DailyDataHandler

class qf_lib.backtesting.data_handler.daily_data_handler.DailyDataHandler(data_provider: qf_lib.data_providers.data_provider.DataProvider, timer: qf_lib.common.utils.dateutils.timer.Timer)[source]

Bases: qf_lib.backtesting.data_handler.data_handler.DataHandler

Methods

get_last_available_price(tickers, …)

Gets the latest available price for given assets as of end_time.

get_last_available_price(tickers: Union[qf_lib.common.tickers.tickers.Ticker, Sequence[qf_lib.common.tickers.tickers.Ticker]], frequency: qf_lib.common.enums.frequency.Frequency = None, end_time: Optional[datetime.datetime] = None) → Union[float, qf_lib.containers.series.qf_series.QFSeries][source]

Gets the latest available price for given assets as of end_time.

Parameters
  • tickers (Ticker, Sequence[Ticker]) – tickers of the securities which prices should be downloaded

  • frequency (Frequency) – frequency of the data

  • end_time (datetime) – date which should be used as a base to compute the last available price. The parameter is optional and if not provided, the end_date will point to the current user time.

Returns

last_prices series where: - last_prices.name contains a date of current prices, - last_prices.index contains tickers - last_prices.data contains latest available prices for given tickers

Return type

float, pandas.Series