map_onchain_asset_to_position#

map_onchain_asset_to_position(asset, state)[source]#

Map an on-chain found asset to a trading position.

  • Any reserve currency deposits go to the reserve

  • Any trading position assets go to their respective open trading and frozen position

  • If there are trading position assets and no position is open, then panic

Parameters:
  • asset (AssetIdentifier) – On-chain read token we should make

  • state (State) – The current strategy state

Returns:

The position we think the asset belongs to.

None if there is no reserve, open or frozen positions we know of.

Return type:

tradeexecutor.state.position.TradingPosition | tradeexecutor.state.reserve.ReservePosition | None