ValuationModel#
API documentation for tradeexecutor.strategy.valuation.ValuationModel Python class in Trading Strategy framework.
- class ValuationModel[source]#
Bases:
ABC
Revalue an open position.
Each protocol has its own way to value the position: how much free cash we will receive if we close the position.
Spot positions are valued at their sell price - fees
Loan based positions are valued at the loan NAV
- __init__()#
Methods
__init__
()- abstract __call__(ts, position)[source]#
Set the new position value and reference price for an asset.
The implementation must check if the position protocol is correct for this valuation model.
The implementation must update
valuation_updates
The implementation must set legacy
last_token_price
andlast_pricing_at
variables.
- Parameters:
ts (datetime) – When to revalue. Used in backesting. Live strategies may ignore.
position (TradingPosition) – Open position
- Returns:
(revaluation date, position net value) tuple. Note that revaluation date may differ from the wantead timestamp if there is no data available.
- Return type: