UniverseModel#

API documentation for tradeexecutor.strategy.universe_model.UniverseModel Python class in Trading Strategy framework.

class UniverseModel[source]#

Bases: ABC

Create and manage trade universe.

On a live execution, the trade universe is reconstructor for the every tick, by refreshing the trading data from the server.

__init__()#

Methods

__init__()

construct_universe(ts, mode, options[, ...])

On each strategy tick, refresh/recreate the trading universe for the strategy.

preload_universe(universe_options[, ...])

Triggered before backtesting execution.

preload_universe(universe_options, execution_context=None, strategy_parameters=None, execution_model=None)[source]#

Triggered before backtesting execution.

  • Load all datasets with progress bar display

  • Data is saved in FS cache

  • Not triggered in live trading, as universe changes between cycles

Parameters:
abstract construct_universe(ts, mode, options, strategy_parameters=None, execution_model=None)[source]#

On each strategy tick, refresh/recreate the trading universe for the strategy.

This is called in mainloop before the strategy tick. It needs to download any data updates since the last tick.

Parameters:
Return type:

StrategyExecutionUniverse