BacktestValuationModel#
API documentation for tradeexecutor.backtest.backtest_valuation.BacktestValuationModel Python class in Trading Strategy framework.
- class BacktestValuationModel[source]#
Bases:
ValuationModelRe-value assets based on their on-chain backtest dataset price.
Each asset is valued at its market sell price estimation.
- __init__(pricing_model)[source]#
- Parameters:
pricing_model (BacktestPricing) –
Methods
__init__(pricing_model)- __init__(pricing_model)[source]#
- Parameters:
pricing_model (BacktestPricing) –
- __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_updatesThe implementation must set legacy
last_token_priceandlast_pricing_atvariables.
- 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: