Skip to content

Commit

Permalink
redefining time.sleep in the run method of strategy executor
Browse files Browse the repository at this point in the history
  • Loading branch information
SlimBeji committed Mar 11, 2021
1 parent e6f3dc9 commit 6ec9968
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lumibot/strategies/strategy_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ def __init__(self, strategy):
self.minutes_before_closing = self.strategy.minutes_before_closing
self.result = {}

# Overloading the default time.sleep method
# In case a user is using it for backtesting
time.sleep = self.safe_sleep

@property
def name(self):
return self.strategy._name
Expand Down Expand Up @@ -261,6 +257,10 @@ def _run_trading_session(self):
self._after_market_closes()

def run(self):
# Overloading the default time.sleep method
# In case a user is using it for backtesting
time.sleep = self.safe_sleep

self._initialize()
while self.broker.should_continue() and self.should_continue:
try:
Expand Down

0 comments on commit 6ec9968

Please sign in to comment.