ib_async icon indicating copy to clipboard operation
ib_async copied to clipboard

cancelMktDepth don't cancel ...!

Open Fauche opened this issue 6 months ago • 1 comments

I have a code with try to switch between subscription to marketDepth because only 3 are possibles So I have a function:

    def abonnement(self, fxSymbol='EURUSD'):
        contract = Forex(fxSymbol)
        if self.contractActif != contract and self.contractActif != None:
            self.ib.cancelMktDepth(self.contractActif)     # IB line 1524   
        ticker = self.ib.reqMktDepth(contract)
        ticker.updateEvent += self.onDepthUpdate
        self.contractActif = contract

but when trying to change fxSymbol: cancelMktDepth: No reqId found for contract Forex('EURUSD', exchange='IDEALPRO')

and when looking at results I can see that old contract continue to be updated ... with the new one

Where is the problem ? thanks

Fauche avatar May 19 '25 17:05 Fauche

Humm ! May be it is because I have another client (the "working" one) connected to the same symbol, so when requesting by the other process (the "test" one) for the same symbol, IBgateway just share the data but don't make another subscription so reqId is the one of the first client and the second process don't recognize it. I test with Symbol different from the first process and it seems working with no error message. Data continue to be updated probably because of ticker.updateEvent ... I search more.

Fauche avatar May 19 '25 18:05 Fauche