From e406074b8b6ba1ad4435217ccf99a1e838fc97fe Mon Sep 17 00:00:00 2001 From: voyz Date: Fri, 6 Sep 2024 15:56:40 +0200 Subject: [PATCH] updated _handle_authentication_status to handle 'competing' flag --- ibind/client/ibkr_ws_client.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/ibind/client/ibkr_ws_client.py b/ibind/client/ibkr_ws_client.py index 636609f8..a94958f7 100644 --- a/ibind/client/ibkr_ws_client.py +++ b/ibind/client/ibkr_ws_client.py @@ -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)