Skip to main content

binance_sdk/spot/rest_api/apis/
trade_api.rs

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