slush0/sierrachartfeed — pull request #10 by dkasak (2013-04-23 22:44:42+00:00)
Title: Bitcoincharts api fix

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](http://api.bitcoincharts.com/v1/csv/) (updated daily) offered by bitcoincharts. Since this feature is experimental, downloading from this location was not made automatic in this pull request, but it can be easily done in the future, if needed.

I have tested this and it seems to work well but I would appreciate some more testing. This deprecates pull requests #8, #6 and #4 and should close issues #7 and #9.