-
Notifications
You must be signed in to change notification settings - Fork 849
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LME Contracts Issue? #1403
Comments
I also verified I have correct price data until a few days ago 2024-08-30 23:00:00 17035.0 17035.0 16750.0 16750.0 1.0 |
I don't have an explanation but I can verify that I have seen the same issue, although I only noticed it just now in the Status report.
|
I also see this issue. Per IB UK website: residents of the US, Canada, Hong Kong, and Israel are not permitted to trade LME futures. (I also saw Singapore mentioned elsewhere.) That doesn't necessarily mean we aren't allowed to get price data from LME, but maybe this has something to do with it. Someone would probably have to contact IB support for a definitive answer. In any case, this almost certainly isn't a pysystemtrade issue. A discussion would be more appropriate. |
In TWS, I do indeed see multiple expiries in a given month, so maybe that is the only issue. |
All contracts look basically the same though. I can't see how you would identify one of them as monthly. Per the website I linked above, the contracts expiring on the 3rd Wednesday of the month are the most liquid. Code would need to be added here to identify the "monthly" contracts. |
I've added code to my repo that fixes this. After updating contracts, contract prices, multiple & adjusted prices, all my LME contracts are now up-to-date. If anyone wants to make the change themselves, see this commit and this one. The "is this the third Wednesday?" logic is a bit of a hack. It's really just checking if the contract expires on the third Monday, Tuesday, Wednesday, Thursday, or Friday. It seems to be working fine for now, but could be made more precise if necessary or desired. I can create a PR if @robcarver17 is willing to merge it. |
@tgibson11 Thank you for verifying these contracts could not be traded for US investors. I did not see that notification and will add them to trading_restrictions in private_config.yaml Definitely helpful to know it's not worth paying the $65 data fee! ` trading_restrictions: I wonder if we could effectively swap for similar availables? For example ALUMINUM, COPPER (or _mini, _micro), |
Thanks again @tgibson11 - I deleted my previous comment. Confirmed that your code changes resolve the issue and I was able to successfully update_sampled_contracts. |
Issue #1403 ignore LME weekly contracts
Fixed by #1431 |
Recently I've been getting errors for a failure to find various LME contracts:
{'component': 'ibFuturesContractData', 'instrument_code': 'NICKEL_LME', 'contract_date': '20241100'} Error! Cannot find active contract! Expired? interactive_update_roll_status.py not executed?
I noticed this output in run_stack_handler:
2024-09-10 13:10:19 WARNING stack_handler {'component': 'ibFuturesContractData'} futuresInstrumentWithIBConfigData(instrument=NICKEL_LME, ib_data=symbol='NI', exchange='LMEOTC', currency='USD', ibMultiplier='6.0', priceMagnifier='1.00', ignoreWeekly='False', effective_multiplier='6.00') could not resolve contracts: NICKEL_LME has multiple plausible contracts but is not set to ignoreWeekly in IB config file
2024-09-10 13:10:19 WARNING stack_handler {'component': 'ibFuturesContractData', 'instrument_code': 'NICKEL_LME', 'contract_date': '20241100'} Contract is missing can't get expiry
2024-09-10 13:10:19 DEBUG stack_handler {'component': 'ibFuturesContractData', 'instrument_code': 'NICKEL_LME', 'contract_date': '20241100'} Can't resolve contract
2024-09-10 13:10:19 CRITICAL stack_handler {'component': 'ibFuturesContractData', 'instrument_code': 'NICKEL_LME', 'contract_date': '20241100'} Error! Cannot find active contract! Expired? interactive_update_roll_status.py not executed?
The error suggests that ignoreWeekly may resolve the issue, but I had not seen this before. Barchart and the LME website do not list multiple November LME contracts.
Thank you for any help.
The text was updated successfully, but these errors were encountered: