BacktestEquityPosition¶
-
class
qf_lib.backtesting.portfolio.backtest_equity_position.
BacktestEquityPosition
(ticker: qf_lib.common.tickers.tickers.Ticker)[source]¶ Bases:
qf_lib.backtesting.portfolio.backtest_position.BacktestPosition
Methods
It tells us what is the Market Value of the position.
It tells us what is the total exposure of the position to the market in currency units
-
market_value
() → float[source]¶ It tells us what is the Market Value of the position.
- For cash securities (Equities, Bonds, ETFs, etc)
It represents the value of the position (quantity * price) which is equal to the amount we could receive when we close the position
- For margin securities (Futures, Options)
It represents the P&L of the position. So right after we buy a future contract its market_value is 0. It also represents the cash we could receive when we liquidate the position
- Different behaviour comes form the fact that when we buy cash security we need to spend cash
(cash is removed from the portfolio)
- However, when we buy a margin instrument (for example future contract) our cash is intact,
we only secure the margin which is not deducted from the cash we have.
-
total_exposure
() → float[source]¶ It tells us what is the total exposure of the position to the market in currency units
- For cash securities (Equities, Bonds, ETFs, etc)
It represents the value of the position (quantity * price)
- For margin securities (Futures, Options)
It represents Notional of the position (quantity * price * contract size)
-