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
// This file is @generated by prost-build.
/// Canonical 128-bit field element, exactly 16 bytes little-endian in `value`.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FieldElement {
    #[prost(bytes = "vec", tag = "1")]
    pub value: ::prost::alloc::vec::Vec<u8>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FieldElementPair {
    #[prost(bytes = "vec", tag = "1")]
    pub d: ::prost::alloc::vec::Vec<u8>,
    #[prost(bytes = "vec", tag = "2")]
    pub e: ::prost::alloc::vec::Vec<u8>,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum Side {
    Unspecified = 0,
    Buy = 1,
    Sell = 2,
}
impl Side {
    /// 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 => "SIDE_UNSPECIFIED",
            Self::Buy => "SIDE_BUY",
            Self::Sell => "SIDE_SELL",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "SIDE_UNSPECIFIED" => Some(Self::Unspecified),
            "SIDE_BUY" => Some(Self::Buy),
            "SIDE_SELL" => Some(Self::Sell),
            _ => None,
        }
    }
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum OrderType {
    Unspecified = 0,
    Market = 1,
    Limit = 2,
    Peg = 3,
    StopMarket = 4,
    StopLimit = 5,
}
impl OrderType {
    /// 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 => "ORDER_TYPE_UNSPECIFIED",
            Self::Market => "ORDER_TYPE_MARKET",
            Self::Limit => "ORDER_TYPE_LIMIT",
            Self::Peg => "ORDER_TYPE_PEG",
            Self::StopMarket => "ORDER_TYPE_STOP_MARKET",
            Self::StopLimit => "ORDER_TYPE_STOP_LIMIT",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "ORDER_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
            "ORDER_TYPE_MARKET" => Some(Self::Market),
            "ORDER_TYPE_LIMIT" => Some(Self::Limit),
            "ORDER_TYPE_PEG" => Some(Self::Peg),
            "ORDER_TYPE_STOP_MARKET" => Some(Self::StopMarket),
            "ORDER_TYPE_STOP_LIMIT" => Some(Self::StopLimit),
            _ => None,
        }
    }
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum TimeInForce {
    Unspecified = 0,
    Gtc = 1,
    Ioc = 2,
    Fok = 3,
    Gtd = 4,
}
impl TimeInForce {
    /// 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 => "TIME_IN_FORCE_UNSPECIFIED",
            Self::Gtc => "TIME_IN_FORCE_GTC",
            Self::Ioc => "TIME_IN_FORCE_IOC",
            Self::Fok => "TIME_IN_FORCE_FOK",
            Self::Gtd => "TIME_IN_FORCE_GTD",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "TIME_IN_FORCE_UNSPECIFIED" => Some(Self::Unspecified),
            "TIME_IN_FORCE_GTC" => Some(Self::Gtc),
            "TIME_IN_FORCE_IOC" => Some(Self::Ioc),
            "TIME_IN_FORCE_FOK" => Some(Self::Fok),
            "TIME_IN_FORCE_GTD" => Some(Self::Gtd),
            _ => None,
        }
    }
}
/// Self-trade prevention policy for an order. Same-user detection uses the
/// account UUID; `STP_MODE_UNSPECIFIED` maps to cancel-resting.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum StpMode {
    Unspecified = 0,
    CancelResting = 1,
    CancelAggressor = 2,
    CancelBoth = 3,
}
impl StpMode {
    /// 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 => "STP_MODE_UNSPECIFIED",
            Self::CancelResting => "STP_MODE_CANCEL_RESTING",
            Self::CancelAggressor => "STP_MODE_CANCEL_AGGRESSOR",
            Self::CancelBoth => "STP_MODE_CANCEL_BOTH",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "STP_MODE_UNSPECIFIED" => Some(Self::Unspecified),
            "STP_MODE_CANCEL_RESTING" => Some(Self::CancelResting),
            "STP_MODE_CANCEL_AGGRESSOR" => Some(Self::CancelAggressor),
            "STP_MODE_CANCEL_BOTH" => Some(Self::CancelBoth),
            _ => None,
        }
    }
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum OrderStatus {
    Unspecified = 0,
    New = 1,
    PartiallyFilled = 2,
    Filled = 3,
    Cancelled = 4,
    Rejected = 5,
}
impl OrderStatus {
    /// 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 => "ORDER_STATUS_UNSPECIFIED",
            Self::New => "ORDER_STATUS_NEW",
            Self::PartiallyFilled => "ORDER_STATUS_PARTIALLY_FILLED",
            Self::Filled => "ORDER_STATUS_FILLED",
            Self::Cancelled => "ORDER_STATUS_CANCELLED",
            Self::Rejected => "ORDER_STATUS_REJECTED",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "ORDER_STATUS_UNSPECIFIED" => Some(Self::Unspecified),
            "ORDER_STATUS_NEW" => Some(Self::New),
            "ORDER_STATUS_PARTIALLY_FILLED" => Some(Self::PartiallyFilled),
            "ORDER_STATUS_FILLED" => Some(Self::Filled),
            "ORDER_STATUS_CANCELLED" => Some(Self::Cancelled),
            "ORDER_STATUS_REJECTED" => Some(Self::Rejected),
            _ => None,
        }
    }
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum OrderUpdateType {
    Unspecified = 0,
    Open = 1,
    Filled = 2,
    PartiallyFilled = 3,
    Cancelled = 4,
    Rejected = 5,
    Modified = 6,
    CancelRejected = 7,
    ModifyRejected = 8,
    /// Sequencer received and recorded the order; validation pending (not on book).
    Ack = 9,
}
impl OrderUpdateType {
    /// 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 => "ORDER_UPDATE_TYPE_UNSPECIFIED",
            Self::Open => "ORDER_UPDATE_TYPE_OPEN",
            Self::Filled => "ORDER_UPDATE_TYPE_FILLED",
            Self::PartiallyFilled => "ORDER_UPDATE_TYPE_PARTIALLY_FILLED",
            Self::Cancelled => "ORDER_UPDATE_TYPE_CANCELLED",
            Self::Rejected => "ORDER_UPDATE_TYPE_REJECTED",
            Self::Modified => "ORDER_UPDATE_TYPE_MODIFIED",
            Self::CancelRejected => "ORDER_UPDATE_TYPE_CANCEL_REJECTED",
            Self::ModifyRejected => "ORDER_UPDATE_TYPE_MODIFY_REJECTED",
            Self::Ack => "ORDER_UPDATE_TYPE_ACK",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "ORDER_UPDATE_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
            "ORDER_UPDATE_TYPE_OPEN" => Some(Self::Open),
            "ORDER_UPDATE_TYPE_FILLED" => Some(Self::Filled),
            "ORDER_UPDATE_TYPE_PARTIALLY_FILLED" => Some(Self::PartiallyFilled),
            "ORDER_UPDATE_TYPE_CANCELLED" => Some(Self::Cancelled),
            "ORDER_UPDATE_TYPE_REJECTED" => Some(Self::Rejected),
            "ORDER_UPDATE_TYPE_MODIFIED" => Some(Self::Modified),
            "ORDER_UPDATE_TYPE_CANCEL_REJECTED" => Some(Self::CancelRejected),
            "ORDER_UPDATE_TYPE_MODIFY_REJECTED" => Some(Self::ModifyRejected),
            "ORDER_UPDATE_TYPE_ACK" => Some(Self::Ack),
            _ => None,
        }
    }
}
/// Lifecycle of an order-attached TP/SL (sequencer-local).
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum TpslStatus {
    Unspecified = 0,
    Pending = 1,
    Active = 2,
    Triggered = 3,
    Cancelled = 4,
}
impl TpslStatus {
    /// 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 => "TPSL_STATUS_UNSPECIFIED",
            Self::Pending => "TPSL_STATUS_PENDING",
            Self::Active => "TPSL_STATUS_ACTIVE",
            Self::Triggered => "TPSL_STATUS_TRIGGERED",
            Self::Cancelled => "TPSL_STATUS_CANCELLED",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "TPSL_STATUS_UNSPECIFIED" => Some(Self::Unspecified),
            "TPSL_STATUS_PENDING" => Some(Self::Pending),
            "TPSL_STATUS_ACTIVE" => Some(Self::Active),
            "TPSL_STATUS_TRIGGERED" => Some(Self::Triggered),
            "TPSL_STATUS_CANCELLED" => Some(Self::Cancelled),
            _ => None,
        }
    }
}
/// Which TP/SL leg caused a TRIGGERED close.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum TpslLeg {
    Unspecified = 0,
    TakeProfit = 1,
    StopLoss = 2,
}
impl TpslLeg {
    /// 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 => "TPSL_LEG_UNSPECIFIED",
            Self::TakeProfit => "TPSL_LEG_TAKE_PROFIT",
            Self::StopLoss => "TPSL_LEG_STOP_LOSS",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "TPSL_LEG_UNSPECIFIED" => Some(Self::Unspecified),
            "TPSL_LEG_TAKE_PROFIT" => Some(Self::TakeProfit),
            "TPSL_LEG_STOP_LOSS" => Some(Self::StopLoss),
            _ => None,
        }
    }
}
/// Order-attached (parent fill qty) vs entire-position (live size).
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum TpslKind {
    Unspecified = 0,
    Order = 1,
    Position = 2,
}
impl TpslKind {
    /// 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 => "TPSL_KIND_UNSPECIFIED",
            Self::Order => "TPSL_KIND_ORDER",
            Self::Position => "TPSL_KIND_POSITION",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "TPSL_KIND_UNSPECIFIED" => Some(Self::Unspecified),
            "TPSL_KIND_ORDER" => Some(Self::Order),
            "TPSL_KIND_POSITION" => Some(Self::Position),
            _ => None,
        }
    }
}
/// Reason the sequencer emitted a `PositionsSnapshot`. Carried in the
/// batch so the frontend can label timing-sensitive UI states (fresh
/// hydration vs periodic refresh vs event-driven re-render).
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum PositionsSnapshotSource {
    Unspecified = 0,
    /// First snapshot delivered in reply to a `SubscribePositions` request.
    Initial = 1,
    /// Periodic sweep (`interval_seconds`).
    Periodic = 2,
    /// Fill / flip / close events that actually changed position state.
    Event = 3,
}
impl PositionsSnapshotSource {
    /// 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 => "POSITIONS_SNAPSHOT_SOURCE_UNSPECIFIED",
            Self::Initial => "POSITIONS_SNAPSHOT_SOURCE_INITIAL",
            Self::Periodic => "POSITIONS_SNAPSHOT_SOURCE_PERIODIC",
            Self::Event => "POSITIONS_SNAPSHOT_SOURCE_EVENT",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "POSITIONS_SNAPSHOT_SOURCE_UNSPECIFIED" => Some(Self::Unspecified),
            "POSITIONS_SNAPSHOT_SOURCE_INITIAL" => Some(Self::Initial),
            "POSITIONS_SNAPSHOT_SOURCE_PERIODIC" => Some(Self::Periodic),
            "POSITIONS_SNAPSHOT_SOURCE_EVENT" => Some(Self::Event),
            _ => None,
        }
    }
}
/// Position lifecycle status.
/// Lets the frontend distinguish normal positions from those undergoing
/// liquidation or auto-deleveraging.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum PositionStatus {
    /// Mirrors Bybit `positionStatus`: NORMAL is the meaningful default state and
    /// there is no "unspecified" concept, so the zero value intentionally does not
    /// use the *_UNSPECIFIED suffix. Renumbering would be a wire-incompatible break
    /// for shipped consumers (gdx-web, generated types_pb.ts).
    /// buf:lint:ignore ENUM_ZERO_VALUE_SUFFIX
    Normal = 0,
    /// Position is being liquidated (margin-tranche execution).
    Liq = 1,
    /// Position is being auto-deleveraged.
    Adl = 2,
}
impl PositionStatus {
    /// 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::Normal => "POSITION_STATUS_NORMAL",
            Self::Liq => "POSITION_STATUS_LIQ",
            Self::Adl => "POSITION_STATUS_ADL",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "POSITION_STATUS_NORMAL" => Some(Self::Normal),
            "POSITION_STATUS_LIQ" => Some(Self::Liq),
            "POSITION_STATUS_ADL" => Some(Self::Adl),
            _ => None,
        }
    }
}
/// Per-symbol margin mode. Selected per (user, symbol).
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum MarginMode {
    /// ISOLATED is the meaningful default; there is no "unspecified" concept, so
    /// the zero value intentionally omits the *_UNSPECIFIED suffix.
    /// buf:lint:ignore ENUM_ZERO_VALUE_SUFFIX
    Isolated = 0,
    /// Symbol participates in the account cross collateral pool.
    Cross = 1,
}
impl MarginMode {
    /// 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::Isolated => "MARGIN_MODE_ISOLATED",
            Self::Cross => "MARGIN_MODE_CROSS",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "MARGIN_MODE_ISOLATED" => Some(Self::Isolated),
            "MARGIN_MODE_CROSS" => Some(Self::Cross),
            _ => None,
        }
    }
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum RequestType {
    Unspecified = 0,
    Place = 1,
    Cancel = 2,
    Modify = 3,
    Subscribe = 4,
    GetOpenOrders = 5,
    UpdateLeverage = 6,
    AdjustMargin = 7,
    MassQuote = 8,
    BatchCancel = 9,
    BatchModify = 10,
    /// Cancel order-attached TP/SL without cancelling the parent entry.
    CancelTpsl = 11,
    /// Amend TP/SL triggers on an existing Pending/Active attachment.
    AmendTpsl = 12,
    /// Update per-(user, symbol) margin mode (isolated ↔ cross). Requires flat symbol.
    UpdateMarginMode = 13,
    /// Synchronous full-user positions snapshot (sequencer-local RPC).
    GetPositions = 14,
    /// Synchronous account-margin snapshot (sequencer-local RPC).
    GetAccount = 15,
    /// Cancel every working order for the session user (optional symbol filter).
    CancelAll = 16,
    /// Close every open position for the session user (optional symbol filter).
    CloseAll = 17,
    /// Close the live position at market, then open the opposite side.
    Reverse = 18,
}
impl RequestType {
    /// 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 => "REQUEST_TYPE_UNSPECIFIED",
            Self::Place => "REQUEST_TYPE_PLACE",
            Self::Cancel => "REQUEST_TYPE_CANCEL",
            Self::Modify => "REQUEST_TYPE_MODIFY",
            Self::Subscribe => "REQUEST_TYPE_SUBSCRIBE",
            Self::GetOpenOrders => "REQUEST_TYPE_GET_OPEN_ORDERS",
            Self::UpdateLeverage => "REQUEST_TYPE_UPDATE_LEVERAGE",
            Self::AdjustMargin => "REQUEST_TYPE_ADJUST_MARGIN",
            Self::MassQuote => "REQUEST_TYPE_MASS_QUOTE",
            Self::BatchCancel => "REQUEST_TYPE_BATCH_CANCEL",
            Self::BatchModify => "REQUEST_TYPE_BATCH_MODIFY",
            Self::CancelTpsl => "REQUEST_TYPE_CANCEL_TPSL",
            Self::AmendTpsl => "REQUEST_TYPE_AMEND_TPSL",
            Self::UpdateMarginMode => "REQUEST_TYPE_UPDATE_MARGIN_MODE",
            Self::GetPositions => "REQUEST_TYPE_GET_POSITIONS",
            Self::GetAccount => "REQUEST_TYPE_GET_ACCOUNT",
            Self::CancelAll => "REQUEST_TYPE_CANCEL_ALL",
            Self::CloseAll => "REQUEST_TYPE_CLOSE_ALL",
            Self::Reverse => "REQUEST_TYPE_REVERSE",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "REQUEST_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
            "REQUEST_TYPE_PLACE" => Some(Self::Place),
            "REQUEST_TYPE_CANCEL" => Some(Self::Cancel),
            "REQUEST_TYPE_MODIFY" => Some(Self::Modify),
            "REQUEST_TYPE_SUBSCRIBE" => Some(Self::Subscribe),
            "REQUEST_TYPE_GET_OPEN_ORDERS" => Some(Self::GetOpenOrders),
            "REQUEST_TYPE_UPDATE_LEVERAGE" => Some(Self::UpdateLeverage),
            "REQUEST_TYPE_ADJUST_MARGIN" => Some(Self::AdjustMargin),
            "REQUEST_TYPE_MASS_QUOTE" => Some(Self::MassQuote),
            "REQUEST_TYPE_BATCH_CANCEL" => Some(Self::BatchCancel),
            "REQUEST_TYPE_BATCH_MODIFY" => Some(Self::BatchModify),
            "REQUEST_TYPE_CANCEL_TPSL" => Some(Self::CancelTpsl),
            "REQUEST_TYPE_AMEND_TPSL" => Some(Self::AmendTpsl),
            "REQUEST_TYPE_UPDATE_MARGIN_MODE" => Some(Self::UpdateMarginMode),
            "REQUEST_TYPE_GET_POSITIONS" => Some(Self::GetPositions),
            "REQUEST_TYPE_GET_ACCOUNT" => Some(Self::GetAccount),
            "REQUEST_TYPE_CANCEL_ALL" => Some(Self::CancelAll),
            "REQUEST_TYPE_CLOSE_ALL" => Some(Self::CloseAll),
            "REQUEST_TYPE_REVERSE" => Some(Self::Reverse),
            _ => None,
        }
    }
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum ResponseMessageType {
    Unspecified = 0,
    OrderUpdate = 1,
    SystemHealth = 2,
    Ack = 3,
    /// Synchronous working-orders snapshot reply (encrypted-edge bidi).
    OpenOrdersSnapshot = 4,
    /// Full-user positions batch. See `gdx.sequencer.v1.PositionsSnapshot`.
    PositionsSnapshot = 5,
    /// Atomic balance + positions envelope.
    BalanceAndPosition = 6,
    /// Dedicated account-margin push. See `gdx.sequencer.v1.AccountMarginUpdate`.
    AccountMarginUpdate = 7,
    MassQuoteAck = 8,
    BatchCancelAck = 9,
    BatchModifyAck = 10,
    /// Dedicated TP/SL lifecycle push (cancel / amend / trigger).
    TpslUpdate = 11,
    LeverageSettings = 12,
    CancelAllAck = 13,
    CloseAllAck = 14,
    ReverseAck = 15,
    TpslAck = 16,
}
impl ResponseMessageType {
    /// 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 => "RESPONSE_MESSAGE_TYPE_UNSPECIFIED",
            Self::OrderUpdate => "RESPONSE_MESSAGE_TYPE_ORDER_UPDATE",
            Self::SystemHealth => "RESPONSE_MESSAGE_TYPE_SYSTEM_HEALTH",
            Self::Ack => "RESPONSE_MESSAGE_TYPE_ACK",
            Self::OpenOrdersSnapshot => "RESPONSE_MESSAGE_TYPE_OPEN_ORDERS_SNAPSHOT",
            Self::PositionsSnapshot => "RESPONSE_MESSAGE_TYPE_POSITIONS_SNAPSHOT",
            Self::BalanceAndPosition => "RESPONSE_MESSAGE_TYPE_BALANCE_AND_POSITION",
            Self::AccountMarginUpdate => "RESPONSE_MESSAGE_TYPE_ACCOUNT_MARGIN_UPDATE",
            Self::MassQuoteAck => "RESPONSE_MESSAGE_TYPE_MASS_QUOTE_ACK",
            Self::BatchCancelAck => "RESPONSE_MESSAGE_TYPE_BATCH_CANCEL_ACK",
            Self::BatchModifyAck => "RESPONSE_MESSAGE_TYPE_BATCH_MODIFY_ACK",
            Self::TpslUpdate => "RESPONSE_MESSAGE_TYPE_TPSL_UPDATE",
            Self::LeverageSettings => "RESPONSE_MESSAGE_TYPE_LEVERAGE_SETTINGS",
            Self::CancelAllAck => "RESPONSE_MESSAGE_TYPE_CANCEL_ALL_ACK",
            Self::CloseAllAck => "RESPONSE_MESSAGE_TYPE_CLOSE_ALL_ACK",
            Self::ReverseAck => "RESPONSE_MESSAGE_TYPE_REVERSE_ACK",
            Self::TpslAck => "RESPONSE_MESSAGE_TYPE_TPSL_ACK",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "RESPONSE_MESSAGE_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
            "RESPONSE_MESSAGE_TYPE_ORDER_UPDATE" => Some(Self::OrderUpdate),
            "RESPONSE_MESSAGE_TYPE_SYSTEM_HEALTH" => Some(Self::SystemHealth),
            "RESPONSE_MESSAGE_TYPE_ACK" => Some(Self::Ack),
            "RESPONSE_MESSAGE_TYPE_OPEN_ORDERS_SNAPSHOT" => {
                Some(Self::OpenOrdersSnapshot)
            }
            "RESPONSE_MESSAGE_TYPE_POSITIONS_SNAPSHOT" => Some(Self::PositionsSnapshot),
            "RESPONSE_MESSAGE_TYPE_BALANCE_AND_POSITION" => {
                Some(Self::BalanceAndPosition)
            }
            "RESPONSE_MESSAGE_TYPE_ACCOUNT_MARGIN_UPDATE" => {
                Some(Self::AccountMarginUpdate)
            }
            "RESPONSE_MESSAGE_TYPE_MASS_QUOTE_ACK" => Some(Self::MassQuoteAck),
            "RESPONSE_MESSAGE_TYPE_BATCH_CANCEL_ACK" => Some(Self::BatchCancelAck),
            "RESPONSE_MESSAGE_TYPE_BATCH_MODIFY_ACK" => Some(Self::BatchModifyAck),
            "RESPONSE_MESSAGE_TYPE_TPSL_UPDATE" => Some(Self::TpslUpdate),
            "RESPONSE_MESSAGE_TYPE_LEVERAGE_SETTINGS" => Some(Self::LeverageSettings),
            "RESPONSE_MESSAGE_TYPE_CANCEL_ALL_ACK" => Some(Self::CancelAllAck),
            "RESPONSE_MESSAGE_TYPE_CLOSE_ALL_ACK" => Some(Self::CloseAllAck),
            "RESPONSE_MESSAGE_TYPE_REVERSE_ACK" => Some(Self::ReverseAck),
            "RESPONSE_MESSAGE_TYPE_TPSL_ACK" => Some(Self::TpslAck),
            _ => None,
        }
    }
}
/// Cancel of a working order. `SYSTEM` is the catch-all for engine cancels
/// that are not one of the dedicated buckets (TIF remainder, expiry, ADL,
/// liquidation, margin, reduce-only leftover). Prefer a dedicated value when
/// the cause is a first-class venue rule — do not overload `SYSTEM` + `msg`
/// for those.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum CancelReason {
    Unspecified = 0,
    UserRequested = 1,
    IocRemainder = 2,
    FokNotFilled = 3,
    Expired = 4,
    System = 5,
    Adl = 6,
    LiquidatedCanceled = 7,
    MarginCanceled = 8,
    ReduceOnly = 9,
    StpExpireTaker = 10,
    StpCancelResting = 11,
}
impl CancelReason {
    /// 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 => "CANCEL_REASON_UNSPECIFIED",
            Self::UserRequested => "CANCEL_REASON_USER_REQUESTED",
            Self::IocRemainder => "CANCEL_REASON_IOC_REMAINDER",
            Self::FokNotFilled => "CANCEL_REASON_FOK_NOT_FILLED",
            Self::Expired => "CANCEL_REASON_EXPIRED",
            Self::System => "CANCEL_REASON_SYSTEM",
            Self::Adl => "CANCEL_REASON_ADL",
            Self::LiquidatedCanceled => "CANCEL_REASON_LIQUIDATED_CANCELED",
            Self::MarginCanceled => "CANCEL_REASON_MARGIN_CANCELED",
            Self::ReduceOnly => "CANCEL_REASON_REDUCE_ONLY",
            Self::StpExpireTaker => "CANCEL_REASON_STP_EXPIRE_TAKER",
            Self::StpCancelResting => "CANCEL_REASON_STP_CANCEL_RESTING",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "CANCEL_REASON_UNSPECIFIED" => Some(Self::Unspecified),
            "CANCEL_REASON_USER_REQUESTED" => Some(Self::UserRequested),
            "CANCEL_REASON_IOC_REMAINDER" => Some(Self::IocRemainder),
            "CANCEL_REASON_FOK_NOT_FILLED" => Some(Self::FokNotFilled),
            "CANCEL_REASON_EXPIRED" => Some(Self::Expired),
            "CANCEL_REASON_SYSTEM" => Some(Self::System),
            "CANCEL_REASON_ADL" => Some(Self::Adl),
            "CANCEL_REASON_LIQUIDATED_CANCELED" => Some(Self::LiquidatedCanceled),
            "CANCEL_REASON_MARGIN_CANCELED" => Some(Self::MarginCanceled),
            "CANCEL_REASON_REDUCE_ONLY" => Some(Self::ReduceOnly),
            "CANCEL_REASON_STP_EXPIRE_TAKER" => Some(Self::StpExpireTaker),
            "CANCEL_REASON_STP_CANCEL_RESTING" => Some(Self::StpCancelResting),
            _ => None,
        }
    }
}
/// Position-reducing fill attribution for order history (filled reduce-only /
/// system closes). Distinct from CancelReason, which applies to cancelled orders.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum CloseReason {
    Unspecified = 0,
    Manual = 1,
    TakeProfit = 2,
    StopLoss = 3,
    Adl = 4,
    Liquidation = 5,
}
impl CloseReason {
    /// 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 => "CLOSE_REASON_UNSPECIFIED",
            Self::Manual => "CLOSE_REASON_MANUAL",
            Self::TakeProfit => "CLOSE_REASON_TAKE_PROFIT",
            Self::StopLoss => "CLOSE_REASON_STOP_LOSS",
            Self::Adl => "CLOSE_REASON_ADL",
            Self::Liquidation => "CLOSE_REASON_LIQUIDATION",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "CLOSE_REASON_UNSPECIFIED" => Some(Self::Unspecified),
            "CLOSE_REASON_MANUAL" => Some(Self::Manual),
            "CLOSE_REASON_TAKE_PROFIT" => Some(Self::TakeProfit),
            "CLOSE_REASON_STOP_LOSS" => Some(Self::StopLoss),
            "CLOSE_REASON_ADL" => Some(Self::Adl),
            "CLOSE_REASON_LIQUIDATION" => Some(Self::Liquidation),
            _ => None,
        }
    }
}