Not able to get all contracts for a given instrument #572
-
I am not getting all of the contracts needed to generate the small multiple prices history missing from the updated repo data. I have the same issue in all of the four instruments; Example; MILKWET has 202207 as the forward contract at the last line of the multiple prices repo data. I have done the for completeness;
I thought about the I have tried my darndest to find a class that I can use to pull the missing contract, but I have to admit that the code is on a higher level then my python skills. The abstraction is hard to see through. (honestly Rob's book excerpt with the punch line "apologies for my size" keeps popping up in my mind at the moment - size of my intellect that is) I am keen og getting the paper trading up and running as fast as possible - and so I am going to attempt to import the needed prices from barchart - but this problem might well be a re-ocurring issue - and so I thought I would ask if anyone has any insight on the matter - would be very much appreciated! |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 6 replies
-
Update sampled contracts just adds contracts to the database. If you want to update prices of individual contracts you need This would also be done by |
Beta Was this translation helpful? Give feedback.
-
A small FYI to anyone wanting to pull daily prices from barchart like I did - The barchart .csv time stamp only contained a date part, no time stamp. When I first importet I could not update multiple prices because of this. In addition to the date, the daily prices needs the 23:00 time prat. A small script to add the time part to the .csv did the trick. I wrote a script for this, but my first try was to add this to the csv reader class, which was a hopeless thought. It should be handled separately on the .csv itself before the csv is read. By the time I realized this I did not want to spend more time on the matter (because, not sure if I mentioned this, but I really want to get up and running with pysystemtrade) and so I settled on a very hacky script that is not fit for publication. Once I have more time - I can get back to this and publish. |
Beta Was this translation helpful? Give feedback.
-
Does the update prices script try and get a price for say MILKWET 202207? And when it does, what error does IB throw back? For example
If you don't see the first line, then there is a problem with the hold / roll cycle configuration (which seems unlikely) or update sampled contracts hasn't worked properly. If you see the first line, but then get an error, then the problem is getting data from IB. |
Beta Was this translation helpful? Give feedback.
-
'Manual mode' I ran |
Beta Was this translation helpful? Give feedback.
-
As far as I know you can get contract dates for an instrument without having a price subscription. You might want to double check it is an IB problem by trying to get the price in the underyling API: https://nbviewer.org/github/erdewit/ib_insync/blob/master/notebooks/bar_data.ipynb |
Beta Was this translation helpful? Give feedback.
-
I found the issue; IBKR was blocking the request due to a missing trading permission. I did not get any hints from the API error repsonse;
But logging into the web UI and entering the contract into the order registration form I noticed an alert box saying I did not have trading permissions for this instrument. I set this up a while back and did not think to check Japan at the time. Had some other "holes" in the permissions as well. Requested permission, recieved them almost immediately, and now I am able to download the data. So, to recap; Even though I had bought the data subscription, which should have allowed me to retrieve the price data, IBKR denied the data requests due to lacking trading permissions. I guess it is a bug, but might be a feature?! This might very well explain the fact that I experienced this for other instruments as well, as there are multiple a lot of exchanges listed under the US, where I did not have any permissions. |
Beta Was this translation helpful? Give feedback.
I found the issue; IBKR was blocking the request due to a missing trading permission. I did not get any hints from the API error repsonse;
But logging into the web UI and enter…