MarketData.GetBars hangs forever

Created at 11 Jan 2024, 17:41
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
IN

Intetics

Joined 29.11.2023

MarketData.GetBars hangs forever
11 Jan 2024, 17:41


Hi,

This is in relation to https://ctrader.com/forum/calgo-support/42559

I think I've finally managed to (relatively constantly) reproduce the issue.

The bot code is:

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Internals;

namespace cAlgo.Robots;

[Robot(TimeZone = TimeZones.EasternStandardTime, AccessRights = AccessRights.FullAccess)]
public class SymbolHangBug : Robot
{
    private readonly Dictionary<string, Bars> _bars = new();

    protected override void OnStart()
    {
        Debugger.Launch();

        string[] stockMappings = new string[] { "Meta_Platforms_(META.O)", "Electronic_Arts_(EA.O)", "Alibaba_Group_(BABA.N)", "Microsoft_Corp_(MSFT.O)", "Amazon.com_Inc_(AMZN.O)", "Apple_Inc_(AAPL.O)", "Alphabet_Inc_C_(GOOG.O)", "Netflix_Inc_(NFLX.O)", "Coinbase_Global_Inc_(COIN.O)", "NVIDIA_Corporation_(NVDA.O)", "Tesla_Inc_(TSLA.O)", "AT&T_Inc_(T.N)", "Baidu_Inc_(BIDU.O)", "Citigroup_Inc_(C.N)", "Goldman_Sachs_Group_(GS.N)", "IBM_Corporation_(IBM.N)", "JPMorgan_Chase_&_Co_(JPM.N)", "Mastercard_Inc_(MA.N)", "McDonalds_Corporation_(MCD.N)", "NIKE_Inc_(NKE.N)", "Oracle_Corporation_(ORCL.N)", "Pfizer_Inc_(PFE.N)", "Procter_&_Gamble_Co_(PG.N)", "The_Boeing_Company_(BA.N)", "The_Walt_Disney_Co_(DIS.N)", "Visa_Inc_(V.N)", "Walmart_Inc_(WMT.N)", "Uber_Technologies_(UBER.N)", "PayPal_Holdings_Inc_(PYPL.O)", "American_Express_(AXP.N)", "Lockheed_Martin___(LMT.N)", "Qualcomm_(QCOM.O)", "T-Mobile_US_(TMUS.O)", "Moderna_(MRNA.O)", "Airbnb_Inc_(ABNB.O)", "Beyond_Meat_Inc_(BYND.O)", "Palantir_Tech_(PLTR.O)", "salesforce.com_Inc_(CRM.O)", "Snap_Inc_(SNAP.O)", "Virgin_Galactic_(SPCE.O)", "Zoom_Video_(ZM.O)", "Peloton_Inter._(PTON.O)", "Ryanair_(RYAAY.O)", "Shopify_(SHOP.N)", "Roblox_(RBLX.N)", "Okta_(OKTA.O)", "TripAdvisor_(TRIP.O)", "VMware_(VMW.N)", "Palo_Alto_(PANW.O)", "DoorDash_(DASH.N)", "Alteryx_(AYX.N)", "United_States_Steel_(X.N)", "Chewy_(CHWY.N)", "Teladoc_Health_(TDOC.N)", "Zoetis_Inc_(ZTS.N)", "TotalEnergies_ADR_(TTE.N)", "Sunpower_(SPWR.O)", "Aurinia_Pharma(AUPH.O)", "Stoneco_Ltd_(STNE.O)", "Stride_Inc_(LRN.N)", "Bumble_Inc_(BMBL.O)", "Invitae_(NVTA.N)", "ASML_(ASML.O)", "Weibo_(WB.O)", "Docusign_(DOCU.O)" };
        string[] actualAvailableSymbols = Symbols.ToArray();

        string[] selectedSymbols = stockMappings.Where(x => actualAvailableSymbols.Contains(x)).ToArray();

        foreach (string s in selectedSymbols)
        {
            Bars symbolBars = MarketData.GetBars(TimeFrame, s);
            _bars.Add(s, symbolBars);
        }
    }

}

The code hangs on MarketData.GetBars(TimeFrame, s); for “Ryanair_(RYAAY.O)”. 

To reproduce  the issue:

  1. Select EURUSD as the financial insturment
  2. Set m1 timeframe
  3. Go to backtestind and set strat date to 02/01/2022 and end date to 25/01/2022
  4. Set backtesting data to “m1 bars from the Server
  5. Run the backtest
  6. Set a conditional breakpoint on MarketData.GetBars(TimeFrame, s); for “Ryanair_(RYAAY.O)” and see that the code doesn't move after it. 

