TT CORE SDK
0.1
TT CORE SDK documentation
|
An instrument’s definition can be found by calling the DownloadInstrument() function and specifying either:
This call is synchronous, so it is highly recommended it be used during initialization for performance reasons.
The most efficient way to retrieve an instrument definition is providing the unique ID that TT assigns to it. The signature of the DownloadInstrument()
function in this case is as follows.
If the instrument download fails, a nullptr
is returned.
To look up the instrument ID, TT provides an easy way for you to get the required instrument ID to use in your code. To get the ID for an instrument:
Open a Market Grid in the TT Trade app.
Select the desired instrument and type Shift+Ctrl+X to display the instrument data.
You can then see the value in the instrument's instrumentId field.
Copy the value in the instrument's instrumentId field, and paste into your function call as the instr_id parameter.
The following code snippet illustrates the use of this function in this case.
Alternatively you can perform a query search by providing the market id and either the instrument name (e.g. “ESH8”) or alias (e.g. “ES Mar18”) fields. Note that if the query string does not explicitly match the name/alias fields, the download will fail.
The signature of the DownloadInstrument()
function in this case is as follows.
If the instrument download fails, a nullptr
is returned.
To look up the short name, TT provides an easy way for you to get the required instrument name to use in your code. To get the short name for an instrument:
Open a Market Grid in the TT Trade app.
Select the desired instrument and type Shift+Ctrl+X to display the instrument data.
You can then see the value in the instrument's name field.
Copy the value in the instrument's name field, and paste into your function call as the query parameter.
The following code snippet illustrates the use of this function in this case.
The instrument contains over 35 different public member variables defining the instrument.
Public Attribute | Description |
---|---|
alias | Alias (e.g. ES Dec14). |
combo_type_id | Combo type ID. |
display_factor | Display Factor. |
first_delivery_date | First delivery date. |
implied_rules | Implied rules. |
instr_id | Instrument ID. |
instr_version | Instrument version. |
is_not_tradable | Whether the instrument is not tradable. |
legs | Instrument legs. Returns a vector of instrument_leg struct, which is defined in the instrument.hpp file. |
last_trading_date | Last trading date. |
market_id | Market Identifier. Returns a market enum, which is defined in the enums.hpp file. |
maturity_date | Maturity date. |
min_price_increment | Minimal price increment. |
name | Instrument Name (e.g. ESZ4). |
option_code_id | Option code ID. |
option_scheme_id | Option scheme ID. |
point_value | Value of one point in the default currency. |
price_formula | User-defined price formula for a spread. |
price_topic | The topic which price update is send on. |
product_currency | ISO cod for the native product currency. Returns a currency_code enum, which is defined in the enums.hpp file. |
product_id | Product ID. |
product_type_id | Product type. Returns a product_type_id enum, which is defined in the enums.hpp file. |
product_version | Product version. |
security_id | Security ID. |
series_term_id | Series term ID. |
starting_date | Starting date. |
strike_price | Strike price. |
supports_implieds | Instrument supports implied prices. |
symbol | Product Symbol (e.g. ES). |
tick_denom | Ticking: Denominator. |
tick_num | Ticking: Numerator. |
tick_size | Interval between tradable prices. |
tick_table | Variable ticking data. Returns a tick_table_data struct, which is defined in the instrument.hpp file. |
tick_value | Value of one tick in the default currency. |
underlying_instr_id | Underlying Instrument ID. |
In addition, helper methods for performing accurate price conversions specific to that instrument are also available.
Member Function | Description |
---|---|
GetMinTickSize() | Returns the minimum tick size. double GetMinTickSize(void) const; |
IsPriceOnTick() | Returns if the specified price is on a tradable tick. bool IsPriceOnTick(double price) const; |
IsValid() | Checks if the instrument data is valid. bool IsValid(void) const; |
OffsetPrice() | Returns the tradable price a number of ticks from the specified price. |
PriceToTicks() | Returns the specified price in tradable ticks. bool IsPriceOnTick(double price) const; |
RoundPriceToTick() | Returns the specified price rounded to a tradable tick |
TickPriceDown() | Returns the tradable price a number of ticks below the specified price. double TickPriceDown(double price, uint32_t offset) const; |
TickPriceUp() | Returns the tradable price a number of ticks above the specified price. double TickPriceUp(double price, uint32_t offset) const; |