lolz987
Posts: 1
Joined: Wed Jan 05, 2022 7:13 am

Candlestick question regarding timestamp and ohlc.

What are the datas required for a json response if I want my candlestick chart to have different sets of time interval 1m, 5m, 30m, 4hours, 6hours, 12hours, 1day and 1 week? In my database I’m storing individual crypto transactions with epoch timestamp and price. Do I need to output ohlc for the interval that I want for my json output or do I just need to output the price with the timestamp and highcharts will plot it for me?

Let’s say for the intervals that I stated above, do I query my data for 8 different time set with ohlc

or

Query all the transactions with price and timestamp will do?

Thanks.
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: Candlestick question regarding timestamp and ohlc.

Hi lolz987,

Welcome to our forum and thanks for contacting us with your question!

If the minimal time interval that you would like to show is 1m, then it would be nice to have data records with at least this frequency, and that is the only data set that you need to provide. Highcharts will process that data for any bigger time intervals. Highcharts expects date to be in a format of UTC timestamp expressed in milliseconds since 1970, so your format should be perfect. Here you can find information about available data formats for candlestick series: https://api.highcharts.com/highstock/se ... stick.data
In order to plot candlesticks correctly, you need to make sure that your data fit either of these formats.

Let me know if you have any further questions!
Regards!
Mateusz Bernacik
Highcharts Developer

Return to “Highcharts Usage”