PortaraDataProvider

class qf_lib.data_providers.portara.portara_data_provider.PortaraDataProvider(path: str, tickers: Union[Ticker, Sequence[Ticker]], fields: Union[PriceField, List[PriceField]], start_date: datetime, end_date: datetime, frequency: Frequency)[source]

Bases: PresetDataProvider

Loads Portara data for futures contracts. When it comes to futures, this provider supports both continuous series and working on individual contracts (tenors).

The required format is .csv for pricing data (with headers) and .txt for expiration dates data.

Parameters:
  • path (str) – path to the exported Portara data

  • tickers (Ticker, Sequence[Ticker]) – one or a list of tickers, used further to download the futures contracts related data. The list can contain either Tickers or FutureTickers. In case of the Tickers, simply the given fields are being downloaded and stored using the PresetDataProvider. In case of the FutureTickers, the future chain tickers and their corresponding prices are being downloaded and stored.

  • fields (PriceField, Sequence[PriceField]) – fields that should be downloaded

  • start_date (datetime) – first date to be downloaded

  • end_date (datetime) – last date to be downloaded

  • frequency (Frequency) – frequency of the data (1-minute bar and daily frequencies are supported)

Notes

  • It is assumed that the names of files containing prices data match the names of the contracts (e.g. SI1999Z.csv for SI1999Z).

  • The naming convention used to generate the data in Portara should be the “SymYYYYM”.

  • The date format should be set to “YYYY-MM-DD”.

  • Currently the only supported data frequencies are daily frequency and 1-minute bar frequency. After preloading 1-minute bars, it is possible to aggregate them selecting a different frequency in the get price.

  • In order to see exemplary files which may be used with the PortaraDataProvider (e.g. structure of expiration dates file), check the mock files in the tests directory: tests > unit_tests > data_providers > portara > input_data.

  • To see examples using Portara data provider, check the demo scripts: demo_scripts > data_providers > portara.

Methods:

get_contracts_df()

Returns contracts information.

get_contracts_df() QFDataFrame[source]

Returns contracts information. A non empty data frame is returned only if the pricing data files contain the ‘Contract’ column.