Portfolio#
- class qf_lib.backtesting.portfolio.portfolio.Portfolio(data_provider: AbstractPriceDataProvider, initial_cash: float, currency: str | None = None)#
Bases:
object- net_liquidation_in_currency(currency: str = None) float#
Converts the current net liquidation from the portfolio currency into the specified currency
- portfolio_eod_series() PricesSeries#
Returns a timeseries of value of the portfolio expressed in currency units
- positions_history() QFDataFrame#
Returns a QFDataFrame containing summary of the positions in the portfolio for each day.
- transact_transaction(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).