godark 0.2.0

Rust SDK for GoDark DEX — encrypted trading over WebSocket
Documentation
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
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
// This file is @generated by prost-build.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct OrderMessage {
    #[prost(uint64, tag = "1")]
    pub order_id: u64,
    #[prost(uint64, tag = "2")]
    pub sequence: u64,
    #[prost(uint64, tag = "3")]
    pub symbol_id: u64,
    #[prost(enumeration = "super::super::common::v1::Side", tag = "4")]
    pub side: i32,
    #[prost(enumeration = "super::super::common::v1::OrderType", tag = "5")]
    pub order_type: i32,
    #[prost(uint64, tag = "6")]
    pub price: u64,
    #[prost(uint64, tag = "7")]
    pub quantity: u64,
    #[prost(enumeration = "super::super::common::v1::TimeInForce", tag = "9")]
    pub time_in_force: i32,
    #[prost(uint64, optional, tag = "10")]
    pub min_fill_size: ::core::option::Option<u64>,
    #[prost(uint64, optional, tag = "11")]
    pub expiry_time: ::core::option::Option<u64>,
    #[prost(bytes = "vec", tag = "12")]
    pub correlation_id: ::prost::alloc::vec::Vec<u8>,
    #[prost(uint64, tag = "13")]
    pub timestamp: u64,
    /// Leverage multiplier (1 = 1x isolated margin). Carried end-to-end from
    /// client -> edge -> sequencer so risk checks and UI state use the
    /// client-selected value instead of a hardcoded 1.
    #[prost(uint32, tag = "15")]
    pub leverage: u32,
    #[prost(enumeration = "super::super::common::v1::StpMode", tag = "16")]
    pub stp_mode: i32,
    /// Reduce-only: order must reduce an existing position; rejected if no
    /// position or same-side; quantity clamped to position size.
    #[prost(bool, tag = "17")]
    pub reduce_only: bool,
    /// Post-only: order must rest on the book as a maker; rejected if it
    /// would immediately cross the spread.
    #[prost(bool, tag = "18")]
    pub post_only: bool,
    /// Signed basis-point offset relative to the Pyth mark.
    #[prost(sint32, optional, tag = "21")]
    pub peg_offset_bps: ::core::option::Option<i32>,
    /// Mark trigger for stop-market / stop-limit (fixed-point integer).
    #[prost(uint64, optional, tag = "24")]
    pub trigger_price: ::core::option::Option<u64>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CancelMessage {
    #[prost(uint64, tag = "1")]
    pub order_id: u64,
    #[prost(uint64, tag = "3")]
    pub symbol_id: u64,
    #[prost(uint64, tag = "4")]
    pub sequence: u64,
    #[prost(bytes = "vec", tag = "5")]
    pub correlation_id: ::prost::alloc::vec::Vec<u8>,
    /// Set by the sequencer for liquidation-driven cancels; omitted for user cancels.
    #[prost(enumeration = "super::super::common::v1::CancelReason", optional, tag = "6")]
    pub cancel_reason: ::core::option::Option<i32>,
}
/// Edge → sequencer cancel (mirrors ModifyOrderInput).
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CancelOrderInput {
    #[prost(uint64, tag = "1")]
    pub order_id: u64,
    #[prost(uint64, tag = "3")]
    pub symbol_id: u64,
    #[prost(bytes = "vec", tag = "4")]
    pub correlation_id: ::prost::alloc::vec::Vec<u8>,
    #[prost(bytes = "vec", tag = "5")]
    pub user_uuid: ::prost::alloc::vec::Vec<u8>,
    #[prost(enumeration = "super::super::common::v1::CancelReason", optional, tag = "6")]
    pub cancel_reason: ::core::option::Option<i32>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ModifyMessage {
    #[prost(uint64, tag = "1")]
    pub order_id: u64,
    #[prost(uint64, tag = "3")]
    pub symbol_id: u64,
    #[prost(uint64, tag = "4")]
    pub sequence: u64,
    #[prost(uint64, optional, tag = "5")]
    pub new_price: ::core::option::Option<u64>,
    #[prost(uint64, optional, tag = "6")]
    pub new_quantity: ::core::option::Option<u64>,
    #[prost(bytes = "vec", tag = "9")]
    pub correlation_id: ::prost::alloc::vec::Vec<u8>,
    #[prost(uint64, tag = "10")]
    pub timestamp: u64,
    /// Sequencer-local mark trigger amend for parked stops.
    #[prost(uint64, optional, tag = "11")]
    pub new_trigger_price: ::core::option::Option<u64>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MassQuoteLegShare {
    #[prost(uint64, tag = "1")]
    pub cancel_order_id: u64,
    #[prost(message, optional, tag = "2")]
    pub place: ::core::option::Option<OrderMessage>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MassQuoteMessage {
    #[prost(uint64, tag = "1")]
    pub symbol_id: u64,
    #[prost(uint64, tag = "2")]
    pub sequence: u64,
    #[prost(bytes = "vec", tag = "3")]
    pub correlation_id: ::prost::alloc::vec::Vec<u8>,
    #[prost(message, repeated, tag = "4")]
    pub legs: ::prost::alloc::vec::Vec<MassQuoteLegShare>,
    #[prost(bool, tag = "5")]
    pub post_only: bool,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchCancelMessage {
    #[prost(uint64, tag = "1")]
    pub symbol_id: u64,
    #[prost(uint64, tag = "2")]
    pub sequence: u64,
    #[prost(bytes = "vec", tag = "3")]
    pub correlation_id: ::prost::alloc::vec::Vec<u8>,
    #[prost(uint64, repeated, tag = "4")]
    pub order_ids: ::prost::alloc::vec::Vec<u64>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct BatchModifyLegShare {
    #[prost(uint64, tag = "1")]
    pub order_id: u64,
    #[prost(uint64, optional, tag = "2")]
    pub new_price: ::core::option::Option<u64>,
    #[prost(uint64, optional, tag = "3")]
    pub new_quantity: ::core::option::Option<u64>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchModifyMessage {
    #[prost(uint64, tag = "1")]
    pub symbol_id: u64,
    #[prost(uint64, tag = "2")]
    pub sequence: u64,
    #[prost(bytes = "vec", tag = "3")]
    pub correlation_id: ::prost::alloc::vec::Vec<u8>,
    #[prost(message, repeated, tag = "4")]
    pub legs: ::prost::alloc::vec::Vec<BatchModifyLegShare>,
    #[prost(uint64, tag = "5")]
    pub timestamp: u64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SubscribePositions {
    #[prost(bytes = "vec", tag = "1")]
    pub user_uuid: ::prost::alloc::vec::Vec<u8>,
    /// Sweep cadence in seconds. Allowed: {2, 5, 10}. Absent = 5.
    #[prost(uint32, optional, tag = "2")]
    pub interval_seconds: ::core::option::Option<u32>,
}
/// Internal edge -> sequencer message: drop a previously registered positions
/// subscription when the last WebSocket session for `user_uuid` disconnects.
/// Not client-facing; clients don't send this themselves.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UnsubscribePositions {
    #[prost(bytes = "vec", tag = "1")]
    pub user_uuid: ::prost::alloc::vec::Vec<u8>,
}
/// Request for a synchronous snapshot of the caller's current open orders.
/// Dispatched directly in the sequencer (no MPC fanout) and replied with
/// an inner `OpenOrdersSnapshot` on the encrypted RPC body.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetOpenOrdersRequest {
    #[prost(bytes = "vec", tag = "1")]
    pub user_uuid: ::prost::alloc::vec::Vec<u8>,
    #[prost(bytes = "vec", tag = "2")]
    pub correlation_id: ::prost::alloc::vec::Vec<u8>,
}
/// Synchronous full-user positions snapshot (no MPC). Reply is an inner
/// `PositionsSnapshot` on the encrypted RPC body.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetPositionsRequest {
    #[prost(bytes = "vec", tag = "1")]
    pub user_uuid: ::prost::alloc::vec::Vec<u8>,
    #[prost(bytes = "vec", tag = "2")]
    pub correlation_id: ::prost::alloc::vec::Vec<u8>,
}
/// Synchronous account-margin snapshot (no MPC). Reply is an inner
/// `AccountMarginUpdate` on the encrypted RPC body.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetAccountRequest {
    #[prost(bytes = "vec", tag = "1")]
    pub user_uuid: ::prost::alloc::vec::Vec<u8>,
    #[prost(bytes = "vec", tag = "2")]
    pub correlation_id: ::prost::alloc::vec::Vec<u8>,
}
/// One row of the open-orders snapshot. Mirrors the key fields the UI needs
/// to display and reconcile working orders after a refresh.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct OpenOrderRow {
    #[prost(uint64, tag = "1")]
    pub order_id: u64,
    #[prost(uint64, tag = "2")]
    pub symbol_id: u64,
    #[prost(enumeration = "super::super::common::v1::Side", tag = "3")]
    pub side: i32,
    #[prost(enumeration = "super::super::common::v1::OrderType", tag = "4")]
    pub order_type: i32,
    #[prost(string, tag = "5")]
    pub price: ::prost::alloc::string::String,
    #[prost(string, tag = "6")]
    pub quantity: ::prost::alloc::string::String,
    #[prost(string, tag = "7")]
    pub filled_qty: ::prost::alloc::string::String,
    #[prost(string, tag = "8")]
    pub remaining_qty: ::prost::alloc::string::String,
    #[prost(enumeration = "super::super::common::v1::OrderStatus", tag = "9")]
    pub order_status: i32,
    #[prost(enumeration = "super::super::common::v1::TimeInForce", tag = "10")]
    pub time_in_force: i32,
    #[prost(uint32, tag = "11")]
    pub leverage: u32,
    #[prost(uint64, tag = "12")]
    pub timestamp: u64,
    #[prost(bytes = "vec", tag = "13")]
    pub correlation_id: ::prost::alloc::vec::Vec<u8>,
    #[prost(uint64, optional, tag = "14")]
    pub expiry_time: ::core::option::Option<u64>,
    /// Reduce-only: order may only shrink an existing position. Surfaced so the
    /// UI can badge a resting order after a refresh (the flag is not otherwise
    /// recoverable client-side).
    #[prost(bool, tag = "15")]
    pub reduce_only: bool,
    /// Post-only: order rested as a maker (would never take liquidity). Surfaced
    /// for the same UI-badge reason as reduce_only.
    #[prost(bool, tag = "16")]
    pub post_only: bool,
    /// Order-attached TP/SL (sequencer-local; stripped before MPC fanout).
    #[prost(string, optional, tag = "17")]
    pub take_profit: ::core::option::Option<::prost::alloc::string::String>,
    #[prost(string, optional, tag = "18")]
    pub stop_loss: ::core::option::Option<::prost::alloc::string::String>,
    #[prost(enumeration = "super::super::common::v1::TpslStatus", optional, tag = "20")]
    pub tpsl_status: ::core::option::Option<i32>,
    #[prost(enumeration = "super::super::common::v1::CloseReason", optional, tag = "21")]
    pub close_reason: ::core::option::Option<i32>,
    #[prost(sint32, optional, tag = "23")]
    pub peg_offset_bps: ::core::option::Option<i32>,
    #[prost(string, optional, tag = "24")]
    pub trigger_price: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct OpenOrdersSnapshot {
    #[prost(message, repeated, tag = "1")]
    pub rows: ::prost::alloc::vec::Vec<OpenOrderRow>,
    #[prost(uint64, tag = "2")]
    pub server_timestamp: u64,
    #[prost(bytes = "vec", tag = "3")]
    pub correlation_id: ::prost::alloc::vec::Vec<u8>,
    /// Fixed-point scale for client/WS decimal formatting (not used on CLOB ticks).
    #[prost(uint32, tag = "4")]
    pub decimal_places: u32,
    #[prost(uint32, optional, tag = "5")]
    pub error_code: ::core::option::Option<u32>,
    #[prost(string, optional, tag = "6")]
    pub reject_text: ::core::option::Option<::prost::alloc::string::String>,
}
/// One row of a terminal-state order for edge Postgres persistence
/// (`OrderHistoryInsertMessage`) and Edge WS JSON history. Mirrors
/// `OpenOrderRow` plus terminal-state metadata.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct OrderHistoryRow {
    /// --- Core order fields (1–13 aligned with OpenOrderRow) ---
    #[prost(uint64, tag = "1")]
    pub order_id: u64,
    #[prost(uint64, tag = "2")]
    pub symbol_id: u64,
    #[prost(enumeration = "super::super::common::v1::Side", tag = "3")]
    pub side: i32,
    #[prost(enumeration = "super::super::common::v1::OrderType", tag = "4")]
    pub order_type: i32,
    #[prost(string, tag = "5")]
    pub price: ::prost::alloc::string::String,
    #[prost(string, tag = "6")]
    pub quantity: ::prost::alloc::string::String,
    #[prost(string, tag = "7")]
    pub filled_qty: ::prost::alloc::string::String,
    #[prost(string, optional, tag = "8")]
    pub avg_fill_price: ::core::option::Option<::prost::alloc::string::String>,
    #[prost(enumeration = "super::super::common::v1::OrderStatus", tag = "9")]
    pub terminal_status: i32,
    #[prost(enumeration = "super::super::common::v1::TimeInForce", tag = "10")]
    pub time_in_force: i32,
    #[prost(uint32, tag = "11")]
    pub leverage: u32,
    #[prost(uint64, tag = "12")]
    pub placed_timestamp: u64,
    #[prost(bytes = "vec", tag = "13")]
    pub correlation_id: ::prost::alloc::vec::Vec<u8>,
    /// --- Terminal-state fields (14–16 aligned with OrderUpdateMessage) ---
    #[prost(
        enumeration = "super::super::common::v1::CancelReason",
        optional,
        tag = "14"
    )]
    pub cancel_reason: ::core::option::Option<i32>,
    #[prost(uint32, optional, tag = "15")]
    pub reject_reason_code: ::core::option::Option<u32>,
    #[prost(string, optional, tag = "16")]
    pub realized_pnl: ::core::option::Option<::prost::alloc::string::String>,
    /// --- OrderHistoryRow-specific fields (17+) ---
    #[prost(uint64, tag = "17")]
    pub terminal_timestamp: u64,
    #[prost(string, optional, tag = "18")]
    pub msg: ::core::option::Option<::prost::alloc::string::String>,
    /// Trading fee on fills (positive = paid, negative = maker rebate).
    #[prost(string, optional, tag = "19")]
    pub trading_fee: ::core::option::Option<::prost::alloc::string::String>,
    /// Order-entry attributes carried for the history badge (mirrors OpenOrderRow
    /// 15/16). Post-only shows the order rested as maker; reduce-only that it
    /// could only shrink a position. OKX retains both on historical orders.
    #[prost(bool, tag = "20")]
    pub reduce_only: bool,
    #[prost(bool, tag = "21")]
    pub post_only: bool,
    /// How a filled position-reducing order closed (manual / TP / SL / ADL / liq).
    #[prost(enumeration = "super::super::common::v1::CloseReason", optional, tag = "22")]
    pub close_reason: ::core::option::Option<i32>,
    #[prost(sint32, optional, tag = "24")]
    pub peg_offset_bps: ::core::option::Option<i32>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct KillRestart {
    #[prost(uint32, tag = "1")]
    pub committee_id: u32,
    #[prost(string, tag = "2")]
    pub reason: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SequencerMessage {
    #[prost(
        oneof = "sequencer_message::Inner",
        tags = "1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12"
    )]
    pub inner: ::core::option::Option<sequencer_message::Inner>,
}
/// Nested message and enum types in `SequencerMessage`.
pub mod sequencer_message {
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Inner {
        #[prost(message, tag = "1")]
        Place(super::OrderMessage),
        #[prost(message, tag = "2")]
        Cancel(super::CancelMessage),
        #[prost(message, tag = "3")]
        Modify(super::ModifyMessage),
        #[prost(message, tag = "4")]
        SubscribePositions(super::SubscribePositions),
        #[prost(message, tag = "5")]
        GetOpenOrders(super::GetOpenOrdersRequest),
        #[prost(message, tag = "6")]
        UnsubscribePositions(super::UnsubscribePositions),
        #[prost(message, tag = "7")]
        MassQuote(super::MassQuoteMessage),
        #[prost(message, tag = "8")]
        BatchCancel(super::BatchCancelMessage),
        #[prost(message, tag = "9")]
        BatchModify(super::BatchModifyMessage),
        #[prost(message, tag = "10")]
        KillRestart(super::KillRestart),
        #[prost(message, tag = "11")]
        GetPositions(super::GetPositionsRequest),
        #[prost(message, tag = "12")]
        GetAccount(super::GetAccountRequest),
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PlaceOrderInput {
    #[prost(uint64, tag = "1")]
    pub symbol_id: u64,
    #[prost(enumeration = "super::super::common::v1::Side", tag = "2")]
    pub side: i32,
    #[prost(enumeration = "super::super::common::v1::OrderType", tag = "3")]
    pub order_type: i32,
    #[prost(double, optional, tag = "4")]
    pub price: ::core::option::Option<f64>,
    #[prost(double, tag = "5")]
    pub quantity: f64,
    #[prost(enumeration = "super::super::common::v1::TimeInForce", tag = "7")]
    pub time_in_force: i32,
    #[prost(double, optional, tag = "8")]
    pub min_fill_size: ::core::option::Option<f64>,
    #[prost(uint64, optional, tag = "9")]
    pub expiry_time: ::core::option::Option<u64>,
    #[prost(bytes = "vec", tag = "10")]
    pub correlation_id: ::prost::alloc::vec::Vec<u8>,
    #[prost(bytes = "vec", tag = "11")]
    pub user_uuid: ::prost::alloc::vec::Vec<u8>,
    #[prost(enumeration = "super::super::common::v1::StpMode", tag = "12")]
    pub stp_mode: i32,
    #[prost(bool, tag = "13")]
    pub reduce_only: bool,
    #[prost(bool, tag = "14")]
    pub post_only: bool,
    #[prost(double, optional, tag = "15")]
    pub take_profit_price: ::core::option::Option<f64>,
    #[prost(double, optional, tag = "16")]
    pub stop_loss_price: ::core::option::Option<f64>,
    #[prost(sint32, optional, tag = "19")]
    pub peg_offset_bps: ::core::option::Option<i32>,
    #[prost(double, optional, tag = "20")]
    pub trigger_price: ::core::option::Option<f64>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ModifyOrderInput {
    #[prost(uint64, tag = "1")]
    pub order_id: u64,
    #[prost(uint64, tag = "3")]
    pub symbol_id: u64,
    #[prost(double, optional, tag = "4")]
    pub new_price: ::core::option::Option<f64>,
    #[prost(double, optional, tag = "5")]
    pub new_quantity: ::core::option::Option<f64>,
    #[prost(bytes = "vec", tag = "6")]
    pub correlation_id: ::prost::alloc::vec::Vec<u8>,
    #[prost(bytes = "vec", tag = "7")]
    pub user_uuid: ::prost::alloc::vec::Vec<u8>,
    #[prost(double, optional, tag = "8")]
    pub new_trigger_price: ::core::option::Option<f64>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MassQuoteLeg {
    #[prost(uint64, tag = "1")]
    pub cancel_order_id: u64,
    #[prost(enumeration = "super::super::common::v1::Side", tag = "2")]
    pub side: i32,
    #[prost(double, tag = "3")]
    pub price: f64,
    #[prost(double, tag = "4")]
    pub quantity: f64,
    #[prost(enumeration = "super::super::common::v1::TimeInForce", tag = "5")]
    pub time_in_force: i32,
    #[prost(uint64, optional, tag = "6")]
    pub expiry_time: ::core::option::Option<u64>,
    #[prost(bytes = "vec", tag = "7")]
    pub correlation_id: ::prost::alloc::vec::Vec<u8>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MassQuoteInput {
    #[prost(uint64, tag = "1")]
    pub symbol_id: u64,
    #[prost(message, repeated, tag = "3")]
    pub legs: ::prost::alloc::vec::Vec<MassQuoteLeg>,
    #[prost(bytes = "vec", tag = "4")]
    pub correlation_id: ::prost::alloc::vec::Vec<u8>,
    #[prost(bytes = "vec", tag = "5")]
    pub user_uuid: ::prost::alloc::vec::Vec<u8>,
    #[prost(enumeration = "super::super::common::v1::StpMode", tag = "6")]
    pub stp_mode: i32,
    #[prost(bool, optional, tag = "7")]
    pub post_only: ::core::option::Option<bool>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchCancelInput {
    #[prost(uint64, tag = "1")]
    pub symbol_id: u64,
    #[prost(uint64, repeated, tag = "3")]
    pub order_ids: ::prost::alloc::vec::Vec<u64>,
    #[prost(bytes = "vec", tag = "4")]
    pub correlation_id: ::prost::alloc::vec::Vec<u8>,
    #[prost(bytes = "vec", tag = "5")]
    pub user_uuid: ::prost::alloc::vec::Vec<u8>,
}
/// Venue Cancel All: sequencer walks the open-orders index. No client id list.
/// Absent symbol_id = every market for user_uuid.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CancelAllInput {
    #[prost(uint64, optional, tag = "1")]
    pub symbol_id: ::core::option::Option<u64>,
    #[prost(bytes = "vec", tag = "2")]
    pub user_uuid: ::prost::alloc::vec::Vec<u8>,
    #[prost(bytes = "vec", tag = "3")]
    pub correlation_id: ::prost::alloc::vec::Vec<u8>,
}
/// Close All: market IOC reduce-only (`close_reason = manual`).
/// Absent symbol_id = every market for user_uuid.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CloseAllInput {
    #[prost(uint64, optional, tag = "1")]
    pub symbol_id: ::core::option::Option<u64>,
    #[prost(bytes = "vec", tag = "2")]
    pub user_uuid: ::prost::alloc::vec::Vec<u8>,
    #[prost(bytes = "vec", tag = "3")]
    pub correlation_id: ::prost::alloc::vec::Vec<u8>,
}
/// Venue Reverse: one symbol. Sequencer uses live position size (2×, not RO).
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ReverseInput {
    #[prost(uint64, tag = "1")]
    pub symbol_id: u64,
    #[prost(bytes = "vec", tag = "2")]
    pub user_uuid: ::prost::alloc::vec::Vec<u8>,
    #[prost(bytes = "vec", tag = "3")]
    pub correlation_id: ::prost::alloc::vec::Vec<u8>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchModifyLeg {
    #[prost(uint64, tag = "1")]
    pub order_id: u64,
    #[prost(double, optional, tag = "2")]
    pub new_price: ::core::option::Option<f64>,
    #[prost(double, optional, tag = "3")]
    pub new_quantity: ::core::option::Option<f64>,
    #[prost(bytes = "vec", tag = "4")]
    pub correlation_id: ::prost::alloc::vec::Vec<u8>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchModifyInput {
    #[prost(uint64, tag = "1")]
    pub symbol_id: u64,
    #[prost(message, repeated, tag = "3")]
    pub legs: ::prost::alloc::vec::Vec<BatchModifyLeg>,
    #[prost(bytes = "vec", tag = "4")]
    pub correlation_id: ::prost::alloc::vec::Vec<u8>,
    #[prost(bytes = "vec", tag = "5")]
    pub user_uuid: ::prost::alloc::vec::Vec<u8>,
}
/// Edge → sequencer: trading-collateral balance change (deposit / withdraw / settlement PnL).
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BalanceChangeMessage {
    #[prost(bytes = "vec", tag = "1")]
    pub user_uuid: ::prost::alloc::vec::Vec<u8>,
    #[prost(sint64, tag = "2")]
    pub delta_raw: i64,
    #[prost(string, tag = "3")]
    pub change_type: ::prost::alloc::string::String,
    #[prost(string, tag = "4")]
    pub tx_signature: ::prost::alloc::string::String,
    /// Base58 Solana pubkey for vault withdraw destination (optional).
    #[prost(string, tag = "5")]
    pub destination_address: ::prost::alloc::string::String,
    /// Solana slot for custody provenance when known (0 = unset).
    #[prost(uint64, tag = "6")]
    pub external_slot: u64,
}
/// Edge → sequencer: deposit receipt ready for ingest (sequencer verifies on-chain).
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DepositNotifyRequest {
    #[prost(string, tag = "1")]
    pub receipt_pubkey: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PoolWithdrawRequest {
    #[prost(bytes = "vec", tag = "1")]
    pub owner: ::prost::alloc::vec::Vec<u8>,
    #[prost(uint64, tag = "2")]
    pub shares_to_burn: u64,
    #[prost(bytes = "vec", tag = "3")]
    pub idempotency_key: ::prost::alloc::vec::Vec<u8>,
}
/// Debit trading collateral and mint LP shares (sequencer-internal; no Solana tx).
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PoolDepositRequest {
    #[prost(bytes = "vec", tag = "1")]
    pub owner: ::prost::alloc::vec::Vec<u8>,
    #[prost(uint64, tag = "2")]
    pub amount_usdt: u64,
    #[prost(bytes = "vec", tag = "3")]
    pub idempotency_key: ::prost::alloc::vec::Vec<u8>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LiquidityPoolStatusRequest {
    #[prost(bytes = "vec", tag = "1")]
    pub user_uuid: ::prost::alloc::vec::Vec<u8>,
    #[prost(bytes = "vec", tag = "2")]
    pub correlation_id: ::prost::alloc::vec::Vec<u8>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryBalanceRequest {
    #[prost(bytes = "vec", tag = "1")]
    pub user_uuid: ::prost::alloc::vec::Vec<u8>,
}
/// Update the per-user-per-symbol leverage setting (industry-standard model).
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateLeverageRequest {
    #[prost(bytes = "vec", tag = "1")]
    pub user_uuid: ::prost::alloc::vec::Vec<u8>,
    #[prost(uint64, tag = "2")]
    pub symbol_id: u64,
    #[prost(uint32, tag = "3")]
    pub leverage: u32,
    #[prost(bytes = "vec", tag = "4")]
    pub correlation_id: ::prost::alloc::vec::Vec<u8>,
}
/// Add or remove collateral from an isolated-margin position's silo.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AdjustMarginRequest {
    #[prost(bytes = "vec", tag = "1")]
    pub user_uuid: ::prost::alloc::vec::Vec<u8>,
    #[prost(uint64, tag = "2")]
    pub symbol_id: u64,
    /// Signed delta: positive = add margin, negative = remove margin.
    /// Encoded as sint64 for efficient varint of negative values.
    #[prost(sint64, tag = "3")]
    pub amount: i64,
    #[prost(bytes = "vec", tag = "4")]
    pub correlation_id: ::prost::alloc::vec::Vec<u8>,
}
/// Update per-(user, symbol) margin mode. Rejected when the symbol has an open
/// position or any resting orders (strict flat switch).
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateMarginModeRequest {
    #[prost(bytes = "vec", tag = "1")]
    pub user_uuid: ::prost::alloc::vec::Vec<u8>,
    #[prost(uint64, tag = "2")]
    pub symbol_id: u64,
    #[prost(enumeration = "super::super::common::v1::MarginMode", tag = "3")]
    pub mode: i32,
    #[prost(bytes = "vec", tag = "4")]
    pub correlation_id: ::prost::alloc::vec::Vec<u8>,
}
/// Cancel TP/SL without cancelling the parent entry or flattening the position.
/// order_id is the parent; 0 plus symbol_id and position_side selects the open-position leg.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CancelTpslRequest {
    #[prost(bytes = "vec", tag = "1")]
    pub user_uuid: ::prost::alloc::vec::Vec<u8>,
    #[prost(uint64, tag = "2")]
    pub order_id: u64,
    #[prost(bytes = "vec", tag = "3")]
    pub correlation_id: ::prost::alloc::vec::Vec<u8>,
    #[prost(uint64, optional, tag = "4")]
    pub symbol_id: ::core::option::Option<u64>,
    #[prost(enumeration = "super::super::common::v1::Side", optional, tag = "5")]
    pub position_side: ::core::option::Option<i32>,
}
/// Amend / attach TP/SL on an order or one-way open position.
/// - Existing attachment: `order_id` is the parent entry id.
/// - Open position with no TP/SL yet: set `order_id` to 0 and set `symbol_id` +
///    `position_side`; the sequencer allocates an Active attachment for the leg.
/// - Price fields: omitted = leave unchanged; `0` = clear that leg; `>0` = set.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AmendTpslRequest {
    #[prost(bytes = "vec", tag = "1")]
    pub user_uuid: ::prost::alloc::vec::Vec<u8>,
    #[prost(uint64, tag = "2")]
    pub order_id: u64,
    #[prost(bytes = "vec", tag = "3")]
    pub correlation_id: ::prost::alloc::vec::Vec<u8>,
    #[prost(double, optional, tag = "4")]
    pub take_profit_price: ::core::option::Option<f64>,
    #[prost(double, optional, tag = "5")]
    pub stop_loss_price: ::core::option::Option<f64>,
    #[prost(uint64, optional, tag = "7")]
    pub symbol_id: ::core::option::Option<u64>,
    #[prost(enumeration = "super::super::common::v1::Side", optional, tag = "8")]
    pub position_side: ::core::option::Option<i32>,
}
/// RPC reply for amend / cancel TP-SL. Live feed remains TpslUpdate.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TpslAck {
    #[prost(bytes = "vec", tag = "1")]
    pub correlation_id: ::prost::alloc::vec::Vec<u8>,
    #[prost(uint64, tag = "2")]
    pub parent_order_id: u64,
    #[prost(string, optional, tag = "3")]
    pub take_profit: ::core::option::Option<::prost::alloc::string::String>,
    #[prost(string, optional, tag = "4")]
    pub stop_loss: ::core::option::Option<::prost::alloc::string::String>,
    #[prost(enumeration = "super::super::common::v1::TpslStatus", optional, tag = "5")]
    pub status: ::core::option::Option<i32>,
    #[prost(enumeration = "super::super::common::v1::TpslKind", optional, tag = "6")]
    pub kind: ::core::option::Option<i32>,
    #[prost(uint32, optional, tag = "7")]
    pub error_code: ::core::option::Option<u32>,
    #[prost(string, optional, tag = "8")]
    pub reject_text: ::core::option::Option<::prost::alloc::string::String>,
}
/// Dedicated TP/SL lifecycle push (cancel / amend / trigger). Not an order-book event.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TpslUpdate {
    #[prost(uint64, tag = "1")]
    pub parent_order_id: u64,
    #[prost(bytes = "vec", tag = "2")]
    pub user_uuid: ::prost::alloc::vec::Vec<u8>,
    #[prost(uint64, tag = "3")]
    pub symbol_id: u64,
    #[prost(enumeration = "super::super::common::v1::Side", tag = "4")]
    pub position_side: i32,
    #[prost(string, optional, tag = "5")]
    pub take_profit: ::core::option::Option<::prost::alloc::string::String>,
    #[prost(string, optional, tag = "6")]
    pub stop_loss: ::core::option::Option<::prost::alloc::string::String>,
    #[prost(enumeration = "super::super::common::v1::TpslStatus", tag = "8")]
    pub status: i32,
    #[prost(enumeration = "super::super::common::v1::TpslLeg", optional, tag = "9")]
    pub fired_leg: ::core::option::Option<i32>,
    #[prost(uint64, tag = "10")]
    pub timestamp: u64,
    #[prost(enumeration = "super::super::common::v1::TpslKind", tag = "11")]
    pub kind: i32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct EdgeSequencerRequest {
    #[prost(
        oneof = "edge_sequencer_request::Inner",
        tags = "1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 24, 25, 26, 27, 28"
    )]
    pub inner: ::core::option::Option<edge_sequencer_request::Inner>,
}
/// Nested message and enum types in `EdgeSequencerRequest`.
pub mod edge_sequencer_request {
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Inner {
        #[prost(message, tag = "1")]
        Place(super::PlaceOrderInput),
        #[prost(message, tag = "2")]
        Cancel(super::CancelOrderInput),
        #[prost(message, tag = "3")]
        Modify(super::ModifyOrderInput),
        #[prost(message, tag = "4")]
        SubscribePositions(super::SubscribePositions),
        #[prost(message, tag = "5")]
        GetOpenOrders(super::GetOpenOrdersRequest),
        #[prost(message, tag = "6")]
        UnsubscribePositions(super::UnsubscribePositions),
        #[prost(message, tag = "7")]
        BalanceChange(super::BalanceChangeMessage),
        #[prost(message, tag = "8")]
        PoolWithdraw(super::PoolWithdrawRequest),
        #[prost(message, tag = "9")]
        LiquidityPoolStatus(super::LiquidityPoolStatusRequest),
        #[prost(message, tag = "10")]
        QueryBalance(super::QueryBalanceRequest),
        #[prost(message, tag = "11")]
        PoolDeposit(super::PoolDepositRequest),
        #[prost(message, tag = "12")]
        UpdateLeverage(super::UpdateLeverageRequest),
        #[prost(message, tag = "13")]
        AdjustMargin(super::AdjustMarginRequest),
        #[prost(message, tag = "14")]
        MassQuote(super::MassQuoteInput),
        #[prost(message, tag = "15")]
        BatchCancel(super::BatchCancelInput),
        #[prost(message, tag = "16")]
        BatchModify(super::BatchModifyInput),
        #[prost(message, tag = "17")]
        DepositNotify(super::DepositNotifyRequest),
        #[prost(message, tag = "18")]
        CancelTpsl(super::CancelTpslRequest),
        #[prost(message, tag = "19")]
        AmendTpsl(super::AmendTpslRequest),
        #[prost(message, tag = "20")]
        UpdateMarginMode(super::UpdateMarginModeRequest),
        #[prost(message, tag = "21")]
        GetPositions(super::GetPositionsRequest),
        #[prost(message, tag = "22")]
        GetAccount(super::GetAccountRequest),
        #[prost(message, tag = "24")]
        ListMarket(super::ListMarketRequest),
        #[prost(message, tag = "25")]
        SetInstrumentStatus(super::SetInstrumentStatusRequest),
        #[prost(message, tag = "26")]
        CancelAll(super::CancelAllInput),
        #[prost(message, tag = "27")]
        CloseAll(super::CloseAllInput),
        #[prost(message, tag = "28")]
        Reverse(super::ReverseInput),
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListMarketRequest {
    #[prost(string, tag = "1")]
    pub symbol: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub base: ::prost::alloc::string::String,
    #[prost(string, tag = "3")]
    pub quote: ::prost::alloc::string::String,
    #[prost(string, tag = "4")]
    pub pyth_feed_id: ::prost::alloc::string::String,
    #[prost(uint32, tag = "5")]
    pub pyth_lazer_id: u32,
    #[prost(uint32, tag = "6")]
    pub max_leverage: u32,
    #[prost(uint32, tag = "7")]
    pub price_decimals: u32,
    #[prost(uint32, tag = "8")]
    pub quantity_decimals: u32,
    #[prost(uint64, tag = "9")]
    pub tick_size_units: u64,
    #[prost(uint64, tag = "10")]
    pub lot_size_units: u64,
    #[prost(uint64, tag = "11")]
    pub max_order_size_units: u64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SetInstrumentStatusRequest {
    #[prost(uint64, tag = "1")]
    pub symbol_id: u64,
    #[prost(string, tag = "2")]
    pub status: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InstrumentRow {
    #[prost(uint64, tag = "1")]
    pub symbol_id: u64,
    #[prost(string, tag = "2")]
    pub symbol: ::prost::alloc::string::String,
    #[prost(string, tag = "3")]
    pub base: ::prost::alloc::string::String,
    #[prost(string, tag = "4")]
    pub quote: ::prost::alloc::string::String,
    #[prost(string, tag = "5")]
    pub contract_type: ::prost::alloc::string::String,
    #[prost(string, tag = "6")]
    pub underlying: ::prost::alloc::string::String,
    #[prost(string, tag = "7")]
    pub index_description: ::prost::alloc::string::String,
    #[prost(string, tag = "8")]
    pub settlement_currency: ::prost::alloc::string::String,
    #[prost(string, tag = "9")]
    pub settlement_type: ::prost::alloc::string::String,
    #[prost(string, tag = "10")]
    pub position_size_unit: ::prost::alloc::string::String,
    #[prost(uint32, tag = "11")]
    pub price_decimals: u32,
    #[prost(uint32, tag = "12")]
    pub quantity_decimals: u32,
    #[prost(uint64, tag = "13")]
    pub tick_size_units: u64,
    #[prost(uint64, tag = "14")]
    pub lot_size_units: u64,
    #[prost(uint64, tag = "15")]
    pub max_order_size_units: u64,
    #[prost(string, tag = "16")]
    pub status: ::prost::alloc::string::String,
    #[prost(uint32, tag = "17")]
    pub max_leverage: u32,
    #[prost(string, optional, tag = "18")]
    pub pyth_feed_id: ::core::option::Option<::prost::alloc::string::String>,
    #[prost(uint32, optional, tag = "19")]
    pub pyth_lazer_id: ::core::option::Option<u32>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InstrumentUpdate {
    #[prost(message, repeated, tag = "1")]
    pub instruments: ::prost::alloc::vec::Vec<InstrumentRow>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TradeMessage {
    #[prost(uint64, tag = "1")]
    pub trade_id: u64,
    #[prost(uint64, tag = "2")]
    pub taker_order_id: u64,
    #[prost(uint64, tag = "3")]
    pub maker_order_id: u64,
    #[prost(uint64, tag = "5")]
    pub symbol_id: u64,
    #[prost(uint64, tag = "6")]
    pub price: u64,
    #[prost(uint64, tag = "7")]
    pub quantity: u64,
    #[prost(uint64, tag = "8")]
    pub timestamp: u64,
    #[prost(enumeration = "super::super::common::v1::Side", tag = "9")]
    pub taker_side: i32,
    #[prost(bytes = "vec", tag = "10")]
    pub correlation_id: ::prost::alloc::vec::Vec<u8>,
    #[prost(uint64, optional, tag = "11")]
    pub maker_remaining_qty: ::core::option::Option<u64>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct AckOutcomeWire {
    #[prost(enumeration = "AckOutcomeKind", tag = "1")]
    pub kind: i32,
    #[prost(enumeration = "super::super::common::v1::OrderStatus", optional, tag = "2")]
    pub order_status: ::core::option::Option<i32>,
    #[prost(uint32, optional, tag = "3")]
    pub business_error_code: ::core::option::Option<u32>,
    #[prost(uint32, optional, tag = "4")]
    pub system_error_code: ::core::option::Option<u32>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AckMessage {
    #[prost(uint64, tag = "1")]
    pub sequence: u64,
    #[prost(uint64, tag = "2")]
    pub order_id: u64,
    #[prost(bytes = "vec", tag = "3")]
    pub correlation_id: ::prost::alloc::vec::Vec<u8>,
    #[prost(message, optional, tag = "4")]
    pub pool_ack: ::core::option::Option<PoolAck>,
    #[prost(string, optional, tag = "5")]
    pub reject_text: ::core::option::Option<::prost::alloc::string::String>,
    #[prost(message, optional, tag = "6")]
    pub ack_outcome: ::core::option::Option<AckOutcomeWire>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct MassQuoteLegResult {
    #[prost(uint32, tag = "1")]
    pub leg_index: u32,
    #[prost(uint64, tag = "2")]
    pub cancelled_order_id: u64,
    #[prost(uint64, tag = "3")]
    pub new_order_id: u64,
    #[prost(enumeration = "MassQuoteLegStatus", tag = "4")]
    pub status: i32,
    #[prost(uint32, optional, tag = "5")]
    pub error_code: ::core::option::Option<u32>,
    #[prost(uint32, tag = "6")]
    pub fill_count: u32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MassQuoteAck {
    #[prost(uint64, tag = "1")]
    pub node_id: u64,
    #[prost(uint64, tag = "2")]
    pub sequence: u64,
    #[prost(bytes = "vec", tag = "3")]
    pub correlation_id: ::prost::alloc::vec::Vec<u8>,
    #[prost(message, repeated, tag = "4")]
    pub results: ::prost::alloc::vec::Vec<MassQuoteLegResult>,
    #[prost(uint32, optional, tag = "5")]
    pub error_code: ::core::option::Option<u32>,
    #[prost(string, optional, tag = "6")]
    pub reject_text: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct BatchCancelLegResult {
    #[prost(uint64, tag = "1")]
    pub order_id: u64,
    #[prost(bool, tag = "2")]
    pub cancelled: bool,
    #[prost(uint32, optional, tag = "3")]
    pub error_code: ::core::option::Option<u32>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchCancelAck {
    #[prost(uint64, tag = "1")]
    pub node_id: u64,
    #[prost(uint64, tag = "2")]
    pub sequence: u64,
    #[prost(bytes = "vec", tag = "3")]
    pub correlation_id: ::prost::alloc::vec::Vec<u8>,
    #[prost(message, repeated, tag = "4")]
    pub results: ::prost::alloc::vec::Vec<BatchCancelLegResult>,
    #[prost(uint32, optional, tag = "5")]
    pub error_code: ::core::option::Option<u32>,
    #[prost(string, optional, tag = "6")]
    pub reject_text: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CancelAllAck {
    #[prost(uint64, tag = "1")]
    pub node_id: u64,
    #[prost(uint64, tag = "2")]
    pub sequence: u64,
    #[prost(bytes = "vec", tag = "3")]
    pub correlation_id: ::prost::alloc::vec::Vec<u8>,
    #[prost(uint32, tag = "4")]
    pub cancelled: u32,
    #[prost(uint64, repeated, tag = "5")]
    pub cancelled_order_ids: ::prost::alloc::vec::Vec<u64>,
    #[prost(uint32, optional, tag = "6")]
    pub error_code: ::core::option::Option<u32>,
    #[prost(string, optional, tag = "7")]
    pub reject_text: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CloseAllAck {
    #[prost(uint64, tag = "1")]
    pub node_id: u64,
    #[prost(uint64, tag = "2")]
    pub sequence: u64,
    #[prost(bytes = "vec", tag = "3")]
    pub correlation_id: ::prost::alloc::vec::Vec<u8>,
    #[prost(uint32, tag = "4")]
    pub closed: u32,
    #[prost(uint64, repeated, tag = "5")]
    pub close_order_ids: ::prost::alloc::vec::Vec<u64>,
    #[prost(uint32, optional, tag = "6")]
    pub error_code: ::core::option::Option<u32>,
    #[prost(string, optional, tag = "7")]
    pub reject_text: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ReverseAck {
    #[prost(uint64, tag = "1")]
    pub node_id: u64,
    #[prost(uint64, tag = "2")]
    pub sequence: u64,
    #[prost(bytes = "vec", tag = "3")]
    pub correlation_id: ::prost::alloc::vec::Vec<u8>,
    #[prost(uint32, tag = "4")]
    pub reversed: u32,
    #[prost(uint64, repeated, tag = "5")]
    pub reverse_order_ids: ::prost::alloc::vec::Vec<u64>,
    #[prost(uint32, optional, tag = "6")]
    pub error_code: ::core::option::Option<u32>,
    #[prost(string, optional, tag = "7")]
    pub reject_text: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct BatchModifyLegResult {
    #[prost(uint64, tag = "1")]
    pub order_id: u64,
    #[prost(bool, tag = "2")]
    pub modified: bool,
    #[prost(uint32, optional, tag = "3")]
    pub error_code: ::core::option::Option<u32>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchModifyAck {
    #[prost(uint64, tag = "1")]
    pub node_id: u64,
    #[prost(uint64, tag = "2")]
    pub sequence: u64,
    #[prost(bytes = "vec", tag = "3")]
    pub correlation_id: ::prost::alloc::vec::Vec<u8>,
    #[prost(message, repeated, tag = "4")]
    pub results: ::prost::alloc::vec::Vec<BatchModifyLegResult>,
    #[prost(uint32, optional, tag = "5")]
    pub error_code: ::core::option::Option<u32>,
    #[prost(string, optional, tag = "6")]
    pub reject_text: ::core::option::Option<::prost::alloc::string::String>,
}
/// Phase 5 — liquidity pool command results (edge ↔ sequencer QUIC).
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct PoolAck {
    #[prost(oneof = "pool_ack::Kind", tags = "1, 2, 3")]
    pub kind: ::core::option::Option<pool_ack::Kind>,
}
/// Nested message and enum types in `PoolAck`.
pub mod pool_ack {
    #[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
    pub enum Kind {
        #[prost(message, tag = "1")]
        Deposit(super::PoolDepositAck),
        #[prost(message, tag = "2")]
        Withdraw(super::PoolWithdrawAck),
        #[prost(message, tag = "3")]
        Status(super::LiquidityPoolStatusAck),
    }
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct PoolDepositAck {
    #[prost(uint64, tag = "1")]
    pub shares_minted: u64,
    #[prost(uint64, tag = "2")]
    pub nav: u64,
    #[prost(uint64, tag = "3")]
    pub share_price: u64,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct PoolWithdrawAck {
    #[prost(uint64, tag = "1")]
    pub usdt_owed: u64,
    #[prost(uint64, tag = "2")]
    pub nav: u64,
    #[prost(uint64, tag = "3")]
    pub shares_burned: u64,
    #[prost(uint64, tag = "4")]
    pub shares_remaining: u64,
    #[prost(bool, tag = "5")]
    pub partial: bool,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct LiquidityPoolStatusAck {
    #[prost(uint64, tag = "1")]
    pub total_shares: u64,
    #[prost(uint64, tag = "2")]
    pub nav: u64,
    #[prost(uint64, tag = "3")]
    pub share_price: u64,
    #[prost(bool, tag = "4")]
    pub pool_paused: bool,
    #[prost(message, optional, tag = "5")]
    pub user: ::core::option::Option<LiquidityPoolUserStatus>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct LiquidityPoolUserStatus {
    #[prost(uint64, tag = "1")]
    pub shares: u64,
    #[prost(uint64, tag = "2")]
    pub deposit_base_usdt: u64,
    #[prost(uint64, tag = "3")]
    pub share_value: u64,
    #[prost(uint64, tag = "4")]
    pub cooldown_remaining_seconds: u64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct OrderUpdateMessage {
    #[prost(uint64, tag = "1")]
    pub order_id: u64,
    #[prost(uint64, tag = "2")]
    pub symbol_id: u64,
    #[prost(enumeration = "super::super::common::v1::Side", tag = "3")]
    pub side: i32,
    #[prost(enumeration = "super::super::common::v1::OrderType", tag = "4")]
    pub order_type: i32,
    #[prost(string, tag = "5")]
    pub price: ::prost::alloc::string::String,
    #[prost(string, tag = "6")]
    pub quantity: ::prost::alloc::string::String,
    #[prost(string, tag = "7")]
    pub filled_qty: ::prost::alloc::string::String,
    #[prost(string, tag = "8")]
    pub remaining_qty: ::prost::alloc::string::String,
    #[prost(enumeration = "super::super::common::v1::OrderStatus", tag = "9")]
    pub order_status: i32,
    #[prost(uint32, tag = "10")]
    pub leverage: u32,
    #[prost(uint64, tag = "11")]
    pub timestamp: u64,
    #[prost(bytes = "vec", tag = "12")]
    pub correlation_id: ::prost::alloc::vec::Vec<u8>,
    #[prost(
        enumeration = "super::super::common::v1::CancelReason",
        optional,
        tag = "13"
    )]
    pub cancel_reason: ::core::option::Option<i32>,
    #[prost(uint32, optional, tag = "14")]
    pub reject_reason_code: ::core::option::Option<u32>,
    #[prost(string, optional, tag = "15")]
    pub realized_pnl: ::core::option::Option<::prost::alloc::string::String>,
    #[prost(enumeration = "super::super::common::v1::OrderUpdateType", tag = "16")]
    pub message_type: i32,
    #[prost(bytes = "vec", tag = "17")]
    pub user_uuid: ::prost::alloc::vec::Vec<u8>,
    #[prost(string, tag = "18")]
    pub cum_fill: ::prost::alloc::string::String,
    #[prost(string, optional, tag = "19")]
    pub msg: ::core::option::Option<::prost::alloc::string::String>,
    /// Running volume-weighted average fill price (FIX AvgPx); absent before
    /// any fill. Mirrors OrderHistoryRow.avg_fill_price.
    #[prost(string, optional, tag = "20")]
    pub avg_fill_price: ::core::option::Option<::prost::alloc::string::String>,
    /// Trading fee on fills. Mirrors OrderHistoryRow.trading_fee.
    #[prost(string, optional, tag = "21")]
    pub trading_fee: ::core::option::Option<::prost::alloc::string::String>,
    /// Order-attached TP/SL fields (mirrors OpenOrderRow).
    #[prost(string, optional, tag = "22")]
    pub take_profit: ::core::option::Option<::prost::alloc::string::String>,
    #[prost(string, optional, tag = "23")]
    pub stop_loss: ::core::option::Option<::prost::alloc::string::String>,
    #[prost(enumeration = "super::super::common::v1::TpslStatus", optional, tag = "25")]
    pub tpsl_status: ::core::option::Option<i32>,
    /// Original peg instruction: signed bps vs Pyth. Price is the current
    /// working limit after mark ± offset (FIX PegOffsetValue + LastPx).
    #[prost(sint32, optional, tag = "26")]
    pub peg_offset_bps: ::core::option::Option<i32>,
    #[prost(string, optional, tag = "27")]
    pub trigger_price: ::core::option::Option<::prost::alloc::string::String>,
    /// Order-entry attributes, mirrored from OpenOrderRow 15/16 so the UI can
    /// badge a resting order from the live push (not just a post-refresh
    /// snapshot). Only meaningful on Place; false elsewhere.
    #[prost(bool, tag = "28")]
    pub reduce_only: bool,
    #[prost(bool, tag = "29")]
    pub post_only: bool,
}
/// One position inside a `PositionsSnapshot` batch. All decimal fields
/// are rendered at the sequencer's configured `decimal_places`; PnL /
/// notional carry `2 * decimal_places` fractional digits to match the
/// realized-PnL convention (see `gdx_sequencer::realized_pnl`).
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PositionRow {
    #[prost(uint64, tag = "1")]
    pub symbol_id: u64,
    #[prost(enumeration = "super::super::common::v1::Side", tag = "2")]
    pub side: i32,
    #[prost(string, tag = "3")]
    pub size: ::prost::alloc::string::String,
    #[prost(string, tag = "4")]
    pub entry_price: ::prost::alloc::string::String,
    #[prost(uint32, tag = "5")]
    pub leverage: u32,
    /// Server-computed mark price (from Pyth Hermes). Absent when no Pyth
    /// tick has been observed yet for this symbol — the frontend should
    /// render the unrealized-PnL column as "—" in that case.
    #[prost(string, optional, tag = "6")]
    pub mark_price: ::core::option::Option<::prost::alloc::string::String>,
    /// Sign-preserved unrealized PnL at `2 * decimal_places`. Absent iff
    /// `mark_price` is absent.
    #[prost(string, optional, tag = "7")]
    pub unrealized_pnl: ::core::option::Option<::prost::alloc::string::String>,
    /// Notional (= |size| * mark_price) at `2 * decimal_places`. Absent
    /// iff `mark_price` is absent.
    #[prost(string, optional, tag = "8")]
    pub notional: ::core::option::Option<::prost::alloc::string::String>,
    /// Pyth `publish_time` for the `mark_price` tick (seconds since
    /// epoch). Lets the frontend surface stale-price warnings.
    #[prost(uint64, optional, tag = "9")]
    pub mark_publish_time_sec: ::core::option::Option<u64>,
    /// Server-computed liquidation price (mark at which maintenance
    /// margin equals equity under isolated margin). Absent when the
    /// position is over-collateralised or on overflow.
    #[prost(string, optional, tag = "10")]
    pub liquidation_price: ::core::option::Option<::prost::alloc::string::String>,
    /// ADL queue indicator (0 = safest, 5 = front of the auto-deleverage
    /// queue). Server-computed from PnL-rank among counterparties.
    /// Absent when ADL ranking is not yet available.
    #[prost(uint32, optional, tag = "11")]
    pub adl_indicator: ::core::option::Option<u32>,
    /// Position lifecycle status (Normal / Liq / Adl). Absent when the
    /// sequencer does not yet track liquidation state for this position.
    #[prost(
        enumeration = "super::super::common::v1::PositionStatus",
        optional,
        tag = "12"
    )]
    pub position_status: ::core::option::Option<i32>,
    /// Total margin allocated to this position (IM + any user-added margin),
    /// decimal string. Equivalent to `margin` / `marginUsed` on other exchanges.
    /// Absent when not computed.
    #[prost(string, optional, tag = "13")]
    pub margin: ::core::option::Option<::prost::alloc::string::String>,
    /// Margin mode. Constant ISOLATED today.
    #[prost(enumeration = "super::super::common::v1::MarginMode", tag = "14")]
    pub mgn_mode: i32,
    /// Maintenance margin requirement, decimal string at `decimal_places`.
    /// Absent when no mark price.
    #[prost(string, optional, tag = "15")]
    pub mmr: ::core::option::Option<::prost::alloc::string::String>,
    /// Margin ratio (equity/maint) as a decimal string, 1.5 = 150%; higher is
    /// safer. Decimal form of margin_ratio_bps. Absent when no mark or
    /// maintenance margin is zero (infinite ratio).
    #[prost(string, optional, tag = "16")]
    pub mgn_ratio: ::core::option::Option<::prost::alloc::string::String>,
    /// Margin ratio in basis points (10000 = 100%, equity/maint). Raw lossless
    /// source of truth for tier-band classification. Absent when no mark or
    /// maintenance margin is zero.
    #[prost(uint64, optional, tag = "17")]
    pub margin_ratio_bps: ::core::option::Option<u64>,
    /// Active order-attached TP/SL for this position (sequencer-local).
    #[prost(string, optional, tag = "18")]
    pub take_profit: ::core::option::Option<::prost::alloc::string::String>,
    #[prost(string, optional, tag = "19")]
    pub stop_loss: ::core::option::Option<::prost::alloc::string::String>,
    #[prost(enumeration = "super::super::common::v1::TpslStatus", optional, tag = "21")]
    pub tpsl_status: ::core::option::Option<i32>,
    #[prost(uint64, optional, tag = "22")]
    pub tpsl_parent_order_id: ::core::option::Option<u64>,
}
/// Authoritative account-level margin summary, mirroring the sequencer's
/// `RiskEngine` view. All amounts are decimal strings at `decimal_places`
/// (same convention as `PositionRow.margin`).
/// `cross_available` is tradeable. Isolated admit / withdraw =
/// min(free_collateral, cross_available).
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AccountMarginSummary {
    /// Risk-engine collateral balance (internal USDT) backing this account.
    #[prost(string, tag = "1")]
    pub total_collateral: ::prost::alloc::string::String,
    /// Sum of isolated silos + cross IM across open positions.
    #[prost(string, tag = "2")]
    pub position_margin: ::prost::alloc::string::String,
    /// Sum of margin reserved by the user's resting (unfilled) orders.
    #[prost(string, tag = "3")]
    pub reserved_order_margin: ::prost::alloc::string::String,
    /// Committed cash residual (no uPnL). Matches RiskEngine::free_collateral.
    #[prost(string, tag = "4")]
    pub free_collateral: ::prost::alloc::string::String,
    /// Account value: total_collateral + sum unrealized PnL (signed, 8dp collateral).
    #[prost(string, tag = "5")]
    pub account_equity: ::prost::alloc::string::String,
    /// Sum of mark unrealized PnL across open positions (signed, 8dp collateral).
    #[prost(string, tag = "6")]
    pub unrealized_pnl: ::prost::alloc::string::String,
    /// Tradeable buying power: leftover cash + cross uPnL, floored at 0.
    #[prost(string, tag = "7")]
    pub cross_available: ::prost::alloc::string::String,
    /// Lifetime FIFO realized PnL (signed, 2× price decimal places).
    /// New tag: do not reuse compacted 1–7.
    #[prost(string, tag = "8")]
    pub realized_pnl: ::prost::alloc::string::String,
    /// Isolated cash locks (no UPL).
    #[prost(string, tag = "9")]
    pub isolated_margin: ::prost::alloc::string::String,
    /// Isolated cash + isolated UPL, floored per position.
    #[prost(string, tag = "10")]
    pub isolated_equity: ::prost::alloc::string::String,
    /// Cross position IM (no order holds).
    #[prost(string, tag = "11")]
    pub cross_im: ::prost::alloc::string::String,
}
/// Dedicated account-margin push (encrypted, per user). Emitted on the initial
/// positions subscribe and whenever the user's collateral, positions, or
/// resting-order holds change (the sequencer diffs the summary and pushes only
/// on change). This is the authoritative source for the UI's "available margin"
/// — see `AccountMarginSummary`.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AccountMarginUpdate {
    #[prost(bytes = "vec", tag = "1")]
    pub user_uuid: ::prost::alloc::vec::Vec<u8>,
    /// Sequencer wall-clock timestamp when the summary was computed, ns.
    #[prost(uint64, tag = "2")]
    pub server_timestamp: u64,
    #[prost(message, optional, tag = "3")]
    pub account: ::core::option::Option<AccountMarginSummary>,
    /// Echoed on GetAccount RPC replies; absent on unsolicited pushes.
    #[prost(bytes = "vec", optional, tag = "4")]
    pub correlation_id: ::core::option::Option<::prost::alloc::vec::Vec<u8>>,
}
/// Per-symbol leverage (1 = 1x).
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct LeverageSettingRow {
    #[prost(uint64, tag = "1")]
    pub symbol_id: u64,
    #[prost(uint32, tag = "2")]
    pub leverage: u32,
}
/// Encrypted account settings (ticket leverage + margin mode). Pushed on
/// positions subscribe and after update_leverage / update_margin_mode.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LeverageSettings {
    #[prost(bytes = "vec", tag = "1")]
    pub user_uuid: ::prost::alloc::vec::Vec<u8>,
    #[prost(uint64, tag = "2")]
    pub server_timestamp: u64,
    #[prost(message, repeated, tag = "3")]
    pub settings: ::prost::alloc::vec::Vec<LeverageSettingRow>,
    #[prost(message, repeated, tag = "4")]
    pub margin_mode_settings: ::prost::alloc::vec::Vec<MarginModeSettingRow>,
}
/// Stored per-symbol mode used for a flat symbol's next position.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct MarginModeSettingRow {
    #[prost(uint64, tag = "1")]
    pub symbol_id: u64,
    #[prost(enumeration = "super::super::common::v1::MarginMode", tag = "2")]
    pub mode: i32,
}
/// Full-user positions batch: subscribe, periodic sweep, or fill event.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PositionsSnapshot {
    #[prost(bytes = "vec", tag = "1")]
    pub user_uuid: ::prost::alloc::vec::Vec<u8>,
    #[prost(message, repeated, tag = "2")]
    pub rows: ::prost::alloc::vec::Vec<PositionRow>,
    /// Sequencer wall-clock timestamp when the batch was assembled, ns.
    #[prost(uint64, tag = "3")]
    pub server_timestamp: u64,
    /// Why this batch was emitted. See enum for details.
    #[prost(
        enumeration = "super::super::common::v1::PositionsSnapshotSource",
        tag = "4"
    )]
    pub source: i32,
    /// Echoed from the original `SubscribePositions` request for the
    /// initial snapshot so the client can demux its pending subscription;
    /// absent on periodic / event-driven refreshes.
    #[prost(bytes = "vec", optional, tag = "5")]
    pub correlation_id: ::core::option::Option<::prost::alloc::vec::Vec<u8>>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FundingRateUpdateMessage {
    #[prost(uint64, tag = "1")]
    pub symbol_id: u64,
    /// In-progress hourly rate (TWAP / 8), decimal fraction.
    #[prost(string, tag = "2")]
    pub funding_rate: ::prost::alloc::string::String,
    #[prost(uint64, tag = "3")]
    pub timestamp: u64,
    /// Last applied hourly rate, decimal fraction.
    #[prost(string, tag = "4")]
    pub last_funding_rate: ::prost::alloc::string::String,
}
/// Sequencer → edge: a single per-user funding payment applied during the
/// hourly funding cycle, persisted in the edge's `funding_payments` Postgres
/// table and surfaced in the frontend "Funding History" tab. Emitted from
/// `apply_funding_all` results whenever funding is settled against a position.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FundingPaymentMessage {
    /// User the funding payment applies to.
    #[prost(bytes = "vec", tag = "1")]
    pub user_uuid: ::prost::alloc::vec::Vec<u8>,
    /// Instrument the position belongs to.
    #[prost(uint64, tag = "2")]
    pub symbol_id: u64,
    /// Long or short at the time funding was applied.
    #[prost(enumeration = "super::super::common::v1::Side", tag = "3")]
    pub side: i32,
    /// Position size when funding was applied (decimal string).
    #[prost(string, tag = "4")]
    pub size: ::prost::alloc::string::String,
    /// Position entry price for reference (decimal string).
    #[prost(string, tag = "5")]
    pub entry_price: ::prost::alloc::string::String,
    /// Signed funding payment amount in human USDC (decimal string). Negative
    /// means the user paid funding; positive means the user received funding.
    #[prost(string, tag = "6")]
    pub payment: ::prost::alloc::string::String,
    /// Hourly funding rate applied, as a decimal *fraction* (e.g. "0.0000125").
    #[prost(string, tag = "7")]
    pub rate: ::prost::alloc::string::String,
    /// Wall-clock when the sequencer applied funding (ns since epoch).
    #[prost(uint64, tag = "8")]
    pub timestamp: u64,
    /// Funding application time (epoch seconds) used as the displayed "Time".
    #[prost(uint64, tag = "9")]
    pub funding_time: u64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct OpenInterestUpdateMessage {
    #[prost(uint64, tag = "1")]
    pub symbol_id: u64,
    #[prost(string, tag = "2")]
    pub open_interest: ::prost::alloc::string::String,
    #[prost(uint64, tag = "3")]
    pub timestamp: u64,
    #[prost(string, optional, tag = "4")]
    pub oi_ccy: ::core::option::Option<::prost::alloc::string::String>,
}
/// Sequencer → edge: updated collateral balance snapshot for a user.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BalanceUpdateMessage {
    #[prost(bytes = "vec", tag = "1")]
    pub user_uuid: ::prost::alloc::vec::Vec<u8>,
    /// Collateral in SPL raw token units (6 dp).
    #[prost(uint64, tag = "2")]
    pub balance_raw: u64,
    #[prost(uint64, tag = "3")]
    pub timestamp: u64,
    /// Human-readable collateral at internal USDT decimal places.
    #[prost(string, tag = "4")]
    pub balance: ::prost::alloc::string::String,
    /// Signed internal 8dp balance (can be negative).
    #[prost(int64, tag = "5")]
    pub signed_balance_8dp: i64,
    /// Committed residual in internal 8dp (no uPnL). Not the withdraw cap.
    #[prost(uint64, tag = "6")]
    pub free_collateral_8dp: u64,
}
/// Atomic balance + positions envelope.
///
/// Delivered as a single encrypted push whenever an event changes both
/// balance and positions atomically (fills, settlements, liquidations).
/// Keeps PositionsSnapshot and BalanceUpdateMessage as clean, single-concern
/// messages; this envelope is the atomicity boundary.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BalanceAndPosition {
    #[prost(bytes = "vec", tag = "1")]
    pub user_uuid: ::prost::alloc::vec::Vec<u8>,
    /// Why the push was emitted: "filled", "settlement", "liquidation".
    #[prost(string, tag = "2")]
    pub event_type: ::prost::alloc::string::String,
    /// Sequencer wall-clock timestamp (ns since epoch).
    #[prost(uint64, tag = "3")]
    pub server_timestamp: u64,
    /// Balance data — authoritative trading-collateral snapshot.
    #[prost(message, optional, tag = "4")]
    pub bal_data: ::core::option::Option<BalanceUpdateMessage>,
    /// Position data — full positions snapshot for this user.
    #[prost(message, optional, tag = "5")]
    pub pos_data: ::core::option::Option<PositionsSnapshot>,
}
/// Sequencer → edge push: a single terminal-state order to persist in the
/// edge's Postgres `order_history` table. Sent alongside the real-time
/// `OrderUpdate` push whenever an order transitions to Filled / Cancelled /
/// Rejected.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct OrderHistoryInsertMessage {
    #[prost(bytes = "vec", tag = "1")]
    pub user_uuid: ::prost::alloc::vec::Vec<u8>,
    #[prost(message, optional, tag = "2")]
    pub row: ::core::option::Option<OrderHistoryRow>,
    #[prost(uint64, tag = "3")]
    pub log_offset: u64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SequencerToEdgeMessage {
    #[prost(
        oneof = "sequencer_to_edge_message::Inner",
        tags = "1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13"
    )]
    pub inner: ::core::option::Option<sequencer_to_edge_message::Inner>,
}
/// Nested message and enum types in `SequencerToEdgeMessage`.
pub mod sequencer_to_edge_message {
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Inner {
        #[prost(message, tag = "1")]
        OrderUpdate(super::OrderUpdateMessage),
        /// Full-user positions batch (initial / periodic / event). See
        /// `PositionsSnapshot`.
        #[prost(message, tag = "2")]
        PositionsSnapshot(super::PositionsSnapshot),
        #[prost(message, tag = "3")]
        FundingRateUpdate(super::FundingRateUpdateMessage),
        #[prost(message, tag = "4")]
        BalanceUpdate(super::BalanceUpdateMessage),
        /// Terminal-state order row for edge Postgres persistence.
        #[prost(message, tag = "5")]
        OrderHistoryInsert(super::OrderHistoryInsertMessage),
        #[prost(message, tag = "6")]
        OpenInterestUpdate(super::OpenInterestUpdateMessage),
        /// Atomic balance + positions envelope.
        #[prost(message, tag = "7")]
        BalanceAndPosition(super::BalanceAndPosition),
        /// Dedicated account-margin push (collateral / used / reserved / free).
        #[prost(message, tag = "8")]
        AccountMarginUpdate(super::AccountMarginUpdate),
        /// Per-user hourly funding payment for the "Funding History" tab.
        #[prost(message, tag = "9")]
        FundingPayment(super::FundingPaymentMessage),
        /// Dedicated TP/SL lifecycle push (cancel / amend / trigger).
        #[prost(message, tag = "10")]
        TpslUpdate(super::TpslUpdate),
        /// Unified health report (successor to legacy system_health_batch).
        #[prost(message, tag = "11")]
        HealthReport(super::super::super::health::v1::HealthReport),
        #[prost(message, tag = "12")]
        LeverageSettings(super::LeverageSettings),
        #[prost(message, tag = "13")]
        InstrumentUpdate(super::InstrumentUpdate),
    }
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum AckOutcomeKind {
    Unspecified = 0,
    Applied = 1,
    SystemFailed = 2,
}
impl AckOutcomeKind {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::Unspecified => "ACK_OUTCOME_KIND_UNSPECIFIED",
            Self::Applied => "ACK_OUTCOME_KIND_APPLIED",
            Self::SystemFailed => "ACK_OUTCOME_KIND_SYSTEM_FAILED",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "ACK_OUTCOME_KIND_UNSPECIFIED" => Some(Self::Unspecified),
            "ACK_OUTCOME_KIND_APPLIED" => Some(Self::Applied),
            "ACK_OUTCOME_KIND_SYSTEM_FAILED" => Some(Self::SystemFailed),
            _ => None,
        }
    }
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum MassQuoteLegStatus {
    Unspecified = 0,
    Open = 1,
    Filled = 2,
    Failed = 3,
}
impl MassQuoteLegStatus {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::Unspecified => "MASS_QUOTE_LEG_STATUS_UNSPECIFIED",
            Self::Open => "MASS_QUOTE_LEG_STATUS_OPEN",
            Self::Filled => "MASS_QUOTE_LEG_STATUS_FILLED",
            Self::Failed => "MASS_QUOTE_LEG_STATUS_FAILED",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "MASS_QUOTE_LEG_STATUS_UNSPECIFIED" => Some(Self::Unspecified),
            "MASS_QUOTE_LEG_STATUS_OPEN" => Some(Self::Open),
            "MASS_QUOTE_LEG_STATUS_FILLED" => Some(Self::Filled),
            "MASS_QUOTE_LEG_STATUS_FAILED" => Some(Self::Failed),
            _ => None,
        }
    }
}