ExecutionContext#

tradeexecutor.strategy.execution_context.ExecutionContext class.

class ExecutionContext[source]#

Bases: object

Information about the strategy execution environment.

This is passed to create_trading_universe and couple of other functions and they can determine and take action based the mode of strategy execution.

__init__(mode, timed_task_context_manager)#
Parameters
Return type

None

Methods

__init__(mode, timed_task_context_manager)

Attributes

live_trading

Are we doing live trading.

mode

What is the current mode of the execution.

timed_task_context_manager

Python context manager for timed tasks.

mode: ExecutionMode#

What is the current mode of the execution.

timed_task_context_manager: Callable#

Python context manager for timed tasks. Functions can use this context manager to add them to the tracing. Used for profiling the strategy code run-time performance. See tradeexecutor.utils.timer.

property live_trading: bool#

Are we doing live trading.

Returns

True if we doing live trading or paper trading.

False if we are operating on backtesting data.

__init__(mode, timed_task_context_manager)#
Parameters
Return type

None