Ticker

class qf_lib.common.tickers.tickers.Ticker(ticker: str, security_type: qf_lib.common.enums.security_type.SecurityType, point_value: int)[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.

Methods

as_string()

Returns a string representation of a ticker

from_string(ticker_str, Sequence[str]])

Allows creation of a ticker from a string

set_name(name)

Sets the name of the ticker.

Attributes

name

Returns a name of the ticker.

as_string() → str[source]

Returns a string representation of a ticker

abstract from_string(ticker_str: Union[str, Sequence[str]]) → Union[qf_lib.common.tickers.tickers.Ticker, Sequence[qf_lib.common.tickers.tickers.Ticker]][source]

Allows creation of a ticker from a string

property name

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.