Switch to the new bitcoincharts API URL.
Adapt to bitcoincharts API changes.

The bitcoincharts API has recently been changed in several ways. The
start parameter has been deprecated and the API now always returns 20000
last trades which happened earlier than the timestamp passed as the end
parameter. Furthermore, the API now returns trades in reverse, from
newest to oldest. One of the reasons the API has been changed is because
histories have grown large for some of the exchanges and it caused great
traffic for bitcoincharts.

This commit aims to work around the changes in the API while still being
mindful of bitcoincharts' bandwidth. It reimplements the logic in
bitcoincharts_history() to download the data in chunks using only the
end parameter. Also, it adds two new options, --history-length and
--bootstrap. The former parameter limits the length of the history to be
downloaded from bitcoincharts (in days, defaults to 10 days). The
parameter has no effect if a *.scid file for the symbol in question
already exists; in this case, it downloads the complete missing history
in order not to create gaps. Complementarily, the --bootstrap parameter
allows a user to pass in the path of a *.csv file which then gets
converted to a *.scid file. The purpose of this parameter is to enable
the use of the new experimental historical dumps (updated daily) offered
by bitcoincharts (http://api.bitcoincharts.com/v1/csv/). Since this
feature is experimental, downloading from this location was not made
automatic in this commit, but it can be easily done in the future, if
needed.
Stop missing trades on chunk boundaries.
Add adaptive chunk size logic.

This commit adds adaptive chunk size logic and handles potential HTTP
errors (particularly 502) that sometimes happen with bitcoincharts. This
functionality relies on the deprecated start parameter of bitcoincharts
which is, as of the time of this commit, still functional for limiting
the number of trades returned.
Make sure there is no gap before returning.

Before exiting bitcoincharts_history, re-request the newest data to make
sure we don't leave a gap if trades happened while we were downloading
the history.
Adjust initial timespan according to the size of the missing data.

Don't always start by requesting a day's worth of data since we might be
missing much less.
Merge pull request #10 from dkasak/bitcoincharts_api_fix

Bitcoincharts API fix