Ticker#

class qf_lib.common.tickers.tickers.Ticker(ticker: str, security_type: SecurityType, point_value: int, currency: str | None = None)[source]#

Bases: object

Representation of a security.

Parameters:
  • ticker (str) – identifier of the security in a specific database

  • security_type (SecurityType) – denotes the type of the security, that the ticker is representing e.g. SecurityType.STOCK for a stock, SecurityType.FUTURE for a futures contract etc.

  • point_value (int) – size of the contract as given by the ticker’s Data Provider.

  • currency (Optional[str]) – ISO code of the currency of the ticker. Example “USD”.

as_string() str[source]#

Returns a string representation of a ticker

abstractmethod from_string(ticker_str: str | Sequence[str]) Ticker | Sequence[Ticker][source]#

Allows creation of a ticker from a string

property name: str#

Returns a name of the ticker. The property should be adjusted for different Ticker classes to provide a string representation of a Ticker, which in some cases could be more understandable than the output of as_string() function.

set_name(name: str)[source]#

Sets the name of the ticker. Name should be used for different Ticker classes to provide a readable string representation of a Ticker. For example, for tickers of security type FUTURE it is a good idea to set the name to point to the name of the asset (e.g. Cotton, Corn) to faciliate the further analysis of the tickers in transactions, portfolio etc.