Exemple #1
0
    def ib_conn(self):
        ib_conn = getattr(self, "_ib_conn", arg_not_supplied)
        if ib_conn is arg_not_supplied:
            ib_conn = connectionIB(log=self.log, mongo_db=self.mongo_db)
            self._ib_conn = ib_conn

        return ib_conn
Exemple #2
0
    def ib_conn(self):
        ib_conn = getattr(self, "_ib_conn", arg_not_supplied)
        if ib_conn is arg_not_supplied:

            ## default to tracking ID through mongo change if required
            self.add_class_object(mongoIbBrokerClientIdData)
            client_id = self.db_ib_broker_client_id.return_valid_client_id()
            ib_conn = connectionIB(client_id, log=self.log)
            self._ib_conn = ib_conn

        return ib_conn
 def _get_new_ib_connection(self) -> connectionIB:
     # Try this 5 times...
     attempts = 0
     failed_ids = []
     client_id = self._get_next_client_id_for_ib()
     while True:
         try:
             ib_conn = connectionIB(client_id, log=self.log)
             for id in failed_ids:
                 self.db_ib_broker_client_id.release_clientid(id)
             return ib_conn
         except Exception as e:
             failed_ids.append(client_id)
             client_id = self._get_next_client_id_for_ib()
             attempts += 1
             if attempts > 5:
                 for id in failed_ids:
                     self.db_ib_broker_client_id.release_clientid(id)
                 raise e
Exemple #4
0
    def _get_new_ib_connection(self) -> connectionIB:
        client_id = self._get_next_client_id_for_ib()

        ib_conn = connectionIB(client_id, log=self.log)
        return ib_conn