Replace trade filter condition with an assertion
This commit is contained in:
parent
8a0355cc98
commit
0bebd31c26
@ -31,8 +31,7 @@ if __name__ == '__main__':
|
|||||||
assert connection_successful(), 'Cannot connect to IBKR. Ensure that TWS or Gateway is running.'
|
assert connection_successful(), 'Cannot connect to IBKR. Ensure that TWS or Gateway is running.'
|
||||||
|
|
||||||
now = datetime.now(timezone(eastern_timezone))
|
now = datetime.now(timezone(eastern_timezone))
|
||||||
if all(filter.trade_allowed(now) for filter in trade_filters):
|
assert all(filter.trade_allowed(now) for filter in trade_filters), 'Trade filters prevent trading today.'
|
||||||
print('Trade filters allow for trading today.')
|
|
||||||
|
|
||||||
entry_times = getenv('ENTRY_TIMES').split(',')
|
entry_times = getenv('ENTRY_TIMES').split(',')
|
||||||
for entry_time in entry_times:
|
for entry_time in entry_times:
|
||||||
@ -51,5 +50,3 @@ if __name__ == '__main__':
|
|||||||
while True:
|
while True:
|
||||||
schedule.run_pending()
|
schedule.run_pending()
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
else:
|
|
||||||
print('Trade filters prevent trading today.')
|
|
Loading…
Reference in New Issue
Block a user