HaverDataProvider

class qf_lib.data_providers.haver.haver_data_provider.HaverDataProvider(settings: Settings)[source]

Bases: AbstractPriceDataProvider

Constructs a new HaverDataProvider instance.

Parameters:

settings – Settings object, which should contain path to the directory with the Haver database

Methods:

expiration_date_field_str_map([ticker])

Method has to be implemented in each data provider in order to be able to use get_futures_chain_tickers.

get_history(tickers[, fields, start_date, ...])

Gets historical fields for Haver tickers.

price_field_to_str_map()

Haver stores only end of day figures.

supported_ticker_types()

Returns classes of tickers which are supported by this DataProvider.

expiration_date_field_str_map(ticker: Optional[Ticker] = None) Dict[ExpirationDateField, str][source]

Method has to be implemented in each data provider in order to be able to use get_futures_chain_tickers. Returns dictionary containing mapping between ExpirationDateField and corresponding string that has to be used by get_futures_chain_tickers method.

Parameters:

ticker (None, Ticker) – ticker is optional and might be uses by particular data providers to create appropriate dictionary

Returns:

mapping between ExpirationDateField and corresponding strings

Return type:

Dict[ExpirationDateField, str]

get_history(tickers: Union[HaverTicker, Sequence[HaverTicker]], fields=None, start_date: Optional[datetime] = None, end_date: Optional[datetime] = None, **kwargs) Union[QFSeries, QFDataFrame][source]

Gets historical fields for Haver tickers.

Parameters:
  • tickers (HaverTicker, Sequence[HaverTicker]) – Haver tickers, for which the prices should be returned

  • fields – should be equal to None as each ticker corresponds to one timeseries and there is no such thing as a field in the Haver DB

  • start_date (datetime) – date representing the beginning of historical period from which data should be retrieved

  • end_date (datetime) – date representing the end of historical period from which data should be retrieved; if no end_date was provided, by default the current date will be used

Return type:

QFSeries, QFDataFrame

price_field_to_str_map() Dict[PriceField, Optional[str]][source]

Haver stores only end of day figures. Use PriceField.Close to obtain them

supported_ticker_types()[source]

Returns classes of tickers which are supported by this DataProvider.