BloombergFutureTicker

class qf_lib.containers.futures.future_tickers.bloomberg_future_ticker.BloombergFutureTicker(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, BloombergTicker

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

Parameters:
  • name (str) – Field which contains a name (or a short description) of the FutureTicker.

  • family_id (str) – Used to to verify if a specific BloombergTicker belongs to a certain futures family and to the active Ticker string, which can be further used by the data provider to download the chain of corresponding Tickers. The family ID pattern - e.g. for Cotton, an exemplary ticker string is of the following form: “CTZ9 Comdty”. The “Z9” part denotes the month and year codes - this is the only variable part of the ticker. Thus, in order to verify if a ticker belongs to the cotton family, it should be in form of “CT{} Comdty”. For all other ticker families, the family_id should be in the form of specific ticker with the month and year codes replaced with the “{}” placeholder.

  • N (int) – Since we chain individual contracts, we need to know which one to select. N determines which contract is used at any given time when we have to select a specific contract. 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 BloombergDataProvider get_futures_chain_tickers function.

  • 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 BloombergTicker, verifies if it belongs to the family of futures contracts, identified by the BloombergFutureTicker and returns true if that is the case (false otherwise).

get_active_ticker()

Returns the active ticker.

supported_ticker_type()

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

belongs_to_family(ticker: BloombergTicker) bool[source]

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

get_active_ticker() BloombergTicker[source]

Returns the active ticker.

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.