StrategyModuleInformation#
tradeexecutor.strategy.strategy_module.StrategyModuleInformation Python class in Trading Strategy framework.
- class StrategyModuleInformation[source]#
Bases:
object
Describe elements that we need to have in a strategy module.
The class variables are the same name as found in the Python strategy module. They can be uppercase or lowercase - all strategy module variables are exported as lowercase.
- __init__(path, source_code, trading_strategy_engine_version, trading_strategy_type, trading_strategy_cycle, trade_routing, reserve_currency, decide_trades, create_trading_universe, chain_id=None, backtest_start=None, backtest_end=None, initial_cash=None)#
- Parameters:
path (Path) –
trading_strategy_engine_version (str) –
trading_strategy_type (StrategyType) –
trading_strategy_cycle (CycleDuration) –
trade_routing (TradeRouting) –
reserve_currency (ReserveCurrency) –
decide_trades (DecideTradesProtocol) –
create_trading_universe (CreateTradingUniverseProtocol) –
- Return type:
None
Methods
__init__
(path, source_code, ...[, chain_id, ...])is_version_greater_or_equal_than
(major, ...)Check strategy module for its version compatibility.
validate
()Check that the user inputted variable names look good.
Validate that the module is backtest runnable.
Attributes
Only needed for backtests
Only needed for backtests
Blockchain id on which this strategy operates
Only needed for backtests
Path to the module
The source code of the strategy
trading_strategy_engine_version
trading_strategy_type
trading_strategy_cycle
trade_routing
reserve_currency
decide_trades
If execution_context.live_trading is true then this function is called for every execution cycle.
- source_code: Optional[str]#
The source code of the strategy
Can be set None for strategies that are not public.
- create_trading_universe: CreateTradingUniverseProtocol#
If execution_context.live_trading is true then this function is called for every execution cycle. If we are backtesting, then this function is called only once at the start of backtesting and the decide_trades need to deal with new and deprecated trading pairs.
- chain_id: Optional[ChainId] = None#
Blockchain id on which this strategy operates
Valid for single chain strategies only
- is_version_greater_or_equal_than(major, minor, patch)[source]#
Check strategy module for its version compatibility.
- validate()[source]#
Check that the user inputted variable names look good.
- Raises:
StrategyModuleNotValid – If we could not load/parse strategy module for some reason
- __init__(path, source_code, trading_strategy_engine_version, trading_strategy_type, trading_strategy_cycle, trade_routing, reserve_currency, decide_trades, create_trading_universe, chain_id=None, backtest_start=None, backtest_end=None, initial_cash=None)#
- Parameters:
path (Path) –
trading_strategy_engine_version (str) –
trading_strategy_type (StrategyType) –
trading_strategy_cycle (CycleDuration) –
trade_routing (TradeRouting) –
reserve_currency (ReserveCurrency) –
decide_trades (DecideTradesProtocol) –
create_trading_universe (CreateTradingUniverseProtocol) –
- Return type:
None