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
- abstractmethod collect(start, end, granularity='HOUR')¶
Collects historical bars for the given symbol and date range. :param symbol: e.g. “AAPL” or “BTC-USD” :param start: start date :param end: end date :return: dataframe with columns: datetime, open, low, high, close, volume
- Parameters:
symbol (str)
start (datetime)
end (datetime)
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”