Historical Data Collection

class src.boatwright.Data.Collection.Historical.Collector.Collector(source, debug=False)

collects candlestick data from somewhere and saves it to the local database

Parameters:
  • source (str) – e.g. “ALPACA” or “COINBASE”

  • debug – boolean toggle to print debugging information

abstract collect(start, end, granularity='MINUTE')

returns dataframe with columns: timestamp, open, low, high, close, volume

Parameters:
  • symbol (str)

  • start (date)

  • end (date)

  • granularity (str)

fill_missing_data(data)

It is not uncommon to find missing bars of data from external sources. This method fills missing rows of data with an approximation based on the bars on either side.

make_time_chunks(start, end, max_size, granularity='MINUTE')

breaks the date range into a set of smaller date ranges of max_size or smaller returns a list of start and end datetime objects

Parameters:
  • start (datetime) – start date

  • end (datetime) – end date

  • max_size (int) – chunk size, in number of bars

  • granularity (str) – “MINUTE”, “HOUR”, or “DAY”