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

abstract __call__(ts, position)[source]#

Set the new position value and reference price for an asset.

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:

ValuationUpdate