bitcoincharts – Bitcoin Charts reference

Feeds

class pyalgotrade.bitcoincharts.barfeed.CSVTradeFeed(timezone=None, maxLen=None)

Bases: pyalgotrade.barfeed.csvfeed.BarFeed

A BarFeed that builds bars from a Historic Trade Data CSV file as described in http://www.bitcoincharts.com/about/markets-api/. Files can be downloaded from http://api.bitcoincharts.com/v1/csv/.

Parameters:
  • timezone (A pytz timezone.) – An optional default timezone to use to localize bars. By default bars are loaded in UTC.
  • maxLen (int.) – The maximum number of values that the pyalgotrade.dataseries.bards.BarDataSeries will hold. If not None, it must be greater than 0. Once a bounded length is full, when new items are added, a corresponding number of items are discarded from the opposite end. If None then dataseries.DEFAULT_MAX_LEN is used.

Note

  • A pyalgotrade.bar.Bar instance will be created for every trade, so open, high, low and close values will all be the same.
  • Files must be sorted with the unixtime column in ascending order.
addBarsFromCSV(path, instrument='BTC', timezone=None, fromDateTime=None, toDateTime=None)

Loads bars from a trades CSV formatted file.

Parameters:
  • path (string.) – The path to the file.
  • instrument (string.) – The instrument identifier.
  • timezone (A pytz timezone.) – An optional timezone to use to localize bars. By default bars are loaded in UTC.
  • fromDateTime (datetime.datetime.) – An optional datetime to use to filter bars to load. If supplied only those bars whose datetime is greater than or equal to fromDateTime are loaded.
  • toDateTime (datetime.datetime.) – An optional datetime to use to filter bars to load. If supplied only those bars whose datetime is lower than or equal to toDateTime are loaded.

Note

  • Every file that you load bars from must have trades in the same currency.
  • If fromDateTime or toDateTime are naive, they are treated as UTC.

Table Of Contents

Previous topic

Bitcoin Charts support

Next topic

Bitcoin Charts example

This Page