TT CORE SDK  0.1
TT CORE SDK documentation
instrument.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <tt_core_sdk/enums.hpp>
4 #include <cstdint>
5 #include <vector>
6 #include <memory>
7 
8 namespace tt_core_sdk {
9 
10 struct opaque_data;
11 
15 {
16 public:
17  static constexpr size_t MAX_TICK_TABLE_ROW_COUNT = 128;
18 
20  bool IsValid (void) const noexcept;
21 
38  double OffsetPrice (double price, int32_t offset, rounding round) const noexcept;
39 
44  double TickPriceUp (double price, uint32_t offset) const noexcept;
45 
50  double TickPriceDown (double price, uint32_t offset) const noexcept;
51 
56  double RoundPriceToTick (double price, rounding round) const noexcept;
57 
62  double GetMinTickSize (void) const noexcept;
63 
66  bool IsPriceOnTick (double price) const noexcept;
67 
74  int32_t PriceToTicks (double price) const noexcept;
75 
76  uint64_t instr_id;
77  uint64_t instr_version;
78  uint64_t synthetic_instr_id;
80  uint64_t algo_compliance_id;
81 
82  std::string name;
83  std::string alias;
84  std::string security_id;
85  std::string series_key;
86 
88  std::string symbol;
89  uint64_t product_id;
90  uint64_t product_version;
93 
94  double tick_value;
95  double tick_size;
96  uint32_t tick_num;
97  uint32_t tick_denom;
98  double point_value;
99  double display_factor;
101 
102  std::string price_topic;
103  std::string price_formula;
104  std::string implied_rules;
105 
106  uint32_t starting_date;
107  uint32_t last_trading_date;
109  uint32_t maturity_date;
110 
111  double strike_price;
112  uint16_t option_code_id;
113  uint16_t option_scheme_id;
114  uint16_t series_term_id;
115  uint16_t combo_type_id;
116 
119 
123  {
124  uint64_t tick_table_id;
125  size_t count;
126 
127  struct row
128  {
129  double price;
130  double tick_size;
132  } tick_table;
133 
137  {
138  std::shared_ptr<Instrument> instr;
140  double strike;
141  int32_t ratio;
143  std::string name;
145  std::string alias;
146  };
147 
148  std::vector<instrument_leg> legs;
149 
152  uint32_t update_source;
154  std::unique_ptr<opaque_data> opaque;
155 
156  bool IsAlgoVersion (const std::string& version) const noexcept;
157  bool IsAlgoADL (void) const noexcept;
158  bool IsAlgoSO (void) const noexcept;
159  uint64_t KeyId (void) const noexcept;
161 };
162 
168 std::shared_ptr<Instrument> DownloadInstrument (uint64_t instr_id);
169 
178 std::shared_ptr<Instrument> DownloadInstrument (const std::string& query, enum market market_id);
179 
180 } // namespace tt_core_sdk
double strike_price
Strike price.
Definition: instrument.hpp:111
uint32_t tick_denom
Ticking: Denominator.
Definition: instrument.hpp:97
uint32_t tick_num
Ticking: Numerator.
Definition: instrument.hpp:96
uint64_t synthetic_instr_id
Synthetic Instrument ID.
Definition: instrument.hpp:78
std::string alias
Security Alias.
Definition: instrument.hpp:145
currency_code
ISO currency codes.
Definition: enums.hpp:329
uint16_t option_code_id
Option code ID.
Definition: instrument.hpp:112
uint16_t combo_type_id
Combo type ID.
Definition: instrument.hpp:115
product_type_id
Product Type identifiers.
Definition: enums.hpp:201
double TickPriceUp(double price, uint32_t offset) const noexcept
Returns the tradable price a number of ticks above the specified price.
Definition of a contract on an exchange.
Definition: instrument.hpp:14
uint64_t product_version
Product version.
Definition: instrument.hpp:90
std::string security_id
Security ID.
Definition: instrument.hpp:84
enum instr_state state
Internal.
Definition: instrument.hpp:151
bool IsAlgoADL(void) const noexcept
enum currency_code product_currency
Native product currency.
Definition: instrument.hpp:92
bool IsValid(void) const noexcept
Check if the instrument data is valid.
std::shared_ptr< Instrument > DownloadInstrument(uint64_t instr_id)
Synchronous Instrument download by instrument id.
bool supports_implieds
Instrument supports implied prices.
Definition: instrument.hpp:117
bool IsPriceOnTick(double price) const noexcept
Returns if the specified price is on a tradable tick.
uint32_t maturity_date
Maturity date.
Definition: instrument.hpp:109
double tick_size
Interval between tradable prices.
Definition: instrument.hpp:95
uint64_t underlying_instr_id
Underlying Instrument ID.
Definition: instrument.hpp:79
bool IsAlgoVersion(const std::string &version) const noexcept
uint64_t product_id
Product ID.
Definition: instrument.hpp:89
double tick_value
Value of one tick in the default currency.
Definition: instrument.hpp:94
std::shared_ptr< Instrument > instr
Definition: instrument.hpp:138
enum product_type_id product_type_id
Product type.
Definition: instrument.hpp:91
std::string name
Instrument Name (e.g. ESZ4)
Definition: instrument.hpp:82
uint64_t algo_compliance_id
Algo identifier for exchange compliance.
Definition: instrument.hpp:80
std::string series_key
Unique TT assigned ID.
Definition: instrument.hpp:85
double GetMinTickSize(void) const noexcept
Returns the minimum tick size.
static constexpr size_t MAX_TICK_TABLE_ROW_COUNT
Max supported tick table entries.
Definition: instrument.hpp:17
double point_value
Value of one point in the default currency.
Definition: instrument.hpp:98
std::string price_topic
The topic which price update is send on.
Definition: instrument.hpp:102
uint64_t instr_version
Instrument version.
Definition: instrument.hpp:77
uint64_t instr_id
Instrument ID.
Definition: instrument.hpp:76
std::string implied_rules
Implied rules.
Definition: instrument.hpp:104
uint32_t starting_date
Starting date.
Definition: instrument.hpp:106
std::vector< instrument_leg > legs
Definition: instrument.hpp:148
double RoundPriceToTick(double price, rounding round) const noexcept
Returns the specified price rounded to a tradable tick.
enum market market_id
Market Identifier.
Definition: instrument.hpp:87
uint16_t option_scheme_id
Option scheme ID.
Definition: instrument.hpp:113
double OffsetPrice(double price, int32_t offset, rounding round) const noexcept
Returns the tradable price a number of ticks from the specified price.
std::string symbol
Product Symbol (e.g. ES)
Definition: instrument.hpp:88
std::unique_ptr< opaque_data > opaque
Definition: instrument.hpp:154
bool IsAlgoSO(void) const noexcept
double display_factor
Display Factor.
Definition: instrument.hpp:99
double min_price_increment
Minimal price increment.
Definition: instrument.hpp:100
struct tt_core_sdk::Instrument::tick_table_data::row rows[MAX_TICK_TABLE_ROW_COUNT]
int32_t PriceToTicks(double price) const noexcept
Returns the specified price in tradable ticks.
uint32_t last_trading_date
Last trading date.
Definition: instrument.hpp:107
uint32_t first_delivery_date
First delivery date.
Definition: instrument.hpp:108
std::string alias
Alias (e.g. ES Dec14)
Definition: instrument.hpp:83
struct tt_core_sdk::Instrument::tick_table_data tick_table
uint16_t series_term_id
Series term ID.
Definition: instrument.hpp:114
std::string price_formula
User-defined price formula for a spread.
Definition: instrument.hpp:103
double TickPriceDown(double price, uint32_t offset) const noexcept
Returns the tradable price a number of ticks below the specified price.
std::string name
Security Desc.
Definition: instrument.hpp:143
uint64_t KeyId(void) const noexcept
bool is_not_tradable
Instrument is not tradable.
Definition: instrument.hpp:118