DefaultTradingStrategyUniverseModel#

tradeexecutor.strategy.trading_strategy_universe.DefaultTradingStrategyUniverseModel class.

class DefaultTradingStrategyUniverseModel[source]#

Bases: TradingStrategyUniverseModel

Shortcut for simple strategies.

  • Assumes we have a strategy that fits to tradeexecutor.strategy_module definiton

  • At the start of the backtests or at each cycle of live trading, call the create_trading_universe callback of the strategy

  • Validate the output of the function

__init__(client, execution_context, create_trading_universe, candle_time_frame_override=None)[source]#
Parameters

Methods

__init__(client, execution_context, ...[, ...])

check_data_age(ts, universe, ...)

Check if our data is up-to-date and we do not have issues with feeds.

construct_universe(ts, mode)

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

create_from_dataset(dataset, chains, ...[, ...])

Create an trading universe from dataset with zero filtering for the data.

load_data(time_frame, mode[, ...])

Loads the server-side data using the client.

log_universe(universe)

Log the state of the current universe.]

preload_universe()

Triggered before backtesting execution.

__init__(client, execution_context, create_trading_universe, candle_time_frame_override=None)[source]#
Parameters
preload_universe()[source]#

Triggered before backtesting execution.

  • Load all datasets with progress bar display.

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

construct_universe(ts, mode)[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

TradingStrategyUniverse