Mismatching between c-trader graphic data and openapi dataframe

Created at 11 Apr 2022, 09:02
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!
PR

prenven570

Joined 24.12.2021

Mismatching between c-trader graphic data and openapi dataframe
11 Apr 2022, 09:02


Hi, I need to get the last hourly candle, so for example, at 7:00 am, I need the data of 6:00 am candle,

But when I request the data, mine last hourly candle does not equal to the previous candle that i see in the ctrader graphic.

 

This is my dataframe, as you can see the last candle high is 14173 and low is 14129, but in the ctrader graphic I get other data

 

This is the prevous hourly candle, as you can see, the high is 14162, and the low 14132,

It seems like the last candle in my dataframe correspond to the third less recent candle. 

But I need the data of the other candle in my dataframe  (with high 14162, and low 14132) because that's the last "closed" most recent hourly candle.

Is this a ctrader, broker problem? how can i get the candle i need?


@prenven570
Replies

amusleh
11 Apr 2022, 14:32

Hi,

The Open API returns the last closed bar data if you pass right parameters to trend bar request.

To get only the last closed bar set the to timestamp to now and request count field to 1, then it will return only the last bar data.

If you are using our Open API Python package (OpenApiPy) there was an issue on it's samples related to Python date time to Unix time conversion, we fixed it, please update your samples.


@amusleh

prenven570
11 Apr 2022, 14:50

RE:

amusleh said:

Hi,

The Open API returns the last closed bar data if you pass right parameters to trend bar request.

To get only the last closed bar set the to timestamp to now and request count field to 1, then it will return only the last bar data.

If you are using our Open API Python package (OpenApiPy) there was an issue on it's samples related to Python date time to Unix time conversion, we fixed it, please update your samples.

Thanks!, now I get the candle I need


@prenven570