build_expected_asset_map#

API documentation for tradeexecutor.strategy.asset.build_expected_asset_map Python function.

build_expected_asset_map(portfolio, pair_universe=None, universe_enumaration_threshold=20)[source]#

Get list of tokens that the portfolio should hold.

Parameters:
  • portfolio (Portfolio) – Current portfolio

  • pair_universe (PandasPairUniverse) –

    If given, enumerate all pairs here as well.

    We might have balance on an asset we have not traded yet, causing accounting incorrectness.

  • universe_enumaration_threshold

    Max pairs per universe before we do auto enumation.

    Prevent denial of service on open-ended universes > 100 pairs.

Returns:

Token -> (Amount, positions hold across mappings)

Return type:

Dict[AssetIdentifier, AssetToPositionsMapping]