PortaraFutureTicker

class qf_lib.containers.futures.future_tickers.portara_future_ticker.PortaraFutureTicker(name: str, family_id: str, N: int, days_before_exp_date: int, point_value: int = 1, designated_contracts: str = 'FGHJKMNQUVXZ', security_type: SecurityType = SecurityType.FUTURE)[source]

Bases: FutureTicker, PortaraTicker

Representation of a Future Ticker, designed to be used by the PortaraDataProvider.

Parameters:
  • name (str) – Field which contains a name (or a short description) of the FutureTicker, for example ‘Cotton’ or ‘Brent Crude Oil’. This does not need to be a ticker code.

  • family_id (str) – Used to identify a given futures family. It should match the name of the file, which contains expiration dates for a chain of the futures contracts. For example, in case of Silver, the name of the file with expiration dates should be equal to ‘SIA.txt’ and the family_id should be equal to ‘SIA{}’. The ‘{}’ part of the family_id points to this part of the symbol, which should be filled with the month and year code in case of individual tickers. In case of Silver the following tickers will belong to the Futures family: SIA2021H, SIA2021K, SIA2021N, SIA2021U, SIA2021Z etc.

  • N (int) – Since we chain individual tenors, we need to know which contract to select. N determines which contract is used at any given time when we have to select a specific contract (tenor). For example N parameter set to 1, denotes the first (front) future contract. N set to 2 will be the second contract and so on.

  • days_before_exp_date (int) – Number of days before the expiration day of each of the contract, when the “current” specific contract should be substituted with the next consecutive one.

  • point_value (int) – Used to define the size of the contract.

  • designated_contracts (str) – It is a string, which represents all month codes, that are being downloaded and stored in the chain of future contracts. Any specific order of letters is not required. E.g. providing this parameter value equal to “HMUZ”, would restrict the future chain to only the contracts, which expire in March, June, September and December, even if contracts for any other months exist and are returned by the DataProvider get_futures_chain_tickers function.

Methods:

belongs_to_family(ticker)

Function, which takes a specific PortaraTicker, and verifies if it belongs to the family of futures contracts, identified by the PortaraFutureTicker and returns true if that is the case (false otherwise).

supported_ticker_type()

Returns class of specific tickers which are supported by this FutureTicker (e.g.

belongs_to_family(ticker: PortaraTicker) bool[source]

Function, which takes a specific PortaraTicker, and verifies if it belongs to the family of futures contracts, identified by the PortaraFutureTicker and returns true if that is the case (false otherwise).

supported_ticker_type() Type[Ticker][source]

Returns class of specific tickers which are supported by this FutureTicker (e.g. it should return BloombergTicker for the BloombergFutureTicker etc.