kucoin-api-docs
kucoin-api-docs copied to clipboard
API : weekly time frame get_kline_data does not return the right day in the week(thursday instead of monday)
https://api.kucoin.com/api/v1/market/candles?type=1week&symbol=BLOK-USDT ->{"code":"200000","data":[["1647475200","0.014819","0.016037","0.01701","0.014508","1225433242.10023188","19282467.8799579453914"],["1646870400","0.015826","0.014832","0.015992","0.013777","1151688196.97778707","16845629.39237758133956"],["1646265600","0.019245","0.015826","0.019487","0.014132","1754894524.65309572","28569991.74945049203015"],["1645660800","0.015409","0.019241","0.021496","0.012632","3638302937.1719292","62601158.58512233173313"],
datetime.fromtimestamp(ts) ->datetime.datetime(2022, 3, 17, 1, 0) Thursday March 17th 2022
Why does candle start on Thursday??
January 1st, 1970 at 00:00:00 UTC is referred to as the Unix epoch. The default server start time of the first day is calculated from UTC time, so it is inferred that this time is not Monday but Wednesday.
The following weekly data are based on this time + 7 days.
However, it should be noted that although the date of the web-side data is displayed on Monday, the actual data value is still the Wednesday mentioned above. This may be a bit misunderstood, but the reality is such a division.
Thanks