Skip to content

Commit

Permalink
updated _handle_authentication_status to handle 'competing' flag
Browse files Browse the repository at this point in the history
  • Loading branch information
Voyz committed Sep 6, 2024
1 parent f8e09a4 commit e406074
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions ibind/client/ibkr_ws_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,15 +367,17 @@ def _handle_account_update(self, message, data):
def _handle_authentication_status(self, message, data):
self._handle_unsolicited_message(IbkrWsKey.AUTHENTICATION_STATUS, data)

if 'authenticated' not in data:
_LOGGER.info(f'{self}: Unknown status response: {message}')
return

if data.get('authenticated') == False:
_LOGGER.error(f'{self}: Status unauthenticated: {data}')
if 'authenticated' in data:
if data.get('authenticated') == False:
_LOGGER.error(f'{self}: Status unauthenticated: {data}')
self._login()
else:
self._logged_in = True
elif 'competing' in data and data.get('competing') == True:
_LOGGER.error(f'{self}: Status competing: {data}')
self._login()
else:
self._logged_in = True
_LOGGER.info(f'{self}: Unknown status response: {message}')

def _handle_bulletin(self, message): # pragma: no cover
self._handle_unsolicited_message(IbkrWsKey.BULLETINS, message)
Expand Down

0 comments on commit e406074

Please sign in to comment.