TT CORE SDK 2.0.1.1
TT CORE SDK documentation
Loading...
Searching...
No Matches
prices.h
Go to the documentation of this file.
1/***************************************************************************
2 *
3 * Unpublished Work Copyright (c) 2018-2020
4 * Trading Technologies International, Inc.
5 * All Rights Reserved Worldwide
6 *
7 * * * * S T R I C T L Y P R O P R I E T A R Y * * *
8 *
9 * WARNING: This program (or document) is unpublished, proprietary property
10 * of Trading Technologies International, Inc. and is to be maintained in
11 * strict confidence. Unauthorized reproduction, distribution or disclosure
12 * of this program (or document), or any program (or document) derived from
13 * it is prohibited by State and Federal law, and by local law outside of
14 * the U.S.
15 *
16 ***************************************************************************/
17#pragma once
18
19#include <stddef.h>
21#include "enums/TradingStatus.h"
24#include "enums/TradeType.h"
26#include "instrument.h"
27#include "consts.h"
28#include <math.h>
29
30namespace ttsdk {
31
32 enum class PriceEventType
33 {
34 DIRECT,
37 UNKNOWN,
38 };
39 struct PriceSnap
40 {
41 static constexpr size_t MAX_DEPTH_LEVEL = 10;
42
43 enum class SnapStatus
44 {
48 ERROR,
49 UNKNOWN,
50 };
56
59 struct DepthSnap
60 {
70
71 size_t count;
72 };
73
74 uint64_t instrument_id;
76
81
83 double open_price = NAN;
84 double close_price = NAN;
85 double high_price = NAN;
86 double low_price = NAN;
87 double last_trade_price = NAN;
88 double last_trade_quantity = NAN;
89 double volume = NAN;
91 double settlement_price = NAN;
93 double open_interest = NAN;
96
98 double ind_settle = NAN;
99 double ind_price = NAN;
100 double ind_quantity = NAN;
101 double ind_bid = NAN;
102 double ind_ask = NAN;
104
105
108 uint64_t seq_no;
109 uint64_t conflation_no;
110 uint64_t exchange_time;
111 uint64_t server_time;
112 uint64_t client_time;
113 uint64_t sdk_time;
116 };
117
155
156
179
187 {
188 public:
189 virtual ~IPriceEventHandler(void) noexcept = default;
190
192 virtual void OnPriceUpdate(const uint64_t subId, const InstrumentPtr& instrument, const PriceSnap& snap) = 0;
193
195 virtual void OnError(const uint64_t subId, const InstrumentPtr& instrument,
196 const SubscriptionError code, const char* error) = 0;
197
199 virtual void OnDisconnect(const uint64_t subId, const InstrumentPtr& instrument, const PriceEventType type) = 0;
200
202 // destroy the handler object (sdk will no longer use it)
203 virtual void OnUnsubscribed(const uint64_t subId) = 0;
204 };
206
211 {
212 public:
213 virtual ~ITimeSalesEventHandler(void) noexcept = default;
214
216 virtual void OnTimeSalesUpdate(const uint64_t subId, const InstrumentPtr& instrument, const TimeSales& ts) = 0;
217
219 virtual void OnError(const uint64_t subId, const InstrumentPtr& instrument,
220 const SubscriptionError code, const char* error) = 0;
221
223 virtual void OnDisconnect(const uint64_t subId, const InstrumentPtr& instrument, const PriceEventType type) = 0;
224
226 // destroy the handler object (sdk will no longer use it)
227 virtual void OnUnsubscribed(const uint64_t subId) = 0;
228 };
230
231
232
233}
Interface for listening to price subscription events.
Definition prices.h:187
virtual void OnUnsubscribed(const uint64_t subId)=0
Callback fired when the unsubscribe request is complete and it is safe to.
virtual void OnPriceUpdate(const uint64_t subId, const InstrumentPtr &instrument, const PriceSnap &snap)=0
Callback delivering price updates.
virtual void OnError(const uint64_t subId, const InstrumentPtr &instrument, const SubscriptionError code, const char *error)=0
Callback fired when an error occurs fulfilling a price subscription request.
virtual void OnDisconnect(const uint64_t subId, const InstrumentPtr &instrument, const PriceEventType type)=0
Callback fired when an disconnection event happens.
virtual ~IPriceEventHandler(void) noexcept=default
Interface for listening to time and sales subscription events.
Definition prices.h:211
virtual ~ITimeSalesEventHandler(void) noexcept=default
virtual void OnDisconnect(const uint64_t subId, const InstrumentPtr &instrument, const PriceEventType type)=0
Callback fired when an disconnection event happens.
virtual void OnTimeSalesUpdate(const uint64_t subId, const InstrumentPtr &instrument, const TimeSales &ts)=0
Callback indicating.
virtual void OnError(const uint64_t subId, const InstrumentPtr &instrument, const SubscriptionError code, const char *error)=0
Callback fired when an error occurs fulfilling a price subscription request.
virtual void OnUnsubscribed(const uint64_t subId)=0
Callback fired when the unsubscribe request is complete and it is safe to.
#define U64NAN
Definition consts.h:20
PriceEventType
Definition prices.h:33
SubscriptionError
Definition prices.h:157
TradeType
Definition TradeType.h:22
double quantity
Total quantity at this level.
Definition prices.h:67
int32_t order_count
Number of orders that make up the total quantity.
Definition prices.h:66
double implied_quantity
Implied quantity contributing to the total quantity.
Definition prices.h:68
size_t count
Number of available price depth levels.
Definition prices.h:71
struct ttsdk::PriceSnap::DepthSnap::DepthLevel levels[MAX_DEPTH_LEVEL]
uint64_t instrument_id
Instrument Id for the trade.
Definition prices.h:74
uint64_t exchange_seq_no
Definition prices.h:114
uint64_t epoch_transact_time_nano
Definition prices.h:94
uint64_t conflation_no
App level conflation value.
Definition prices.h:109
uint64_t server_time
Price Server timestamp (mdrc_recv_time);.
Definition prices.h:111
uint64_t settlement_time
Settlement time in nanos past the epoch (U64NAN when unavailable)
Definition prices.h:92
double last_trade_price
Last traded price (NAN when unavailable)
Definition prices.h:87
ImpliedsSource implieds_source
Definition prices.h:55
DepthSnap asks
Price feed depth.
Definition prices.h:78
double ind_bid
Indicative Bid price (NAN when unavailable)
Definition prices.h:101
TradingStatus market_state
Market State.
Definition prices.h:75
double volume
Total contract volume.
Definition prices.h:89
uint64_t client_time
Client timestamp (client_recv_time);.
Definition prices.h:112
double close_price
Close price (NAN when unavailable)
Definition prices.h:84
SnapStatus simulated
status of the simulated subscription
Definition prices.h:54
uint64_t exchange_time
Exchange timestamp.
Definition prices.h:110
double ind_settle
Indicative values.
Definition prices.h:98
double settlement_price
Settlement price (NAN when unavailable)
Definition prices.h:91
DepthSnap bids
Definition prices.h:79
PriceEventType event_type
Price snapshot properties.
Definition prices.h:107
uint64_t seq_no
Price snap sequence number.
Definition prices.h:108
double ind_quantity
Indicative quantity (NAN when unavailable)
Definition prices.h:100
SnapStatus direct
status of the direct subscription
Definition prices.h:52
double open_price
Price feed properties.
Definition prices.h:83
double open_interest
Open interest.
Definition prices.h:93
double high_price
High price (NAN when unavailable)
Definition prices.h:85
bool all_snaps_ready
helper bool indicates all requested data has been received and merged
Definition prices.h:51
double last_trade_quantity
Last traded quantity (NAN when unavailable)
Definition prices.h:88
double ind_ask
Definition prices.h:102
uint64_t sdk_time
User listener timestamp (order_stimulus_received_algo)
Definition prices.h:113
double cum_last_trade_quantity
Cum Last traded quantity (NAN when unavailable)
Definition prices.h:90
double ind_price
Indicative price (NAN when unavailable)
Definition prices.h:99
static constexpr size_t MAX_DEPTH_LEVEL
Max supported levels of depth.
Definition prices.h:41
SnapStatus implied
status of the implied subscription
Definition prices.h:53
double low_price
Low price (NAN when unavailable)
Definition prices.h:86
uint64_t exchange_transact_time_ns
Definition prices.h:148
uint64_t epoch_transact_time_nano
Time and Sales trade properties.
Definition prices.h:147
uint64_t alternate_epoch_transact_time_nano
Definition prices.h:143
ttsdk::TradeIndicator indicator
Definition prices.h:134
ttsdk::TradeType trade_side
Trade Side.
Definition prices.h:132
ttsdk::TradeQualifier qualifier
Trade Qualifier.
Definition prices.h:133
double alternate_last_traded_quantity
Definition prices.h:142
ttsdk::ExchSupportedOTCTypes otc_type
Definition prices.h:135
double last_trade_quantity
Last traded quantity (NAN when unavailable)
Definition prices.h:131
uint64_t exchange_seq_no
Definition prices.h:149
double last_trade_price
Time and Sales feed properties.
Definition prices.h:130
double alternate_last_traded_price
Alternate trade information.
Definition prices.h:141
uint32_t ask_counterparty_id
Definition prices.h:137
uint32_t bid_counterparty_id
Definition prices.h:136
Time and Sales update data.
Definition prices.h:121
PriceEventType event_type
Definition prices.h:124
static constexpr size_t MAX_EVENTS
Max supported trades in one update.
Definition prices.h:122
Trade trades[MAX_EVENTS]
Definition prices.h:152
uint64_t instrument_id
Instrument Id for the trade.
Definition prices.h:123
size_t count
Number of available T&S events.
Definition prices.h:125