Skip to main content

binance_sdk/spot/rest_api/apis/
trade_api.rs

1/*
2 * Spot REST API
3 *
4 * Access market data, manage accounts, and trade on Binance Spot.
5 *
6 * The version of the OpenAPI document: 1.0.0
7 *
8 *
9 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
10 * https://openapi-generator.tech
11 * Do not edit the class manually.
12 */
13
14#![allow(unused_imports)]
15use async_trait::async_trait;
16use derive_builder::Builder;
17use reqwest;
18use rust_decimal::prelude::*;
19use serde::{Deserialize, Serialize};
20use serde_json::{Value, json};
21use std::collections::BTreeMap;
22
23use crate::common::{
24    config::ConfigurationRestApi,
25    models::{ParamBuildError, RestApiResponse},
26    utils::send_request,
27};
28use crate::spot::rest_api::models;
29
30const HAS_TIME_UNIT: bool = true;
31
32#[async_trait]
33pub trait TradeApi: Send + Sync {
34    async fn delete_open_orders(
35        &self,
36        params: DeleteOpenOrdersParams,
37    ) -> anyhow::Result<RestApiResponse<Vec<models::DeleteOpenOrdersResponseInner>>>;
38    async fn delete_order(
39        &self,
40        params: DeleteOrderParams,
41    ) -> anyhow::Result<RestApiResponse<models::DeleteOrderResponse>>;
42    async fn delete_order_list(
43        &self,
44        params: DeleteOrderListParams,
45    ) -> anyhow::Result<RestApiResponse<models::DeleteOrderListResponse>>;
46    async fn new_order(
47        &self,
48        params: NewOrderParams,
49    ) -> anyhow::Result<RestApiResponse<models::NewOrderResponse>>;
50    async fn order_amend_keep_priority(
51        &self,
52        params: OrderAmendKeepPriorityParams,
53    ) -> anyhow::Result<RestApiResponse<models::OrderAmendKeepPriorityResponse>>;
54    async fn order_cancel_replace(
55        &self,
56        params: OrderCancelReplaceParams,
57    ) -> anyhow::Result<RestApiResponse<models::OrderCancelReplaceResponse>>;
58    async fn order_list_oco(
59        &self,
60        params: OrderListOcoParams,
61    ) -> anyhow::Result<RestApiResponse<models::OrderListOcoResponse>>;
62    async fn order_list_opo(
63        &self,
64        params: OrderListOpoParams,
65    ) -> anyhow::Result<RestApiResponse<models::OrderListOpoResponse>>;
66    async fn order_list_opoco(
67        &self,
68        params: OrderListOpocoParams,
69    ) -> anyhow::Result<RestApiResponse<models::OrderListOpocoResponse>>;
70    async fn order_list_oto(
71        &self,
72        params: OrderListOtoParams,
73    ) -> anyhow::Result<RestApiResponse<models::OrderListOtoResponse>>;
74    async fn order_list_otoco(
75        &self,
76        params: OrderListOtocoParams,
77    ) -> anyhow::Result<RestApiResponse<models::OrderListOtocoResponse>>;
78    async fn order_oco(
79        &self,
80        params: OrderOcoParams,
81    ) -> anyhow::Result<RestApiResponse<models::OrderOcoResponse>>;
82    async fn order_test(
83        &self,
84        params: OrderTestParams,
85    ) -> anyhow::Result<RestApiResponse<models::OrderTestResponse>>;
86    async fn sor_order(
87        &self,
88        params: SorOrderParams,
89    ) -> anyhow::Result<RestApiResponse<models::SorOrderResponse>>;
90    async fn sor_order_test(
91        &self,
92        params: SorOrderTestParams,
93    ) -> anyhow::Result<RestApiResponse<models::SorOrderTestResponse>>;
94}
95
96#[derive(Debug, Clone)]
97pub struct TradeApiClient {
98    configuration: ConfigurationRestApi,
99}
100
101impl TradeApiClient {
102    pub fn new(configuration: ConfigurationRestApi) -> Self {
103        Self { configuration }
104    }
105}
106
107#[allow(non_camel_case_types)]
108#[derive(Debug, Clone, Serialize, Deserialize)]
109pub enum DeleteOrderCancelRestrictionsEnum {
110    #[serde(rename = "ONLY_NEW")]
111    OnlyNew,
112    #[serde(rename = "ONLY_PARTIALLY_FILLED")]
113    OnlyPartiallyFilled,
114}
115
116impl DeleteOrderCancelRestrictionsEnum {
117    #[must_use]
118    pub fn as_str(&self) -> &'static str {
119        match self {
120            Self::OnlyNew => "ONLY_NEW",
121            Self::OnlyPartiallyFilled => "ONLY_PARTIALLY_FILLED",
122        }
123    }
124}
125
126impl std::str::FromStr for DeleteOrderCancelRestrictionsEnum {
127    type Err = Box<dyn std::error::Error + Send + Sync>;
128
129    fn from_str(s: &str) -> Result<Self, Self::Err> {
130        match s {
131            "ONLY_NEW" => Ok(Self::OnlyNew),
132            "ONLY_PARTIALLY_FILLED" => Ok(Self::OnlyPartiallyFilled),
133            other => Err(format!("invalid DeleteOrderCancelRestrictionsEnum: {}", other).into()),
134        }
135    }
136}
137
138#[allow(non_camel_case_types)]
139#[derive(Debug, Clone, Serialize, Deserialize)]
140pub enum NewOrderSideEnum {
141    #[serde(rename = "BUY")]
142    Buy,
143    #[serde(rename = "SELL")]
144    Sell,
145}
146
147impl NewOrderSideEnum {
148    #[must_use]
149    pub fn as_str(&self) -> &'static str {
150        match self {
151            Self::Buy => "BUY",
152            Self::Sell => "SELL",
153        }
154    }
155}
156
157impl std::str::FromStr for NewOrderSideEnum {
158    type Err = Box<dyn std::error::Error + Send + Sync>;
159
160    fn from_str(s: &str) -> Result<Self, Self::Err> {
161        match s {
162            "BUY" => Ok(Self::Buy),
163            "SELL" => Ok(Self::Sell),
164            other => Err(format!("invalid NewOrderSideEnum: {}", other).into()),
165        }
166    }
167}
168
169#[allow(non_camel_case_types)]
170#[derive(Debug, Clone, Serialize, Deserialize)]
171pub enum NewOrderTypeEnum {
172    #[serde(rename = "MARKET")]
173    Market,
174    #[serde(rename = "LIMIT")]
175    Limit,
176    #[serde(rename = "STOP_LOSS")]
177    StopLoss,
178    #[serde(rename = "STOP_LOSS_LIMIT")]
179    StopLossLimit,
180    #[serde(rename = "TAKE_PROFIT")]
181    TakeProfit,
182    #[serde(rename = "TAKE_PROFIT_LIMIT")]
183    TakeProfitLimit,
184    #[serde(rename = "LIMIT_MAKER")]
185    LimitMaker,
186}
187
188impl NewOrderTypeEnum {
189    #[must_use]
190    pub fn as_str(&self) -> &'static str {
191        match self {
192            Self::Market => "MARKET",
193            Self::Limit => "LIMIT",
194            Self::StopLoss => "STOP_LOSS",
195            Self::StopLossLimit => "STOP_LOSS_LIMIT",
196            Self::TakeProfit => "TAKE_PROFIT",
197            Self::TakeProfitLimit => "TAKE_PROFIT_LIMIT",
198            Self::LimitMaker => "LIMIT_MAKER",
199        }
200    }
201}
202
203impl std::str::FromStr for NewOrderTypeEnum {
204    type Err = Box<dyn std::error::Error + Send + Sync>;
205
206    fn from_str(s: &str) -> Result<Self, Self::Err> {
207        match s {
208            "MARKET" => Ok(Self::Market),
209            "LIMIT" => Ok(Self::Limit),
210            "STOP_LOSS" => Ok(Self::StopLoss),
211            "STOP_LOSS_LIMIT" => Ok(Self::StopLossLimit),
212            "TAKE_PROFIT" => Ok(Self::TakeProfit),
213            "TAKE_PROFIT_LIMIT" => Ok(Self::TakeProfitLimit),
214            "LIMIT_MAKER" => Ok(Self::LimitMaker),
215            other => Err(format!("invalid NewOrderTypeEnum: {}", other).into()),
216        }
217    }
218}
219
220#[allow(non_camel_case_types)]
221#[derive(Debug, Clone, Serialize, Deserialize)]
222pub enum NewOrderTimeInForceEnum {
223    #[serde(rename = "GTC")]
224    Gtc,
225    #[serde(rename = "IOC")]
226    Ioc,
227    #[serde(rename = "FOK")]
228    Fok,
229}
230
231impl NewOrderTimeInForceEnum {
232    #[must_use]
233    pub fn as_str(&self) -> &'static str {
234        match self {
235            Self::Gtc => "GTC",
236            Self::Ioc => "IOC",
237            Self::Fok => "FOK",
238        }
239    }
240}
241
242impl std::str::FromStr for NewOrderTimeInForceEnum {
243    type Err = Box<dyn std::error::Error + Send + Sync>;
244
245    fn from_str(s: &str) -> Result<Self, Self::Err> {
246        match s {
247            "GTC" => Ok(Self::Gtc),
248            "IOC" => Ok(Self::Ioc),
249            "FOK" => Ok(Self::Fok),
250            other => Err(format!("invalid NewOrderTimeInForceEnum: {}", other).into()),
251        }
252    }
253}
254
255#[allow(non_camel_case_types)]
256#[derive(Debug, Clone, Serialize, Deserialize)]
257pub enum NewOrderNewOrderRespTypeEnum {
258    #[serde(rename = "ACK")]
259    Ack,
260    #[serde(rename = "RESULT")]
261    Result,
262    #[serde(rename = "FULL")]
263    Full,
264}
265
266impl NewOrderNewOrderRespTypeEnum {
267    #[must_use]
268    pub fn as_str(&self) -> &'static str {
269        match self {
270            Self::Ack => "ACK",
271            Self::Result => "RESULT",
272            Self::Full => "FULL",
273        }
274    }
275}
276
277impl std::str::FromStr for NewOrderNewOrderRespTypeEnum {
278    type Err = Box<dyn std::error::Error + Send + Sync>;
279
280    fn from_str(s: &str) -> Result<Self, Self::Err> {
281        match s {
282            "ACK" => Ok(Self::Ack),
283            "RESULT" => Ok(Self::Result),
284            "FULL" => Ok(Self::Full),
285            other => Err(format!("invalid NewOrderNewOrderRespTypeEnum: {}", other).into()),
286        }
287    }
288}
289
290#[allow(non_camel_case_types)]
291#[derive(Debug, Clone, Serialize, Deserialize)]
292pub enum NewOrderSelfTradePreventionModeEnum {
293    #[serde(rename = "NONE")]
294    None,
295    #[serde(rename = "EXPIRE_TAKER")]
296    ExpireTaker,
297    #[serde(rename = "EXPIRE_MAKER")]
298    ExpireMaker,
299    #[serde(rename = "EXPIRE_BOTH")]
300    ExpireBoth,
301    #[serde(rename = "DECREMENT")]
302    Decrement,
303    #[serde(rename = "TRANSFER")]
304    Transfer,
305}
306
307impl NewOrderSelfTradePreventionModeEnum {
308    #[must_use]
309    pub fn as_str(&self) -> &'static str {
310        match self {
311            Self::None => "NONE",
312            Self::ExpireTaker => "EXPIRE_TAKER",
313            Self::ExpireMaker => "EXPIRE_MAKER",
314            Self::ExpireBoth => "EXPIRE_BOTH",
315            Self::Decrement => "DECREMENT",
316            Self::Transfer => "TRANSFER",
317        }
318    }
319}
320
321impl std::str::FromStr for NewOrderSelfTradePreventionModeEnum {
322    type Err = Box<dyn std::error::Error + Send + Sync>;
323
324    fn from_str(s: &str) -> Result<Self, Self::Err> {
325        match s {
326            "NONE" => Ok(Self::None),
327            "EXPIRE_TAKER" => Ok(Self::ExpireTaker),
328            "EXPIRE_MAKER" => Ok(Self::ExpireMaker),
329            "EXPIRE_BOTH" => Ok(Self::ExpireBoth),
330            "DECREMENT" => Ok(Self::Decrement),
331            "TRANSFER" => Ok(Self::Transfer),
332            other => Err(format!("invalid NewOrderSelfTradePreventionModeEnum: {}", other).into()),
333        }
334    }
335}
336
337#[allow(non_camel_case_types)]
338#[derive(Debug, Clone, Serialize, Deserialize)]
339pub enum NewOrderPegPriceTypeEnum {
340    #[serde(rename = "PRIMARY_PEG")]
341    PrimaryPeg,
342    #[serde(rename = "MARKET_PEG")]
343    MarketPeg,
344}
345
346impl NewOrderPegPriceTypeEnum {
347    #[must_use]
348    pub fn as_str(&self) -> &'static str {
349        match self {
350            Self::PrimaryPeg => "PRIMARY_PEG",
351            Self::MarketPeg => "MARKET_PEG",
352        }
353    }
354}
355
356impl std::str::FromStr for NewOrderPegPriceTypeEnum {
357    type Err = Box<dyn std::error::Error + Send + Sync>;
358
359    fn from_str(s: &str) -> Result<Self, Self::Err> {
360        match s {
361            "PRIMARY_PEG" => Ok(Self::PrimaryPeg),
362            "MARKET_PEG" => Ok(Self::MarketPeg),
363            other => Err(format!("invalid NewOrderPegPriceTypeEnum: {}", other).into()),
364        }
365    }
366}
367
368#[allow(non_camel_case_types)]
369#[derive(Debug, Clone, Serialize, Deserialize)]
370pub enum NewOrderPegOffsetTypeEnum {
371    #[serde(rename = "PRICE_LEVEL")]
372    PriceLevel,
373}
374
375impl NewOrderPegOffsetTypeEnum {
376    #[must_use]
377    pub fn as_str(&self) -> &'static str {
378        match self {
379            Self::PriceLevel => "PRICE_LEVEL",
380        }
381    }
382}
383
384impl std::str::FromStr for NewOrderPegOffsetTypeEnum {
385    type Err = Box<dyn std::error::Error + Send + Sync>;
386
387    fn from_str(s: &str) -> Result<Self, Self::Err> {
388        match s {
389            "PRICE_LEVEL" => Ok(Self::PriceLevel),
390            other => Err(format!("invalid NewOrderPegOffsetTypeEnum: {}", other).into()),
391        }
392    }
393}
394
395#[allow(non_camel_case_types)]
396#[derive(Debug, Clone, Serialize, Deserialize)]
397pub enum OrderCancelReplaceSideEnum {
398    #[serde(rename = "BUY")]
399    Buy,
400    #[serde(rename = "SELL")]
401    Sell,
402}
403
404impl OrderCancelReplaceSideEnum {
405    #[must_use]
406    pub fn as_str(&self) -> &'static str {
407        match self {
408            Self::Buy => "BUY",
409            Self::Sell => "SELL",
410        }
411    }
412}
413
414impl std::str::FromStr for OrderCancelReplaceSideEnum {
415    type Err = Box<dyn std::error::Error + Send + Sync>;
416
417    fn from_str(s: &str) -> Result<Self, Self::Err> {
418        match s {
419            "BUY" => Ok(Self::Buy),
420            "SELL" => Ok(Self::Sell),
421            other => Err(format!("invalid OrderCancelReplaceSideEnum: {}", other).into()),
422        }
423    }
424}
425
426#[allow(non_camel_case_types)]
427#[derive(Debug, Clone, Serialize, Deserialize)]
428pub enum OrderCancelReplaceTypeEnum {
429    #[serde(rename = "MARKET")]
430    Market,
431    #[serde(rename = "LIMIT")]
432    Limit,
433    #[serde(rename = "STOP_LOSS")]
434    StopLoss,
435    #[serde(rename = "STOP_LOSS_LIMIT")]
436    StopLossLimit,
437    #[serde(rename = "TAKE_PROFIT")]
438    TakeProfit,
439    #[serde(rename = "TAKE_PROFIT_LIMIT")]
440    TakeProfitLimit,
441    #[serde(rename = "LIMIT_MAKER")]
442    LimitMaker,
443}
444
445impl OrderCancelReplaceTypeEnum {
446    #[must_use]
447    pub fn as_str(&self) -> &'static str {
448        match self {
449            Self::Market => "MARKET",
450            Self::Limit => "LIMIT",
451            Self::StopLoss => "STOP_LOSS",
452            Self::StopLossLimit => "STOP_LOSS_LIMIT",
453            Self::TakeProfit => "TAKE_PROFIT",
454            Self::TakeProfitLimit => "TAKE_PROFIT_LIMIT",
455            Self::LimitMaker => "LIMIT_MAKER",
456        }
457    }
458}
459
460impl std::str::FromStr for OrderCancelReplaceTypeEnum {
461    type Err = Box<dyn std::error::Error + Send + Sync>;
462
463    fn from_str(s: &str) -> Result<Self, Self::Err> {
464        match s {
465            "MARKET" => Ok(Self::Market),
466            "LIMIT" => Ok(Self::Limit),
467            "STOP_LOSS" => Ok(Self::StopLoss),
468            "STOP_LOSS_LIMIT" => Ok(Self::StopLossLimit),
469            "TAKE_PROFIT" => Ok(Self::TakeProfit),
470            "TAKE_PROFIT_LIMIT" => Ok(Self::TakeProfitLimit),
471            "LIMIT_MAKER" => Ok(Self::LimitMaker),
472            other => Err(format!("invalid OrderCancelReplaceTypeEnum: {}", other).into()),
473        }
474    }
475}
476
477#[allow(non_camel_case_types)]
478#[derive(Debug, Clone, Serialize, Deserialize)]
479pub enum OrderCancelReplaceCancelReplaceModeEnum {
480    #[serde(rename = "STOP_ON_FAILURE")]
481    StopOnFailure,
482    #[serde(rename = "ALLOW_FAILURE")]
483    AllowFailure,
484}
485
486impl OrderCancelReplaceCancelReplaceModeEnum {
487    #[must_use]
488    pub fn as_str(&self) -> &'static str {
489        match self {
490            Self::StopOnFailure => "STOP_ON_FAILURE",
491            Self::AllowFailure => "ALLOW_FAILURE",
492        }
493    }
494}
495
496impl std::str::FromStr for OrderCancelReplaceCancelReplaceModeEnum {
497    type Err = Box<dyn std::error::Error + Send + Sync>;
498
499    fn from_str(s: &str) -> Result<Self, Self::Err> {
500        match s {
501            "STOP_ON_FAILURE" => Ok(Self::StopOnFailure),
502            "ALLOW_FAILURE" => Ok(Self::AllowFailure),
503            other => {
504                Err(format!("invalid OrderCancelReplaceCancelReplaceModeEnum: {}", other).into())
505            }
506        }
507    }
508}
509
510#[allow(non_camel_case_types)]
511#[derive(Debug, Clone, Serialize, Deserialize)]
512pub enum OrderCancelReplaceTimeInForceEnum {
513    #[serde(rename = "GTC")]
514    Gtc,
515    #[serde(rename = "IOC")]
516    Ioc,
517    #[serde(rename = "FOK")]
518    Fok,
519}
520
521impl OrderCancelReplaceTimeInForceEnum {
522    #[must_use]
523    pub fn as_str(&self) -> &'static str {
524        match self {
525            Self::Gtc => "GTC",
526            Self::Ioc => "IOC",
527            Self::Fok => "FOK",
528        }
529    }
530}
531
532impl std::str::FromStr for OrderCancelReplaceTimeInForceEnum {
533    type Err = Box<dyn std::error::Error + Send + Sync>;
534
535    fn from_str(s: &str) -> Result<Self, Self::Err> {
536        match s {
537            "GTC" => Ok(Self::Gtc),
538            "IOC" => Ok(Self::Ioc),
539            "FOK" => Ok(Self::Fok),
540            other => Err(format!("invalid OrderCancelReplaceTimeInForceEnum: {}", other).into()),
541        }
542    }
543}
544
545#[allow(non_camel_case_types)]
546#[derive(Debug, Clone, Serialize, Deserialize)]
547pub enum OrderCancelReplaceNewOrderRespTypeEnum {
548    #[serde(rename = "ACK")]
549    Ack,
550    #[serde(rename = "RESULT")]
551    Result,
552    #[serde(rename = "FULL")]
553    Full,
554}
555
556impl OrderCancelReplaceNewOrderRespTypeEnum {
557    #[must_use]
558    pub fn as_str(&self) -> &'static str {
559        match self {
560            Self::Ack => "ACK",
561            Self::Result => "RESULT",
562            Self::Full => "FULL",
563        }
564    }
565}
566
567impl std::str::FromStr for OrderCancelReplaceNewOrderRespTypeEnum {
568    type Err = Box<dyn std::error::Error + Send + Sync>;
569
570    fn from_str(s: &str) -> Result<Self, Self::Err> {
571        match s {
572            "ACK" => Ok(Self::Ack),
573            "RESULT" => Ok(Self::Result),
574            "FULL" => Ok(Self::Full),
575            other => {
576                Err(format!("invalid OrderCancelReplaceNewOrderRespTypeEnum: {}", other).into())
577            }
578        }
579    }
580}
581
582#[allow(non_camel_case_types)]
583#[derive(Debug, Clone, Serialize, Deserialize)]
584pub enum OrderCancelReplaceSelfTradePreventionModeEnum {
585    #[serde(rename = "NONE")]
586    None,
587    #[serde(rename = "EXPIRE_TAKER")]
588    ExpireTaker,
589    #[serde(rename = "EXPIRE_MAKER")]
590    ExpireMaker,
591    #[serde(rename = "EXPIRE_BOTH")]
592    ExpireBoth,
593    #[serde(rename = "DECREMENT")]
594    Decrement,
595    #[serde(rename = "TRANSFER")]
596    Transfer,
597}
598
599impl OrderCancelReplaceSelfTradePreventionModeEnum {
600    #[must_use]
601    pub fn as_str(&self) -> &'static str {
602        match self {
603            Self::None => "NONE",
604            Self::ExpireTaker => "EXPIRE_TAKER",
605            Self::ExpireMaker => "EXPIRE_MAKER",
606            Self::ExpireBoth => "EXPIRE_BOTH",
607            Self::Decrement => "DECREMENT",
608            Self::Transfer => "TRANSFER",
609        }
610    }
611}
612
613impl std::str::FromStr for OrderCancelReplaceSelfTradePreventionModeEnum {
614    type Err = Box<dyn std::error::Error + Send + Sync>;
615
616    fn from_str(s: &str) -> Result<Self, Self::Err> {
617        match s {
618            "NONE" => Ok(Self::None),
619            "EXPIRE_TAKER" => Ok(Self::ExpireTaker),
620            "EXPIRE_MAKER" => Ok(Self::ExpireMaker),
621            "EXPIRE_BOTH" => Ok(Self::ExpireBoth),
622            "DECREMENT" => Ok(Self::Decrement),
623            "TRANSFER" => Ok(Self::Transfer),
624            other => Err(format!(
625                "invalid OrderCancelReplaceSelfTradePreventionModeEnum: {}",
626                other
627            )
628            .into()),
629        }
630    }
631}
632
633#[allow(non_camel_case_types)]
634#[derive(Debug, Clone, Serialize, Deserialize)]
635pub enum OrderCancelReplaceCancelRestrictionsEnum {
636    #[serde(rename = "ONLY_NEW")]
637    OnlyNew,
638    #[serde(rename = "ONLY_PARTIALLY_FILLED")]
639    OnlyPartiallyFilled,
640}
641
642impl OrderCancelReplaceCancelRestrictionsEnum {
643    #[must_use]
644    pub fn as_str(&self) -> &'static str {
645        match self {
646            Self::OnlyNew => "ONLY_NEW",
647            Self::OnlyPartiallyFilled => "ONLY_PARTIALLY_FILLED",
648        }
649    }
650}
651
652impl std::str::FromStr for OrderCancelReplaceCancelRestrictionsEnum {
653    type Err = Box<dyn std::error::Error + Send + Sync>;
654
655    fn from_str(s: &str) -> Result<Self, Self::Err> {
656        match s {
657            "ONLY_NEW" => Ok(Self::OnlyNew),
658            "ONLY_PARTIALLY_FILLED" => Ok(Self::OnlyPartiallyFilled),
659            other => Err(format!(
660                "invalid OrderCancelReplaceCancelRestrictionsEnum: {}",
661                other
662            )
663            .into()),
664        }
665    }
666}
667
668#[allow(non_camel_case_types)]
669#[derive(Debug, Clone, Serialize, Deserialize)]
670pub enum OrderCancelReplaceOrderRateLimitExceededModeEnum {
671    #[serde(rename = "DO_NOTHING")]
672    DoNothing,
673    #[serde(rename = "CANCEL_ONLY")]
674    CancelOnly,
675}
676
677impl OrderCancelReplaceOrderRateLimitExceededModeEnum {
678    #[must_use]
679    pub fn as_str(&self) -> &'static str {
680        match self {
681            Self::DoNothing => "DO_NOTHING",
682            Self::CancelOnly => "CANCEL_ONLY",
683        }
684    }
685}
686
687impl std::str::FromStr for OrderCancelReplaceOrderRateLimitExceededModeEnum {
688    type Err = Box<dyn std::error::Error + Send + Sync>;
689
690    fn from_str(s: &str) -> Result<Self, Self::Err> {
691        match s {
692            "DO_NOTHING" => Ok(Self::DoNothing),
693            "CANCEL_ONLY" => Ok(Self::CancelOnly),
694            other => Err(format!(
695                "invalid OrderCancelReplaceOrderRateLimitExceededModeEnum: {}",
696                other
697            )
698            .into()),
699        }
700    }
701}
702
703#[allow(non_camel_case_types)]
704#[derive(Debug, Clone, Serialize, Deserialize)]
705pub enum OrderCancelReplacePegPriceTypeEnum {
706    #[serde(rename = "PRIMARY_PEG")]
707    PrimaryPeg,
708    #[serde(rename = "MARKET_PEG")]
709    MarketPeg,
710}
711
712impl OrderCancelReplacePegPriceTypeEnum {
713    #[must_use]
714    pub fn as_str(&self) -> &'static str {
715        match self {
716            Self::PrimaryPeg => "PRIMARY_PEG",
717            Self::MarketPeg => "MARKET_PEG",
718        }
719    }
720}
721
722impl std::str::FromStr for OrderCancelReplacePegPriceTypeEnum {
723    type Err = Box<dyn std::error::Error + Send + Sync>;
724
725    fn from_str(s: &str) -> Result<Self, Self::Err> {
726        match s {
727            "PRIMARY_PEG" => Ok(Self::PrimaryPeg),
728            "MARKET_PEG" => Ok(Self::MarketPeg),
729            other => Err(format!("invalid OrderCancelReplacePegPriceTypeEnum: {}", other).into()),
730        }
731    }
732}
733
734#[allow(non_camel_case_types)]
735#[derive(Debug, Clone, Serialize, Deserialize)]
736pub enum OrderCancelReplacePegOffsetTypeEnum {
737    #[serde(rename = "PRICE_LEVEL")]
738    PriceLevel,
739}
740
741impl OrderCancelReplacePegOffsetTypeEnum {
742    #[must_use]
743    pub fn as_str(&self) -> &'static str {
744        match self {
745            Self::PriceLevel => "PRICE_LEVEL",
746        }
747    }
748}
749
750impl std::str::FromStr for OrderCancelReplacePegOffsetTypeEnum {
751    type Err = Box<dyn std::error::Error + Send + Sync>;
752
753    fn from_str(s: &str) -> Result<Self, Self::Err> {
754        match s {
755            "PRICE_LEVEL" => Ok(Self::PriceLevel),
756            other => Err(format!("invalid OrderCancelReplacePegOffsetTypeEnum: {}", other).into()),
757        }
758    }
759}
760
761#[allow(non_camel_case_types)]
762#[derive(Debug, Clone, Serialize, Deserialize)]
763pub enum OrderListOcoSideEnum {
764    #[serde(rename = "BUY")]
765    Buy,
766    #[serde(rename = "SELL")]
767    Sell,
768}
769
770impl OrderListOcoSideEnum {
771    #[must_use]
772    pub fn as_str(&self) -> &'static str {
773        match self {
774            Self::Buy => "BUY",
775            Self::Sell => "SELL",
776        }
777    }
778}
779
780impl std::str::FromStr for OrderListOcoSideEnum {
781    type Err = Box<dyn std::error::Error + Send + Sync>;
782
783    fn from_str(s: &str) -> Result<Self, Self::Err> {
784        match s {
785            "BUY" => Ok(Self::Buy),
786            "SELL" => Ok(Self::Sell),
787            other => Err(format!("invalid OrderListOcoSideEnum: {}", other).into()),
788        }
789    }
790}
791
792#[allow(non_camel_case_types)]
793#[derive(Debug, Clone, Serialize, Deserialize)]
794pub enum OrderListOcoAboveTypeEnum {
795    #[serde(rename = "STOP_LOSS_LIMIT")]
796    StopLossLimit,
797    #[serde(rename = "STOP_LOSS")]
798    StopLoss,
799    #[serde(rename = "LIMIT_MAKER")]
800    LimitMaker,
801    #[serde(rename = "TAKE_PROFIT")]
802    TakeProfit,
803    #[serde(rename = "TAKE_PROFIT_LIMIT")]
804    TakeProfitLimit,
805}
806
807impl OrderListOcoAboveTypeEnum {
808    #[must_use]
809    pub fn as_str(&self) -> &'static str {
810        match self {
811            Self::StopLossLimit => "STOP_LOSS_LIMIT",
812            Self::StopLoss => "STOP_LOSS",
813            Self::LimitMaker => "LIMIT_MAKER",
814            Self::TakeProfit => "TAKE_PROFIT",
815            Self::TakeProfitLimit => "TAKE_PROFIT_LIMIT",
816        }
817    }
818}
819
820impl std::str::FromStr for OrderListOcoAboveTypeEnum {
821    type Err = Box<dyn std::error::Error + Send + Sync>;
822
823    fn from_str(s: &str) -> Result<Self, Self::Err> {
824        match s {
825            "STOP_LOSS_LIMIT" => Ok(Self::StopLossLimit),
826            "STOP_LOSS" => Ok(Self::StopLoss),
827            "LIMIT_MAKER" => Ok(Self::LimitMaker),
828            "TAKE_PROFIT" => Ok(Self::TakeProfit),
829            "TAKE_PROFIT_LIMIT" => Ok(Self::TakeProfitLimit),
830            other => Err(format!("invalid OrderListOcoAboveTypeEnum: {}", other).into()),
831        }
832    }
833}
834
835#[allow(non_camel_case_types)]
836#[derive(Debug, Clone, Serialize, Deserialize)]
837pub enum OrderListOcoBelowTypeEnum {
838    #[serde(rename = "STOP_LOSS")]
839    StopLoss,
840    #[serde(rename = "STOP_LOSS_LIMIT")]
841    StopLossLimit,
842    #[serde(rename = "TAKE_PROFIT")]
843    TakeProfit,
844    #[serde(rename = "TAKE_PROFIT_LIMIT")]
845    TakeProfitLimit,
846}
847
848impl OrderListOcoBelowTypeEnum {
849    #[must_use]
850    pub fn as_str(&self) -> &'static str {
851        match self {
852            Self::StopLoss => "STOP_LOSS",
853            Self::StopLossLimit => "STOP_LOSS_LIMIT",
854            Self::TakeProfit => "TAKE_PROFIT",
855            Self::TakeProfitLimit => "TAKE_PROFIT_LIMIT",
856        }
857    }
858}
859
860impl std::str::FromStr for OrderListOcoBelowTypeEnum {
861    type Err = Box<dyn std::error::Error + Send + Sync>;
862
863    fn from_str(s: &str) -> Result<Self, Self::Err> {
864        match s {
865            "STOP_LOSS" => Ok(Self::StopLoss),
866            "STOP_LOSS_LIMIT" => Ok(Self::StopLossLimit),
867            "TAKE_PROFIT" => Ok(Self::TakeProfit),
868            "TAKE_PROFIT_LIMIT" => Ok(Self::TakeProfitLimit),
869            other => Err(format!("invalid OrderListOcoBelowTypeEnum: {}", other).into()),
870        }
871    }
872}
873
874#[allow(non_camel_case_types)]
875#[derive(Debug, Clone, Serialize, Deserialize)]
876pub enum OrderListOcoAboveTimeInForceEnum {
877    #[serde(rename = "GTC")]
878    Gtc,
879    #[serde(rename = "IOC")]
880    Ioc,
881    #[serde(rename = "FOK")]
882    Fok,
883}
884
885impl OrderListOcoAboveTimeInForceEnum {
886    #[must_use]
887    pub fn as_str(&self) -> &'static str {
888        match self {
889            Self::Gtc => "GTC",
890            Self::Ioc => "IOC",
891            Self::Fok => "FOK",
892        }
893    }
894}
895
896impl std::str::FromStr for OrderListOcoAboveTimeInForceEnum {
897    type Err = Box<dyn std::error::Error + Send + Sync>;
898
899    fn from_str(s: &str) -> Result<Self, Self::Err> {
900        match s {
901            "GTC" => Ok(Self::Gtc),
902            "IOC" => Ok(Self::Ioc),
903            "FOK" => Ok(Self::Fok),
904            other => Err(format!("invalid OrderListOcoAboveTimeInForceEnum: {}", other).into()),
905        }
906    }
907}
908
909#[allow(non_camel_case_types)]
910#[derive(Debug, Clone, Serialize, Deserialize)]
911pub enum OrderListOcoAbovePegPriceTypeEnum {
912    #[serde(rename = "PRIMARY_PEG")]
913    PrimaryPeg,
914    #[serde(rename = "MARKET_PEG")]
915    MarketPeg,
916}
917
918impl OrderListOcoAbovePegPriceTypeEnum {
919    #[must_use]
920    pub fn as_str(&self) -> &'static str {
921        match self {
922            Self::PrimaryPeg => "PRIMARY_PEG",
923            Self::MarketPeg => "MARKET_PEG",
924        }
925    }
926}
927
928impl std::str::FromStr for OrderListOcoAbovePegPriceTypeEnum {
929    type Err = Box<dyn std::error::Error + Send + Sync>;
930
931    fn from_str(s: &str) -> Result<Self, Self::Err> {
932        match s {
933            "PRIMARY_PEG" => Ok(Self::PrimaryPeg),
934            "MARKET_PEG" => Ok(Self::MarketPeg),
935            other => Err(format!("invalid OrderListOcoAbovePegPriceTypeEnum: {}", other).into()),
936        }
937    }
938}
939
940#[allow(non_camel_case_types)]
941#[derive(Debug, Clone, Serialize, Deserialize)]
942pub enum OrderListOcoAbovePegOffsetTypeEnum {
943    #[serde(rename = "PRICE_LEVEL")]
944    PriceLevel,
945}
946
947impl OrderListOcoAbovePegOffsetTypeEnum {
948    #[must_use]
949    pub fn as_str(&self) -> &'static str {
950        match self {
951            Self::PriceLevel => "PRICE_LEVEL",
952        }
953    }
954}
955
956impl std::str::FromStr for OrderListOcoAbovePegOffsetTypeEnum {
957    type Err = Box<dyn std::error::Error + Send + Sync>;
958
959    fn from_str(s: &str) -> Result<Self, Self::Err> {
960        match s {
961            "PRICE_LEVEL" => Ok(Self::PriceLevel),
962            other => Err(format!("invalid OrderListOcoAbovePegOffsetTypeEnum: {}", other).into()),
963        }
964    }
965}
966
967#[allow(non_camel_case_types)]
968#[derive(Debug, Clone, Serialize, Deserialize)]
969pub enum OrderListOcoBelowTimeInForceEnum {
970    #[serde(rename = "GTC")]
971    Gtc,
972    #[serde(rename = "IOC")]
973    Ioc,
974    #[serde(rename = "FOK")]
975    Fok,
976}
977
978impl OrderListOcoBelowTimeInForceEnum {
979    #[must_use]
980    pub fn as_str(&self) -> &'static str {
981        match self {
982            Self::Gtc => "GTC",
983            Self::Ioc => "IOC",
984            Self::Fok => "FOK",
985        }
986    }
987}
988
989impl std::str::FromStr for OrderListOcoBelowTimeInForceEnum {
990    type Err = Box<dyn std::error::Error + Send + Sync>;
991
992    fn from_str(s: &str) -> Result<Self, Self::Err> {
993        match s {
994            "GTC" => Ok(Self::Gtc),
995            "IOC" => Ok(Self::Ioc),
996            "FOK" => Ok(Self::Fok),
997            other => Err(format!("invalid OrderListOcoBelowTimeInForceEnum: {}", other).into()),
998        }
999    }
1000}
1001
1002#[allow(non_camel_case_types)]
1003#[derive(Debug, Clone, Serialize, Deserialize)]
1004pub enum OrderListOcoBelowPegPriceTypeEnum {
1005    #[serde(rename = "PRIMARY_PEG")]
1006    PrimaryPeg,
1007    #[serde(rename = "MARKET_PEG")]
1008    MarketPeg,
1009}
1010
1011impl OrderListOcoBelowPegPriceTypeEnum {
1012    #[must_use]
1013    pub fn as_str(&self) -> &'static str {
1014        match self {
1015            Self::PrimaryPeg => "PRIMARY_PEG",
1016            Self::MarketPeg => "MARKET_PEG",
1017        }
1018    }
1019}
1020
1021impl std::str::FromStr for OrderListOcoBelowPegPriceTypeEnum {
1022    type Err = Box<dyn std::error::Error + Send + Sync>;
1023
1024    fn from_str(s: &str) -> Result<Self, Self::Err> {
1025        match s {
1026            "PRIMARY_PEG" => Ok(Self::PrimaryPeg),
1027            "MARKET_PEG" => Ok(Self::MarketPeg),
1028            other => Err(format!("invalid OrderListOcoBelowPegPriceTypeEnum: {}", other).into()),
1029        }
1030    }
1031}
1032
1033#[allow(non_camel_case_types)]
1034#[derive(Debug, Clone, Serialize, Deserialize)]
1035pub enum OrderListOcoBelowPegOffsetTypeEnum {
1036    #[serde(rename = "PRICE_LEVEL")]
1037    PriceLevel,
1038}
1039
1040impl OrderListOcoBelowPegOffsetTypeEnum {
1041    #[must_use]
1042    pub fn as_str(&self) -> &'static str {
1043        match self {
1044            Self::PriceLevel => "PRICE_LEVEL",
1045        }
1046    }
1047}
1048
1049impl std::str::FromStr for OrderListOcoBelowPegOffsetTypeEnum {
1050    type Err = Box<dyn std::error::Error + Send + Sync>;
1051
1052    fn from_str(s: &str) -> Result<Self, Self::Err> {
1053        match s {
1054            "PRICE_LEVEL" => Ok(Self::PriceLevel),
1055            other => Err(format!("invalid OrderListOcoBelowPegOffsetTypeEnum: {}", other).into()),
1056        }
1057    }
1058}
1059
1060#[allow(non_camel_case_types)]
1061#[derive(Debug, Clone, Serialize, Deserialize)]
1062pub enum OrderListOcoNewOrderRespTypeEnum {
1063    #[serde(rename = "ACK")]
1064    Ack,
1065    #[serde(rename = "RESULT")]
1066    Result,
1067    #[serde(rename = "FULL")]
1068    Full,
1069}
1070
1071impl OrderListOcoNewOrderRespTypeEnum {
1072    #[must_use]
1073    pub fn as_str(&self) -> &'static str {
1074        match self {
1075            Self::Ack => "ACK",
1076            Self::Result => "RESULT",
1077            Self::Full => "FULL",
1078        }
1079    }
1080}
1081
1082impl std::str::FromStr for OrderListOcoNewOrderRespTypeEnum {
1083    type Err = Box<dyn std::error::Error + Send + Sync>;
1084
1085    fn from_str(s: &str) -> Result<Self, Self::Err> {
1086        match s {
1087            "ACK" => Ok(Self::Ack),
1088            "RESULT" => Ok(Self::Result),
1089            "FULL" => Ok(Self::Full),
1090            other => Err(format!("invalid OrderListOcoNewOrderRespTypeEnum: {}", other).into()),
1091        }
1092    }
1093}
1094
1095#[allow(non_camel_case_types)]
1096#[derive(Debug, Clone, Serialize, Deserialize)]
1097pub enum OrderListOcoSelfTradePreventionModeEnum {
1098    #[serde(rename = "NONE")]
1099    None,
1100    #[serde(rename = "EXPIRE_TAKER")]
1101    ExpireTaker,
1102    #[serde(rename = "EXPIRE_MAKER")]
1103    ExpireMaker,
1104    #[serde(rename = "EXPIRE_BOTH")]
1105    ExpireBoth,
1106    #[serde(rename = "DECREMENT")]
1107    Decrement,
1108    #[serde(rename = "TRANSFER")]
1109    Transfer,
1110}
1111
1112impl OrderListOcoSelfTradePreventionModeEnum {
1113    #[must_use]
1114    pub fn as_str(&self) -> &'static str {
1115        match self {
1116            Self::None => "NONE",
1117            Self::ExpireTaker => "EXPIRE_TAKER",
1118            Self::ExpireMaker => "EXPIRE_MAKER",
1119            Self::ExpireBoth => "EXPIRE_BOTH",
1120            Self::Decrement => "DECREMENT",
1121            Self::Transfer => "TRANSFER",
1122        }
1123    }
1124}
1125
1126impl std::str::FromStr for OrderListOcoSelfTradePreventionModeEnum {
1127    type Err = Box<dyn std::error::Error + Send + Sync>;
1128
1129    fn from_str(s: &str) -> Result<Self, Self::Err> {
1130        match s {
1131            "NONE" => Ok(Self::None),
1132            "EXPIRE_TAKER" => Ok(Self::ExpireTaker),
1133            "EXPIRE_MAKER" => Ok(Self::ExpireMaker),
1134            "EXPIRE_BOTH" => Ok(Self::ExpireBoth),
1135            "DECREMENT" => Ok(Self::Decrement),
1136            "TRANSFER" => Ok(Self::Transfer),
1137            other => {
1138                Err(format!("invalid OrderListOcoSelfTradePreventionModeEnum: {}", other).into())
1139            }
1140        }
1141    }
1142}
1143
1144#[allow(non_camel_case_types)]
1145#[derive(Debug, Clone, Serialize, Deserialize)]
1146pub enum OrderListOpoWorkingTypeEnum {
1147    #[serde(rename = "LIMIT")]
1148    Limit,
1149    #[serde(rename = "LIMIT_MAKER")]
1150    LimitMaker,
1151}
1152
1153impl OrderListOpoWorkingTypeEnum {
1154    #[must_use]
1155    pub fn as_str(&self) -> &'static str {
1156        match self {
1157            Self::Limit => "LIMIT",
1158            Self::LimitMaker => "LIMIT_MAKER",
1159        }
1160    }
1161}
1162
1163impl std::str::FromStr for OrderListOpoWorkingTypeEnum {
1164    type Err = Box<dyn std::error::Error + Send + Sync>;
1165
1166    fn from_str(s: &str) -> Result<Self, Self::Err> {
1167        match s {
1168            "LIMIT" => Ok(Self::Limit),
1169            "LIMIT_MAKER" => Ok(Self::LimitMaker),
1170            other => Err(format!("invalid OrderListOpoWorkingTypeEnum: {}", other).into()),
1171        }
1172    }
1173}
1174
1175#[allow(non_camel_case_types)]
1176#[derive(Debug, Clone, Serialize, Deserialize)]
1177pub enum OrderListOpoWorkingSideEnum {
1178    #[serde(rename = "BUY")]
1179    Buy,
1180    #[serde(rename = "SELL")]
1181    Sell,
1182}
1183
1184impl OrderListOpoWorkingSideEnum {
1185    #[must_use]
1186    pub fn as_str(&self) -> &'static str {
1187        match self {
1188            Self::Buy => "BUY",
1189            Self::Sell => "SELL",
1190        }
1191    }
1192}
1193
1194impl std::str::FromStr for OrderListOpoWorkingSideEnum {
1195    type Err = Box<dyn std::error::Error + Send + Sync>;
1196
1197    fn from_str(s: &str) -> Result<Self, Self::Err> {
1198        match s {
1199            "BUY" => Ok(Self::Buy),
1200            "SELL" => Ok(Self::Sell),
1201            other => Err(format!("invalid OrderListOpoWorkingSideEnum: {}", other).into()),
1202        }
1203    }
1204}
1205
1206#[allow(non_camel_case_types)]
1207#[derive(Debug, Clone, Serialize, Deserialize)]
1208pub enum OrderListOpoPendingTypeEnum {
1209    #[serde(rename = "LIMIT")]
1210    Limit,
1211    #[serde(rename = "MARKET")]
1212    Market,
1213    #[serde(rename = "STOP_LOSS")]
1214    StopLoss,
1215    #[serde(rename = "STOP_LOSS_LIMIT")]
1216    StopLossLimit,
1217    #[serde(rename = "TAKE_PROFIT")]
1218    TakeProfit,
1219    #[serde(rename = "TAKE_PROFIT_LIMIT")]
1220    TakeProfitLimit,
1221    #[serde(rename = "LIMIT_MAKER")]
1222    LimitMaker,
1223}
1224
1225impl OrderListOpoPendingTypeEnum {
1226    #[must_use]
1227    pub fn as_str(&self) -> &'static str {
1228        match self {
1229            Self::Limit => "LIMIT",
1230            Self::Market => "MARKET",
1231            Self::StopLoss => "STOP_LOSS",
1232            Self::StopLossLimit => "STOP_LOSS_LIMIT",
1233            Self::TakeProfit => "TAKE_PROFIT",
1234            Self::TakeProfitLimit => "TAKE_PROFIT_LIMIT",
1235            Self::LimitMaker => "LIMIT_MAKER",
1236        }
1237    }
1238}
1239
1240impl std::str::FromStr for OrderListOpoPendingTypeEnum {
1241    type Err = Box<dyn std::error::Error + Send + Sync>;
1242
1243    fn from_str(s: &str) -> Result<Self, Self::Err> {
1244        match s {
1245            "LIMIT" => Ok(Self::Limit),
1246            "MARKET" => Ok(Self::Market),
1247            "STOP_LOSS" => Ok(Self::StopLoss),
1248            "STOP_LOSS_LIMIT" => Ok(Self::StopLossLimit),
1249            "TAKE_PROFIT" => Ok(Self::TakeProfit),
1250            "TAKE_PROFIT_LIMIT" => Ok(Self::TakeProfitLimit),
1251            "LIMIT_MAKER" => Ok(Self::LimitMaker),
1252            other => Err(format!("invalid OrderListOpoPendingTypeEnum: {}", other).into()),
1253        }
1254    }
1255}
1256
1257#[allow(non_camel_case_types)]
1258#[derive(Debug, Clone, Serialize, Deserialize)]
1259pub enum OrderListOpoPendingSideEnum {
1260    #[serde(rename = "BUY")]
1261    Buy,
1262    #[serde(rename = "SELL")]
1263    Sell,
1264}
1265
1266impl OrderListOpoPendingSideEnum {
1267    #[must_use]
1268    pub fn as_str(&self) -> &'static str {
1269        match self {
1270            Self::Buy => "BUY",
1271            Self::Sell => "SELL",
1272        }
1273    }
1274}
1275
1276impl std::str::FromStr for OrderListOpoPendingSideEnum {
1277    type Err = Box<dyn std::error::Error + Send + Sync>;
1278
1279    fn from_str(s: &str) -> Result<Self, Self::Err> {
1280        match s {
1281            "BUY" => Ok(Self::Buy),
1282            "SELL" => Ok(Self::Sell),
1283            other => Err(format!("invalid OrderListOpoPendingSideEnum: {}", other).into()),
1284        }
1285    }
1286}
1287
1288#[allow(non_camel_case_types)]
1289#[derive(Debug, Clone, Serialize, Deserialize)]
1290pub enum OrderListOpoNewOrderRespTypeEnum {
1291    #[serde(rename = "ACK")]
1292    Ack,
1293    #[serde(rename = "RESULT")]
1294    Result,
1295    #[serde(rename = "FULL")]
1296    Full,
1297}
1298
1299impl OrderListOpoNewOrderRespTypeEnum {
1300    #[must_use]
1301    pub fn as_str(&self) -> &'static str {
1302        match self {
1303            Self::Ack => "ACK",
1304            Self::Result => "RESULT",
1305            Self::Full => "FULL",
1306        }
1307    }
1308}
1309
1310impl std::str::FromStr for OrderListOpoNewOrderRespTypeEnum {
1311    type Err = Box<dyn std::error::Error + Send + Sync>;
1312
1313    fn from_str(s: &str) -> Result<Self, Self::Err> {
1314        match s {
1315            "ACK" => Ok(Self::Ack),
1316            "RESULT" => Ok(Self::Result),
1317            "FULL" => Ok(Self::Full),
1318            other => Err(format!("invalid OrderListOpoNewOrderRespTypeEnum: {}", other).into()),
1319        }
1320    }
1321}
1322
1323#[allow(non_camel_case_types)]
1324#[derive(Debug, Clone, Serialize, Deserialize)]
1325pub enum OrderListOpoSelfTradePreventionModeEnum {
1326    #[serde(rename = "NONE")]
1327    None,
1328    #[serde(rename = "EXPIRE_TAKER")]
1329    ExpireTaker,
1330    #[serde(rename = "EXPIRE_MAKER")]
1331    ExpireMaker,
1332    #[serde(rename = "EXPIRE_BOTH")]
1333    ExpireBoth,
1334    #[serde(rename = "DECREMENT")]
1335    Decrement,
1336    #[serde(rename = "TRANSFER")]
1337    Transfer,
1338}
1339
1340impl OrderListOpoSelfTradePreventionModeEnum {
1341    #[must_use]
1342    pub fn as_str(&self) -> &'static str {
1343        match self {
1344            Self::None => "NONE",
1345            Self::ExpireTaker => "EXPIRE_TAKER",
1346            Self::ExpireMaker => "EXPIRE_MAKER",
1347            Self::ExpireBoth => "EXPIRE_BOTH",
1348            Self::Decrement => "DECREMENT",
1349            Self::Transfer => "TRANSFER",
1350        }
1351    }
1352}
1353
1354impl std::str::FromStr for OrderListOpoSelfTradePreventionModeEnum {
1355    type Err = Box<dyn std::error::Error + Send + Sync>;
1356
1357    fn from_str(s: &str) -> Result<Self, Self::Err> {
1358        match s {
1359            "NONE" => Ok(Self::None),
1360            "EXPIRE_TAKER" => Ok(Self::ExpireTaker),
1361            "EXPIRE_MAKER" => Ok(Self::ExpireMaker),
1362            "EXPIRE_BOTH" => Ok(Self::ExpireBoth),
1363            "DECREMENT" => Ok(Self::Decrement),
1364            "TRANSFER" => Ok(Self::Transfer),
1365            other => {
1366                Err(format!("invalid OrderListOpoSelfTradePreventionModeEnum: {}", other).into())
1367            }
1368        }
1369    }
1370}
1371
1372#[allow(non_camel_case_types)]
1373#[derive(Debug, Clone, Serialize, Deserialize)]
1374pub enum OrderListOpoWorkingTimeInForceEnum {
1375    #[serde(rename = "GTC")]
1376    Gtc,
1377    #[serde(rename = "IOC")]
1378    Ioc,
1379    #[serde(rename = "FOK")]
1380    Fok,
1381}
1382
1383impl OrderListOpoWorkingTimeInForceEnum {
1384    #[must_use]
1385    pub fn as_str(&self) -> &'static str {
1386        match self {
1387            Self::Gtc => "GTC",
1388            Self::Ioc => "IOC",
1389            Self::Fok => "FOK",
1390        }
1391    }
1392}
1393
1394impl std::str::FromStr for OrderListOpoWorkingTimeInForceEnum {
1395    type Err = Box<dyn std::error::Error + Send + Sync>;
1396
1397    fn from_str(s: &str) -> Result<Self, Self::Err> {
1398        match s {
1399            "GTC" => Ok(Self::Gtc),
1400            "IOC" => Ok(Self::Ioc),
1401            "FOK" => Ok(Self::Fok),
1402            other => Err(format!("invalid OrderListOpoWorkingTimeInForceEnum: {}", other).into()),
1403        }
1404    }
1405}
1406
1407#[allow(non_camel_case_types)]
1408#[derive(Debug, Clone, Serialize, Deserialize)]
1409pub enum OrderListOpoWorkingPegPriceTypeEnum {
1410    #[serde(rename = "PRIMARY_PEG")]
1411    PrimaryPeg,
1412    #[serde(rename = "MARKET_PEG")]
1413    MarketPeg,
1414}
1415
1416impl OrderListOpoWorkingPegPriceTypeEnum {
1417    #[must_use]
1418    pub fn as_str(&self) -> &'static str {
1419        match self {
1420            Self::PrimaryPeg => "PRIMARY_PEG",
1421            Self::MarketPeg => "MARKET_PEG",
1422        }
1423    }
1424}
1425
1426impl std::str::FromStr for OrderListOpoWorkingPegPriceTypeEnum {
1427    type Err = Box<dyn std::error::Error + Send + Sync>;
1428
1429    fn from_str(s: &str) -> Result<Self, Self::Err> {
1430        match s {
1431            "PRIMARY_PEG" => Ok(Self::PrimaryPeg),
1432            "MARKET_PEG" => Ok(Self::MarketPeg),
1433            other => Err(format!("invalid OrderListOpoWorkingPegPriceTypeEnum: {}", other).into()),
1434        }
1435    }
1436}
1437
1438#[allow(non_camel_case_types)]
1439#[derive(Debug, Clone, Serialize, Deserialize)]
1440pub enum OrderListOpoWorkingPegOffsetTypeEnum {
1441    #[serde(rename = "PRICE_LEVEL")]
1442    PriceLevel,
1443}
1444
1445impl OrderListOpoWorkingPegOffsetTypeEnum {
1446    #[must_use]
1447    pub fn as_str(&self) -> &'static str {
1448        match self {
1449            Self::PriceLevel => "PRICE_LEVEL",
1450        }
1451    }
1452}
1453
1454impl std::str::FromStr for OrderListOpoWorkingPegOffsetTypeEnum {
1455    type Err = Box<dyn std::error::Error + Send + Sync>;
1456
1457    fn from_str(s: &str) -> Result<Self, Self::Err> {
1458        match s {
1459            "PRICE_LEVEL" => Ok(Self::PriceLevel),
1460            other => Err(format!("invalid OrderListOpoWorkingPegOffsetTypeEnum: {}", other).into()),
1461        }
1462    }
1463}
1464
1465#[allow(non_camel_case_types)]
1466#[derive(Debug, Clone, Serialize, Deserialize)]
1467pub enum OrderListOpoPendingTimeInForceEnum {
1468    #[serde(rename = "GTC")]
1469    Gtc,
1470    #[serde(rename = "IOC")]
1471    Ioc,
1472    #[serde(rename = "FOK")]
1473    Fok,
1474}
1475
1476impl OrderListOpoPendingTimeInForceEnum {
1477    #[must_use]
1478    pub fn as_str(&self) -> &'static str {
1479        match self {
1480            Self::Gtc => "GTC",
1481            Self::Ioc => "IOC",
1482            Self::Fok => "FOK",
1483        }
1484    }
1485}
1486
1487impl std::str::FromStr for OrderListOpoPendingTimeInForceEnum {
1488    type Err = Box<dyn std::error::Error + Send + Sync>;
1489
1490    fn from_str(s: &str) -> Result<Self, Self::Err> {
1491        match s {
1492            "GTC" => Ok(Self::Gtc),
1493            "IOC" => Ok(Self::Ioc),
1494            "FOK" => Ok(Self::Fok),
1495            other => Err(format!("invalid OrderListOpoPendingTimeInForceEnum: {}", other).into()),
1496        }
1497    }
1498}
1499
1500#[allow(non_camel_case_types)]
1501#[derive(Debug, Clone, Serialize, Deserialize)]
1502pub enum OrderListOpoPendingPegPriceTypeEnum {
1503    #[serde(rename = "PRIMARY_PEG")]
1504    PrimaryPeg,
1505    #[serde(rename = "MARKET_PEG")]
1506    MarketPeg,
1507}
1508
1509impl OrderListOpoPendingPegPriceTypeEnum {
1510    #[must_use]
1511    pub fn as_str(&self) -> &'static str {
1512        match self {
1513            Self::PrimaryPeg => "PRIMARY_PEG",
1514            Self::MarketPeg => "MARKET_PEG",
1515        }
1516    }
1517}
1518
1519impl std::str::FromStr for OrderListOpoPendingPegPriceTypeEnum {
1520    type Err = Box<dyn std::error::Error + Send + Sync>;
1521
1522    fn from_str(s: &str) -> Result<Self, Self::Err> {
1523        match s {
1524            "PRIMARY_PEG" => Ok(Self::PrimaryPeg),
1525            "MARKET_PEG" => Ok(Self::MarketPeg),
1526            other => Err(format!("invalid OrderListOpoPendingPegPriceTypeEnum: {}", other).into()),
1527        }
1528    }
1529}
1530
1531#[allow(non_camel_case_types)]
1532#[derive(Debug, Clone, Serialize, Deserialize)]
1533pub enum OrderListOpoPendingPegOffsetTypeEnum {
1534    #[serde(rename = "PRICE_LEVEL")]
1535    PriceLevel,
1536}
1537
1538impl OrderListOpoPendingPegOffsetTypeEnum {
1539    #[must_use]
1540    pub fn as_str(&self) -> &'static str {
1541        match self {
1542            Self::PriceLevel => "PRICE_LEVEL",
1543        }
1544    }
1545}
1546
1547impl std::str::FromStr for OrderListOpoPendingPegOffsetTypeEnum {
1548    type Err = Box<dyn std::error::Error + Send + Sync>;
1549
1550    fn from_str(s: &str) -> Result<Self, Self::Err> {
1551        match s {
1552            "PRICE_LEVEL" => Ok(Self::PriceLevel),
1553            other => Err(format!("invalid OrderListOpoPendingPegOffsetTypeEnum: {}", other).into()),
1554        }
1555    }
1556}
1557
1558#[allow(non_camel_case_types)]
1559#[derive(Debug, Clone, Serialize, Deserialize)]
1560pub enum OrderListOpocoWorkingTypeEnum {
1561    #[serde(rename = "LIMIT")]
1562    Limit,
1563    #[serde(rename = "LIMIT_MAKER")]
1564    LimitMaker,
1565}
1566
1567impl OrderListOpocoWorkingTypeEnum {
1568    #[must_use]
1569    pub fn as_str(&self) -> &'static str {
1570        match self {
1571            Self::Limit => "LIMIT",
1572            Self::LimitMaker => "LIMIT_MAKER",
1573        }
1574    }
1575}
1576
1577impl std::str::FromStr for OrderListOpocoWorkingTypeEnum {
1578    type Err = Box<dyn std::error::Error + Send + Sync>;
1579
1580    fn from_str(s: &str) -> Result<Self, Self::Err> {
1581        match s {
1582            "LIMIT" => Ok(Self::Limit),
1583            "LIMIT_MAKER" => Ok(Self::LimitMaker),
1584            other => Err(format!("invalid OrderListOpocoWorkingTypeEnum: {}", other).into()),
1585        }
1586    }
1587}
1588
1589#[allow(non_camel_case_types)]
1590#[derive(Debug, Clone, Serialize, Deserialize)]
1591pub enum OrderListOpocoWorkingSideEnum {
1592    #[serde(rename = "BUY")]
1593    Buy,
1594    #[serde(rename = "SELL")]
1595    Sell,
1596}
1597
1598impl OrderListOpocoWorkingSideEnum {
1599    #[must_use]
1600    pub fn as_str(&self) -> &'static str {
1601        match self {
1602            Self::Buy => "BUY",
1603            Self::Sell => "SELL",
1604        }
1605    }
1606}
1607
1608impl std::str::FromStr for OrderListOpocoWorkingSideEnum {
1609    type Err = Box<dyn std::error::Error + Send + Sync>;
1610
1611    fn from_str(s: &str) -> Result<Self, Self::Err> {
1612        match s {
1613            "BUY" => Ok(Self::Buy),
1614            "SELL" => Ok(Self::Sell),
1615            other => Err(format!("invalid OrderListOpocoWorkingSideEnum: {}", other).into()),
1616        }
1617    }
1618}
1619
1620#[allow(non_camel_case_types)]
1621#[derive(Debug, Clone, Serialize, Deserialize)]
1622pub enum OrderListOpocoPendingSideEnum {
1623    #[serde(rename = "BUY")]
1624    Buy,
1625    #[serde(rename = "SELL")]
1626    Sell,
1627}
1628
1629impl OrderListOpocoPendingSideEnum {
1630    #[must_use]
1631    pub fn as_str(&self) -> &'static str {
1632        match self {
1633            Self::Buy => "BUY",
1634            Self::Sell => "SELL",
1635        }
1636    }
1637}
1638
1639impl std::str::FromStr for OrderListOpocoPendingSideEnum {
1640    type Err = Box<dyn std::error::Error + Send + Sync>;
1641
1642    fn from_str(s: &str) -> Result<Self, Self::Err> {
1643        match s {
1644            "BUY" => Ok(Self::Buy),
1645            "SELL" => Ok(Self::Sell),
1646            other => Err(format!("invalid OrderListOpocoPendingSideEnum: {}", other).into()),
1647        }
1648    }
1649}
1650
1651#[allow(non_camel_case_types)]
1652#[derive(Debug, Clone, Serialize, Deserialize)]
1653pub enum OrderListOpocoPendingAboveTypeEnum {
1654    #[serde(rename = "STOP_LOSS_LIMIT")]
1655    StopLossLimit,
1656    #[serde(rename = "STOP_LOSS")]
1657    StopLoss,
1658    #[serde(rename = "LIMIT_MAKER")]
1659    LimitMaker,
1660    #[serde(rename = "TAKE_PROFIT")]
1661    TakeProfit,
1662    #[serde(rename = "TAKE_PROFIT_LIMIT")]
1663    TakeProfitLimit,
1664}
1665
1666impl OrderListOpocoPendingAboveTypeEnum {
1667    #[must_use]
1668    pub fn as_str(&self) -> &'static str {
1669        match self {
1670            Self::StopLossLimit => "STOP_LOSS_LIMIT",
1671            Self::StopLoss => "STOP_LOSS",
1672            Self::LimitMaker => "LIMIT_MAKER",
1673            Self::TakeProfit => "TAKE_PROFIT",
1674            Self::TakeProfitLimit => "TAKE_PROFIT_LIMIT",
1675        }
1676    }
1677}
1678
1679impl std::str::FromStr for OrderListOpocoPendingAboveTypeEnum {
1680    type Err = Box<dyn std::error::Error + Send + Sync>;
1681
1682    fn from_str(s: &str) -> Result<Self, Self::Err> {
1683        match s {
1684            "STOP_LOSS_LIMIT" => Ok(Self::StopLossLimit),
1685            "STOP_LOSS" => Ok(Self::StopLoss),
1686            "LIMIT_MAKER" => Ok(Self::LimitMaker),
1687            "TAKE_PROFIT" => Ok(Self::TakeProfit),
1688            "TAKE_PROFIT_LIMIT" => Ok(Self::TakeProfitLimit),
1689            other => Err(format!("invalid OrderListOpocoPendingAboveTypeEnum: {}", other).into()),
1690        }
1691    }
1692}
1693
1694#[allow(non_camel_case_types)]
1695#[derive(Debug, Clone, Serialize, Deserialize)]
1696pub enum OrderListOpocoNewOrderRespTypeEnum {
1697    #[serde(rename = "ACK")]
1698    Ack,
1699    #[serde(rename = "RESULT")]
1700    Result,
1701    #[serde(rename = "FULL")]
1702    Full,
1703}
1704
1705impl OrderListOpocoNewOrderRespTypeEnum {
1706    #[must_use]
1707    pub fn as_str(&self) -> &'static str {
1708        match self {
1709            Self::Ack => "ACK",
1710            Self::Result => "RESULT",
1711            Self::Full => "FULL",
1712        }
1713    }
1714}
1715
1716impl std::str::FromStr for OrderListOpocoNewOrderRespTypeEnum {
1717    type Err = Box<dyn std::error::Error + Send + Sync>;
1718
1719    fn from_str(s: &str) -> Result<Self, Self::Err> {
1720        match s {
1721            "ACK" => Ok(Self::Ack),
1722            "RESULT" => Ok(Self::Result),
1723            "FULL" => Ok(Self::Full),
1724            other => Err(format!("invalid OrderListOpocoNewOrderRespTypeEnum: {}", other).into()),
1725        }
1726    }
1727}
1728
1729#[allow(non_camel_case_types)]
1730#[derive(Debug, Clone, Serialize, Deserialize)]
1731pub enum OrderListOpocoSelfTradePreventionModeEnum {
1732    #[serde(rename = "NONE")]
1733    None,
1734    #[serde(rename = "EXPIRE_TAKER")]
1735    ExpireTaker,
1736    #[serde(rename = "EXPIRE_MAKER")]
1737    ExpireMaker,
1738    #[serde(rename = "EXPIRE_BOTH")]
1739    ExpireBoth,
1740    #[serde(rename = "DECREMENT")]
1741    Decrement,
1742    #[serde(rename = "TRANSFER")]
1743    Transfer,
1744}
1745
1746impl OrderListOpocoSelfTradePreventionModeEnum {
1747    #[must_use]
1748    pub fn as_str(&self) -> &'static str {
1749        match self {
1750            Self::None => "NONE",
1751            Self::ExpireTaker => "EXPIRE_TAKER",
1752            Self::ExpireMaker => "EXPIRE_MAKER",
1753            Self::ExpireBoth => "EXPIRE_BOTH",
1754            Self::Decrement => "DECREMENT",
1755            Self::Transfer => "TRANSFER",
1756        }
1757    }
1758}
1759
1760impl std::str::FromStr for OrderListOpocoSelfTradePreventionModeEnum {
1761    type Err = Box<dyn std::error::Error + Send + Sync>;
1762
1763    fn from_str(s: &str) -> Result<Self, Self::Err> {
1764        match s {
1765            "NONE" => Ok(Self::None),
1766            "EXPIRE_TAKER" => Ok(Self::ExpireTaker),
1767            "EXPIRE_MAKER" => Ok(Self::ExpireMaker),
1768            "EXPIRE_BOTH" => Ok(Self::ExpireBoth),
1769            "DECREMENT" => Ok(Self::Decrement),
1770            "TRANSFER" => Ok(Self::Transfer),
1771            other => Err(format!(
1772                "invalid OrderListOpocoSelfTradePreventionModeEnum: {}",
1773                other
1774            )
1775            .into()),
1776        }
1777    }
1778}
1779
1780#[allow(non_camel_case_types)]
1781#[derive(Debug, Clone, Serialize, Deserialize)]
1782pub enum OrderListOpocoWorkingTimeInForceEnum {
1783    #[serde(rename = "GTC")]
1784    Gtc,
1785    #[serde(rename = "IOC")]
1786    Ioc,
1787    #[serde(rename = "FOK")]
1788    Fok,
1789}
1790
1791impl OrderListOpocoWorkingTimeInForceEnum {
1792    #[must_use]
1793    pub fn as_str(&self) -> &'static str {
1794        match self {
1795            Self::Gtc => "GTC",
1796            Self::Ioc => "IOC",
1797            Self::Fok => "FOK",
1798        }
1799    }
1800}
1801
1802impl std::str::FromStr for OrderListOpocoWorkingTimeInForceEnum {
1803    type Err = Box<dyn std::error::Error + Send + Sync>;
1804
1805    fn from_str(s: &str) -> Result<Self, Self::Err> {
1806        match s {
1807            "GTC" => Ok(Self::Gtc),
1808            "IOC" => Ok(Self::Ioc),
1809            "FOK" => Ok(Self::Fok),
1810            other => Err(format!("invalid OrderListOpocoWorkingTimeInForceEnum: {}", other).into()),
1811        }
1812    }
1813}
1814
1815#[allow(non_camel_case_types)]
1816#[derive(Debug, Clone, Serialize, Deserialize)]
1817pub enum OrderListOpocoWorkingPegPriceTypeEnum {
1818    #[serde(rename = "PRIMARY_PEG")]
1819    PrimaryPeg,
1820    #[serde(rename = "MARKET_PEG")]
1821    MarketPeg,
1822}
1823
1824impl OrderListOpocoWorkingPegPriceTypeEnum {
1825    #[must_use]
1826    pub fn as_str(&self) -> &'static str {
1827        match self {
1828            Self::PrimaryPeg => "PRIMARY_PEG",
1829            Self::MarketPeg => "MARKET_PEG",
1830        }
1831    }
1832}
1833
1834impl std::str::FromStr for OrderListOpocoWorkingPegPriceTypeEnum {
1835    type Err = Box<dyn std::error::Error + Send + Sync>;
1836
1837    fn from_str(s: &str) -> Result<Self, Self::Err> {
1838        match s {
1839            "PRIMARY_PEG" => Ok(Self::PrimaryPeg),
1840            "MARKET_PEG" => Ok(Self::MarketPeg),
1841            other => {
1842                Err(format!("invalid OrderListOpocoWorkingPegPriceTypeEnum: {}", other).into())
1843            }
1844        }
1845    }
1846}
1847
1848#[allow(non_camel_case_types)]
1849#[derive(Debug, Clone, Serialize, Deserialize)]
1850pub enum OrderListOpocoWorkingPegOffsetTypeEnum {
1851    #[serde(rename = "PRICE_LEVEL")]
1852    PriceLevel,
1853}
1854
1855impl OrderListOpocoWorkingPegOffsetTypeEnum {
1856    #[must_use]
1857    pub fn as_str(&self) -> &'static str {
1858        match self {
1859            Self::PriceLevel => "PRICE_LEVEL",
1860        }
1861    }
1862}
1863
1864impl std::str::FromStr for OrderListOpocoWorkingPegOffsetTypeEnum {
1865    type Err = Box<dyn std::error::Error + Send + Sync>;
1866
1867    fn from_str(s: &str) -> Result<Self, Self::Err> {
1868        match s {
1869            "PRICE_LEVEL" => Ok(Self::PriceLevel),
1870            other => {
1871                Err(format!("invalid OrderListOpocoWorkingPegOffsetTypeEnum: {}", other).into())
1872            }
1873        }
1874    }
1875}
1876
1877#[allow(non_camel_case_types)]
1878#[derive(Debug, Clone, Serialize, Deserialize)]
1879pub enum OrderListOpocoPendingAboveTimeInForceEnum {
1880    #[serde(rename = "GTC")]
1881    Gtc,
1882    #[serde(rename = "IOC")]
1883    Ioc,
1884    #[serde(rename = "FOK")]
1885    Fok,
1886}
1887
1888impl OrderListOpocoPendingAboveTimeInForceEnum {
1889    #[must_use]
1890    pub fn as_str(&self) -> &'static str {
1891        match self {
1892            Self::Gtc => "GTC",
1893            Self::Ioc => "IOC",
1894            Self::Fok => "FOK",
1895        }
1896    }
1897}
1898
1899impl std::str::FromStr for OrderListOpocoPendingAboveTimeInForceEnum {
1900    type Err = Box<dyn std::error::Error + Send + Sync>;
1901
1902    fn from_str(s: &str) -> Result<Self, Self::Err> {
1903        match s {
1904            "GTC" => Ok(Self::Gtc),
1905            "IOC" => Ok(Self::Ioc),
1906            "FOK" => Ok(Self::Fok),
1907            other => Err(format!(
1908                "invalid OrderListOpocoPendingAboveTimeInForceEnum: {}",
1909                other
1910            )
1911            .into()),
1912        }
1913    }
1914}
1915
1916#[allow(non_camel_case_types)]
1917#[derive(Debug, Clone, Serialize, Deserialize)]
1918pub enum OrderListOpocoPendingAbovePegPriceTypeEnum {
1919    #[serde(rename = "PRIMARY_PEG")]
1920    PrimaryPeg,
1921    #[serde(rename = "MARKET_PEG")]
1922    MarketPeg,
1923}
1924
1925impl OrderListOpocoPendingAbovePegPriceTypeEnum {
1926    #[must_use]
1927    pub fn as_str(&self) -> &'static str {
1928        match self {
1929            Self::PrimaryPeg => "PRIMARY_PEG",
1930            Self::MarketPeg => "MARKET_PEG",
1931        }
1932    }
1933}
1934
1935impl std::str::FromStr for OrderListOpocoPendingAbovePegPriceTypeEnum {
1936    type Err = Box<dyn std::error::Error + Send + Sync>;
1937
1938    fn from_str(s: &str) -> Result<Self, Self::Err> {
1939        match s {
1940            "PRIMARY_PEG" => Ok(Self::PrimaryPeg),
1941            "MARKET_PEG" => Ok(Self::MarketPeg),
1942            other => Err(format!(
1943                "invalid OrderListOpocoPendingAbovePegPriceTypeEnum: {}",
1944                other
1945            )
1946            .into()),
1947        }
1948    }
1949}
1950
1951#[allow(non_camel_case_types)]
1952#[derive(Debug, Clone, Serialize, Deserialize)]
1953pub enum OrderListOpocoPendingAbovePegOffsetTypeEnum {
1954    #[serde(rename = "PRICE_LEVEL")]
1955    PriceLevel,
1956}
1957
1958impl OrderListOpocoPendingAbovePegOffsetTypeEnum {
1959    #[must_use]
1960    pub fn as_str(&self) -> &'static str {
1961        match self {
1962            Self::PriceLevel => "PRICE_LEVEL",
1963        }
1964    }
1965}
1966
1967impl std::str::FromStr for OrderListOpocoPendingAbovePegOffsetTypeEnum {
1968    type Err = Box<dyn std::error::Error + Send + Sync>;
1969
1970    fn from_str(s: &str) -> Result<Self, Self::Err> {
1971        match s {
1972            "PRICE_LEVEL" => Ok(Self::PriceLevel),
1973            other => Err(format!(
1974                "invalid OrderListOpocoPendingAbovePegOffsetTypeEnum: {}",
1975                other
1976            )
1977            .into()),
1978        }
1979    }
1980}
1981
1982#[allow(non_camel_case_types)]
1983#[derive(Debug, Clone, Serialize, Deserialize)]
1984pub enum OrderListOpocoPendingBelowTypeEnum {
1985    #[serde(rename = "STOP_LOSS")]
1986    StopLoss,
1987    #[serde(rename = "STOP_LOSS_LIMIT")]
1988    StopLossLimit,
1989    #[serde(rename = "TAKE_PROFIT")]
1990    TakeProfit,
1991    #[serde(rename = "TAKE_PROFIT_LIMIT")]
1992    TakeProfitLimit,
1993}
1994
1995impl OrderListOpocoPendingBelowTypeEnum {
1996    #[must_use]
1997    pub fn as_str(&self) -> &'static str {
1998        match self {
1999            Self::StopLoss => "STOP_LOSS",
2000            Self::StopLossLimit => "STOP_LOSS_LIMIT",
2001            Self::TakeProfit => "TAKE_PROFIT",
2002            Self::TakeProfitLimit => "TAKE_PROFIT_LIMIT",
2003        }
2004    }
2005}
2006
2007impl std::str::FromStr for OrderListOpocoPendingBelowTypeEnum {
2008    type Err = Box<dyn std::error::Error + Send + Sync>;
2009
2010    fn from_str(s: &str) -> Result<Self, Self::Err> {
2011        match s {
2012            "STOP_LOSS" => Ok(Self::StopLoss),
2013            "STOP_LOSS_LIMIT" => Ok(Self::StopLossLimit),
2014            "TAKE_PROFIT" => Ok(Self::TakeProfit),
2015            "TAKE_PROFIT_LIMIT" => Ok(Self::TakeProfitLimit),
2016            other => Err(format!("invalid OrderListOpocoPendingBelowTypeEnum: {}", other).into()),
2017        }
2018    }
2019}
2020
2021#[allow(non_camel_case_types)]
2022#[derive(Debug, Clone, Serialize, Deserialize)]
2023pub enum OrderListOpocoPendingBelowTimeInForceEnum {
2024    #[serde(rename = "GTC")]
2025    Gtc,
2026    #[serde(rename = "IOC")]
2027    Ioc,
2028    #[serde(rename = "FOK")]
2029    Fok,
2030}
2031
2032impl OrderListOpocoPendingBelowTimeInForceEnum {
2033    #[must_use]
2034    pub fn as_str(&self) -> &'static str {
2035        match self {
2036            Self::Gtc => "GTC",
2037            Self::Ioc => "IOC",
2038            Self::Fok => "FOK",
2039        }
2040    }
2041}
2042
2043impl std::str::FromStr for OrderListOpocoPendingBelowTimeInForceEnum {
2044    type Err = Box<dyn std::error::Error + Send + Sync>;
2045
2046    fn from_str(s: &str) -> Result<Self, Self::Err> {
2047        match s {
2048            "GTC" => Ok(Self::Gtc),
2049            "IOC" => Ok(Self::Ioc),
2050            "FOK" => Ok(Self::Fok),
2051            other => Err(format!(
2052                "invalid OrderListOpocoPendingBelowTimeInForceEnum: {}",
2053                other
2054            )
2055            .into()),
2056        }
2057    }
2058}
2059
2060#[allow(non_camel_case_types)]
2061#[derive(Debug, Clone, Serialize, Deserialize)]
2062pub enum OrderListOpocoPendingBelowPegPriceTypeEnum {
2063    #[serde(rename = "PRIMARY_PEG")]
2064    PrimaryPeg,
2065    #[serde(rename = "MARKET_PEG")]
2066    MarketPeg,
2067}
2068
2069impl OrderListOpocoPendingBelowPegPriceTypeEnum {
2070    #[must_use]
2071    pub fn as_str(&self) -> &'static str {
2072        match self {
2073            Self::PrimaryPeg => "PRIMARY_PEG",
2074            Self::MarketPeg => "MARKET_PEG",
2075        }
2076    }
2077}
2078
2079impl std::str::FromStr for OrderListOpocoPendingBelowPegPriceTypeEnum {
2080    type Err = Box<dyn std::error::Error + Send + Sync>;
2081
2082    fn from_str(s: &str) -> Result<Self, Self::Err> {
2083        match s {
2084            "PRIMARY_PEG" => Ok(Self::PrimaryPeg),
2085            "MARKET_PEG" => Ok(Self::MarketPeg),
2086            other => Err(format!(
2087                "invalid OrderListOpocoPendingBelowPegPriceTypeEnum: {}",
2088                other
2089            )
2090            .into()),
2091        }
2092    }
2093}
2094
2095#[allow(non_camel_case_types)]
2096#[derive(Debug, Clone, Serialize, Deserialize)]
2097pub enum OrderListOpocoPendingBelowPegOffsetTypeEnum {
2098    #[serde(rename = "PRICE_LEVEL")]
2099    PriceLevel,
2100}
2101
2102impl OrderListOpocoPendingBelowPegOffsetTypeEnum {
2103    #[must_use]
2104    pub fn as_str(&self) -> &'static str {
2105        match self {
2106            Self::PriceLevel => "PRICE_LEVEL",
2107        }
2108    }
2109}
2110
2111impl std::str::FromStr for OrderListOpocoPendingBelowPegOffsetTypeEnum {
2112    type Err = Box<dyn std::error::Error + Send + Sync>;
2113
2114    fn from_str(s: &str) -> Result<Self, Self::Err> {
2115        match s {
2116            "PRICE_LEVEL" => Ok(Self::PriceLevel),
2117            other => Err(format!(
2118                "invalid OrderListOpocoPendingBelowPegOffsetTypeEnum: {}",
2119                other
2120            )
2121            .into()),
2122        }
2123    }
2124}
2125
2126#[allow(non_camel_case_types)]
2127#[derive(Debug, Clone, Serialize, Deserialize)]
2128pub enum OrderListOtoWorkingTypeEnum {
2129    #[serde(rename = "LIMIT")]
2130    Limit,
2131    #[serde(rename = "LIMIT_MAKER")]
2132    LimitMaker,
2133}
2134
2135impl OrderListOtoWorkingTypeEnum {
2136    #[must_use]
2137    pub fn as_str(&self) -> &'static str {
2138        match self {
2139            Self::Limit => "LIMIT",
2140            Self::LimitMaker => "LIMIT_MAKER",
2141        }
2142    }
2143}
2144
2145impl std::str::FromStr for OrderListOtoWorkingTypeEnum {
2146    type Err = Box<dyn std::error::Error + Send + Sync>;
2147
2148    fn from_str(s: &str) -> Result<Self, Self::Err> {
2149        match s {
2150            "LIMIT" => Ok(Self::Limit),
2151            "LIMIT_MAKER" => Ok(Self::LimitMaker),
2152            other => Err(format!("invalid OrderListOtoWorkingTypeEnum: {}", other).into()),
2153        }
2154    }
2155}
2156
2157#[allow(non_camel_case_types)]
2158#[derive(Debug, Clone, Serialize, Deserialize)]
2159pub enum OrderListOtoWorkingSideEnum {
2160    #[serde(rename = "BUY")]
2161    Buy,
2162    #[serde(rename = "SELL")]
2163    Sell,
2164}
2165
2166impl OrderListOtoWorkingSideEnum {
2167    #[must_use]
2168    pub fn as_str(&self) -> &'static str {
2169        match self {
2170            Self::Buy => "BUY",
2171            Self::Sell => "SELL",
2172        }
2173    }
2174}
2175
2176impl std::str::FromStr for OrderListOtoWorkingSideEnum {
2177    type Err = Box<dyn std::error::Error + Send + Sync>;
2178
2179    fn from_str(s: &str) -> Result<Self, Self::Err> {
2180        match s {
2181            "BUY" => Ok(Self::Buy),
2182            "SELL" => Ok(Self::Sell),
2183            other => Err(format!("invalid OrderListOtoWorkingSideEnum: {}", other).into()),
2184        }
2185    }
2186}
2187
2188#[allow(non_camel_case_types)]
2189#[derive(Debug, Clone, Serialize, Deserialize)]
2190pub enum OrderListOtoPendingTypeEnum {
2191    #[serde(rename = "LIMIT")]
2192    Limit,
2193    #[serde(rename = "MARKET")]
2194    Market,
2195    #[serde(rename = "STOP_LOSS")]
2196    StopLoss,
2197    #[serde(rename = "STOP_LOSS_LIMIT")]
2198    StopLossLimit,
2199    #[serde(rename = "TAKE_PROFIT")]
2200    TakeProfit,
2201    #[serde(rename = "TAKE_PROFIT_LIMIT")]
2202    TakeProfitLimit,
2203    #[serde(rename = "LIMIT_MAKER")]
2204    LimitMaker,
2205}
2206
2207impl OrderListOtoPendingTypeEnum {
2208    #[must_use]
2209    pub fn as_str(&self) -> &'static str {
2210        match self {
2211            Self::Limit => "LIMIT",
2212            Self::Market => "MARKET",
2213            Self::StopLoss => "STOP_LOSS",
2214            Self::StopLossLimit => "STOP_LOSS_LIMIT",
2215            Self::TakeProfit => "TAKE_PROFIT",
2216            Self::TakeProfitLimit => "TAKE_PROFIT_LIMIT",
2217            Self::LimitMaker => "LIMIT_MAKER",
2218        }
2219    }
2220}
2221
2222impl std::str::FromStr for OrderListOtoPendingTypeEnum {
2223    type Err = Box<dyn std::error::Error + Send + Sync>;
2224
2225    fn from_str(s: &str) -> Result<Self, Self::Err> {
2226        match s {
2227            "LIMIT" => Ok(Self::Limit),
2228            "MARKET" => Ok(Self::Market),
2229            "STOP_LOSS" => Ok(Self::StopLoss),
2230            "STOP_LOSS_LIMIT" => Ok(Self::StopLossLimit),
2231            "TAKE_PROFIT" => Ok(Self::TakeProfit),
2232            "TAKE_PROFIT_LIMIT" => Ok(Self::TakeProfitLimit),
2233            "LIMIT_MAKER" => Ok(Self::LimitMaker),
2234            other => Err(format!("invalid OrderListOtoPendingTypeEnum: {}", other).into()),
2235        }
2236    }
2237}
2238
2239#[allow(non_camel_case_types)]
2240#[derive(Debug, Clone, Serialize, Deserialize)]
2241pub enum OrderListOtoPendingSideEnum {
2242    #[serde(rename = "BUY")]
2243    Buy,
2244    #[serde(rename = "SELL")]
2245    Sell,
2246}
2247
2248impl OrderListOtoPendingSideEnum {
2249    #[must_use]
2250    pub fn as_str(&self) -> &'static str {
2251        match self {
2252            Self::Buy => "BUY",
2253            Self::Sell => "SELL",
2254        }
2255    }
2256}
2257
2258impl std::str::FromStr for OrderListOtoPendingSideEnum {
2259    type Err = Box<dyn std::error::Error + Send + Sync>;
2260
2261    fn from_str(s: &str) -> Result<Self, Self::Err> {
2262        match s {
2263            "BUY" => Ok(Self::Buy),
2264            "SELL" => Ok(Self::Sell),
2265            other => Err(format!("invalid OrderListOtoPendingSideEnum: {}", other).into()),
2266        }
2267    }
2268}
2269
2270#[allow(non_camel_case_types)]
2271#[derive(Debug, Clone, Serialize, Deserialize)]
2272pub enum OrderListOtoNewOrderRespTypeEnum {
2273    #[serde(rename = "ACK")]
2274    Ack,
2275    #[serde(rename = "RESULT")]
2276    Result,
2277    #[serde(rename = "FULL")]
2278    Full,
2279}
2280
2281impl OrderListOtoNewOrderRespTypeEnum {
2282    #[must_use]
2283    pub fn as_str(&self) -> &'static str {
2284        match self {
2285            Self::Ack => "ACK",
2286            Self::Result => "RESULT",
2287            Self::Full => "FULL",
2288        }
2289    }
2290}
2291
2292impl std::str::FromStr for OrderListOtoNewOrderRespTypeEnum {
2293    type Err = Box<dyn std::error::Error + Send + Sync>;
2294
2295    fn from_str(s: &str) -> Result<Self, Self::Err> {
2296        match s {
2297            "ACK" => Ok(Self::Ack),
2298            "RESULT" => Ok(Self::Result),
2299            "FULL" => Ok(Self::Full),
2300            other => Err(format!("invalid OrderListOtoNewOrderRespTypeEnum: {}", other).into()),
2301        }
2302    }
2303}
2304
2305#[allow(non_camel_case_types)]
2306#[derive(Debug, Clone, Serialize, Deserialize)]
2307pub enum OrderListOtoSelfTradePreventionModeEnum {
2308    #[serde(rename = "NONE")]
2309    None,
2310    #[serde(rename = "EXPIRE_TAKER")]
2311    ExpireTaker,
2312    #[serde(rename = "EXPIRE_MAKER")]
2313    ExpireMaker,
2314    #[serde(rename = "EXPIRE_BOTH")]
2315    ExpireBoth,
2316    #[serde(rename = "DECREMENT")]
2317    Decrement,
2318    #[serde(rename = "TRANSFER")]
2319    Transfer,
2320}
2321
2322impl OrderListOtoSelfTradePreventionModeEnum {
2323    #[must_use]
2324    pub fn as_str(&self) -> &'static str {
2325        match self {
2326            Self::None => "NONE",
2327            Self::ExpireTaker => "EXPIRE_TAKER",
2328            Self::ExpireMaker => "EXPIRE_MAKER",
2329            Self::ExpireBoth => "EXPIRE_BOTH",
2330            Self::Decrement => "DECREMENT",
2331            Self::Transfer => "TRANSFER",
2332        }
2333    }
2334}
2335
2336impl std::str::FromStr for OrderListOtoSelfTradePreventionModeEnum {
2337    type Err = Box<dyn std::error::Error + Send + Sync>;
2338
2339    fn from_str(s: &str) -> Result<Self, Self::Err> {
2340        match s {
2341            "NONE" => Ok(Self::None),
2342            "EXPIRE_TAKER" => Ok(Self::ExpireTaker),
2343            "EXPIRE_MAKER" => Ok(Self::ExpireMaker),
2344            "EXPIRE_BOTH" => Ok(Self::ExpireBoth),
2345            "DECREMENT" => Ok(Self::Decrement),
2346            "TRANSFER" => Ok(Self::Transfer),
2347            other => {
2348                Err(format!("invalid OrderListOtoSelfTradePreventionModeEnum: {}", other).into())
2349            }
2350        }
2351    }
2352}
2353
2354#[allow(non_camel_case_types)]
2355#[derive(Debug, Clone, Serialize, Deserialize)]
2356pub enum OrderListOtoWorkingTimeInForceEnum {
2357    #[serde(rename = "GTC")]
2358    Gtc,
2359    #[serde(rename = "IOC")]
2360    Ioc,
2361    #[serde(rename = "FOK")]
2362    Fok,
2363}
2364
2365impl OrderListOtoWorkingTimeInForceEnum {
2366    #[must_use]
2367    pub fn as_str(&self) -> &'static str {
2368        match self {
2369            Self::Gtc => "GTC",
2370            Self::Ioc => "IOC",
2371            Self::Fok => "FOK",
2372        }
2373    }
2374}
2375
2376impl std::str::FromStr for OrderListOtoWorkingTimeInForceEnum {
2377    type Err = Box<dyn std::error::Error + Send + Sync>;
2378
2379    fn from_str(s: &str) -> Result<Self, Self::Err> {
2380        match s {
2381            "GTC" => Ok(Self::Gtc),
2382            "IOC" => Ok(Self::Ioc),
2383            "FOK" => Ok(Self::Fok),
2384            other => Err(format!("invalid OrderListOtoWorkingTimeInForceEnum: {}", other).into()),
2385        }
2386    }
2387}
2388
2389#[allow(non_camel_case_types)]
2390#[derive(Debug, Clone, Serialize, Deserialize)]
2391pub enum OrderListOtoWorkingPegPriceTypeEnum {
2392    #[serde(rename = "PRIMARY_PEG")]
2393    PrimaryPeg,
2394    #[serde(rename = "MARKET_PEG")]
2395    MarketPeg,
2396}
2397
2398impl OrderListOtoWorkingPegPriceTypeEnum {
2399    #[must_use]
2400    pub fn as_str(&self) -> &'static str {
2401        match self {
2402            Self::PrimaryPeg => "PRIMARY_PEG",
2403            Self::MarketPeg => "MARKET_PEG",
2404        }
2405    }
2406}
2407
2408impl std::str::FromStr for OrderListOtoWorkingPegPriceTypeEnum {
2409    type Err = Box<dyn std::error::Error + Send + Sync>;
2410
2411    fn from_str(s: &str) -> Result<Self, Self::Err> {
2412        match s {
2413            "PRIMARY_PEG" => Ok(Self::PrimaryPeg),
2414            "MARKET_PEG" => Ok(Self::MarketPeg),
2415            other => Err(format!("invalid OrderListOtoWorkingPegPriceTypeEnum: {}", other).into()),
2416        }
2417    }
2418}
2419
2420#[allow(non_camel_case_types)]
2421#[derive(Debug, Clone, Serialize, Deserialize)]
2422pub enum OrderListOtoWorkingPegOffsetTypeEnum {
2423    #[serde(rename = "PRICE_LEVEL")]
2424    PriceLevel,
2425}
2426
2427impl OrderListOtoWorkingPegOffsetTypeEnum {
2428    #[must_use]
2429    pub fn as_str(&self) -> &'static str {
2430        match self {
2431            Self::PriceLevel => "PRICE_LEVEL",
2432        }
2433    }
2434}
2435
2436impl std::str::FromStr for OrderListOtoWorkingPegOffsetTypeEnum {
2437    type Err = Box<dyn std::error::Error + Send + Sync>;
2438
2439    fn from_str(s: &str) -> Result<Self, Self::Err> {
2440        match s {
2441            "PRICE_LEVEL" => Ok(Self::PriceLevel),
2442            other => Err(format!("invalid OrderListOtoWorkingPegOffsetTypeEnum: {}", other).into()),
2443        }
2444    }
2445}
2446
2447#[allow(non_camel_case_types)]
2448#[derive(Debug, Clone, Serialize, Deserialize)]
2449pub enum OrderListOtoPendingTimeInForceEnum {
2450    #[serde(rename = "GTC")]
2451    Gtc,
2452    #[serde(rename = "IOC")]
2453    Ioc,
2454    #[serde(rename = "FOK")]
2455    Fok,
2456}
2457
2458impl OrderListOtoPendingTimeInForceEnum {
2459    #[must_use]
2460    pub fn as_str(&self) -> &'static str {
2461        match self {
2462            Self::Gtc => "GTC",
2463            Self::Ioc => "IOC",
2464            Self::Fok => "FOK",
2465        }
2466    }
2467}
2468
2469impl std::str::FromStr for OrderListOtoPendingTimeInForceEnum {
2470    type Err = Box<dyn std::error::Error + Send + Sync>;
2471
2472    fn from_str(s: &str) -> Result<Self, Self::Err> {
2473        match s {
2474            "GTC" => Ok(Self::Gtc),
2475            "IOC" => Ok(Self::Ioc),
2476            "FOK" => Ok(Self::Fok),
2477            other => Err(format!("invalid OrderListOtoPendingTimeInForceEnum: {}", other).into()),
2478        }
2479    }
2480}
2481
2482#[allow(non_camel_case_types)]
2483#[derive(Debug, Clone, Serialize, Deserialize)]
2484pub enum OrderListOtoPendingPegPriceTypeEnum {
2485    #[serde(rename = "PRIMARY_PEG")]
2486    PrimaryPeg,
2487    #[serde(rename = "MARKET_PEG")]
2488    MarketPeg,
2489}
2490
2491impl OrderListOtoPendingPegPriceTypeEnum {
2492    #[must_use]
2493    pub fn as_str(&self) -> &'static str {
2494        match self {
2495            Self::PrimaryPeg => "PRIMARY_PEG",
2496            Self::MarketPeg => "MARKET_PEG",
2497        }
2498    }
2499}
2500
2501impl std::str::FromStr for OrderListOtoPendingPegPriceTypeEnum {
2502    type Err = Box<dyn std::error::Error + Send + Sync>;
2503
2504    fn from_str(s: &str) -> Result<Self, Self::Err> {
2505        match s {
2506            "PRIMARY_PEG" => Ok(Self::PrimaryPeg),
2507            "MARKET_PEG" => Ok(Self::MarketPeg),
2508            other => Err(format!("invalid OrderListOtoPendingPegPriceTypeEnum: {}", other).into()),
2509        }
2510    }
2511}
2512
2513#[allow(non_camel_case_types)]
2514#[derive(Debug, Clone, Serialize, Deserialize)]
2515pub enum OrderListOtoPendingPegOffsetTypeEnum {
2516    #[serde(rename = "PRICE_LEVEL")]
2517    PriceLevel,
2518}
2519
2520impl OrderListOtoPendingPegOffsetTypeEnum {
2521    #[must_use]
2522    pub fn as_str(&self) -> &'static str {
2523        match self {
2524            Self::PriceLevel => "PRICE_LEVEL",
2525        }
2526    }
2527}
2528
2529impl std::str::FromStr for OrderListOtoPendingPegOffsetTypeEnum {
2530    type Err = Box<dyn std::error::Error + Send + Sync>;
2531
2532    fn from_str(s: &str) -> Result<Self, Self::Err> {
2533        match s {
2534            "PRICE_LEVEL" => Ok(Self::PriceLevel),
2535            other => Err(format!("invalid OrderListOtoPendingPegOffsetTypeEnum: {}", other).into()),
2536        }
2537    }
2538}
2539
2540#[allow(non_camel_case_types)]
2541#[derive(Debug, Clone, Serialize, Deserialize)]
2542pub enum OrderListOtocoWorkingTypeEnum {
2543    #[serde(rename = "LIMIT")]
2544    Limit,
2545    #[serde(rename = "LIMIT_MAKER")]
2546    LimitMaker,
2547}
2548
2549impl OrderListOtocoWorkingTypeEnum {
2550    #[must_use]
2551    pub fn as_str(&self) -> &'static str {
2552        match self {
2553            Self::Limit => "LIMIT",
2554            Self::LimitMaker => "LIMIT_MAKER",
2555        }
2556    }
2557}
2558
2559impl std::str::FromStr for OrderListOtocoWorkingTypeEnum {
2560    type Err = Box<dyn std::error::Error + Send + Sync>;
2561
2562    fn from_str(s: &str) -> Result<Self, Self::Err> {
2563        match s {
2564            "LIMIT" => Ok(Self::Limit),
2565            "LIMIT_MAKER" => Ok(Self::LimitMaker),
2566            other => Err(format!("invalid OrderListOtocoWorkingTypeEnum: {}", other).into()),
2567        }
2568    }
2569}
2570
2571#[allow(non_camel_case_types)]
2572#[derive(Debug, Clone, Serialize, Deserialize)]
2573pub enum OrderListOtocoWorkingSideEnum {
2574    #[serde(rename = "BUY")]
2575    Buy,
2576    #[serde(rename = "SELL")]
2577    Sell,
2578}
2579
2580impl OrderListOtocoWorkingSideEnum {
2581    #[must_use]
2582    pub fn as_str(&self) -> &'static str {
2583        match self {
2584            Self::Buy => "BUY",
2585            Self::Sell => "SELL",
2586        }
2587    }
2588}
2589
2590impl std::str::FromStr for OrderListOtocoWorkingSideEnum {
2591    type Err = Box<dyn std::error::Error + Send + Sync>;
2592
2593    fn from_str(s: &str) -> Result<Self, Self::Err> {
2594        match s {
2595            "BUY" => Ok(Self::Buy),
2596            "SELL" => Ok(Self::Sell),
2597            other => Err(format!("invalid OrderListOtocoWorkingSideEnum: {}", other).into()),
2598        }
2599    }
2600}
2601
2602#[allow(non_camel_case_types)]
2603#[derive(Debug, Clone, Serialize, Deserialize)]
2604pub enum OrderListOtocoPendingSideEnum {
2605    #[serde(rename = "BUY")]
2606    Buy,
2607    #[serde(rename = "SELL")]
2608    Sell,
2609}
2610
2611impl OrderListOtocoPendingSideEnum {
2612    #[must_use]
2613    pub fn as_str(&self) -> &'static str {
2614        match self {
2615            Self::Buy => "BUY",
2616            Self::Sell => "SELL",
2617        }
2618    }
2619}
2620
2621impl std::str::FromStr for OrderListOtocoPendingSideEnum {
2622    type Err = Box<dyn std::error::Error + Send + Sync>;
2623
2624    fn from_str(s: &str) -> Result<Self, Self::Err> {
2625        match s {
2626            "BUY" => Ok(Self::Buy),
2627            "SELL" => Ok(Self::Sell),
2628            other => Err(format!("invalid OrderListOtocoPendingSideEnum: {}", other).into()),
2629        }
2630    }
2631}
2632
2633#[allow(non_camel_case_types)]
2634#[derive(Debug, Clone, Serialize, Deserialize)]
2635pub enum OrderListOtocoPendingAboveTypeEnum {
2636    #[serde(rename = "STOP_LOSS_LIMIT")]
2637    StopLossLimit,
2638    #[serde(rename = "STOP_LOSS")]
2639    StopLoss,
2640    #[serde(rename = "LIMIT_MAKER")]
2641    LimitMaker,
2642    #[serde(rename = "TAKE_PROFIT")]
2643    TakeProfit,
2644    #[serde(rename = "TAKE_PROFIT_LIMIT")]
2645    TakeProfitLimit,
2646}
2647
2648impl OrderListOtocoPendingAboveTypeEnum {
2649    #[must_use]
2650    pub fn as_str(&self) -> &'static str {
2651        match self {
2652            Self::StopLossLimit => "STOP_LOSS_LIMIT",
2653            Self::StopLoss => "STOP_LOSS",
2654            Self::LimitMaker => "LIMIT_MAKER",
2655            Self::TakeProfit => "TAKE_PROFIT",
2656            Self::TakeProfitLimit => "TAKE_PROFIT_LIMIT",
2657        }
2658    }
2659}
2660
2661impl std::str::FromStr for OrderListOtocoPendingAboveTypeEnum {
2662    type Err = Box<dyn std::error::Error + Send + Sync>;
2663
2664    fn from_str(s: &str) -> Result<Self, Self::Err> {
2665        match s {
2666            "STOP_LOSS_LIMIT" => Ok(Self::StopLossLimit),
2667            "STOP_LOSS" => Ok(Self::StopLoss),
2668            "LIMIT_MAKER" => Ok(Self::LimitMaker),
2669            "TAKE_PROFIT" => Ok(Self::TakeProfit),
2670            "TAKE_PROFIT_LIMIT" => Ok(Self::TakeProfitLimit),
2671            other => Err(format!("invalid OrderListOtocoPendingAboveTypeEnum: {}", other).into()),
2672        }
2673    }
2674}
2675
2676#[allow(non_camel_case_types)]
2677#[derive(Debug, Clone, Serialize, Deserialize)]
2678pub enum OrderListOtocoNewOrderRespTypeEnum {
2679    #[serde(rename = "ACK")]
2680    Ack,
2681    #[serde(rename = "RESULT")]
2682    Result,
2683    #[serde(rename = "FULL")]
2684    Full,
2685}
2686
2687impl OrderListOtocoNewOrderRespTypeEnum {
2688    #[must_use]
2689    pub fn as_str(&self) -> &'static str {
2690        match self {
2691            Self::Ack => "ACK",
2692            Self::Result => "RESULT",
2693            Self::Full => "FULL",
2694        }
2695    }
2696}
2697
2698impl std::str::FromStr for OrderListOtocoNewOrderRespTypeEnum {
2699    type Err = Box<dyn std::error::Error + Send + Sync>;
2700
2701    fn from_str(s: &str) -> Result<Self, Self::Err> {
2702        match s {
2703            "ACK" => Ok(Self::Ack),
2704            "RESULT" => Ok(Self::Result),
2705            "FULL" => Ok(Self::Full),
2706            other => Err(format!("invalid OrderListOtocoNewOrderRespTypeEnum: {}", other).into()),
2707        }
2708    }
2709}
2710
2711#[allow(non_camel_case_types)]
2712#[derive(Debug, Clone, Serialize, Deserialize)]
2713pub enum OrderListOtocoSelfTradePreventionModeEnum {
2714    #[serde(rename = "NONE")]
2715    None,
2716    #[serde(rename = "EXPIRE_TAKER")]
2717    ExpireTaker,
2718    #[serde(rename = "EXPIRE_MAKER")]
2719    ExpireMaker,
2720    #[serde(rename = "EXPIRE_BOTH")]
2721    ExpireBoth,
2722    #[serde(rename = "DECREMENT")]
2723    Decrement,
2724    #[serde(rename = "TRANSFER")]
2725    Transfer,
2726}
2727
2728impl OrderListOtocoSelfTradePreventionModeEnum {
2729    #[must_use]
2730    pub fn as_str(&self) -> &'static str {
2731        match self {
2732            Self::None => "NONE",
2733            Self::ExpireTaker => "EXPIRE_TAKER",
2734            Self::ExpireMaker => "EXPIRE_MAKER",
2735            Self::ExpireBoth => "EXPIRE_BOTH",
2736            Self::Decrement => "DECREMENT",
2737            Self::Transfer => "TRANSFER",
2738        }
2739    }
2740}
2741
2742impl std::str::FromStr for OrderListOtocoSelfTradePreventionModeEnum {
2743    type Err = Box<dyn std::error::Error + Send + Sync>;
2744
2745    fn from_str(s: &str) -> Result<Self, Self::Err> {
2746        match s {
2747            "NONE" => Ok(Self::None),
2748            "EXPIRE_TAKER" => Ok(Self::ExpireTaker),
2749            "EXPIRE_MAKER" => Ok(Self::ExpireMaker),
2750            "EXPIRE_BOTH" => Ok(Self::ExpireBoth),
2751            "DECREMENT" => Ok(Self::Decrement),
2752            "TRANSFER" => Ok(Self::Transfer),
2753            other => Err(format!(
2754                "invalid OrderListOtocoSelfTradePreventionModeEnum: {}",
2755                other
2756            )
2757            .into()),
2758        }
2759    }
2760}
2761
2762#[allow(non_camel_case_types)]
2763#[derive(Debug, Clone, Serialize, Deserialize)]
2764pub enum OrderListOtocoWorkingTimeInForceEnum {
2765    #[serde(rename = "GTC")]
2766    Gtc,
2767    #[serde(rename = "IOC")]
2768    Ioc,
2769    #[serde(rename = "FOK")]
2770    Fok,
2771}
2772
2773impl OrderListOtocoWorkingTimeInForceEnum {
2774    #[must_use]
2775    pub fn as_str(&self) -> &'static str {
2776        match self {
2777            Self::Gtc => "GTC",
2778            Self::Ioc => "IOC",
2779            Self::Fok => "FOK",
2780        }
2781    }
2782}
2783
2784impl std::str::FromStr for OrderListOtocoWorkingTimeInForceEnum {
2785    type Err = Box<dyn std::error::Error + Send + Sync>;
2786
2787    fn from_str(s: &str) -> Result<Self, Self::Err> {
2788        match s {
2789            "GTC" => Ok(Self::Gtc),
2790            "IOC" => Ok(Self::Ioc),
2791            "FOK" => Ok(Self::Fok),
2792            other => Err(format!("invalid OrderListOtocoWorkingTimeInForceEnum: {}", other).into()),
2793        }
2794    }
2795}
2796
2797#[allow(non_camel_case_types)]
2798#[derive(Debug, Clone, Serialize, Deserialize)]
2799pub enum OrderListOtocoWorkingPegPriceTypeEnum {
2800    #[serde(rename = "PRIMARY_PEG")]
2801    PrimaryPeg,
2802    #[serde(rename = "MARKET_PEG")]
2803    MarketPeg,
2804}
2805
2806impl OrderListOtocoWorkingPegPriceTypeEnum {
2807    #[must_use]
2808    pub fn as_str(&self) -> &'static str {
2809        match self {
2810            Self::PrimaryPeg => "PRIMARY_PEG",
2811            Self::MarketPeg => "MARKET_PEG",
2812        }
2813    }
2814}
2815
2816impl std::str::FromStr for OrderListOtocoWorkingPegPriceTypeEnum {
2817    type Err = Box<dyn std::error::Error + Send + Sync>;
2818
2819    fn from_str(s: &str) -> Result<Self, Self::Err> {
2820        match s {
2821            "PRIMARY_PEG" => Ok(Self::PrimaryPeg),
2822            "MARKET_PEG" => Ok(Self::MarketPeg),
2823            other => {
2824                Err(format!("invalid OrderListOtocoWorkingPegPriceTypeEnum: {}", other).into())
2825            }
2826        }
2827    }
2828}
2829
2830#[allow(non_camel_case_types)]
2831#[derive(Debug, Clone, Serialize, Deserialize)]
2832pub enum OrderListOtocoWorkingPegOffsetTypeEnum {
2833    #[serde(rename = "PRICE_LEVEL")]
2834    PriceLevel,
2835}
2836
2837impl OrderListOtocoWorkingPegOffsetTypeEnum {
2838    #[must_use]
2839    pub fn as_str(&self) -> &'static str {
2840        match self {
2841            Self::PriceLevel => "PRICE_LEVEL",
2842        }
2843    }
2844}
2845
2846impl std::str::FromStr for OrderListOtocoWorkingPegOffsetTypeEnum {
2847    type Err = Box<dyn std::error::Error + Send + Sync>;
2848
2849    fn from_str(s: &str) -> Result<Self, Self::Err> {
2850        match s {
2851            "PRICE_LEVEL" => Ok(Self::PriceLevel),
2852            other => {
2853                Err(format!("invalid OrderListOtocoWorkingPegOffsetTypeEnum: {}", other).into())
2854            }
2855        }
2856    }
2857}
2858
2859#[allow(non_camel_case_types)]
2860#[derive(Debug, Clone, Serialize, Deserialize)]
2861pub enum OrderListOtocoPendingAboveTimeInForceEnum {
2862    #[serde(rename = "GTC")]
2863    Gtc,
2864    #[serde(rename = "IOC")]
2865    Ioc,
2866    #[serde(rename = "FOK")]
2867    Fok,
2868}
2869
2870impl OrderListOtocoPendingAboveTimeInForceEnum {
2871    #[must_use]
2872    pub fn as_str(&self) -> &'static str {
2873        match self {
2874            Self::Gtc => "GTC",
2875            Self::Ioc => "IOC",
2876            Self::Fok => "FOK",
2877        }
2878    }
2879}
2880
2881impl std::str::FromStr for OrderListOtocoPendingAboveTimeInForceEnum {
2882    type Err = Box<dyn std::error::Error + Send + Sync>;
2883
2884    fn from_str(s: &str) -> Result<Self, Self::Err> {
2885        match s {
2886            "GTC" => Ok(Self::Gtc),
2887            "IOC" => Ok(Self::Ioc),
2888            "FOK" => Ok(Self::Fok),
2889            other => Err(format!(
2890                "invalid OrderListOtocoPendingAboveTimeInForceEnum: {}",
2891                other
2892            )
2893            .into()),
2894        }
2895    }
2896}
2897
2898#[allow(non_camel_case_types)]
2899#[derive(Debug, Clone, Serialize, Deserialize)]
2900pub enum OrderListOtocoPendingAbovePegPriceTypeEnum {
2901    #[serde(rename = "PRIMARY_PEG")]
2902    PrimaryPeg,
2903    #[serde(rename = "MARKET_PEG")]
2904    MarketPeg,
2905}
2906
2907impl OrderListOtocoPendingAbovePegPriceTypeEnum {
2908    #[must_use]
2909    pub fn as_str(&self) -> &'static str {
2910        match self {
2911            Self::PrimaryPeg => "PRIMARY_PEG",
2912            Self::MarketPeg => "MARKET_PEG",
2913        }
2914    }
2915}
2916
2917impl std::str::FromStr for OrderListOtocoPendingAbovePegPriceTypeEnum {
2918    type Err = Box<dyn std::error::Error + Send + Sync>;
2919
2920    fn from_str(s: &str) -> Result<Self, Self::Err> {
2921        match s {
2922            "PRIMARY_PEG" => Ok(Self::PrimaryPeg),
2923            "MARKET_PEG" => Ok(Self::MarketPeg),
2924            other => Err(format!(
2925                "invalid OrderListOtocoPendingAbovePegPriceTypeEnum: {}",
2926                other
2927            )
2928            .into()),
2929        }
2930    }
2931}
2932
2933#[allow(non_camel_case_types)]
2934#[derive(Debug, Clone, Serialize, Deserialize)]
2935pub enum OrderListOtocoPendingAbovePegOffsetTypeEnum {
2936    #[serde(rename = "PRICE_LEVEL")]
2937    PriceLevel,
2938}
2939
2940impl OrderListOtocoPendingAbovePegOffsetTypeEnum {
2941    #[must_use]
2942    pub fn as_str(&self) -> &'static str {
2943        match self {
2944            Self::PriceLevel => "PRICE_LEVEL",
2945        }
2946    }
2947}
2948
2949impl std::str::FromStr for OrderListOtocoPendingAbovePegOffsetTypeEnum {
2950    type Err = Box<dyn std::error::Error + Send + Sync>;
2951
2952    fn from_str(s: &str) -> Result<Self, Self::Err> {
2953        match s {
2954            "PRICE_LEVEL" => Ok(Self::PriceLevel),
2955            other => Err(format!(
2956                "invalid OrderListOtocoPendingAbovePegOffsetTypeEnum: {}",
2957                other
2958            )
2959            .into()),
2960        }
2961    }
2962}
2963
2964#[allow(non_camel_case_types)]
2965#[derive(Debug, Clone, Serialize, Deserialize)]
2966pub enum OrderListOtocoPendingBelowTypeEnum {
2967    #[serde(rename = "STOP_LOSS")]
2968    StopLoss,
2969    #[serde(rename = "STOP_LOSS_LIMIT")]
2970    StopLossLimit,
2971    #[serde(rename = "TAKE_PROFIT")]
2972    TakeProfit,
2973    #[serde(rename = "TAKE_PROFIT_LIMIT")]
2974    TakeProfitLimit,
2975}
2976
2977impl OrderListOtocoPendingBelowTypeEnum {
2978    #[must_use]
2979    pub fn as_str(&self) -> &'static str {
2980        match self {
2981            Self::StopLoss => "STOP_LOSS",
2982            Self::StopLossLimit => "STOP_LOSS_LIMIT",
2983            Self::TakeProfit => "TAKE_PROFIT",
2984            Self::TakeProfitLimit => "TAKE_PROFIT_LIMIT",
2985        }
2986    }
2987}
2988
2989impl std::str::FromStr for OrderListOtocoPendingBelowTypeEnum {
2990    type Err = Box<dyn std::error::Error + Send + Sync>;
2991
2992    fn from_str(s: &str) -> Result<Self, Self::Err> {
2993        match s {
2994            "STOP_LOSS" => Ok(Self::StopLoss),
2995            "STOP_LOSS_LIMIT" => Ok(Self::StopLossLimit),
2996            "TAKE_PROFIT" => Ok(Self::TakeProfit),
2997            "TAKE_PROFIT_LIMIT" => Ok(Self::TakeProfitLimit),
2998            other => Err(format!("invalid OrderListOtocoPendingBelowTypeEnum: {}", other).into()),
2999        }
3000    }
3001}
3002
3003#[allow(non_camel_case_types)]
3004#[derive(Debug, Clone, Serialize, Deserialize)]
3005pub enum OrderListOtocoPendingBelowTimeInForceEnum {
3006    #[serde(rename = "GTC")]
3007    Gtc,
3008    #[serde(rename = "IOC")]
3009    Ioc,
3010    #[serde(rename = "FOK")]
3011    Fok,
3012}
3013
3014impl OrderListOtocoPendingBelowTimeInForceEnum {
3015    #[must_use]
3016    pub fn as_str(&self) -> &'static str {
3017        match self {
3018            Self::Gtc => "GTC",
3019            Self::Ioc => "IOC",
3020            Self::Fok => "FOK",
3021        }
3022    }
3023}
3024
3025impl std::str::FromStr for OrderListOtocoPendingBelowTimeInForceEnum {
3026    type Err = Box<dyn std::error::Error + Send + Sync>;
3027
3028    fn from_str(s: &str) -> Result<Self, Self::Err> {
3029        match s {
3030            "GTC" => Ok(Self::Gtc),
3031            "IOC" => Ok(Self::Ioc),
3032            "FOK" => Ok(Self::Fok),
3033            other => Err(format!(
3034                "invalid OrderListOtocoPendingBelowTimeInForceEnum: {}",
3035                other
3036            )
3037            .into()),
3038        }
3039    }
3040}
3041
3042#[allow(non_camel_case_types)]
3043#[derive(Debug, Clone, Serialize, Deserialize)]
3044pub enum OrderListOtocoPendingBelowPegPriceTypeEnum {
3045    #[serde(rename = "PRIMARY_PEG")]
3046    PrimaryPeg,
3047    #[serde(rename = "MARKET_PEG")]
3048    MarketPeg,
3049}
3050
3051impl OrderListOtocoPendingBelowPegPriceTypeEnum {
3052    #[must_use]
3053    pub fn as_str(&self) -> &'static str {
3054        match self {
3055            Self::PrimaryPeg => "PRIMARY_PEG",
3056            Self::MarketPeg => "MARKET_PEG",
3057        }
3058    }
3059}
3060
3061impl std::str::FromStr for OrderListOtocoPendingBelowPegPriceTypeEnum {
3062    type Err = Box<dyn std::error::Error + Send + Sync>;
3063
3064    fn from_str(s: &str) -> Result<Self, Self::Err> {
3065        match s {
3066            "PRIMARY_PEG" => Ok(Self::PrimaryPeg),
3067            "MARKET_PEG" => Ok(Self::MarketPeg),
3068            other => Err(format!(
3069                "invalid OrderListOtocoPendingBelowPegPriceTypeEnum: {}",
3070                other
3071            )
3072            .into()),
3073        }
3074    }
3075}
3076
3077#[allow(non_camel_case_types)]
3078#[derive(Debug, Clone, Serialize, Deserialize)]
3079pub enum OrderListOtocoPendingBelowPegOffsetTypeEnum {
3080    #[serde(rename = "PRICE_LEVEL")]
3081    PriceLevel,
3082}
3083
3084impl OrderListOtocoPendingBelowPegOffsetTypeEnum {
3085    #[must_use]
3086    pub fn as_str(&self) -> &'static str {
3087        match self {
3088            Self::PriceLevel => "PRICE_LEVEL",
3089        }
3090    }
3091}
3092
3093impl std::str::FromStr for OrderListOtocoPendingBelowPegOffsetTypeEnum {
3094    type Err = Box<dyn std::error::Error + Send + Sync>;
3095
3096    fn from_str(s: &str) -> Result<Self, Self::Err> {
3097        match s {
3098            "PRICE_LEVEL" => Ok(Self::PriceLevel),
3099            other => Err(format!(
3100                "invalid OrderListOtocoPendingBelowPegOffsetTypeEnum: {}",
3101                other
3102            )
3103            .into()),
3104        }
3105    }
3106}
3107
3108#[allow(non_camel_case_types)]
3109#[derive(Debug, Clone, Serialize, Deserialize)]
3110pub enum OrderOcoSideEnum {
3111    #[serde(rename = "BUY")]
3112    Buy,
3113    #[serde(rename = "SELL")]
3114    Sell,
3115}
3116
3117impl OrderOcoSideEnum {
3118    #[must_use]
3119    pub fn as_str(&self) -> &'static str {
3120        match self {
3121            Self::Buy => "BUY",
3122            Self::Sell => "SELL",
3123        }
3124    }
3125}
3126
3127impl std::str::FromStr for OrderOcoSideEnum {
3128    type Err = Box<dyn std::error::Error + Send + Sync>;
3129
3130    fn from_str(s: &str) -> Result<Self, Self::Err> {
3131        match s {
3132            "BUY" => Ok(Self::Buy),
3133            "SELL" => Ok(Self::Sell),
3134            other => Err(format!("invalid OrderOcoSideEnum: {}", other).into()),
3135        }
3136    }
3137}
3138
3139#[allow(non_camel_case_types)]
3140#[derive(Debug, Clone, Serialize, Deserialize)]
3141pub enum OrderOcoStopLimitTimeInForceEnum {
3142    #[serde(rename = "GTC")]
3143    Gtc,
3144    #[serde(rename = "IOC")]
3145    Ioc,
3146    #[serde(rename = "FOK")]
3147    Fok,
3148}
3149
3150impl OrderOcoStopLimitTimeInForceEnum {
3151    #[must_use]
3152    pub fn as_str(&self) -> &'static str {
3153        match self {
3154            Self::Gtc => "GTC",
3155            Self::Ioc => "IOC",
3156            Self::Fok => "FOK",
3157        }
3158    }
3159}
3160
3161impl std::str::FromStr for OrderOcoStopLimitTimeInForceEnum {
3162    type Err = Box<dyn std::error::Error + Send + Sync>;
3163
3164    fn from_str(s: &str) -> Result<Self, Self::Err> {
3165        match s {
3166            "GTC" => Ok(Self::Gtc),
3167            "IOC" => Ok(Self::Ioc),
3168            "FOK" => Ok(Self::Fok),
3169            other => Err(format!("invalid OrderOcoStopLimitTimeInForceEnum: {}", other).into()),
3170        }
3171    }
3172}
3173
3174#[allow(non_camel_case_types)]
3175#[derive(Debug, Clone, Serialize, Deserialize)]
3176pub enum OrderOcoNewOrderRespTypeEnum {
3177    #[serde(rename = "ACK")]
3178    Ack,
3179    #[serde(rename = "RESULT")]
3180    Result,
3181    #[serde(rename = "FULL")]
3182    Full,
3183}
3184
3185impl OrderOcoNewOrderRespTypeEnum {
3186    #[must_use]
3187    pub fn as_str(&self) -> &'static str {
3188        match self {
3189            Self::Ack => "ACK",
3190            Self::Result => "RESULT",
3191            Self::Full => "FULL",
3192        }
3193    }
3194}
3195
3196impl std::str::FromStr for OrderOcoNewOrderRespTypeEnum {
3197    type Err = Box<dyn std::error::Error + Send + Sync>;
3198
3199    fn from_str(s: &str) -> Result<Self, Self::Err> {
3200        match s {
3201            "ACK" => Ok(Self::Ack),
3202            "RESULT" => Ok(Self::Result),
3203            "FULL" => Ok(Self::Full),
3204            other => Err(format!("invalid OrderOcoNewOrderRespTypeEnum: {}", other).into()),
3205        }
3206    }
3207}
3208
3209#[allow(non_camel_case_types)]
3210#[derive(Debug, Clone, Serialize, Deserialize)]
3211pub enum OrderOcoSelfTradePreventionModeEnum {
3212    #[serde(rename = "NONE")]
3213    None,
3214    #[serde(rename = "EXPIRE_TAKER")]
3215    ExpireTaker,
3216    #[serde(rename = "EXPIRE_MAKER")]
3217    ExpireMaker,
3218    #[serde(rename = "EXPIRE_BOTH")]
3219    ExpireBoth,
3220    #[serde(rename = "DECREMENT")]
3221    Decrement,
3222    #[serde(rename = "TRANSFER")]
3223    Transfer,
3224}
3225
3226impl OrderOcoSelfTradePreventionModeEnum {
3227    #[must_use]
3228    pub fn as_str(&self) -> &'static str {
3229        match self {
3230            Self::None => "NONE",
3231            Self::ExpireTaker => "EXPIRE_TAKER",
3232            Self::ExpireMaker => "EXPIRE_MAKER",
3233            Self::ExpireBoth => "EXPIRE_BOTH",
3234            Self::Decrement => "DECREMENT",
3235            Self::Transfer => "TRANSFER",
3236        }
3237    }
3238}
3239
3240impl std::str::FromStr for OrderOcoSelfTradePreventionModeEnum {
3241    type Err = Box<dyn std::error::Error + Send + Sync>;
3242
3243    fn from_str(s: &str) -> Result<Self, Self::Err> {
3244        match s {
3245            "NONE" => Ok(Self::None),
3246            "EXPIRE_TAKER" => Ok(Self::ExpireTaker),
3247            "EXPIRE_MAKER" => Ok(Self::ExpireMaker),
3248            "EXPIRE_BOTH" => Ok(Self::ExpireBoth),
3249            "DECREMENT" => Ok(Self::Decrement),
3250            "TRANSFER" => Ok(Self::Transfer),
3251            other => Err(format!("invalid OrderOcoSelfTradePreventionModeEnum: {}", other).into()),
3252        }
3253    }
3254}
3255
3256#[allow(non_camel_case_types)]
3257#[derive(Debug, Clone, Serialize, Deserialize)]
3258pub enum OrderTestSideEnum {
3259    #[serde(rename = "BUY")]
3260    Buy,
3261    #[serde(rename = "SELL")]
3262    Sell,
3263}
3264
3265impl OrderTestSideEnum {
3266    #[must_use]
3267    pub fn as_str(&self) -> &'static str {
3268        match self {
3269            Self::Buy => "BUY",
3270            Self::Sell => "SELL",
3271        }
3272    }
3273}
3274
3275impl std::str::FromStr for OrderTestSideEnum {
3276    type Err = Box<dyn std::error::Error + Send + Sync>;
3277
3278    fn from_str(s: &str) -> Result<Self, Self::Err> {
3279        match s {
3280            "BUY" => Ok(Self::Buy),
3281            "SELL" => Ok(Self::Sell),
3282            other => Err(format!("invalid OrderTestSideEnum: {}", other).into()),
3283        }
3284    }
3285}
3286
3287#[allow(non_camel_case_types)]
3288#[derive(Debug, Clone, Serialize, Deserialize)]
3289pub enum OrderTestTypeEnum {
3290    #[serde(rename = "MARKET")]
3291    Market,
3292    #[serde(rename = "LIMIT")]
3293    Limit,
3294    #[serde(rename = "STOP_LOSS")]
3295    StopLoss,
3296    #[serde(rename = "STOP_LOSS_LIMIT")]
3297    StopLossLimit,
3298    #[serde(rename = "TAKE_PROFIT")]
3299    TakeProfit,
3300    #[serde(rename = "TAKE_PROFIT_LIMIT")]
3301    TakeProfitLimit,
3302    #[serde(rename = "LIMIT_MAKER")]
3303    LimitMaker,
3304}
3305
3306impl OrderTestTypeEnum {
3307    #[must_use]
3308    pub fn as_str(&self) -> &'static str {
3309        match self {
3310            Self::Market => "MARKET",
3311            Self::Limit => "LIMIT",
3312            Self::StopLoss => "STOP_LOSS",
3313            Self::StopLossLimit => "STOP_LOSS_LIMIT",
3314            Self::TakeProfit => "TAKE_PROFIT",
3315            Self::TakeProfitLimit => "TAKE_PROFIT_LIMIT",
3316            Self::LimitMaker => "LIMIT_MAKER",
3317        }
3318    }
3319}
3320
3321impl std::str::FromStr for OrderTestTypeEnum {
3322    type Err = Box<dyn std::error::Error + Send + Sync>;
3323
3324    fn from_str(s: &str) -> Result<Self, Self::Err> {
3325        match s {
3326            "MARKET" => Ok(Self::Market),
3327            "LIMIT" => Ok(Self::Limit),
3328            "STOP_LOSS" => Ok(Self::StopLoss),
3329            "STOP_LOSS_LIMIT" => Ok(Self::StopLossLimit),
3330            "TAKE_PROFIT" => Ok(Self::TakeProfit),
3331            "TAKE_PROFIT_LIMIT" => Ok(Self::TakeProfitLimit),
3332            "LIMIT_MAKER" => Ok(Self::LimitMaker),
3333            other => Err(format!("invalid OrderTestTypeEnum: {}", other).into()),
3334        }
3335    }
3336}
3337
3338#[allow(non_camel_case_types)]
3339#[derive(Debug, Clone, Serialize, Deserialize)]
3340pub enum OrderTestTimeInForceEnum {
3341    #[serde(rename = "GTC")]
3342    Gtc,
3343    #[serde(rename = "IOC")]
3344    Ioc,
3345    #[serde(rename = "FOK")]
3346    Fok,
3347}
3348
3349impl OrderTestTimeInForceEnum {
3350    #[must_use]
3351    pub fn as_str(&self) -> &'static str {
3352        match self {
3353            Self::Gtc => "GTC",
3354            Self::Ioc => "IOC",
3355            Self::Fok => "FOK",
3356        }
3357    }
3358}
3359
3360impl std::str::FromStr for OrderTestTimeInForceEnum {
3361    type Err = Box<dyn std::error::Error + Send + Sync>;
3362
3363    fn from_str(s: &str) -> Result<Self, Self::Err> {
3364        match s {
3365            "GTC" => Ok(Self::Gtc),
3366            "IOC" => Ok(Self::Ioc),
3367            "FOK" => Ok(Self::Fok),
3368            other => Err(format!("invalid OrderTestTimeInForceEnum: {}", other).into()),
3369        }
3370    }
3371}
3372
3373#[allow(non_camel_case_types)]
3374#[derive(Debug, Clone, Serialize, Deserialize)]
3375pub enum OrderTestNewOrderRespTypeEnum {
3376    #[serde(rename = "ACK")]
3377    Ack,
3378    #[serde(rename = "RESULT")]
3379    Result,
3380    #[serde(rename = "FULL")]
3381    Full,
3382}
3383
3384impl OrderTestNewOrderRespTypeEnum {
3385    #[must_use]
3386    pub fn as_str(&self) -> &'static str {
3387        match self {
3388            Self::Ack => "ACK",
3389            Self::Result => "RESULT",
3390            Self::Full => "FULL",
3391        }
3392    }
3393}
3394
3395impl std::str::FromStr for OrderTestNewOrderRespTypeEnum {
3396    type Err = Box<dyn std::error::Error + Send + Sync>;
3397
3398    fn from_str(s: &str) -> Result<Self, Self::Err> {
3399        match s {
3400            "ACK" => Ok(Self::Ack),
3401            "RESULT" => Ok(Self::Result),
3402            "FULL" => Ok(Self::Full),
3403            other => Err(format!("invalid OrderTestNewOrderRespTypeEnum: {}", other).into()),
3404        }
3405    }
3406}
3407
3408#[allow(non_camel_case_types)]
3409#[derive(Debug, Clone, Serialize, Deserialize)]
3410pub enum OrderTestSelfTradePreventionModeEnum {
3411    #[serde(rename = "NONE")]
3412    None,
3413    #[serde(rename = "EXPIRE_TAKER")]
3414    ExpireTaker,
3415    #[serde(rename = "EXPIRE_MAKER")]
3416    ExpireMaker,
3417    #[serde(rename = "EXPIRE_BOTH")]
3418    ExpireBoth,
3419    #[serde(rename = "DECREMENT")]
3420    Decrement,
3421    #[serde(rename = "TRANSFER")]
3422    Transfer,
3423}
3424
3425impl OrderTestSelfTradePreventionModeEnum {
3426    #[must_use]
3427    pub fn as_str(&self) -> &'static str {
3428        match self {
3429            Self::None => "NONE",
3430            Self::ExpireTaker => "EXPIRE_TAKER",
3431            Self::ExpireMaker => "EXPIRE_MAKER",
3432            Self::ExpireBoth => "EXPIRE_BOTH",
3433            Self::Decrement => "DECREMENT",
3434            Self::Transfer => "TRANSFER",
3435        }
3436    }
3437}
3438
3439impl std::str::FromStr for OrderTestSelfTradePreventionModeEnum {
3440    type Err = Box<dyn std::error::Error + Send + Sync>;
3441
3442    fn from_str(s: &str) -> Result<Self, Self::Err> {
3443        match s {
3444            "NONE" => Ok(Self::None),
3445            "EXPIRE_TAKER" => Ok(Self::ExpireTaker),
3446            "EXPIRE_MAKER" => Ok(Self::ExpireMaker),
3447            "EXPIRE_BOTH" => Ok(Self::ExpireBoth),
3448            "DECREMENT" => Ok(Self::Decrement),
3449            "TRANSFER" => Ok(Self::Transfer),
3450            other => Err(format!("invalid OrderTestSelfTradePreventionModeEnum: {}", other).into()),
3451        }
3452    }
3453}
3454
3455#[allow(non_camel_case_types)]
3456#[derive(Debug, Clone, Serialize, Deserialize)]
3457pub enum OrderTestPegPriceTypeEnum {
3458    #[serde(rename = "PRIMARY_PEG")]
3459    PrimaryPeg,
3460    #[serde(rename = "MARKET_PEG")]
3461    MarketPeg,
3462}
3463
3464impl OrderTestPegPriceTypeEnum {
3465    #[must_use]
3466    pub fn as_str(&self) -> &'static str {
3467        match self {
3468            Self::PrimaryPeg => "PRIMARY_PEG",
3469            Self::MarketPeg => "MARKET_PEG",
3470        }
3471    }
3472}
3473
3474impl std::str::FromStr for OrderTestPegPriceTypeEnum {
3475    type Err = Box<dyn std::error::Error + Send + Sync>;
3476
3477    fn from_str(s: &str) -> Result<Self, Self::Err> {
3478        match s {
3479            "PRIMARY_PEG" => Ok(Self::PrimaryPeg),
3480            "MARKET_PEG" => Ok(Self::MarketPeg),
3481            other => Err(format!("invalid OrderTestPegPriceTypeEnum: {}", other).into()),
3482        }
3483    }
3484}
3485
3486#[allow(non_camel_case_types)]
3487#[derive(Debug, Clone, Serialize, Deserialize)]
3488pub enum OrderTestPegOffsetTypeEnum {
3489    #[serde(rename = "PRICE_LEVEL")]
3490    PriceLevel,
3491}
3492
3493impl OrderTestPegOffsetTypeEnum {
3494    #[must_use]
3495    pub fn as_str(&self) -> &'static str {
3496        match self {
3497            Self::PriceLevel => "PRICE_LEVEL",
3498        }
3499    }
3500}
3501
3502impl std::str::FromStr for OrderTestPegOffsetTypeEnum {
3503    type Err = Box<dyn std::error::Error + Send + Sync>;
3504
3505    fn from_str(s: &str) -> Result<Self, Self::Err> {
3506        match s {
3507            "PRICE_LEVEL" => Ok(Self::PriceLevel),
3508            other => Err(format!("invalid OrderTestPegOffsetTypeEnum: {}", other).into()),
3509        }
3510    }
3511}
3512
3513#[allow(non_camel_case_types)]
3514#[derive(Debug, Clone, Serialize, Deserialize)]
3515pub enum SorOrderSideEnum {
3516    #[serde(rename = "BUY")]
3517    Buy,
3518    #[serde(rename = "SELL")]
3519    Sell,
3520}
3521
3522impl SorOrderSideEnum {
3523    #[must_use]
3524    pub fn as_str(&self) -> &'static str {
3525        match self {
3526            Self::Buy => "BUY",
3527            Self::Sell => "SELL",
3528        }
3529    }
3530}
3531
3532impl std::str::FromStr for SorOrderSideEnum {
3533    type Err = Box<dyn std::error::Error + Send + Sync>;
3534
3535    fn from_str(s: &str) -> Result<Self, Self::Err> {
3536        match s {
3537            "BUY" => Ok(Self::Buy),
3538            "SELL" => Ok(Self::Sell),
3539            other => Err(format!("invalid SorOrderSideEnum: {}", other).into()),
3540        }
3541    }
3542}
3543
3544#[allow(non_camel_case_types)]
3545#[derive(Debug, Clone, Serialize, Deserialize)]
3546pub enum SorOrderTypeEnum {
3547    #[serde(rename = "MARKET")]
3548    Market,
3549    #[serde(rename = "LIMIT")]
3550    Limit,
3551}
3552
3553impl SorOrderTypeEnum {
3554    #[must_use]
3555    pub fn as_str(&self) -> &'static str {
3556        match self {
3557            Self::Market => "MARKET",
3558            Self::Limit => "LIMIT",
3559        }
3560    }
3561}
3562
3563impl std::str::FromStr for SorOrderTypeEnum {
3564    type Err = Box<dyn std::error::Error + Send + Sync>;
3565
3566    fn from_str(s: &str) -> Result<Self, Self::Err> {
3567        match s {
3568            "MARKET" => Ok(Self::Market),
3569            "LIMIT" => Ok(Self::Limit),
3570            other => Err(format!("invalid SorOrderTypeEnum: {}", other).into()),
3571        }
3572    }
3573}
3574
3575#[allow(non_camel_case_types)]
3576#[derive(Debug, Clone, Serialize, Deserialize)]
3577pub enum SorOrderTimeInForceEnum {
3578    #[serde(rename = "GTC")]
3579    Gtc,
3580    #[serde(rename = "IOC")]
3581    Ioc,
3582    #[serde(rename = "FOK")]
3583    Fok,
3584}
3585
3586impl SorOrderTimeInForceEnum {
3587    #[must_use]
3588    pub fn as_str(&self) -> &'static str {
3589        match self {
3590            Self::Gtc => "GTC",
3591            Self::Ioc => "IOC",
3592            Self::Fok => "FOK",
3593        }
3594    }
3595}
3596
3597impl std::str::FromStr for SorOrderTimeInForceEnum {
3598    type Err = Box<dyn std::error::Error + Send + Sync>;
3599
3600    fn from_str(s: &str) -> Result<Self, Self::Err> {
3601        match s {
3602            "GTC" => Ok(Self::Gtc),
3603            "IOC" => Ok(Self::Ioc),
3604            "FOK" => Ok(Self::Fok),
3605            other => Err(format!("invalid SorOrderTimeInForceEnum: {}", other).into()),
3606        }
3607    }
3608}
3609
3610#[allow(non_camel_case_types)]
3611#[derive(Debug, Clone, Serialize, Deserialize)]
3612pub enum SorOrderNewOrderRespTypeEnum {
3613    #[serde(rename = "ACK")]
3614    Ack,
3615    #[serde(rename = "RESULT")]
3616    Result,
3617    #[serde(rename = "FULL")]
3618    Full,
3619}
3620
3621impl SorOrderNewOrderRespTypeEnum {
3622    #[must_use]
3623    pub fn as_str(&self) -> &'static str {
3624        match self {
3625            Self::Ack => "ACK",
3626            Self::Result => "RESULT",
3627            Self::Full => "FULL",
3628        }
3629    }
3630}
3631
3632impl std::str::FromStr for SorOrderNewOrderRespTypeEnum {
3633    type Err = Box<dyn std::error::Error + Send + Sync>;
3634
3635    fn from_str(s: &str) -> Result<Self, Self::Err> {
3636        match s {
3637            "ACK" => Ok(Self::Ack),
3638            "RESULT" => Ok(Self::Result),
3639            "FULL" => Ok(Self::Full),
3640            other => Err(format!("invalid SorOrderNewOrderRespTypeEnum: {}", other).into()),
3641        }
3642    }
3643}
3644
3645#[allow(non_camel_case_types)]
3646#[derive(Debug, Clone, Serialize, Deserialize)]
3647pub enum SorOrderSelfTradePreventionModeEnum {
3648    #[serde(rename = "NONE")]
3649    None,
3650    #[serde(rename = "EXPIRE_TAKER")]
3651    ExpireTaker,
3652    #[serde(rename = "EXPIRE_MAKER")]
3653    ExpireMaker,
3654    #[serde(rename = "EXPIRE_BOTH")]
3655    ExpireBoth,
3656    #[serde(rename = "DECREMENT")]
3657    Decrement,
3658    #[serde(rename = "TRANSFER")]
3659    Transfer,
3660}
3661
3662impl SorOrderSelfTradePreventionModeEnum {
3663    #[must_use]
3664    pub fn as_str(&self) -> &'static str {
3665        match self {
3666            Self::None => "NONE",
3667            Self::ExpireTaker => "EXPIRE_TAKER",
3668            Self::ExpireMaker => "EXPIRE_MAKER",
3669            Self::ExpireBoth => "EXPIRE_BOTH",
3670            Self::Decrement => "DECREMENT",
3671            Self::Transfer => "TRANSFER",
3672        }
3673    }
3674}
3675
3676impl std::str::FromStr for SorOrderSelfTradePreventionModeEnum {
3677    type Err = Box<dyn std::error::Error + Send + Sync>;
3678
3679    fn from_str(s: &str) -> Result<Self, Self::Err> {
3680        match s {
3681            "NONE" => Ok(Self::None),
3682            "EXPIRE_TAKER" => Ok(Self::ExpireTaker),
3683            "EXPIRE_MAKER" => Ok(Self::ExpireMaker),
3684            "EXPIRE_BOTH" => Ok(Self::ExpireBoth),
3685            "DECREMENT" => Ok(Self::Decrement),
3686            "TRANSFER" => Ok(Self::Transfer),
3687            other => Err(format!("invalid SorOrderSelfTradePreventionModeEnum: {}", other).into()),
3688        }
3689    }
3690}
3691
3692#[allow(non_camel_case_types)]
3693#[derive(Debug, Clone, Serialize, Deserialize)]
3694pub enum SorOrderTestSideEnum {
3695    #[serde(rename = "BUY")]
3696    Buy,
3697    #[serde(rename = "SELL")]
3698    Sell,
3699}
3700
3701impl SorOrderTestSideEnum {
3702    #[must_use]
3703    pub fn as_str(&self) -> &'static str {
3704        match self {
3705            Self::Buy => "BUY",
3706            Self::Sell => "SELL",
3707        }
3708    }
3709}
3710
3711impl std::str::FromStr for SorOrderTestSideEnum {
3712    type Err = Box<dyn std::error::Error + Send + Sync>;
3713
3714    fn from_str(s: &str) -> Result<Self, Self::Err> {
3715        match s {
3716            "BUY" => Ok(Self::Buy),
3717            "SELL" => Ok(Self::Sell),
3718            other => Err(format!("invalid SorOrderTestSideEnum: {}", other).into()),
3719        }
3720    }
3721}
3722
3723#[allow(non_camel_case_types)]
3724#[derive(Debug, Clone, Serialize, Deserialize)]
3725pub enum SorOrderTestTypeEnum {
3726    #[serde(rename = "MARKET")]
3727    Market,
3728    #[serde(rename = "LIMIT")]
3729    Limit,
3730}
3731
3732impl SorOrderTestTypeEnum {
3733    #[must_use]
3734    pub fn as_str(&self) -> &'static str {
3735        match self {
3736            Self::Market => "MARKET",
3737            Self::Limit => "LIMIT",
3738        }
3739    }
3740}
3741
3742impl std::str::FromStr for SorOrderTestTypeEnum {
3743    type Err = Box<dyn std::error::Error + Send + Sync>;
3744
3745    fn from_str(s: &str) -> Result<Self, Self::Err> {
3746        match s {
3747            "MARKET" => Ok(Self::Market),
3748            "LIMIT" => Ok(Self::Limit),
3749            other => Err(format!("invalid SorOrderTestTypeEnum: {}", other).into()),
3750        }
3751    }
3752}
3753
3754#[allow(non_camel_case_types)]
3755#[derive(Debug, Clone, Serialize, Deserialize)]
3756pub enum SorOrderTestTimeInForceEnum {
3757    #[serde(rename = "GTC")]
3758    Gtc,
3759    #[serde(rename = "IOC")]
3760    Ioc,
3761    #[serde(rename = "FOK")]
3762    Fok,
3763}
3764
3765impl SorOrderTestTimeInForceEnum {
3766    #[must_use]
3767    pub fn as_str(&self) -> &'static str {
3768        match self {
3769            Self::Gtc => "GTC",
3770            Self::Ioc => "IOC",
3771            Self::Fok => "FOK",
3772        }
3773    }
3774}
3775
3776impl std::str::FromStr for SorOrderTestTimeInForceEnum {
3777    type Err = Box<dyn std::error::Error + Send + Sync>;
3778
3779    fn from_str(s: &str) -> Result<Self, Self::Err> {
3780        match s {
3781            "GTC" => Ok(Self::Gtc),
3782            "IOC" => Ok(Self::Ioc),
3783            "FOK" => Ok(Self::Fok),
3784            other => Err(format!("invalid SorOrderTestTimeInForceEnum: {}", other).into()),
3785        }
3786    }
3787}
3788
3789#[allow(non_camel_case_types)]
3790#[derive(Debug, Clone, Serialize, Deserialize)]
3791pub enum SorOrderTestNewOrderRespTypeEnum {
3792    #[serde(rename = "ACK")]
3793    Ack,
3794    #[serde(rename = "RESULT")]
3795    Result,
3796    #[serde(rename = "FULL")]
3797    Full,
3798}
3799
3800impl SorOrderTestNewOrderRespTypeEnum {
3801    #[must_use]
3802    pub fn as_str(&self) -> &'static str {
3803        match self {
3804            Self::Ack => "ACK",
3805            Self::Result => "RESULT",
3806            Self::Full => "FULL",
3807        }
3808    }
3809}
3810
3811impl std::str::FromStr for SorOrderTestNewOrderRespTypeEnum {
3812    type Err = Box<dyn std::error::Error + Send + Sync>;
3813
3814    fn from_str(s: &str) -> Result<Self, Self::Err> {
3815        match s {
3816            "ACK" => Ok(Self::Ack),
3817            "RESULT" => Ok(Self::Result),
3818            "FULL" => Ok(Self::Full),
3819            other => Err(format!("invalid SorOrderTestNewOrderRespTypeEnum: {}", other).into()),
3820        }
3821    }
3822}
3823
3824#[allow(non_camel_case_types)]
3825#[derive(Debug, Clone, Serialize, Deserialize)]
3826pub enum SorOrderTestSelfTradePreventionModeEnum {
3827    #[serde(rename = "NONE")]
3828    None,
3829    #[serde(rename = "EXPIRE_TAKER")]
3830    ExpireTaker,
3831    #[serde(rename = "EXPIRE_MAKER")]
3832    ExpireMaker,
3833    #[serde(rename = "EXPIRE_BOTH")]
3834    ExpireBoth,
3835    #[serde(rename = "DECREMENT")]
3836    Decrement,
3837    #[serde(rename = "TRANSFER")]
3838    Transfer,
3839}
3840
3841impl SorOrderTestSelfTradePreventionModeEnum {
3842    #[must_use]
3843    pub fn as_str(&self) -> &'static str {
3844        match self {
3845            Self::None => "NONE",
3846            Self::ExpireTaker => "EXPIRE_TAKER",
3847            Self::ExpireMaker => "EXPIRE_MAKER",
3848            Self::ExpireBoth => "EXPIRE_BOTH",
3849            Self::Decrement => "DECREMENT",
3850            Self::Transfer => "TRANSFER",
3851        }
3852    }
3853}
3854
3855impl std::str::FromStr for SorOrderTestSelfTradePreventionModeEnum {
3856    type Err = Box<dyn std::error::Error + Send + Sync>;
3857
3858    fn from_str(s: &str) -> Result<Self, Self::Err> {
3859        match s {
3860            "NONE" => Ok(Self::None),
3861            "EXPIRE_TAKER" => Ok(Self::ExpireTaker),
3862            "EXPIRE_MAKER" => Ok(Self::ExpireMaker),
3863            "EXPIRE_BOTH" => Ok(Self::ExpireBoth),
3864            "DECREMENT" => Ok(Self::Decrement),
3865            "TRANSFER" => Ok(Self::Transfer),
3866            other => {
3867                Err(format!("invalid SorOrderTestSelfTradePreventionModeEnum: {}", other).into())
3868            }
3869        }
3870    }
3871}
3872
3873/// Request parameters for the [`delete_open_orders`] operation.
3874///
3875/// This struct holds all of the inputs you can pass when calling
3876/// [`delete_open_orders`](#method.delete_open_orders).
3877#[derive(Clone, Debug, Builder, Deserialize)]
3878#[builder(pattern = "owned", build_fn(error = "ParamBuildError"))]
3879pub struct DeleteOpenOrdersParams {
3880    ///
3881    /// The `symbol` parameter.
3882    ///
3883    /// This field is **required.
3884    #[builder(setter(into))]
3885    #[serde(rename = "symbol")]
3886    pub symbol: String,
3887    /// Supports up to three decimal places of precision (e.g., 6000.346) so that microseconds may be specified.
3888    ///
3889    /// This field is **optional.
3890    #[builder(setter(into), default)]
3891    #[serde(rename = "recvWindow", default)]
3892    pub recv_window: Option<rust_decimal::Decimal>,
3893}
3894
3895impl DeleteOpenOrdersParams {
3896    /// Create a builder for [`delete_open_orders`].
3897    ///
3898    /// Required parameters:
3899    ///
3900    /// * `symbol` — String
3901    ///
3902    #[must_use]
3903    pub fn builder(symbol: String) -> DeleteOpenOrdersParamsBuilder {
3904        DeleteOpenOrdersParamsBuilder::default().symbol(symbol)
3905    }
3906}
3907/// Request parameters for the [`delete_order`] operation.
3908///
3909/// This struct holds all of the inputs you can pass when calling
3910/// [`delete_order`](#method.delete_order).
3911#[derive(Clone, Debug, Builder, Deserialize)]
3912#[builder(pattern = "owned", build_fn(error = "ParamBuildError"))]
3913pub struct DeleteOrderParams {
3914    ///
3915    /// The `symbol` parameter.
3916    ///
3917    /// This field is **required.
3918    #[builder(setter(into))]
3919    #[serde(rename = "symbol")]
3920    pub symbol: String,
3921    ///
3922    /// The `order_id` parameter.
3923    ///
3924    /// This field is **optional.
3925    #[builder(setter(into), default)]
3926    #[serde(rename = "orderId", default)]
3927    pub order_id: Option<i64>,
3928    ///
3929    /// The `orig_client_order_id` parameter.
3930    ///
3931    /// This field is **optional.
3932    #[builder(setter(into), default)]
3933    #[serde(rename = "origClientOrderId", default)]
3934    pub orig_client_order_id: Option<String>,
3935    /// Used to uniquely identify this cancel. Automatically generated by default.
3936    ///
3937    /// This field is **optional.
3938    #[builder(setter(into), default)]
3939    #[serde(rename = "newClientOrderId", default)]
3940    pub new_client_order_id: Option<String>,
3941    /// Supported values: <br>`ONLY_NEW` - Cancel will succeed if the order status is `NEW`.<br> `ONLY_PARTIALLY_FILLED` - Cancel will succeed if order status is `PARTIALLY_FILLED`.
3942    ///
3943    /// This field is **optional.
3944    #[builder(setter(into), default)]
3945    #[serde(rename = "cancelRestrictions", default)]
3946    pub cancel_restrictions: Option<DeleteOrderCancelRestrictionsEnum>,
3947    /// Supports up to three decimal places of precision (e.g., 6000.346) so that microseconds may be specified.
3948    ///
3949    /// This field is **optional.
3950    #[builder(setter(into), default)]
3951    #[serde(rename = "recvWindow", default)]
3952    pub recv_window: Option<rust_decimal::Decimal>,
3953}
3954
3955impl DeleteOrderParams {
3956    /// Create a builder for [`delete_order`].
3957    ///
3958    /// Required parameters:
3959    ///
3960    /// * `symbol` — String
3961    ///
3962    #[must_use]
3963    pub fn builder(symbol: String) -> DeleteOrderParamsBuilder {
3964        DeleteOrderParamsBuilder::default().symbol(symbol)
3965    }
3966}
3967/// Request parameters for the [`delete_order_list`] operation.
3968///
3969/// This struct holds all of the inputs you can pass when calling
3970/// [`delete_order_list`](#method.delete_order_list).
3971#[derive(Clone, Debug, Builder, Deserialize)]
3972#[builder(pattern = "owned", build_fn(error = "ParamBuildError"))]
3973pub struct DeleteOrderListParams {
3974    ///
3975    /// The `symbol` parameter.
3976    ///
3977    /// This field is **required.
3978    #[builder(setter(into))]
3979    #[serde(rename = "symbol")]
3980    pub symbol: String,
3981    /// Either `orderListId` or `listClientOrderId` must be provided
3982    ///
3983    /// This field is **optional.
3984    #[builder(setter(into), default)]
3985    #[serde(rename = "orderListId", default)]
3986    pub order_list_id: Option<i64>,
3987    /// Either `orderListId` or `listClientOrderId` must be provided
3988    ///
3989    /// This field is **optional.
3990    #[builder(setter(into), default)]
3991    #[serde(rename = "listClientOrderId", default)]
3992    pub list_client_order_id: Option<String>,
3993    /// Used to uniquely identify this cancel. Automatically generated by default.
3994    ///
3995    /// This field is **optional.
3996    #[builder(setter(into), default)]
3997    #[serde(rename = "newClientOrderId", default)]
3998    pub new_client_order_id: Option<String>,
3999    /// Supports up to three decimal places of precision (e.g., 6000.346) so that microseconds may be specified.
4000    ///
4001    /// This field is **optional.
4002    #[builder(setter(into), default)]
4003    #[serde(rename = "recvWindow", default)]
4004    pub recv_window: Option<rust_decimal::Decimal>,
4005}
4006
4007impl DeleteOrderListParams {
4008    /// Create a builder for [`delete_order_list`].
4009    ///
4010    /// Required parameters:
4011    ///
4012    /// * `symbol` — String
4013    ///
4014    #[must_use]
4015    pub fn builder(symbol: String) -> DeleteOrderListParamsBuilder {
4016        DeleteOrderListParamsBuilder::default().symbol(symbol)
4017    }
4018}
4019/// Request parameters for the [`new_order`] operation.
4020///
4021/// This struct holds all of the inputs you can pass when calling
4022/// [`new_order`](#method.new_order).
4023#[derive(Clone, Debug, Builder, Deserialize)]
4024#[builder(pattern = "owned", build_fn(error = "ParamBuildError"))]
4025pub struct NewOrderParams {
4026    ///
4027    /// The `symbol` parameter.
4028    ///
4029    /// This field is **required.
4030    #[builder(setter(into))]
4031    #[serde(rename = "symbol")]
4032    pub symbol: String,
4033    /// Please see [Enums](/products/spot/enums#side) for supported values.
4034    ///
4035    /// This field is **required.
4036    #[builder(setter(into))]
4037    #[serde(rename = "side")]
4038    pub side: NewOrderSideEnum,
4039    /// Please see [Enums](/products/spot/enums#ordertypes) for supported values.
4040    ///
4041    /// This field is **required.
4042    #[builder(setter(into))]
4043    #[serde(rename = "type")]
4044    pub r#type: NewOrderTypeEnum,
4045    /// Please see [Enums](/products/spot/enums#timeinforce) for supported values.
4046    ///
4047    /// This field is **optional.
4048    #[builder(setter(into), default)]
4049    #[serde(rename = "timeInForce", default)]
4050    pub time_in_force: Option<NewOrderTimeInForceEnum>,
4051    ///
4052    /// The `quantity` parameter.
4053    ///
4054    /// This field is **optional.
4055    #[builder(setter(into), default)]
4056    #[serde(rename = "quantity", default)]
4057    pub quantity: Option<rust_decimal::Decimal>,
4058    ///
4059    /// The `quote_order_qty` parameter.
4060    ///
4061    /// This field is **optional.
4062    #[builder(setter(into), default)]
4063    #[serde(rename = "quoteOrderQty", default)]
4064    pub quote_order_qty: Option<rust_decimal::Decimal>,
4065    ///
4066    /// The `price` parameter.
4067    ///
4068    /// This field is **optional.
4069    #[builder(setter(into), default)]
4070    #[serde(rename = "price", default)]
4071    pub price: Option<rust_decimal::Decimal>,
4072    /// A unique id among open orders. Automatically generated if not sent.<br/> Orders with the same `newClientOrderID` can be accepted only when the previous one is filled, otherwise the order will be rejected.
4073    ///
4074    /// This field is **optional.
4075    #[builder(setter(into), default)]
4076    #[serde(rename = "newClientOrderId", default)]
4077    pub new_client_order_id: Option<String>,
4078    ///
4079    /// The `strategy_id` parameter.
4080    ///
4081    /// This field is **optional.
4082    #[builder(setter(into), default)]
4083    #[serde(rename = "strategyId", default)]
4084    pub strategy_id: Option<i64>,
4085    /// The value cannot be less than `1000000`.
4086    ///
4087    /// This field is **optional.
4088    #[builder(setter(into), default)]
4089    #[serde(rename = "strategyType", default)]
4090    pub strategy_type: Option<i32>,
4091    /// Used with `STOP_LOSS`, `STOP_LOSS_LIMIT`, `TAKE_PROFIT`, and `TAKE_PROFIT_LIMIT` orders.
4092    ///
4093    /// This field is **optional.
4094    #[builder(setter(into), default)]
4095    #[serde(rename = "stopPrice", default)]
4096    pub stop_price: Option<rust_decimal::Decimal>,
4097    /// See Trailing Stop order FAQ
4098    ///
4099    /// This field is **optional.
4100    #[builder(setter(into), default)]
4101    #[serde(rename = "trailingDelta", default)]
4102    pub trailing_delta: Option<i64>,
4103    /// Used with `LIMIT`, `STOP_LOSS_LIMIT`, and `TAKE_PROFIT_LIMIT` to create an iceberg order.
4104    ///
4105    /// This field is **optional.
4106    #[builder(setter(into), default)]
4107    #[serde(rename = "icebergQty", default)]
4108    pub iceberg_qty: Option<rust_decimal::Decimal>,
4109    /// `MARKET` and `LIMIT` order types default to `FULL`, all other orders default to `ACK`.
4110    ///
4111    /// This field is **optional.
4112    #[builder(setter(into), default)]
4113    #[serde(rename = "newOrderRespType", default)]
4114    pub new_order_resp_type: Option<NewOrderNewOrderRespTypeEnum>,
4115    /// The allowed enums is dependent on what is configured on the symbol.
4116    ///
4117    /// This field is **optional.
4118    #[builder(setter(into), default)]
4119    #[serde(rename = "selfTradePreventionMode", default)]
4120    pub self_trade_prevention_mode: Option<NewOrderSelfTradePreventionModeEnum>,
4121    /// See Pegged Orders Info
4122    ///
4123    /// This field is **optional.
4124    #[builder(setter(into), default)]
4125    #[serde(rename = "pegPriceType", default)]
4126    pub peg_price_type: Option<NewOrderPegPriceTypeEnum>,
4127    /// Price level to peg the price to (max: 100). See Pegged Orders Info
4128    ///
4129    /// This field is **optional.
4130    #[builder(setter(into), default)]
4131    #[serde(rename = "pegOffsetValue", default)]
4132    pub peg_offset_value: Option<i32>,
4133    /// Only `PRICE_LEVEL` is supported. See Pegged Orders Info
4134    ///
4135    /// This field is **optional.
4136    #[builder(setter(into), default)]
4137    #[serde(rename = "pegOffsetType", default)]
4138    pub peg_offset_type: Option<NewOrderPegOffsetTypeEnum>,
4139    /// Supports up to three decimal places of precision (e.g., 6000.346) so that microseconds may be specified.
4140    ///
4141    /// This field is **optional.
4142    #[builder(setter(into), default)]
4143    #[serde(rename = "recvWindow", default)]
4144    pub recv_window: Option<rust_decimal::Decimal>,
4145}
4146
4147impl NewOrderParams {
4148    /// Create a builder for [`new_order`].
4149    ///
4150    /// Required parameters:
4151    ///
4152    /// * `symbol` — String
4153    /// * `side` — Please see [Enums](/products/spot/enums#side) for supported values.
4154    /// * `r#type` — Please see [Enums](/products/spot/enums#ordertypes) for supported values.
4155    ///
4156    #[must_use]
4157    pub fn builder(
4158        symbol: String,
4159        side: NewOrderSideEnum,
4160        r#type: NewOrderTypeEnum,
4161    ) -> NewOrderParamsBuilder {
4162        NewOrderParamsBuilder::default()
4163            .symbol(symbol)
4164            .side(side)
4165            .r#type(r#type)
4166    }
4167}
4168/// Request parameters for the [`order_amend_keep_priority`] operation.
4169///
4170/// This struct holds all of the inputs you can pass when calling
4171/// [`order_amend_keep_priority`](#method.order_amend_keep_priority).
4172#[derive(Clone, Debug, Builder, Deserialize)]
4173#[builder(pattern = "owned", build_fn(error = "ParamBuildError"))]
4174pub struct OrderAmendKeepPriorityParams {
4175    ///
4176    /// The `symbol` parameter.
4177    ///
4178    /// This field is **required.
4179    #[builder(setter(into))]
4180    #[serde(rename = "symbol")]
4181    pub symbol: String,
4182    /// `newQty` must be greater than 0 and less than the order's quantity.
4183    ///
4184    /// This field is **required.
4185    #[builder(setter(into))]
4186    #[serde(rename = "newQty")]
4187    pub new_qty: rust_decimal::Decimal,
4188    /// `orderId` or `origClientOrderId` must be sent
4189    ///
4190    /// This field is **optional.
4191    #[builder(setter(into), default)]
4192    #[serde(rename = "orderId", default)]
4193    pub order_id: Option<i64>,
4194    /// `orderId` or `origClientOrderId` must be sent
4195    ///
4196    /// This field is **optional.
4197    #[builder(setter(into), default)]
4198    #[serde(rename = "origClientOrderId", default)]
4199    pub orig_client_order_id: Option<String>,
4200    /// The new client order ID for the order after being amended. <br> If not sent, one will be randomly generated. <br> It is possible to reuse the current clientOrderId by sending it as the `newClientOrderId`.
4201    ///
4202    /// This field is **optional.
4203    #[builder(setter(into), default)]
4204    #[serde(rename = "newClientOrderId", default)]
4205    pub new_client_order_id: Option<String>,
4206    /// The value cannot be greater than `60000`. <br> Supports up to three decimal places of precision (e.g., 6000.346) so that microseconds may be specified.
4207    ///
4208    /// This field is **optional.
4209    #[builder(setter(into), default)]
4210    #[serde(rename = "recvWindow", default)]
4211    pub recv_window: Option<rust_decimal::Decimal>,
4212}
4213
4214impl OrderAmendKeepPriorityParams {
4215    /// Create a builder for [`order_amend_keep_priority`].
4216    ///
4217    /// Required parameters:
4218    ///
4219    /// * `symbol` — String
4220    /// * `new_qty` — `newQty` must be greater than 0 and less than the order's quantity.
4221    ///
4222    #[must_use]
4223    pub fn builder(
4224        symbol: String,
4225        new_qty: rust_decimal::Decimal,
4226    ) -> OrderAmendKeepPriorityParamsBuilder {
4227        OrderAmendKeepPriorityParamsBuilder::default()
4228            .symbol(symbol)
4229            .new_qty(new_qty)
4230    }
4231}
4232/// Request parameters for the [`order_cancel_replace`] operation.
4233///
4234/// This struct holds all of the inputs you can pass when calling
4235/// [`order_cancel_replace`](#method.order_cancel_replace).
4236#[derive(Clone, Debug, Builder, Deserialize)]
4237#[builder(pattern = "owned", build_fn(error = "ParamBuildError"))]
4238pub struct OrderCancelReplaceParams {
4239    ///
4240    /// The `symbol` parameter.
4241    ///
4242    /// This field is **required.
4243    #[builder(setter(into))]
4244    #[serde(rename = "symbol")]
4245    pub symbol: String,
4246    ///
4247    /// The `side` parameter.
4248    ///
4249    /// This field is **required.
4250    #[builder(setter(into))]
4251    #[serde(rename = "side")]
4252    pub side: OrderCancelReplaceSideEnum,
4253    ///
4254    /// The `r#type` parameter.
4255    ///
4256    /// This field is **required.
4257    #[builder(setter(into))]
4258    #[serde(rename = "type")]
4259    pub r#type: OrderCancelReplaceTypeEnum,
4260    /// The allowed values are: <br/> `STOP_ON_FAILURE` - If the cancel request fails, the new order placement will not be attempted. <br/> `ALLOW_FAILURE` - new order placement will be attempted even if cancel request fails.
4261    ///
4262    /// This field is **required.
4263    #[builder(setter(into))]
4264    #[serde(rename = "cancelReplaceMode")]
4265    pub cancel_replace_mode: OrderCancelReplaceCancelReplaceModeEnum,
4266    ///
4267    /// The `time_in_force` parameter.
4268    ///
4269    /// This field is **optional.
4270    #[builder(setter(into), default)]
4271    #[serde(rename = "timeInForce", default)]
4272    pub time_in_force: Option<OrderCancelReplaceTimeInForceEnum>,
4273    ///
4274    /// The `quantity` parameter.
4275    ///
4276    /// This field is **optional.
4277    #[builder(setter(into), default)]
4278    #[serde(rename = "quantity", default)]
4279    pub quantity: Option<rust_decimal::Decimal>,
4280    ///
4281    /// The `quote_order_qty` parameter.
4282    ///
4283    /// This field is **optional.
4284    #[builder(setter(into), default)]
4285    #[serde(rename = "quoteOrderQty", default)]
4286    pub quote_order_qty: Option<rust_decimal::Decimal>,
4287    ///
4288    /// The `price` parameter.
4289    ///
4290    /// This field is **optional.
4291    #[builder(setter(into), default)]
4292    #[serde(rename = "price", default)]
4293    pub price: Option<rust_decimal::Decimal>,
4294    /// Used to uniquely identify this cancel. Automatically generated by default.
4295    ///
4296    /// This field is **optional.
4297    #[builder(setter(into), default)]
4298    #[serde(rename = "cancelNewClientOrderId", default)]
4299    pub cancel_new_client_order_id: Option<String>,
4300    /// Either `cancelOrderId` or `cancelOrigClientOrderId` must be sent. <br></br> If both `cancelOrderId` and `cancelOrigClientOrderId` parameters are provided, the `cancelOrderId` is searched first, then the `cancelOrigClientOrderId` from that result is checked against that order. <br></br> If both conditions are not met the request will be rejected.
4301    ///
4302    /// This field is **optional.
4303    #[builder(setter(into), default)]
4304    #[serde(rename = "cancelOrigClientOrderId", default)]
4305    pub cancel_orig_client_order_id: Option<String>,
4306    /// Either `cancelOrderId` or `cancelOrigClientOrderId` must be sent. <br></br>If both `cancelOrderId` and `cancelOrigClientOrderId` parameters are provided, the `cancelOrderId` is searched first, then the `cancelOrigClientOrderId` from that result is checked against that order. <br></br>If both conditions are not met the request will be rejected.
4307    ///
4308    /// This field is **optional.
4309    #[builder(setter(into), default)]
4310    #[serde(rename = "cancelOrderId", default)]
4311    pub cancel_order_id: Option<i64>,
4312    /// Used to identify the new order.
4313    ///
4314    /// This field is **optional.
4315    #[builder(setter(into), default)]
4316    #[serde(rename = "newClientOrderId", default)]
4317    pub new_client_order_id: Option<String>,
4318    ///
4319    /// The `strategy_id` parameter.
4320    ///
4321    /// This field is **optional.
4322    #[builder(setter(into), default)]
4323    #[serde(rename = "strategyId", default)]
4324    pub strategy_id: Option<i64>,
4325    /// The value cannot be less than `1000000`.
4326    ///
4327    /// This field is **optional.
4328    #[builder(setter(into), default)]
4329    #[serde(rename = "strategyType", default)]
4330    pub strategy_type: Option<i32>,
4331    ///
4332    /// The `stop_price` parameter.
4333    ///
4334    /// This field is **optional.
4335    #[builder(setter(into), default)]
4336    #[serde(rename = "stopPrice", default)]
4337    pub stop_price: Option<rust_decimal::Decimal>,
4338    /// See [Trailing Stop order FAQ](/products/spot/faqs/trailing-stop-faq)
4339    ///
4340    /// This field is **optional.
4341    #[builder(setter(into), default)]
4342    #[serde(rename = "trailingDelta", default)]
4343    pub trailing_delta: Option<i64>,
4344    ///
4345    /// The `iceberg_qty` parameter.
4346    ///
4347    /// This field is **optional.
4348    #[builder(setter(into), default)]
4349    #[serde(rename = "icebergQty", default)]
4350    pub iceberg_qty: Option<rust_decimal::Decimal>,
4351    /// Allowed values: <br/> `ACK`, `RESULT`, `FULL` <br/> `MARKET` and `LIMIT` orders types default to `FULL`; all other orders default to `ACK`
4352    ///
4353    /// This field is **optional.
4354    #[builder(setter(into), default)]
4355    #[serde(rename = "newOrderRespType", default)]
4356    pub new_order_resp_type: Option<OrderCancelReplaceNewOrderRespTypeEnum>,
4357    /// The allowed enums is dependent on what is configured on the symbol. The possible supported values are: [STP Modes](/products/spot/enums#stpmodes).
4358    ///
4359    /// This field is **optional.
4360    #[builder(setter(into), default)]
4361    #[serde(rename = "selfTradePreventionMode", default)]
4362    pub self_trade_prevention_mode: Option<OrderCancelReplaceSelfTradePreventionModeEnum>,
4363    /// Supported values: <br>`ONLY_NEW` - Cancel will succeed if the order status is `NEW`.<br> `ONLY_PARTIALLY_FILLED ` - Cancel will succeed if order status is `PARTIALLY_FILLED`.
4364    ///
4365    /// This field is **optional.
4366    #[builder(setter(into), default)]
4367    #[serde(rename = "cancelRestrictions", default)]
4368    pub cancel_restrictions: Option<OrderCancelReplaceCancelRestrictionsEnum>,
4369    /// Supported values: <br> `DO_NOTHING` (default)- will only attempt to cancel the order if account has not exceeded the unfilled order rate limit<br> `CANCEL_ONLY` - will always cancel the order
4370    ///
4371    /// This field is **optional.
4372    #[builder(setter(into), default)]
4373    #[serde(rename = "orderRateLimitExceededMode", default)]
4374    pub order_rate_limit_exceeded_mode: Option<OrderCancelReplaceOrderRateLimitExceededModeEnum>,
4375    /// `PRIMARY_PEG` or `MARKET_PEG` <br> See Pegged Orders
4376    ///
4377    /// This field is **optional.
4378    #[builder(setter(into), default)]
4379    #[serde(rename = "pegPriceType", default)]
4380    pub peg_price_type: Option<OrderCancelReplacePegPriceTypeEnum>,
4381    /// Price level to peg the price to (max: 100) <br> See Pegged Orders
4382    ///
4383    /// This field is **optional.
4384    #[builder(setter(into), default)]
4385    #[serde(rename = "pegOffsetValue", default)]
4386    pub peg_offset_value: Option<i32>,
4387    /// Only `PRICE_LEVEL` is supported <br> See Pegged Orders.
4388    ///
4389    /// This field is **optional.
4390    #[builder(setter(into), default)]
4391    #[serde(rename = "pegOffsetType", default)]
4392    pub peg_offset_type: Option<OrderCancelReplacePegOffsetTypeEnum>,
4393    /// Supports up to three decimal places of precision (e.g., 6000.346) so that microseconds may be specified.
4394    ///
4395    /// This field is **optional.
4396    #[builder(setter(into), default)]
4397    #[serde(rename = "recvWindow", default)]
4398    pub recv_window: Option<rust_decimal::Decimal>,
4399}
4400
4401impl OrderCancelReplaceParams {
4402    /// Create a builder for [`order_cancel_replace`].
4403    ///
4404    /// Required parameters:
4405    ///
4406    /// * `symbol` — String
4407    /// * `side` — String
4408    /// * `r#type` — String
4409    /// * `cancel_replace_mode` — The allowed values are: <br/> `STOP_ON_FAILURE` - If the cancel request fails, the new order placement will not be attempted. <br/> `ALLOW_FAILURE` - new order placement will be attempted even if cancel request fails.
4410    ///
4411    #[must_use]
4412    pub fn builder(
4413        symbol: String,
4414        side: OrderCancelReplaceSideEnum,
4415        r#type: OrderCancelReplaceTypeEnum,
4416        cancel_replace_mode: OrderCancelReplaceCancelReplaceModeEnum,
4417    ) -> OrderCancelReplaceParamsBuilder {
4418        OrderCancelReplaceParamsBuilder::default()
4419            .symbol(symbol)
4420            .side(side)
4421            .r#type(r#type)
4422            .cancel_replace_mode(cancel_replace_mode)
4423    }
4424}
4425/// Request parameters for the [`order_list_oco`] operation.
4426///
4427/// This struct holds all of the inputs you can pass when calling
4428/// [`order_list_oco`](#method.order_list_oco).
4429#[derive(Clone, Debug, Builder, Deserialize)]
4430#[builder(pattern = "owned", build_fn(error = "ParamBuildError"))]
4431pub struct OrderListOcoParams {
4432    ///
4433    /// The `symbol` parameter.
4434    ///
4435    /// This field is **required.
4436    #[builder(setter(into))]
4437    #[serde(rename = "symbol")]
4438    pub symbol: String,
4439    ///
4440    /// The `side` parameter.
4441    ///
4442    /// This field is **required.
4443    #[builder(setter(into))]
4444    #[serde(rename = "side")]
4445    pub side: OrderListOcoSideEnum,
4446    /// Quantity for both orders of the order list.
4447    ///
4448    /// This field is **required.
4449    #[builder(setter(into))]
4450    #[serde(rename = "quantity")]
4451    pub quantity: rust_decimal::Decimal,
4452    ///
4453    /// The `above_type` parameter.
4454    ///
4455    /// This field is **required.
4456    #[builder(setter(into))]
4457    #[serde(rename = "aboveType")]
4458    pub above_type: OrderListOcoAboveTypeEnum,
4459    /// Supported values: `STOP_LOSS`, `STOP_LOSS_LIMIT`, `TAKE_PROFIT`, `TAKE_PROFIT_LIMIT`
4460    ///
4461    /// This field is **required.
4462    #[builder(setter(into))]
4463    #[serde(rename = "belowType")]
4464    pub below_type: OrderListOcoBelowTypeEnum,
4465    /// Arbitrary unique ID among open order lists. Automatically generated if not sent. A new order list with the same `listClientOrderId` is accepted only when the previous one is filled or completely expired. `listClientOrderId` is distinct from the `aboveClientOrderId` and the `belowClientOrderId`.
4466    ///
4467    /// This field is **optional.
4468    #[builder(setter(into), default)]
4469    #[serde(rename = "listClientOrderId", default)]
4470    pub list_client_order_id: Option<String>,
4471    /// Arbitrary unique ID among open orders for the above order. Automatically generated if not sent.
4472    ///
4473    /// This field is **optional.
4474    #[builder(setter(into), default)]
4475    #[serde(rename = "aboveClientOrderId", default)]
4476    pub above_client_order_id: Option<String>,
4477    /// Note that this can only be used if `aboveTimeInForce` is `GTC`.
4478    ///
4479    /// This field is **optional.
4480    #[builder(setter(into), default)]
4481    #[serde(rename = "aboveIcebergQty", default)]
4482    pub above_iceberg_qty: Option<i64>,
4483    /// Can be used if `aboveType` is `STOP_LOSS_LIMIT`, `LIMIT_MAKER`, or `TAKE_PROFIT_LIMIT` to specify the limit price.
4484    ///
4485    /// This field is **optional.
4486    #[builder(setter(into), default)]
4487    #[serde(rename = "abovePrice", default)]
4488    pub above_price: Option<rust_decimal::Decimal>,
4489    /// Can be used if `aboveType` is `STOP_LOSS`, `STOP_LOSS_LIMIT`, `TAKE_PROFIT`, `TAKE_PROFIT_LIMIT`. Either `aboveStopPrice` or `aboveTrailingDelta` or both, must be specified.
4490    ///
4491    /// This field is **optional.
4492    #[builder(setter(into), default)]
4493    #[serde(rename = "aboveStopPrice", default)]
4494    pub above_stop_price: Option<rust_decimal::Decimal>,
4495    /// See [Trailing Stop order FAQ](/products/spot/faqs/trailing-stop-faq)
4496    ///
4497    /// This field is **optional.
4498    #[builder(setter(into), default)]
4499    #[serde(rename = "aboveTrailingDelta", default)]
4500    pub above_trailing_delta: Option<i64>,
4501    /// Required if `aboveType` is `STOP_LOSS_LIMIT` or `TAKE_PROFIT_LIMIT`.
4502    ///
4503    /// This field is **optional.
4504    #[builder(setter(into), default)]
4505    #[serde(rename = "aboveTimeInForce", default)]
4506    pub above_time_in_force: Option<OrderListOcoAboveTimeInForceEnum>,
4507    /// Arbitrary numeric value identifying the above order within an order strategy.
4508    ///
4509    /// This field is **optional.
4510    #[builder(setter(into), default)]
4511    #[serde(rename = "aboveStrategyId", default)]
4512    pub above_strategy_id: Option<i64>,
4513    /// Arbitrary numeric value identifying the above order strategy. Values smaller than `1000000` are reserved and cannot be used.
4514    ///
4515    /// This field is **optional.
4516    #[builder(setter(into), default)]
4517    #[serde(rename = "aboveStrategyType", default)]
4518    pub above_strategy_type: Option<i32>,
4519    /// `PRIMARY_PEG` or `MARKET_PEG`. See [Pegged Orders](/products/spot/faqs/pegged_orders)
4520    ///
4521    /// This field is **optional.
4522    #[builder(setter(into), default)]
4523    #[serde(rename = "abovePegPriceType", default)]
4524    pub above_peg_price_type: Option<OrderListOcoAbovePegPriceTypeEnum>,
4525    ///
4526    /// The `above_peg_offset_type` parameter.
4527    ///
4528    /// This field is **optional.
4529    #[builder(setter(into), default)]
4530    #[serde(rename = "abovePegOffsetType", default)]
4531    pub above_peg_offset_type: Option<OrderListOcoAbovePegOffsetTypeEnum>,
4532    ///
4533    /// The `above_peg_offset_value` parameter.
4534    ///
4535    /// This field is **optional.
4536    #[builder(setter(into), default)]
4537    #[serde(rename = "abovePegOffsetValue", default)]
4538    pub above_peg_offset_value: Option<i32>,
4539    /// Arbitrary unique ID among open orders for the below order. Automatically generated if not sent.
4540    ///
4541    /// This field is **optional.
4542    #[builder(setter(into), default)]
4543    #[serde(rename = "belowClientOrderId", default)]
4544    pub below_client_order_id: Option<String>,
4545    /// Note that this can only be used if `belowTimeInForce` is `GTC`.
4546    ///
4547    /// This field is **optional.
4548    #[builder(setter(into), default)]
4549    #[serde(rename = "belowIcebergQty", default)]
4550    pub below_iceberg_qty: Option<i64>,
4551    /// Can be used if `belowType` is `STOP_LOSS_LIMIT`, `LIMIT_MAKER`, or `TAKE_PROFIT_LIMIT` to specify the limit price.
4552    ///
4553    /// This field is **optional.
4554    #[builder(setter(into), default)]
4555    #[serde(rename = "belowPrice", default)]
4556    pub below_price: Option<rust_decimal::Decimal>,
4557    /// Can be used if `belowType` is `STOP_LOSS`, `STOP_LOSS_LIMIT`, `TAKE_PROFIT`, `TAKE_PROFIT_LIMIT`. Either `belowStopPrice` or `belowTrailingDelta` or both, must be specified.
4558    ///
4559    /// This field is **optional.
4560    #[builder(setter(into), default)]
4561    #[serde(rename = "belowStopPrice", default)]
4562    pub below_stop_price: Option<rust_decimal::Decimal>,
4563    /// See [Trailing Stop order FAQ](/products/spot/faqs/trailing-stop-faq)
4564    ///
4565    /// This field is **optional.
4566    #[builder(setter(into), default)]
4567    #[serde(rename = "belowTrailingDelta", default)]
4568    pub below_trailing_delta: Option<i64>,
4569    /// Required if `belowType` is `STOP_LOSS_LIMIT` or `TAKE_PROFIT_LIMIT`.
4570    ///
4571    /// This field is **optional.
4572    #[builder(setter(into), default)]
4573    #[serde(rename = "belowTimeInForce", default)]
4574    pub below_time_in_force: Option<OrderListOcoBelowTimeInForceEnum>,
4575    /// Arbitrary numeric value identifying the below order within an order strategy.
4576    ///
4577    /// This field is **optional.
4578    #[builder(setter(into), default)]
4579    #[serde(rename = "belowStrategyId", default)]
4580    pub below_strategy_id: Option<i64>,
4581    /// Arbitrary numeric value identifying the below order strategy. Values smaller than `1000000` are reserved and cannot be used.
4582    ///
4583    /// This field is **optional.
4584    #[builder(setter(into), default)]
4585    #[serde(rename = "belowStrategyType", default)]
4586    pub below_strategy_type: Option<i32>,
4587    /// See [Pegged Orders](/products/spot/faqs/pegged_orders)
4588    ///
4589    /// This field is **optional.
4590    #[builder(setter(into), default)]
4591    #[serde(rename = "belowPegPriceType", default)]
4592    pub below_peg_price_type: Option<OrderListOcoBelowPegPriceTypeEnum>,
4593    ///
4594    /// The `below_peg_offset_type` parameter.
4595    ///
4596    /// This field is **optional.
4597    #[builder(setter(into), default)]
4598    #[serde(rename = "belowPegOffsetType", default)]
4599    pub below_peg_offset_type: Option<OrderListOcoBelowPegOffsetTypeEnum>,
4600    ///
4601    /// The `below_peg_offset_value` parameter.
4602    ///
4603    /// This field is **optional.
4604    #[builder(setter(into), default)]
4605    #[serde(rename = "belowPegOffsetValue", default)]
4606    pub below_peg_offset_value: Option<i32>,
4607    /// Select response format: `ACK`, `RESULT`, `FULL`.
4608    ///
4609    /// This field is **optional.
4610    #[builder(setter(into), default)]
4611    #[serde(rename = "newOrderRespType", default)]
4612    pub new_order_resp_type: Option<OrderListOcoNewOrderRespTypeEnum>,
4613    /// The allowed enums is dependent on what is configured on the symbol. Supported values: [STP Modes](/products/spot/enums#stpmodes)
4614    ///
4615    /// This field is **optional.
4616    #[builder(setter(into), default)]
4617    #[serde(rename = "selfTradePreventionMode", default)]
4618    pub self_trade_prevention_mode: Option<OrderListOcoSelfTradePreventionModeEnum>,
4619    /// The value cannot be greater than `60000`. Supports up to three decimal places of precision (e.g., 6000.346) so that microseconds may be specified.
4620    ///
4621    /// This field is **optional.
4622    #[builder(setter(into), default)]
4623    #[serde(rename = "recvWindow", default)]
4624    pub recv_window: Option<rust_decimal::Decimal>,
4625}
4626
4627impl OrderListOcoParams {
4628    /// Create a builder for [`order_list_oco`].
4629    ///
4630    /// Required parameters:
4631    ///
4632    /// * `symbol` — String
4633    /// * `side` — String
4634    /// * `quantity` — Quantity for both orders of the order list.
4635    /// * `above_type` — String
4636    /// * `below_type` — Supported values: `STOP_LOSS`, `STOP_LOSS_LIMIT`, `TAKE_PROFIT`, `TAKE_PROFIT_LIMIT`
4637    ///
4638    #[must_use]
4639    pub fn builder(
4640        symbol: String,
4641        side: OrderListOcoSideEnum,
4642        quantity: rust_decimal::Decimal,
4643        above_type: OrderListOcoAboveTypeEnum,
4644        below_type: OrderListOcoBelowTypeEnum,
4645    ) -> OrderListOcoParamsBuilder {
4646        OrderListOcoParamsBuilder::default()
4647            .symbol(symbol)
4648            .side(side)
4649            .quantity(quantity)
4650            .above_type(above_type)
4651            .below_type(below_type)
4652    }
4653}
4654/// Request parameters for the [`order_list_opo`] operation.
4655///
4656/// This struct holds all of the inputs you can pass when calling
4657/// [`order_list_opo`](#method.order_list_opo).
4658#[derive(Clone, Debug, Builder, Deserialize)]
4659#[builder(pattern = "owned", build_fn(error = "ParamBuildError"))]
4660pub struct OrderListOpoParams {
4661    ///
4662    /// The `symbol` parameter.
4663    ///
4664    /// This field is **required.
4665    #[builder(setter(into))]
4666    #[serde(rename = "symbol")]
4667    pub symbol: String,
4668    /// Supported values: `LIMIT`, `LIMIT_MAKER`
4669    ///
4670    /// This field is **required.
4671    #[builder(setter(into))]
4672    #[serde(rename = "workingType")]
4673    pub working_type: OrderListOpoWorkingTypeEnum,
4674    /// Supported values: [Order Side](/products/spot/enums#side)
4675    ///
4676    /// This field is **required.
4677    #[builder(setter(into))]
4678    #[serde(rename = "workingSide")]
4679    pub working_side: OrderListOpoWorkingSideEnum,
4680    /// Price for the working order.
4681    ///
4682    /// This field is **required.
4683    #[builder(setter(into))]
4684    #[serde(rename = "workingPrice")]
4685    pub working_price: rust_decimal::Decimal,
4686    /// Sets the quantity for the working order.
4687    ///
4688    /// This field is **required.
4689    #[builder(setter(into))]
4690    #[serde(rename = "workingQuantity")]
4691    pub working_quantity: rust_decimal::Decimal,
4692    /// Supported values: [Order Types](/products/spot/enums#ordertypes). Note that `MARKET` orders using `quoteOrderQty` are not supported.
4693    ///
4694    /// This field is **required.
4695    #[builder(setter(into))]
4696    #[serde(rename = "pendingType")]
4697    pub pending_type: OrderListOpoPendingTypeEnum,
4698    /// Supported values: [Order Side](/products/spot/enums#side)
4699    ///
4700    /// This field is **required.
4701    #[builder(setter(into))]
4702    #[serde(rename = "pendingSide")]
4703    pub pending_side: OrderListOpoPendingSideEnum,
4704    /// Arbitrary unique ID among open order lists. Automatically generated if not sent. A new order list with the same `listClientOrderId` is accepted only when the previous one is filled or completely expired. `listClientOrderId` is distinct from the `workingClientOrderId` and the `pendingClientOrderId`.
4705    ///
4706    /// This field is **optional.
4707    #[builder(setter(into), default)]
4708    #[serde(rename = "listClientOrderId", default)]
4709    pub list_client_order_id: Option<String>,
4710    /// Format of the JSON response. Supported values: [Order Response Type](/products/spot/enums#orderresponsetype)
4711    ///
4712    /// This field is **optional.
4713    #[builder(setter(into), default)]
4714    #[serde(rename = "newOrderRespType", default)]
4715    pub new_order_resp_type: Option<OrderListOpoNewOrderRespTypeEnum>,
4716    /// The allowed enums is dependent on what is configured on the symbol. Supported values: [STP Modes](/products/spot/enums#stpmodes)
4717    ///
4718    /// This field is **optional.
4719    #[builder(setter(into), default)]
4720    #[serde(rename = "selfTradePreventionMode", default)]
4721    pub self_trade_prevention_mode: Option<OrderListOpoSelfTradePreventionModeEnum>,
4722    /// Arbitrary unique ID among open orders for the working order. Automatically generated if not sent.
4723    ///
4724    /// This field is **optional.
4725    #[builder(setter(into), default)]
4726    #[serde(rename = "workingClientOrderId", default)]
4727    pub working_client_order_id: Option<String>,
4728    /// This can only be used if `workingTimeInForce` is `GTC`, or if `workingType` is `LIMIT_MAKER`.
4729    ///
4730    /// This field is **optional.
4731    #[builder(setter(into), default)]
4732    #[serde(rename = "workingIcebergQty", default)]
4733    pub working_iceberg_qty: Option<rust_decimal::Decimal>,
4734    /// Supported values: [Time In Force](/products/spot/enums#timeinforce)
4735    ///
4736    /// This field is **optional.
4737    #[builder(setter(into), default)]
4738    #[serde(rename = "workingTimeInForce", default)]
4739    pub working_time_in_force: Option<OrderListOpoWorkingTimeInForceEnum>,
4740    /// Arbitrary numeric value identifying the working order within an order strategy.
4741    ///
4742    /// This field is **optional.
4743    #[builder(setter(into), default)]
4744    #[serde(rename = "workingStrategyId", default)]
4745    pub working_strategy_id: Option<i64>,
4746    /// Arbitrary numeric value identifying the working order strategy. Values smaller than `1000000` are reserved and cannot be used.
4747    ///
4748    /// This field is **optional.
4749    #[builder(setter(into), default)]
4750    #[serde(rename = "workingStrategyType", default)]
4751    pub working_strategy_type: Option<i32>,
4752    /// See [Pegged Orders](/products/spot/faqs/pegged_orders)
4753    ///
4754    /// This field is **optional.
4755    #[builder(setter(into), default)]
4756    #[serde(rename = "workingPegPriceType", default)]
4757    pub working_peg_price_type: Option<OrderListOpoWorkingPegPriceTypeEnum>,
4758    ///
4759    /// The `working_peg_offset_type` parameter.
4760    ///
4761    /// This field is **optional.
4762    #[builder(setter(into), default)]
4763    #[serde(rename = "workingPegOffsetType", default)]
4764    pub working_peg_offset_type: Option<OrderListOpoWorkingPegOffsetTypeEnum>,
4765    ///
4766    /// The `working_peg_offset_value` parameter.
4767    ///
4768    /// This field is **optional.
4769    #[builder(setter(into), default)]
4770    #[serde(rename = "workingPegOffsetValue", default)]
4771    pub working_peg_offset_value: Option<i32>,
4772    /// Arbitrary unique ID among open orders for the pending order. Automatically generated if not sent.
4773    ///
4774    /// This field is **optional.
4775    #[builder(setter(into), default)]
4776    #[serde(rename = "pendingClientOrderId", default)]
4777    pub pending_client_order_id: Option<String>,
4778    /// Price for the pending order.
4779    ///
4780    /// This field is **optional.
4781    #[builder(setter(into), default)]
4782    #[serde(rename = "pendingPrice", default)]
4783    pub pending_price: Option<rust_decimal::Decimal>,
4784    /// Stop price for the pending order.
4785    ///
4786    /// This field is **optional.
4787    #[builder(setter(into), default)]
4788    #[serde(rename = "pendingStopPrice", default)]
4789    pub pending_stop_price: Option<rust_decimal::Decimal>,
4790    /// Trailing delta for the pending order.
4791    ///
4792    /// This field is **optional.
4793    #[builder(setter(into), default)]
4794    #[serde(rename = "pendingTrailingDelta", default)]
4795    pub pending_trailing_delta: Option<rust_decimal::Decimal>,
4796    /// This can only be used if `pendingTimeInForce` is `GTC` or if `pendingType` is `LIMIT_MAKER`.
4797    ///
4798    /// This field is **optional.
4799    #[builder(setter(into), default)]
4800    #[serde(rename = "pendingIcebergQty", default)]
4801    pub pending_iceberg_qty: Option<rust_decimal::Decimal>,
4802    /// Supported values: [Time In Force](/products/spot/enums#timeinforce)
4803    ///
4804    /// This field is **optional.
4805    #[builder(setter(into), default)]
4806    #[serde(rename = "pendingTimeInForce", default)]
4807    pub pending_time_in_force: Option<OrderListOpoPendingTimeInForceEnum>,
4808    /// Arbitrary numeric value identifying the pending order within an order strategy.
4809    ///
4810    /// This field is **optional.
4811    #[builder(setter(into), default)]
4812    #[serde(rename = "pendingStrategyId", default)]
4813    pub pending_strategy_id: Option<i64>,
4814    /// Arbitrary numeric value identifying the pending order strategy. Values smaller than `1000000` are reserved and cannot be used.
4815    ///
4816    /// This field is **optional.
4817    #[builder(setter(into), default)]
4818    #[serde(rename = "pendingStrategyType", default)]
4819    pub pending_strategy_type: Option<i32>,
4820    /// See [Pegged Orders](/products/spot/faqs/pegged_orders)
4821    ///
4822    /// This field is **optional.
4823    #[builder(setter(into), default)]
4824    #[serde(rename = "pendingPegPriceType", default)]
4825    pub pending_peg_price_type: Option<OrderListOpoPendingPegPriceTypeEnum>,
4826    ///
4827    /// The `pending_peg_offset_type` parameter.
4828    ///
4829    /// This field is **optional.
4830    #[builder(setter(into), default)]
4831    #[serde(rename = "pendingPegOffsetType", default)]
4832    pub pending_peg_offset_type: Option<OrderListOpoPendingPegOffsetTypeEnum>,
4833    ///
4834    /// The `pending_peg_offset_value` parameter.
4835    ///
4836    /// This field is **optional.
4837    #[builder(setter(into), default)]
4838    #[serde(rename = "pendingPegOffsetValue", default)]
4839    pub pending_peg_offset_value: Option<i32>,
4840    /// Supports up to three decimal places of precision (e.g., 6000.346) so that microseconds may be specified.
4841    ///
4842    /// This field is **optional.
4843    #[builder(setter(into), default)]
4844    #[serde(rename = "recvWindow", default)]
4845    pub recv_window: Option<rust_decimal::Decimal>,
4846}
4847
4848impl OrderListOpoParams {
4849    /// Create a builder for [`order_list_opo`].
4850    ///
4851    /// Required parameters:
4852    ///
4853    /// * `symbol` — String
4854    /// * `working_type` — Supported values: `LIMIT`, `LIMIT_MAKER`
4855    /// * `working_side` — Supported values: [Order Side](/products/spot/enums#side)
4856    /// * `working_price` — Price for the working order.
4857    /// * `working_quantity` — Sets the quantity for the working order.
4858    /// * `pending_type` — Supported values: [Order Types](/products/spot/enums#ordertypes). Note that `MARKET` orders using `quoteOrderQty` are not supported.
4859    /// * `pending_side` — Supported values: [Order Side](/products/spot/enums#side)
4860    ///
4861    #[must_use]
4862    pub fn builder(
4863        symbol: String,
4864        working_type: OrderListOpoWorkingTypeEnum,
4865        working_side: OrderListOpoWorkingSideEnum,
4866        working_price: rust_decimal::Decimal,
4867        working_quantity: rust_decimal::Decimal,
4868        pending_type: OrderListOpoPendingTypeEnum,
4869        pending_side: OrderListOpoPendingSideEnum,
4870    ) -> OrderListOpoParamsBuilder {
4871        OrderListOpoParamsBuilder::default()
4872            .symbol(symbol)
4873            .working_type(working_type)
4874            .working_side(working_side)
4875            .working_price(working_price)
4876            .working_quantity(working_quantity)
4877            .pending_type(pending_type)
4878            .pending_side(pending_side)
4879    }
4880}
4881/// Request parameters for the [`order_list_opoco`] operation.
4882///
4883/// This struct holds all of the inputs you can pass when calling
4884/// [`order_list_opoco`](#method.order_list_opoco).
4885#[derive(Clone, Debug, Builder, Deserialize)]
4886#[builder(pattern = "owned", build_fn(error = "ParamBuildError"))]
4887pub struct OrderListOpocoParams {
4888    ///
4889    /// The `symbol` parameter.
4890    ///
4891    /// This field is **required.
4892    #[builder(setter(into))]
4893    #[serde(rename = "symbol")]
4894    pub symbol: String,
4895    ///
4896    /// The `working_type` parameter.
4897    ///
4898    /// This field is **required.
4899    #[builder(setter(into))]
4900    #[serde(rename = "workingType")]
4901    pub working_type: OrderListOpocoWorkingTypeEnum,
4902    /// Supported values: [Order Side](/products/spot/enums#side)
4903    ///
4904    /// This field is **required.
4905    #[builder(setter(into))]
4906    #[serde(rename = "workingSide")]
4907    pub working_side: OrderListOpocoWorkingSideEnum,
4908    /// Price for the working order.
4909    ///
4910    /// This field is **required.
4911    #[builder(setter(into))]
4912    #[serde(rename = "workingPrice")]
4913    pub working_price: rust_decimal::Decimal,
4914    /// Sets the quantity for the working order.
4915    ///
4916    /// This field is **required.
4917    #[builder(setter(into))]
4918    #[serde(rename = "workingQuantity")]
4919    pub working_quantity: rust_decimal::Decimal,
4920    /// Supported values: [Order Side](/products/spot/enums#side)
4921    ///
4922    /// This field is **required.
4923    #[builder(setter(into))]
4924    #[serde(rename = "pendingSide")]
4925    pub pending_side: OrderListOpocoPendingSideEnum,
4926    /// Supported values: `STOP_LOSS_LIMIT`, `STOP_LOSS`, `LIMIT_MAKER`, `TAKE_PROFIT`, `TAKE_PROFIT_LIMIT`
4927    ///
4928    /// This field is **required.
4929    #[builder(setter(into))]
4930    #[serde(rename = "pendingAboveType")]
4931    pub pending_above_type: OrderListOpocoPendingAboveTypeEnum,
4932    /// Arbitrary unique ID among open order lists. Automatically generated if not sent. A new order list with the same `listClientOrderId` is accepted only when the previous one is filled or completely expired. `listClientOrderId` is distinct from the `workingClientOrderId` and the `pendingClientOrderId`.
4933    ///
4934    /// This field is **optional.
4935    #[builder(setter(into), default)]
4936    #[serde(rename = "listClientOrderId", default)]
4937    pub list_client_order_id: Option<String>,
4938    /// Format of the JSON response. Supported values: [Order Response Type](/products/spot/enums#orderresponsetype)
4939    ///
4940    /// This field is **optional.
4941    #[builder(setter(into), default)]
4942    #[serde(rename = "newOrderRespType", default)]
4943    pub new_order_resp_type: Option<OrderListOpocoNewOrderRespTypeEnum>,
4944    /// The allowed enums is dependent on what is configured on the symbol. Supported values: [STP Modes](/products/spot/enums#stpmodes)
4945    ///
4946    /// This field is **optional.
4947    #[builder(setter(into), default)]
4948    #[serde(rename = "selfTradePreventionMode", default)]
4949    pub self_trade_prevention_mode: Option<OrderListOpocoSelfTradePreventionModeEnum>,
4950    /// Arbitrary unique ID among open orders for the working order. Automatically generated if not sent.
4951    ///
4952    /// This field is **optional.
4953    #[builder(setter(into), default)]
4954    #[serde(rename = "workingClientOrderId", default)]
4955    pub working_client_order_id: Option<String>,
4956    /// This can only be used if `workingTimeInForce` is `GTC`, or if `workingType` is `LIMIT_MAKER`.
4957    ///
4958    /// This field is **optional.
4959    #[builder(setter(into), default)]
4960    #[serde(rename = "workingIcebergQty", default)]
4961    pub working_iceberg_qty: Option<rust_decimal::Decimal>,
4962    /// Supported values: [Time In Force](/products/spot/enums#timeinforce)
4963    ///
4964    /// This field is **optional.
4965    #[builder(setter(into), default)]
4966    #[serde(rename = "workingTimeInForce", default)]
4967    pub working_time_in_force: Option<OrderListOpocoWorkingTimeInForceEnum>,
4968    /// Arbitrary numeric value identifying the working order within an order strategy.
4969    ///
4970    /// This field is **optional.
4971    #[builder(setter(into), default)]
4972    #[serde(rename = "workingStrategyId", default)]
4973    pub working_strategy_id: Option<i64>,
4974    /// Arbitrary numeric value identifying the working order strategy. Values smaller than `1000000` are reserved and cannot be used.
4975    ///
4976    /// This field is **optional.
4977    #[builder(setter(into), default)]
4978    #[serde(rename = "workingStrategyType", default)]
4979    pub working_strategy_type: Option<i32>,
4980    /// See [Pegged Orders](/products/spot/faqs/pegged_orders)
4981    ///
4982    /// This field is **optional.
4983    #[builder(setter(into), default)]
4984    #[serde(rename = "workingPegPriceType", default)]
4985    pub working_peg_price_type: Option<OrderListOpocoWorkingPegPriceTypeEnum>,
4986    /// See [Pegged Orders](/products/spot/faqs/pegged_orders)
4987    ///
4988    /// This field is **optional.
4989    #[builder(setter(into), default)]
4990    #[serde(rename = "workingPegOffsetType", default)]
4991    pub working_peg_offset_type: Option<OrderListOpocoWorkingPegOffsetTypeEnum>,
4992    /// Price level for pegging (max: 100). See [Pegged Orders](/products/spot/faqs/pegged_orders)
4993    ///
4994    /// This field is **optional.
4995    #[builder(setter(into), default)]
4996    #[serde(rename = "workingPegOffsetValue", default)]
4997    pub working_peg_offset_value: Option<i32>,
4998    /// Arbitrary unique ID among open orders for the pending above order. Automatically generated if not sent.
4999    ///
5000    /// This field is **optional.
5001    #[builder(setter(into), default)]
5002    #[serde(rename = "pendingAboveClientOrderId", default)]
5003    pub pending_above_client_order_id: Option<String>,
5004    /// Can be used if `pendingAboveType` is `STOP_LOSS_LIMIT`, `LIMIT_MAKER`, or `TAKE_PROFIT_LIMIT` to specify the limit price.
5005    ///
5006    /// This field is **optional.
5007    #[builder(setter(into), default)]
5008    #[serde(rename = "pendingAbovePrice", default)]
5009    pub pending_above_price: Option<rust_decimal::Decimal>,
5010    /// Can be used if `pendingAboveType` is `STOP_LOSS`, `STOP_LOSS_LIMIT`, `TAKE_PROFIT`, `TAKE_PROFIT_LIMIT`.
5011    ///
5012    /// This field is **optional.
5013    #[builder(setter(into), default)]
5014    #[serde(rename = "pendingAboveStopPrice", default)]
5015    pub pending_above_stop_price: Option<rust_decimal::Decimal>,
5016    /// See [Trailing Stop order FAQ](/products/spot/faqs/trailing-stop-faq)
5017    ///
5018    /// This field is **optional.
5019    #[builder(setter(into), default)]
5020    #[serde(rename = "pendingAboveTrailingDelta", default)]
5021    pub pending_above_trailing_delta: Option<rust_decimal::Decimal>,
5022    /// This can only be used if `pendingAboveTimeInForce` is `GTC` or `pendingAboveType` is `LIMIT_MAKER`.
5023    ///
5024    /// This field is **optional.
5025    #[builder(setter(into), default)]
5026    #[serde(rename = "pendingAboveIcebergQty", default)]
5027    pub pending_above_iceberg_qty: Option<rust_decimal::Decimal>,
5028    /// Required if `pendingAboveType` is `STOP_LOSS_LIMIT` or `TAKE_PROFIT_LIMIT`.
5029    ///
5030    /// This field is **optional.
5031    #[builder(setter(into), default)]
5032    #[serde(rename = "pendingAboveTimeInForce", default)]
5033    pub pending_above_time_in_force: Option<OrderListOpocoPendingAboveTimeInForceEnum>,
5034    /// Arbitrary numeric value identifying the pending above order within an order strategy.
5035    ///
5036    /// This field is **optional.
5037    #[builder(setter(into), default)]
5038    #[serde(rename = "pendingAboveStrategyId", default)]
5039    pub pending_above_strategy_id: Option<i64>,
5040    /// Arbitrary numeric value identifying the pending above order strategy. Values smaller than `1000000` are reserved and cannot be used.
5041    ///
5042    /// This field is **optional.
5043    #[builder(setter(into), default)]
5044    #[serde(rename = "pendingAboveStrategyType", default)]
5045    pub pending_above_strategy_type: Option<i32>,
5046    /// See [Pegged Orders](/products/spot/faqs/pegged_orders)
5047    ///
5048    /// This field is **optional.
5049    #[builder(setter(into), default)]
5050    #[serde(rename = "pendingAbovePegPriceType", default)]
5051    pub pending_above_peg_price_type: Option<OrderListOpocoPendingAbovePegPriceTypeEnum>,
5052    /// See [Pegged Orders](/products/spot/faqs/pegged_orders)
5053    ///
5054    /// This field is **optional.
5055    #[builder(setter(into), default)]
5056    #[serde(rename = "pendingAbovePegOffsetType", default)]
5057    pub pending_above_peg_offset_type: Option<OrderListOpocoPendingAbovePegOffsetTypeEnum>,
5058    /// Price level for pegging (max: 100). See [Pegged Orders](/products/spot/faqs/pegged_orders)
5059    ///
5060    /// This field is **optional.
5061    #[builder(setter(into), default)]
5062    #[serde(rename = "pendingAbovePegOffsetValue", default)]
5063    pub pending_above_peg_offset_value: Option<i32>,
5064    /// Supported values: `STOP_LOSS`, `STOP_LOSS_LIMIT`, `TAKE_PROFIT`, `TAKE_PROFIT_LIMIT`
5065    ///
5066    /// This field is **optional.
5067    #[builder(setter(into), default)]
5068    #[serde(rename = "pendingBelowType", default)]
5069    pub pending_below_type: Option<OrderListOpocoPendingBelowTypeEnum>,
5070    /// Arbitrary unique ID among open orders for the pending below order. Automatically generated if not sent.
5071    ///
5072    /// This field is **optional.
5073    #[builder(setter(into), default)]
5074    #[serde(rename = "pendingBelowClientOrderId", default)]
5075    pub pending_below_client_order_id: Option<String>,
5076    /// Can be used if `pendingBelowType` is `STOP_LOSS_LIMIT` or `TAKE_PROFIT_LIMIT` to specify the limit price.
5077    ///
5078    /// This field is **optional.
5079    #[builder(setter(into), default)]
5080    #[serde(rename = "pendingBelowPrice", default)]
5081    pub pending_below_price: Option<rust_decimal::Decimal>,
5082    /// Can be used if `pendingBelowType` is `STOP_LOSS`, `STOP_LOSS_LIMIT`, `TAKE_PROFIT`, `TAKE_PROFIT_LIMIT`. Either `pendingBelowStopPrice` or `pendingBelowTrailingDelta` or both, must be specified.
5083    ///
5084    /// This field is **optional.
5085    #[builder(setter(into), default)]
5086    #[serde(rename = "pendingBelowStopPrice", default)]
5087    pub pending_below_stop_price: Option<rust_decimal::Decimal>,
5088    /// See [Trailing Stop order FAQ](/products/spot/faqs/trailing-stop-faq)
5089    ///
5090    /// This field is **optional.
5091    #[builder(setter(into), default)]
5092    #[serde(rename = "pendingBelowTrailingDelta", default)]
5093    pub pending_below_trailing_delta: Option<rust_decimal::Decimal>,
5094    /// This can only be used if `pendingBelowTimeInForce` is `GTC` or `pendingBelowType` is `LIMIT_MAKER`.
5095    ///
5096    /// This field is **optional.
5097    #[builder(setter(into), default)]
5098    #[serde(rename = "pendingBelowIcebergQty", default)]
5099    pub pending_below_iceberg_qty: Option<rust_decimal::Decimal>,
5100    /// Supported values: [Time In Force](/products/spot/enums#timeinforce)
5101    ///
5102    /// This field is **optional.
5103    #[builder(setter(into), default)]
5104    #[serde(rename = "pendingBelowTimeInForce", default)]
5105    pub pending_below_time_in_force: Option<OrderListOpocoPendingBelowTimeInForceEnum>,
5106    /// Arbitrary numeric value identifying the pending below order within an order strategy.
5107    ///
5108    /// This field is **optional.
5109    #[builder(setter(into), default)]
5110    #[serde(rename = "pendingBelowStrategyId", default)]
5111    pub pending_below_strategy_id: Option<i64>,
5112    /// Arbitrary numeric value identifying the pending below order strategy. Values smaller than `1000000` are reserved and cannot be used.
5113    ///
5114    /// This field is **optional.
5115    #[builder(setter(into), default)]
5116    #[serde(rename = "pendingBelowStrategyType", default)]
5117    pub pending_below_strategy_type: Option<i32>,
5118    /// See [Pegged Orders](/products/spot/faqs/pegged_orders)
5119    ///
5120    /// This field is **optional.
5121    #[builder(setter(into), default)]
5122    #[serde(rename = "pendingBelowPegPriceType", default)]
5123    pub pending_below_peg_price_type: Option<OrderListOpocoPendingBelowPegPriceTypeEnum>,
5124    ///
5125    /// The `pending_below_peg_offset_type` parameter.
5126    ///
5127    /// This field is **optional.
5128    #[builder(setter(into), default)]
5129    #[serde(rename = "pendingBelowPegOffsetType", default)]
5130    pub pending_below_peg_offset_type: Option<OrderListOpocoPendingBelowPegOffsetTypeEnum>,
5131    ///
5132    /// The `pending_below_peg_offset_value` parameter.
5133    ///
5134    /// This field is **optional.
5135    #[builder(setter(into), default)]
5136    #[serde(rename = "pendingBelowPegOffsetValue", default)]
5137    pub pending_below_peg_offset_value: Option<i32>,
5138    /// The value cannot be greater than `60000`. Supports up to three decimal places of precision (e.g., 6000.346) so that microseconds may be specified.
5139    ///
5140    /// This field is **optional.
5141    #[builder(setter(into), default)]
5142    #[serde(rename = "recvWindow", default)]
5143    pub recv_window: Option<rust_decimal::Decimal>,
5144}
5145
5146impl OrderListOpocoParams {
5147    /// Create a builder for [`order_list_opoco`].
5148    ///
5149    /// Required parameters:
5150    ///
5151    /// * `symbol` — String
5152    /// * `working_type` — String
5153    /// * `working_side` — Supported values: [Order Side](/products/spot/enums#side)
5154    /// * `working_price` — Price for the working order.
5155    /// * `working_quantity` — Sets the quantity for the working order.
5156    /// * `pending_side` — Supported values: [Order Side](/products/spot/enums#side)
5157    /// * `pending_above_type` — Supported values: `STOP_LOSS_LIMIT`, `STOP_LOSS`, `LIMIT_MAKER`, `TAKE_PROFIT`, `TAKE_PROFIT_LIMIT`
5158    ///
5159    #[must_use]
5160    pub fn builder(
5161        symbol: String,
5162        working_type: OrderListOpocoWorkingTypeEnum,
5163        working_side: OrderListOpocoWorkingSideEnum,
5164        working_price: rust_decimal::Decimal,
5165        working_quantity: rust_decimal::Decimal,
5166        pending_side: OrderListOpocoPendingSideEnum,
5167        pending_above_type: OrderListOpocoPendingAboveTypeEnum,
5168    ) -> OrderListOpocoParamsBuilder {
5169        OrderListOpocoParamsBuilder::default()
5170            .symbol(symbol)
5171            .working_type(working_type)
5172            .working_side(working_side)
5173            .working_price(working_price)
5174            .working_quantity(working_quantity)
5175            .pending_side(pending_side)
5176            .pending_above_type(pending_above_type)
5177    }
5178}
5179/// Request parameters for the [`order_list_oto`] operation.
5180///
5181/// This struct holds all of the inputs you can pass when calling
5182/// [`order_list_oto`](#method.order_list_oto).
5183#[derive(Clone, Debug, Builder, Deserialize)]
5184#[builder(pattern = "owned", build_fn(error = "ParamBuildError"))]
5185pub struct OrderListOtoParams {
5186    ///
5187    /// The `symbol` parameter.
5188    ///
5189    /// This field is **required.
5190    #[builder(setter(into))]
5191    #[serde(rename = "symbol")]
5192    pub symbol: String,
5193    /// Supported values: `LIMIT`, `LIMIT_MAKER`
5194    ///
5195    /// This field is **required.
5196    #[builder(setter(into))]
5197    #[serde(rename = "workingType")]
5198    pub working_type: OrderListOtoWorkingTypeEnum,
5199    /// Supported values: [Order Side](/products/spot/enums#side)
5200    ///
5201    /// This field is **required.
5202    #[builder(setter(into))]
5203    #[serde(rename = "workingSide")]
5204    pub working_side: OrderListOtoWorkingSideEnum,
5205    ///
5206    /// The `working_price` parameter.
5207    ///
5208    /// This field is **required.
5209    #[builder(setter(into))]
5210    #[serde(rename = "workingPrice")]
5211    pub working_price: rust_decimal::Decimal,
5212    /// Sets the quantity for the working order.
5213    ///
5214    /// This field is **required.
5215    #[builder(setter(into))]
5216    #[serde(rename = "workingQuantity")]
5217    pub working_quantity: rust_decimal::Decimal,
5218    /// Supported values: [Order Types](/products/spot/enums#ordertypes). Note that `MARKET` orders using `quoteOrderQty` are not supported.
5219    ///
5220    /// This field is **required.
5221    #[builder(setter(into))]
5222    #[serde(rename = "pendingType")]
5223    pub pending_type: OrderListOtoPendingTypeEnum,
5224    /// Supported values: [Order Side](/products/spot/enums#side)
5225    ///
5226    /// This field is **required.
5227    #[builder(setter(into))]
5228    #[serde(rename = "pendingSide")]
5229    pub pending_side: OrderListOtoPendingSideEnum,
5230    /// Sets the quantity for the pending order.
5231    ///
5232    /// This field is **required.
5233    #[builder(setter(into))]
5234    #[serde(rename = "pendingQuantity")]
5235    pub pending_quantity: rust_decimal::Decimal,
5236    /// Arbitrary unique ID among open order lists. Automatically generated if not sent. A new order list with the same `listClientOrderId` is accepted only when the previous one is filled or completely expired. `listClientOrderId` is distinct from the `workingClientOrderId` and the `pendingClientOrderId`.
5237    ///
5238    /// This field is **optional.
5239    #[builder(setter(into), default)]
5240    #[serde(rename = "listClientOrderId", default)]
5241    pub list_client_order_id: Option<String>,
5242    /// Format of the JSON response. Supported values: [Order Response Type](/products/spot/enums#orderresponsetype)
5243    ///
5244    /// This field is **optional.
5245    #[builder(setter(into), default)]
5246    #[serde(rename = "newOrderRespType", default)]
5247    pub new_order_resp_type: Option<OrderListOtoNewOrderRespTypeEnum>,
5248    /// The allowed enums is dependent on what is configured on the symbol. Supported values: [STP Modes](/products/spot/enums#stpmodes)
5249    ///
5250    /// This field is **optional.
5251    #[builder(setter(into), default)]
5252    #[serde(rename = "selfTradePreventionMode", default)]
5253    pub self_trade_prevention_mode: Option<OrderListOtoSelfTradePreventionModeEnum>,
5254    /// Arbitrary unique ID among open orders for the working order. Automatically generated if not sent.
5255    ///
5256    /// This field is **optional.
5257    #[builder(setter(into), default)]
5258    #[serde(rename = "workingClientOrderId", default)]
5259    pub working_client_order_id: Option<String>,
5260    /// This can only be used if `workingTimeInForce` is `GTC`, or if `workingType` is `LIMIT_MAKER`.
5261    ///
5262    /// This field is **optional.
5263    #[builder(setter(into), default)]
5264    #[serde(rename = "workingIcebergQty", default)]
5265    pub working_iceberg_qty: Option<rust_decimal::Decimal>,
5266    /// Supported values: [Time In Force](/products/spot/enums#timeinforce)
5267    ///
5268    /// This field is **optional.
5269    #[builder(setter(into), default)]
5270    #[serde(rename = "workingTimeInForce", default)]
5271    pub working_time_in_force: Option<OrderListOtoWorkingTimeInForceEnum>,
5272    /// Arbitrary numeric value identifying the working order within an order strategy.
5273    ///
5274    /// This field is **optional.
5275    #[builder(setter(into), default)]
5276    #[serde(rename = "workingStrategyId", default)]
5277    pub working_strategy_id: Option<i64>,
5278    /// Arbitrary numeric value identifying the working order strategy. Values smaller than `1000000` are reserved and cannot be used.
5279    ///
5280    /// This field is **optional.
5281    #[builder(setter(into), default)]
5282    #[serde(rename = "workingStrategyType", default)]
5283    pub working_strategy_type: Option<i32>,
5284    /// See [Pegged Orders](/products/spot/faqs/pegged_orders)
5285    ///
5286    /// This field is **optional.
5287    #[builder(setter(into), default)]
5288    #[serde(rename = "workingPegPriceType", default)]
5289    pub working_peg_price_type: Option<OrderListOtoWorkingPegPriceTypeEnum>,
5290    ///
5291    /// The `working_peg_offset_type` parameter.
5292    ///
5293    /// This field is **optional.
5294    #[builder(setter(into), default)]
5295    #[serde(rename = "workingPegOffsetType", default)]
5296    pub working_peg_offset_type: Option<OrderListOtoWorkingPegOffsetTypeEnum>,
5297    ///
5298    /// The `working_peg_offset_value` parameter.
5299    ///
5300    /// This field is **optional.
5301    #[builder(setter(into), default)]
5302    #[serde(rename = "workingPegOffsetValue", default)]
5303    pub working_peg_offset_value: Option<i32>,
5304    /// Arbitrary unique ID among open orders for the pending order. Automatically generated if not sent.
5305    ///
5306    /// This field is **optional.
5307    #[builder(setter(into), default)]
5308    #[serde(rename = "pendingClientOrderId", default)]
5309    pub pending_client_order_id: Option<String>,
5310    ///
5311    /// The `pending_price` parameter.
5312    ///
5313    /// This field is **optional.
5314    #[builder(setter(into), default)]
5315    #[serde(rename = "pendingPrice", default)]
5316    pub pending_price: Option<rust_decimal::Decimal>,
5317    ///
5318    /// The `pending_stop_price` parameter.
5319    ///
5320    /// This field is **optional.
5321    #[builder(setter(into), default)]
5322    #[serde(rename = "pendingStopPrice", default)]
5323    pub pending_stop_price: Option<rust_decimal::Decimal>,
5324    ///
5325    /// The `pending_trailing_delta` parameter.
5326    ///
5327    /// This field is **optional.
5328    #[builder(setter(into), default)]
5329    #[serde(rename = "pendingTrailingDelta", default)]
5330    pub pending_trailing_delta: Option<rust_decimal::Decimal>,
5331    /// This can only be used if `pendingTimeInForce` is `GTC` or if `pendingType` is `LIMIT_MAKER`.
5332    ///
5333    /// This field is **optional.
5334    #[builder(setter(into), default)]
5335    #[serde(rename = "pendingIcebergQty", default)]
5336    pub pending_iceberg_qty: Option<rust_decimal::Decimal>,
5337    /// Supported values: [Time In Force](/products/spot/enums#timeinforce)
5338    ///
5339    /// This field is **optional.
5340    #[builder(setter(into), default)]
5341    #[serde(rename = "pendingTimeInForce", default)]
5342    pub pending_time_in_force: Option<OrderListOtoPendingTimeInForceEnum>,
5343    /// Arbitrary numeric value identifying the pending order within an order strategy.
5344    ///
5345    /// This field is **optional.
5346    #[builder(setter(into), default)]
5347    #[serde(rename = "pendingStrategyId", default)]
5348    pub pending_strategy_id: Option<i64>,
5349    /// Arbitrary numeric value identifying the pending order strategy. Values smaller than `1000000` are reserved and cannot be used.
5350    ///
5351    /// This field is **optional.
5352    #[builder(setter(into), default)]
5353    #[serde(rename = "pendingStrategyType", default)]
5354    pub pending_strategy_type: Option<i32>,
5355    /// See [Pegged Orders](/products/spot/faqs/pegged_orders)
5356    ///
5357    /// This field is **optional.
5358    #[builder(setter(into), default)]
5359    #[serde(rename = "pendingPegPriceType", default)]
5360    pub pending_peg_price_type: Option<OrderListOtoPendingPegPriceTypeEnum>,
5361    ///
5362    /// The `pending_peg_offset_type` parameter.
5363    ///
5364    /// This field is **optional.
5365    #[builder(setter(into), default)]
5366    #[serde(rename = "pendingPegOffsetType", default)]
5367    pub pending_peg_offset_type: Option<OrderListOtoPendingPegOffsetTypeEnum>,
5368    ///
5369    /// The `pending_peg_offset_value` parameter.
5370    ///
5371    /// This field is **optional.
5372    #[builder(setter(into), default)]
5373    #[serde(rename = "pendingPegOffsetValue", default)]
5374    pub pending_peg_offset_value: Option<i32>,
5375    /// The value cannot be greater than `60000`. Supports up to three decimal places of precision (e.g., 6000.346) so that microseconds may be specified.
5376    ///
5377    /// This field is **optional.
5378    #[builder(setter(into), default)]
5379    #[serde(rename = "recvWindow", default)]
5380    pub recv_window: Option<rust_decimal::Decimal>,
5381}
5382
5383impl OrderListOtoParams {
5384    /// Create a builder for [`order_list_oto`].
5385    ///
5386    /// Required parameters:
5387    ///
5388    /// * `symbol` — String
5389    /// * `working_type` — Supported values: `LIMIT`, `LIMIT_MAKER`
5390    /// * `working_side` — Supported values: [Order Side](/products/spot/enums#side)
5391    /// * `working_price` — `rust_decimal::Decimal`
5392    /// * `working_quantity` — Sets the quantity for the working order.
5393    /// * `pending_type` — Supported values: [Order Types](/products/spot/enums#ordertypes). Note that `MARKET` orders using `quoteOrderQty` are not supported.
5394    /// * `pending_side` — Supported values: [Order Side](/products/spot/enums#side)
5395    /// * `pending_quantity` — Sets the quantity for the pending order.
5396    ///
5397    #[must_use]
5398    pub fn builder(
5399        symbol: String,
5400        working_type: OrderListOtoWorkingTypeEnum,
5401        working_side: OrderListOtoWorkingSideEnum,
5402        working_price: rust_decimal::Decimal,
5403        working_quantity: rust_decimal::Decimal,
5404        pending_type: OrderListOtoPendingTypeEnum,
5405        pending_side: OrderListOtoPendingSideEnum,
5406        pending_quantity: rust_decimal::Decimal,
5407    ) -> OrderListOtoParamsBuilder {
5408        OrderListOtoParamsBuilder::default()
5409            .symbol(symbol)
5410            .working_type(working_type)
5411            .working_side(working_side)
5412            .working_price(working_price)
5413            .working_quantity(working_quantity)
5414            .pending_type(pending_type)
5415            .pending_side(pending_side)
5416            .pending_quantity(pending_quantity)
5417    }
5418}
5419/// Request parameters for the [`order_list_otoco`] operation.
5420///
5421/// This struct holds all of the inputs you can pass when calling
5422/// [`order_list_otoco`](#method.order_list_otoco).
5423#[derive(Clone, Debug, Builder, Deserialize)]
5424#[builder(pattern = "owned", build_fn(error = "ParamBuildError"))]
5425pub struct OrderListOtocoParams {
5426    ///
5427    /// The `symbol` parameter.
5428    ///
5429    /// This field is **required.
5430    #[builder(setter(into))]
5431    #[serde(rename = "symbol")]
5432    pub symbol: String,
5433    /// Supported values: `LIMIT`, `LIMIT_MAKER`
5434    ///
5435    /// This field is **required.
5436    #[builder(setter(into))]
5437    #[serde(rename = "workingType")]
5438    pub working_type: OrderListOtocoWorkingTypeEnum,
5439    /// Supported values: [Order Side](/products/spot/enums#side)
5440    ///
5441    /// This field is **required.
5442    #[builder(setter(into))]
5443    #[serde(rename = "workingSide")]
5444    pub working_side: OrderListOtocoWorkingSideEnum,
5445    ///
5446    /// The `working_price` parameter.
5447    ///
5448    /// This field is **required.
5449    #[builder(setter(into))]
5450    #[serde(rename = "workingPrice")]
5451    pub working_price: rust_decimal::Decimal,
5452    /// Sets the quantity for the working order.
5453    ///
5454    /// This field is **required.
5455    #[builder(setter(into))]
5456    #[serde(rename = "workingQuantity")]
5457    pub working_quantity: rust_decimal::Decimal,
5458    /// Supported values: [Order Side](/products/spot/enums#side)
5459    ///
5460    /// This field is **required.
5461    #[builder(setter(into))]
5462    #[serde(rename = "pendingSide")]
5463    pub pending_side: OrderListOtocoPendingSideEnum,
5464    /// Sets the quantity for the pending orders.
5465    ///
5466    /// This field is **required.
5467    #[builder(setter(into))]
5468    #[serde(rename = "pendingQuantity")]
5469    pub pending_quantity: rust_decimal::Decimal,
5470    /// Supported values: `STOP_LOSS_LIMIT`, `STOP_LOSS`, `LIMIT_MAKER`, `TAKE_PROFIT`, `TAKE_PROFIT_LIMIT`
5471    ///
5472    /// This field is **required.
5473    #[builder(setter(into))]
5474    #[serde(rename = "pendingAboveType")]
5475    pub pending_above_type: OrderListOtocoPendingAboveTypeEnum,
5476    /// Arbitrary unique ID among open order lists. Automatically generated if not sent. A new order list with the same `listClientOrderId` is accepted only when the previous one is filled or completely expired. `listClientOrderId` is distinct from the `workingClientOrderId` and the `pendingClientOrderId`.
5477    ///
5478    /// This field is **optional.
5479    #[builder(setter(into), default)]
5480    #[serde(rename = "listClientOrderId", default)]
5481    pub list_client_order_id: Option<String>,
5482    /// Format of the JSON response. Supported values: [Order Response Type](/products/spot/enums#orderresponsetype)
5483    ///
5484    /// This field is **optional.
5485    #[builder(setter(into), default)]
5486    #[serde(rename = "newOrderRespType", default)]
5487    pub new_order_resp_type: Option<OrderListOtocoNewOrderRespTypeEnum>,
5488    /// The allowed enums is dependent on what is configured on the symbol. Supported values: [STP Modes](/products/spot/enums#stpmodes)
5489    ///
5490    /// This field is **optional.
5491    #[builder(setter(into), default)]
5492    #[serde(rename = "selfTradePreventionMode", default)]
5493    pub self_trade_prevention_mode: Option<OrderListOtocoSelfTradePreventionModeEnum>,
5494    /// Arbitrary unique ID among open orders for the working order. Automatically generated if not sent.
5495    ///
5496    /// This field is **optional.
5497    #[builder(setter(into), default)]
5498    #[serde(rename = "workingClientOrderId", default)]
5499    pub working_client_order_id: Option<String>,
5500    /// This can only be used if `workingTimeInForce` is `GTC`, or if `workingType` is `LIMIT_MAKER`.
5501    ///
5502    /// This field is **optional.
5503    #[builder(setter(into), default)]
5504    #[serde(rename = "workingIcebergQty", default)]
5505    pub working_iceberg_qty: Option<rust_decimal::Decimal>,
5506    /// Supported values: [Time In Force](/products/spot/enums#timeinforce)
5507    ///
5508    /// This field is **optional.
5509    #[builder(setter(into), default)]
5510    #[serde(rename = "workingTimeInForce", default)]
5511    pub working_time_in_force: Option<OrderListOtocoWorkingTimeInForceEnum>,
5512    /// Arbitrary numeric value identifying the working order within an order strategy.
5513    ///
5514    /// This field is **optional.
5515    #[builder(setter(into), default)]
5516    #[serde(rename = "workingStrategyId", default)]
5517    pub working_strategy_id: Option<i64>,
5518    /// Arbitrary numeric value identifying the working order strategy. Values smaller than `1000000` are reserved and cannot be used.
5519    ///
5520    /// This field is **optional.
5521    #[builder(setter(into), default)]
5522    #[serde(rename = "workingStrategyType", default)]
5523    pub working_strategy_type: Option<i32>,
5524    /// See [Pegged Orders](/products/spot/faqs/pegged_orders)
5525    ///
5526    /// This field is **optional.
5527    #[builder(setter(into), default)]
5528    #[serde(rename = "workingPegPriceType", default)]
5529    pub working_peg_price_type: Option<OrderListOtocoWorkingPegPriceTypeEnum>,
5530    ///
5531    /// The `working_peg_offset_type` parameter.
5532    ///
5533    /// This field is **optional.
5534    #[builder(setter(into), default)]
5535    #[serde(rename = "workingPegOffsetType", default)]
5536    pub working_peg_offset_type: Option<OrderListOtocoWorkingPegOffsetTypeEnum>,
5537    ///
5538    /// The `working_peg_offset_value` parameter.
5539    ///
5540    /// This field is **optional.
5541    #[builder(setter(into), default)]
5542    #[serde(rename = "workingPegOffsetValue", default)]
5543    pub working_peg_offset_value: Option<i32>,
5544    /// Arbitrary unique ID among open orders for the pending above order. Automatically generated if not sent.
5545    ///
5546    /// This field is **optional.
5547    #[builder(setter(into), default)]
5548    #[serde(rename = "pendingAboveClientOrderId", default)]
5549    pub pending_above_client_order_id: Option<String>,
5550    /// Can be used if `pendingAboveType` is `STOP_LOSS_LIMIT`, `LIMIT_MAKER`, or `TAKE_PROFIT_LIMIT` to specify the limit price.
5551    ///
5552    /// This field is **optional.
5553    #[builder(setter(into), default)]
5554    #[serde(rename = "pendingAbovePrice", default)]
5555    pub pending_above_price: Option<rust_decimal::Decimal>,
5556    /// Can be used if `pendingAboveType` is `STOP_LOSS`, `STOP_LOSS_LIMIT`, `TAKE_PROFIT`, `TAKE_PROFIT_LIMIT`.
5557    ///
5558    /// This field is **optional.
5559    #[builder(setter(into), default)]
5560    #[serde(rename = "pendingAboveStopPrice", default)]
5561    pub pending_above_stop_price: Option<rust_decimal::Decimal>,
5562    /// See [Trailing Stop order FAQ](/products/spot/faqs/trailing-stop-faq)
5563    ///
5564    /// This field is **optional.
5565    #[builder(setter(into), default)]
5566    #[serde(rename = "pendingAboveTrailingDelta", default)]
5567    pub pending_above_trailing_delta: Option<rust_decimal::Decimal>,
5568    /// This can only be used if `pendingAboveTimeInForce` is `GTC` or if `pendingAboveType` is `LIMIT_MAKER`.
5569    ///
5570    /// This field is **optional.
5571    #[builder(setter(into), default)]
5572    #[serde(rename = "pendingAboveIcebergQty", default)]
5573    pub pending_above_iceberg_qty: Option<rust_decimal::Decimal>,
5574    /// Required if `pendingAboveType` is `STOP_LOSS_LIMIT` or `TAKE_PROFIT_LIMIT`.
5575    ///
5576    /// This field is **optional.
5577    #[builder(setter(into), default)]
5578    #[serde(rename = "pendingAboveTimeInForce", default)]
5579    pub pending_above_time_in_force: Option<OrderListOtocoPendingAboveTimeInForceEnum>,
5580    /// Arbitrary numeric value identifying the pending above order within an order strategy.
5581    ///
5582    /// This field is **optional.
5583    #[builder(setter(into), default)]
5584    #[serde(rename = "pendingAboveStrategyId", default)]
5585    pub pending_above_strategy_id: Option<i64>,
5586    /// Arbitrary numeric value identifying the pending above order strategy. Values smaller than `1000000` are reserved and cannot be used.
5587    ///
5588    /// This field is **optional.
5589    #[builder(setter(into), default)]
5590    #[serde(rename = "pendingAboveStrategyType", default)]
5591    pub pending_above_strategy_type: Option<i32>,
5592    /// See [Pegged Orders](/products/spot/faqs/pegged_orders)
5593    ///
5594    /// This field is **optional.
5595    #[builder(setter(into), default)]
5596    #[serde(rename = "pendingAbovePegPriceType", default)]
5597    pub pending_above_peg_price_type: Option<OrderListOtocoPendingAbovePegPriceTypeEnum>,
5598    ///
5599    /// The `pending_above_peg_offset_type` parameter.
5600    ///
5601    /// This field is **optional.
5602    #[builder(setter(into), default)]
5603    #[serde(rename = "pendingAbovePegOffsetType", default)]
5604    pub pending_above_peg_offset_type: Option<OrderListOtocoPendingAbovePegOffsetTypeEnum>,
5605    ///
5606    /// The `pending_above_peg_offset_value` parameter.
5607    ///
5608    /// This field is **optional.
5609    #[builder(setter(into), default)]
5610    #[serde(rename = "pendingAbovePegOffsetValue", default)]
5611    pub pending_above_peg_offset_value: Option<i32>,
5612    /// Supported values: `STOP_LOSS`, `STOP_LOSS_LIMIT`, `TAKE_PROFIT`, `TAKE_PROFIT_LIMIT`
5613    ///
5614    /// This field is **optional.
5615    #[builder(setter(into), default)]
5616    #[serde(rename = "pendingBelowType", default)]
5617    pub pending_below_type: Option<OrderListOtocoPendingBelowTypeEnum>,
5618    /// Arbitrary unique ID among open orders for the pending below order. Automatically generated if not sent.
5619    ///
5620    /// This field is **optional.
5621    #[builder(setter(into), default)]
5622    #[serde(rename = "pendingBelowClientOrderId", default)]
5623    pub pending_below_client_order_id: Option<String>,
5624    /// Can be used if `pendingBelowType` is `STOP_LOSS_LIMIT` or `TAKE_PROFIT_LIMIT` to specify the limit price.
5625    ///
5626    /// This field is **optional.
5627    #[builder(setter(into), default)]
5628    #[serde(rename = "pendingBelowPrice", default)]
5629    pub pending_below_price: Option<rust_decimal::Decimal>,
5630    /// Can be used if `pendingBelowType` is `STOP_LOSS`, `STOP_LOSS_LIMIT`, `TAKE_PROFIT`, `TAKE_PROFIT_LIMIT`. Either `pendingBelowStopPrice` or `pendingBelowTrailingDelta` or both, must be specified.
5631    ///
5632    /// This field is **optional.
5633    #[builder(setter(into), default)]
5634    #[serde(rename = "pendingBelowStopPrice", default)]
5635    pub pending_below_stop_price: Option<rust_decimal::Decimal>,
5636    /// See [Trailing Stop order FAQ](/products/spot/faqs/trailing-stop-faq)
5637    ///
5638    /// This field is **optional.
5639    #[builder(setter(into), default)]
5640    #[serde(rename = "pendingBelowTrailingDelta", default)]
5641    pub pending_below_trailing_delta: Option<rust_decimal::Decimal>,
5642    /// This can only be used if `pendingBelowTimeInForce` is `GTC`, or if `pendingBelowType` is `LIMIT_MAKER`.
5643    ///
5644    /// This field is **optional.
5645    #[builder(setter(into), default)]
5646    #[serde(rename = "pendingBelowIcebergQty", default)]
5647    pub pending_below_iceberg_qty: Option<rust_decimal::Decimal>,
5648    /// Required if `pendingBelowType` is `STOP_LOSS_LIMIT` or `TAKE_PROFIT_LIMIT`.
5649    ///
5650    /// This field is **optional.
5651    #[builder(setter(into), default)]
5652    #[serde(rename = "pendingBelowTimeInForce", default)]
5653    pub pending_below_time_in_force: Option<OrderListOtocoPendingBelowTimeInForceEnum>,
5654    /// Arbitrary numeric value identifying the pending below order within an order strategy.
5655    ///
5656    /// This field is **optional.
5657    #[builder(setter(into), default)]
5658    #[serde(rename = "pendingBelowStrategyId", default)]
5659    pub pending_below_strategy_id: Option<i64>,
5660    /// Arbitrary numeric value identifying the pending below order strategy. Values smaller than `1000000` are reserved and cannot be used.
5661    ///
5662    /// This field is **optional.
5663    #[builder(setter(into), default)]
5664    #[serde(rename = "pendingBelowStrategyType", default)]
5665    pub pending_below_strategy_type: Option<i32>,
5666    /// See [Pegged Orders](/products/spot/faqs/pegged_orders)
5667    ///
5668    /// This field is **optional.
5669    #[builder(setter(into), default)]
5670    #[serde(rename = "pendingBelowPegPriceType", default)]
5671    pub pending_below_peg_price_type: Option<OrderListOtocoPendingBelowPegPriceTypeEnum>,
5672    ///
5673    /// The `pending_below_peg_offset_type` parameter.
5674    ///
5675    /// This field is **optional.
5676    #[builder(setter(into), default)]
5677    #[serde(rename = "pendingBelowPegOffsetType", default)]
5678    pub pending_below_peg_offset_type: Option<OrderListOtocoPendingBelowPegOffsetTypeEnum>,
5679    ///
5680    /// The `pending_below_peg_offset_value` parameter.
5681    ///
5682    /// This field is **optional.
5683    #[builder(setter(into), default)]
5684    #[serde(rename = "pendingBelowPegOffsetValue", default)]
5685    pub pending_below_peg_offset_value: Option<i32>,
5686    /// The value cannot be greater than `60000`. Supports up to three decimal places of precision (e.g., 6000.346) so that microseconds may be specified.
5687    ///
5688    /// This field is **optional.
5689    #[builder(setter(into), default)]
5690    #[serde(rename = "recvWindow", default)]
5691    pub recv_window: Option<rust_decimal::Decimal>,
5692}
5693
5694impl OrderListOtocoParams {
5695    /// Create a builder for [`order_list_otoco`].
5696    ///
5697    /// Required parameters:
5698    ///
5699    /// * `symbol` — String
5700    /// * `working_type` — Supported values: `LIMIT`, `LIMIT_MAKER`
5701    /// * `working_side` — Supported values: [Order Side](/products/spot/enums#side)
5702    /// * `working_price` — `rust_decimal::Decimal`
5703    /// * `working_quantity` — Sets the quantity for the working order.
5704    /// * `pending_side` — Supported values: [Order Side](/products/spot/enums#side)
5705    /// * `pending_quantity` — Sets the quantity for the pending orders.
5706    /// * `pending_above_type` — Supported values: `STOP_LOSS_LIMIT`, `STOP_LOSS`, `LIMIT_MAKER`, `TAKE_PROFIT`, `TAKE_PROFIT_LIMIT`
5707    ///
5708    #[must_use]
5709    pub fn builder(
5710        symbol: String,
5711        working_type: OrderListOtocoWorkingTypeEnum,
5712        working_side: OrderListOtocoWorkingSideEnum,
5713        working_price: rust_decimal::Decimal,
5714        working_quantity: rust_decimal::Decimal,
5715        pending_side: OrderListOtocoPendingSideEnum,
5716        pending_quantity: rust_decimal::Decimal,
5717        pending_above_type: OrderListOtocoPendingAboveTypeEnum,
5718    ) -> OrderListOtocoParamsBuilder {
5719        OrderListOtocoParamsBuilder::default()
5720            .symbol(symbol)
5721            .working_type(working_type)
5722            .working_side(working_side)
5723            .working_price(working_price)
5724            .working_quantity(working_quantity)
5725            .pending_side(pending_side)
5726            .pending_quantity(pending_quantity)
5727            .pending_above_type(pending_above_type)
5728    }
5729}
5730/// Request parameters for the [`order_oco`] operation.
5731///
5732/// This struct holds all of the inputs you can pass when calling
5733/// [`order_oco`](#method.order_oco).
5734#[derive(Clone, Debug, Builder, Deserialize)]
5735#[builder(pattern = "owned", build_fn(error = "ParamBuildError"))]
5736pub struct OrderOcoParams {
5737    ///
5738    /// The `symbol` parameter.
5739    ///
5740    /// This field is **required.
5741    #[builder(setter(into))]
5742    #[serde(rename = "symbol")]
5743    pub symbol: String,
5744    ///
5745    /// The `side` parameter.
5746    ///
5747    /// This field is **required.
5748    #[builder(setter(into))]
5749    #[serde(rename = "side")]
5750    pub side: OrderOcoSideEnum,
5751    ///
5752    /// The `quantity` parameter.
5753    ///
5754    /// This field is **required.
5755    #[builder(setter(into))]
5756    #[serde(rename = "quantity")]
5757    pub quantity: rust_decimal::Decimal,
5758    ///
5759    /// The `price` parameter.
5760    ///
5761    /// This field is **required.
5762    #[builder(setter(into))]
5763    #[serde(rename = "price")]
5764    pub price: rust_decimal::Decimal,
5765    ///
5766    /// The `stop_price` parameter.
5767    ///
5768    /// This field is **required.
5769    #[builder(setter(into))]
5770    #[serde(rename = "stopPrice")]
5771    pub stop_price: rust_decimal::Decimal,
5772    /// A unique Id for the entire orderList
5773    ///
5774    /// This field is **optional.
5775    #[builder(setter(into), default)]
5776    #[serde(rename = "listClientOrderId", default)]
5777    pub list_client_order_id: Option<String>,
5778    /// A unique Id for the limit order
5779    ///
5780    /// This field is **optional.
5781    #[builder(setter(into), default)]
5782    #[serde(rename = "limitClientOrderId", default)]
5783    pub limit_client_order_id: Option<String>,
5784    ///
5785    /// The `limit_strategy_id` parameter.
5786    ///
5787    /// This field is **optional.
5788    #[builder(setter(into), default)]
5789    #[serde(rename = "limitStrategyId", default)]
5790    pub limit_strategy_id: Option<i64>,
5791    /// The value cannot be less than `1000000`.
5792    ///
5793    /// This field is **optional.
5794    #[builder(setter(into), default)]
5795    #[serde(rename = "limitStrategyType", default)]
5796    pub limit_strategy_type: Option<i32>,
5797    /// Used to make the `LIMIT_MAKER` leg an iceberg order.
5798    ///
5799    /// This field is **optional.
5800    #[builder(setter(into), default)]
5801    #[serde(rename = "limitIcebergQty", default)]
5802    pub limit_iceberg_qty: Option<rust_decimal::Decimal>,
5803    ///
5804    /// The `trailing_delta` parameter.
5805    ///
5806    /// This field is **optional.
5807    #[builder(setter(into), default)]
5808    #[serde(rename = "trailingDelta", default)]
5809    pub trailing_delta: Option<i64>,
5810    /// A unique Id for the stop loss/stop loss limit leg
5811    ///
5812    /// This field is **optional.
5813    #[builder(setter(into), default)]
5814    #[serde(rename = "stopClientOrderId", default)]
5815    pub stop_client_order_id: Option<String>,
5816    ///
5817    /// The `stop_strategy_id` parameter.
5818    ///
5819    /// This field is **optional.
5820    #[builder(setter(into), default)]
5821    #[serde(rename = "stopStrategyId", default)]
5822    pub stop_strategy_id: Option<i64>,
5823    /// The value cannot be less than `1000000`.
5824    ///
5825    /// This field is **optional.
5826    #[builder(setter(into), default)]
5827    #[serde(rename = "stopStrategyType", default)]
5828    pub stop_strategy_type: Option<i32>,
5829    /// If provided, `stopLimitTimeInForce` is required.
5830    ///
5831    /// This field is **optional.
5832    #[builder(setter(into), default)]
5833    #[serde(rename = "stopLimitPrice", default)]
5834    pub stop_limit_price: Option<rust_decimal::Decimal>,
5835    /// Used with `STOP_LOSS_LIMIT` leg to make an iceberg order.
5836    ///
5837    /// This field is **optional.
5838    #[builder(setter(into), default)]
5839    #[serde(rename = "stopIcebergQty", default)]
5840    pub stop_iceberg_qty: Option<rust_decimal::Decimal>,
5841    /// Valid values are `GTC`/`FOK`/`IOC`
5842    ///
5843    /// This field is **optional.
5844    #[builder(setter(into), default)]
5845    #[serde(rename = "stopLimitTimeInForce", default)]
5846    pub stop_limit_time_in_force: Option<OrderOcoStopLimitTimeInForceEnum>,
5847    /// Format of the JSON response. Supported values: [Order Response Type](/products/spot/enums#orderresponsetype)
5848    ///
5849    /// This field is **optional.
5850    #[builder(setter(into), default)]
5851    #[serde(rename = "newOrderRespType", default)]
5852    pub new_order_resp_type: Option<OrderOcoNewOrderRespTypeEnum>,
5853    /// The allowed values are dependent on what is configured on the symbol. Supported values: [STP Modes](/products/spot/enums#stpmodes)
5854    ///
5855    /// This field is **optional.
5856    #[builder(setter(into), default)]
5857    #[serde(rename = "selfTradePreventionMode", default)]
5858    pub self_trade_prevention_mode: Option<OrderOcoSelfTradePreventionModeEnum>,
5859    /// The value cannot be greater than `60000`. <br> Supports up to three decimal places of precision (e.g., 6000.346) so that microseconds may be specified.
5860    ///
5861    /// This field is **optional.
5862    #[builder(setter(into), default)]
5863    #[serde(rename = "recvWindow", default)]
5864    pub recv_window: Option<rust_decimal::Decimal>,
5865}
5866
5867impl OrderOcoParams {
5868    /// Create a builder for [`order_oco`].
5869    ///
5870    /// Required parameters:
5871    ///
5872    /// * `symbol` — String
5873    /// * `side` — String
5874    /// * `quantity` — `rust_decimal::Decimal`
5875    /// * `price` — `rust_decimal::Decimal`
5876    /// * `stop_price` — `rust_decimal::Decimal`
5877    ///
5878    #[must_use]
5879    pub fn builder(
5880        symbol: String,
5881        side: OrderOcoSideEnum,
5882        quantity: rust_decimal::Decimal,
5883        price: rust_decimal::Decimal,
5884        stop_price: rust_decimal::Decimal,
5885    ) -> OrderOcoParamsBuilder {
5886        OrderOcoParamsBuilder::default()
5887            .symbol(symbol)
5888            .side(side)
5889            .quantity(quantity)
5890            .price(price)
5891            .stop_price(stop_price)
5892    }
5893}
5894/// Request parameters for the [`order_test`] operation.
5895///
5896/// This struct holds all of the inputs you can pass when calling
5897/// [`order_test`](#method.order_test).
5898#[derive(Clone, Debug, Builder, Deserialize)]
5899#[builder(pattern = "owned", build_fn(error = "ParamBuildError"))]
5900pub struct OrderTestParams {
5901    ///
5902    /// The `symbol` parameter.
5903    ///
5904    /// This field is **required.
5905    #[builder(setter(into))]
5906    #[serde(rename = "symbol")]
5907    pub symbol: String,
5908    /// Please see [Enums](/products/spot/enums#side) for supported values.
5909    ///
5910    /// This field is **required.
5911    #[builder(setter(into))]
5912    #[serde(rename = "side")]
5913    pub side: OrderTestSideEnum,
5914    /// Please see [Enums](/products/spot/enums#ordertypes) for supported values.
5915    ///
5916    /// This field is **required.
5917    #[builder(setter(into))]
5918    #[serde(rename = "type")]
5919    pub r#type: OrderTestTypeEnum,
5920    /// Default: `false` <br> See [Commissions FAQ](/products/spot/faqs/commission_faq#test-order-diferences) to learn more.
5921    ///
5922    /// This field is **optional.
5923    #[builder(setter(into), default)]
5924    #[serde(rename = "computeCommissionRates", default)]
5925    pub compute_commission_rates: Option<bool>,
5926    /// Please see [Enums](/products/spot/enums#timeinforce) for supported values.
5927    ///
5928    /// This field is **optional.
5929    #[builder(setter(into), default)]
5930    #[serde(rename = "timeInForce", default)]
5931    pub time_in_force: Option<OrderTestTimeInForceEnum>,
5932    ///
5933    /// The `quantity` parameter.
5934    ///
5935    /// This field is **optional.
5936    #[builder(setter(into), default)]
5937    #[serde(rename = "quantity", default)]
5938    pub quantity: Option<rust_decimal::Decimal>,
5939    ///
5940    /// The `quote_order_qty` parameter.
5941    ///
5942    /// This field is **optional.
5943    #[builder(setter(into), default)]
5944    #[serde(rename = "quoteOrderQty", default)]
5945    pub quote_order_qty: Option<rust_decimal::Decimal>,
5946    ///
5947    /// The `price` parameter.
5948    ///
5949    /// This field is **optional.
5950    #[builder(setter(into), default)]
5951    #[serde(rename = "price", default)]
5952    pub price: Option<rust_decimal::Decimal>,
5953    /// A unique id among open orders. Automatically generated if not sent. Orders with the same `newClientOrderID` can be accepted only when the previous one is filled, otherwise the order will be rejected.
5954    ///
5955    /// This field is **optional.
5956    #[builder(setter(into), default)]
5957    #[serde(rename = "newClientOrderId", default)]
5958    pub new_client_order_id: Option<String>,
5959    ///
5960    /// The `strategy_id` parameter.
5961    ///
5962    /// This field is **optional.
5963    #[builder(setter(into), default)]
5964    #[serde(rename = "strategyId", default)]
5965    pub strategy_id: Option<i64>,
5966    /// The value cannot be less than `1000000`.
5967    ///
5968    /// This field is **optional.
5969    #[builder(setter(into), default)]
5970    #[serde(rename = "strategyType", default)]
5971    pub strategy_type: Option<i32>,
5972    /// Used with `STOP_LOSS`, `STOP_LOSS_LIMIT`, `TAKE_PROFIT`, and `TAKE_PROFIT_LIMIT` orders.
5973    ///
5974    /// This field is **optional.
5975    #[builder(setter(into), default)]
5976    #[serde(rename = "stopPrice", default)]
5977    pub stop_price: Option<rust_decimal::Decimal>,
5978    /// See [Trailing Stop order FAQ](/products/spot/faqs/trailing-stop-faq)
5979    ///
5980    /// This field is **optional.
5981    #[builder(setter(into), default)]
5982    #[serde(rename = "trailingDelta", default)]
5983    pub trailing_delta: Option<i64>,
5984    /// Used with `LIMIT`, `STOP_LOSS_LIMIT`, and `TAKE_PROFIT_LIMIT` to create an iceberg order.
5985    ///
5986    /// This field is **optional.
5987    #[builder(setter(into), default)]
5988    #[serde(rename = "icebergQty", default)]
5989    pub iceberg_qty: Option<rust_decimal::Decimal>,
5990    /// Set the response JSON. `ACK`, `RESULT`, or `FULL`; `MARKET` and `LIMIT` order types default to `FULL`, all other orders default to `ACK`.
5991    ///
5992    /// This field is **optional.
5993    #[builder(setter(into), default)]
5994    #[serde(rename = "newOrderRespType", default)]
5995    pub new_order_resp_type: Option<OrderTestNewOrderRespTypeEnum>,
5996    /// The allowed enums is dependent on what is configured on the symbol. Supported values: [STP Modes](/products/spot/enums#stpmodes)
5997    ///
5998    /// This field is **optional.
5999    #[builder(setter(into), default)]
6000    #[serde(rename = "selfTradePreventionMode", default)]
6001    pub self_trade_prevention_mode: Option<OrderTestSelfTradePreventionModeEnum>,
6002    /// `PRIMARY_PEG` or `MARKET_PEG`. See [Pegged Orders](/products/spot/faqs/pegged_orders)
6003    ///
6004    /// This field is **optional.
6005    #[builder(setter(into), default)]
6006    #[serde(rename = "pegPriceType", default)]
6007    pub peg_price_type: Option<OrderTestPegPriceTypeEnum>,
6008    /// Price level for pegging (max: 100). See [Pegged Orders](/products/spot/faqs/pegged_orders)
6009    ///
6010    /// This field is **optional.
6011    #[builder(setter(into), default)]
6012    #[serde(rename = "pegOffsetValue", default)]
6013    pub peg_offset_value: Option<i32>,
6014    /// Only `PRICE_LEVEL` is supported. See [Pegged Orders](/products/spot/faqs/pegged_orders)
6015    ///
6016    /// This field is **optional.
6017    #[builder(setter(into), default)]
6018    #[serde(rename = "pegOffsetType", default)]
6019    pub peg_offset_type: Option<OrderTestPegOffsetTypeEnum>,
6020    /// The value cannot be greater than `60000`. Supports up to three decimal places of precision (e.g., 6000.346) so that microseconds may be specified.
6021    ///
6022    /// This field is **optional.
6023    #[builder(setter(into), default)]
6024    #[serde(rename = "recvWindow", default)]
6025    pub recv_window: Option<rust_decimal::Decimal>,
6026}
6027
6028impl OrderTestParams {
6029    /// Create a builder for [`order_test`].
6030    ///
6031    /// Required parameters:
6032    ///
6033    /// * `symbol` — String
6034    /// * `side` — Please see [Enums](/products/spot/enums#side) for supported values.
6035    /// * `r#type` — Please see [Enums](/products/spot/enums#ordertypes) for supported values.
6036    ///
6037    #[must_use]
6038    pub fn builder(
6039        symbol: String,
6040        side: OrderTestSideEnum,
6041        r#type: OrderTestTypeEnum,
6042    ) -> OrderTestParamsBuilder {
6043        OrderTestParamsBuilder::default()
6044            .symbol(symbol)
6045            .side(side)
6046            .r#type(r#type)
6047    }
6048}
6049/// Request parameters for the [`sor_order`] operation.
6050///
6051/// This struct holds all of the inputs you can pass when calling
6052/// [`sor_order`](#method.sor_order).
6053#[derive(Clone, Debug, Builder, Deserialize)]
6054#[builder(pattern = "owned", build_fn(error = "ParamBuildError"))]
6055pub struct SorOrderParams {
6056    ///
6057    /// The `symbol` parameter.
6058    ///
6059    /// This field is **required.
6060    #[builder(setter(into))]
6061    #[serde(rename = "symbol")]
6062    pub symbol: String,
6063    ///
6064    /// The `side` parameter.
6065    ///
6066    /// This field is **required.
6067    #[builder(setter(into))]
6068    #[serde(rename = "side")]
6069    pub side: SorOrderSideEnum,
6070    ///
6071    /// The `r#type` parameter.
6072    ///
6073    /// This field is **required.
6074    #[builder(setter(into))]
6075    #[serde(rename = "type")]
6076    pub r#type: SorOrderTypeEnum,
6077    ///
6078    /// The `quantity` parameter.
6079    ///
6080    /// This field is **required.
6081    #[builder(setter(into))]
6082    #[serde(rename = "quantity")]
6083    pub quantity: rust_decimal::Decimal,
6084    ///
6085    /// The `time_in_force` parameter.
6086    ///
6087    /// This field is **optional.
6088    #[builder(setter(into), default)]
6089    #[serde(rename = "timeInForce", default)]
6090    pub time_in_force: Option<SorOrderTimeInForceEnum>,
6091    ///
6092    /// The `price` parameter.
6093    ///
6094    /// This field is **optional.
6095    #[builder(setter(into), default)]
6096    #[serde(rename = "price", default)]
6097    pub price: Option<rust_decimal::Decimal>,
6098    /// A unique id among open orders. Automatically generated if not sent.<br/> Orders with the same `newClientOrderID` can be accepted only when the previous one is filled, otherwise the order will be rejected.
6099    ///
6100    /// This field is **optional.
6101    #[builder(setter(into), default)]
6102    #[serde(rename = "newClientOrderId", default)]
6103    pub new_client_order_id: Option<String>,
6104    ///
6105    /// The `strategy_id` parameter.
6106    ///
6107    /// This field is **optional.
6108    #[builder(setter(into), default)]
6109    #[serde(rename = "strategyId", default)]
6110    pub strategy_id: Option<i64>,
6111    /// The value cannot be less than `1000000`.
6112    ///
6113    /// This field is **optional.
6114    #[builder(setter(into), default)]
6115    #[serde(rename = "strategyType", default)]
6116    pub strategy_type: Option<i32>,
6117    /// Used with `LIMIT` to create an iceberg order.
6118    ///
6119    /// This field is **optional.
6120    #[builder(setter(into), default)]
6121    #[serde(rename = "icebergQty", default)]
6122    pub iceberg_qty: Option<rust_decimal::Decimal>,
6123    /// Set the response JSON. `ACK`, `RESULT`, or `FULL`. Default to `FULL`
6124    ///
6125    /// This field is **optional.
6126    #[builder(setter(into), default)]
6127    #[serde(rename = "newOrderRespType", default)]
6128    pub new_order_resp_type: Option<SorOrderNewOrderRespTypeEnum>,
6129    /// The allowed enums is dependent on what is configured on the symbol. The possible supported values are: [STP Modes](/products/spot/enums#stpmodes).
6130    ///
6131    /// This field is **optional.
6132    #[builder(setter(into), default)]
6133    #[serde(rename = "selfTradePreventionMode", default)]
6134    pub self_trade_prevention_mode: Option<SorOrderSelfTradePreventionModeEnum>,
6135    /// The value cannot be greater than `60000`. <br> Supports up to three decimal places of precision (e.g., 6000.346) so that microseconds may be specified.
6136    ///
6137    /// This field is **optional.
6138    #[builder(setter(into), default)]
6139    #[serde(rename = "recvWindow", default)]
6140    pub recv_window: Option<rust_decimal::Decimal>,
6141}
6142
6143impl SorOrderParams {
6144    /// Create a builder for [`sor_order`].
6145    ///
6146    /// Required parameters:
6147    ///
6148    /// * `symbol` — String
6149    /// * `side` — String
6150    /// * `r#type` — String
6151    /// * `quantity` — `rust_decimal::Decimal`
6152    ///
6153    #[must_use]
6154    pub fn builder(
6155        symbol: String,
6156        side: SorOrderSideEnum,
6157        r#type: SorOrderTypeEnum,
6158        quantity: rust_decimal::Decimal,
6159    ) -> SorOrderParamsBuilder {
6160        SorOrderParamsBuilder::default()
6161            .symbol(symbol)
6162            .side(side)
6163            .r#type(r#type)
6164            .quantity(quantity)
6165    }
6166}
6167/// Request parameters for the [`sor_order_test`] operation.
6168///
6169/// This struct holds all of the inputs you can pass when calling
6170/// [`sor_order_test`](#method.sor_order_test).
6171#[derive(Clone, Debug, Builder, Deserialize)]
6172#[builder(pattern = "owned", build_fn(error = "ParamBuildError"))]
6173pub struct SorOrderTestParams {
6174    ///
6175    /// The `symbol` parameter.
6176    ///
6177    /// This field is **required.
6178    #[builder(setter(into))]
6179    #[serde(rename = "symbol")]
6180    pub symbol: String,
6181    /// Please see [Enums](/products/spot/enums#side) for supported values.
6182    ///
6183    /// This field is **required.
6184    #[builder(setter(into))]
6185    #[serde(rename = "side")]
6186    pub side: SorOrderTestSideEnum,
6187    /// Please see [Enums](/products/spot/enums#ordertypes) for supported values.
6188    ///
6189    /// This field is **required.
6190    #[builder(setter(into))]
6191    #[serde(rename = "type")]
6192    pub r#type: SorOrderTestTypeEnum,
6193    ///
6194    /// The `quantity` parameter.
6195    ///
6196    /// This field is **required.
6197    #[builder(setter(into))]
6198    #[serde(rename = "quantity")]
6199    pub quantity: rust_decimal::Decimal,
6200    ///
6201    /// The `compute_commission_rates` parameter.
6202    ///
6203    /// This field is **optional.
6204    #[builder(setter(into), default)]
6205    #[serde(rename = "computeCommissionRates", default)]
6206    pub compute_commission_rates: Option<bool>,
6207    /// Please see [Enums](/products/spot/enums#timeinforce) for supported values.
6208    ///
6209    /// This field is **optional.
6210    #[builder(setter(into), default)]
6211    #[serde(rename = "timeInForce", default)]
6212    pub time_in_force: Option<SorOrderTestTimeInForceEnum>,
6213    ///
6214    /// The `price` parameter.
6215    ///
6216    /// This field is **optional.
6217    #[builder(setter(into), default)]
6218    #[serde(rename = "price", default)]
6219    pub price: Option<rust_decimal::Decimal>,
6220    /// A unique id among open orders. Automatically generated if not sent. Orders with the same `newClientOrderID` can be accepted only when the previous one is filled, otherwise the order will be rejected.
6221    ///
6222    /// This field is **optional.
6223    #[builder(setter(into), default)]
6224    #[serde(rename = "newClientOrderId", default)]
6225    pub new_client_order_id: Option<String>,
6226    ///
6227    /// The `strategy_id` parameter.
6228    ///
6229    /// This field is **optional.
6230    #[builder(setter(into), default)]
6231    #[serde(rename = "strategyId", default)]
6232    pub strategy_id: Option<i64>,
6233    /// The value cannot be less than `1000000`.
6234    ///
6235    /// This field is **optional.
6236    #[builder(setter(into), default)]
6237    #[serde(rename = "strategyType", default)]
6238    pub strategy_type: Option<i32>,
6239    /// Used with `LIMIT` to create an iceberg order.
6240    ///
6241    /// This field is **optional.
6242    #[builder(setter(into), default)]
6243    #[serde(rename = "icebergQty", default)]
6244    pub iceberg_qty: Option<rust_decimal::Decimal>,
6245    /// Set the response JSON. `ACK`, `RESULT`, or `FULL`. Default to `FULL`.
6246    ///
6247    /// This field is **optional.
6248    #[builder(setter(into), default)]
6249    #[serde(rename = "newOrderRespType", default)]
6250    pub new_order_resp_type: Option<SorOrderTestNewOrderRespTypeEnum>,
6251    /// The allowed enums is dependent on what is configured on the symbol. Supported values: [STP Modes](/products/spot/enums#stpmodes)
6252    ///
6253    /// This field is **optional.
6254    #[builder(setter(into), default)]
6255    #[serde(rename = "selfTradePreventionMode", default)]
6256    pub self_trade_prevention_mode: Option<SorOrderTestSelfTradePreventionModeEnum>,
6257    /// The value cannot be greater than `60000`. Supports up to three decimal places of precision (e.g., 6000.346) so that microseconds may be specified.
6258    ///
6259    /// This field is **optional.
6260    #[builder(setter(into), default)]
6261    #[serde(rename = "recvWindow", default)]
6262    pub recv_window: Option<rust_decimal::Decimal>,
6263}
6264
6265impl SorOrderTestParams {
6266    /// Create a builder for [`sor_order_test`].
6267    ///
6268    /// Required parameters:
6269    ///
6270    /// * `symbol` — String
6271    /// * `side` — Please see [Enums](/products/spot/enums#side) for supported values.
6272    /// * `r#type` — Please see [Enums](/products/spot/enums#ordertypes) for supported values.
6273    /// * `quantity` — `rust_decimal::Decimal`
6274    ///
6275    #[must_use]
6276    pub fn builder(
6277        symbol: String,
6278        side: SorOrderTestSideEnum,
6279        r#type: SorOrderTestTypeEnum,
6280        quantity: rust_decimal::Decimal,
6281    ) -> SorOrderTestParamsBuilder {
6282        SorOrderTestParamsBuilder::default()
6283            .symbol(symbol)
6284            .side(side)
6285            .r#type(r#type)
6286            .quantity(quantity)
6287    }
6288}
6289
6290#[async_trait]
6291impl TradeApi for TradeApiClient {
6292    async fn delete_open_orders(
6293        &self,
6294        params: DeleteOpenOrdersParams,
6295    ) -> anyhow::Result<RestApiResponse<Vec<models::DeleteOpenOrdersResponseInner>>> {
6296        let DeleteOpenOrdersParams {
6297            symbol,
6298            recv_window,
6299        } = params;
6300
6301        let mut query_params = BTreeMap::new();
6302        let body_params = BTreeMap::new();
6303
6304        query_params.insert("symbol".to_string(), json!(symbol));
6305
6306        if let Some(rw) = recv_window {
6307            query_params.insert("recvWindow".to_string(), json!(rw));
6308        }
6309
6310        send_request::<Vec<models::DeleteOpenOrdersResponseInner>>(
6311            &self.configuration,
6312            "/api/v3/openOrders",
6313            reqwest::Method::DELETE,
6314            query_params,
6315            body_params,
6316            if HAS_TIME_UNIT {
6317                self.configuration.time_unit
6318            } else {
6319                None
6320            },
6321            true,
6322        )
6323        .await
6324    }
6325
6326    async fn delete_order(
6327        &self,
6328        params: DeleteOrderParams,
6329    ) -> anyhow::Result<RestApiResponse<models::DeleteOrderResponse>> {
6330        let DeleteOrderParams {
6331            symbol,
6332            order_id,
6333            orig_client_order_id,
6334            new_client_order_id,
6335            cancel_restrictions,
6336            recv_window,
6337        } = params;
6338
6339        let mut query_params = BTreeMap::new();
6340        let body_params = BTreeMap::new();
6341
6342        query_params.insert("symbol".to_string(), json!(symbol));
6343
6344        if let Some(rw) = order_id {
6345            query_params.insert("orderId".to_string(), json!(rw));
6346        }
6347
6348        if let Some(rw) = orig_client_order_id {
6349            query_params.insert("origClientOrderId".to_string(), json!(rw));
6350        }
6351
6352        if let Some(rw) = new_client_order_id {
6353            query_params.insert("newClientOrderId".to_string(), json!(rw));
6354        }
6355
6356        if let Some(rw) = cancel_restrictions {
6357            query_params.insert("cancelRestrictions".to_string(), json!(rw));
6358        }
6359
6360        if let Some(rw) = recv_window {
6361            query_params.insert("recvWindow".to_string(), json!(rw));
6362        }
6363
6364        send_request::<models::DeleteOrderResponse>(
6365            &self.configuration,
6366            "/api/v3/order",
6367            reqwest::Method::DELETE,
6368            query_params,
6369            body_params,
6370            if HAS_TIME_UNIT {
6371                self.configuration.time_unit
6372            } else {
6373                None
6374            },
6375            true,
6376        )
6377        .await
6378    }
6379
6380    async fn delete_order_list(
6381        &self,
6382        params: DeleteOrderListParams,
6383    ) -> anyhow::Result<RestApiResponse<models::DeleteOrderListResponse>> {
6384        let DeleteOrderListParams {
6385            symbol,
6386            order_list_id,
6387            list_client_order_id,
6388            new_client_order_id,
6389            recv_window,
6390        } = params;
6391
6392        let mut query_params = BTreeMap::new();
6393        let body_params = BTreeMap::new();
6394
6395        query_params.insert("symbol".to_string(), json!(symbol));
6396
6397        if let Some(rw) = order_list_id {
6398            query_params.insert("orderListId".to_string(), json!(rw));
6399        }
6400
6401        if let Some(rw) = list_client_order_id {
6402            query_params.insert("listClientOrderId".to_string(), json!(rw));
6403        }
6404
6405        if let Some(rw) = new_client_order_id {
6406            query_params.insert("newClientOrderId".to_string(), json!(rw));
6407        }
6408
6409        if let Some(rw) = recv_window {
6410            query_params.insert("recvWindow".to_string(), json!(rw));
6411        }
6412
6413        send_request::<models::DeleteOrderListResponse>(
6414            &self.configuration,
6415            "/api/v3/orderList",
6416            reqwest::Method::DELETE,
6417            query_params,
6418            body_params,
6419            if HAS_TIME_UNIT {
6420                self.configuration.time_unit
6421            } else {
6422                None
6423            },
6424            true,
6425        )
6426        .await
6427    }
6428
6429    async fn new_order(
6430        &self,
6431        params: NewOrderParams,
6432    ) -> anyhow::Result<RestApiResponse<models::NewOrderResponse>> {
6433        let NewOrderParams {
6434            symbol,
6435            side,
6436            r#type,
6437            time_in_force,
6438            quantity,
6439            quote_order_qty,
6440            price,
6441            new_client_order_id,
6442            strategy_id,
6443            strategy_type,
6444            stop_price,
6445            trailing_delta,
6446            iceberg_qty,
6447            new_order_resp_type,
6448            self_trade_prevention_mode,
6449            peg_price_type,
6450            peg_offset_value,
6451            peg_offset_type,
6452            recv_window,
6453        } = params;
6454
6455        let mut query_params = BTreeMap::new();
6456        let body_params = BTreeMap::new();
6457
6458        query_params.insert("symbol".to_string(), json!(symbol));
6459
6460        query_params.insert("side".to_string(), json!(side));
6461
6462        query_params.insert("type".to_string(), json!(r#type));
6463
6464        if let Some(rw) = time_in_force {
6465            query_params.insert("timeInForce".to_string(), json!(rw));
6466        }
6467
6468        if let Some(rw) = quantity {
6469            query_params.insert("quantity".to_string(), json!(rw));
6470        }
6471
6472        if let Some(rw) = quote_order_qty {
6473            query_params.insert("quoteOrderQty".to_string(), json!(rw));
6474        }
6475
6476        if let Some(rw) = price {
6477            query_params.insert("price".to_string(), json!(rw));
6478        }
6479
6480        if let Some(rw) = new_client_order_id {
6481            query_params.insert("newClientOrderId".to_string(), json!(rw));
6482        }
6483
6484        if let Some(rw) = strategy_id {
6485            query_params.insert("strategyId".to_string(), json!(rw));
6486        }
6487
6488        if let Some(rw) = strategy_type {
6489            query_params.insert("strategyType".to_string(), json!(rw));
6490        }
6491
6492        if let Some(rw) = stop_price {
6493            query_params.insert("stopPrice".to_string(), json!(rw));
6494        }
6495
6496        if let Some(rw) = trailing_delta {
6497            query_params.insert("trailingDelta".to_string(), json!(rw));
6498        }
6499
6500        if let Some(rw) = iceberg_qty {
6501            query_params.insert("icebergQty".to_string(), json!(rw));
6502        }
6503
6504        if let Some(rw) = new_order_resp_type {
6505            query_params.insert("newOrderRespType".to_string(), json!(rw));
6506        }
6507
6508        if let Some(rw) = self_trade_prevention_mode {
6509            query_params.insert("selfTradePreventionMode".to_string(), json!(rw));
6510        }
6511
6512        if let Some(rw) = peg_price_type {
6513            query_params.insert("pegPriceType".to_string(), json!(rw));
6514        }
6515
6516        if let Some(rw) = peg_offset_value {
6517            query_params.insert("pegOffsetValue".to_string(), json!(rw));
6518        }
6519
6520        if let Some(rw) = peg_offset_type {
6521            query_params.insert("pegOffsetType".to_string(), json!(rw));
6522        }
6523
6524        if let Some(rw) = recv_window {
6525            query_params.insert("recvWindow".to_string(), json!(rw));
6526        }
6527
6528        send_request::<models::NewOrderResponse>(
6529            &self.configuration,
6530            "/api/v3/order",
6531            reqwest::Method::POST,
6532            query_params,
6533            body_params,
6534            if HAS_TIME_UNIT {
6535                self.configuration.time_unit
6536            } else {
6537                None
6538            },
6539            true,
6540        )
6541        .await
6542    }
6543
6544    async fn order_amend_keep_priority(
6545        &self,
6546        params: OrderAmendKeepPriorityParams,
6547    ) -> anyhow::Result<RestApiResponse<models::OrderAmendKeepPriorityResponse>> {
6548        let OrderAmendKeepPriorityParams {
6549            symbol,
6550            new_qty,
6551            order_id,
6552            orig_client_order_id,
6553            new_client_order_id,
6554            recv_window,
6555        } = params;
6556
6557        let mut query_params = BTreeMap::new();
6558        let body_params = BTreeMap::new();
6559
6560        query_params.insert("symbol".to_string(), json!(symbol));
6561
6562        if let Some(rw) = order_id {
6563            query_params.insert("orderId".to_string(), json!(rw));
6564        }
6565
6566        if let Some(rw) = orig_client_order_id {
6567            query_params.insert("origClientOrderId".to_string(), json!(rw));
6568        }
6569
6570        if let Some(rw) = new_client_order_id {
6571            query_params.insert("newClientOrderId".to_string(), json!(rw));
6572        }
6573
6574        query_params.insert("newQty".to_string(), json!(new_qty));
6575
6576        if let Some(rw) = recv_window {
6577            query_params.insert("recvWindow".to_string(), json!(rw));
6578        }
6579
6580        send_request::<models::OrderAmendKeepPriorityResponse>(
6581            &self.configuration,
6582            "/api/v3/order/amend/keepPriority",
6583            reqwest::Method::PUT,
6584            query_params,
6585            body_params,
6586            if HAS_TIME_UNIT {
6587                self.configuration.time_unit
6588            } else {
6589                None
6590            },
6591            true,
6592        )
6593        .await
6594    }
6595
6596    async fn order_cancel_replace(
6597        &self,
6598        params: OrderCancelReplaceParams,
6599    ) -> anyhow::Result<RestApiResponse<models::OrderCancelReplaceResponse>> {
6600        let OrderCancelReplaceParams {
6601            symbol,
6602            side,
6603            r#type,
6604            cancel_replace_mode,
6605            time_in_force,
6606            quantity,
6607            quote_order_qty,
6608            price,
6609            cancel_new_client_order_id,
6610            cancel_orig_client_order_id,
6611            cancel_order_id,
6612            new_client_order_id,
6613            strategy_id,
6614            strategy_type,
6615            stop_price,
6616            trailing_delta,
6617            iceberg_qty,
6618            new_order_resp_type,
6619            self_trade_prevention_mode,
6620            cancel_restrictions,
6621            order_rate_limit_exceeded_mode,
6622            peg_price_type,
6623            peg_offset_value,
6624            peg_offset_type,
6625            recv_window,
6626        } = params;
6627
6628        let mut query_params = BTreeMap::new();
6629        let body_params = BTreeMap::new();
6630
6631        query_params.insert("symbol".to_string(), json!(symbol));
6632
6633        query_params.insert("side".to_string(), json!(side));
6634
6635        query_params.insert("type".to_string(), json!(r#type));
6636
6637        query_params.insert("cancelReplaceMode".to_string(), json!(cancel_replace_mode));
6638
6639        if let Some(rw) = time_in_force {
6640            query_params.insert("timeInForce".to_string(), json!(rw));
6641        }
6642
6643        if let Some(rw) = quantity {
6644            query_params.insert("quantity".to_string(), json!(rw));
6645        }
6646
6647        if let Some(rw) = quote_order_qty {
6648            query_params.insert("quoteOrderQty".to_string(), json!(rw));
6649        }
6650
6651        if let Some(rw) = price {
6652            query_params.insert("price".to_string(), json!(rw));
6653        }
6654
6655        if let Some(rw) = cancel_new_client_order_id {
6656            query_params.insert("cancelNewClientOrderId".to_string(), json!(rw));
6657        }
6658
6659        if let Some(rw) = cancel_orig_client_order_id {
6660            query_params.insert("cancelOrigClientOrderId".to_string(), json!(rw));
6661        }
6662
6663        if let Some(rw) = cancel_order_id {
6664            query_params.insert("cancelOrderId".to_string(), json!(rw));
6665        }
6666
6667        if let Some(rw) = new_client_order_id {
6668            query_params.insert("newClientOrderId".to_string(), json!(rw));
6669        }
6670
6671        if let Some(rw) = strategy_id {
6672            query_params.insert("strategyId".to_string(), json!(rw));
6673        }
6674
6675        if let Some(rw) = strategy_type {
6676            query_params.insert("strategyType".to_string(), json!(rw));
6677        }
6678
6679        if let Some(rw) = stop_price {
6680            query_params.insert("stopPrice".to_string(), json!(rw));
6681        }
6682
6683        if let Some(rw) = trailing_delta {
6684            query_params.insert("trailingDelta".to_string(), json!(rw));
6685        }
6686
6687        if let Some(rw) = iceberg_qty {
6688            query_params.insert("icebergQty".to_string(), json!(rw));
6689        }
6690
6691        if let Some(rw) = new_order_resp_type {
6692            query_params.insert("newOrderRespType".to_string(), json!(rw));
6693        }
6694
6695        if let Some(rw) = self_trade_prevention_mode {
6696            query_params.insert("selfTradePreventionMode".to_string(), json!(rw));
6697        }
6698
6699        if let Some(rw) = cancel_restrictions {
6700            query_params.insert("cancelRestrictions".to_string(), json!(rw));
6701        }
6702
6703        if let Some(rw) = order_rate_limit_exceeded_mode {
6704            query_params.insert("orderRateLimitExceededMode".to_string(), json!(rw));
6705        }
6706
6707        if let Some(rw) = peg_price_type {
6708            query_params.insert("pegPriceType".to_string(), json!(rw));
6709        }
6710
6711        if let Some(rw) = peg_offset_value {
6712            query_params.insert("pegOffsetValue".to_string(), json!(rw));
6713        }
6714
6715        if let Some(rw) = peg_offset_type {
6716            query_params.insert("pegOffsetType".to_string(), json!(rw));
6717        }
6718
6719        if let Some(rw) = recv_window {
6720            query_params.insert("recvWindow".to_string(), json!(rw));
6721        }
6722
6723        send_request::<models::OrderCancelReplaceResponse>(
6724            &self.configuration,
6725            "/api/v3/order/cancelReplace",
6726            reqwest::Method::POST,
6727            query_params,
6728            body_params,
6729            if HAS_TIME_UNIT {
6730                self.configuration.time_unit
6731            } else {
6732                None
6733            },
6734            true,
6735        )
6736        .await
6737    }
6738
6739    async fn order_list_oco(
6740        &self,
6741        params: OrderListOcoParams,
6742    ) -> anyhow::Result<RestApiResponse<models::OrderListOcoResponse>> {
6743        let OrderListOcoParams {
6744            symbol,
6745            side,
6746            quantity,
6747            above_type,
6748            below_type,
6749            list_client_order_id,
6750            above_client_order_id,
6751            above_iceberg_qty,
6752            above_price,
6753            above_stop_price,
6754            above_trailing_delta,
6755            above_time_in_force,
6756            above_strategy_id,
6757            above_strategy_type,
6758            above_peg_price_type,
6759            above_peg_offset_type,
6760            above_peg_offset_value,
6761            below_client_order_id,
6762            below_iceberg_qty,
6763            below_price,
6764            below_stop_price,
6765            below_trailing_delta,
6766            below_time_in_force,
6767            below_strategy_id,
6768            below_strategy_type,
6769            below_peg_price_type,
6770            below_peg_offset_type,
6771            below_peg_offset_value,
6772            new_order_resp_type,
6773            self_trade_prevention_mode,
6774            recv_window,
6775        } = params;
6776
6777        let mut query_params = BTreeMap::new();
6778        let body_params = BTreeMap::new();
6779
6780        query_params.insert("symbol".to_string(), json!(symbol));
6781
6782        if let Some(rw) = list_client_order_id {
6783            query_params.insert("listClientOrderId".to_string(), json!(rw));
6784        }
6785
6786        query_params.insert("side".to_string(), json!(side));
6787
6788        query_params.insert("quantity".to_string(), json!(quantity));
6789
6790        query_params.insert("aboveType".to_string(), json!(above_type));
6791
6792        if let Some(rw) = above_client_order_id {
6793            query_params.insert("aboveClientOrderId".to_string(), json!(rw));
6794        }
6795
6796        if let Some(rw) = above_iceberg_qty {
6797            query_params.insert("aboveIcebergQty".to_string(), json!(rw));
6798        }
6799
6800        if let Some(rw) = above_price {
6801            query_params.insert("abovePrice".to_string(), json!(rw));
6802        }
6803
6804        if let Some(rw) = above_stop_price {
6805            query_params.insert("aboveStopPrice".to_string(), json!(rw));
6806        }
6807
6808        if let Some(rw) = above_trailing_delta {
6809            query_params.insert("aboveTrailingDelta".to_string(), json!(rw));
6810        }
6811
6812        if let Some(rw) = above_time_in_force {
6813            query_params.insert("aboveTimeInForce".to_string(), json!(rw));
6814        }
6815
6816        if let Some(rw) = above_strategy_id {
6817            query_params.insert("aboveStrategyId".to_string(), json!(rw));
6818        }
6819
6820        if let Some(rw) = above_strategy_type {
6821            query_params.insert("aboveStrategyType".to_string(), json!(rw));
6822        }
6823
6824        if let Some(rw) = above_peg_price_type {
6825            query_params.insert("abovePegPriceType".to_string(), json!(rw));
6826        }
6827
6828        if let Some(rw) = above_peg_offset_type {
6829            query_params.insert("abovePegOffsetType".to_string(), json!(rw));
6830        }
6831
6832        if let Some(rw) = above_peg_offset_value {
6833            query_params.insert("abovePegOffsetValue".to_string(), json!(rw));
6834        }
6835
6836        query_params.insert("belowType".to_string(), json!(below_type));
6837
6838        if let Some(rw) = below_client_order_id {
6839            query_params.insert("belowClientOrderId".to_string(), json!(rw));
6840        }
6841
6842        if let Some(rw) = below_iceberg_qty {
6843            query_params.insert("belowIcebergQty".to_string(), json!(rw));
6844        }
6845
6846        if let Some(rw) = below_price {
6847            query_params.insert("belowPrice".to_string(), json!(rw));
6848        }
6849
6850        if let Some(rw) = below_stop_price {
6851            query_params.insert("belowStopPrice".to_string(), json!(rw));
6852        }
6853
6854        if let Some(rw) = below_trailing_delta {
6855            query_params.insert("belowTrailingDelta".to_string(), json!(rw));
6856        }
6857
6858        if let Some(rw) = below_time_in_force {
6859            query_params.insert("belowTimeInForce".to_string(), json!(rw));
6860        }
6861
6862        if let Some(rw) = below_strategy_id {
6863            query_params.insert("belowStrategyId".to_string(), json!(rw));
6864        }
6865
6866        if let Some(rw) = below_strategy_type {
6867            query_params.insert("belowStrategyType".to_string(), json!(rw));
6868        }
6869
6870        if let Some(rw) = below_peg_price_type {
6871            query_params.insert("belowPegPriceType".to_string(), json!(rw));
6872        }
6873
6874        if let Some(rw) = below_peg_offset_type {
6875            query_params.insert("belowPegOffsetType".to_string(), json!(rw));
6876        }
6877
6878        if let Some(rw) = below_peg_offset_value {
6879            query_params.insert("belowPegOffsetValue".to_string(), json!(rw));
6880        }
6881
6882        if let Some(rw) = new_order_resp_type {
6883            query_params.insert("newOrderRespType".to_string(), json!(rw));
6884        }
6885
6886        if let Some(rw) = self_trade_prevention_mode {
6887            query_params.insert("selfTradePreventionMode".to_string(), json!(rw));
6888        }
6889
6890        if let Some(rw) = recv_window {
6891            query_params.insert("recvWindow".to_string(), json!(rw));
6892        }
6893
6894        send_request::<models::OrderListOcoResponse>(
6895            &self.configuration,
6896            "/api/v3/orderList/oco",
6897            reqwest::Method::POST,
6898            query_params,
6899            body_params,
6900            if HAS_TIME_UNIT {
6901                self.configuration.time_unit
6902            } else {
6903                None
6904            },
6905            true,
6906        )
6907        .await
6908    }
6909
6910    async fn order_list_opo(
6911        &self,
6912        params: OrderListOpoParams,
6913    ) -> anyhow::Result<RestApiResponse<models::OrderListOpoResponse>> {
6914        let OrderListOpoParams {
6915            symbol,
6916            working_type,
6917            working_side,
6918            working_price,
6919            working_quantity,
6920            pending_type,
6921            pending_side,
6922            list_client_order_id,
6923            new_order_resp_type,
6924            self_trade_prevention_mode,
6925            working_client_order_id,
6926            working_iceberg_qty,
6927            working_time_in_force,
6928            working_strategy_id,
6929            working_strategy_type,
6930            working_peg_price_type,
6931            working_peg_offset_type,
6932            working_peg_offset_value,
6933            pending_client_order_id,
6934            pending_price,
6935            pending_stop_price,
6936            pending_trailing_delta,
6937            pending_iceberg_qty,
6938            pending_time_in_force,
6939            pending_strategy_id,
6940            pending_strategy_type,
6941            pending_peg_price_type,
6942            pending_peg_offset_type,
6943            pending_peg_offset_value,
6944            recv_window,
6945        } = params;
6946
6947        let mut query_params = BTreeMap::new();
6948        let body_params = BTreeMap::new();
6949
6950        query_params.insert("symbol".to_string(), json!(symbol));
6951
6952        if let Some(rw) = list_client_order_id {
6953            query_params.insert("listClientOrderId".to_string(), json!(rw));
6954        }
6955
6956        if let Some(rw) = new_order_resp_type {
6957            query_params.insert("newOrderRespType".to_string(), json!(rw));
6958        }
6959
6960        if let Some(rw) = self_trade_prevention_mode {
6961            query_params.insert("selfTradePreventionMode".to_string(), json!(rw));
6962        }
6963
6964        query_params.insert("workingType".to_string(), json!(working_type));
6965
6966        query_params.insert("workingSide".to_string(), json!(working_side));
6967
6968        if let Some(rw) = working_client_order_id {
6969            query_params.insert("workingClientOrderId".to_string(), json!(rw));
6970        }
6971
6972        query_params.insert("workingPrice".to_string(), json!(working_price));
6973
6974        query_params.insert("workingQuantity".to_string(), json!(working_quantity));
6975
6976        if let Some(rw) = working_iceberg_qty {
6977            query_params.insert("workingIcebergQty".to_string(), json!(rw));
6978        }
6979
6980        if let Some(rw) = working_time_in_force {
6981            query_params.insert("workingTimeInForce".to_string(), json!(rw));
6982        }
6983
6984        if let Some(rw) = working_strategy_id {
6985            query_params.insert("workingStrategyId".to_string(), json!(rw));
6986        }
6987
6988        if let Some(rw) = working_strategy_type {
6989            query_params.insert("workingStrategyType".to_string(), json!(rw));
6990        }
6991
6992        if let Some(rw) = working_peg_price_type {
6993            query_params.insert("workingPegPriceType".to_string(), json!(rw));
6994        }
6995
6996        if let Some(rw) = working_peg_offset_type {
6997            query_params.insert("workingPegOffsetType".to_string(), json!(rw));
6998        }
6999
7000        if let Some(rw) = working_peg_offset_value {
7001            query_params.insert("workingPegOffsetValue".to_string(), json!(rw));
7002        }
7003
7004        query_params.insert("pendingType".to_string(), json!(pending_type));
7005
7006        query_params.insert("pendingSide".to_string(), json!(pending_side));
7007
7008        if let Some(rw) = pending_client_order_id {
7009            query_params.insert("pendingClientOrderId".to_string(), json!(rw));
7010        }
7011
7012        if let Some(rw) = pending_price {
7013            query_params.insert("pendingPrice".to_string(), json!(rw));
7014        }
7015
7016        if let Some(rw) = pending_stop_price {
7017            query_params.insert("pendingStopPrice".to_string(), json!(rw));
7018        }
7019
7020        if let Some(rw) = pending_trailing_delta {
7021            query_params.insert("pendingTrailingDelta".to_string(), json!(rw));
7022        }
7023
7024        if let Some(rw) = pending_iceberg_qty {
7025            query_params.insert("pendingIcebergQty".to_string(), json!(rw));
7026        }
7027
7028        if let Some(rw) = pending_time_in_force {
7029            query_params.insert("pendingTimeInForce".to_string(), json!(rw));
7030        }
7031
7032        if let Some(rw) = pending_strategy_id {
7033            query_params.insert("pendingStrategyId".to_string(), json!(rw));
7034        }
7035
7036        if let Some(rw) = pending_strategy_type {
7037            query_params.insert("pendingStrategyType".to_string(), json!(rw));
7038        }
7039
7040        if let Some(rw) = pending_peg_price_type {
7041            query_params.insert("pendingPegPriceType".to_string(), json!(rw));
7042        }
7043
7044        if let Some(rw) = pending_peg_offset_type {
7045            query_params.insert("pendingPegOffsetType".to_string(), json!(rw));
7046        }
7047
7048        if let Some(rw) = pending_peg_offset_value {
7049            query_params.insert("pendingPegOffsetValue".to_string(), json!(rw));
7050        }
7051
7052        if let Some(rw) = recv_window {
7053            query_params.insert("recvWindow".to_string(), json!(rw));
7054        }
7055
7056        send_request::<models::OrderListOpoResponse>(
7057            &self.configuration,
7058            "/api/v3/orderList/opo",
7059            reqwest::Method::POST,
7060            query_params,
7061            body_params,
7062            if HAS_TIME_UNIT {
7063                self.configuration.time_unit
7064            } else {
7065                None
7066            },
7067            true,
7068        )
7069        .await
7070    }
7071
7072    async fn order_list_opoco(
7073        &self,
7074        params: OrderListOpocoParams,
7075    ) -> anyhow::Result<RestApiResponse<models::OrderListOpocoResponse>> {
7076        let OrderListOpocoParams {
7077            symbol,
7078            working_type,
7079            working_side,
7080            working_price,
7081            working_quantity,
7082            pending_side,
7083            pending_above_type,
7084            list_client_order_id,
7085            new_order_resp_type,
7086            self_trade_prevention_mode,
7087            working_client_order_id,
7088            working_iceberg_qty,
7089            working_time_in_force,
7090            working_strategy_id,
7091            working_strategy_type,
7092            working_peg_price_type,
7093            working_peg_offset_type,
7094            working_peg_offset_value,
7095            pending_above_client_order_id,
7096            pending_above_price,
7097            pending_above_stop_price,
7098            pending_above_trailing_delta,
7099            pending_above_iceberg_qty,
7100            pending_above_time_in_force,
7101            pending_above_strategy_id,
7102            pending_above_strategy_type,
7103            pending_above_peg_price_type,
7104            pending_above_peg_offset_type,
7105            pending_above_peg_offset_value,
7106            pending_below_type,
7107            pending_below_client_order_id,
7108            pending_below_price,
7109            pending_below_stop_price,
7110            pending_below_trailing_delta,
7111            pending_below_iceberg_qty,
7112            pending_below_time_in_force,
7113            pending_below_strategy_id,
7114            pending_below_strategy_type,
7115            pending_below_peg_price_type,
7116            pending_below_peg_offset_type,
7117            pending_below_peg_offset_value,
7118            recv_window,
7119        } = params;
7120
7121        let mut query_params = BTreeMap::new();
7122        let body_params = BTreeMap::new();
7123
7124        query_params.insert("symbol".to_string(), json!(symbol));
7125
7126        if let Some(rw) = list_client_order_id {
7127            query_params.insert("listClientOrderId".to_string(), json!(rw));
7128        }
7129
7130        if let Some(rw) = new_order_resp_type {
7131            query_params.insert("newOrderRespType".to_string(), json!(rw));
7132        }
7133
7134        if let Some(rw) = self_trade_prevention_mode {
7135            query_params.insert("selfTradePreventionMode".to_string(), json!(rw));
7136        }
7137
7138        query_params.insert("workingType".to_string(), json!(working_type));
7139
7140        query_params.insert("workingSide".to_string(), json!(working_side));
7141
7142        if let Some(rw) = working_client_order_id {
7143            query_params.insert("workingClientOrderId".to_string(), json!(rw));
7144        }
7145
7146        query_params.insert("workingPrice".to_string(), json!(working_price));
7147
7148        query_params.insert("workingQuantity".to_string(), json!(working_quantity));
7149
7150        if let Some(rw) = working_iceberg_qty {
7151            query_params.insert("workingIcebergQty".to_string(), json!(rw));
7152        }
7153
7154        if let Some(rw) = working_time_in_force {
7155            query_params.insert("workingTimeInForce".to_string(), json!(rw));
7156        }
7157
7158        if let Some(rw) = working_strategy_id {
7159            query_params.insert("workingStrategyId".to_string(), json!(rw));
7160        }
7161
7162        if let Some(rw) = working_strategy_type {
7163            query_params.insert("workingStrategyType".to_string(), json!(rw));
7164        }
7165
7166        if let Some(rw) = working_peg_price_type {
7167            query_params.insert("workingPegPriceType".to_string(), json!(rw));
7168        }
7169
7170        if let Some(rw) = working_peg_offset_type {
7171            query_params.insert("workingPegOffsetType".to_string(), json!(rw));
7172        }
7173
7174        if let Some(rw) = working_peg_offset_value {
7175            query_params.insert("workingPegOffsetValue".to_string(), json!(rw));
7176        }
7177
7178        query_params.insert("pendingSide".to_string(), json!(pending_side));
7179
7180        query_params.insert("pendingAboveType".to_string(), json!(pending_above_type));
7181
7182        if let Some(rw) = pending_above_client_order_id {
7183            query_params.insert("pendingAboveClientOrderId".to_string(), json!(rw));
7184        }
7185
7186        if let Some(rw) = pending_above_price {
7187            query_params.insert("pendingAbovePrice".to_string(), json!(rw));
7188        }
7189
7190        if let Some(rw) = pending_above_stop_price {
7191            query_params.insert("pendingAboveStopPrice".to_string(), json!(rw));
7192        }
7193
7194        if let Some(rw) = pending_above_trailing_delta {
7195            query_params.insert("pendingAboveTrailingDelta".to_string(), json!(rw));
7196        }
7197
7198        if let Some(rw) = pending_above_iceberg_qty {
7199            query_params.insert("pendingAboveIcebergQty".to_string(), json!(rw));
7200        }
7201
7202        if let Some(rw) = pending_above_time_in_force {
7203            query_params.insert("pendingAboveTimeInForce".to_string(), json!(rw));
7204        }
7205
7206        if let Some(rw) = pending_above_strategy_id {
7207            query_params.insert("pendingAboveStrategyId".to_string(), json!(rw));
7208        }
7209
7210        if let Some(rw) = pending_above_strategy_type {
7211            query_params.insert("pendingAboveStrategyType".to_string(), json!(rw));
7212        }
7213
7214        if let Some(rw) = pending_above_peg_price_type {
7215            query_params.insert("pendingAbovePegPriceType".to_string(), json!(rw));
7216        }
7217
7218        if let Some(rw) = pending_above_peg_offset_type {
7219            query_params.insert("pendingAbovePegOffsetType".to_string(), json!(rw));
7220        }
7221
7222        if let Some(rw) = pending_above_peg_offset_value {
7223            query_params.insert("pendingAbovePegOffsetValue".to_string(), json!(rw));
7224        }
7225
7226        if let Some(rw) = pending_below_type {
7227            query_params.insert("pendingBelowType".to_string(), json!(rw));
7228        }
7229
7230        if let Some(rw) = pending_below_client_order_id {
7231            query_params.insert("pendingBelowClientOrderId".to_string(), json!(rw));
7232        }
7233
7234        if let Some(rw) = pending_below_price {
7235            query_params.insert("pendingBelowPrice".to_string(), json!(rw));
7236        }
7237
7238        if let Some(rw) = pending_below_stop_price {
7239            query_params.insert("pendingBelowStopPrice".to_string(), json!(rw));
7240        }
7241
7242        if let Some(rw) = pending_below_trailing_delta {
7243            query_params.insert("pendingBelowTrailingDelta".to_string(), json!(rw));
7244        }
7245
7246        if let Some(rw) = pending_below_iceberg_qty {
7247            query_params.insert("pendingBelowIcebergQty".to_string(), json!(rw));
7248        }
7249
7250        if let Some(rw) = pending_below_time_in_force {
7251            query_params.insert("pendingBelowTimeInForce".to_string(), json!(rw));
7252        }
7253
7254        if let Some(rw) = pending_below_strategy_id {
7255            query_params.insert("pendingBelowStrategyId".to_string(), json!(rw));
7256        }
7257
7258        if let Some(rw) = pending_below_strategy_type {
7259            query_params.insert("pendingBelowStrategyType".to_string(), json!(rw));
7260        }
7261
7262        if let Some(rw) = pending_below_peg_price_type {
7263            query_params.insert("pendingBelowPegPriceType".to_string(), json!(rw));
7264        }
7265
7266        if let Some(rw) = pending_below_peg_offset_type {
7267            query_params.insert("pendingBelowPegOffsetType".to_string(), json!(rw));
7268        }
7269
7270        if let Some(rw) = pending_below_peg_offset_value {
7271            query_params.insert("pendingBelowPegOffsetValue".to_string(), json!(rw));
7272        }
7273
7274        if let Some(rw) = recv_window {
7275            query_params.insert("recvWindow".to_string(), json!(rw));
7276        }
7277
7278        send_request::<models::OrderListOpocoResponse>(
7279            &self.configuration,
7280            "/api/v3/orderList/opoco",
7281            reqwest::Method::POST,
7282            query_params,
7283            body_params,
7284            if HAS_TIME_UNIT {
7285                self.configuration.time_unit
7286            } else {
7287                None
7288            },
7289            true,
7290        )
7291        .await
7292    }
7293
7294    async fn order_list_oto(
7295        &self,
7296        params: OrderListOtoParams,
7297    ) -> anyhow::Result<RestApiResponse<models::OrderListOtoResponse>> {
7298        let OrderListOtoParams {
7299            symbol,
7300            working_type,
7301            working_side,
7302            working_price,
7303            working_quantity,
7304            pending_type,
7305            pending_side,
7306            pending_quantity,
7307            list_client_order_id,
7308            new_order_resp_type,
7309            self_trade_prevention_mode,
7310            working_client_order_id,
7311            working_iceberg_qty,
7312            working_time_in_force,
7313            working_strategy_id,
7314            working_strategy_type,
7315            working_peg_price_type,
7316            working_peg_offset_type,
7317            working_peg_offset_value,
7318            pending_client_order_id,
7319            pending_price,
7320            pending_stop_price,
7321            pending_trailing_delta,
7322            pending_iceberg_qty,
7323            pending_time_in_force,
7324            pending_strategy_id,
7325            pending_strategy_type,
7326            pending_peg_price_type,
7327            pending_peg_offset_type,
7328            pending_peg_offset_value,
7329            recv_window,
7330        } = params;
7331
7332        let mut query_params = BTreeMap::new();
7333        let body_params = BTreeMap::new();
7334
7335        query_params.insert("symbol".to_string(), json!(symbol));
7336
7337        if let Some(rw) = list_client_order_id {
7338            query_params.insert("listClientOrderId".to_string(), json!(rw));
7339        }
7340
7341        if let Some(rw) = new_order_resp_type {
7342            query_params.insert("newOrderRespType".to_string(), json!(rw));
7343        }
7344
7345        if let Some(rw) = self_trade_prevention_mode {
7346            query_params.insert("selfTradePreventionMode".to_string(), json!(rw));
7347        }
7348
7349        query_params.insert("workingType".to_string(), json!(working_type));
7350
7351        query_params.insert("workingSide".to_string(), json!(working_side));
7352
7353        if let Some(rw) = working_client_order_id {
7354            query_params.insert("workingClientOrderId".to_string(), json!(rw));
7355        }
7356
7357        query_params.insert("workingPrice".to_string(), json!(working_price));
7358
7359        query_params.insert("workingQuantity".to_string(), json!(working_quantity));
7360
7361        if let Some(rw) = working_iceberg_qty {
7362            query_params.insert("workingIcebergQty".to_string(), json!(rw));
7363        }
7364
7365        if let Some(rw) = working_time_in_force {
7366            query_params.insert("workingTimeInForce".to_string(), json!(rw));
7367        }
7368
7369        if let Some(rw) = working_strategy_id {
7370            query_params.insert("workingStrategyId".to_string(), json!(rw));
7371        }
7372
7373        if let Some(rw) = working_strategy_type {
7374            query_params.insert("workingStrategyType".to_string(), json!(rw));
7375        }
7376
7377        query_params.insert("pendingType".to_string(), json!(pending_type));
7378
7379        if let Some(rw) = working_peg_price_type {
7380            query_params.insert("workingPegPriceType".to_string(), json!(rw));
7381        }
7382
7383        if let Some(rw) = working_peg_offset_type {
7384            query_params.insert("workingPegOffsetType".to_string(), json!(rw));
7385        }
7386
7387        if let Some(rw) = working_peg_offset_value {
7388            query_params.insert("workingPegOffsetValue".to_string(), json!(rw));
7389        }
7390
7391        query_params.insert("pendingSide".to_string(), json!(pending_side));
7392
7393        if let Some(rw) = pending_client_order_id {
7394            query_params.insert("pendingClientOrderId".to_string(), json!(rw));
7395        }
7396
7397        if let Some(rw) = pending_price {
7398            query_params.insert("pendingPrice".to_string(), json!(rw));
7399        }
7400
7401        if let Some(rw) = pending_stop_price {
7402            query_params.insert("pendingStopPrice".to_string(), json!(rw));
7403        }
7404
7405        if let Some(rw) = pending_trailing_delta {
7406            query_params.insert("pendingTrailingDelta".to_string(), json!(rw));
7407        }
7408
7409        query_params.insert("pendingQuantity".to_string(), json!(pending_quantity));
7410
7411        if let Some(rw) = pending_iceberg_qty {
7412            query_params.insert("pendingIcebergQty".to_string(), json!(rw));
7413        }
7414
7415        if let Some(rw) = pending_time_in_force {
7416            query_params.insert("pendingTimeInForce".to_string(), json!(rw));
7417        }
7418
7419        if let Some(rw) = pending_strategy_id {
7420            query_params.insert("pendingStrategyId".to_string(), json!(rw));
7421        }
7422
7423        if let Some(rw) = pending_strategy_type {
7424            query_params.insert("pendingStrategyType".to_string(), json!(rw));
7425        }
7426
7427        if let Some(rw) = pending_peg_price_type {
7428            query_params.insert("pendingPegPriceType".to_string(), json!(rw));
7429        }
7430
7431        if let Some(rw) = pending_peg_offset_type {
7432            query_params.insert("pendingPegOffsetType".to_string(), json!(rw));
7433        }
7434
7435        if let Some(rw) = pending_peg_offset_value {
7436            query_params.insert("pendingPegOffsetValue".to_string(), json!(rw));
7437        }
7438
7439        if let Some(rw) = recv_window {
7440            query_params.insert("recvWindow".to_string(), json!(rw));
7441        }
7442
7443        send_request::<models::OrderListOtoResponse>(
7444            &self.configuration,
7445            "/api/v3/orderList/oto",
7446            reqwest::Method::POST,
7447            query_params,
7448            body_params,
7449            if HAS_TIME_UNIT {
7450                self.configuration.time_unit
7451            } else {
7452                None
7453            },
7454            true,
7455        )
7456        .await
7457    }
7458
7459    async fn order_list_otoco(
7460        &self,
7461        params: OrderListOtocoParams,
7462    ) -> anyhow::Result<RestApiResponse<models::OrderListOtocoResponse>> {
7463        let OrderListOtocoParams {
7464            symbol,
7465            working_type,
7466            working_side,
7467            working_price,
7468            working_quantity,
7469            pending_side,
7470            pending_quantity,
7471            pending_above_type,
7472            list_client_order_id,
7473            new_order_resp_type,
7474            self_trade_prevention_mode,
7475            working_client_order_id,
7476            working_iceberg_qty,
7477            working_time_in_force,
7478            working_strategy_id,
7479            working_strategy_type,
7480            working_peg_price_type,
7481            working_peg_offset_type,
7482            working_peg_offset_value,
7483            pending_above_client_order_id,
7484            pending_above_price,
7485            pending_above_stop_price,
7486            pending_above_trailing_delta,
7487            pending_above_iceberg_qty,
7488            pending_above_time_in_force,
7489            pending_above_strategy_id,
7490            pending_above_strategy_type,
7491            pending_above_peg_price_type,
7492            pending_above_peg_offset_type,
7493            pending_above_peg_offset_value,
7494            pending_below_type,
7495            pending_below_client_order_id,
7496            pending_below_price,
7497            pending_below_stop_price,
7498            pending_below_trailing_delta,
7499            pending_below_iceberg_qty,
7500            pending_below_time_in_force,
7501            pending_below_strategy_id,
7502            pending_below_strategy_type,
7503            pending_below_peg_price_type,
7504            pending_below_peg_offset_type,
7505            pending_below_peg_offset_value,
7506            recv_window,
7507        } = params;
7508
7509        let mut query_params = BTreeMap::new();
7510        let body_params = BTreeMap::new();
7511
7512        query_params.insert("symbol".to_string(), json!(symbol));
7513
7514        if let Some(rw) = list_client_order_id {
7515            query_params.insert("listClientOrderId".to_string(), json!(rw));
7516        }
7517
7518        if let Some(rw) = new_order_resp_type {
7519            query_params.insert("newOrderRespType".to_string(), json!(rw));
7520        }
7521
7522        if let Some(rw) = self_trade_prevention_mode {
7523            query_params.insert("selfTradePreventionMode".to_string(), json!(rw));
7524        }
7525
7526        query_params.insert("workingType".to_string(), json!(working_type));
7527
7528        query_params.insert("workingSide".to_string(), json!(working_side));
7529
7530        if let Some(rw) = working_client_order_id {
7531            query_params.insert("workingClientOrderId".to_string(), json!(rw));
7532        }
7533
7534        query_params.insert("workingPrice".to_string(), json!(working_price));
7535
7536        query_params.insert("workingQuantity".to_string(), json!(working_quantity));
7537
7538        if let Some(rw) = working_iceberg_qty {
7539            query_params.insert("workingIcebergQty".to_string(), json!(rw));
7540        }
7541
7542        if let Some(rw) = working_time_in_force {
7543            query_params.insert("workingTimeInForce".to_string(), json!(rw));
7544        }
7545
7546        if let Some(rw) = working_strategy_id {
7547            query_params.insert("workingStrategyId".to_string(), json!(rw));
7548        }
7549
7550        if let Some(rw) = working_strategy_type {
7551            query_params.insert("workingStrategyType".to_string(), json!(rw));
7552        }
7553
7554        if let Some(rw) = working_peg_price_type {
7555            query_params.insert("workingPegPriceType".to_string(), json!(rw));
7556        }
7557
7558        if let Some(rw) = working_peg_offset_type {
7559            query_params.insert("workingPegOffsetType".to_string(), json!(rw));
7560        }
7561
7562        if let Some(rw) = working_peg_offset_value {
7563            query_params.insert("workingPegOffsetValue".to_string(), json!(rw));
7564        }
7565
7566        query_params.insert("pendingSide".to_string(), json!(pending_side));
7567
7568        query_params.insert("pendingQuantity".to_string(), json!(pending_quantity));
7569
7570        query_params.insert("pendingAboveType".to_string(), json!(pending_above_type));
7571
7572        if let Some(rw) = pending_above_client_order_id {
7573            query_params.insert("pendingAboveClientOrderId".to_string(), json!(rw));
7574        }
7575
7576        if let Some(rw) = pending_above_price {
7577            query_params.insert("pendingAbovePrice".to_string(), json!(rw));
7578        }
7579
7580        if let Some(rw) = pending_above_stop_price {
7581            query_params.insert("pendingAboveStopPrice".to_string(), json!(rw));
7582        }
7583
7584        if let Some(rw) = pending_above_trailing_delta {
7585            query_params.insert("pendingAboveTrailingDelta".to_string(), json!(rw));
7586        }
7587
7588        if let Some(rw) = pending_above_iceberg_qty {
7589            query_params.insert("pendingAboveIcebergQty".to_string(), json!(rw));
7590        }
7591
7592        if let Some(rw) = pending_above_time_in_force {
7593            query_params.insert("pendingAboveTimeInForce".to_string(), json!(rw));
7594        }
7595
7596        if let Some(rw) = pending_above_strategy_id {
7597            query_params.insert("pendingAboveStrategyId".to_string(), json!(rw));
7598        }
7599
7600        if let Some(rw) = pending_above_strategy_type {
7601            query_params.insert("pendingAboveStrategyType".to_string(), json!(rw));
7602        }
7603
7604        if let Some(rw) = pending_above_peg_price_type {
7605            query_params.insert("pendingAbovePegPriceType".to_string(), json!(rw));
7606        }
7607
7608        if let Some(rw) = pending_above_peg_offset_type {
7609            query_params.insert("pendingAbovePegOffsetType".to_string(), json!(rw));
7610        }
7611
7612        if let Some(rw) = pending_above_peg_offset_value {
7613            query_params.insert("pendingAbovePegOffsetValue".to_string(), json!(rw));
7614        }
7615
7616        if let Some(rw) = pending_below_type {
7617            query_params.insert("pendingBelowType".to_string(), json!(rw));
7618        }
7619
7620        if let Some(rw) = pending_below_client_order_id {
7621            query_params.insert("pendingBelowClientOrderId".to_string(), json!(rw));
7622        }
7623
7624        if let Some(rw) = pending_below_price {
7625            query_params.insert("pendingBelowPrice".to_string(), json!(rw));
7626        }
7627
7628        if let Some(rw) = pending_below_stop_price {
7629            query_params.insert("pendingBelowStopPrice".to_string(), json!(rw));
7630        }
7631
7632        if let Some(rw) = pending_below_trailing_delta {
7633            query_params.insert("pendingBelowTrailingDelta".to_string(), json!(rw));
7634        }
7635
7636        if let Some(rw) = pending_below_iceberg_qty {
7637            query_params.insert("pendingBelowIcebergQty".to_string(), json!(rw));
7638        }
7639
7640        if let Some(rw) = pending_below_time_in_force {
7641            query_params.insert("pendingBelowTimeInForce".to_string(), json!(rw));
7642        }
7643
7644        if let Some(rw) = pending_below_strategy_id {
7645            query_params.insert("pendingBelowStrategyId".to_string(), json!(rw));
7646        }
7647
7648        if let Some(rw) = pending_below_strategy_type {
7649            query_params.insert("pendingBelowStrategyType".to_string(), json!(rw));
7650        }
7651
7652        if let Some(rw) = pending_below_peg_price_type {
7653            query_params.insert("pendingBelowPegPriceType".to_string(), json!(rw));
7654        }
7655
7656        if let Some(rw) = pending_below_peg_offset_type {
7657            query_params.insert("pendingBelowPegOffsetType".to_string(), json!(rw));
7658        }
7659
7660        if let Some(rw) = pending_below_peg_offset_value {
7661            query_params.insert("pendingBelowPegOffsetValue".to_string(), json!(rw));
7662        }
7663
7664        if let Some(rw) = recv_window {
7665            query_params.insert("recvWindow".to_string(), json!(rw));
7666        }
7667
7668        send_request::<models::OrderListOtocoResponse>(
7669            &self.configuration,
7670            "/api/v3/orderList/otoco",
7671            reqwest::Method::POST,
7672            query_params,
7673            body_params,
7674            if HAS_TIME_UNIT {
7675                self.configuration.time_unit
7676            } else {
7677                None
7678            },
7679            true,
7680        )
7681        .await
7682    }
7683
7684    async fn order_oco(
7685        &self,
7686        params: OrderOcoParams,
7687    ) -> anyhow::Result<RestApiResponse<models::OrderOcoResponse>> {
7688        let OrderOcoParams {
7689            symbol,
7690            side,
7691            quantity,
7692            price,
7693            stop_price,
7694            list_client_order_id,
7695            limit_client_order_id,
7696            limit_strategy_id,
7697            limit_strategy_type,
7698            limit_iceberg_qty,
7699            trailing_delta,
7700            stop_client_order_id,
7701            stop_strategy_id,
7702            stop_strategy_type,
7703            stop_limit_price,
7704            stop_iceberg_qty,
7705            stop_limit_time_in_force,
7706            new_order_resp_type,
7707            self_trade_prevention_mode,
7708            recv_window,
7709        } = params;
7710
7711        let mut query_params = BTreeMap::new();
7712        let body_params = BTreeMap::new();
7713
7714        query_params.insert("symbol".to_string(), json!(symbol));
7715
7716        if let Some(rw) = list_client_order_id {
7717            query_params.insert("listClientOrderId".to_string(), json!(rw));
7718        }
7719
7720        query_params.insert("side".to_string(), json!(side));
7721
7722        query_params.insert("quantity".to_string(), json!(quantity));
7723
7724        if let Some(rw) = limit_client_order_id {
7725            query_params.insert("limitClientOrderId".to_string(), json!(rw));
7726        }
7727
7728        query_params.insert("price".to_string(), json!(price));
7729
7730        if let Some(rw) = limit_strategy_id {
7731            query_params.insert("limitStrategyId".to_string(), json!(rw));
7732        }
7733
7734        if let Some(rw) = limit_strategy_type {
7735            query_params.insert("limitStrategyType".to_string(), json!(rw));
7736        }
7737
7738        if let Some(rw) = limit_iceberg_qty {
7739            query_params.insert("limitIcebergQty".to_string(), json!(rw));
7740        }
7741
7742        if let Some(rw) = trailing_delta {
7743            query_params.insert("trailingDelta".to_string(), json!(rw));
7744        }
7745
7746        if let Some(rw) = stop_client_order_id {
7747            query_params.insert("stopClientOrderId".to_string(), json!(rw));
7748        }
7749
7750        query_params.insert("stopPrice".to_string(), json!(stop_price));
7751
7752        if let Some(rw) = stop_strategy_id {
7753            query_params.insert("stopStrategyId".to_string(), json!(rw));
7754        }
7755
7756        if let Some(rw) = stop_strategy_type {
7757            query_params.insert("stopStrategyType".to_string(), json!(rw));
7758        }
7759
7760        if let Some(rw) = stop_limit_price {
7761            query_params.insert("stopLimitPrice".to_string(), json!(rw));
7762        }
7763
7764        if let Some(rw) = stop_iceberg_qty {
7765            query_params.insert("stopIcebergQty".to_string(), json!(rw));
7766        }
7767
7768        if let Some(rw) = stop_limit_time_in_force {
7769            query_params.insert("stopLimitTimeInForce".to_string(), json!(rw));
7770        }
7771
7772        if let Some(rw) = new_order_resp_type {
7773            query_params.insert("newOrderRespType".to_string(), json!(rw));
7774        }
7775
7776        if let Some(rw) = self_trade_prevention_mode {
7777            query_params.insert("selfTradePreventionMode".to_string(), json!(rw));
7778        }
7779
7780        if let Some(rw) = recv_window {
7781            query_params.insert("recvWindow".to_string(), json!(rw));
7782        }
7783
7784        send_request::<models::OrderOcoResponse>(
7785            &self.configuration,
7786            "/api/v3/order/oco",
7787            reqwest::Method::POST,
7788            query_params,
7789            body_params,
7790            if HAS_TIME_UNIT {
7791                self.configuration.time_unit
7792            } else {
7793                None
7794            },
7795            true,
7796        )
7797        .await
7798    }
7799
7800    async fn order_test(
7801        &self,
7802        params: OrderTestParams,
7803    ) -> anyhow::Result<RestApiResponse<models::OrderTestResponse>> {
7804        let OrderTestParams {
7805            symbol,
7806            side,
7807            r#type,
7808            compute_commission_rates,
7809            time_in_force,
7810            quantity,
7811            quote_order_qty,
7812            price,
7813            new_client_order_id,
7814            strategy_id,
7815            strategy_type,
7816            stop_price,
7817            trailing_delta,
7818            iceberg_qty,
7819            new_order_resp_type,
7820            self_trade_prevention_mode,
7821            peg_price_type,
7822            peg_offset_value,
7823            peg_offset_type,
7824            recv_window,
7825        } = params;
7826
7827        let mut query_params = BTreeMap::new();
7828        let body_params = BTreeMap::new();
7829
7830        if let Some(rw) = compute_commission_rates {
7831            query_params.insert("computeCommissionRates".to_string(), json!(rw));
7832        }
7833
7834        query_params.insert("symbol".to_string(), json!(symbol));
7835
7836        query_params.insert("side".to_string(), json!(side));
7837
7838        query_params.insert("type".to_string(), json!(r#type));
7839
7840        if let Some(rw) = time_in_force {
7841            query_params.insert("timeInForce".to_string(), json!(rw));
7842        }
7843
7844        if let Some(rw) = quantity {
7845            query_params.insert("quantity".to_string(), json!(rw));
7846        }
7847
7848        if let Some(rw) = quote_order_qty {
7849            query_params.insert("quoteOrderQty".to_string(), json!(rw));
7850        }
7851
7852        if let Some(rw) = price {
7853            query_params.insert("price".to_string(), json!(rw));
7854        }
7855
7856        if let Some(rw) = new_client_order_id {
7857            query_params.insert("newClientOrderId".to_string(), json!(rw));
7858        }
7859
7860        if let Some(rw) = strategy_id {
7861            query_params.insert("strategyId".to_string(), json!(rw));
7862        }
7863
7864        if let Some(rw) = strategy_type {
7865            query_params.insert("strategyType".to_string(), json!(rw));
7866        }
7867
7868        if let Some(rw) = stop_price {
7869            query_params.insert("stopPrice".to_string(), json!(rw));
7870        }
7871
7872        if let Some(rw) = trailing_delta {
7873            query_params.insert("trailingDelta".to_string(), json!(rw));
7874        }
7875
7876        if let Some(rw) = iceberg_qty {
7877            query_params.insert("icebergQty".to_string(), json!(rw));
7878        }
7879
7880        if let Some(rw) = new_order_resp_type {
7881            query_params.insert("newOrderRespType".to_string(), json!(rw));
7882        }
7883
7884        if let Some(rw) = self_trade_prevention_mode {
7885            query_params.insert("selfTradePreventionMode".to_string(), json!(rw));
7886        }
7887
7888        if let Some(rw) = peg_price_type {
7889            query_params.insert("pegPriceType".to_string(), json!(rw));
7890        }
7891
7892        if let Some(rw) = peg_offset_value {
7893            query_params.insert("pegOffsetValue".to_string(), json!(rw));
7894        }
7895
7896        if let Some(rw) = peg_offset_type {
7897            query_params.insert("pegOffsetType".to_string(), json!(rw));
7898        }
7899
7900        if let Some(rw) = recv_window {
7901            query_params.insert("recvWindow".to_string(), json!(rw));
7902        }
7903
7904        send_request::<models::OrderTestResponse>(
7905            &self.configuration,
7906            "/api/v3/order/test",
7907            reqwest::Method::POST,
7908            query_params,
7909            body_params,
7910            if HAS_TIME_UNIT {
7911                self.configuration.time_unit
7912            } else {
7913                None
7914            },
7915            true,
7916        )
7917        .await
7918    }
7919
7920    async fn sor_order(
7921        &self,
7922        params: SorOrderParams,
7923    ) -> anyhow::Result<RestApiResponse<models::SorOrderResponse>> {
7924        let SorOrderParams {
7925            symbol,
7926            side,
7927            r#type,
7928            quantity,
7929            time_in_force,
7930            price,
7931            new_client_order_id,
7932            strategy_id,
7933            strategy_type,
7934            iceberg_qty,
7935            new_order_resp_type,
7936            self_trade_prevention_mode,
7937            recv_window,
7938        } = params;
7939
7940        let mut query_params = BTreeMap::new();
7941        let body_params = BTreeMap::new();
7942
7943        query_params.insert("symbol".to_string(), json!(symbol));
7944
7945        query_params.insert("side".to_string(), json!(side));
7946
7947        query_params.insert("type".to_string(), json!(r#type));
7948
7949        if let Some(rw) = time_in_force {
7950            query_params.insert("timeInForce".to_string(), json!(rw));
7951        }
7952
7953        query_params.insert("quantity".to_string(), json!(quantity));
7954
7955        if let Some(rw) = price {
7956            query_params.insert("price".to_string(), json!(rw));
7957        }
7958
7959        if let Some(rw) = new_client_order_id {
7960            query_params.insert("newClientOrderId".to_string(), json!(rw));
7961        }
7962
7963        if let Some(rw) = strategy_id {
7964            query_params.insert("strategyId".to_string(), json!(rw));
7965        }
7966
7967        if let Some(rw) = strategy_type {
7968            query_params.insert("strategyType".to_string(), json!(rw));
7969        }
7970
7971        if let Some(rw) = iceberg_qty {
7972            query_params.insert("icebergQty".to_string(), json!(rw));
7973        }
7974
7975        if let Some(rw) = new_order_resp_type {
7976            query_params.insert("newOrderRespType".to_string(), json!(rw));
7977        }
7978
7979        if let Some(rw) = self_trade_prevention_mode {
7980            query_params.insert("selfTradePreventionMode".to_string(), json!(rw));
7981        }
7982
7983        if let Some(rw) = recv_window {
7984            query_params.insert("recvWindow".to_string(), json!(rw));
7985        }
7986
7987        send_request::<models::SorOrderResponse>(
7988            &self.configuration,
7989            "/api/v3/sor/order",
7990            reqwest::Method::POST,
7991            query_params,
7992            body_params,
7993            if HAS_TIME_UNIT {
7994                self.configuration.time_unit
7995            } else {
7996                None
7997            },
7998            true,
7999        )
8000        .await
8001    }
8002
8003    async fn sor_order_test(
8004        &self,
8005        params: SorOrderTestParams,
8006    ) -> anyhow::Result<RestApiResponse<models::SorOrderTestResponse>> {
8007        let SorOrderTestParams {
8008            symbol,
8009            side,
8010            r#type,
8011            quantity,
8012            compute_commission_rates,
8013            time_in_force,
8014            price,
8015            new_client_order_id,
8016            strategy_id,
8017            strategy_type,
8018            iceberg_qty,
8019            new_order_resp_type,
8020            self_trade_prevention_mode,
8021            recv_window,
8022        } = params;
8023
8024        let mut query_params = BTreeMap::new();
8025        let body_params = BTreeMap::new();
8026
8027        if let Some(rw) = compute_commission_rates {
8028            query_params.insert("computeCommissionRates".to_string(), json!(rw));
8029        }
8030
8031        query_params.insert("symbol".to_string(), json!(symbol));
8032
8033        query_params.insert("side".to_string(), json!(side));
8034
8035        query_params.insert("type".to_string(), json!(r#type));
8036
8037        if let Some(rw) = time_in_force {
8038            query_params.insert("timeInForce".to_string(), json!(rw));
8039        }
8040
8041        query_params.insert("quantity".to_string(), json!(quantity));
8042
8043        if let Some(rw) = price {
8044            query_params.insert("price".to_string(), json!(rw));
8045        }
8046
8047        if let Some(rw) = new_client_order_id {
8048            query_params.insert("newClientOrderId".to_string(), json!(rw));
8049        }
8050
8051        if let Some(rw) = strategy_id {
8052            query_params.insert("strategyId".to_string(), json!(rw));
8053        }
8054
8055        if let Some(rw) = strategy_type {
8056            query_params.insert("strategyType".to_string(), json!(rw));
8057        }
8058
8059        if let Some(rw) = iceberg_qty {
8060            query_params.insert("icebergQty".to_string(), json!(rw));
8061        }
8062
8063        if let Some(rw) = new_order_resp_type {
8064            query_params.insert("newOrderRespType".to_string(), json!(rw));
8065        }
8066
8067        if let Some(rw) = self_trade_prevention_mode {
8068            query_params.insert("selfTradePreventionMode".to_string(), json!(rw));
8069        }
8070
8071        if let Some(rw) = recv_window {
8072            query_params.insert("recvWindow".to_string(), json!(rw));
8073        }
8074
8075        send_request::<models::SorOrderTestResponse>(
8076            &self.configuration,
8077            "/api/v3/sor/order/test",
8078            reqwest::Method::POST,
8079            query_params,
8080            body_params,
8081            if HAS_TIME_UNIT {
8082                self.configuration.time_unit
8083            } else {
8084                None
8085            },
8086            true,
8087        )
8088        .await
8089    }
8090}
8091
8092#[cfg(all(test, feature = "spot"))]
8093mod tests {
8094    use super::*;
8095    use crate::TOKIO_SHARED_RT;
8096    use crate::{errors::ConnectorError, models::DataFuture, models::RestApiRateLimit};
8097    use async_trait::async_trait;
8098    use std::collections::HashMap;
8099
8100    struct DummyRestApiResponse<T> {
8101        inner: Box<dyn FnOnce() -> DataFuture<Result<T, ConnectorError>> + Send + Sync>,
8102        status: u16,
8103        headers: HashMap<String, String>,
8104        rate_limits: Option<Vec<RestApiRateLimit>>,
8105    }
8106
8107    impl<T> From<DummyRestApiResponse<T>> for RestApiResponse<T> {
8108        fn from(dummy: DummyRestApiResponse<T>) -> Self {
8109            Self {
8110                data_fn: dummy.inner,
8111                status: dummy.status,
8112                headers: dummy.headers,
8113                rate_limits: dummy.rate_limits,
8114            }
8115        }
8116    }
8117
8118    struct MockTradeApiClient {
8119        force_error: bool,
8120    }
8121
8122    #[async_trait]
8123    impl TradeApi for MockTradeApiClient {
8124        async fn delete_open_orders(
8125            &self,
8126            _params: DeleteOpenOrdersParams,
8127        ) -> anyhow::Result<RestApiResponse<Vec<models::DeleteOpenOrdersResponseInner>>> {
8128            if self.force_error {
8129                return Err(ConnectorError::ConnectorClientError {
8130                    msg: "ResponseError".to_string(),
8131                    code: None,
8132                }
8133                .into());
8134            }
8135
8136            let resp_json: Value = serde_json::from_str(r#"[{"symbol":"BTCUSDT","origClientOrderId":"E6APeyTJvkMvLMYMqu1KQ4","orderId":11,"orderListId":-1,"clientOrderId":"pXLV6Hz6mprAcVYpVMTGgx","transactTime":1684804350068,"price":"0.089853","origQty":"0.178622","executedQty":"0.000000","origQuoteOrderQty":"0.000000","cummulativeQuoteQty":"0.000000","status":"CANCELED","timeInForce":"GTC","type":"LIMIT","side":"BUY","selfTradePreventionMode":"NONE"}]"#).unwrap_or_else(|_| serde_json::json!({}));
8137            let dummy_response: Vec<models::DeleteOpenOrdersResponseInner> =
8138                serde_json::from_value(resp_json.clone())
8139                    .expect("should parse into Vec<models::DeleteOpenOrdersResponseInner>");
8140
8141            let dummy = DummyRestApiResponse {
8142                inner: Box::new(move || Box::pin(async move { Ok(dummy_response) })),
8143                status: 200,
8144                headers: HashMap::new(),
8145                rate_limits: None,
8146            };
8147
8148            Ok(dummy.into())
8149        }
8150
8151        async fn delete_order(
8152            &self,
8153            _params: DeleteOrderParams,
8154        ) -> anyhow::Result<RestApiResponse<models::DeleteOrderResponse>> {
8155            if self.force_error {
8156                return Err(ConnectorError::ConnectorClientError {
8157                    msg: "ResponseError".to_string(),
8158                    code: None,
8159                }
8160                .into());
8161            }
8162
8163            let resp_json: Value = serde_json::from_str(r#"{"symbol":"LTCBTC","orderId":4,"orderListId":-1,"origClientOrderId":"myOrder1","clientOrderId":"cancelMyOrder1","transactTime":1684804350068,"price":"2.00000000","origQty":"1.00000000","executedQty":"0.00000000","origQuoteOrderQty":"0.000000","cummulativeQuoteQty":"0.00000000","status":"CANCELED","timeInForce":"GTC","type":"LIMIT","side":"BUY","selfTradePreventionMode":"NONE","icebergQty":"0.00000000","preventedMatchId":0,"preventedQuantity":"1.200000","stopPrice":"23500.00000000","strategyId":37463720,"strategyType":1000000,"trailingDelta":10,"trailingTime":-1,"usedSor":true,"workingFloor":"SOR","pegPriceType":"PRIMARY_PEG","pegOffsetType":"PRICE_LEVEL","pegOffsetValue":5,"peggedPrice":"87523.83710000","expiryReason":"INSUFFICIENT_LIQUIDITY"}"#).unwrap_or_else(|_| serde_json::json!({}));
8164            let dummy_response: models::DeleteOrderResponse =
8165                serde_json::from_value(resp_json.clone())
8166                    .expect("should parse into models::DeleteOrderResponse");
8167
8168            let dummy = DummyRestApiResponse {
8169                inner: Box::new(move || Box::pin(async move { Ok(dummy_response) })),
8170                status: 200,
8171                headers: HashMap::new(),
8172                rate_limits: None,
8173            };
8174
8175            Ok(dummy.into())
8176        }
8177
8178        async fn delete_order_list(
8179            &self,
8180            _params: DeleteOrderListParams,
8181        ) -> anyhow::Result<RestApiResponse<models::DeleteOrderListResponse>> {
8182            if self.force_error {
8183                return Err(ConnectorError::ConnectorClientError {
8184                    msg: "ResponseError".to_string(),
8185                    code: None,
8186                }
8187                .into());
8188            }
8189
8190            let resp_json: Value = serde_json::from_str(r#"{"orderListId":0,"contingencyType":"OCO","listStatusType":"ALL_DONE","listOrderStatus":"ALL_DONE","listClientOrderId":"C3wyj4WVEktd7u9aVBRXcN","transactionTime":1574040868128,"symbol":"LTCBTC","orders":[{"symbol":"LTCBTC","orderId":2,"clientOrderId":"pO9ufTiFGg3nw2fOdgeOXa"}],"orderReports":[{"symbol":"LTCBTC","origClientOrderId":"pO9ufTiFGg3nw2fOdgeOXa","orderId":2,"orderListId":0,"clientOrderId":"unfWT8ig8i0uj6lPuYLez6","transactTime":1688005070874,"price":"1.00000000","origQty":"10.00000000","executedQty":"0.00000000","origQuoteOrderQty":"0.000000","cummulativeQuoteQty":"0.00000000","status":"CANCELED","timeInForce":"GTC","type":"STOP_LOSS_LIMIT","side":"SELL","icebergQty":"0.00000000","preventedMatchId":0,"preventedQuantity":"1.200000","stopPrice":"0.00000000","strategyId":1,"strategyType":1000000,"trailingDelta":10,"trailingTime":-1,"usedSor":true,"workingFloor":"SOR","pegPriceType":"PRIMARY_PEG","pegOffsetType":"PRICE_LEVEL","pegOffsetValue":5,"peggedPrice":"87523.83710000","expiryReason":"INSUFFICIENT_LIQUIDITY"}]}"#).unwrap_or_else(|_| serde_json::json!({}));
8191            let dummy_response: models::DeleteOrderListResponse =
8192                serde_json::from_value(resp_json.clone())
8193                    .expect("should parse into models::DeleteOrderListResponse");
8194
8195            let dummy = DummyRestApiResponse {
8196                inner: Box::new(move || Box::pin(async move { Ok(dummy_response) })),
8197                status: 200,
8198                headers: HashMap::new(),
8199                rate_limits: None,
8200            };
8201
8202            Ok(dummy.into())
8203        }
8204
8205        async fn new_order(
8206            &self,
8207            _params: NewOrderParams,
8208        ) -> anyhow::Result<RestApiResponse<models::NewOrderResponse>> {
8209            if self.force_error {
8210                return Err(ConnectorError::ConnectorClientError {
8211                    msg: "ResponseError".to_string(),
8212                    code: None,
8213                }
8214                .into());
8215            }
8216
8217            let resp_json: Value = serde_json::from_str(r#"{"symbol":"BTCUSDT","orderId":28,"orderListId":-1,"clientOrderId":"6gCrw2kRUAF9CvJDGP16IP","transactTime":1507725176595,"status":"FILLED","timeInForce":"GTC","type":"MARKET","side":"SELL","workingTime":1507725176595,"selfTradePreventionMode":"NONE","fills":[{"commissionAsset":"USDT","tradeId":56}]}"#).unwrap_or_else(|_| serde_json::json!({}));
8218            let dummy_response: models::NewOrderResponse =
8219                serde_json::from_value(resp_json.clone())
8220                    .expect("should parse into models::NewOrderResponse");
8221
8222            let dummy = DummyRestApiResponse {
8223                inner: Box::new(move || Box::pin(async move { Ok(dummy_response) })),
8224                status: 200,
8225                headers: HashMap::new(),
8226                rate_limits: None,
8227            };
8228
8229            Ok(dummy.into())
8230        }
8231
8232        async fn order_amend_keep_priority(
8233            &self,
8234            _params: OrderAmendKeepPriorityParams,
8235        ) -> anyhow::Result<RestApiResponse<models::OrderAmendKeepPriorityResponse>> {
8236            if self.force_error {
8237                return Err(ConnectorError::ConnectorClientError {
8238                    msg: "ResponseError".to_string(),
8239                    code: None,
8240                }
8241                .into());
8242            }
8243
8244            let resp_json: Value = serde_json::from_str(r#"{"transactTime":1741926410255,"executionId":75,"amendedOrder":{"symbol":"BTCUSDT","orderId":33,"orderListId":-1,"origClientOrderId":"5xrgbMyg6z36NzBn2pbT8H","clientOrderId":"PFaq6hIHxqFENGfdtn4J6Q","price":"6.00000000","qty":"5.00000000","executedQty":"0.00000000","preventedQty":"0.00000000","quoteOrderQty":"0.00000000","cumulativeQuoteQty":"0.00000000","status":"NEW","timeInForce":"GTC","type":"LIMIT","side":"SELL","workingTime":1741926410242,"selfTradePreventionMode":"NONE","icebergQty":"0.00000000","preventedMatchId":0,"preventedQuantity":"1.200000","stopPrice":"0.00000000","strategyId":1,"strategyType":1000000,"trailingDelta":10,"trailingTime":-1,"usedSor":true,"workingFloor":"SOR","pegPriceType":"PRIMARY_PEG","pegOffsetType":"PRICE_LEVEL","pegOffsetValue":5,"peggedPrice":"87523.83710000","expiryReason":"INSUFFICIENT_LIQUIDITY"},"listStatus":{"orderListId":1,"contingencyType":"OTO","listOrderStatus":"EXECUTING","listClientOrderId":"AT7FTxZXylVSwRoZs52mt3","symbol":"BTCUSDT","orders":[{"symbol":"BTCUSDT","orderId":8,"clientOrderId":"GkwwHZUUbFtZOoH1YsZk9Q"}]}}"#).unwrap_or_else(|_| serde_json::json!({}));
8245            let dummy_response: models::OrderAmendKeepPriorityResponse =
8246                serde_json::from_value(resp_json.clone())
8247                    .expect("should parse into models::OrderAmendKeepPriorityResponse");
8248
8249            let dummy = DummyRestApiResponse {
8250                inner: Box::new(move || Box::pin(async move { Ok(dummy_response) })),
8251                status: 200,
8252                headers: HashMap::new(),
8253                rate_limits: None,
8254            };
8255
8256            Ok(dummy.into())
8257        }
8258
8259        async fn order_cancel_replace(
8260            &self,
8261            _params: OrderCancelReplaceParams,
8262        ) -> anyhow::Result<RestApiResponse<models::OrderCancelReplaceResponse>> {
8263            if self.force_error {
8264                return Err(ConnectorError::ConnectorClientError {
8265                    msg: "ResponseError".to_string(),
8266                    code: None,
8267                }
8268                .into());
8269            }
8270
8271            let resp_json: Value = serde_json::from_str(r#"{"cancelResult":"SUCCESS","newOrderResult":"SUCCESS","cancelResponse":{"symbol":"BTCUSDT","origClientOrderId":"DnLo3vTAQcjha43lAZhZ0y","orderId":9,"orderListId":-1,"clientOrderId":"osxN3JXAtJvKvCqGeMWMVR","transactTime":1684804350068,"price":"0.01000000","origQty":"0.000100","executedQty":"0.00000000","origQuoteOrderQty":"0.000000","cummulativeQuoteQty":"0.00000000","status":"CANCELED","timeInForce":"GTC","type":"LIMIT","side":"SELL","selfTradePreventionMode":"NONE","icebergQty":"0.00000000","preventedMatchId":0,"preventedQuantity":"1.200000","stopPrice":"0.00000000","strategyId":1,"strategyType":1000000,"trailingDelta":10,"trailingTime":-1,"usedSor":true,"workingFloor":"SOR","pegPriceType":"PRIMARY_PEG","pegOffsetType":"PRICE_LEVEL","pegOffsetValue":5,"peggedPrice":"87523.83710000","expiryReason":"INSUFFICIENT_LIQUIDITY"},"newOrderResponse":{"symbol":"BTCUSDT","orderId":10,"orderListId":-1,"clientOrderId":"wOceeeOzNORyLiQfw7jd8S","transactTime":1652928801803,"price":"0.02000000","origQty":"0.040000","executedQty":"0.00000000","origQuoteOrderQty":"0.000000","cummulativeQuoteQty":"0.00000000","status":"NEW","timeInForce":"GTC","type":"LIMIT","side":"BUY","workingTime":1669277163808,"fills":[{"price":"4000.00000000","qty":"1.00000000","commission":"4.00000000","commissionAsset":"USDT","tradeId":12345}],"selfTradePreventionMode":"NONE","icebergQty":"0.00000000","preventedMatchId":0,"preventedQuantity":"1.200000","stopPrice":"0.00000000","strategyId":1,"strategyType":1000000,"trailingDelta":10,"trailingTime":-1,"usedSor":true,"workingFloor":"SOR","pegPriceType":"PRIMARY_PEG","pegOffsetType":"PRICE_LEVEL","pegOffsetValue":5,"peggedPrice":"87523.83710000","expiryReason":"INSUFFICIENT_LIQUIDITY"}}"#).unwrap_or_else(|_| serde_json::json!({}));
8272            let dummy_response: models::OrderCancelReplaceResponse =
8273                serde_json::from_value(resp_json.clone())
8274                    .expect("should parse into models::OrderCancelReplaceResponse");
8275
8276            let dummy = DummyRestApiResponse {
8277                inner: Box::new(move || Box::pin(async move { Ok(dummy_response) })),
8278                status: 200,
8279                headers: HashMap::new(),
8280                rate_limits: None,
8281            };
8282
8283            Ok(dummy.into())
8284        }
8285
8286        async fn order_list_oco(
8287            &self,
8288            _params: OrderListOcoParams,
8289        ) -> anyhow::Result<RestApiResponse<models::OrderListOcoResponse>> {
8290            if self.force_error {
8291                return Err(ConnectorError::ConnectorClientError {
8292                    msg: "ResponseError".to_string(),
8293                    code: None,
8294                }
8295                .into());
8296            }
8297
8298            let resp_json: Value = serde_json::from_str(r#"{"orderListId":1,"contingencyType":"OCO","listStatusType":"EXEC_STARTED","listOrderStatus":"EXECUTING","listClientOrderId":"lH1YDkuQKWiXVXHPSKYEIp","transactionTime":1710485608839,"symbol":"LTCBTC","orders":[{"symbol":"LTCBTC","orderId":10,"clientOrderId":"44nZvqpemY7sVYgPYbvPih"}],"orderReports":[{"symbol":"LTCBTC","orderId":10,"orderListId":1,"clientOrderId":"44nZvqpemY7sVYgPYbvPih","transactTime":1710485608839,"price":"1.00000000","origQty":"5.00000000","executedQty":"0.00000000","origQuoteOrderQty":"0.000000","cummulativeQuoteQty":"0.00000000","status":"NEW","timeInForce":"GTC","type":"STOP_LOSS_LIMIT","side":"SELL","workingTime":-1,"selfTradePreventionMode":"NONE","stopPrice":"1.00000000","icebergQty":"1.00000000"}]}"#).unwrap_or_else(|_| serde_json::json!({}));
8299            let dummy_response: models::OrderListOcoResponse =
8300                serde_json::from_value(resp_json.clone())
8301                    .expect("should parse into models::OrderListOcoResponse");
8302
8303            let dummy = DummyRestApiResponse {
8304                inner: Box::new(move || Box::pin(async move { Ok(dummy_response) })),
8305                status: 200,
8306                headers: HashMap::new(),
8307                rate_limits: None,
8308            };
8309
8310            Ok(dummy.into())
8311        }
8312
8313        async fn order_list_opo(
8314            &self,
8315            _params: OrderListOpoParams,
8316        ) -> anyhow::Result<RestApiResponse<models::OrderListOpoResponse>> {
8317            if self.force_error {
8318                return Err(ConnectorError::ConnectorClientError {
8319                    msg: "ResponseError".to_string(),
8320                    code: None,
8321                }
8322                .into());
8323            }
8324
8325            let resp_json: Value = serde_json::from_str(r#"{"orderListId":0,"contingencyType":"OTO","listStatusType":"EXEC_STARTED","listOrderStatus":"EXECUTING","listClientOrderId":"H94qCqO27P74OEiO4X8HOG","transactionTime":1762998011671,"symbol":"BTCUSDT","orders":[{"symbol":"BTCUSDT","orderId":2,"clientOrderId":"JX6xfdjo0wysiGumfHNmPu"}],"orderReports":[{"symbol":"BTCUSDT","orderId":2,"orderListId":0,"clientOrderId":"JX6xfdjo0wysiGumfHNmPu","transactTime":1762998011671,"price":"102264.00000000","executedQty":"0.00000000","origQuoteOrderQty":"0.00000000","cummulativeQuoteQty":"0.00000000","status":"NEW","timeInForce":"GTC","type":"LIMIT","side":"BUY","workingTime":1762998011671,"selfTradePreventionMode":"NONE","origQty":"0.00060000","icebergQty":"0.00000000","preventedMatchId":0,"preventedQuantity":"1.200000","stopPrice":"0.00000000","strategyId":1,"strategyType":1000000,"trailingDelta":10,"trailingTime":-1,"usedSor":true,"workingFloor":"SOR","pegPriceType":"PRIMARY_PEG","pegOffsetType":"PRICE_LEVEL","pegOffsetValue":5,"peggedPrice":"87523.83710000","expiryReason":"INSUFFICIENT_LIQUIDITY"}]}"#).unwrap_or_else(|_| serde_json::json!({}));
8326            let dummy_response: models::OrderListOpoResponse =
8327                serde_json::from_value(resp_json.clone())
8328                    .expect("should parse into models::OrderListOpoResponse");
8329
8330            let dummy = DummyRestApiResponse {
8331                inner: Box::new(move || Box::pin(async move { Ok(dummy_response) })),
8332                status: 200,
8333                headers: HashMap::new(),
8334                rate_limits: None,
8335            };
8336
8337            Ok(dummy.into())
8338        }
8339
8340        async fn order_list_opoco(
8341            &self,
8342            _params: OrderListOpocoParams,
8343        ) -> anyhow::Result<RestApiResponse<models::OrderListOpocoResponse>> {
8344            if self.force_error {
8345                return Err(ConnectorError::ConnectorClientError {
8346                    msg: "ResponseError".to_string(),
8347                    code: None,
8348                }
8349                .into());
8350            }
8351
8352            let resp_json: Value = serde_json::from_str(r#"{"orderListId":2,"contingencyType":"OTO","listStatusType":"EXEC_STARTED","listOrderStatus":"EXECUTING","listClientOrderId":"bcedxMpQG6nFrZUPQyshoL","transactionTime":1763000506354,"symbol":"BTCUSDT","orders":[{"symbol":"BTCUSDT","orderId":9,"clientOrderId":"OLSBhMWaIlLSzZ9Zm7fnKB"}],"orderReports":[{"symbol":"BTCUSDT","orderId":9,"orderListId":2,"clientOrderId":"OLSBhMWaIlLSzZ9Zm7fnKB","transactTime":1763000506354,"price":"102496.00000000","executedQty":"0.00000000","origQuoteOrderQty":"0.00000000","cummulativeQuoteQty":"0.00000000","status":"NEW","timeInForce":"GTC","type":"LIMIT","side":"BUY","workingTime":1763000506354,"selfTradePreventionMode":"NONE","origQty":"0.00170000","icebergQty":"0.00000000","preventedMatchId":0,"preventedQuantity":"1.200000","stopPrice":"0.00000000","strategyId":1,"strategyType":1000000,"trailingDelta":10,"trailingTime":-1,"usedSor":true,"workingFloor":"SOR","pegPriceType":"PRIMARY_PEG","pegOffsetType":"PRICE_LEVEL","pegOffsetValue":5,"peggedPrice":"87523.83710000","expiryReason":"INSUFFICIENT_LIQUIDITY"}]}"#).unwrap_or_else(|_| serde_json::json!({}));
8353            let dummy_response: models::OrderListOpocoResponse =
8354                serde_json::from_value(resp_json.clone())
8355                    .expect("should parse into models::OrderListOpocoResponse");
8356
8357            let dummy = DummyRestApiResponse {
8358                inner: Box::new(move || Box::pin(async move { Ok(dummy_response) })),
8359                status: 200,
8360                headers: HashMap::new(),
8361                rate_limits: None,
8362            };
8363
8364            Ok(dummy.into())
8365        }
8366
8367        async fn order_list_oto(
8368            &self,
8369            _params: OrderListOtoParams,
8370        ) -> anyhow::Result<RestApiResponse<models::OrderListOtoResponse>> {
8371            if self.force_error {
8372                return Err(ConnectorError::ConnectorClientError {
8373                    msg: "ResponseError".to_string(),
8374                    code: None,
8375                }
8376                .into());
8377            }
8378
8379            let resp_json: Value = serde_json::from_str(r#"{"orderListId":0,"contingencyType":"OTO","listStatusType":"EXEC_STARTED","listOrderStatus":"EXECUTING","listClientOrderId":"yl2ERtcar1o25zcWtqVBTC","transactionTime":1712289389158,"symbol":"LTCBTC","orders":[{"symbol":"LTCBTC","orderId":4,"clientOrderId":"Bq17mn9fP6vyCn75Jw1xya"}],"orderReports":[{"symbol":"LTCBTC","orderId":4,"orderListId":0,"clientOrderId":"Bq17mn9fP6vyCn75Jw1xya","transactTime":1712289389158,"price":"1.00000000","origQty":"1.00000000","executedQty":"0.00000000","origQuoteOrderQty":"0.000000","cummulativeQuoteQty":"0.00000000","status":"NEW","timeInForce":"GTC","type":"LIMIT","side":"SELL","workingTime":1712289389158,"selfTradePreventionMode":"NONE","icebergQty":"0.00000000","preventedMatchId":0,"preventedQuantity":"1.200000","stopPrice":"0.00000000","strategyId":1,"strategyType":1000000,"trailingDelta":10,"trailingTime":-1,"usedSor":true,"workingFloor":"SOR","pegPriceType":"PRIMARY_PEG","pegOffsetType":"PRICE_LEVEL","pegOffsetValue":5,"peggedPrice":"87523.83710000","expiryReason":"INSUFFICIENT_LIQUIDITY"}]}"#).unwrap_or_else(|_| serde_json::json!({}));
8380            let dummy_response: models::OrderListOtoResponse =
8381                serde_json::from_value(resp_json.clone())
8382                    .expect("should parse into models::OrderListOtoResponse");
8383
8384            let dummy = DummyRestApiResponse {
8385                inner: Box::new(move || Box::pin(async move { Ok(dummy_response) })),
8386                status: 200,
8387                headers: HashMap::new(),
8388                rate_limits: None,
8389            };
8390
8391            Ok(dummy.into())
8392        }
8393
8394        async fn order_list_otoco(
8395            &self,
8396            _params: OrderListOtocoParams,
8397        ) -> anyhow::Result<RestApiResponse<models::OrderListOtocoResponse>> {
8398            if self.force_error {
8399                return Err(ConnectorError::ConnectorClientError {
8400                    msg: "ResponseError".to_string(),
8401                    code: None,
8402                }
8403                .into());
8404            }
8405
8406            let resp_json: Value = serde_json::from_str(r#"{"orderListId":1,"contingencyType":"OTO","listStatusType":"EXEC_STARTED","listOrderStatus":"EXECUTING","listClientOrderId":"RumwQpBaDctlUu5jyG5rs0","transactionTime":1712291372842,"symbol":"LTCBTC","orders":[{"symbol":"LTCBTC","orderId":6,"clientOrderId":"fM9Y4m23IFJVCQmIrlUmMK"}],"orderReports":[{"symbol":"LTCBTC","orderId":6,"orderListId":1,"clientOrderId":"fM9Y4m23IFJVCQmIrlUmMK","transactTime":1712291372842,"price":"1.00000000","origQty":"1.00000000","executedQty":"0.00000000","origQuoteOrderQty":"0.000000","cummulativeQuoteQty":"0.00000000","status":"NEW","timeInForce":"GTC","type":"LIMIT","side":"SELL","workingTime":1712291372842,"selfTradePreventionMode":"NONE","icebergQty":"0.00000000","preventedMatchId":0,"preventedQuantity":"1.200000","stopPrice":"0.00000000","strategyId":1,"strategyType":1000000,"trailingDelta":10,"trailingTime":-1,"usedSor":true,"workingFloor":"SOR","pegPriceType":"PRIMARY_PEG","pegOffsetType":"PRICE_LEVEL","pegOffsetValue":5,"peggedPrice":"87523.83710000","expiryReason":"INSUFFICIENT_LIQUIDITY"}]}"#).unwrap_or_else(|_| serde_json::json!({}));
8407            let dummy_response: models::OrderListOtocoResponse =
8408                serde_json::from_value(resp_json.clone())
8409                    .expect("should parse into models::OrderListOtocoResponse");
8410
8411            let dummy = DummyRestApiResponse {
8412                inner: Box::new(move || Box::pin(async move { Ok(dummy_response) })),
8413                status: 200,
8414                headers: HashMap::new(),
8415                rate_limits: None,
8416            };
8417
8418            Ok(dummy.into())
8419        }
8420
8421        async fn order_oco(
8422            &self,
8423            _params: OrderOcoParams,
8424        ) -> anyhow::Result<RestApiResponse<models::OrderOcoResponse>> {
8425            if self.force_error {
8426                return Err(ConnectorError::ConnectorClientError {
8427                    msg: "ResponseError".to_string(),
8428                    code: None,
8429                }
8430                .into());
8431            }
8432
8433            let resp_json: Value = serde_json::from_str(r#"{"orderListId":0,"contingencyType":"OCO","listStatusType":"EXEC_STARTED","listOrderStatus":"EXECUTING","listClientOrderId":"JYVpp3F0f5CAG15DhtrqLp","transactionTime":1563417480525,"symbol":"LTCBTC","orders":[{"symbol":"LTCBTC","orderId":2,"clientOrderId":"Kk7sqHb9J6mJWTMDVW7Vos"}],"orderReports":[{"symbol":"LTCBTC","orderId":2,"orderListId":0,"clientOrderId":"Kk7sqHb9J6mJWTMDVW7Vos","transactTime":1563417480525,"price":"0.000000","origQty":"0.624363","executedQty":"0.000000","origQuoteOrderQty":"0.000000","cummulativeQuoteQty":"0.000000","status":"NEW","timeInForce":"GTC","type":"STOP_LOSS","side":"BUY","workingTime":-1,"selfTradePreventionMode":"NONE","stopPrice":"0.960664"}]}"#).unwrap_or_else(|_| serde_json::json!({}));
8434            let dummy_response: models::OrderOcoResponse =
8435                serde_json::from_value(resp_json.clone())
8436                    .expect("should parse into models::OrderOcoResponse");
8437
8438            let dummy = DummyRestApiResponse {
8439                inner: Box::new(move || Box::pin(async move { Ok(dummy_response) })),
8440                status: 200,
8441                headers: HashMap::new(),
8442                rate_limits: None,
8443            };
8444
8445            Ok(dummy.into())
8446        }
8447
8448        async fn order_test(
8449            &self,
8450            _params: OrderTestParams,
8451        ) -> anyhow::Result<RestApiResponse<models::OrderTestResponse>> {
8452            if self.force_error {
8453                return Err(ConnectorError::ConnectorClientError {
8454                    msg: "ResponseError".to_string(),
8455                    code: None,
8456                }
8457                .into());
8458            }
8459
8460            let resp_json: Value = serde_json::from_str(r#"{"discount":{"enabledForAccount":true,"enabledForSymbol":true,"discountAsset":"BNB"}}"#).unwrap_or_else(|_| serde_json::json!({}));
8461            let dummy_response: models::OrderTestResponse =
8462                serde_json::from_value(resp_json.clone())
8463                    .expect("should parse into models::OrderTestResponse");
8464
8465            let dummy = DummyRestApiResponse {
8466                inner: Box::new(move || Box::pin(async move { Ok(dummy_response) })),
8467                status: 200,
8468                headers: HashMap::new(),
8469                rate_limits: None,
8470            };
8471
8472            Ok(dummy.into())
8473        }
8474
8475        async fn sor_order(
8476            &self,
8477            _params: SorOrderParams,
8478        ) -> anyhow::Result<RestApiResponse<models::SorOrderResponse>> {
8479            if self.force_error {
8480                return Err(ConnectorError::ConnectorClientError {
8481                    msg: "ResponseError".to_string(),
8482                    code: None,
8483                }
8484                .into());
8485            }
8486
8487            let resp_json: Value = serde_json::from_str(r#"{"symbol":"BTCUSDT","orderId":2,"orderListId":-1,"clientOrderId":"sBI1KM6nNtOfj5tccZSKly","transactTime":1689149087774,"price":"31000.00000000","origQty":"0.50000000","executedQty":"0.50000000","origQuoteOrderQty":"0.000000","cummulativeQuoteQty":"14000.00000000","status":"FILLED","timeInForce":"GTC","type":"LIMIT","side":"BUY","workingTime":1689149087774,"fills":[{"matchType":"ONE_PARTY_TRADE_REPORT","price":"28000.00000000","qty":"0.50000000","commission":"0.00000000","commissionAsset":"BTC","tradeId":-1,"allocId":0}],"workingFloor":"SOR","selfTradePreventionMode":"NONE","usedSor":true}"#).unwrap_or_else(|_| serde_json::json!({}));
8488            let dummy_response: models::SorOrderResponse =
8489                serde_json::from_value(resp_json.clone())
8490                    .expect("should parse into models::SorOrderResponse");
8491
8492            let dummy = DummyRestApiResponse {
8493                inner: Box::new(move || Box::pin(async move { Ok(dummy_response) })),
8494                status: 200,
8495                headers: HashMap::new(),
8496                rate_limits: None,
8497            };
8498
8499            Ok(dummy.into())
8500        }
8501
8502        async fn sor_order_test(
8503            &self,
8504            _params: SorOrderTestParams,
8505        ) -> anyhow::Result<RestApiResponse<models::SorOrderTestResponse>> {
8506            if self.force_error {
8507                return Err(ConnectorError::ConnectorClientError {
8508                    msg: "ResponseError".to_string(),
8509                    code: None,
8510                }
8511                .into());
8512            }
8513
8514            let resp_json: Value = serde_json::from_str(r#"{"discount":{"enabledForAccount":true,"enabledForSymbol":true,"discountAsset":"BNB"}}"#).unwrap_or_else(|_| serde_json::json!({}));
8515            let dummy_response: models::SorOrderTestResponse =
8516                serde_json::from_value(resp_json.clone())
8517                    .expect("should parse into models::SorOrderTestResponse");
8518
8519            let dummy = DummyRestApiResponse {
8520                inner: Box::new(move || Box::pin(async move { Ok(dummy_response) })),
8521                status: 200,
8522                headers: HashMap::new(),
8523                rate_limits: None,
8524            };
8525
8526            Ok(dummy.into())
8527        }
8528    }
8529
8530    #[test]
8531    fn delete_open_orders_required_params_success() {
8532        TOKIO_SHARED_RT.block_on(async {
8533            let client = MockTradeApiClient { force_error: false };
8534
8535            let params = DeleteOpenOrdersParams::builder("BNBUSDT".to_string(),).build().unwrap();
8536
8537            let resp_json: Value = serde_json::from_str(r#"[{"symbol":"BTCUSDT","origClientOrderId":"E6APeyTJvkMvLMYMqu1KQ4","orderId":11,"orderListId":-1,"clientOrderId":"pXLV6Hz6mprAcVYpVMTGgx","transactTime":1684804350068,"price":"0.089853","origQty":"0.178622","executedQty":"0.000000","origQuoteOrderQty":"0.000000","cummulativeQuoteQty":"0.000000","status":"CANCELED","timeInForce":"GTC","type":"LIMIT","side":"BUY","selfTradePreventionMode":"NONE"}]"#).unwrap_or_else(|_| serde_json::json!({}));
8538            let expected_response : Vec<models::DeleteOpenOrdersResponseInner> = serde_json::from_value(resp_json.clone()).expect("should parse into Vec<models::DeleteOpenOrdersResponseInner>");
8539
8540            let resp = client.delete_open_orders(params).await.expect("Expected a response");
8541            let data_future = resp.data();
8542            let actual_response = data_future.await.unwrap();
8543            assert_eq!(actual_response, expected_response);
8544        });
8545    }
8546
8547    #[test]
8548    fn delete_open_orders_optional_params_success() {
8549        TOKIO_SHARED_RT.block_on(async {
8550            let client = MockTradeApiClient { force_error: false };
8551
8552            let params = DeleteOpenOrdersParams::builder("BNBUSDT".to_string(),).recv_window(dec!(5000)).build().unwrap();
8553
8554            let resp_json: Value = serde_json::from_str(r#"[{"symbol":"BTCUSDT","origClientOrderId":"E6APeyTJvkMvLMYMqu1KQ4","orderId":11,"orderListId":-1,"clientOrderId":"pXLV6Hz6mprAcVYpVMTGgx","transactTime":1684804350068,"price":"0.089853","origQty":"0.178622","executedQty":"0.000000","origQuoteOrderQty":"0.000000","cummulativeQuoteQty":"0.000000","status":"CANCELED","timeInForce":"GTC","type":"LIMIT","side":"BUY","selfTradePreventionMode":"NONE"}]"#).unwrap_or_else(|_| serde_json::json!({}));
8555            let expected_response : Vec<models::DeleteOpenOrdersResponseInner> = serde_json::from_value(resp_json.clone()).expect("should parse into Vec<models::DeleteOpenOrdersResponseInner>");
8556
8557            let resp = client.delete_open_orders(params).await.expect("Expected a response");
8558            let data_future = resp.data();
8559            let actual_response = data_future.await.unwrap();
8560            assert_eq!(actual_response, expected_response);
8561        });
8562    }
8563
8564    #[test]
8565    fn delete_open_orders_response_error() {
8566        TOKIO_SHARED_RT.block_on(async {
8567            let client = MockTradeApiClient { force_error: true };
8568
8569            let params = DeleteOpenOrdersParams::builder("BNBUSDT".to_string())
8570                .build()
8571                .unwrap();
8572
8573            match client.delete_open_orders(params).await {
8574                Ok(_) => panic!("Expected an error"),
8575                Err(err) => {
8576                    assert_eq!(err.to_string(), "Connector client error: ResponseError");
8577                }
8578            }
8579        });
8580    }
8581
8582    #[test]
8583    fn delete_order_required_params_success() {
8584        TOKIO_SHARED_RT.block_on(async {
8585            let client = MockTradeApiClient { force_error: false };
8586
8587            let params = DeleteOrderParams::builder("BNBUSDT".to_string(),).build().unwrap();
8588
8589            let resp_json: Value = serde_json::from_str(r#"{"symbol":"LTCBTC","orderId":4,"orderListId":-1,"origClientOrderId":"myOrder1","clientOrderId":"cancelMyOrder1","transactTime":1684804350068,"price":"2.00000000","origQty":"1.00000000","executedQty":"0.00000000","origQuoteOrderQty":"0.000000","cummulativeQuoteQty":"0.00000000","status":"CANCELED","timeInForce":"GTC","type":"LIMIT","side":"BUY","selfTradePreventionMode":"NONE","icebergQty":"0.00000000","preventedMatchId":0,"preventedQuantity":"1.200000","stopPrice":"23500.00000000","strategyId":37463720,"strategyType":1000000,"trailingDelta":10,"trailingTime":-1,"usedSor":true,"workingFloor":"SOR","pegPriceType":"PRIMARY_PEG","pegOffsetType":"PRICE_LEVEL","pegOffsetValue":5,"peggedPrice":"87523.83710000","expiryReason":"INSUFFICIENT_LIQUIDITY"}"#).unwrap_or_else(|_| serde_json::json!({}));
8590            let expected_response : models::DeleteOrderResponse = serde_json::from_value(resp_json.clone()).expect("should parse into models::DeleteOrderResponse");
8591
8592            let resp = client.delete_order(params).await.expect("Expected a response");
8593            let data_future = resp.data();
8594            let actual_response = data_future.await.unwrap();
8595            assert_eq!(actual_response, expected_response);
8596        });
8597    }
8598
8599    #[test]
8600    fn delete_order_optional_params_success() {
8601        TOKIO_SHARED_RT.block_on(async {
8602            let client = MockTradeApiClient { force_error: false };
8603
8604            let params = DeleteOrderParams::builder("BNBUSDT".to_string(),).order_id(1).orig_client_order_id("myOrder1".to_string()).new_client_order_id("cancelMyOrder1".to_string()).cancel_restrictions(DeleteOrderCancelRestrictionsEnum::OnlyNew).recv_window(dec!(5000)).build().unwrap();
8605
8606            let resp_json: Value = serde_json::from_str(r#"{"symbol":"LTCBTC","orderId":4,"orderListId":-1,"origClientOrderId":"myOrder1","clientOrderId":"cancelMyOrder1","transactTime":1684804350068,"price":"2.00000000","origQty":"1.00000000","executedQty":"0.00000000","origQuoteOrderQty":"0.000000","cummulativeQuoteQty":"0.00000000","status":"CANCELED","timeInForce":"GTC","type":"LIMIT","side":"BUY","selfTradePreventionMode":"NONE","icebergQty":"0.00000000","preventedMatchId":0,"preventedQuantity":"1.200000","stopPrice":"23500.00000000","strategyId":37463720,"strategyType":1000000,"trailingDelta":10,"trailingTime":-1,"usedSor":true,"workingFloor":"SOR","pegPriceType":"PRIMARY_PEG","pegOffsetType":"PRICE_LEVEL","pegOffsetValue":5,"peggedPrice":"87523.83710000","expiryReason":"INSUFFICIENT_LIQUIDITY"}"#).unwrap_or_else(|_| serde_json::json!({}));
8607            let expected_response : models::DeleteOrderResponse = serde_json::from_value(resp_json.clone()).expect("should parse into models::DeleteOrderResponse");
8608
8609            let resp = client.delete_order(params).await.expect("Expected a response");
8610            let data_future = resp.data();
8611            let actual_response = data_future.await.unwrap();
8612            assert_eq!(actual_response, expected_response);
8613        });
8614    }
8615
8616    #[test]
8617    fn delete_order_response_error() {
8618        TOKIO_SHARED_RT.block_on(async {
8619            let client = MockTradeApiClient { force_error: true };
8620
8621            let params = DeleteOrderParams::builder("BNBUSDT".to_string())
8622                .build()
8623                .unwrap();
8624
8625            match client.delete_order(params).await {
8626                Ok(_) => panic!("Expected an error"),
8627                Err(err) => {
8628                    assert_eq!(err.to_string(), "Connector client error: ResponseError");
8629                }
8630            }
8631        });
8632    }
8633
8634    #[test]
8635    fn delete_order_list_required_params_success() {
8636        TOKIO_SHARED_RT.block_on(async {
8637            let client = MockTradeApiClient { force_error: false };
8638
8639            let params = DeleteOrderListParams::builder("BNBUSDT".to_string(),).build().unwrap();
8640
8641            let resp_json: Value = serde_json::from_str(r#"{"orderListId":0,"contingencyType":"OCO","listStatusType":"ALL_DONE","listOrderStatus":"ALL_DONE","listClientOrderId":"C3wyj4WVEktd7u9aVBRXcN","transactionTime":1574040868128,"symbol":"LTCBTC","orders":[{"symbol":"LTCBTC","orderId":2,"clientOrderId":"pO9ufTiFGg3nw2fOdgeOXa"}],"orderReports":[{"symbol":"LTCBTC","origClientOrderId":"pO9ufTiFGg3nw2fOdgeOXa","orderId":2,"orderListId":0,"clientOrderId":"unfWT8ig8i0uj6lPuYLez6","transactTime":1688005070874,"price":"1.00000000","origQty":"10.00000000","executedQty":"0.00000000","origQuoteOrderQty":"0.000000","cummulativeQuoteQty":"0.00000000","status":"CANCELED","timeInForce":"GTC","type":"STOP_LOSS_LIMIT","side":"SELL","icebergQty":"0.00000000","preventedMatchId":0,"preventedQuantity":"1.200000","stopPrice":"0.00000000","strategyId":1,"strategyType":1000000,"trailingDelta":10,"trailingTime":-1,"usedSor":true,"workingFloor":"SOR","pegPriceType":"PRIMARY_PEG","pegOffsetType":"PRICE_LEVEL","pegOffsetValue":5,"peggedPrice":"87523.83710000","expiryReason":"INSUFFICIENT_LIQUIDITY"}]}"#).unwrap_or_else(|_| serde_json::json!({}));
8642            let expected_response : models::DeleteOrderListResponse = serde_json::from_value(resp_json.clone()).expect("should parse into models::DeleteOrderListResponse");
8643
8644            let resp = client.delete_order_list(params).await.expect("Expected a response");
8645            let data_future = resp.data();
8646            let actual_response = data_future.await.unwrap();
8647            assert_eq!(actual_response, expected_response);
8648        });
8649    }
8650
8651    #[test]
8652    fn delete_order_list_optional_params_success() {
8653        TOKIO_SHARED_RT.block_on(async {
8654            let client = MockTradeApiClient { force_error: false };
8655
8656            let params = DeleteOrderListParams::builder("BNBUSDT".to_string(),).order_list_id(1).list_client_order_id("C3wyj4WVEktd7u9aVBRXcN".to_string()).new_client_order_id("cancelMyOrder1".to_string()).recv_window(dec!(5000)).build().unwrap();
8657
8658            let resp_json: Value = serde_json::from_str(r#"{"orderListId":0,"contingencyType":"OCO","listStatusType":"ALL_DONE","listOrderStatus":"ALL_DONE","listClientOrderId":"C3wyj4WVEktd7u9aVBRXcN","transactionTime":1574040868128,"symbol":"LTCBTC","orders":[{"symbol":"LTCBTC","orderId":2,"clientOrderId":"pO9ufTiFGg3nw2fOdgeOXa"}],"orderReports":[{"symbol":"LTCBTC","origClientOrderId":"pO9ufTiFGg3nw2fOdgeOXa","orderId":2,"orderListId":0,"clientOrderId":"unfWT8ig8i0uj6lPuYLez6","transactTime":1688005070874,"price":"1.00000000","origQty":"10.00000000","executedQty":"0.00000000","origQuoteOrderQty":"0.000000","cummulativeQuoteQty":"0.00000000","status":"CANCELED","timeInForce":"GTC","type":"STOP_LOSS_LIMIT","side":"SELL","icebergQty":"0.00000000","preventedMatchId":0,"preventedQuantity":"1.200000","stopPrice":"0.00000000","strategyId":1,"strategyType":1000000,"trailingDelta":10,"trailingTime":-1,"usedSor":true,"workingFloor":"SOR","pegPriceType":"PRIMARY_PEG","pegOffsetType":"PRICE_LEVEL","pegOffsetValue":5,"peggedPrice":"87523.83710000","expiryReason":"INSUFFICIENT_LIQUIDITY"}]}"#).unwrap_or_else(|_| serde_json::json!({}));
8659            let expected_response : models::DeleteOrderListResponse = serde_json::from_value(resp_json.clone()).expect("should parse into models::DeleteOrderListResponse");
8660
8661            let resp = client.delete_order_list(params).await.expect("Expected a response");
8662            let data_future = resp.data();
8663            let actual_response = data_future.await.unwrap();
8664            assert_eq!(actual_response, expected_response);
8665        });
8666    }
8667
8668    #[test]
8669    fn delete_order_list_response_error() {
8670        TOKIO_SHARED_RT.block_on(async {
8671            let client = MockTradeApiClient { force_error: true };
8672
8673            let params = DeleteOrderListParams::builder("BNBUSDT".to_string())
8674                .build()
8675                .unwrap();
8676
8677            match client.delete_order_list(params).await {
8678                Ok(_) => panic!("Expected an error"),
8679                Err(err) => {
8680                    assert_eq!(err.to_string(), "Connector client error: ResponseError");
8681                }
8682            }
8683        });
8684    }
8685
8686    #[test]
8687    fn new_order_required_params_success() {
8688        TOKIO_SHARED_RT.block_on(async {
8689            let client = MockTradeApiClient { force_error: false };
8690
8691            let params = NewOrderParams::builder("BNBUSDT".to_string(),NewOrderSideEnum::Buy,NewOrderTypeEnum::Market,).build().unwrap();
8692
8693            let resp_json: Value = serde_json::from_str(r#"{"symbol":"BTCUSDT","orderId":28,"orderListId":-1,"clientOrderId":"6gCrw2kRUAF9CvJDGP16IP","transactTime":1507725176595,"status":"FILLED","timeInForce":"GTC","type":"MARKET","side":"SELL","workingTime":1507725176595,"selfTradePreventionMode":"NONE","fills":[{"commissionAsset":"USDT","tradeId":56}]}"#).unwrap_or_else(|_| serde_json::json!({}));
8694            let expected_response : models::NewOrderResponse = serde_json::from_value(resp_json.clone()).expect("should parse into models::NewOrderResponse");
8695
8696            let resp = client.new_order(params).await.expect("Expected a response");
8697            let data_future = resp.data();
8698            let actual_response = data_future.await.unwrap();
8699            assert_eq!(actual_response, expected_response);
8700        });
8701    }
8702
8703    #[test]
8704    fn new_order_optional_params_success() {
8705        TOKIO_SHARED_RT.block_on(async {
8706            let client = MockTradeApiClient { force_error: false };
8707
8708            let params = NewOrderParams::builder("BNBUSDT".to_string(),NewOrderSideEnum::Buy,NewOrderTypeEnum::Market,).time_in_force(NewOrderTimeInForceEnum::Gtc).quantity(dec!(1)).quote_order_qty(dec!(1)).price(dec!(400)).new_client_order_id("myOrder1".to_string()).strategy_id(1).strategy_type(1).stop_price(dec!(1)).trailing_delta(1).iceberg_qty(dec!(1)).new_order_resp_type(NewOrderNewOrderRespTypeEnum::Ack).self_trade_prevention_mode(NewOrderSelfTradePreventionModeEnum::None).peg_price_type(NewOrderPegPriceTypeEnum::PrimaryPeg).peg_offset_value(1).peg_offset_type(NewOrderPegOffsetTypeEnum::PriceLevel).recv_window(dec!(5000)).build().unwrap();
8709
8710            let resp_json: Value = serde_json::from_str(r#"{"symbol":"BTCUSDT","orderId":28,"orderListId":-1,"clientOrderId":"6gCrw2kRUAF9CvJDGP16IP","transactTime":1507725176595,"status":"FILLED","timeInForce":"GTC","type":"MARKET","side":"SELL","workingTime":1507725176595,"selfTradePreventionMode":"NONE","fills":[{"commissionAsset":"USDT","tradeId":56}]}"#).unwrap_or_else(|_| serde_json::json!({}));
8711            let expected_response : models::NewOrderResponse = serde_json::from_value(resp_json.clone()).expect("should parse into models::NewOrderResponse");
8712
8713            let resp = client.new_order(params).await.expect("Expected a response");
8714            let data_future = resp.data();
8715            let actual_response = data_future.await.unwrap();
8716            assert_eq!(actual_response, expected_response);
8717        });
8718    }
8719
8720    #[test]
8721    fn new_order_response_error() {
8722        TOKIO_SHARED_RT.block_on(async {
8723            let client = MockTradeApiClient { force_error: true };
8724
8725            let params = NewOrderParams::builder(
8726                "BNBUSDT".to_string(),
8727                NewOrderSideEnum::Buy,
8728                NewOrderTypeEnum::Market,
8729            )
8730            .build()
8731            .unwrap();
8732
8733            match client.new_order(params).await {
8734                Ok(_) => panic!("Expected an error"),
8735                Err(err) => {
8736                    assert_eq!(err.to_string(), "Connector client error: ResponseError");
8737                }
8738            }
8739        });
8740    }
8741
8742    #[test]
8743    fn order_amend_keep_priority_required_params_success() {
8744        TOKIO_SHARED_RT.block_on(async {
8745            let client = MockTradeApiClient { force_error: false };
8746
8747            let params = OrderAmendKeepPriorityParams::builder("BNBUSDT".to_string(),dec!(1),).build().unwrap();
8748
8749            let resp_json: Value = serde_json::from_str(r#"{"transactTime":1741926410255,"executionId":75,"amendedOrder":{"symbol":"BTCUSDT","orderId":33,"orderListId":-1,"origClientOrderId":"5xrgbMyg6z36NzBn2pbT8H","clientOrderId":"PFaq6hIHxqFENGfdtn4J6Q","price":"6.00000000","qty":"5.00000000","executedQty":"0.00000000","preventedQty":"0.00000000","quoteOrderQty":"0.00000000","cumulativeQuoteQty":"0.00000000","status":"NEW","timeInForce":"GTC","type":"LIMIT","side":"SELL","workingTime":1741926410242,"selfTradePreventionMode":"NONE","icebergQty":"0.00000000","preventedMatchId":0,"preventedQuantity":"1.200000","stopPrice":"0.00000000","strategyId":1,"strategyType":1000000,"trailingDelta":10,"trailingTime":-1,"usedSor":true,"workingFloor":"SOR","pegPriceType":"PRIMARY_PEG","pegOffsetType":"PRICE_LEVEL","pegOffsetValue":5,"peggedPrice":"87523.83710000","expiryReason":"INSUFFICIENT_LIQUIDITY"},"listStatus":{"orderListId":1,"contingencyType":"OTO","listOrderStatus":"EXECUTING","listClientOrderId":"AT7FTxZXylVSwRoZs52mt3","symbol":"BTCUSDT","orders":[{"symbol":"BTCUSDT","orderId":8,"clientOrderId":"GkwwHZUUbFtZOoH1YsZk9Q"}]}}"#).unwrap_or_else(|_| serde_json::json!({}));
8750            let expected_response : models::OrderAmendKeepPriorityResponse = serde_json::from_value(resp_json.clone()).expect("should parse into models::OrderAmendKeepPriorityResponse");
8751
8752            let resp = client.order_amend_keep_priority(params).await.expect("Expected a response");
8753            let data_future = resp.data();
8754            let actual_response = data_future.await.unwrap();
8755            assert_eq!(actual_response, expected_response);
8756        });
8757    }
8758
8759    #[test]
8760    fn order_amend_keep_priority_optional_params_success() {
8761        TOKIO_SHARED_RT.block_on(async {
8762            let client = MockTradeApiClient { force_error: false };
8763
8764            let params = OrderAmendKeepPriorityParams::builder("BNBUSDT".to_string(),dec!(1),).order_id(1).orig_client_order_id("myOrder1".to_string()).new_client_order_id("myOrder2".to_string()).recv_window(dec!(5000)).build().unwrap();
8765
8766            let resp_json: Value = serde_json::from_str(r#"{"transactTime":1741926410255,"executionId":75,"amendedOrder":{"symbol":"BTCUSDT","orderId":33,"orderListId":-1,"origClientOrderId":"5xrgbMyg6z36NzBn2pbT8H","clientOrderId":"PFaq6hIHxqFENGfdtn4J6Q","price":"6.00000000","qty":"5.00000000","executedQty":"0.00000000","preventedQty":"0.00000000","quoteOrderQty":"0.00000000","cumulativeQuoteQty":"0.00000000","status":"NEW","timeInForce":"GTC","type":"LIMIT","side":"SELL","workingTime":1741926410242,"selfTradePreventionMode":"NONE","icebergQty":"0.00000000","preventedMatchId":0,"preventedQuantity":"1.200000","stopPrice":"0.00000000","strategyId":1,"strategyType":1000000,"trailingDelta":10,"trailingTime":-1,"usedSor":true,"workingFloor":"SOR","pegPriceType":"PRIMARY_PEG","pegOffsetType":"PRICE_LEVEL","pegOffsetValue":5,"peggedPrice":"87523.83710000","expiryReason":"INSUFFICIENT_LIQUIDITY"},"listStatus":{"orderListId":1,"contingencyType":"OTO","listOrderStatus":"EXECUTING","listClientOrderId":"AT7FTxZXylVSwRoZs52mt3","symbol":"BTCUSDT","orders":[{"symbol":"BTCUSDT","orderId":8,"clientOrderId":"GkwwHZUUbFtZOoH1YsZk9Q"}]}}"#).unwrap_or_else(|_| serde_json::json!({}));
8767            let expected_response : models::OrderAmendKeepPriorityResponse = serde_json::from_value(resp_json.clone()).expect("should parse into models::OrderAmendKeepPriorityResponse");
8768
8769            let resp = client.order_amend_keep_priority(params).await.expect("Expected a response");
8770            let data_future = resp.data();
8771            let actual_response = data_future.await.unwrap();
8772            assert_eq!(actual_response, expected_response);
8773        });
8774    }
8775
8776    #[test]
8777    fn order_amend_keep_priority_response_error() {
8778        TOKIO_SHARED_RT.block_on(async {
8779            let client = MockTradeApiClient { force_error: true };
8780
8781            let params = OrderAmendKeepPriorityParams::builder("BNBUSDT".to_string(), dec!(1))
8782                .build()
8783                .unwrap();
8784
8785            match client.order_amend_keep_priority(params).await {
8786                Ok(_) => panic!("Expected an error"),
8787                Err(err) => {
8788                    assert_eq!(err.to_string(), "Connector client error: ResponseError");
8789                }
8790            }
8791        });
8792    }
8793
8794    #[test]
8795    fn order_cancel_replace_required_params_success() {
8796        TOKIO_SHARED_RT.block_on(async {
8797            let client = MockTradeApiClient { force_error: false };
8798
8799            let params = OrderCancelReplaceParams::builder("BNBUSDT".to_string(),OrderCancelReplaceSideEnum::Buy,OrderCancelReplaceTypeEnum::Market,OrderCancelReplaceCancelReplaceModeEnum::StopOnFailure,).build().unwrap();
8800
8801            let resp_json: Value = serde_json::from_str(r#"{"cancelResult":"SUCCESS","newOrderResult":"SUCCESS","cancelResponse":{"symbol":"BTCUSDT","origClientOrderId":"DnLo3vTAQcjha43lAZhZ0y","orderId":9,"orderListId":-1,"clientOrderId":"osxN3JXAtJvKvCqGeMWMVR","transactTime":1684804350068,"price":"0.01000000","origQty":"0.000100","executedQty":"0.00000000","origQuoteOrderQty":"0.000000","cummulativeQuoteQty":"0.00000000","status":"CANCELED","timeInForce":"GTC","type":"LIMIT","side":"SELL","selfTradePreventionMode":"NONE","icebergQty":"0.00000000","preventedMatchId":0,"preventedQuantity":"1.200000","stopPrice":"0.00000000","strategyId":1,"strategyType":1000000,"trailingDelta":10,"trailingTime":-1,"usedSor":true,"workingFloor":"SOR","pegPriceType":"PRIMARY_PEG","pegOffsetType":"PRICE_LEVEL","pegOffsetValue":5,"peggedPrice":"87523.83710000","expiryReason":"INSUFFICIENT_LIQUIDITY"},"newOrderResponse":{"symbol":"BTCUSDT","orderId":10,"orderListId":-1,"clientOrderId":"wOceeeOzNORyLiQfw7jd8S","transactTime":1652928801803,"price":"0.02000000","origQty":"0.040000","executedQty":"0.00000000","origQuoteOrderQty":"0.000000","cummulativeQuoteQty":"0.00000000","status":"NEW","timeInForce":"GTC","type":"LIMIT","side":"BUY","workingTime":1669277163808,"fills":[{"price":"4000.00000000","qty":"1.00000000","commission":"4.00000000","commissionAsset":"USDT","tradeId":12345}],"selfTradePreventionMode":"NONE","icebergQty":"0.00000000","preventedMatchId":0,"preventedQuantity":"1.200000","stopPrice":"0.00000000","strategyId":1,"strategyType":1000000,"trailingDelta":10,"trailingTime":-1,"usedSor":true,"workingFloor":"SOR","pegPriceType":"PRIMARY_PEG","pegOffsetType":"PRICE_LEVEL","pegOffsetValue":5,"peggedPrice":"87523.83710000","expiryReason":"INSUFFICIENT_LIQUIDITY"}}"#).unwrap_or_else(|_| serde_json::json!({}));
8802            let expected_response : models::OrderCancelReplaceResponse = serde_json::from_value(resp_json.clone()).expect("should parse into models::OrderCancelReplaceResponse");
8803
8804            let resp = client.order_cancel_replace(params).await.expect("Expected a response");
8805            let data_future = resp.data();
8806            let actual_response = data_future.await.unwrap();
8807            assert_eq!(actual_response, expected_response);
8808        });
8809    }
8810
8811    #[test]
8812    fn order_cancel_replace_optional_params_success() {
8813        TOKIO_SHARED_RT.block_on(async {
8814            let client = MockTradeApiClient { force_error: false };
8815
8816            let params = OrderCancelReplaceParams::builder("BNBUSDT".to_string(),OrderCancelReplaceSideEnum::Buy,OrderCancelReplaceTypeEnum::Market,OrderCancelReplaceCancelReplaceModeEnum::StopOnFailure,).time_in_force(OrderCancelReplaceTimeInForceEnum::Gtc).quantity(dec!(1)).quote_order_qty(dec!(1)).price(dec!(400)).cancel_new_client_order_id("cancelMyOrder1".to_string()).cancel_orig_client_order_id("myOrder1".to_string()).cancel_order_id(1).new_client_order_id("myOrder2".to_string()).strategy_id(1).strategy_type(1).stop_price(dec!(1)).trailing_delta(1).iceberg_qty(dec!(1)).new_order_resp_type(OrderCancelReplaceNewOrderRespTypeEnum::Ack).self_trade_prevention_mode(OrderCancelReplaceSelfTradePreventionModeEnum::None).cancel_restrictions(OrderCancelReplaceCancelRestrictionsEnum::OnlyNew).order_rate_limit_exceeded_mode(OrderCancelReplaceOrderRateLimitExceededModeEnum::DoNothing).peg_price_type(OrderCancelReplacePegPriceTypeEnum::PrimaryPeg).peg_offset_value(1).peg_offset_type(OrderCancelReplacePegOffsetTypeEnum::PriceLevel).recv_window(dec!(5000)).build().unwrap();
8817
8818            let resp_json: Value = serde_json::from_str(r#"{"cancelResult":"SUCCESS","newOrderResult":"SUCCESS","cancelResponse":{"symbol":"BTCUSDT","origClientOrderId":"DnLo3vTAQcjha43lAZhZ0y","orderId":9,"orderListId":-1,"clientOrderId":"osxN3JXAtJvKvCqGeMWMVR","transactTime":1684804350068,"price":"0.01000000","origQty":"0.000100","executedQty":"0.00000000","origQuoteOrderQty":"0.000000","cummulativeQuoteQty":"0.00000000","status":"CANCELED","timeInForce":"GTC","type":"LIMIT","side":"SELL","selfTradePreventionMode":"NONE","icebergQty":"0.00000000","preventedMatchId":0,"preventedQuantity":"1.200000","stopPrice":"0.00000000","strategyId":1,"strategyType":1000000,"trailingDelta":10,"trailingTime":-1,"usedSor":true,"workingFloor":"SOR","pegPriceType":"PRIMARY_PEG","pegOffsetType":"PRICE_LEVEL","pegOffsetValue":5,"peggedPrice":"87523.83710000","expiryReason":"INSUFFICIENT_LIQUIDITY"},"newOrderResponse":{"symbol":"BTCUSDT","orderId":10,"orderListId":-1,"clientOrderId":"wOceeeOzNORyLiQfw7jd8S","transactTime":1652928801803,"price":"0.02000000","origQty":"0.040000","executedQty":"0.00000000","origQuoteOrderQty":"0.000000","cummulativeQuoteQty":"0.00000000","status":"NEW","timeInForce":"GTC","type":"LIMIT","side":"BUY","workingTime":1669277163808,"fills":[{"price":"4000.00000000","qty":"1.00000000","commission":"4.00000000","commissionAsset":"USDT","tradeId":12345}],"selfTradePreventionMode":"NONE","icebergQty":"0.00000000","preventedMatchId":0,"preventedQuantity":"1.200000","stopPrice":"0.00000000","strategyId":1,"strategyType":1000000,"trailingDelta":10,"trailingTime":-1,"usedSor":true,"workingFloor":"SOR","pegPriceType":"PRIMARY_PEG","pegOffsetType":"PRICE_LEVEL","pegOffsetValue":5,"peggedPrice":"87523.83710000","expiryReason":"INSUFFICIENT_LIQUIDITY"}}"#).unwrap_or_else(|_| serde_json::json!({}));
8819            let expected_response : models::OrderCancelReplaceResponse = serde_json::from_value(resp_json.clone()).expect("should parse into models::OrderCancelReplaceResponse");
8820
8821            let resp = client.order_cancel_replace(params).await.expect("Expected a response");
8822            let data_future = resp.data();
8823            let actual_response = data_future.await.unwrap();
8824            assert_eq!(actual_response, expected_response);
8825        });
8826    }
8827
8828    #[test]
8829    fn order_cancel_replace_response_error() {
8830        TOKIO_SHARED_RT.block_on(async {
8831            let client = MockTradeApiClient { force_error: true };
8832
8833            let params = OrderCancelReplaceParams::builder(
8834                "BNBUSDT".to_string(),
8835                OrderCancelReplaceSideEnum::Buy,
8836                OrderCancelReplaceTypeEnum::Market,
8837                OrderCancelReplaceCancelReplaceModeEnum::StopOnFailure,
8838            )
8839            .build()
8840            .unwrap();
8841
8842            match client.order_cancel_replace(params).await {
8843                Ok(_) => panic!("Expected an error"),
8844                Err(err) => {
8845                    assert_eq!(err.to_string(), "Connector client error: ResponseError");
8846                }
8847            }
8848        });
8849    }
8850
8851    #[test]
8852    fn order_list_oco_required_params_success() {
8853        TOKIO_SHARED_RT.block_on(async {
8854            let client = MockTradeApiClient { force_error: false };
8855
8856            let params = OrderListOcoParams::builder("BNBUSDT".to_string(),OrderListOcoSideEnum::Buy,dec!(1),OrderListOcoAboveTypeEnum::StopLossLimit,OrderListOcoBelowTypeEnum::StopLoss,).build().unwrap();
8857
8858            let resp_json: Value = serde_json::from_str(r#"{"orderListId":1,"contingencyType":"OCO","listStatusType":"EXEC_STARTED","listOrderStatus":"EXECUTING","listClientOrderId":"lH1YDkuQKWiXVXHPSKYEIp","transactionTime":1710485608839,"symbol":"LTCBTC","orders":[{"symbol":"LTCBTC","orderId":10,"clientOrderId":"44nZvqpemY7sVYgPYbvPih"}],"orderReports":[{"symbol":"LTCBTC","orderId":10,"orderListId":1,"clientOrderId":"44nZvqpemY7sVYgPYbvPih","transactTime":1710485608839,"price":"1.00000000","origQty":"5.00000000","executedQty":"0.00000000","origQuoteOrderQty":"0.000000","cummulativeQuoteQty":"0.00000000","status":"NEW","timeInForce":"GTC","type":"STOP_LOSS_LIMIT","side":"SELL","workingTime":-1,"selfTradePreventionMode":"NONE","stopPrice":"1.00000000","icebergQty":"1.00000000"}]}"#).unwrap_or_else(|_| serde_json::json!({}));
8859            let expected_response : models::OrderListOcoResponse = serde_json::from_value(resp_json.clone()).expect("should parse into models::OrderListOcoResponse");
8860
8861            let resp = client.order_list_oco(params).await.expect("Expected a response");
8862            let data_future = resp.data();
8863            let actual_response = data_future.await.unwrap();
8864            assert_eq!(actual_response, expected_response);
8865        });
8866    }
8867
8868    #[test]
8869    fn order_list_oco_optional_params_success() {
8870        TOKIO_SHARED_RT.block_on(async {
8871            let client = MockTradeApiClient { force_error: false };
8872
8873            let params = OrderListOcoParams::builder("BNBUSDT".to_string(),OrderListOcoSideEnum::Buy,dec!(1),OrderListOcoAboveTypeEnum::StopLossLimit,OrderListOcoBelowTypeEnum::StopLoss,).list_client_order_id("lH1YDkuQKWiXVXHPSKYEIp".to_string()).above_client_order_id("aboveOrder1".to_string()).above_iceberg_qty(1).above_price(dec!(1)).above_stop_price(dec!(1)).above_trailing_delta(1).above_time_in_force(OrderListOcoAboveTimeInForceEnum::Gtc).above_strategy_id(1).above_strategy_type(1).above_peg_price_type(OrderListOcoAbovePegPriceTypeEnum::PrimaryPeg).above_peg_offset_type(OrderListOcoAbovePegOffsetTypeEnum::PriceLevel).above_peg_offset_value(1).below_client_order_id("belowOrder1".to_string()).below_iceberg_qty(1).below_price(dec!(1)).below_stop_price(dec!(1)).below_trailing_delta(1).below_time_in_force(OrderListOcoBelowTimeInForceEnum::Gtc).below_strategy_id(1).below_strategy_type(1).below_peg_price_type(OrderListOcoBelowPegPriceTypeEnum::PrimaryPeg).below_peg_offset_type(OrderListOcoBelowPegOffsetTypeEnum::PriceLevel).below_peg_offset_value(1).new_order_resp_type(OrderListOcoNewOrderRespTypeEnum::Ack).self_trade_prevention_mode(OrderListOcoSelfTradePreventionModeEnum::None).recv_window(dec!(5000)).build().unwrap();
8874
8875            let resp_json: Value = serde_json::from_str(r#"{"orderListId":1,"contingencyType":"OCO","listStatusType":"EXEC_STARTED","listOrderStatus":"EXECUTING","listClientOrderId":"lH1YDkuQKWiXVXHPSKYEIp","transactionTime":1710485608839,"symbol":"LTCBTC","orders":[{"symbol":"LTCBTC","orderId":10,"clientOrderId":"44nZvqpemY7sVYgPYbvPih"}],"orderReports":[{"symbol":"LTCBTC","orderId":10,"orderListId":1,"clientOrderId":"44nZvqpemY7sVYgPYbvPih","transactTime":1710485608839,"price":"1.00000000","origQty":"5.00000000","executedQty":"0.00000000","origQuoteOrderQty":"0.000000","cummulativeQuoteQty":"0.00000000","status":"NEW","timeInForce":"GTC","type":"STOP_LOSS_LIMIT","side":"SELL","workingTime":-1,"selfTradePreventionMode":"NONE","stopPrice":"1.00000000","icebergQty":"1.00000000"}]}"#).unwrap_or_else(|_| serde_json::json!({}));
8876            let expected_response : models::OrderListOcoResponse = serde_json::from_value(resp_json.clone()).expect("should parse into models::OrderListOcoResponse");
8877
8878            let resp = client.order_list_oco(params).await.expect("Expected a response");
8879            let data_future = resp.data();
8880            let actual_response = data_future.await.unwrap();
8881            assert_eq!(actual_response, expected_response);
8882        });
8883    }
8884
8885    #[test]
8886    fn order_list_oco_response_error() {
8887        TOKIO_SHARED_RT.block_on(async {
8888            let client = MockTradeApiClient { force_error: true };
8889
8890            let params = OrderListOcoParams::builder(
8891                "BNBUSDT".to_string(),
8892                OrderListOcoSideEnum::Buy,
8893                dec!(1),
8894                OrderListOcoAboveTypeEnum::StopLossLimit,
8895                OrderListOcoBelowTypeEnum::StopLoss,
8896            )
8897            .build()
8898            .unwrap();
8899
8900            match client.order_list_oco(params).await {
8901                Ok(_) => panic!("Expected an error"),
8902                Err(err) => {
8903                    assert_eq!(err.to_string(), "Connector client error: ResponseError");
8904                }
8905            }
8906        });
8907    }
8908
8909    #[test]
8910    fn order_list_opo_required_params_success() {
8911        TOKIO_SHARED_RT.block_on(async {
8912            let client = MockTradeApiClient { force_error: false };
8913
8914            let params = OrderListOpoParams::builder("BNBUSDT".to_string(),OrderListOpoWorkingTypeEnum::Limit,OrderListOpoWorkingSideEnum::Buy,dec!(1),dec!(1),OrderListOpoPendingTypeEnum::Limit,OrderListOpoPendingSideEnum::Buy,).build().unwrap();
8915
8916            let resp_json: Value = serde_json::from_str(r#"{"orderListId":0,"contingencyType":"OTO","listStatusType":"EXEC_STARTED","listOrderStatus":"EXECUTING","listClientOrderId":"H94qCqO27P74OEiO4X8HOG","transactionTime":1762998011671,"symbol":"BTCUSDT","orders":[{"symbol":"BTCUSDT","orderId":2,"clientOrderId":"JX6xfdjo0wysiGumfHNmPu"}],"orderReports":[{"symbol":"BTCUSDT","orderId":2,"orderListId":0,"clientOrderId":"JX6xfdjo0wysiGumfHNmPu","transactTime":1762998011671,"price":"102264.00000000","executedQty":"0.00000000","origQuoteOrderQty":"0.00000000","cummulativeQuoteQty":"0.00000000","status":"NEW","timeInForce":"GTC","type":"LIMIT","side":"BUY","workingTime":1762998011671,"selfTradePreventionMode":"NONE","origQty":"0.00060000","icebergQty":"0.00000000","preventedMatchId":0,"preventedQuantity":"1.200000","stopPrice":"0.00000000","strategyId":1,"strategyType":1000000,"trailingDelta":10,"trailingTime":-1,"usedSor":true,"workingFloor":"SOR","pegPriceType":"PRIMARY_PEG","pegOffsetType":"PRICE_LEVEL","pegOffsetValue":5,"peggedPrice":"87523.83710000","expiryReason":"INSUFFICIENT_LIQUIDITY"}]}"#).unwrap_or_else(|_| serde_json::json!({}));
8917            let expected_response : models::OrderListOpoResponse = serde_json::from_value(resp_json.clone()).expect("should parse into models::OrderListOpoResponse");
8918
8919            let resp = client.order_list_opo(params).await.expect("Expected a response");
8920            let data_future = resp.data();
8921            let actual_response = data_future.await.unwrap();
8922            assert_eq!(actual_response, expected_response);
8923        });
8924    }
8925
8926    #[test]
8927    fn order_list_opo_optional_params_success() {
8928        TOKIO_SHARED_RT.block_on(async {
8929            let client = MockTradeApiClient { force_error: false };
8930
8931            let params = OrderListOpoParams::builder("BNBUSDT".to_string(),OrderListOpoWorkingTypeEnum::Limit,OrderListOpoWorkingSideEnum::Buy,dec!(1),dec!(1),OrderListOpoPendingTypeEnum::Limit,OrderListOpoPendingSideEnum::Buy,).list_client_order_id("H94qCqO27P74OEiO4X8HOG".to_string()).new_order_resp_type(OrderListOpoNewOrderRespTypeEnum::Ack).self_trade_prevention_mode(OrderListOpoSelfTradePreventionModeEnum::None).working_client_order_id("workingOrder1".to_string()).working_iceberg_qty(dec!(1)).working_time_in_force(OrderListOpoWorkingTimeInForceEnum::Gtc).working_strategy_id(1).working_strategy_type(1).working_peg_price_type(OrderListOpoWorkingPegPriceTypeEnum::PrimaryPeg).working_peg_offset_type(OrderListOpoWorkingPegOffsetTypeEnum::PriceLevel).working_peg_offset_value(1).pending_client_order_id("pendingOrder1".to_string()).pending_price(dec!(1)).pending_stop_price(dec!(1)).pending_trailing_delta(dec!(1)).pending_iceberg_qty(dec!(1)).pending_time_in_force(OrderListOpoPendingTimeInForceEnum::Gtc).pending_strategy_id(1).pending_strategy_type(1).pending_peg_price_type(OrderListOpoPendingPegPriceTypeEnum::PrimaryPeg).pending_peg_offset_type(OrderListOpoPendingPegOffsetTypeEnum::PriceLevel).pending_peg_offset_value(1).recv_window(dec!(5000)).build().unwrap();
8932
8933            let resp_json: Value = serde_json::from_str(r#"{"orderListId":0,"contingencyType":"OTO","listStatusType":"EXEC_STARTED","listOrderStatus":"EXECUTING","listClientOrderId":"H94qCqO27P74OEiO4X8HOG","transactionTime":1762998011671,"symbol":"BTCUSDT","orders":[{"symbol":"BTCUSDT","orderId":2,"clientOrderId":"JX6xfdjo0wysiGumfHNmPu"}],"orderReports":[{"symbol":"BTCUSDT","orderId":2,"orderListId":0,"clientOrderId":"JX6xfdjo0wysiGumfHNmPu","transactTime":1762998011671,"price":"102264.00000000","executedQty":"0.00000000","origQuoteOrderQty":"0.00000000","cummulativeQuoteQty":"0.00000000","status":"NEW","timeInForce":"GTC","type":"LIMIT","side":"BUY","workingTime":1762998011671,"selfTradePreventionMode":"NONE","origQty":"0.00060000","icebergQty":"0.00000000","preventedMatchId":0,"preventedQuantity":"1.200000","stopPrice":"0.00000000","strategyId":1,"strategyType":1000000,"trailingDelta":10,"trailingTime":-1,"usedSor":true,"workingFloor":"SOR","pegPriceType":"PRIMARY_PEG","pegOffsetType":"PRICE_LEVEL","pegOffsetValue":5,"peggedPrice":"87523.83710000","expiryReason":"INSUFFICIENT_LIQUIDITY"}]}"#).unwrap_or_else(|_| serde_json::json!({}));
8934            let expected_response : models::OrderListOpoResponse = serde_json::from_value(resp_json.clone()).expect("should parse into models::OrderListOpoResponse");
8935
8936            let resp = client.order_list_opo(params).await.expect("Expected a response");
8937            let data_future = resp.data();
8938            let actual_response = data_future.await.unwrap();
8939            assert_eq!(actual_response, expected_response);
8940        });
8941    }
8942
8943    #[test]
8944    fn order_list_opo_response_error() {
8945        TOKIO_SHARED_RT.block_on(async {
8946            let client = MockTradeApiClient { force_error: true };
8947
8948            let params = OrderListOpoParams::builder(
8949                "BNBUSDT".to_string(),
8950                OrderListOpoWorkingTypeEnum::Limit,
8951                OrderListOpoWorkingSideEnum::Buy,
8952                dec!(1),
8953                dec!(1),
8954                OrderListOpoPendingTypeEnum::Limit,
8955                OrderListOpoPendingSideEnum::Buy,
8956            )
8957            .build()
8958            .unwrap();
8959
8960            match client.order_list_opo(params).await {
8961                Ok(_) => panic!("Expected an error"),
8962                Err(err) => {
8963                    assert_eq!(err.to_string(), "Connector client error: ResponseError");
8964                }
8965            }
8966        });
8967    }
8968
8969    #[test]
8970    fn order_list_opoco_required_params_success() {
8971        TOKIO_SHARED_RT.block_on(async {
8972            let client = MockTradeApiClient { force_error: false };
8973
8974            let params = OrderListOpocoParams::builder("BNBUSDT".to_string(),OrderListOpocoWorkingTypeEnum::Limit,OrderListOpocoWorkingSideEnum::Buy,dec!(1),dec!(1),OrderListOpocoPendingSideEnum::Buy,OrderListOpocoPendingAboveTypeEnum::StopLossLimit,).build().unwrap();
8975
8976            let resp_json: Value = serde_json::from_str(r#"{"orderListId":2,"contingencyType":"OTO","listStatusType":"EXEC_STARTED","listOrderStatus":"EXECUTING","listClientOrderId":"bcedxMpQG6nFrZUPQyshoL","transactionTime":1763000506354,"symbol":"BTCUSDT","orders":[{"symbol":"BTCUSDT","orderId":9,"clientOrderId":"OLSBhMWaIlLSzZ9Zm7fnKB"}],"orderReports":[{"symbol":"BTCUSDT","orderId":9,"orderListId":2,"clientOrderId":"OLSBhMWaIlLSzZ9Zm7fnKB","transactTime":1763000506354,"price":"102496.00000000","executedQty":"0.00000000","origQuoteOrderQty":"0.00000000","cummulativeQuoteQty":"0.00000000","status":"NEW","timeInForce":"GTC","type":"LIMIT","side":"BUY","workingTime":1763000506354,"selfTradePreventionMode":"NONE","origQty":"0.00170000","icebergQty":"0.00000000","preventedMatchId":0,"preventedQuantity":"1.200000","stopPrice":"0.00000000","strategyId":1,"strategyType":1000000,"trailingDelta":10,"trailingTime":-1,"usedSor":true,"workingFloor":"SOR","pegPriceType":"PRIMARY_PEG","pegOffsetType":"PRICE_LEVEL","pegOffsetValue":5,"peggedPrice":"87523.83710000","expiryReason":"INSUFFICIENT_LIQUIDITY"}]}"#).unwrap_or_else(|_| serde_json::json!({}));
8977            let expected_response : models::OrderListOpocoResponse = serde_json::from_value(resp_json.clone()).expect("should parse into models::OrderListOpocoResponse");
8978
8979            let resp = client.order_list_opoco(params).await.expect("Expected a response");
8980            let data_future = resp.data();
8981            let actual_response = data_future.await.unwrap();
8982            assert_eq!(actual_response, expected_response);
8983        });
8984    }
8985
8986    #[test]
8987    fn order_list_opoco_optional_params_success() {
8988        TOKIO_SHARED_RT.block_on(async {
8989            let client = MockTradeApiClient { force_error: false };
8990
8991            let params = OrderListOpocoParams::builder("BNBUSDT".to_string(),OrderListOpocoWorkingTypeEnum::Limit,OrderListOpocoWorkingSideEnum::Buy,dec!(1),dec!(1),OrderListOpocoPendingSideEnum::Buy,OrderListOpocoPendingAboveTypeEnum::StopLossLimit,).list_client_order_id("bcedxMpQG6nFrZUPQyshoL".to_string()).new_order_resp_type(OrderListOpocoNewOrderRespTypeEnum::Ack).self_trade_prevention_mode(OrderListOpocoSelfTradePreventionModeEnum::None).working_client_order_id("workingOrder1".to_string()).working_iceberg_qty(dec!(1)).working_time_in_force(OrderListOpocoWorkingTimeInForceEnum::Gtc).working_strategy_id(1).working_strategy_type(1).working_peg_price_type(OrderListOpocoWorkingPegPriceTypeEnum::PrimaryPeg).working_peg_offset_type(OrderListOpocoWorkingPegOffsetTypeEnum::PriceLevel).working_peg_offset_value(1).pending_above_client_order_id("pendingAboveOrder1".to_string()).pending_above_price(dec!(1)).pending_above_stop_price(dec!(1)).pending_above_trailing_delta(dec!(1)).pending_above_iceberg_qty(dec!(1)).pending_above_time_in_force(OrderListOpocoPendingAboveTimeInForceEnum::Gtc).pending_above_strategy_id(1).pending_above_strategy_type(1).pending_above_peg_price_type(OrderListOpocoPendingAbovePegPriceTypeEnum::PrimaryPeg).pending_above_peg_offset_type(OrderListOpocoPendingAbovePegOffsetTypeEnum::PriceLevel).pending_above_peg_offset_value(1).pending_below_type(OrderListOpocoPendingBelowTypeEnum::StopLoss).pending_below_client_order_id("pendingBelowOrder1".to_string()).pending_below_price(dec!(1)).pending_below_stop_price(dec!(1)).pending_below_trailing_delta(dec!(1)).pending_below_iceberg_qty(dec!(1)).pending_below_time_in_force(OrderListOpocoPendingBelowTimeInForceEnum::Gtc).pending_below_strategy_id(1).pending_below_strategy_type(1).pending_below_peg_price_type(OrderListOpocoPendingBelowPegPriceTypeEnum::PrimaryPeg).pending_below_peg_offset_type(OrderListOpocoPendingBelowPegOffsetTypeEnum::PriceLevel).pending_below_peg_offset_value(1).recv_window(dec!(5000)).build().unwrap();
8992
8993            let resp_json: Value = serde_json::from_str(r#"{"orderListId":2,"contingencyType":"OTO","listStatusType":"EXEC_STARTED","listOrderStatus":"EXECUTING","listClientOrderId":"bcedxMpQG6nFrZUPQyshoL","transactionTime":1763000506354,"symbol":"BTCUSDT","orders":[{"symbol":"BTCUSDT","orderId":9,"clientOrderId":"OLSBhMWaIlLSzZ9Zm7fnKB"}],"orderReports":[{"symbol":"BTCUSDT","orderId":9,"orderListId":2,"clientOrderId":"OLSBhMWaIlLSzZ9Zm7fnKB","transactTime":1763000506354,"price":"102496.00000000","executedQty":"0.00000000","origQuoteOrderQty":"0.00000000","cummulativeQuoteQty":"0.00000000","status":"NEW","timeInForce":"GTC","type":"LIMIT","side":"BUY","workingTime":1763000506354,"selfTradePreventionMode":"NONE","origQty":"0.00170000","icebergQty":"0.00000000","preventedMatchId":0,"preventedQuantity":"1.200000","stopPrice":"0.00000000","strategyId":1,"strategyType":1000000,"trailingDelta":10,"trailingTime":-1,"usedSor":true,"workingFloor":"SOR","pegPriceType":"PRIMARY_PEG","pegOffsetType":"PRICE_LEVEL","pegOffsetValue":5,"peggedPrice":"87523.83710000","expiryReason":"INSUFFICIENT_LIQUIDITY"}]}"#).unwrap_or_else(|_| serde_json::json!({}));
8994            let expected_response : models::OrderListOpocoResponse = serde_json::from_value(resp_json.clone()).expect("should parse into models::OrderListOpocoResponse");
8995
8996            let resp = client.order_list_opoco(params).await.expect("Expected a response");
8997            let data_future = resp.data();
8998            let actual_response = data_future.await.unwrap();
8999            assert_eq!(actual_response, expected_response);
9000        });
9001    }
9002
9003    #[test]
9004    fn order_list_opoco_response_error() {
9005        TOKIO_SHARED_RT.block_on(async {
9006            let client = MockTradeApiClient { force_error: true };
9007
9008            let params = OrderListOpocoParams::builder(
9009                "BNBUSDT".to_string(),
9010                OrderListOpocoWorkingTypeEnum::Limit,
9011                OrderListOpocoWorkingSideEnum::Buy,
9012                dec!(1),
9013                dec!(1),
9014                OrderListOpocoPendingSideEnum::Buy,
9015                OrderListOpocoPendingAboveTypeEnum::StopLossLimit,
9016            )
9017            .build()
9018            .unwrap();
9019
9020            match client.order_list_opoco(params).await {
9021                Ok(_) => panic!("Expected an error"),
9022                Err(err) => {
9023                    assert_eq!(err.to_string(), "Connector client error: ResponseError");
9024                }
9025            }
9026        });
9027    }
9028
9029    #[test]
9030    fn order_list_oto_required_params_success() {
9031        TOKIO_SHARED_RT.block_on(async {
9032            let client = MockTradeApiClient { force_error: false };
9033
9034            let params = OrderListOtoParams::builder("BNBUSDT".to_string(),OrderListOtoWorkingTypeEnum::Limit,OrderListOtoWorkingSideEnum::Buy,dec!(1),dec!(1),OrderListOtoPendingTypeEnum::Limit,OrderListOtoPendingSideEnum::Buy,dec!(1),).build().unwrap();
9035
9036            let resp_json: Value = serde_json::from_str(r#"{"orderListId":0,"contingencyType":"OTO","listStatusType":"EXEC_STARTED","listOrderStatus":"EXECUTING","listClientOrderId":"yl2ERtcar1o25zcWtqVBTC","transactionTime":1712289389158,"symbol":"LTCBTC","orders":[{"symbol":"LTCBTC","orderId":4,"clientOrderId":"Bq17mn9fP6vyCn75Jw1xya"}],"orderReports":[{"symbol":"LTCBTC","orderId":4,"orderListId":0,"clientOrderId":"Bq17mn9fP6vyCn75Jw1xya","transactTime":1712289389158,"price":"1.00000000","origQty":"1.00000000","executedQty":"0.00000000","origQuoteOrderQty":"0.000000","cummulativeQuoteQty":"0.00000000","status":"NEW","timeInForce":"GTC","type":"LIMIT","side":"SELL","workingTime":1712289389158,"selfTradePreventionMode":"NONE","icebergQty":"0.00000000","preventedMatchId":0,"preventedQuantity":"1.200000","stopPrice":"0.00000000","strategyId":1,"strategyType":1000000,"trailingDelta":10,"trailingTime":-1,"usedSor":true,"workingFloor":"SOR","pegPriceType":"PRIMARY_PEG","pegOffsetType":"PRICE_LEVEL","pegOffsetValue":5,"peggedPrice":"87523.83710000","expiryReason":"INSUFFICIENT_LIQUIDITY"}]}"#).unwrap_or_else(|_| serde_json::json!({}));
9037            let expected_response : models::OrderListOtoResponse = serde_json::from_value(resp_json.clone()).expect("should parse into models::OrderListOtoResponse");
9038
9039            let resp = client.order_list_oto(params).await.expect("Expected a response");
9040            let data_future = resp.data();
9041            let actual_response = data_future.await.unwrap();
9042            assert_eq!(actual_response, expected_response);
9043        });
9044    }
9045
9046    #[test]
9047    fn order_list_oto_optional_params_success() {
9048        TOKIO_SHARED_RT.block_on(async {
9049            let client = MockTradeApiClient { force_error: false };
9050
9051            let params = OrderListOtoParams::builder("BNBUSDT".to_string(),OrderListOtoWorkingTypeEnum::Limit,OrderListOtoWorkingSideEnum::Buy,dec!(1),dec!(1),OrderListOtoPendingTypeEnum::Limit,OrderListOtoPendingSideEnum::Buy,dec!(1),).list_client_order_id("yl2ERtcar1o25zcWtqVBTC".to_string()).new_order_resp_type(OrderListOtoNewOrderRespTypeEnum::Ack).self_trade_prevention_mode(OrderListOtoSelfTradePreventionModeEnum::None).working_client_order_id("workingOrder1".to_string()).working_iceberg_qty(dec!(1)).working_time_in_force(OrderListOtoWorkingTimeInForceEnum::Gtc).working_strategy_id(1).working_strategy_type(1).working_peg_price_type(OrderListOtoWorkingPegPriceTypeEnum::PrimaryPeg).working_peg_offset_type(OrderListOtoWorkingPegOffsetTypeEnum::PriceLevel).working_peg_offset_value(1).pending_client_order_id("pendingOrder1".to_string()).pending_price(dec!(1)).pending_stop_price(dec!(1)).pending_trailing_delta(dec!(1)).pending_iceberg_qty(dec!(1)).pending_time_in_force(OrderListOtoPendingTimeInForceEnum::Gtc).pending_strategy_id(1).pending_strategy_type(1).pending_peg_price_type(OrderListOtoPendingPegPriceTypeEnum::PrimaryPeg).pending_peg_offset_type(OrderListOtoPendingPegOffsetTypeEnum::PriceLevel).pending_peg_offset_value(1).recv_window(dec!(5000)).build().unwrap();
9052
9053            let resp_json: Value = serde_json::from_str(r#"{"orderListId":0,"contingencyType":"OTO","listStatusType":"EXEC_STARTED","listOrderStatus":"EXECUTING","listClientOrderId":"yl2ERtcar1o25zcWtqVBTC","transactionTime":1712289389158,"symbol":"LTCBTC","orders":[{"symbol":"LTCBTC","orderId":4,"clientOrderId":"Bq17mn9fP6vyCn75Jw1xya"}],"orderReports":[{"symbol":"LTCBTC","orderId":4,"orderListId":0,"clientOrderId":"Bq17mn9fP6vyCn75Jw1xya","transactTime":1712289389158,"price":"1.00000000","origQty":"1.00000000","executedQty":"0.00000000","origQuoteOrderQty":"0.000000","cummulativeQuoteQty":"0.00000000","status":"NEW","timeInForce":"GTC","type":"LIMIT","side":"SELL","workingTime":1712289389158,"selfTradePreventionMode":"NONE","icebergQty":"0.00000000","preventedMatchId":0,"preventedQuantity":"1.200000","stopPrice":"0.00000000","strategyId":1,"strategyType":1000000,"trailingDelta":10,"trailingTime":-1,"usedSor":true,"workingFloor":"SOR","pegPriceType":"PRIMARY_PEG","pegOffsetType":"PRICE_LEVEL","pegOffsetValue":5,"peggedPrice":"87523.83710000","expiryReason":"INSUFFICIENT_LIQUIDITY"}]}"#).unwrap_or_else(|_| serde_json::json!({}));
9054            let expected_response : models::OrderListOtoResponse = serde_json::from_value(resp_json.clone()).expect("should parse into models::OrderListOtoResponse");
9055
9056            let resp = client.order_list_oto(params).await.expect("Expected a response");
9057            let data_future = resp.data();
9058            let actual_response = data_future.await.unwrap();
9059            assert_eq!(actual_response, expected_response);
9060        });
9061    }
9062
9063    #[test]
9064    fn order_list_oto_response_error() {
9065        TOKIO_SHARED_RT.block_on(async {
9066            let client = MockTradeApiClient { force_error: true };
9067
9068            let params = OrderListOtoParams::builder(
9069                "BNBUSDT".to_string(),
9070                OrderListOtoWorkingTypeEnum::Limit,
9071                OrderListOtoWorkingSideEnum::Buy,
9072                dec!(1),
9073                dec!(1),
9074                OrderListOtoPendingTypeEnum::Limit,
9075                OrderListOtoPendingSideEnum::Buy,
9076                dec!(1),
9077            )
9078            .build()
9079            .unwrap();
9080
9081            match client.order_list_oto(params).await {
9082                Ok(_) => panic!("Expected an error"),
9083                Err(err) => {
9084                    assert_eq!(err.to_string(), "Connector client error: ResponseError");
9085                }
9086            }
9087        });
9088    }
9089
9090    #[test]
9091    fn order_list_otoco_required_params_success() {
9092        TOKIO_SHARED_RT.block_on(async {
9093            let client = MockTradeApiClient { force_error: false };
9094
9095            let params = OrderListOtocoParams::builder("BNBUSDT".to_string(),OrderListOtocoWorkingTypeEnum::Limit,OrderListOtocoWorkingSideEnum::Buy,dec!(1),dec!(1),OrderListOtocoPendingSideEnum::Buy,dec!(1),OrderListOtocoPendingAboveTypeEnum::StopLossLimit,).build().unwrap();
9096
9097            let resp_json: Value = serde_json::from_str(r#"{"orderListId":1,"contingencyType":"OTO","listStatusType":"EXEC_STARTED","listOrderStatus":"EXECUTING","listClientOrderId":"RumwQpBaDctlUu5jyG5rs0","transactionTime":1712291372842,"symbol":"LTCBTC","orders":[{"symbol":"LTCBTC","orderId":6,"clientOrderId":"fM9Y4m23IFJVCQmIrlUmMK"}],"orderReports":[{"symbol":"LTCBTC","orderId":6,"orderListId":1,"clientOrderId":"fM9Y4m23IFJVCQmIrlUmMK","transactTime":1712291372842,"price":"1.00000000","origQty":"1.00000000","executedQty":"0.00000000","origQuoteOrderQty":"0.000000","cummulativeQuoteQty":"0.00000000","status":"NEW","timeInForce":"GTC","type":"LIMIT","side":"SELL","workingTime":1712291372842,"selfTradePreventionMode":"NONE","icebergQty":"0.00000000","preventedMatchId":0,"preventedQuantity":"1.200000","stopPrice":"0.00000000","strategyId":1,"strategyType":1000000,"trailingDelta":10,"trailingTime":-1,"usedSor":true,"workingFloor":"SOR","pegPriceType":"PRIMARY_PEG","pegOffsetType":"PRICE_LEVEL","pegOffsetValue":5,"peggedPrice":"87523.83710000","expiryReason":"INSUFFICIENT_LIQUIDITY"}]}"#).unwrap_or_else(|_| serde_json::json!({}));
9098            let expected_response : models::OrderListOtocoResponse = serde_json::from_value(resp_json.clone()).expect("should parse into models::OrderListOtocoResponse");
9099
9100            let resp = client.order_list_otoco(params).await.expect("Expected a response");
9101            let data_future = resp.data();
9102            let actual_response = data_future.await.unwrap();
9103            assert_eq!(actual_response, expected_response);
9104        });
9105    }
9106
9107    #[test]
9108    fn order_list_otoco_optional_params_success() {
9109        TOKIO_SHARED_RT.block_on(async {
9110            let client = MockTradeApiClient { force_error: false };
9111
9112            let params = OrderListOtocoParams::builder("BNBUSDT".to_string(),OrderListOtocoWorkingTypeEnum::Limit,OrderListOtocoWorkingSideEnum::Buy,dec!(1),dec!(1),OrderListOtocoPendingSideEnum::Buy,dec!(1),OrderListOtocoPendingAboveTypeEnum::StopLossLimit,).list_client_order_id("RumwQpBaDctlUu5jyG5rs0".to_string()).new_order_resp_type(OrderListOtocoNewOrderRespTypeEnum::Ack).self_trade_prevention_mode(OrderListOtocoSelfTradePreventionModeEnum::None).working_client_order_id("workingOrder1".to_string()).working_iceberg_qty(dec!(1)).working_time_in_force(OrderListOtocoWorkingTimeInForceEnum::Gtc).working_strategy_id(1).working_strategy_type(1).working_peg_price_type(OrderListOtocoWorkingPegPriceTypeEnum::PrimaryPeg).working_peg_offset_type(OrderListOtocoWorkingPegOffsetTypeEnum::PriceLevel).working_peg_offset_value(1).pending_above_client_order_id("pendingAboveOrder1".to_string()).pending_above_price(dec!(1)).pending_above_stop_price(dec!(1)).pending_above_trailing_delta(dec!(1)).pending_above_iceberg_qty(dec!(1)).pending_above_time_in_force(OrderListOtocoPendingAboveTimeInForceEnum::Gtc).pending_above_strategy_id(1).pending_above_strategy_type(1).pending_above_peg_price_type(OrderListOtocoPendingAbovePegPriceTypeEnum::PrimaryPeg).pending_above_peg_offset_type(OrderListOtocoPendingAbovePegOffsetTypeEnum::PriceLevel).pending_above_peg_offset_value(1).pending_below_type(OrderListOtocoPendingBelowTypeEnum::StopLoss).pending_below_client_order_id("pendingBelowOrder1".to_string()).pending_below_price(dec!(1)).pending_below_stop_price(dec!(1)).pending_below_trailing_delta(dec!(1)).pending_below_iceberg_qty(dec!(1)).pending_below_time_in_force(OrderListOtocoPendingBelowTimeInForceEnum::Gtc).pending_below_strategy_id(1).pending_below_strategy_type(1).pending_below_peg_price_type(OrderListOtocoPendingBelowPegPriceTypeEnum::PrimaryPeg).pending_below_peg_offset_type(OrderListOtocoPendingBelowPegOffsetTypeEnum::PriceLevel).pending_below_peg_offset_value(1).recv_window(dec!(5000)).build().unwrap();
9113
9114            let resp_json: Value = serde_json::from_str(r#"{"orderListId":1,"contingencyType":"OTO","listStatusType":"EXEC_STARTED","listOrderStatus":"EXECUTING","listClientOrderId":"RumwQpBaDctlUu5jyG5rs0","transactionTime":1712291372842,"symbol":"LTCBTC","orders":[{"symbol":"LTCBTC","orderId":6,"clientOrderId":"fM9Y4m23IFJVCQmIrlUmMK"}],"orderReports":[{"symbol":"LTCBTC","orderId":6,"orderListId":1,"clientOrderId":"fM9Y4m23IFJVCQmIrlUmMK","transactTime":1712291372842,"price":"1.00000000","origQty":"1.00000000","executedQty":"0.00000000","origQuoteOrderQty":"0.000000","cummulativeQuoteQty":"0.00000000","status":"NEW","timeInForce":"GTC","type":"LIMIT","side":"SELL","workingTime":1712291372842,"selfTradePreventionMode":"NONE","icebergQty":"0.00000000","preventedMatchId":0,"preventedQuantity":"1.200000","stopPrice":"0.00000000","strategyId":1,"strategyType":1000000,"trailingDelta":10,"trailingTime":-1,"usedSor":true,"workingFloor":"SOR","pegPriceType":"PRIMARY_PEG","pegOffsetType":"PRICE_LEVEL","pegOffsetValue":5,"peggedPrice":"87523.83710000","expiryReason":"INSUFFICIENT_LIQUIDITY"}]}"#).unwrap_or_else(|_| serde_json::json!({}));
9115            let expected_response : models::OrderListOtocoResponse = serde_json::from_value(resp_json.clone()).expect("should parse into models::OrderListOtocoResponse");
9116
9117            let resp = client.order_list_otoco(params).await.expect("Expected a response");
9118            let data_future = resp.data();
9119            let actual_response = data_future.await.unwrap();
9120            assert_eq!(actual_response, expected_response);
9121        });
9122    }
9123
9124    #[test]
9125    fn order_list_otoco_response_error() {
9126        TOKIO_SHARED_RT.block_on(async {
9127            let client = MockTradeApiClient { force_error: true };
9128
9129            let params = OrderListOtocoParams::builder(
9130                "BNBUSDT".to_string(),
9131                OrderListOtocoWorkingTypeEnum::Limit,
9132                OrderListOtocoWorkingSideEnum::Buy,
9133                dec!(1),
9134                dec!(1),
9135                OrderListOtocoPendingSideEnum::Buy,
9136                dec!(1),
9137                OrderListOtocoPendingAboveTypeEnum::StopLossLimit,
9138            )
9139            .build()
9140            .unwrap();
9141
9142            match client.order_list_otoco(params).await {
9143                Ok(_) => panic!("Expected an error"),
9144                Err(err) => {
9145                    assert_eq!(err.to_string(), "Connector client error: ResponseError");
9146                }
9147            }
9148        });
9149    }
9150
9151    #[test]
9152    fn order_oco_required_params_success() {
9153        TOKIO_SHARED_RT.block_on(async {
9154            let client = MockTradeApiClient { force_error: false };
9155
9156            let params = OrderOcoParams::builder("BNBUSDT".to_string(),OrderOcoSideEnum::Buy,dec!(1),dec!(1),dec!(1),).build().unwrap();
9157
9158            let resp_json: Value = serde_json::from_str(r#"{"orderListId":0,"contingencyType":"OCO","listStatusType":"EXEC_STARTED","listOrderStatus":"EXECUTING","listClientOrderId":"JYVpp3F0f5CAG15DhtrqLp","transactionTime":1563417480525,"symbol":"LTCBTC","orders":[{"symbol":"LTCBTC","orderId":2,"clientOrderId":"Kk7sqHb9J6mJWTMDVW7Vos"}],"orderReports":[{"symbol":"LTCBTC","orderId":2,"orderListId":0,"clientOrderId":"Kk7sqHb9J6mJWTMDVW7Vos","transactTime":1563417480525,"price":"0.000000","origQty":"0.624363","executedQty":"0.000000","origQuoteOrderQty":"0.000000","cummulativeQuoteQty":"0.000000","status":"NEW","timeInForce":"GTC","type":"STOP_LOSS","side":"BUY","workingTime":-1,"selfTradePreventionMode":"NONE","stopPrice":"0.960664"}]}"#).unwrap_or_else(|_| serde_json::json!({}));
9159            let expected_response : models::OrderOcoResponse = serde_json::from_value(resp_json.clone()).expect("should parse into models::OrderOcoResponse");
9160
9161            let resp = client.order_oco(params).await.expect("Expected a response");
9162            let data_future = resp.data();
9163            let actual_response = data_future.await.unwrap();
9164            assert_eq!(actual_response, expected_response);
9165        });
9166    }
9167
9168    #[test]
9169    fn order_oco_optional_params_success() {
9170        TOKIO_SHARED_RT.block_on(async {
9171            let client = MockTradeApiClient { force_error: false };
9172
9173            let params = OrderOcoParams::builder("BNBUSDT".to_string(),OrderOcoSideEnum::Buy,dec!(1),dec!(1),dec!(1),).list_client_order_id("JYVpp3F0f5CAG15DhtrqLp".to_string()).limit_client_order_id("limitOrder1".to_string()).limit_strategy_id(1).limit_strategy_type(1).limit_iceberg_qty(dec!(1)).trailing_delta(1).stop_client_order_id("stopOrder1".to_string()).stop_strategy_id(1).stop_strategy_type(1).stop_limit_price(dec!(1)).stop_iceberg_qty(dec!(1)).stop_limit_time_in_force(OrderOcoStopLimitTimeInForceEnum::Gtc).new_order_resp_type(OrderOcoNewOrderRespTypeEnum::Ack).self_trade_prevention_mode(OrderOcoSelfTradePreventionModeEnum::None).recv_window(dec!(5000)).build().unwrap();
9174
9175            let resp_json: Value = serde_json::from_str(r#"{"orderListId":0,"contingencyType":"OCO","listStatusType":"EXEC_STARTED","listOrderStatus":"EXECUTING","listClientOrderId":"JYVpp3F0f5CAG15DhtrqLp","transactionTime":1563417480525,"symbol":"LTCBTC","orders":[{"symbol":"LTCBTC","orderId":2,"clientOrderId":"Kk7sqHb9J6mJWTMDVW7Vos"}],"orderReports":[{"symbol":"LTCBTC","orderId":2,"orderListId":0,"clientOrderId":"Kk7sqHb9J6mJWTMDVW7Vos","transactTime":1563417480525,"price":"0.000000","origQty":"0.624363","executedQty":"0.000000","origQuoteOrderQty":"0.000000","cummulativeQuoteQty":"0.000000","status":"NEW","timeInForce":"GTC","type":"STOP_LOSS","side":"BUY","workingTime":-1,"selfTradePreventionMode":"NONE","stopPrice":"0.960664"}]}"#).unwrap_or_else(|_| serde_json::json!({}));
9176            let expected_response : models::OrderOcoResponse = serde_json::from_value(resp_json.clone()).expect("should parse into models::OrderOcoResponse");
9177
9178            let resp = client.order_oco(params).await.expect("Expected a response");
9179            let data_future = resp.data();
9180            let actual_response = data_future.await.unwrap();
9181            assert_eq!(actual_response, expected_response);
9182        });
9183    }
9184
9185    #[test]
9186    fn order_oco_response_error() {
9187        TOKIO_SHARED_RT.block_on(async {
9188            let client = MockTradeApiClient { force_error: true };
9189
9190            let params = OrderOcoParams::builder(
9191                "BNBUSDT".to_string(),
9192                OrderOcoSideEnum::Buy,
9193                dec!(1),
9194                dec!(1),
9195                dec!(1),
9196            )
9197            .build()
9198            .unwrap();
9199
9200            match client.order_oco(params).await {
9201                Ok(_) => panic!("Expected an error"),
9202                Err(err) => {
9203                    assert_eq!(err.to_string(), "Connector client error: ResponseError");
9204                }
9205            }
9206        });
9207    }
9208
9209    #[test]
9210    fn order_test_required_params_success() {
9211        TOKIO_SHARED_RT.block_on(async {
9212            let client = MockTradeApiClient { force_error: false };
9213
9214            let params = OrderTestParams::builder("BNBUSDT".to_string(),OrderTestSideEnum::Buy,OrderTestTypeEnum::Market,).build().unwrap();
9215
9216            let resp_json: Value = serde_json::from_str(r#"{"discount":{"enabledForAccount":true,"enabledForSymbol":true,"discountAsset":"BNB"}}"#).unwrap_or_else(|_| serde_json::json!({}));
9217            let expected_response : models::OrderTestResponse = serde_json::from_value(resp_json.clone()).expect("should parse into models::OrderTestResponse");
9218
9219            let resp = client.order_test(params).await.expect("Expected a response");
9220            let data_future = resp.data();
9221            let actual_response = data_future.await.unwrap();
9222            assert_eq!(actual_response, expected_response);
9223        });
9224    }
9225
9226    #[test]
9227    fn order_test_optional_params_success() {
9228        TOKIO_SHARED_RT.block_on(async {
9229            let client = MockTradeApiClient { force_error: false };
9230
9231            let params = OrderTestParams::builder("BNBUSDT".to_string(),OrderTestSideEnum::Buy,OrderTestTypeEnum::Market,).compute_commission_rates(false).time_in_force(OrderTestTimeInForceEnum::Gtc).quantity(dec!(1)).quote_order_qty(dec!(1)).price(dec!(400)).new_client_order_id("myOrder1".to_string()).strategy_id(1).strategy_type(1).stop_price(dec!(1)).trailing_delta(1).iceberg_qty(dec!(1)).new_order_resp_type(OrderTestNewOrderRespTypeEnum::Ack).self_trade_prevention_mode(OrderTestSelfTradePreventionModeEnum::None).peg_price_type(OrderTestPegPriceTypeEnum::PrimaryPeg).peg_offset_value(1).peg_offset_type(OrderTestPegOffsetTypeEnum::PriceLevel).recv_window(dec!(5000)).build().unwrap();
9232
9233            let resp_json: Value = serde_json::from_str(r#"{"discount":{"enabledForAccount":true,"enabledForSymbol":true,"discountAsset":"BNB"}}"#).unwrap_or_else(|_| serde_json::json!({}));
9234            let expected_response : models::OrderTestResponse = serde_json::from_value(resp_json.clone()).expect("should parse into models::OrderTestResponse");
9235
9236            let resp = client.order_test(params).await.expect("Expected a response");
9237            let data_future = resp.data();
9238            let actual_response = data_future.await.unwrap();
9239            assert_eq!(actual_response, expected_response);
9240        });
9241    }
9242
9243    #[test]
9244    fn order_test_response_error() {
9245        TOKIO_SHARED_RT.block_on(async {
9246            let client = MockTradeApiClient { force_error: true };
9247
9248            let params = OrderTestParams::builder(
9249                "BNBUSDT".to_string(),
9250                OrderTestSideEnum::Buy,
9251                OrderTestTypeEnum::Market,
9252            )
9253            .build()
9254            .unwrap();
9255
9256            match client.order_test(params).await {
9257                Ok(_) => panic!("Expected an error"),
9258                Err(err) => {
9259                    assert_eq!(err.to_string(), "Connector client error: ResponseError");
9260                }
9261            }
9262        });
9263    }
9264
9265    #[test]
9266    fn sor_order_required_params_success() {
9267        TOKIO_SHARED_RT.block_on(async {
9268            let client = MockTradeApiClient { force_error: false };
9269
9270            let params = SorOrderParams::builder("BNBUSDT".to_string(),SorOrderSideEnum::Buy,SorOrderTypeEnum::Market,dec!(1),).build().unwrap();
9271
9272            let resp_json: Value = serde_json::from_str(r#"{"symbol":"BTCUSDT","orderId":2,"orderListId":-1,"clientOrderId":"sBI1KM6nNtOfj5tccZSKly","transactTime":1689149087774,"price":"31000.00000000","origQty":"0.50000000","executedQty":"0.50000000","origQuoteOrderQty":"0.000000","cummulativeQuoteQty":"14000.00000000","status":"FILLED","timeInForce":"GTC","type":"LIMIT","side":"BUY","workingTime":1689149087774,"fills":[{"matchType":"ONE_PARTY_TRADE_REPORT","price":"28000.00000000","qty":"0.50000000","commission":"0.00000000","commissionAsset":"BTC","tradeId":-1,"allocId":0}],"workingFloor":"SOR","selfTradePreventionMode":"NONE","usedSor":true}"#).unwrap_or_else(|_| serde_json::json!({}));
9273            let expected_response : models::SorOrderResponse = serde_json::from_value(resp_json.clone()).expect("should parse into models::SorOrderResponse");
9274
9275            let resp = client.sor_order(params).await.expect("Expected a response");
9276            let data_future = resp.data();
9277            let actual_response = data_future.await.unwrap();
9278            assert_eq!(actual_response, expected_response);
9279        });
9280    }
9281
9282    #[test]
9283    fn sor_order_optional_params_success() {
9284        TOKIO_SHARED_RT.block_on(async {
9285            let client = MockTradeApiClient { force_error: false };
9286
9287            let params = SorOrderParams::builder("BNBUSDT".to_string(),SorOrderSideEnum::Buy,SorOrderTypeEnum::Market,dec!(1),).time_in_force(SorOrderTimeInForceEnum::Gtc).price(dec!(400)).new_client_order_id("myOrder1".to_string()).strategy_id(1).strategy_type(1).iceberg_qty(dec!(1)).new_order_resp_type(SorOrderNewOrderRespTypeEnum::Ack).self_trade_prevention_mode(SorOrderSelfTradePreventionModeEnum::None).recv_window(dec!(5000)).build().unwrap();
9288
9289            let resp_json: Value = serde_json::from_str(r#"{"symbol":"BTCUSDT","orderId":2,"orderListId":-1,"clientOrderId":"sBI1KM6nNtOfj5tccZSKly","transactTime":1689149087774,"price":"31000.00000000","origQty":"0.50000000","executedQty":"0.50000000","origQuoteOrderQty":"0.000000","cummulativeQuoteQty":"14000.00000000","status":"FILLED","timeInForce":"GTC","type":"LIMIT","side":"BUY","workingTime":1689149087774,"fills":[{"matchType":"ONE_PARTY_TRADE_REPORT","price":"28000.00000000","qty":"0.50000000","commission":"0.00000000","commissionAsset":"BTC","tradeId":-1,"allocId":0}],"workingFloor":"SOR","selfTradePreventionMode":"NONE","usedSor":true}"#).unwrap_or_else(|_| serde_json::json!({}));
9290            let expected_response : models::SorOrderResponse = serde_json::from_value(resp_json.clone()).expect("should parse into models::SorOrderResponse");
9291
9292            let resp = client.sor_order(params).await.expect("Expected a response");
9293            let data_future = resp.data();
9294            let actual_response = data_future.await.unwrap();
9295            assert_eq!(actual_response, expected_response);
9296        });
9297    }
9298
9299    #[test]
9300    fn sor_order_response_error() {
9301        TOKIO_SHARED_RT.block_on(async {
9302            let client = MockTradeApiClient { force_error: true };
9303
9304            let params = SorOrderParams::builder(
9305                "BNBUSDT".to_string(),
9306                SorOrderSideEnum::Buy,
9307                SorOrderTypeEnum::Market,
9308                dec!(1),
9309            )
9310            .build()
9311            .unwrap();
9312
9313            match client.sor_order(params).await {
9314                Ok(_) => panic!("Expected an error"),
9315                Err(err) => {
9316                    assert_eq!(err.to_string(), "Connector client error: ResponseError");
9317                }
9318            }
9319        });
9320    }
9321
9322    #[test]
9323    fn sor_order_test_required_params_success() {
9324        TOKIO_SHARED_RT.block_on(async {
9325            let client = MockTradeApiClient { force_error: false };
9326
9327            let params = SorOrderTestParams::builder("BNBUSDT".to_string(),SorOrderTestSideEnum::Buy,SorOrderTestTypeEnum::Market,dec!(1),).build().unwrap();
9328
9329            let resp_json: Value = serde_json::from_str(r#"{"discount":{"enabledForAccount":true,"enabledForSymbol":true,"discountAsset":"BNB"}}"#).unwrap_or_else(|_| serde_json::json!({}));
9330            let expected_response : models::SorOrderTestResponse = serde_json::from_value(resp_json.clone()).expect("should parse into models::SorOrderTestResponse");
9331
9332            let resp = client.sor_order_test(params).await.expect("Expected a response");
9333            let data_future = resp.data();
9334            let actual_response = data_future.await.unwrap();
9335            assert_eq!(actual_response, expected_response);
9336        });
9337    }
9338
9339    #[test]
9340    fn sor_order_test_optional_params_success() {
9341        TOKIO_SHARED_RT.block_on(async {
9342            let client = MockTradeApiClient { force_error: false };
9343
9344            let params = SorOrderTestParams::builder("BNBUSDT".to_string(),SorOrderTestSideEnum::Buy,SorOrderTestTypeEnum::Market,dec!(1),).compute_commission_rates(false).time_in_force(SorOrderTestTimeInForceEnum::Gtc).price(dec!(400)).new_client_order_id("myOrder1".to_string()).strategy_id(1).strategy_type(1).iceberg_qty(dec!(1)).new_order_resp_type(SorOrderTestNewOrderRespTypeEnum::Ack).self_trade_prevention_mode(SorOrderTestSelfTradePreventionModeEnum::None).recv_window(dec!(5000)).build().unwrap();
9345
9346            let resp_json: Value = serde_json::from_str(r#"{"discount":{"enabledForAccount":true,"enabledForSymbol":true,"discountAsset":"BNB"}}"#).unwrap_or_else(|_| serde_json::json!({}));
9347            let expected_response : models::SorOrderTestResponse = serde_json::from_value(resp_json.clone()).expect("should parse into models::SorOrderTestResponse");
9348
9349            let resp = client.sor_order_test(params).await.expect("Expected a response");
9350            let data_future = resp.data();
9351            let actual_response = data_future.await.unwrap();
9352            assert_eq!(actual_response, expected_response);
9353        });
9354    }
9355
9356    #[test]
9357    fn sor_order_test_response_error() {
9358        TOKIO_SHARED_RT.block_on(async {
9359            let client = MockTradeApiClient { force_error: true };
9360
9361            let params = SorOrderTestParams::builder(
9362                "BNBUSDT".to_string(),
9363                SorOrderTestSideEnum::Buy,
9364                SorOrderTestTypeEnum::Market,
9365                dec!(1),
9366            )
9367            .build()
9368            .unwrap();
9369
9370            match client.sor_order_test(params).await {
9371                Ok(_) => panic!("Expected an error"),
9372                Err(err) => {
9373                    assert_eq!(err.to_string(), "Connector client error: ResponseError");
9374                }
9375            }
9376        });
9377    }
9378}