Symbology
The library requires information about the symbol in order to request and process data correctly. This information should be arranged in a specified format and supplied as a LibrarySymbolInfo object. This article explains the most challenging concepts of the LibrarySymbolInfo
implementation. You can find the complete list of interface parameters, and their descriptions, in the API section.
The library calls the resolveSymbol
method to request symbol information. To provide this information, create the LibrarySymbolInfo
object and pass it to ResolveCallback
as a parameter.
Refer to the Datafeed API topic for more information on how to supply the chart with data.
Symbol name
The library addresses a symbol by a unique identifier. You can use full_name
or ticker
to specify such an identifier for a certain symbol. If you provide both properties, the library considers ticker
as the higher priority property.
full_name
A string that has the EXCHANGE:SYMBOL
format. This string is displayed on the chart legend. If you do not specify full_name
manually, the library generates the property value using name
and exchange
.
ticker
If you need to address a symbol by a custom identifier (for example, numeric), you can use ticker
instead of full_name
. This identifier is not displayed to the users. Make sure you provide ticker
in LibrarySymbolInfo
and SearchSymbolResultItem.
Resolutions
Refer to the Resolution article for information on how to specify the following properties:
supported_resolutions
has_seconds
seconds_multipliers
has_intraday
intraday_multipliers
has_daily
daily_multipliers
has_weekly_and_monthly
weekly_multipliers
monthly_multipliers
has_ticks
Time zone
The library arranges data based on the timezone
value. Make sure you specify this property to avoid potential issues.
If your time zone is not supported, you can request it on GitHub Issues 🔐 (access is restricted).
Session
The library arranges data based on the session
value. Make sure you specify this property to avoid potential issues.
Refer to the Trading Sessions topic for more information on the session format.
subsession_id
The subsession ID of this symbol. The value of this property should match one of the id
s from subsessions
. Should usually be 'regular'
or 'extended'
depending on whether or not the symbol is in extended trading mode.
subsessions
Refer to Extended Sessions for more information.
An array of objects describing the subsessions of this symbol.
Each object must have the properties id
, description
, and session
:
id
is a unique identifier for the subsession.description
is a description of subsession. For example'Regular Trading Hours'
.session
is a session string. See session for more information.'session-correction'
is an optional session correction string.
Price format
The library supports the decimal and fractional price formats. To configure how the price displays, specify the following properties:
pricescale
— a number of decimal places or fractions that the price has.minmov
— a number of units that represents the price tick.minmove2
— a fraction of a fraction.fractional
— a boolean value that shows whether the format is fractional or decimal.
These properties' values depend on the chosen format and are not visible to users.
Decimal format
pricescale
should be10^n
, wheren
is the number of decimal places. For example, if the price is1.01
, setpricescale
to100
.minmov
depends on the tick size that is calculated asminmov / pricescale
. For example, if the tick size is0.25
, setminmov
to25
.minmove2
should be0
or not specified.fractional
should befalse
or not specified.
Consider the following examples:
- The security's tick size is
0.01
. To display this security, setminmov = 1
,pricescale = 100
. - The security's tick size is
0.0125
. To display this security, setminmov = 125
,pricescale = 10000
. - The security's tick size is
0.20
. To display this security, setminmov = 20
,pricescale = 100
.
Variable tick size
If you need to adjust a tick size depending on a symbol price, you can additionally specify the variable_tick_size
property. This property should be a string
that contains prices and the corresponding tick sizes. The library overrides the pricescale
and minmov
properties to represent the desired tick size.
For example, the '0.01 10 0.02 25 0.05'
value specifies the following ticks:
- For prices less than or equal to 10, the tick size is
0.01
. Therefore,minmov = 1
,pricescale = 100
. - For prices greater than 10 but less than or equal to 25, the tick size is
0.02
. Therefore,minmov = 2
,pricescale = 100
. - For prices greater than 25, the tick size is
0.05
. Therefore,minmov = 5
,pricescale = 100
.
Note that you need to initialize pricescale
and minmov
regardless of whether you use variable_tick_size
or not.
How to display pips
You can display pips for symbols that have forex
or cfd
type. To do this, set minmove2
to 10
. In the UI, pips look smaller than the price digits.
If minmove2
is 0
for forex
/cfd
symbols, the spread is displayed in ticks, not pips.
Fractional format
The fractional price is displayed as x'y
(for example, 133'21
), where x
and y
are the integer and fractional parts, respectively. A single quote is used as a delimiter.
pricescale
should be2^n
. This value represents the number of fractions.minmov
depends on the tick size that is calculated asminmov / pricescale
. For example, if the tick size is1/4
, setminmov
to1
.minmove2
should be0
or not specified.fractional
should betrue
.
Consider the following examples:
- To display a security that has the
1/32
tick size, setminmov = 1
,pricescale = 32
. - To display a security that has the
2/8
tick size, setminmov = 2
,pricescale = 8
.
Fraction of a fraction format
The fraction of a fraction format is a particular case of the fractional format. It is displayed as x'y'z
(for example, 133'21'5
), where z
is a fractional part of y
. In this case, minmove2
differs from 0
and represents a fraction of a fraction. For example, the ZBM2023
tick size is 1/4 of a 32nd. To display this security, set minmov = 1
, pricescale = 128
, minmove2 = 4
. The price is displayed in the UI as follows:
119'16'0
represents119 + 16.0/32
119'16'2
represents119 + 16.25/32
119'16'5
represents119 + 16.5/32
119'16'7
represents119 + 16.75/32