UniverseOptions#
API documentation for tradeexecutor.strategy.universe_model.UniverseOptions Python class in Trading Strategy framework.
- class UniverseOptions[source]#
Bases:
object
Options that we can pass for the trading strategy universe creation.
Describe the dataset loading options, or override options for the internal testing purposes.
These can be given on the command line, or from the parent execution context. It allows to override parameters given in the strategy file easily without need to edit the file.
The most common use case is to speed up backtesting by decreasing the stop loss check frequency.
The default options do not override anything:
universe_options = UniverseOptions()
See Testing the strategy module how these options are used.
Both backtesting range and live trading history period can be given at the same time. In this case, the loaded data range is determined by
ExecutionMode
.See also
- __init__(start_at=None, end_at=None, history_period=None, candle_time_bucket_override=None, stop_loss_time_bucket_override=None)#
- Parameters:
candle_time_bucket_override (Optional[TimeBucket]) –
stop_loss_time_bucket_override (Optional[TimeBucket]) –
- Return type:
None
Methods
__init__
([start_at, end_at, history_period, ...])from_strategy_parameters_class
(Parameters, ...)Extract backtesting range or live history load range based on if we are doing live trading.
Get the human description of the time range for these universe load options.
Attributes
Override settings defined in the strategy module in unit testing
Optionally passed backtest end time
How much data we look back if we look the current data
Optionally passed backtest start time.
Override settings defined in the strategy module in unit testing
- start_at: Optional[datetime] = None#
Optionally passed backtest start time.
Can be used in create_trading_universe() to set the data range.
- end_at: Optional[datetime] = None#
Optionally passed backtest end time
Can be used in create_trading_universe() to set the data range.
- history_period: Optional[timedelta] = None#
How much data we look back if we look the current data
Give only
history_period
or bothstart_at
andend_at
.
- candle_time_bucket_override: Optional[TimeBucket] = None#
Override settings defined in the strategy module in unit testing
- stop_loss_time_bucket_override: Optional[TimeBucket] = None#
Override settings defined in the strategy module in unit testing
- get_range_description()[source]#
Get the human description of the time range for these universe load options.
- Return type:
- static from_strategy_parameters_class(Parameters, execution_context)[source]#
Extract backtesting range or live history load range based on if we are doing live trading.
- Parameters:
Parameters (Type[StrategyParameters]) –
execution_context (ExecutionContext) –
- Return type:
- __init__(start_at=None, end_at=None, history_period=None, candle_time_bucket_override=None, stop_loss_time_bucket_override=None)#
- Parameters:
candle_time_bucket_override (Optional[TimeBucket]) –
stop_loss_time_bucket_override (Optional[TimeBucket]) –
- Return type:
None