The weird thing is that during the last few days the code stops on different companies. Originally it was Sunpower_(SPWR.O), then Invitae_(NVTA.N), then Chewy_(CHWY.N), today Ryanair_(RYAAY.O).

Additional data:

  • Broker: PepperStone
  • Account Type: Test
  • Account Balance: 10,000

Are we running here in some kind of throattling from your side @PanagiotisCharalampous?

 


@Intetics
Replies

PanagiotisCharalampous
12 Jan 2024, 07:20 ( Updated at: 12 Jan 2024, 07:21 )

Hi there,

Thanks for the information, we will investigate it

Best regards,

Panagiotis


@PanagiotisCharalampous

Intetics
13 Jan 2024, 08:02

RE: MarketData.GetBars hangs forever

PanagiotisCharalampous said: 

Hi there,

Thanks for the information, we will investigate it

Best regards,

Panagiotis

HI PanagiotisCharalampous,

Did you guys manage to reproduce the issue?

Regards


@Intetics

PanagiotisCharalampous
15 Jan 2024, 07:41

RE: RE: MarketData.GetBars hangs forever

Intetics said: 

PanagiotisCharalampous said: 

Hi there,

Thanks for the information, we will investigate it

Best regards,

Panagiotis

HI PanagiotisCharalampous,

Did you guys manage to reproduce the issue?

Regards

Hi there,

Yes and we are working on a solution.

Best regards,

Panagiotis


@PanagiotisCharalampous

Intetics
15 Jan 2024, 08:54 ( Updated at: 15 Jan 2024, 12:20 )

RE: RE: RE: MarketData.GetBars hangs forever

PanagiotisCharalampous said: 

Intetics said: 

PanagiotisCharalampous said: 

Hi there,

Thanks for the information, we will investigate it

Best regards,

Panagiotis

HI PanagiotisCharalampous,

Did you guys manage to reproduce the issue?

Regards

Hi there,

Yes and we are working on a solution.

Best regards,

Panagiotis

Thanks @PanagiotisCharalampous. Is there a temporary solution/hack I could use locally while you're guys finishish a proper fix? It's just a showstopper that stops the whole work I'm doing. 


@Intetics

PanagiotisCharalampous
15 Jan 2024, 13:00

RE: RE: RE: RE: MarketData.GetBars hangs forever

Intetics said: 

PanagiotisCharalampous said: 

Intetics said: 

PanagiotisCharalampous said: 

Hi there,

Thanks for the information, we will investigate it

Best regards,

Panagiotis

HI PanagiotisCharalampous,

Did you guys manage to reproduce the issue?

Regards

Hi there,

Yes and we are working on a solution.

Best regards,

Panagiotis

Thanks @PanagiotisCharalampous. Is there a temporary solution/hack I could use locally while you're guys finishish a proper fix? It's just a showstopper that stops the whole work I'm doing. 

Unfortunately there isn't. It seems that some data of the specific broker is corrupted and needs to be fixed


@PanagiotisCharalampous

Intetics
17 Jan 2024, 11:59 ( Updated at: 18 Jan 2024, 14:11 )

RE: RE: RE: RE: RE: MarketData.GetBars hangs forever

PanagiotisCharalampous said: 

 

Thanks @PanagiotisCharalampous. Is there a temporary solution/hack I could use locally while you're guys finishish a proper fix? It's just a showstopper that stops the whole work I'm doing. 

Unfortunately there isn't. It seems that some data of the specific broker is corrupted and needs to be fixed

Ok, clear. How long do you think it will take to fix the data? Are we talking more days or weeks?


@Intetics

PanagiotisCharalampous
19 Jan 2024, 07:57

RE: RE: RE: RE: RE: RE: MarketData.GetBars hangs forever

Intetics said: 

PanagiotisCharalampous said: 

 

Thanks @PanagiotisCharalampous. Is there a temporary solution/hack I could use locally while you're guys finishish a proper fix? It's just a showstopper that stops the whole work I'm doing. 

Unfortunately there isn't. It seems that some data of the specific broker is corrupted and needs to be fixed

Ok, clear. How long do you think it will take to fix the data? Are we talking more days or weeks?

Hi there,

The data is the responsibility of the broker. What we will do is to fix the method so that it does not hang when there are no data for the specific symbol. Unfortunately we do not have ETA for this fix at the moment.

Best regards,

Panagiotis


@PanagiotisCharalampous