ExecutionMode#

tradeexecutor.strategy.execution_context.ExecutionMode class.

class ExecutionMode[source]#

Bases: Enum

Different execution modes the strategy engine can hvae.

__init__()#

Methods

is_live_trading()

Are we trading real time?

is_fresh_data_always_needed()

Should we purge caches for each trade cycle.

is_unit_testing()

Are we executing unit tests.

Attributes

real_trading

We are live trading with real assets

paper_trading

We are live trading with mock assets TODO: This mode is not yet supported

backtesting

We are backtesting When backtesting mode is selected, we can skip most of the statistical calculations that would otherwise be calculated during live-trade.

data_preload

We are loading and caching datasets before a backtesting session can begin.

unit_testing_trading

We are operating on real datasets like real_trading but we do not want to purge caches.

simulated_trading

Simulated trading: Blockchain we are connected is not real.

preflight_check

Prefilight checks

real_trading = 'real_trading'#

We are live trading with real assets

paper_trading = 'paper_trading'#

We are live trading with mock assets TODO: This mode is not yet supported

backtesting = 'backtesting'#

We are backtesting When backtesting mode is selected, we can skip most of the statistical calculations that would otherwise be calculated during live-trade. This offers great performance benefits for backtesting.

data_preload = 'data_preload'#

We are loading and caching datasets before a backtesting session can begin. We call create_trading_universe() and assume tradingstrategy.client.Client class is set to a such state it can display nice progress bar when loading data in a Jupyter notebook.

unit_testing_trading = 'unit_testing_trading'#

We are operating on real datasets like real_trading but we do not want to purge caches.

This mode is specially used to test some live trading features.

simulated_trading = 'simulated_trading'#

Simulated trading: Blockchain we are connected is not real.

We are trading against a simulated step-by-step blockchain like EthereumTester. This allows us to control block production, but otherwise behave as live trading.

In this mode, we are also not using any dataset loading features, but the trading universe and price feeds are typed in the test code.

preflight_check = 'preflight_check'#

Prefilight checks

In this execution mode, we are invoked from the command line to check that all of our files and connections are intact.

is_live_trading()[source]#

Are we trading real time?

Return type

bool

is_fresh_data_always_needed()[source]#

Should we purge caches for each trade cycle.

This will force the redownload of data on each cycle.

is_unit_testing()[source]#

Are we executing unit tests.

Return type

bool