Break between db and broker #836
-
Got a break message on the reconcile report, that is causing me some headache. Posting here in the hopes of getting some pointers / input; I have two problems;
but first, here is my issue; My reconcile report issue
(the snippet is reduced to the three contracts where break occurs) My reading of the problem is that the contract date in the db is inconsistent with the contract date from IB. 1) Do not understand why the contract date is changing on a contract with a position onMy reports are commited to git every day. Looking at the reconcile report generated the day before - everything is fine;
This has never happened before. I did merge from pysystemtrade on the 9th of november. Other than that nothing has changed in the production code. Only reason I can think of. 2) not sure how to fix.Looking at the in the Not sure this assumption is correct however - because looking into the
which is consitent with what is stated in the broker section of the reconcile report, not the db section. I was hoping to correct the contract date in the db, but now I am not sure how to correct this issue. Any input would be greatly appreciated!! |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 5 replies
-
Perhaps confusingly, the dates in 'positions in DB' are actually coming from IB. Follow the logic:
This is done to avoid the edge case when an expiry date hasn't been updated in the database. (We can have a further discusison about how likely this is, and whether the unexpected nature of this behaviour is worth changing it) So what has probably happened is that IB has provided a different contract expiry date for the same contract within a minute or so. I've actually seen this behaviour myself this morning with a different instrument. If you rerun the report it should hopefully work. |
Beta Was this translation helpful? Give feedback.
-
Strangely, I just got this same error tonight. Have held the SOYBEAN_mini for a couple weeks with no breaks until tonight.
The "Position DB", which had been 03-14-2023 all along changed to 03-01-2023, presumably getting that from IB? After reading this thread, I tried running the a reconcile report twice more and got the same result. I checked my IB config and it was on the latest version and the specific SOYBEAN_mini config was ok. I also saw the same sort of error as Tobias did in the reconcile report.
And this is from the IB Gateway API log when running update_sampled_contracts
I'll rerun the report Saturday morning just to see if it corrects itself. Maybe it's an IB issue. I'll post if it fixes itself. By the way, what will the system try to do on Monday? Will it try to "correct" the break and buy a March 2023 contract again? If so, what do I need to do to prevent this? Thanks! |
Beta Was this translation helpful? Give feedback.
-
I can confirm, doing the changes to the exchanges fixes the issue. as an example : |
Beta Was this translation helpful? Give feedback.
-
I've updated the config, although I need to test as wave 4 is a bit vague. (A good way to test this is to run get all trading hours as that will poll all the instruments) |
Beta Was this translation helpful? Give feedback.
Perhaps confusingly, the dates in 'positions in DB' are actually coming from IB. Follow the logic:
This is done to avoid the edge case when an expiry date hasn't been updated in the database.
(We can have a further discusison about how likely this is, and whether the unexpected nature of this behaviour is worth changing it)
So what has probably happened is that IB has provided a different contract expiry date for the same contract within a minute or so.…