dapi获取k线接口有误

dapi获取k线接口对startTime和endTime参数的支持有误,具体如下:

在postman中用以下参数调用接口https://dapi.binance.com/dapi/v1/klines返回空数组:
symbol=BTCUSD_PERP
interval=1m
startTime=1648449000
limit=1

等效cURL:
curl --location --request GET ‘https://dapi.binance.com/dapi/v1/klines?symbol=BTCUSD_PERP&interval=1m&startTime=1648449000&limit=1’ --header ‘Content-Type: application/json’

在sapi和fapi使用类似参数调用对应接口没有问题。

求解答,谢谢!

The values of the startTime and endTime parameters are expected to be milliseconds from epoch/unix timestamp.

Therefore startTime should be equal to 1648449000000 not 1648449000

1 Like

Thank you very much!
However, my original intention at the beginning was to assign a value of 0 to the startTime parameter to get when a certain symbol started trading on Binance.
However, I found that the CM api, that is, the dapi, cannot use the startTime value of 0. It should be that dapi has a limit on the value range of time.
Do you know of other ways to get the starting trading time of a CM symbol?

Use the historical trades or aggregated trades endpoints with fromId = 0 to retrieve the first trade timestamp.

https://binance-docs.github.io/apidocs/delivery/en/#compressed-aggregate-trades-list

1 Like

非常感谢!