-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsidepit_api.proto
More file actions
462 lines (407 loc) · 11.5 KB
/
Copy pathsidepit_api.proto
File metadata and controls
462 lines (407 loc) · 11.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
syntax = "proto3";
message Transaction {
int32 version = 1;
uint64 timestamp = 10;
oneof tx {
NewOrder new_order = 20;
CancelReplace replace_order = 22;
string cancel_orderid = 30;
AuctionBid auction_bid = 40;
UnlockRequest unlock_req = 50;
BtcLocks btc_locks = 60;
Delegate new_delegate = 70;
string revoke_delegate = 72;
}
string sidepit_id = 101;
string agent_id = 102;
}
message SignedTransaction {
int32 signature_version = 2;
Transaction transaction = 11;
string tx_digest = 21;
string pubkey = 31;
string signature = 111;
}
message RejectedTransaction {
Transaction transaction = 110;
RejectCode reject_code = 120;
}
message NewOrder {
sint32 side = 11;
int32 size = 20;
int32 price = 30;
string ticker = 40;
}
message CancelReplace {
int32 price = 30;
string ref_orderid = 40;
}
message AuctionBid {
uint64 epoch = 10;
string hash = 20;
string ordering_salt = 30;
int32 bid = 40;
}
message UnlockRequest {
AmountType minmax = 20;
uint64 explicit_amount = 30;
}
message Delegate {
string agent_id = 10;
string agent_pubkey = 20;
string signature = 111;
}
message EpochEvent {
uint64 epoch = 10;
string hash = 20;
string id = 100;
bytes signature = 110;
}
message ExchangeEvent {
ExchangeState state = 10;
}
message BtcEvent {
SignedTransaction btc_locks = 10;
}
message AccountEvent {
SignedTransaction account_tx = 10;
}
message TxBlockStream {
uint64 epoch = 10;
ExchangeState estate = 20;
oneof txepoch {
EpochEvent epoch_event = 25;
SignedTransaction stx = 31;
ExchangeEvent exchange_event = 40;
BtcEvent btc_event = 50;
AccountEvent account_event = 60;
}
}
message MarketQuote {
int32 bidsize = 10;
int32 bid = 20;
int32 ask = 30;
int32 asksize = 40;
int32 last = 50;
int32 lastsize = 60;
bool upordown = 70;
string ticker = 80;
uint64 epoch = 90;
}
message EpochBar {
string ticker = 10;
uint64 epoch = 15;
int32 open = 20;
int32 high = 30;
int32 low = 40;
int32 close = 50;
int32 volume = 60;
}
message BarHistory {
string ticker = 10;
repeated EpochBar bars = 20;
string session_id = 30;
string prev_session_id = 40;
string next_session_id = 50;
}
message ContractBar {
string ticker = 10;
uint64 epoch = 15;
int32 day_open = 20;
int32 day_high = 30;
int32 day_low = 40;
int32 day_close = 50;
int32 day_volume = 60;
int32 high = 70;
int32 low = 80;
int32 volume = 90;
int32 open_interest = 100;
int32 previous_close = 110;
}
message BookOrder {
sint32 side = 10;
int32 price = 20;
int32 open_qty = 30;
int32 filled_qty = 40;
int32 remaining_qty = 50;
int32 canceled_qty = 60;
int32 agres_fill_qty = 62;
float agres_avg_price = 63;
int32 pass_fill_qty = 64;
float avg_price = 65;
string ticker = 70;
string update_time = 80;
string orderid = 90;
string traderid = 100;
string agentid = 110;
uint64 sequence = 120;
}
message DepthItem {
int32 level = 10;
int32 b = 30;
int32 a = 40;
int32 bs = 50;
int32 as = 60;
}
message MarketData {
int32 version = 1;
uint64 epoch = 10;
string ticker = 12;
EpochBar bar = 20;
MarketQuote quote = 30;
repeated DepthItem depth = 40;
}
message FillData {
string agressiveid = 10;
string passiveid = 20;
uint32 price = 30;
uint32 qty = 40;
int32 agressive_side = 50;
uint64 microtime = 60;
}
message OrderData {
int32 version = 1;
uint64 epoch = 10;
string ticker = 12;
repeated BookOrder bookorders = 40;
repeated FillData fills = 50;
repeated TraderMarginState margin_states = 70;
uint32 more_in_epoch = 80;
}
message TraderMarginState {
string sidepit_id = 10;
sint64 available_margin = 20;
sint32 risk_position = 30;
sint64 open_pnl = 40;
sint32 net_oi = 50;
}
message Contract {
string symbol = 10;
uint32 unit_size = 20;
string unit = 30;
string price_quote = 40;
int32 price_quote_units = 50;
uint32 tic_min = 60;
uint32 tic_value = 70;
int32 price_limit_percent = 80;
uint64 initial_margin = 90;
uint64 maint_margin = 100;
int32 position_limits = 110;
string trading_open_time_zone = 140;
string trading_close_time_zone = 150;
}
message Product {
string ticker = 10;
string contract_symbol = 20;
uint64 expiration_date = 30;
uint64 start_trading_date = 40;
bool is_active = 50;
}
message Schedule {
uint64 date = 10;
uint64 trading_open_time = 20;
uint64 trading_close_time = 30;
repeated string product = 40;
}
message CalendarSchedule {
string exchange_id = 10;
repeated Schedule products = 30;
}
message TradingSession {
string session_id = 10;
Schedule schedule = 20;
string prev_session_id = 50;
}
message SessionStatus {
ExchangeState estate = 10;
string session_id = 20;
}
message ExchangeStatus {
TradingSession session = 10;
SessionStatus status = 20;
}
message ActiveContractProduct {
Contract contract = 10;
Product product = 20;
Schedule schedule = 30;
}
message Position {
sint32 position = 10;
float avg_price = 21;
uint32 old_avg = 20;
}
message ContractScheduleProducts {
Contract contract = 10;
Schedule schedule = 20;
repeated Product products = 30;
}
message OrderFills {
BookOrder order = 10;
repeated FillData fills = 50;
}
message BtcLocks {
string txid = 10;
string pubkey = 20;
string btc_address = 30;
uint64 lock_sats = 40;
uint64 unlock_sats = 50;
bool is_pending = 60;
}
message PositionMargin {
int64 realized_pnl = 50;
int64 realized_fees = 52;
int64 margin_required = 80;
int32 reduce_only = 112;
sint32 carried_position = 130;
sint32 new_position = 140;
}
message AccountTickerPosition {
string ticker = 1;
Position position = 10;
PositionMargin margin = 20;
int32 open_bids = 150;
int32 open_asks = 160;
}
message ContractMargin {
string symbol = 113;
PositionMargin margin = 115;
map<string, AccountTickerPosition>
positions = 121;
sint32 carried_open_interest = 200;
sint32 net_open_interest = 210;
int32 bid_margin_required = 220;
int32 ask_margin_required = 230;
}
message AccountMarginState {
string sidepit_id = 10;
string pubkey = 20;
repeated Delegate active_delegates = 25;
int64 total_balance = 24;
int64 net_locked = 30;
int64 pending_unlock = 40;
int64 available_balance = 90;
int64 available_margin = 100;
bool is_restricted = 110;
map<string, ContractMargin>
contract_margins = 121;
}
message AccountDelegate {
string delegateid_oid = 10;
string agent_id = 20;
enum DelegateStatus {
DELEGATE_NONE = 0;
DELEGATE_ACTIVE = 1;
DELEGATE_REVOKED = 2;
}
DelegateStatus status = 30;
bool is_active = 40;
uint64 updatetime = 50;
}
message AccountRequest {
Transaction account_tx = 10;
bool is_pending = 20;
string oid = 30;
}
message DelegateData {
AccountDelegate account_delegate = 10;
repeated AccountRequest requests = 50;
}
message UnlockRecord {
AccountRequest unlock_tx = 10;
enum UnlockStatus {
UNLOCK_NONE = 0;
UNLOCK_PENDING = 1;
UNLOCK_REJECTED = 2;
UNLOCK_RESERVED = 3;
UNLOCK_PROCESSING = 4;
UNLOCK_COMPLETED = 5;
}
UnlockStatus status = 20;
string oid = 30;
uint64 amount_sats = 40;
string btc_txid = 50;
map <uint64, UnlockStatus>
updatetime = 60;
}
message AccountOperations {
repeated AccountDelegate delegate_data = 80;
repeated UnlockRecord unlock_records = 82;
repeated AccountRequest account_requests = 90;
}
message RequestReply {
int32 TypeMask = 1;
string traderid = 10;
string ticker = 30;
SignedTransaction account_tx = 40;
string session_id = 50;
}
message ReplyRequest {
int32 TypeMask = 10;
TraderPositionOrders trader_positions = 20;
ActiveProduct active_product = 30;
MarketData market_data = 40;
BarHistory bars = 50;
CalendarSchedule calendar_schedule = 60;
}
message TraderPositionOrders {
string traderid = 10;
string symbol = 20;
map<string, OrderFills> orderfills = 40;
AccountMarginState accountstate = 50;
repeated BtcLocks locks = 60;
TraderMarginState trader_margin_state = 70;
AccountOperations accountops = 100;
}
message ActiveProduct {
string ticker = 2;
ActiveContractProduct active_contract_product = 10;
ExchangeStatus exchange_status = 20;
ContractBar contractbar = 30;
}
message EpochOrders {
uint64 epoch = 10;
ExchangeState estate = 15;
map<string, Transaction>
orders = 20;
repeated Transaction locks = 30;
repeated Transaction accountops = 40;
}
enum ReplyRequestTypes {
NONE = 0;
ACTIVE_PRODUCT = 1;
POSITIONS = 2;
QUOTE = 4;
SNAPSHOT = 8;
HISTORICAL_BARS = 16;
SCHEDULES = 32;
DELEGATE = 64;
UNLOCK = 128;
}
enum ExchangeState {
EXCHANGE_UNKNOWN = 0;
EXCHANGE_PENDING_OPEN = 1;
EXCHANGE_OPEN = 2;
EXCHANGE_RECOVERING = 3;
EXCHANGE_CLOSING = 4;
EXCHANGE_SETTLED = 5;
EXCHANGE_CLOSED = 6;
}
enum RejectCode {
RC_NONE = 0;
RC_VERIFY = 1;
RC_DUP = 2;
RC_ID = 4;
RC_BAD = 5;
RC_REDUCE = 6;
RC_MARGIN = 7;
RC_DK = 8;
RC_CDUP = 9;
RC_CREJ = 10;
RC_OTHER = 100;
}
enum AmountType {
AMOUNT_NONE = 0;
MAX = 1;
MIN = 2;
EXPLICIT = 3;
}