<p>My suggestion is to get data by fragments for example:</p>

<ul>
<li>Jan 1 2017 - July 31 2017</li>
<li>Aug 1 2017 - Dec 31 2017</li>
</ul>

<p>Then merge on your code</p>

CC BY-SA 4.0
2018-08-07T08:14:50.557Z
2018-08-07T08:14:50.557Z
Roel B
<p>Here is one way to do it: <a href="https://github.com/nateGeorge/bitfinex-ohlc-import" rel="nofollow noreferrer">https://github.com/nateGeorge/bitfinex-ohlc-import</a>
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.</p>

CC BY-SA 4.0
2019-08-22T07:13:00.157Z
2019-08-22T07:13:00.157Z
wordsforthewise
<p>limit=1000 is the most you can get.</p>

CC BY-SA 3.0
2018-02-11T16:13:18.870Z
2018-02-11T16:13:18.870Z
islandTraderFX
<p>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: <a href="https://bitfinex.readme.io/v2/reference#rest-public-candles" rel="nofollow noreferrer">https://bitfinex.readme.io/v2/reference#rest-public-candles</a> Everything works fine except the limit of the retrieved data.</p>

<p>This is my request: <a href="https://api.bitfinex.com/v2/candles/trade:1h:tBTCUSD/hist?start=1514764800000&amp;sort=1" rel="nofollow noreferrer">https://api.bitfinex.com/v2/candles/trade:1h:tBTCUSD/hist?start=1514764800000&amp;sort=1</a></p>

<p>The result can be seen over here or you can copy the request to the browser: <a href="https://docs.google.com/document/d/1sG11Ro0X21_UFgUtdqrlitcCchoSh30NzGCgAe6M0u0/edit?usp=sharing" rel="nofollow noreferrer">https://docs.google.com/document/d/1sG11Ro0X21_UFgUtdqrlitcCchoSh30NzGCgAe6M0u0/edit?usp=sharing</a></p>

<p>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:</p>

<p>Server error: GET <a href="https://api.bitfinex.com/v2/candles/trade:1h:tBTCUSD/hist?limit=1100&amp;start=1512086400000&amp;end=1516233600000&amp;sort=1" rel="nofollow noreferrer">https://api.bitfinex.com/v2/candles/trade:1h:tBTCUSD/hist?limit=1100&amp;start=1512086400000&amp;end=1516233600000&amp;sort=1</a> 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.</p>

<p>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.</p>

<api><bitfinex>
How to get the historical data from bitfinex.com with out a limit?
Diego Slinger
# How to get the historical data from bitfinex.com with out a limit?

(Asked by: username_0 on 2018-01-18)

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.

**Tags:** api, bitfinex


---

## 3 answers

### Answer by username_1 on 2018-08-07. Score: 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


---

### Answer by username_2 on 2019-08-22. Score: 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.


---

### Answer by username_3 on 2018-02-11. Score: -1

limit=1000 is the most you can get.


---

