restrequestcryptographyquantitative-finance

Why doesn't end_time work on FTX REST API


I have been trying to fetch historical prices of Bitcoin on FTX using their REST API. I created a small Python script that does that for me. The scripts works but it seems like the API is bugging.

This is the request that FTX has in its docs to fetch historical prices :

GET /markets/{market_name}/candles?resolution={resolution}&start_time={start_time}&end_time={end_time}

So I tried it with resolution = 60 (in seconds) market_name = BTC-PERP start_time = 1559881511 (which is a timestamp) and end_time = 1559881711 [ actually these numbers are in an example given by FTX on their API page]

And the result of that request was : {"success":true,"result":[]} which clearly means that something is wrong.

I tried again without end_time and it worked perfectly, and if I put only end_time and no start_time it does the same bug.

Can't really figure it out


Solution

  • Is there data still available via API from that far back (2019)? I believe it works without end_date because it queries in reverse-chronological order, so it is just showing you the most recent candles.

    The end_date parameter seems to work with more recent chunks of time:

    https://ftx.com/api/markets/BTC-PERP/candles?resolution=60&start_time=1654097434&end_time=1656689434

    e.g. June to July this year, above.