XROAD
mdata_proto.h
Go to the documentation of this file.
1 #pragma once
8 #include <common/xroad_string.h>
9 #include <common/xroad_time.h>
10 #include <common/xroad_date.h>
12 
13 #pragma pack(push, 4)
14 
15 #define MDATA_INDICATOR_TYPE_SIZE 8
16 
17 typedef enum
18 {
19  mdata_proto_type_heartbeat = 0,
20  mdata_proto_type_resolve = 1,
21  mdata_proto_type_subscribe = 2,
22  mdata_proto_type_symbol = 3,
23  mdata_proto_type_book = 4,
24  mdata_proto_type_trade = 5,
25  mdata_proto_type_subscribe_res = 6,
26  mdata_proto_type_feed_state = 7,
27  mdata_proto_type_quote = 8,
28  mdata_proto_type_common_info = 9,
29  mdata_proto_type_order = 10,
30  mdata_proto_type_bar = 11,
31  mdata_proto_type_indicator = 12,
32  mdata_proto_type_bestprice = 13,
33  mdata_proto_type_speedway = 14
34 } mdata_proto_type_t;
35 
36 #define MAX_PROTO_TYPE 12
37 
38 typedef enum
39 {
40  mdata_feed_offline = 0,
41  mdata_feed_online = 1,
42  mdata_feed_unknown = 2
43 } mdata_feed_state_type_t;
44 
45 typedef enum
46 {
47  mdata_ask_t = 1,
48  mdata_bid_t = 2
49 } mdata_side_t;
50 
51 typedef enum
52 {
53  mdata_canceled_t = 0,
54  mdata_new_t = 1,
55  mdata_filled_t = 2,
56  mdata_replaced_t = 3,
57  mdata_clear_book_t = 4
58 } mdata_status_t;
59 
60 typedef enum
61 {
62  mdata_subscription_book = 1,
63  mdata_subscription_trade = 2,
64  mdata_subscription_quote = 4,
65  mdata_subscription_common = 8,
66  mdata_subscription_orders = 16,
67  mdata_subscription_snapshot = 32,
68  mdata_subscription_updates = 64,
69  mdata_subscription_bar = 128,
70  mdata_subscription_indicator = 256,
71  mdata_subscription_bestprice = 512,
72  mdata_subscription_speedway = 1024
73 } mdata_subscription_type_t;
74 
75 typedef struct mdata_heartbeat_s
76 {
77  mdata_feed_state_type_t state;
78  xroad_object_id_t source_id;
80 
81 typedef struct mdata_book_level_s
82 {
83  xroad_price_t price;
84  xroad_qty_t qty;
86 
87 typedef uint32_t mdata_subscription_mask_t;
88 
89 typedef struct mdata_subscribe_s
90 {
91  char alias[XROAD_ALIAS_SIZE + 1];
92  char req_id[XROAD_UUID_SIZE + 1];
93  mdata_subscription_mask_t mask;
95 
97 {
98  xroad_object_id_t instr_id;
99  char req_id[XROAD_UUID_SIZE + 1];
100  xroad_errno_t error_num;
101  mdata_subscription_mask_t mask;
103 
104 #define MDATA_BOOK_20_SIZE 20U
105 
106 typedef struct mdata_book_20_s
107 {
108  xroad_object_id_t instr_id;
109  mdata_book_level_t asks[MDATA_BOOK_20_SIZE];
110  mdata_book_level_t bids[MDATA_BOOK_20_SIZE];
111  xroad_timestamp_t exch_ts;
112  xroad_timestamp_t ts;
113  xroad_object_id_t source_id;
114  //xroad_timestamp_t rcv_ts;
116 
117 typedef struct mdata_quote_s
118 {
119  xroad_object_id_t instr_id;
120  mdata_book_level_t ask;
121  mdata_book_level_t bid;
122  xroad_timestamp_t exch_ts;
123  xroad_timestamp_t ts;
124  uint32_t flag;
125  xroad_object_id_t source_id;
126  //xroad_timestamp_t rcv_ts;
127 } mdata_quote_t;
128 
129 typedef struct mdata_trade_s
130 {
131  xroad_object_id_t instr_id;
132  xroad_price_t price;
133  xroad_qty_t qty;
134  xroad_side_t side;
135  xroad_timestamp_t exch_ts;
136  xroad_timestamp_t ts;
137  xroad_object_id_t source_id;
138  //xroad_timestamp_t rcv_ts;
139 } mdata_trade_t;
140 
141 typedef struct mdata_order_s
142 {
143  xroad_object_id_t instr_id;
144  int64_t record_id;
145  xroad_price_t price;
146  xroad_qty_t qty;
147  xroad_side_t side;
148  xroad_timestamp_t exch_ts;
149  xroad_timestamp_t ts;
150  int64_t order_id;
151  mdata_status_t status;
152  int64_t trade_id;
153  xroad_price_t trade_price;
154  xroad_object_id_t source_id;
155 } mdata_order_t;
156 
157 typedef struct mdata_best_prices_s
158 {
159  xroad_object_id_t instr_id;
160  xroad_object_id_t source_id;
161  xroad_price_t bid;
162  xroad_price_t ask;
163  xroad_timestamp_t exch_ts;
164  xroad_timestamp_t ts;
166 
167 typedef struct mdata_feed_state_s
168 {
169  xroad_object_id_t instr_id;
170  mdata_feed_state_type_t state;
171  xroad_object_id_t source_id;
173 
174 typedef enum
175 {
176  mdata_oi_t = 1,
177  mdata_min_t = 2,
178  mdata_max_t = 4,
179  mdata_open_t = 8,
180  mdata_high_t = 16,
181  mdata_low_t = 32,
182  mdata_last_t = 64,
183  mdata_volume_t = 128,
184  mdata_open_period_t = 256,
185  mdata_vwap_t = 512,
186  mdata_close_t = 1024,
187  mdata_oa_price_t = 2048,
188  mdata_ca_price_t = 4096,
189  mdata_trading_status_t = 8192,
190  mdata_lower_limit_t = 16384,
191  mdata_upper_limit_t = 32768,
192  mdata_wa_price_t = 0x10000,
193  mdata_settle_date_t = 0x20000,
194 } mdata_stat_flag_t;
195 
196 typedef struct mdata_common_info_s
197 {
198  xroad_object_id_t instr_id;
199  int32_t flag;
200  xroad_price_t oi;
201  xroad_price_t min;
202  xroad_price_t max;
203  xroad_price_t open;
204  xroad_price_t close;
205  xroad_price_t high;
206  xroad_price_t low;
207  xroad_price_t last;
208  xroad_price_t volume;
209  xroad_price_t open_period;
210  xroad_price_t vwap;
211  xroad_price_t oa_price;
212  xroad_price_t ca_price;
213  xroad_price_t lower_limit;
214  xroad_price_t upper_limit;
215  xroad_trading_status_t trading_status;
216  xroad_timestamp_t ts;
217  xroad_timestamp_t exch_ts;
218  xroad_object_id_t source_id;
219  xroad_price_t wa_price;
220  xroad_date_t settle_date;
222 
223 typedef struct mdata_bar_s
224 {
225  xroad_object_id_t instr_id;
226  xroad_object_id_t source_id;
227  xroad_timestamp_t open_ts;
228  xroad_timestamp_t ts; // ts of update
229  int32_t size; // length of bar in minutes
230  xroad_price_t open;
231  xroad_price_t close;
232  xroad_price_t high;
233  xroad_price_t low;
234  xroad_price_t pvol;
235  xroad_qty_t qvol;
236 } mdata_bar_t;
237 
238 typedef struct mdata_indicator_s
239 {
240  xroad_object_id_t instr_id;
241  xroad_object_id_t source_id;
242  xroad_timestamp_t ts; // ts of update
243  char type[MDATA_INDICATOR_TYPE_SIZE + 1];
244  xroad_price_t value;
246 
247 typedef struct
248 {
249  xroad_str_t key;
250  xroad_field_type_t type;
251  xroad_binary_t value;
252  xroad_timestamp_t ts; // ts of update
254 
255 #pragma pack(pop)
Definition: mdata_proto.h:224
Definition: mdata_proto.h:158
Definition: mdata_proto.h:107
Definition: mdata_proto.h:82
Definition: mdata_proto.h:197
Definition: mdata_proto.h:168
Definition: mdata_proto.h:76
Definition: mdata_proto.h:239
Definition: mdata_proto.h:142
Definition: mdata_proto.h:118
Definition: mdata_proto.h:248
Definition: mdata_proto.h:97
Definition: mdata_proto.h:90
Definition: mdata_proto.h:130
Definition: xroad_binary.h:24
Definition: xroad_date.h:20
Definition: xroad_string.h:29
CAUTION: do not change this file - it is autogenerated.
#define XROAD_ALIAS_SIZE
Definition: xroad_objects_types.h:193
int64_t xroad_qty_t
Definition: xroad_objects_types.h:159