Portfolio¶
-
class
qf_lib.backtesting.portfolio.portfolio.
Portfolio
(data_handler: qf_lib.backtesting.data_handler.data_handler.DataHandler, initial_cash: float, timer: qf_lib.common.utils.dateutils.timer.Timer)¶ Bases:
object
Methods
Leverage = GrossPositionValue / NetLiquidation
Returns a timeseries of value of the portfolio expressed in currency units
Returns a QFDataFrame containing summary of the positions in the portfolio for each day.
transact_transaction
(transaction)Adjusts positions to account for a transaction.
update
([record])Updates the value of all positions that are currently open by getting the most recent price.
-
leverage_series
() → qf_lib.containers.series.qf_series.QFSeries¶ Leverage = GrossPositionValue / NetLiquidation
-
portfolio_eod_series
() → qf_lib.containers.series.prices_series.PricesSeries¶ Returns a timeseries of value of the portfolio expressed in currency units
-
positions_history
() → qf_lib.containers.dataframe.qf_dataframe.QFDataFrame¶ Returns a QFDataFrame containing summary of the positions in the portfolio for each day.
-
transact_transaction
(transaction: qf_lib.backtesting.portfolio.transaction.Transaction)¶ Adjusts positions to account for a transaction. Handles any new position or modification to a current position
-
update
(record=False)¶ Updates the value of all positions that are currently open by getting the most recent price. The function is called at the end of the day (after market close) and after each executed transaction. If the flag record is set to True, it records the current assets values and the portfolio value (this is performed once per day, after the market close).
-