Re: eroor 322 errorMsg "Error processing request.-'bW' : cause - Duplicate ticker id"
Hi Liu,
The "counter" variable is initialized at a higher scope (not within the for-each loop).
This means that multiple parallel for-each executions are working against the same instance of that variable.
Depending on race conditions, this might lead to incorrect functioning of your logic.
Cheers,
Dmitry
toggle quoted message
Show quoted text
Hello
I am getting an duplicate ticker id error, however I already have a unique id for each request,
I have uploaded a screenshot of my snippet of code
when I comment out this code it works fine, I have tried commenting out contract.conid and using contract.tradingclass instead of contract.symbol but these did not solve the problem, the full message in debug shows?
? ? ? ? ? ? ? foreach (var strike in strikes) ? ? ? ? ? ? ? ?{ ? ? ? ? ? ? ? ? ? ?foreach (var expire in expirations) ? ? ? ? ? ? ? ? ? ?{ ? ? ? ? ? ? ? ? ? ? ? ?Contract contract = new Contract(); ? ? ? ? ? ? ? ? ? ?contract.ConId = underlyingConId; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? contract.TradingClass = tradingClass; ? ? ? ? ? ? ? ? ? ? contract.Exchange = "SMART"; ? ? ? ? ? ? ? ? ? ?contract.Currency = "USD"; ? ? ? ? ? ? ? ? ? ?contract.SecType = "OPT"; ? ? ? ? ? ? ? ? ? ?contract.Right = "CALL"; ? ? ? ? ? ? ? ? ? ?contract.Multiplier = "100"; ? ? ? ? ? ? ? ? ? ? contract.Strike = strike; ?? ? ? ? ? ? ? ? ? ? ? ? ?contract.LastTradeDateOrContractMonth = expire; ? ? ? ? ? ? ? ? ? ? ? ?// Create a new TagValue List object (for API version 9.71) ? ? ? ? ? ? ? ? ? ? ? ?List<TagValue> mktDataOptions = new List<TagValue>(); ? ? ? ? ? ? ? ? ? ?clientSocket.reqMarketDataType(3); ? ? ? ? ? ? ? ?clientSocket.reqMktData(reqId + counter, contract, "", false, false, mktDataOptions);? ? ? ? ? ? ? ? ? ? ? ? ?counter = counter + 1; ? ? ? ? ? ? ? ? ? ?}
Are you sure you wish to delete this message from the message archives of
[email protected] ?
This cannot be undone.
Are you sure you wish to repost this message?