HaverDataProvider¶
-
class
qf_lib.data_providers.haver.haver_data_provider.
HaverDataProvider
(settings: qf_lib.settings.Settings)[source]¶ Bases:
qf_lib.data_providers.abstract_price_data_provider.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])Gets historical fields for Haver tickers.
price_field_to_str_map
(ticker)Haver stores only end of day figures.
Returns classes of tickers which are supported by this DataProvider.
-
expiration_date_field_str_map
(ticker: qf_lib.common.tickers.tickers.Ticker = None) → Dict[qf_lib.common.enums.expiration_date_field.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[qf_lib.common.tickers.tickers.HaverTicker, Sequence[qf_lib.common.tickers.tickers.HaverTicker]], fields=None, start_date: datetime.datetime = None, end_date: datetime.datetime = None, **kwargs) → Union[qf_lib.containers.series.qf_series.QFSeries, qf_lib.containers.dataframe.qf_dataframe.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
- Returns
- Return type
-
price_field_to_str_map
(ticker: qf_lib.common.tickers.tickers.HaverTicker = None) → Dict[qf_lib.common.enums.price_field.PriceField, Optional[str]][source]¶ Haver stores only end of day figures. Use PriceField.Close to obtain them