PolygonCollector

class src.boatwright.Data.OHLCV.Historical.PolygonCollector.PolygonCollector(api_key=None, crypto=False, debug=False)

Collects historical data via Polygon API.

Parameters:
  • api_key (str) – Polygon API key, defaults to key specified in config.json

  • crypto (bool) – boolean toggle to indicate if collecting crypto data

  • debug (bool) – boolean toggle for printing debugging information

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

Collects historical bars for the given symbol and date range.

Parameters:
  • symbol (str) – e.g. “AAPL” or “BTC-USD”

  • start (date) – start date (datetime.date or datetime.datetime)

  • end (date) – end date (datetime.date or datetime.datetime)

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

Returns:

pd.DataFrame with columns [datetime, open, high, low, close, volume]