Skip to content

Commit

Permalink
Normalise is_live_trading() across classes - more cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
miohtama committed Oct 24, 2024
1 parent 427d748 commit 29de2b0
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions tradeexecutor/strategy/execution_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ class ExecutionMode(enum.Enum):
def is_live_trading(self) -> bool:
"""Are we trading real time?
- For live trading, we are operating on real-time price feeds based on `required_history_period` distance,
instead of explicit start and end dates of backtesting
- Preflight check is considered live trading, because strategy modules
are not in backtesting when doing preflight checks
"""
Expand Down Expand Up @@ -235,13 +238,7 @@ def has_visualisation(self) -> bool:
def live_trading(self) -> bool:
"""Are we doing live trading.
This is a bit trickier, as live trading itself can have different phases
with different execution modes.
:return:
True if we doing live trading, one off operation, unit test live trade checks or paper trading.
False if we are operating on backtesting data, or unit testing.
See :py:method:`ExecutionMode.is_live_trading`.
"""
return self.mode.is_live_trading()

Expand Down

0 comments on commit 29de2b0

Please sign in to comment.