Skip to content
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

Retrieving FutureOptionChain from CME URL fails with a 403. #8590

Closed
sukhcs opened this issue Feb 17, 2025 · 1 comment
Closed

Retrieving FutureOptionChain from CME URL fails with a 403. #8590

sukhcs opened this issue Feb 17, 2025 · 1 comment

Comments

@sukhcs
Copy link

sukhcs commented Feb 17, 2025

Expected Behavior

Retrieving FutureOptionChain using the following, fails with a 403. This should have returned 200.
The following filter was used in the initialize block of the algorithm
self.add_future_option(self._mes.symbol, lambda option_filter_universe: option_filter_universe.naked_put(21, 0))

This in-turns calls a CME URL from LiveOptionChainProvider.cs : https://www.cmegroup.com/CmeWS/mvc/ProductSlate/V2/List?pageNumber=1&sortAsc=false&sortField=rank&searchString=MES&pageSize=5

that should pass with 200, but instead returns 403.

Actual Behavior

The actual behavior is getting a 403, when a call to CME is made to get future option chain info for MES options

   at QuantConnect.Lean.Engine.DataFeeds.LiveOptionChainProvider.GetFutureOptionContractList(Symbol futureContractSymbol, DateTime date)+MoveNext() in **Engine/DataFeeds/LiveOptionChainProvider.cs:line 165**
←[39;49m←[39;49m←[31m20250217 03:58:01.057 ERROR:: <GetFutureOptionContractList>d__13.MoveNext(): Failed to retrieve futures options chain from CME, retrying (3 / 5) System.Net.Http.HttpRequestException: Response status code does not
indicate success: 403 (Forbidden).

Potential Solution

Fix any http header /param that is expected by the CME site and is being missed.

A direct call to the URL using a chrome browser returns 200/and informaiton
URL: https://www.cmegroup.com/CmeWS/mvc/ProductSlate/V2/List?pageNumber=1&sortAsc=false&sortField=rank&searchString=MES&pageSize=5

But this call fails when called from a Lean Docker Instance

Reproducing the Problem

def initialise:
self._mes = self.add_future(Futures.Indices.MICRO_SP_500_E_MINI, Resolution.TICK, extended_market_hours=True)
self.add_future_option(self._mes.symbol, lambda option_filter_universe: option_filter_universe.naked_put(21, 0))

System Information

Running in docker container on Windows host.

Checklist

  • [Y ] I have completely filled out this template
  • [ Y] I have confirmed that this issue exists on the current master branch
  • [ Y] I have confirmed that this is not a duplicate issue by searching issues
  • [Y] I have provided detailed steps to reproduce the issue

20250217 03:57:31.741 TRACE:: LiveTradingDataFeed.CreateUniverseSubscription(): Creating option chain universe: MES 1S4|MES YQYHC5L1GPA9
20250217 03:57:31.743 TRACE:: DataManager.AddSubscription(): Added ?MES21H25,#0,MES21H25,Minute,ZipEntryName,Quote,Raw,OpenInterest. Start: 2/17/2025 3:57:31 AM. End: 12/31/2050 12:00:00 AM
[39;49m←[31m20250217 03:58:00.401 ERROR:: <GetFutureOptionContractList>d__13.MoveNext(): Failed to retrieve futures options chain from CME, retrying (1 / 5) System.Net.Http.HttpRequestException: Response status code does not indicate
success: 403 (Forbidden).
   at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
   at QuantConnect.Lean.Engine.DataFeeds.LiveOptionChainProvider.GetFutureOptionContractList(Symbol futureContractSymbol, DateTime date)+MoveNext() in Engine/DataFeeds/LiveOptionChainProvider.cs:line 165
←[39;49m←[39;49m←[31m20250217 03:58:00.561 ERROR:: <GetFutureOptionContractList>d__13.MoveNext(): Failed to retrieve futures options chain from CME, retrying (2 / 5) System.Net.Http.HttpRequestException: Response status code does not
indicate success: 403 (Forbidden).
   at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
   at QuantConnect.Lean.Engine.DataFeeds.LiveOptionChainProvider.GetFutureOptionContractList(Symbol futureContractSymbol, DateTime date)+MoveNext() in Engine/DataFeeds/LiveOptionChainProvider.cs:line 165
←[39;49m←[39;49m←[31m20250217 03:58:01.057 ERROR:: <GetFutureOptionContractList>d__13.MoveNext(): Failed to retrieve futures options chain from CME, retrying (3 / 5) System.Net.Http.HttpRequestException: Response status code does not
indicate success: 403 (Forbidden).
   at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
   at QuantConnect.Lean.Engine.DataFeeds.LiveOptionChainProvider.GetFutureOptionContractList(Symbol futureContractSymbol, DateTime date)+MoveNext() in Engine/DataFeeds/LiveOptionChainProvider.cs:line 165
←[39;49m←[39;49m←[31m20250217 03:58:01.567 ERROR:: <GetFutureOptionContractList>d__13.MoveNext(): Failed to retrieve futures options chain from CME, retrying (4 / 5) System.Net.Http.HttpRequestException: Response status code does not
indicate success: 403 (Forbidden).
   at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
   at QuantConnect.Lean.Engine.DataFeeds.LiveOptionChainProvider.GetFutureOptionContractList(Symbol futureContractSymbol, DateTime date)+MoveNext() in Engine/DataFeeds/LiveOptionChainProvider.cs:line 165
←[39;49m←[39;49m←[31m20250217 03:58:02.080 ERROR:: <GetFutureOptionContractList>d__13.MoveNext(): Failed to retrieve futures options chain from CME, returning empty result (5 / 5) System.Net.Http.HttpRequestException: Response status code
does not indicate success: 403 (Forbidden).
   at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
@Martin-Molinero
Copy link
Member

Thanks for the report, closing as duplicate of #8427. The usage of the chain provider will soon be replaced by #8480

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants