Sometimes MarketData.GetBars hangs forever

Created at 20 Dec 2023, 07:42
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

Sometimes MarketData.GetBars hangs forever
20 Dec 2023, 07:42


Hi,

I've noticed that time to time MarketData.GetBars just hangs and never returns for some symbols.

For example, today it's happening with MarketData.GetBars(TimeFrame.Daily, "American_Express_(AXP.N)");

Is there a way to set a timeout for the GetBars excution? I understand that sometimes data might not be available but I don't want my code to lock forever waiting for a response.

Broker: Perpperstone


@Intetics
Replies

Intetics
20 Dec 2023, 08:01

Ok, found GetBarsAsync. Just wondering why did you guys decide to implement it with callbacks rather than proper Task Async methods?


@Intetics

Intetics
20 Dec 2023, 10:27 ( Updated at: 20 Dec 2023, 10:56 )

Hm, actually

Action<Bars> callback = o =>{        Bars result = o;    Print("Market Bars found");};
MarketData.GetBarsAsync(TimeFrame.Daily, "American_Express_(AXP.N)", callback);

also hangs forever and never moves past the GetBarsAsync line.

Any suggestions how to avoid it?


@Intetics

PanagiotisCharalampous
21 Dec 2023, 06:49

Hi there,

Can you share the complete cBot code as well as the broker, so that we can reproduce and investigate?

Best regards,

Panagiotis


@PanagiotisCharalampous

Intetics
21 Dec 2023, 07:20

RE: Sometimes MarketData.GetBars hangs forever

PanagiotisCharalampous said: 

Hi there,

Can you share the complete cBot code as well as the broker, so that we can reproduce and investigate?

Best regards,

Panagiotis

cTrader restart fixed the issue. Are there cTrader internal logs that I could share with you when it happens in the future?


@Intetics

PanagiotisCharalampous
21 Dec 2023, 09:24

RE: RE: Sometimes MarketData.GetBars hangs forever

Intetics said: 

PanagiotisCharalampous said: 

Hi there,

Can you share the complete cBot code as well as the broker, so that we can reproduce and investigate?

Best regards,

Panagiotis

cTrader restart fixed the issue. Are there cTrader internal logs that I could share with you when it happens in the future?

Hi there,

If it happens again please send us some troubleshooting info and quote the link to this discussion.

Best Regards,

Panagiotis 


 


@PanagiotisCharalampous