1

I am drawing a chart using the data pulled from bitfinex.com via a simple API query. As the result, i will need to render a chart which is going to show the historical data of BTCUSD for the past two years. Docs are available right here: https://bitfinex.readme.io/v2/reference#rest-public-candles Everything works fine except the limit of the retrieved data.

This is my request: https://api.bitfinex.com/v2/candles/trade:1h:tBTCUSD/hist?start=1514764800000&sort=1

The result can be seen over here or you can copy the request to the browser: https://docs.google.com/document/d/1sG11Ro0X21_UFgUtdqrlitcCchoSh30NzGCgAe6M0u0/edit?usp=sharing

The problem is that I receive candles for only 5 days no matter what dates or parameters I use. I can get more candles if i add the limit parameter to the string. But still, I can not get more than 1100-1000 candles. I even get the 500 error from the server:

Server error: GET https://api.bitfinex.com/v2/candles/trade:1h:tBTCUSD/hist?limit=1100&start=1512086400000&end=1516233600000&sort=1 resulted in a 500 Internal Server Error response:\n ["error",10020,"limit: invalid"]. What should be the valid limit? There is no such information in the docs.

How can I get the desired amount of data for the two years period of time? I do not want to break my query down into smaller pieces and go step by step. It will look ugly.

Diego Slinger
  • 11
  • 1
  • 3

3 Answers3

1

My suggestion is to get data by fragments for example:

  • Jan 1 2017 - July 31 2017
  • Aug 1 2017 - Dec 31 2017

Then merge on your code

Roel B
  • 11
  • 2
0

Here is one way to do it: https://github.com/nateGeorge/bitfinex-ohlc-import Also check out the original repo I forked from. Basically I get the earliest candles, then work up from there. If there are some candles in the DB already, it updates to the current time.

-1

limit=1000 is the most you can get.