Closed emretezel closed 1 year ago
Discussed here. Not techically an error.
I think I've tracked down the cause of this problem.
1) Request contract details from IB 2) Contract not found 3) Attempt to handle error 4) _get_log_for_contract (ib_client, 138) 5) Try to request contract details again (ib_client, 198)
You used to just grab the IB symbol from the contract object, then reverse lookup to get the instrument symbol
I assume you changed that to support different instruments having the same IB symbol.
You already have an IB contract object, so it seems like you should be able to get what you need from there, then lookup the instrument symbol from config. I'm not sure why you are trying to request contract details from IB (and that seems like a lot of overhead just to log an error).
I wasn't sure if the ib contract object would already include the exchange
OK if you get the contract object eg from positions, it certainly doesn't include the exchange. You need to reqContractDetails.
I've implemented another fix for this, but @tgibson11 won't like it .. it involves return missing_contract rather than raising an exception if the instrument isn't found in the config.
Think it's fixed now.
Yeah...I don't like this fix.
I would have preferred to make the reverse lookup from config smarter: you don't ALWAYS need all those attributes.
Well..... I'm happy to hear suggestions.
I may look into it some more today if I have time.
I also have an error backing up historic contract positions that I want to figure out first.
I just checked something in that might fix that backup
It also seems like this doesn't fix the original problem.
You can verify by running update_sampled_contracts.
The "server" side of the IB client receives an error from the Gateway regardless of how you handle exceptions in pysystemtrade. It's the second attempt to call reqContractDetails that is the problem (the attempt itself - not how you handle the result).
I will definitely look at this more.
Question: the BEST solution IMO, would be avoid all this in the first place by not having to jump through hoops to get a logger. What are your thought on that? Maybe include the ibContract object in the message, but don't worry about setting all the log attributes in this case?
I just checked something in that might fix that backup
Thanks. Will check it out.
It also seems like this doesn't fix the original problem.
You can verify by running update_sampled_contracts.
The "server" side of the IB client receives an error from the Gateway regardless of how you handle exceptions in pysystemtrade. It's the second attempt to call reqContractDetails that is the problem (the attempt itself - not how you handle the result).
I will definitely look at this more.
Question: the BEST solution IMO, would be avoid all this in the first place by not having to jump through hoops to get a logger. What are your thought on that? Maybe include the ibContract object in the message, but don't worry about setting all the log attributes in this case?
Well the original intention here was to be able to label error messages with the correct instrument code, rather than the IB contract. But it does seems like that is more trouble than it's worth.
I just checked something in that might fix that backup
First problem fixed, but now similar problem for strategy positions
Correction: the error is still on historic contracts.
Traceback (most recent call last):
File "/home/todd/pysystemtrade/sysproduction/linux/scripts/run.py", line 67, in
I've decided to just pull the functionality, so no log is created.
@tgibson11 think that's also fixed now.
I like how the log message comes out now. It seems like a good tradeoff for the reduced complexity, IMO.
Have the changes been pushed to master, still getting original error message when for example updating sampled contracts.
No, it is only in develop. But develop is in pretty good working order right now. Should be safe to grab if you want to.
Hi Everyone,
On the latest master branch receiving the following error when seeing prices from IB