reverse_trading_universe_from_state#

reverse_trading_universe_from_state(state, client, time_bucket, overlook_period=datetime.timedelta(days=7), data_range_mode=DataRangeMode.trades)[source]#

Reverse-engineer trading universe from an existing execution state.

  • Exchanges are filtered down the set that the trading execution state already has

  • Pairs are filtered down the set that the trading execution state already has

  • We may leak extra pairs, because we do not do strict (chain, pair address) tuple checks and some pairs have duplicate address across chains

  • Exchanges are not filtered, but contain the whole set of available exchanges

  • No backtest stop loss data is loaded

  • No liquidity data is loaded

Note

Trading data granularity, or time bucket, may be different that the strategy originally used.

Parameters:
  • state (State) – The trade executor state

  • client (Client) – Client used to downlaod the data

  • time_bucket (TimeBucket) – Granularity of the candle data

  • overlook_period (timedelta) –

    We load candle data for the duration of trades in the portfolio.

    We add +/- overlook_period to the data range.

  • data_range_mode (DataRangeMode) – Is this for visualising the latest technical indicators, or old executed trades.

Returns:

A trading universe containing data for all trading pairs

Return type:

TradingStrategyUniverse