INNER CODE UNIT · Python
onDisconnected
ldt9/PyOptionTrader · models/futures/short_strangle.py:171
def onDisconnected(self):
print(f"{self.get_timestamp()} Disconnect Event")
print(f"{self.get_timestamp()} attempting restart and reconnect...")
self.connect_to_ibkr()
# Update the options chain
def update_options_chains(self):
'''
Update the options chain to get the latest expiration dates and strikes
:return: None
'''
try:
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
print(f"{self.get_timestamp()} Updating Options Chains...")
# Get current options chain