Closed Amir-Inbar closed 4 months ago
Your contract is wrong
Use this to get contract details
https://nbviewer.org/github/erdewit/ib_insync/blob/master/notebooks/contract_details.ipynb
Then select a valid expiration date and continue with your code
Regards, Gonzalo Sáenz
On Sat, Jul 20, 2024 at 12:08 Amir-Inbar @.***> wrote:
For some reason I can't fetch any historical data, I'm getting the same error again and again, what I'm doing wrong?.
Error: Error 200, reqId 8: No security definition has been found for the request, contract: Contract(secType='FUT', symbol='MES', lastTradeDateOrContractMonth='202409', exchange='GLOBEX', currency='USD')
`
def fetch_market_data(self): contract = Contract( symbol="MES", secType="FUT", exchange="GLOBEX", currency="USD", lastTradeDateOrContractMonth="202409" )
while True: try: bar_list = self._broker_agent.reqHistoricalData( contract=contract, endDateTime="", durationStr="1 D", barSizeSetting="1 hour", whatToShow="TRADES", useRTH=False, formatDate=1, keepUpToDate=True, ) for bar in bar_list: print(bar) self._broker_agent.sleep(10) self._logger.info(f"Received {len(bar_list)} bars.") except Exception as e: self._logger.error(f"Error fetching market data: {e}") raise e
`
Thanks!
— Reply to this email directly, view it on GitHub https://github.com/ib-api-reloaded/ib_async/issues/49, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB75CQWG3O26UAYR4VKIB2TZNIZJLAVCNFSM6AAAAABLFZ4L2KVHI2DSMVQWIX3LMV43ASLTON2WKOZSGQZDANZZGYZTSOA . You are receiving this because you are subscribed to this thread.Message ID: @.***>
Works great, thanks!
For some reason I can't fetch any historical data, I'm getting the same error again and again, what I'm doing wrong?.
Error:
Error 200, reqId 8: No security definition has been found for the request, contract: Contract(secType='FUT', symbol='MES', lastTradeDateOrContractMonth='202409', exchange='GLOBEX', currency='USD')
`
`
Thanks!