calculate_asset_weights#

API documentation for tradeexecutor.analysis.weights.calculate_asset_weights Python function.

calculate_asset_weights(state)[source]#

Get timeline of asset weights for a backtest.

  • Designed for visualisation / human readable output

  • Might not handle complex cases correctly

Returns:

Pandas Series of asset weights

  • (DateTime, asset symbol) MultiIndex

  • USD value of the asset in the portfolio in the given time

Parameters:

state (State) –

Return type:

Series