Base Historical Provider

class algotradepy.historical.providers.base.AHistoricalProvider(simulation=True, **kwargs)

An abstract historical data provider.

Provides methods for downloading data from an API provided by one of the implementations.

Parameters

simulation (bool, default True) – Used in cases where an API provides a simulation mode.

abstract download_bars_data(contract, start_date, end_date, bar_size, rth, **kwargs)

Download historical data from the provider.

Parameters
  • contract (AContract) – The contract definition for which to request historical bar data.

  • start_date (datetime.date) – The start date.

  • end_date (datetime.date) – The end date.

  • bar_size (datetime.timedelta) – The bar size.

  • rth (bool, default True) – Restrict to regular trading hours.

  • kwargs

Returns

The data frame with the values.

Return type

pandas.DataFrame

abstract download_trades_data(contract, start_date, end_date, rth, **kwargs)

Download historical data from the provider.

Parameters
  • contract (AContract) – The contract definition for which to request historical trades data.

  • start_date (datetime.date) – The start date.

  • end_date (datetime.date) – The end date.

  • rth (bool, default True) – Restrict to regular trading hours.

  • kwargs

Returns

The data frame with the values.

Return type

pandas.DataFrame