Printing Halted symbols to console
Hey guys, I am trying to print symbols that have been halted during trading hours to the console. I am using the on_trade method and the documentation says that the sales conditions that you can use in conjunction with md.L1.trade_condition are as follows.
1 is a stoped stock
# 5 is reopening
# 'O' opening prints
# '6' closing prints
The below is my code and I am getting the error back KeyError: 'trade_condtion'. (As a side note I received the same error if I try to print self.symbol as well.)
def on_trade(self, event, md, order, service, account):
if '5' in md.L1.trade_condtion:
print(md.symbol)
else:
pass
I also tried the below which gave me the same error.
def on_trade(self, event, md, order, service, account):
if md.L1.trade_condtion == ['5']:
print(md.symbol)
else:
pass
and
def on_trade(self, event, md, order, service, account):
if md.L1.trade_condtion == ['5']:
print(md.symbol)
else:
pass
Finally the def on_trading_halt and def_on_trading_resume methods are disabled even in the elite simulator. So, that was not a viable work around.
Any suggestions on proper syntax here?
Thanks
Comments
Looks like a typo... you are missing an 'i' in 'trade_condition'