PortaraDataProvider(path: str, tickers: Union[qf_lib.common.tickers.tickers.Ticker, Sequence[qf_lib.common.tickers.tickers.Ticker]], fields: Union[qf_lib.common.enums.price_field.PriceField, List[qf_lib.common.enums.price_field.PriceField]], start_date: datetime.datetime, end_date: datetime.datetime, frequency: qf_lib.common.enums.frequency.Frequency)[source]¶
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.
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)
Returns contracts information.
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.
get_contracts_df() → qf_lib.containers.dataframe.qf_dataframe.QFDataFrame[source]¶
Returns contracts information. A non empty data frame is returned only if the pricing data files contain the ‘Contract’ column.