1use reqwest;
13use serde::{Deserialize, Serialize, de::Error as _};
14use crate::spot::{apis::ResponseContent, models};
15use super::{Error, configuration, ContentType};
16
17#[derive(Clone, Debug, Default)]
19pub struct CreateOrderCancelReplaceV3Params {
20 pub cancel_replace_mode: String,
21 pub side: String,
22 pub symbol: String,
23 pub timestamp: i64,
24 pub r#type: String,
25 pub cancel_new_client_order_id: Option<String>,
26 pub cancel_order_id: Option<i64>,
27 pub cancel_orig_client_order_id: Option<String>,
28 pub cancel_restrictions: Option<String>,
29 pub iceberg_qty: Option<String>,
30 pub new_client_order_id: Option<String>,
31 pub new_order_resp_type: Option<String>,
32 pub order_rate_limit_exceeded_mode: Option<String>,
33 pub price: Option<String>,
34 pub quantity: Option<String>,
35 pub quote_order_qty: Option<String>,
36 pub recv_window: Option<i64>,
37 pub self_trade_prevention_mode: Option<String>,
38 pub stop_price: Option<String>,
39 pub strategy_id: Option<i64>,
40 pub strategy_type: Option<i32>,
41 pub time_in_force: Option<String>,
42 pub trailing_delta: Option<i64>
43}
44
45#[derive(Clone, Debug, Default)]
47pub struct CreateOrderListOcoV3Params {
48 pub above_type: String,
49 pub below_type: String,
50 pub quantity: String,
51 pub side: String,
52 pub symbol: String,
53 pub timestamp: i64,
54 pub above_client_order_id: Option<String>,
55 pub above_iceberg_qty: Option<i64>,
56 pub above_price: Option<String>,
57 pub above_stop_price: Option<String>,
58 pub above_strategy_id: Option<i64>,
59 pub above_strategy_type: Option<i32>,
60 pub above_time_in_force: Option<String>,
61 pub above_trailing_delta: Option<i64>,
62 pub below_client_order_id: Option<String>,
63 pub below_iceberg_qty: Option<i64>,
64 pub below_price: Option<String>,
65 pub below_stop_price: Option<String>,
66 pub below_strategy_id: Option<i64>,
67 pub below_strategy_type: Option<i32>,
68 pub below_time_in_force: Option<String>,
69 pub below_trailing_delta: Option<i64>,
70 pub list_client_order_id: Option<String>,
71 pub new_order_resp_type: Option<String>,
72 pub recv_window: Option<i64>,
73 pub self_trade_prevention_mode: Option<String>
74}
75
76#[derive(Clone, Debug, Default)]
78pub struct CreateOrderListOtoV3Params {
79 pub pending_quantity: String,
80 pub pending_side: String,
81 pub pending_type: String,
82 pub symbol: String,
83 pub timestamp: i64,
84 pub working_price: String,
85 pub working_quantity: String,
86 pub working_side: String,
87 pub working_type: String,
88 pub list_client_order_id: Option<String>,
89 pub new_order_resp_type: Option<String>,
90 pub pending_client_order_id: Option<String>,
91 pub pending_iceberg_qty: Option<String>,
92 pub pending_price: Option<String>,
93 pub pending_stop_price: Option<String>,
94 pub pending_strategy_id: Option<i64>,
95 pub pending_strategy_type: Option<i32>,
96 pub pending_time_in_force: Option<String>,
97 pub pending_trailing_delta: Option<String>,
98 pub recv_window: Option<i64>,
99 pub self_trade_prevention_mode: Option<String>,
100 pub working_client_order_id: Option<String>,
101 pub working_iceberg_qty: Option<String>,
102 pub working_strategy_id: Option<i64>,
103 pub working_strategy_type: Option<i32>,
104 pub working_time_in_force: Option<String>
105}
106
107#[derive(Clone, Debug, Default)]
109pub struct CreateOrderListOtocoV3Params {
110 pub pending_above_type: String,
111 pub pending_quantity: String,
112 pub pending_side: String,
113 pub symbol: String,
114 pub timestamp: i64,
115 pub working_price: String,
116 pub working_quantity: String,
117 pub working_side: String,
118 pub working_type: String,
119 pub list_client_order_id: Option<String>,
120 pub new_order_resp_type: Option<String>,
121 pub pending_above_client_order_id: Option<String>,
122 pub pending_above_iceberg_qty: Option<String>,
123 pub pending_above_price: Option<String>,
124 pub pending_above_stop_price: Option<String>,
125 pub pending_above_strategy_id: Option<i64>,
126 pub pending_above_strategy_type: Option<i32>,
127 pub pending_above_time_in_force: Option<String>,
128 pub pending_above_trailing_delta: Option<String>,
129 pub pending_below_client_order_id: Option<String>,
130 pub pending_below_iceberg_qty: Option<String>,
131 pub pending_below_price: Option<String>,
132 pub pending_below_stop_price: Option<String>,
133 pub pending_below_strategy_id: Option<i64>,
134 pub pending_below_strategy_type: Option<i32>,
135 pub pending_below_time_in_force: Option<String>,
136 pub pending_below_trailing_delta: Option<String>,
137 pub pending_below_type: Option<String>,
138 pub recv_window: Option<i64>,
139 pub self_trade_prevention_mode: Option<String>,
140 pub working_client_order_id: Option<String>,
141 pub working_iceberg_qty: Option<String>,
142 pub working_strategy_id: Option<i64>,
143 pub working_strategy_type: Option<i32>,
144 pub working_time_in_force: Option<String>
145}
146
147#[derive(Clone, Debug, Default)]
149pub struct CreateOrderOcoV3Params {
150 pub price: String,
151 pub quantity: String,
152 pub side: String,
153 pub stop_price: String,
154 pub symbol: String,
155 pub timestamp: i64,
156 pub limit_client_order_id: Option<String>,
157 pub limit_iceberg_qty: Option<String>,
158 pub limit_strategy_id: Option<i64>,
159 pub limit_strategy_type: Option<i32>,
160 pub list_client_order_id: Option<String>,
161 pub new_order_resp_type: Option<String>,
162 pub recv_window: Option<i64>,
163 pub self_trade_prevention_mode: Option<String>,
164 pub stop_client_order_id: Option<String>,
165 pub stop_iceberg_qty: Option<String>,
166 pub stop_limit_price: Option<String>,
167 pub stop_limit_time_in_force: Option<String>,
168 pub stop_strategy_id: Option<i64>,
169 pub stop_strategy_type: Option<i32>,
170 pub trailing_delta: Option<i64>
171}
172
173#[derive(Clone, Debug, Default)]
175pub struct CreateOrderTestV3Params {
176 pub side: String,
177 pub symbol: String,
178 pub timestamp: i64,
179 pub r#type: String,
180 pub compute_commission_rates: Option<bool>,
181 pub iceberg_qty: Option<String>,
182 pub new_client_order_id: Option<String>,
183 pub new_order_resp_type: Option<String>,
184 pub price: Option<String>,
185 pub quantity: Option<String>,
186 pub quote_order_qty: Option<String>,
187 pub recv_window: Option<i64>,
188 pub self_trade_prevention_mode: Option<String>,
189 pub stop_price: Option<String>,
190 pub strategy_id: Option<i64>,
191 pub strategy_type: Option<i32>,
192 pub time_in_force: Option<String>,
193 pub trailing_delta: Option<i64>
194}
195
196#[derive(Clone, Debug, Default)]
198pub struct CreateOrderV3Params {
199 pub side: String,
200 pub symbol: String,
201 pub timestamp: i64,
202 pub r#type: String,
203 pub iceberg_qty: Option<String>,
204 pub new_client_order_id: Option<String>,
205 pub new_order_resp_type: Option<String>,
206 pub price: Option<String>,
207 pub quantity: Option<String>,
208 pub quote_order_qty: Option<String>,
209 pub recv_window: Option<i64>,
210 pub self_trade_prevention_mode: Option<String>,
211 pub stop_price: Option<String>,
212 pub strategy_id: Option<i64>,
213 pub strategy_type: Option<i32>,
214 pub time_in_force: Option<String>,
215 pub trailing_delta: Option<i64>
216}
217
218#[derive(Clone, Debug, Default)]
220pub struct CreateSorOrderTestV3Params {
221 pub quantity: String,
222 pub side: String,
223 pub symbol: String,
224 pub timestamp: i64,
225 pub r#type: String,
226 pub compute_commission_rates: Option<bool>,
227 pub iceberg_qty: Option<String>,
228 pub new_client_order_id: Option<String>,
229 pub new_order_resp_type: Option<String>,
230 pub price: Option<String>,
231 pub recv_window: Option<i64>,
232 pub self_trade_prevention_mode: Option<String>,
233 pub strategy_id: Option<i64>,
234 pub strategy_type: Option<i32>,
235 pub time_in_force: Option<String>
236}
237
238#[derive(Clone, Debug, Default)]
240pub struct CreateSorOrderV3Params {
241 pub quantity: String,
242 pub side: String,
243 pub symbol: String,
244 pub timestamp: i64,
245 pub r#type: String,
246 pub iceberg_qty: Option<String>,
247 pub new_client_order_id: Option<String>,
248 pub new_order_resp_type: Option<String>,
249 pub price: Option<String>,
250 pub recv_window: Option<i64>,
251 pub self_trade_prevention_mode: Option<String>,
252 pub strategy_id: Option<i64>,
253 pub strategy_type: Option<i32>,
254 pub time_in_force: Option<String>
255}
256
257#[derive(Clone, Debug, Default)]
259pub struct DeleteOpenOrdersV3Params {
260 pub symbol: String,
261 pub timestamp: i64,
262 pub recv_window: Option<i64>
264}
265
266#[derive(Clone, Debug, Default)]
268pub struct DeleteOrderListV3Params {
269 pub symbol: String,
270 pub timestamp: i64,
271 pub order_list_id: Option<i64>,
273 pub list_client_order_id: Option<String>,
275 pub new_client_order_id: Option<String>,
277 pub recv_window: Option<i64>
279}
280
281#[derive(Clone, Debug, Default)]
283pub struct DeleteOrderV3Params {
284 pub symbol: String,
285 pub timestamp: i64,
286 pub order_id: Option<i64>,
287 pub orig_client_order_id: Option<String>,
288 pub new_client_order_id: Option<String>,
290 pub cancel_restrictions: Option<String>,
292 pub recv_window: Option<i64>
294}
295
296#[derive(Clone, Debug, Default)]
298pub struct DeleteUserDataStreamV3Params {
299 pub listen_key: String
300}
301
302#[derive(Clone, Debug, Default)]
304pub struct GetAccountCommissionV3Params {
305 pub symbol: String
306}
307
308#[derive(Clone, Debug, Default)]
310pub struct GetAccountV3Params {
311 pub timestamp: i64,
312 pub omit_zero_balances: Option<bool>,
314 pub recv_window: Option<i64>
316}
317
318#[derive(Clone, Debug, Default)]
320pub struct GetAggTradesV3Params {
321 pub symbol: String,
322 pub from_id: Option<i64>,
324 pub start_time: Option<i64>,
326 pub end_time: Option<i64>,
328 pub limit: Option<i32>
330}
331
332#[derive(Clone, Debug, Default)]
334pub struct GetAllOrderListV3Params {
335 pub timestamp: i64,
336 pub from_id: Option<i64>,
338 pub start_time: Option<i64>,
339 pub end_time: Option<i64>,
340 pub limit: Option<i32>,
342 pub recv_window: Option<i64>
344}
345
346#[derive(Clone, Debug, Default)]
348pub struct GetAllOrdersV3Params {
349 pub symbol: String,
350 pub timestamp: i64,
351 pub order_id: Option<i64>,
352 pub start_time: Option<i64>,
353 pub end_time: Option<i64>,
354 pub limit: Option<i32>,
356 pub recv_window: Option<i64>
358}
359
360#[derive(Clone, Debug, Default)]
362pub struct GetAvgPriceV3Params {
363 pub symbol: String
364}
365
366#[derive(Clone, Debug, Default)]
368pub struct GetDepthV3Params {
369 pub symbol: String,
370 pub limit: Option<i32>
372}
373
374#[derive(Clone, Debug, Default)]
376pub struct GetExchangeInfoV3Params {
377 pub symbol: Option<String>,
379 pub symbols: Option<Vec<String>>,
381 pub permissions: Option<String>,
383 pub show_permission_sets: Option<bool>,
385 pub symbol_status: Option<String>
387}
388
389#[derive(Clone, Debug, Default)]
391pub struct GetHistoricalTradesV3Params {
392 pub symbol: String,
393 pub limit: Option<i32>,
395 pub from_id: Option<i64>
397}
398
399#[derive(Clone, Debug, Default)]
401pub struct GetKlinesV3Params {
402 pub symbol: String,
403 pub interval: String,
404 pub start_time: Option<i64>,
405 pub end_time: Option<i64>,
406 pub time_zone: Option<String>,
408 pub limit: Option<i32>
410}
411
412#[derive(Clone, Debug, Default)]
414pub struct GetMyAllocationsV3Params {
415 pub symbol: String,
416 pub start_time: Option<i64>,
417 pub end_time: Option<i64>,
418 pub from_allocation_id: Option<i32>,
419 pub limit: Option<i32>,
421 pub order_id: Option<i64>,
422 pub recv_window: Option<i64>,
424 pub timestamp: Option<i64>
425}
426
427#[derive(Clone, Debug, Default)]
429pub struct GetMyPreventedMatchesV3Params {
430 pub symbol: String,
431 pub timestamp: i64,
432 pub prevented_match_id: Option<i64>,
433 pub order_id: Option<i64>,
434 pub from_prevented_match_id: Option<i64>,
435 pub limit: Option<i32>,
437 pub recv_window: Option<i64>
439}
440
441#[derive(Clone, Debug, Default)]
443pub struct GetMyTradesV3Params {
444 pub symbol: String,
445 pub timestamp: i64,
446 pub order_id: Option<i64>,
448 pub start_time: Option<i64>,
449 pub end_time: Option<i64>,
450 pub from_id: Option<i64>,
452 pub limit: Option<i32>,
454 pub recv_window: Option<i64>
456}
457
458#[derive(Clone, Debug, Default)]
460pub struct GetOpenOrderListV3Params {
461 pub timestamp: i64,
462 pub recv_window: Option<i64>
464}
465
466#[derive(Clone, Debug, Default)]
468pub struct GetOpenOrdersV3Params {
469 pub timestamp: i64,
470 pub symbol: Option<String>,
471 pub recv_window: Option<i64>
473}
474
475#[derive(Clone, Debug, Default)]
477pub struct GetOrderListV3Params {
478 pub timestamp: i64,
479 pub order_list_id: Option<i64>,
481 pub orig_client_order_id: Option<String>,
483 pub recv_window: Option<i64>
485}
486
487#[derive(Clone, Debug, Default)]
489pub struct GetOrderV3Params {
490 pub symbol: String,
491 pub timestamp: i64,
492 pub order_id: Option<i64>,
493 pub orig_client_order_id: Option<String>,
494 pub recv_window: Option<i64>
496}
497
498#[derive(Clone, Debug, Default)]
500pub struct GetRateLimitOrderV3Params {
501 pub timestamp: i64,
502 pub recv_window: Option<i64>
504}
505
506#[derive(Clone, Debug, Default)]
508pub struct GetTicker24hrV3Params {
509 pub symbol: Option<String>,
511 pub symbols: Option<String>,
513 pub r#type: Option<String>
515}
516
517#[derive(Clone, Debug, Default)]
519pub struct GetTickerBookTickerV3Params {
520 pub symbol: Option<String>,
522 pub symbols: Option<String>
524}
525
526#[derive(Clone, Debug, Default)]
528pub struct GetTickerPriceV3Params {
529 pub symbol: Option<String>,
531 pub symbols: Option<String>
533}
534
535#[derive(Clone, Debug, Default)]
537pub struct GetTickerTradingDayV3Params {
538 pub symbol: String,
540 pub symbols: String,
542 pub time_zone: Option<String>,
544 pub r#type: Option<String>
546}
547
548#[derive(Clone, Debug, Default)]
550pub struct GetTickerV3Params {
551 pub symbol: String,
553 pub symbols: String,
555 pub window_size: Option<String>,
557 pub r#type: Option<String>
559}
560
561#[derive(Clone, Debug, Default)]
563pub struct GetTradesV3Params {
564 pub symbol: String,
565 pub limit: Option<i32>
567}
568
569#[derive(Clone, Debug, Default)]
571pub struct GetUiKlinesV3Params {
572 pub symbol: String,
573 pub interval: String,
575 pub start_time: Option<i64>,
576 pub end_time: Option<i64>,
577 pub time_zone: Option<String>,
579 pub limit: Option<i32>
581}
582
583#[derive(Clone, Debug, Default)]
585pub struct UpdateUserDataStreamV3Params {
586 pub listen_key: String
587}
588
589
590#[derive(Debug, Clone, Serialize, Deserialize)]
592#[serde(untagged)]
593pub enum CreateOrderCancelReplaceV3Error {
594 Status4XX(models::ApiError),
595 Status5XX(models::ApiError),
596 UnknownValue(serde_json::Value),
597}
598
599#[derive(Debug, Clone, Serialize, Deserialize)]
601#[serde(untagged)]
602pub enum CreateOrderListOcoV3Error {
603 Status4XX(models::ApiError),
604 Status5XX(models::ApiError),
605 UnknownValue(serde_json::Value),
606}
607
608#[derive(Debug, Clone, Serialize, Deserialize)]
610#[serde(untagged)]
611pub enum CreateOrderListOtoV3Error {
612 Status4XX(models::ApiError),
613 Status5XX(models::ApiError),
614 UnknownValue(serde_json::Value),
615}
616
617#[derive(Debug, Clone, Serialize, Deserialize)]
619#[serde(untagged)]
620pub enum CreateOrderListOtocoV3Error {
621 Status4XX(models::ApiError),
622 Status5XX(models::ApiError),
623 UnknownValue(serde_json::Value),
624}
625
626#[derive(Debug, Clone, Serialize, Deserialize)]
628#[serde(untagged)]
629pub enum CreateOrderOcoV3Error {
630 Status4XX(models::ApiError),
631 Status5XX(models::ApiError),
632 UnknownValue(serde_json::Value),
633}
634
635#[derive(Debug, Clone, Serialize, Deserialize)]
637#[serde(untagged)]
638pub enum CreateOrderTestV3Error {
639 Status4XX(models::ApiError),
640 Status5XX(models::ApiError),
641 UnknownValue(serde_json::Value),
642}
643
644#[derive(Debug, Clone, Serialize, Deserialize)]
646#[serde(untagged)]
647pub enum CreateOrderV3Error {
648 Status4XX(models::ApiError),
649 Status5XX(models::ApiError),
650 UnknownValue(serde_json::Value),
651}
652
653#[derive(Debug, Clone, Serialize, Deserialize)]
655#[serde(untagged)]
656pub enum CreateSorOrderTestV3Error {
657 Status4XX(models::ApiError),
658 Status5XX(models::ApiError),
659 UnknownValue(serde_json::Value),
660}
661
662#[derive(Debug, Clone, Serialize, Deserialize)]
664#[serde(untagged)]
665pub enum CreateSorOrderV3Error {
666 Status4XX(models::ApiError),
667 Status5XX(models::ApiError),
668 UnknownValue(serde_json::Value),
669}
670
671#[derive(Debug, Clone, Serialize, Deserialize)]
673#[serde(untagged)]
674pub enum CreateUserDataStreamV3Error {
675 Status4XX(models::ApiError),
676 Status5XX(models::ApiError),
677 UnknownValue(serde_json::Value),
678}
679
680#[derive(Debug, Clone, Serialize, Deserialize)]
682#[serde(untagged)]
683pub enum DeleteOpenOrdersV3Error {
684 Status4XX(models::ApiError),
685 Status5XX(models::ApiError),
686 UnknownValue(serde_json::Value),
687}
688
689#[derive(Debug, Clone, Serialize, Deserialize)]
691#[serde(untagged)]
692pub enum DeleteOrderListV3Error {
693 Status4XX(models::ApiError),
694 Status5XX(models::ApiError),
695 UnknownValue(serde_json::Value),
696}
697
698#[derive(Debug, Clone, Serialize, Deserialize)]
700#[serde(untagged)]
701pub enum DeleteOrderV3Error {
702 Status4XX(models::ApiError),
703 Status5XX(models::ApiError),
704 UnknownValue(serde_json::Value),
705}
706
707#[derive(Debug, Clone, Serialize, Deserialize)]
709#[serde(untagged)]
710pub enum DeleteUserDataStreamV3Error {
711 Status4XX(models::ApiError),
712 Status5XX(models::ApiError),
713 UnknownValue(serde_json::Value),
714}
715
716#[derive(Debug, Clone, Serialize, Deserialize)]
718#[serde(untagged)]
719pub enum GetAccountCommissionV3Error {
720 Status4XX(models::ApiError),
721 Status5XX(models::ApiError),
722 UnknownValue(serde_json::Value),
723}
724
725#[derive(Debug, Clone, Serialize, Deserialize)]
727#[serde(untagged)]
728pub enum GetAccountV3Error {
729 Status4XX(models::ApiError),
730 Status5XX(models::ApiError),
731 UnknownValue(serde_json::Value),
732}
733
734#[derive(Debug, Clone, Serialize, Deserialize)]
736#[serde(untagged)]
737pub enum GetAggTradesV3Error {
738 Status4XX(models::ApiError),
739 Status5XX(models::ApiError),
740 UnknownValue(serde_json::Value),
741}
742
743#[derive(Debug, Clone, Serialize, Deserialize)]
745#[serde(untagged)]
746pub enum GetAllOrderListV3Error {
747 Status4XX(models::ApiError),
748 Status5XX(models::ApiError),
749 UnknownValue(serde_json::Value),
750}
751
752#[derive(Debug, Clone, Serialize, Deserialize)]
754#[serde(untagged)]
755pub enum GetAllOrdersV3Error {
756 Status4XX(models::ApiError),
757 Status5XX(models::ApiError),
758 UnknownValue(serde_json::Value),
759}
760
761#[derive(Debug, Clone, Serialize, Deserialize)]
763#[serde(untagged)]
764pub enum GetAvgPriceV3Error {
765 Status4XX(models::ApiError),
766 Status5XX(models::ApiError),
767 UnknownValue(serde_json::Value),
768}
769
770#[derive(Debug, Clone, Serialize, Deserialize)]
772#[serde(untagged)]
773pub enum GetDepthV3Error {
774 Status4XX(models::ApiError),
775 Status5XX(models::ApiError),
776 UnknownValue(serde_json::Value),
777}
778
779#[derive(Debug, Clone, Serialize, Deserialize)]
781#[serde(untagged)]
782pub enum GetExchangeInfoV3Error {
783 Status4XX(models::ApiError),
784 Status5XX(models::ApiError),
785 UnknownValue(serde_json::Value),
786}
787
788#[derive(Debug, Clone, Serialize, Deserialize)]
790#[serde(untagged)]
791pub enum GetHistoricalTradesV3Error {
792 Status4XX(models::ApiError),
793 Status5XX(models::ApiError),
794 UnknownValue(serde_json::Value),
795}
796
797#[derive(Debug, Clone, Serialize, Deserialize)]
799#[serde(untagged)]
800pub enum GetKlinesV3Error {
801 Status4XX(models::ApiError),
802 Status5XX(models::ApiError),
803 UnknownValue(serde_json::Value),
804}
805
806#[derive(Debug, Clone, Serialize, Deserialize)]
808#[serde(untagged)]
809pub enum GetMyAllocationsV3Error {
810 Status4XX(models::ApiError),
811 Status5XX(models::ApiError),
812 UnknownValue(serde_json::Value),
813}
814
815#[derive(Debug, Clone, Serialize, Deserialize)]
817#[serde(untagged)]
818pub enum GetMyPreventedMatchesV3Error {
819 Status4XX(models::ApiError),
820 Status5XX(models::ApiError),
821 UnknownValue(serde_json::Value),
822}
823
824#[derive(Debug, Clone, Serialize, Deserialize)]
826#[serde(untagged)]
827pub enum GetMyTradesV3Error {
828 Status4XX(models::ApiError),
829 Status5XX(models::ApiError),
830 UnknownValue(serde_json::Value),
831}
832
833#[derive(Debug, Clone, Serialize, Deserialize)]
835#[serde(untagged)]
836pub enum GetOpenOrderListV3Error {
837 Status4XX(models::ApiError),
838 Status5XX(models::ApiError),
839 UnknownValue(serde_json::Value),
840}
841
842#[derive(Debug, Clone, Serialize, Deserialize)]
844#[serde(untagged)]
845pub enum GetOpenOrdersV3Error {
846 Status4XX(models::ApiError),
847 Status5XX(models::ApiError),
848 UnknownValue(serde_json::Value),
849}
850
851#[derive(Debug, Clone, Serialize, Deserialize)]
853#[serde(untagged)]
854pub enum GetOrderListV3Error {
855 Status4XX(models::ApiError),
856 Status5XX(models::ApiError),
857 UnknownValue(serde_json::Value),
858}
859
860#[derive(Debug, Clone, Serialize, Deserialize)]
862#[serde(untagged)]
863pub enum GetOrderV3Error {
864 Status4XX(models::ApiError),
865 Status5XX(models::ApiError),
866 UnknownValue(serde_json::Value),
867}
868
869#[derive(Debug, Clone, Serialize, Deserialize)]
871#[serde(untagged)]
872pub enum GetPingV3Error {
873 Status4XX(models::ApiError),
874 Status5XX(models::ApiError),
875 UnknownValue(serde_json::Value),
876}
877
878#[derive(Debug, Clone, Serialize, Deserialize)]
880#[serde(untagged)]
881pub enum GetRateLimitOrderV3Error {
882 Status4XX(models::ApiError),
883 Status5XX(models::ApiError),
884 UnknownValue(serde_json::Value),
885}
886
887#[derive(Debug, Clone, Serialize, Deserialize)]
889#[serde(untagged)]
890pub enum GetTicker24hrV3Error {
891 Status4XX(models::ApiError),
892 Status5XX(models::ApiError),
893 UnknownValue(serde_json::Value),
894}
895
896#[derive(Debug, Clone, Serialize, Deserialize)]
898#[serde(untagged)]
899pub enum GetTickerBookTickerV3Error {
900 Status4XX(models::ApiError),
901 Status5XX(models::ApiError),
902 UnknownValue(serde_json::Value),
903}
904
905#[derive(Debug, Clone, Serialize, Deserialize)]
907#[serde(untagged)]
908pub enum GetTickerPriceV3Error {
909 Status4XX(models::ApiError),
910 Status5XX(models::ApiError),
911 UnknownValue(serde_json::Value),
912}
913
914#[derive(Debug, Clone, Serialize, Deserialize)]
916#[serde(untagged)]
917pub enum GetTickerTradingDayV3Error {
918 Status4XX(models::ApiError),
919 Status5XX(models::ApiError),
920 UnknownValue(serde_json::Value),
921}
922
923#[derive(Debug, Clone, Serialize, Deserialize)]
925#[serde(untagged)]
926pub enum GetTickerV3Error {
927 Status4XX(models::ApiError),
928 Status5XX(models::ApiError),
929 UnknownValue(serde_json::Value),
930}
931
932#[derive(Debug, Clone, Serialize, Deserialize)]
934#[serde(untagged)]
935pub enum GetTimeV3Error {
936 Status4XX(models::ApiError),
937 Status5XX(models::ApiError),
938 UnknownValue(serde_json::Value),
939}
940
941#[derive(Debug, Clone, Serialize, Deserialize)]
943#[serde(untagged)]
944pub enum GetTradesV3Error {
945 Status4XX(models::ApiError),
946 Status5XX(models::ApiError),
947 UnknownValue(serde_json::Value),
948}
949
950#[derive(Debug, Clone, Serialize, Deserialize)]
952#[serde(untagged)]
953pub enum GetUiKlinesV3Error {
954 Status4XX(models::ApiError),
955 Status5XX(models::ApiError),
956 UnknownValue(serde_json::Value),
957}
958
959#[derive(Debug, Clone, Serialize, Deserialize)]
961#[serde(untagged)]
962pub enum UpdateUserDataStreamV3Error {
963 Status4XX(models::ApiError),
964 Status5XX(models::ApiError),
965 UnknownValue(serde_json::Value),
966}
967
968
969pub async fn create_order_cancel_replace_v3(configuration: &configuration::Configuration, params: CreateOrderCancelReplaceV3Params) -> Result<models::SpotCreateOrderCancelReplaceV3Resp, Error<CreateOrderCancelReplaceV3Error>> {
971
972 let uri_str = format!("{}/api/v3/order/cancelReplace", configuration.base_path);
973 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
974
975 let mut query_params: Vec<(String, String)> = Vec::new();
977
978
979 let mut header_params = std::collections::HashMap::new();
981
982 if let Some(ref binance_auth) = configuration.binance_auth {
984 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
986
987 let body_string: Option<Vec<u8>> = None;
989
990 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
992 Ok(sig) => sig,
993 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
994 };
995
996 query_params.push(("signature".to_string(), signature));
998 }
999
1000 if !query_params.is_empty() {
1002 req_builder = req_builder.query(&query_params);
1003 }
1004
1005
1006 if let Some(ref user_agent) = configuration.user_agent {
1008 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1009 }
1010
1011 for (header_name, header_value) in header_params {
1013 req_builder = req_builder.header(&header_name, &header_value);
1014 }
1015
1016 let mut multipart_form_params = std::collections::HashMap::new();
1017 if let Some(param_value) = params.cancel_new_client_order_id {
1018 multipart_form_params.insert("cancelNewClientOrderId", param_value.to_string());
1019 }
1020 if let Some(param_value) = params.cancel_order_id {
1021 multipart_form_params.insert("cancelOrderId", param_value.to_string());
1022 }
1023 if let Some(param_value) = params.cancel_orig_client_order_id {
1024 multipart_form_params.insert("cancelOrigClientOrderId", param_value.to_string());
1025 }
1026 multipart_form_params.insert("cancelReplaceMode", params.cancel_replace_mode.to_string());
1027 if let Some(param_value) = params.cancel_restrictions {
1028 multipart_form_params.insert("cancelRestrictions", param_value.to_string());
1029 }
1030 if let Some(param_value) = params.iceberg_qty {
1031 multipart_form_params.insert("icebergQty", param_value.to_string());
1032 }
1033 if let Some(param_value) = params.new_client_order_id {
1034 multipart_form_params.insert("newClientOrderId", param_value.to_string());
1035 }
1036 if let Some(param_value) = params.new_order_resp_type {
1037 multipart_form_params.insert("newOrderRespType", param_value.to_string());
1038 }
1039 if let Some(param_value) = params.order_rate_limit_exceeded_mode {
1040 multipart_form_params.insert("orderRateLimitExceededMode", param_value.to_string());
1041 }
1042 if let Some(param_value) = params.price {
1043 multipart_form_params.insert("price", param_value.to_string());
1044 }
1045 if let Some(param_value) = params.quantity {
1046 multipart_form_params.insert("quantity", param_value.to_string());
1047 }
1048 if let Some(param_value) = params.quote_order_qty {
1049 multipart_form_params.insert("quoteOrderQty", param_value.to_string());
1050 }
1051 if let Some(param_value) = params.recv_window {
1052 multipart_form_params.insert("recvWindow", param_value.to_string());
1053 }
1054 if let Some(param_value) = params.self_trade_prevention_mode {
1055 multipart_form_params.insert("selfTradePreventionMode", param_value.to_string());
1056 }
1057 multipart_form_params.insert("side", params.side.to_string());
1058 if let Some(param_value) = params.stop_price {
1059 multipart_form_params.insert("stopPrice", param_value.to_string());
1060 }
1061 if let Some(param_value) = params.strategy_id {
1062 multipart_form_params.insert("strategyId", param_value.to_string());
1063 }
1064 if let Some(param_value) = params.strategy_type {
1065 multipart_form_params.insert("strategyType", param_value.to_string());
1066 }
1067 multipart_form_params.insert("symbol", params.symbol.to_string());
1068 if let Some(param_value) = params.time_in_force {
1069 multipart_form_params.insert("timeInForce", param_value.to_string());
1070 }
1071 multipart_form_params.insert("timestamp", params.timestamp.to_string());
1072 if let Some(param_value) = params.trailing_delta {
1073 multipart_form_params.insert("trailingDelta", param_value.to_string());
1074 }
1075 multipart_form_params.insert("type", params.r#type.to_string());
1076 req_builder = req_builder.form(&multipart_form_params);
1077
1078 let req = req_builder.build()?;
1079 let resp = configuration.client.execute(req).await?;
1080
1081 let status = resp.status();
1082 let content_type = resp
1083 .headers()
1084 .get("content-type")
1085 .and_then(|v| v.to_str().ok())
1086 .unwrap_or("application/octet-stream");
1087 let content_type = super::ContentType::from(content_type);
1088
1089 if !status.is_client_error() && !status.is_server_error() {
1090 let content = resp.text().await?;
1091 match content_type {
1092 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1093 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SpotCreateOrderCancelReplaceV3Resp`"))),
1094 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::SpotCreateOrderCancelReplaceV3Resp`")))),
1095 }
1096 } else {
1097 let content = resp.text().await?;
1098 let entity: Option<CreateOrderCancelReplaceV3Error> = serde_json::from_str(&content).ok();
1099 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1100 }
1101}
1102
1103pub async fn create_order_list_oco_v3(configuration: &configuration::Configuration, params: CreateOrderListOcoV3Params) -> Result<models::CreateOrderListOcoV3Resp, Error<CreateOrderListOcoV3Error>> {
1105
1106 let uri_str = format!("{}/api/v3/orderList/oco", configuration.base_path);
1107 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1108
1109 let mut query_params: Vec<(String, String)> = Vec::new();
1111
1112
1113 let mut header_params = std::collections::HashMap::new();
1115
1116 if let Some(ref binance_auth) = configuration.binance_auth {
1118 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1120
1121 let body_string: Option<Vec<u8>> = None;
1123
1124 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1126 Ok(sig) => sig,
1127 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1128 };
1129
1130 query_params.push(("signature".to_string(), signature));
1132 }
1133
1134 if !query_params.is_empty() {
1136 req_builder = req_builder.query(&query_params);
1137 }
1138
1139
1140 if let Some(ref user_agent) = configuration.user_agent {
1142 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1143 }
1144
1145 for (header_name, header_value) in header_params {
1147 req_builder = req_builder.header(&header_name, &header_value);
1148 }
1149
1150 let mut multipart_form_params = std::collections::HashMap::new();
1151 if let Some(param_value) = params.above_client_order_id {
1152 multipart_form_params.insert("aboveClientOrderId", param_value.to_string());
1153 }
1154 if let Some(param_value) = params.above_iceberg_qty {
1155 multipart_form_params.insert("aboveIcebergQty", param_value.to_string());
1156 }
1157 if let Some(param_value) = params.above_price {
1158 multipart_form_params.insert("abovePrice", param_value.to_string());
1159 }
1160 if let Some(param_value) = params.above_stop_price {
1161 multipart_form_params.insert("aboveStopPrice", param_value.to_string());
1162 }
1163 if let Some(param_value) = params.above_strategy_id {
1164 multipart_form_params.insert("aboveStrategyId", param_value.to_string());
1165 }
1166 if let Some(param_value) = params.above_strategy_type {
1167 multipart_form_params.insert("aboveStrategyType", param_value.to_string());
1168 }
1169 if let Some(param_value) = params.above_time_in_force {
1170 multipart_form_params.insert("aboveTimeInForce", param_value.to_string());
1171 }
1172 if let Some(param_value) = params.above_trailing_delta {
1173 multipart_form_params.insert("aboveTrailingDelta", param_value.to_string());
1174 }
1175 multipart_form_params.insert("aboveType", params.above_type.to_string());
1176 if let Some(param_value) = params.below_client_order_id {
1177 multipart_form_params.insert("belowClientOrderId", param_value.to_string());
1178 }
1179 if let Some(param_value) = params.below_iceberg_qty {
1180 multipart_form_params.insert("belowIcebergQty", param_value.to_string());
1181 }
1182 if let Some(param_value) = params.below_price {
1183 multipart_form_params.insert("belowPrice", param_value.to_string());
1184 }
1185 if let Some(param_value) = params.below_stop_price {
1186 multipart_form_params.insert("belowStopPrice", param_value.to_string());
1187 }
1188 if let Some(param_value) = params.below_strategy_id {
1189 multipart_form_params.insert("belowStrategyId", param_value.to_string());
1190 }
1191 if let Some(param_value) = params.below_strategy_type {
1192 multipart_form_params.insert("belowStrategyType", param_value.to_string());
1193 }
1194 if let Some(param_value) = params.below_time_in_force {
1195 multipart_form_params.insert("belowTimeInForce", param_value.to_string());
1196 }
1197 if let Some(param_value) = params.below_trailing_delta {
1198 multipart_form_params.insert("belowTrailingDelta", param_value.to_string());
1199 }
1200 multipart_form_params.insert("belowType", params.below_type.to_string());
1201 if let Some(param_value) = params.list_client_order_id {
1202 multipart_form_params.insert("listClientOrderId", param_value.to_string());
1203 }
1204 if let Some(param_value) = params.new_order_resp_type {
1205 multipart_form_params.insert("newOrderRespType", param_value.to_string());
1206 }
1207 multipart_form_params.insert("quantity", params.quantity.to_string());
1208 if let Some(param_value) = params.recv_window {
1209 multipart_form_params.insert("recvWindow", param_value.to_string());
1210 }
1211 if let Some(param_value) = params.self_trade_prevention_mode {
1212 multipart_form_params.insert("selfTradePreventionMode", param_value.to_string());
1213 }
1214 multipart_form_params.insert("side", params.side.to_string());
1215 multipart_form_params.insert("symbol", params.symbol.to_string());
1216 multipart_form_params.insert("timestamp", params.timestamp.to_string());
1217 req_builder = req_builder.form(&multipart_form_params);
1218
1219 let req = req_builder.build()?;
1220 let resp = configuration.client.execute(req).await?;
1221
1222 let status = resp.status();
1223 let content_type = resp
1224 .headers()
1225 .get("content-type")
1226 .and_then(|v| v.to_str().ok())
1227 .unwrap_or("application/octet-stream");
1228 let content_type = super::ContentType::from(content_type);
1229
1230 if !status.is_client_error() && !status.is_server_error() {
1231 let content = resp.text().await?;
1232 match content_type {
1233 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1234 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateOrderListOcoV3Resp`"))),
1235 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CreateOrderListOcoV3Resp`")))),
1236 }
1237 } else {
1238 let content = resp.text().await?;
1239 let entity: Option<CreateOrderListOcoV3Error> = serde_json::from_str(&content).ok();
1240 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1241 }
1242}
1243
1244pub async fn create_order_list_oto_v3(configuration: &configuration::Configuration, params: CreateOrderListOtoV3Params) -> Result<models::CreateOrderListOtoV3Resp, Error<CreateOrderListOtoV3Error>> {
1246
1247 let uri_str = format!("{}/api/v3/orderList/oto", configuration.base_path);
1248 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1249
1250 let mut query_params: Vec<(String, String)> = Vec::new();
1252
1253
1254 let mut header_params = std::collections::HashMap::new();
1256
1257 if let Some(ref binance_auth) = configuration.binance_auth {
1259 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1261
1262 let body_string: Option<Vec<u8>> = None;
1264
1265 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1267 Ok(sig) => sig,
1268 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1269 };
1270
1271 query_params.push(("signature".to_string(), signature));
1273 }
1274
1275 if !query_params.is_empty() {
1277 req_builder = req_builder.query(&query_params);
1278 }
1279
1280
1281 if let Some(ref user_agent) = configuration.user_agent {
1283 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1284 }
1285
1286 for (header_name, header_value) in header_params {
1288 req_builder = req_builder.header(&header_name, &header_value);
1289 }
1290
1291 let mut multipart_form_params = std::collections::HashMap::new();
1292 if let Some(param_value) = params.list_client_order_id {
1293 multipart_form_params.insert("listClientOrderId", param_value.to_string());
1294 }
1295 if let Some(param_value) = params.new_order_resp_type {
1296 multipart_form_params.insert("newOrderRespType", param_value.to_string());
1297 }
1298 if let Some(param_value) = params.pending_client_order_id {
1299 multipart_form_params.insert("pendingClientOrderId", param_value.to_string());
1300 }
1301 if let Some(param_value) = params.pending_iceberg_qty {
1302 multipart_form_params.insert("pendingIcebergQty", param_value.to_string());
1303 }
1304 if let Some(param_value) = params.pending_price {
1305 multipart_form_params.insert("pendingPrice", param_value.to_string());
1306 }
1307 multipart_form_params.insert("pendingQuantity", params.pending_quantity.to_string());
1308 multipart_form_params.insert("pendingSide", params.pending_side.to_string());
1309 if let Some(param_value) = params.pending_stop_price {
1310 multipart_form_params.insert("pendingStopPrice", param_value.to_string());
1311 }
1312 if let Some(param_value) = params.pending_strategy_id {
1313 multipart_form_params.insert("pendingStrategyId", param_value.to_string());
1314 }
1315 if let Some(param_value) = params.pending_strategy_type {
1316 multipart_form_params.insert("pendingStrategyType", param_value.to_string());
1317 }
1318 if let Some(param_value) = params.pending_time_in_force {
1319 multipart_form_params.insert("pendingTimeInForce", param_value.to_string());
1320 }
1321 if let Some(param_value) = params.pending_trailing_delta {
1322 multipart_form_params.insert("pendingTrailingDelta", param_value.to_string());
1323 }
1324 multipart_form_params.insert("pendingType", params.pending_type.to_string());
1325 if let Some(param_value) = params.recv_window {
1326 multipart_form_params.insert("recvWindow", param_value.to_string());
1327 }
1328 if let Some(param_value) = params.self_trade_prevention_mode {
1329 multipart_form_params.insert("selfTradePreventionMode", param_value.to_string());
1330 }
1331 multipart_form_params.insert("symbol", params.symbol.to_string());
1332 multipart_form_params.insert("timestamp", params.timestamp.to_string());
1333 if let Some(param_value) = params.working_client_order_id {
1334 multipart_form_params.insert("workingClientOrderId", param_value.to_string());
1335 }
1336 if let Some(param_value) = params.working_iceberg_qty {
1337 multipart_form_params.insert("workingIcebergQty", param_value.to_string());
1338 }
1339 multipart_form_params.insert("workingPrice", params.working_price.to_string());
1340 multipart_form_params.insert("workingQuantity", params.working_quantity.to_string());
1341 multipart_form_params.insert("workingSide", params.working_side.to_string());
1342 if let Some(param_value) = params.working_strategy_id {
1343 multipart_form_params.insert("workingStrategyId", param_value.to_string());
1344 }
1345 if let Some(param_value) = params.working_strategy_type {
1346 multipart_form_params.insert("workingStrategyType", param_value.to_string());
1347 }
1348 if let Some(param_value) = params.working_time_in_force {
1349 multipart_form_params.insert("workingTimeInForce", param_value.to_string());
1350 }
1351 multipart_form_params.insert("workingType", params.working_type.to_string());
1352 req_builder = req_builder.form(&multipart_form_params);
1353
1354 let req = req_builder.build()?;
1355 let resp = configuration.client.execute(req).await?;
1356
1357 let status = resp.status();
1358 let content_type = resp
1359 .headers()
1360 .get("content-type")
1361 .and_then(|v| v.to_str().ok())
1362 .unwrap_or("application/octet-stream");
1363 let content_type = super::ContentType::from(content_type);
1364
1365 if !status.is_client_error() && !status.is_server_error() {
1366 let content = resp.text().await?;
1367 match content_type {
1368 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1369 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateOrderListOtoV3Resp`"))),
1370 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CreateOrderListOtoV3Resp`")))),
1371 }
1372 } else {
1373 let content = resp.text().await?;
1374 let entity: Option<CreateOrderListOtoV3Error> = serde_json::from_str(&content).ok();
1375 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1376 }
1377}
1378
1379pub async fn create_order_list_otoco_v3(configuration: &configuration::Configuration, params: CreateOrderListOtocoV3Params) -> Result<models::CreateOrderListOtocoV3Resp, Error<CreateOrderListOtocoV3Error>> {
1381
1382 let uri_str = format!("{}/api/v3/orderList/otoco", configuration.base_path);
1383 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1384
1385 let mut query_params: Vec<(String, String)> = Vec::new();
1387
1388
1389 let mut header_params = std::collections::HashMap::new();
1391
1392 if let Some(ref binance_auth) = configuration.binance_auth {
1394 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1396
1397 let body_string: Option<Vec<u8>> = None;
1399
1400 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1402 Ok(sig) => sig,
1403 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1404 };
1405
1406 query_params.push(("signature".to_string(), signature));
1408 }
1409
1410 if !query_params.is_empty() {
1412 req_builder = req_builder.query(&query_params);
1413 }
1414
1415
1416 if let Some(ref user_agent) = configuration.user_agent {
1418 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1419 }
1420
1421 for (header_name, header_value) in header_params {
1423 req_builder = req_builder.header(&header_name, &header_value);
1424 }
1425
1426 let mut multipart_form_params = std::collections::HashMap::new();
1427 if let Some(param_value) = params.list_client_order_id {
1428 multipart_form_params.insert("listClientOrderId", param_value.to_string());
1429 }
1430 if let Some(param_value) = params.new_order_resp_type {
1431 multipart_form_params.insert("newOrderRespType", param_value.to_string());
1432 }
1433 if let Some(param_value) = params.pending_above_client_order_id {
1434 multipart_form_params.insert("pendingAboveClientOrderId", param_value.to_string());
1435 }
1436 if let Some(param_value) = params.pending_above_iceberg_qty {
1437 multipart_form_params.insert("pendingAboveIcebergQty", param_value.to_string());
1438 }
1439 if let Some(param_value) = params.pending_above_price {
1440 multipart_form_params.insert("pendingAbovePrice", param_value.to_string());
1441 }
1442 if let Some(param_value) = params.pending_above_stop_price {
1443 multipart_form_params.insert("pendingAboveStopPrice", param_value.to_string());
1444 }
1445 if let Some(param_value) = params.pending_above_strategy_id {
1446 multipart_form_params.insert("pendingAboveStrategyId", param_value.to_string());
1447 }
1448 if let Some(param_value) = params.pending_above_strategy_type {
1449 multipart_form_params.insert("pendingAboveStrategyType", param_value.to_string());
1450 }
1451 if let Some(param_value) = params.pending_above_time_in_force {
1452 multipart_form_params.insert("pendingAboveTimeInForce", param_value.to_string());
1453 }
1454 if let Some(param_value) = params.pending_above_trailing_delta {
1455 multipart_form_params.insert("pendingAboveTrailingDelta", param_value.to_string());
1456 }
1457 multipart_form_params.insert("pendingAboveType", params.pending_above_type.to_string());
1458 if let Some(param_value) = params.pending_below_client_order_id {
1459 multipart_form_params.insert("pendingBelowClientOrderId", param_value.to_string());
1460 }
1461 if let Some(param_value) = params.pending_below_iceberg_qty {
1462 multipart_form_params.insert("pendingBelowIcebergQty", param_value.to_string());
1463 }
1464 if let Some(param_value) = params.pending_below_price {
1465 multipart_form_params.insert("pendingBelowPrice", param_value.to_string());
1466 }
1467 if let Some(param_value) = params.pending_below_stop_price {
1468 multipart_form_params.insert("pendingBelowStopPrice", param_value.to_string());
1469 }
1470 if let Some(param_value) = params.pending_below_strategy_id {
1471 multipart_form_params.insert("pendingBelowStrategyId", param_value.to_string());
1472 }
1473 if let Some(param_value) = params.pending_below_strategy_type {
1474 multipart_form_params.insert("pendingBelowStrategyType", param_value.to_string());
1475 }
1476 if let Some(param_value) = params.pending_below_time_in_force {
1477 multipart_form_params.insert("pendingBelowTimeInForce", param_value.to_string());
1478 }
1479 if let Some(param_value) = params.pending_below_trailing_delta {
1480 multipart_form_params.insert("pendingBelowTrailingDelta", param_value.to_string());
1481 }
1482 if let Some(param_value) = params.pending_below_type {
1483 multipart_form_params.insert("pendingBelowType", param_value.to_string());
1484 }
1485 multipart_form_params.insert("pendingQuantity", params.pending_quantity.to_string());
1486 multipart_form_params.insert("pendingSide", params.pending_side.to_string());
1487 if let Some(param_value) = params.recv_window {
1488 multipart_form_params.insert("recvWindow", param_value.to_string());
1489 }
1490 if let Some(param_value) = params.self_trade_prevention_mode {
1491 multipart_form_params.insert("selfTradePreventionMode", param_value.to_string());
1492 }
1493 multipart_form_params.insert("symbol", params.symbol.to_string());
1494 multipart_form_params.insert("timestamp", params.timestamp.to_string());
1495 if let Some(param_value) = params.working_client_order_id {
1496 multipart_form_params.insert("workingClientOrderId", param_value.to_string());
1497 }
1498 if let Some(param_value) = params.working_iceberg_qty {
1499 multipart_form_params.insert("workingIcebergQty", param_value.to_string());
1500 }
1501 multipart_form_params.insert("workingPrice", params.working_price.to_string());
1502 multipart_form_params.insert("workingQuantity", params.working_quantity.to_string());
1503 multipart_form_params.insert("workingSide", params.working_side.to_string());
1504 if let Some(param_value) = params.working_strategy_id {
1505 multipart_form_params.insert("workingStrategyId", param_value.to_string());
1506 }
1507 if let Some(param_value) = params.working_strategy_type {
1508 multipart_form_params.insert("workingStrategyType", param_value.to_string());
1509 }
1510 if let Some(param_value) = params.working_time_in_force {
1511 multipart_form_params.insert("workingTimeInForce", param_value.to_string());
1512 }
1513 multipart_form_params.insert("workingType", params.working_type.to_string());
1514 req_builder = req_builder.form(&multipart_form_params);
1515
1516 let req = req_builder.build()?;
1517 let resp = configuration.client.execute(req).await?;
1518
1519 let status = resp.status();
1520 let content_type = resp
1521 .headers()
1522 .get("content-type")
1523 .and_then(|v| v.to_str().ok())
1524 .unwrap_or("application/octet-stream");
1525 let content_type = super::ContentType::from(content_type);
1526
1527 if !status.is_client_error() && !status.is_server_error() {
1528 let content = resp.text().await?;
1529 match content_type {
1530 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1531 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateOrderListOtocoV3Resp`"))),
1532 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CreateOrderListOtocoV3Resp`")))),
1533 }
1534 } else {
1535 let content = resp.text().await?;
1536 let entity: Option<CreateOrderListOtocoV3Error> = serde_json::from_str(&content).ok();
1537 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1538 }
1539}
1540
1541pub async fn create_order_oco_v3(configuration: &configuration::Configuration, params: CreateOrderOcoV3Params) -> Result<models::CreateOrderOcoV3Resp, Error<CreateOrderOcoV3Error>> {
1543
1544 let uri_str = format!("{}/api/v3/order/oco", configuration.base_path);
1545 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1546
1547 let mut query_params: Vec<(String, String)> = Vec::new();
1549
1550
1551 let mut header_params = std::collections::HashMap::new();
1553
1554 if let Some(ref binance_auth) = configuration.binance_auth {
1556 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1558
1559 let body_string: Option<Vec<u8>> = None;
1561
1562 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1564 Ok(sig) => sig,
1565 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1566 };
1567
1568 query_params.push(("signature".to_string(), signature));
1570 }
1571
1572 if !query_params.is_empty() {
1574 req_builder = req_builder.query(&query_params);
1575 }
1576
1577
1578 if let Some(ref user_agent) = configuration.user_agent {
1580 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1581 }
1582
1583 for (header_name, header_value) in header_params {
1585 req_builder = req_builder.header(&header_name, &header_value);
1586 }
1587
1588 let mut multipart_form_params = std::collections::HashMap::new();
1589 if let Some(param_value) = params.limit_client_order_id {
1590 multipart_form_params.insert("limitClientOrderId", param_value.to_string());
1591 }
1592 if let Some(param_value) = params.limit_iceberg_qty {
1593 multipart_form_params.insert("limitIcebergQty", param_value.to_string());
1594 }
1595 if let Some(param_value) = params.limit_strategy_id {
1596 multipart_form_params.insert("limitStrategyId", param_value.to_string());
1597 }
1598 if let Some(param_value) = params.limit_strategy_type {
1599 multipart_form_params.insert("limitStrategyType", param_value.to_string());
1600 }
1601 if let Some(param_value) = params.list_client_order_id {
1602 multipart_form_params.insert("listClientOrderId", param_value.to_string());
1603 }
1604 if let Some(param_value) = params.new_order_resp_type {
1605 multipart_form_params.insert("newOrderRespType", param_value.to_string());
1606 }
1607 multipart_form_params.insert("price", params.price.to_string());
1608 multipart_form_params.insert("quantity", params.quantity.to_string());
1609 if let Some(param_value) = params.recv_window {
1610 multipart_form_params.insert("recvWindow", param_value.to_string());
1611 }
1612 if let Some(param_value) = params.self_trade_prevention_mode {
1613 multipart_form_params.insert("selfTradePreventionMode", param_value.to_string());
1614 }
1615 multipart_form_params.insert("side", params.side.to_string());
1616 if let Some(param_value) = params.stop_client_order_id {
1617 multipart_form_params.insert("stopClientOrderId", param_value.to_string());
1618 }
1619 if let Some(param_value) = params.stop_iceberg_qty {
1620 multipart_form_params.insert("stopIcebergQty", param_value.to_string());
1621 }
1622 if let Some(param_value) = params.stop_limit_price {
1623 multipart_form_params.insert("stopLimitPrice", param_value.to_string());
1624 }
1625 if let Some(param_value) = params.stop_limit_time_in_force {
1626 multipart_form_params.insert("stopLimitTimeInForce", param_value.to_string());
1627 }
1628 multipart_form_params.insert("stopPrice", params.stop_price.to_string());
1629 if let Some(param_value) = params.stop_strategy_id {
1630 multipart_form_params.insert("stopStrategyId", param_value.to_string());
1631 }
1632 if let Some(param_value) = params.stop_strategy_type {
1633 multipart_form_params.insert("stopStrategyType", param_value.to_string());
1634 }
1635 multipart_form_params.insert("symbol", params.symbol.to_string());
1636 multipart_form_params.insert("timestamp", params.timestamp.to_string());
1637 if let Some(param_value) = params.trailing_delta {
1638 multipart_form_params.insert("trailingDelta", param_value.to_string());
1639 }
1640 req_builder = req_builder.form(&multipart_form_params);
1641
1642 let req = req_builder.build()?;
1643 let resp = configuration.client.execute(req).await?;
1644
1645 let status = resp.status();
1646 let content_type = resp
1647 .headers()
1648 .get("content-type")
1649 .and_then(|v| v.to_str().ok())
1650 .unwrap_or("application/octet-stream");
1651 let content_type = super::ContentType::from(content_type);
1652
1653 if !status.is_client_error() && !status.is_server_error() {
1654 let content = resp.text().await?;
1655 match content_type {
1656 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1657 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateOrderOcoV3Resp`"))),
1658 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CreateOrderOcoV3Resp`")))),
1659 }
1660 } else {
1661 let content = resp.text().await?;
1662 let entity: Option<CreateOrderOcoV3Error> = serde_json::from_str(&content).ok();
1663 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1664 }
1665}
1666
1667pub async fn create_order_test_v3(configuration: &configuration::Configuration, params: CreateOrderTestV3Params) -> Result<models::SpotCreateOrderTestV3Resp, Error<CreateOrderTestV3Error>> {
1669
1670 let uri_str = format!("{}/api/v3/order/test", configuration.base_path);
1671 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1672
1673 let mut query_params: Vec<(String, String)> = Vec::new();
1675
1676
1677 let mut header_params = std::collections::HashMap::new();
1679
1680 if let Some(ref binance_auth) = configuration.binance_auth {
1682 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1684
1685 let body_string: Option<Vec<u8>> = None;
1687
1688 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1690 Ok(sig) => sig,
1691 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1692 };
1693
1694 query_params.push(("signature".to_string(), signature));
1696 }
1697
1698 if !query_params.is_empty() {
1700 req_builder = req_builder.query(&query_params);
1701 }
1702
1703
1704 if let Some(ref user_agent) = configuration.user_agent {
1706 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1707 }
1708
1709 for (header_name, header_value) in header_params {
1711 req_builder = req_builder.header(&header_name, &header_value);
1712 }
1713
1714 let mut multipart_form_params = std::collections::HashMap::new();
1715 if let Some(param_value) = params.compute_commission_rates {
1716 multipart_form_params.insert("computeCommissionRates", param_value.to_string());
1717 }
1718 if let Some(param_value) = params.iceberg_qty {
1719 multipart_form_params.insert("icebergQty", param_value.to_string());
1720 }
1721 if let Some(param_value) = params.new_client_order_id {
1722 multipart_form_params.insert("newClientOrderId", param_value.to_string());
1723 }
1724 if let Some(param_value) = params.new_order_resp_type {
1725 multipart_form_params.insert("newOrderRespType", param_value.to_string());
1726 }
1727 if let Some(param_value) = params.price {
1728 multipart_form_params.insert("price", param_value.to_string());
1729 }
1730 if let Some(param_value) = params.quantity {
1731 multipart_form_params.insert("quantity", param_value.to_string());
1732 }
1733 if let Some(param_value) = params.quote_order_qty {
1734 multipart_form_params.insert("quoteOrderQty", param_value.to_string());
1735 }
1736 if let Some(param_value) = params.recv_window {
1737 multipart_form_params.insert("recvWindow", param_value.to_string());
1738 }
1739 if let Some(param_value) = params.self_trade_prevention_mode {
1740 multipart_form_params.insert("selfTradePreventionMode", param_value.to_string());
1741 }
1742 multipart_form_params.insert("side", params.side.to_string());
1743 if let Some(param_value) = params.stop_price {
1744 multipart_form_params.insert("stopPrice", param_value.to_string());
1745 }
1746 if let Some(param_value) = params.strategy_id {
1747 multipart_form_params.insert("strategyId", param_value.to_string());
1748 }
1749 if let Some(param_value) = params.strategy_type {
1750 multipart_form_params.insert("strategyType", param_value.to_string());
1751 }
1752 multipart_form_params.insert("symbol", params.symbol.to_string());
1753 if let Some(param_value) = params.time_in_force {
1754 multipart_form_params.insert("timeInForce", param_value.to_string());
1755 }
1756 multipart_form_params.insert("timestamp", params.timestamp.to_string());
1757 if let Some(param_value) = params.trailing_delta {
1758 multipart_form_params.insert("trailingDelta", param_value.to_string());
1759 }
1760 multipart_form_params.insert("type", params.r#type.to_string());
1761 req_builder = req_builder.form(&multipart_form_params);
1762
1763 let req = req_builder.build()?;
1764 let resp = configuration.client.execute(req).await?;
1765
1766 let status = resp.status();
1767 let content_type = resp
1768 .headers()
1769 .get("content-type")
1770 .and_then(|v| v.to_str().ok())
1771 .unwrap_or("application/octet-stream");
1772 let content_type = super::ContentType::from(content_type);
1773
1774 if !status.is_client_error() && !status.is_server_error() {
1775 let content = resp.text().await?;
1776 match content_type {
1777 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1778 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SpotCreateOrderTestV3Resp`"))),
1779 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::SpotCreateOrderTestV3Resp`")))),
1780 }
1781 } else {
1782 let content = resp.text().await?;
1783 let entity: Option<CreateOrderTestV3Error> = serde_json::from_str(&content).ok();
1784 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1785 }
1786}
1787
1788pub async fn create_order_v3(configuration: &configuration::Configuration, params: CreateOrderV3Params) -> Result<models::SpotCreateOrderV3Resp, Error<CreateOrderV3Error>> {
1790
1791 let uri_str = format!("{}/api/v3/order", configuration.base_path);
1792 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1793
1794 let mut query_params: Vec<(String, String)> = Vec::new();
1796
1797
1798 let mut header_params = std::collections::HashMap::new();
1800
1801 if let Some(ref binance_auth) = configuration.binance_auth {
1803 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1805
1806 let body_string: Option<Vec<u8>> = None;
1808
1809 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1811 Ok(sig) => sig,
1812 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1813 };
1814
1815 query_params.push(("signature".to_string(), signature));
1817 }
1818
1819 if !query_params.is_empty() {
1821 req_builder = req_builder.query(&query_params);
1822 }
1823
1824
1825 if let Some(ref user_agent) = configuration.user_agent {
1827 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1828 }
1829
1830 for (header_name, header_value) in header_params {
1832 req_builder = req_builder.header(&header_name, &header_value);
1833 }
1834
1835 let mut multipart_form_params = std::collections::HashMap::new();
1836 if let Some(param_value) = params.iceberg_qty {
1837 multipart_form_params.insert("icebergQty", param_value.to_string());
1838 }
1839 if let Some(param_value) = params.new_client_order_id {
1840 multipart_form_params.insert("newClientOrderId", param_value.to_string());
1841 }
1842 if let Some(param_value) = params.new_order_resp_type {
1843 multipart_form_params.insert("newOrderRespType", param_value.to_string());
1844 }
1845 if let Some(param_value) = params.price {
1846 multipart_form_params.insert("price", param_value.to_string());
1847 }
1848 if let Some(param_value) = params.quantity {
1849 multipart_form_params.insert("quantity", param_value.to_string());
1850 }
1851 if let Some(param_value) = params.quote_order_qty {
1852 multipart_form_params.insert("quoteOrderQty", param_value.to_string());
1853 }
1854 if let Some(param_value) = params.recv_window {
1855 multipart_form_params.insert("recvWindow", param_value.to_string());
1856 }
1857 if let Some(param_value) = params.self_trade_prevention_mode {
1858 multipart_form_params.insert("selfTradePreventionMode", param_value.to_string());
1859 }
1860 multipart_form_params.insert("side", params.side.to_string());
1861 if let Some(param_value) = params.stop_price {
1862 multipart_form_params.insert("stopPrice", param_value.to_string());
1863 }
1864 if let Some(param_value) = params.strategy_id {
1865 multipart_form_params.insert("strategyId", param_value.to_string());
1866 }
1867 if let Some(param_value) = params.strategy_type {
1868 multipart_form_params.insert("strategyType", param_value.to_string());
1869 }
1870 multipart_form_params.insert("symbol", params.symbol.to_string());
1871 if let Some(param_value) = params.time_in_force {
1872 multipart_form_params.insert("timeInForce", param_value.to_string());
1873 }
1874 multipart_form_params.insert("timestamp", params.timestamp.to_string());
1875 if let Some(param_value) = params.trailing_delta {
1876 multipart_form_params.insert("trailingDelta", param_value.to_string());
1877 }
1878 multipart_form_params.insert("type", params.r#type.to_string());
1879 req_builder = req_builder.form(&multipart_form_params);
1880
1881 let req = req_builder.build()?;
1882 let resp = configuration.client.execute(req).await?;
1883
1884 let status = resp.status();
1885 let content_type = resp
1886 .headers()
1887 .get("content-type")
1888 .and_then(|v| v.to_str().ok())
1889 .unwrap_or("application/octet-stream");
1890 let content_type = super::ContentType::from(content_type);
1891
1892 if !status.is_client_error() && !status.is_server_error() {
1893 let content = resp.text().await?;
1894 match content_type {
1895 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1896 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SpotCreateOrderV3Resp`"))),
1897 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::SpotCreateOrderV3Resp`")))),
1898 }
1899 } else {
1900 let content = resp.text().await?;
1901 let entity: Option<CreateOrderV3Error> = serde_json::from_str(&content).ok();
1902 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1903 }
1904}
1905
1906pub async fn create_sor_order_test_v3(configuration: &configuration::Configuration, params: CreateSorOrderTestV3Params) -> Result<models::SpotCreateSorOrderTestV3Resp, Error<CreateSorOrderTestV3Error>> {
1908
1909 let uri_str = format!("{}/api/v3/sor/order/test", configuration.base_path);
1910 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1911
1912 let mut query_params: Vec<(String, String)> = Vec::new();
1914
1915
1916 let mut header_params = std::collections::HashMap::new();
1918
1919 if let Some(ref binance_auth) = configuration.binance_auth {
1921 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
1923
1924 let body_string: Option<Vec<u8>> = None;
1926
1927 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
1929 Ok(sig) => sig,
1930 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
1931 };
1932
1933 query_params.push(("signature".to_string(), signature));
1935 }
1936
1937 if !query_params.is_empty() {
1939 req_builder = req_builder.query(&query_params);
1940 }
1941
1942
1943 if let Some(ref user_agent) = configuration.user_agent {
1945 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1946 }
1947
1948 for (header_name, header_value) in header_params {
1950 req_builder = req_builder.header(&header_name, &header_value);
1951 }
1952
1953 let mut multipart_form_params = std::collections::HashMap::new();
1954 if let Some(param_value) = params.compute_commission_rates {
1955 multipart_form_params.insert("computeCommissionRates", param_value.to_string());
1956 }
1957 if let Some(param_value) = params.iceberg_qty {
1958 multipart_form_params.insert("icebergQty", param_value.to_string());
1959 }
1960 if let Some(param_value) = params.new_client_order_id {
1961 multipart_form_params.insert("newClientOrderId", param_value.to_string());
1962 }
1963 if let Some(param_value) = params.new_order_resp_type {
1964 multipart_form_params.insert("newOrderRespType", param_value.to_string());
1965 }
1966 if let Some(param_value) = params.price {
1967 multipart_form_params.insert("price", param_value.to_string());
1968 }
1969 multipart_form_params.insert("quantity", params.quantity.to_string());
1970 if let Some(param_value) = params.recv_window {
1971 multipart_form_params.insert("recvWindow", param_value.to_string());
1972 }
1973 if let Some(param_value) = params.self_trade_prevention_mode {
1974 multipart_form_params.insert("selfTradePreventionMode", param_value.to_string());
1975 }
1976 multipart_form_params.insert("side", params.side.to_string());
1977 if let Some(param_value) = params.strategy_id {
1978 multipart_form_params.insert("strategyId", param_value.to_string());
1979 }
1980 if let Some(param_value) = params.strategy_type {
1981 multipart_form_params.insert("strategyType", param_value.to_string());
1982 }
1983 multipart_form_params.insert("symbol", params.symbol.to_string());
1984 if let Some(param_value) = params.time_in_force {
1985 multipart_form_params.insert("timeInForce", param_value.to_string());
1986 }
1987 multipart_form_params.insert("timestamp", params.timestamp.to_string());
1988 multipart_form_params.insert("type", params.r#type.to_string());
1989 req_builder = req_builder.form(&multipart_form_params);
1990
1991 let req = req_builder.build()?;
1992 let resp = configuration.client.execute(req).await?;
1993
1994 let status = resp.status();
1995 let content_type = resp
1996 .headers()
1997 .get("content-type")
1998 .and_then(|v| v.to_str().ok())
1999 .unwrap_or("application/octet-stream");
2000 let content_type = super::ContentType::from(content_type);
2001
2002 if !status.is_client_error() && !status.is_server_error() {
2003 let content = resp.text().await?;
2004 match content_type {
2005 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2006 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SpotCreateSorOrderTestV3Resp`"))),
2007 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::SpotCreateSorOrderTestV3Resp`")))),
2008 }
2009 } else {
2010 let content = resp.text().await?;
2011 let entity: Option<CreateSorOrderTestV3Error> = serde_json::from_str(&content).ok();
2012 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2013 }
2014}
2015
2016pub async fn create_sor_order_v3(configuration: &configuration::Configuration, params: CreateSorOrderV3Params) -> Result<models::CreateSorOrderV3Resp, Error<CreateSorOrderV3Error>> {
2018
2019 let uri_str = format!("{}/api/v3/sor/order", configuration.base_path);
2020 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2021
2022 let mut query_params: Vec<(String, String)> = Vec::new();
2024
2025
2026 let mut header_params = std::collections::HashMap::new();
2028
2029 if let Some(ref binance_auth) = configuration.binance_auth {
2031 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2033
2034 let body_string: Option<Vec<u8>> = None;
2036
2037 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2039 Ok(sig) => sig,
2040 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2041 };
2042
2043 query_params.push(("signature".to_string(), signature));
2045 }
2046
2047 if !query_params.is_empty() {
2049 req_builder = req_builder.query(&query_params);
2050 }
2051
2052
2053 if let Some(ref user_agent) = configuration.user_agent {
2055 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2056 }
2057
2058 for (header_name, header_value) in header_params {
2060 req_builder = req_builder.header(&header_name, &header_value);
2061 }
2062
2063 let mut multipart_form_params = std::collections::HashMap::new();
2064 if let Some(param_value) = params.iceberg_qty {
2065 multipart_form_params.insert("icebergQty", param_value.to_string());
2066 }
2067 if let Some(param_value) = params.new_client_order_id {
2068 multipart_form_params.insert("newClientOrderId", param_value.to_string());
2069 }
2070 if let Some(param_value) = params.new_order_resp_type {
2071 multipart_form_params.insert("newOrderRespType", param_value.to_string());
2072 }
2073 if let Some(param_value) = params.price {
2074 multipart_form_params.insert("price", param_value.to_string());
2075 }
2076 multipart_form_params.insert("quantity", params.quantity.to_string());
2077 if let Some(param_value) = params.recv_window {
2078 multipart_form_params.insert("recvWindow", param_value.to_string());
2079 }
2080 if let Some(param_value) = params.self_trade_prevention_mode {
2081 multipart_form_params.insert("selfTradePreventionMode", param_value.to_string());
2082 }
2083 multipart_form_params.insert("side", params.side.to_string());
2084 if let Some(param_value) = params.strategy_id {
2085 multipart_form_params.insert("strategyId", param_value.to_string());
2086 }
2087 if let Some(param_value) = params.strategy_type {
2088 multipart_form_params.insert("strategyType", param_value.to_string());
2089 }
2090 multipart_form_params.insert("symbol", params.symbol.to_string());
2091 if let Some(param_value) = params.time_in_force {
2092 multipart_form_params.insert("timeInForce", param_value.to_string());
2093 }
2094 multipart_form_params.insert("timestamp", params.timestamp.to_string());
2095 multipart_form_params.insert("type", params.r#type.to_string());
2096 req_builder = req_builder.form(&multipart_form_params);
2097
2098 let req = req_builder.build()?;
2099 let resp = configuration.client.execute(req).await?;
2100
2101 let status = resp.status();
2102 let content_type = resp
2103 .headers()
2104 .get("content-type")
2105 .and_then(|v| v.to_str().ok())
2106 .unwrap_or("application/octet-stream");
2107 let content_type = super::ContentType::from(content_type);
2108
2109 if !status.is_client_error() && !status.is_server_error() {
2110 let content = resp.text().await?;
2111 match content_type {
2112 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2113 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateSorOrderV3Resp`"))),
2114 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CreateSorOrderV3Resp`")))),
2115 }
2116 } else {
2117 let content = resp.text().await?;
2118 let entity: Option<CreateSorOrderV3Error> = serde_json::from_str(&content).ok();
2119 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2120 }
2121}
2122
2123pub async fn create_user_data_stream_v3(configuration: &configuration::Configuration) -> Result<models::CreateUserDataStreamV3Resp, Error<CreateUserDataStreamV3Error>> {
2125
2126 let uri_str = format!("{}/api/v3/userDataStream", configuration.base_path);
2127 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2128
2129 let mut query_params: Vec<(String, String)> = Vec::new();
2131
2132
2133 let mut header_params = std::collections::HashMap::new();
2135
2136 if let Some(ref binance_auth) = configuration.binance_auth {
2138 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2140
2141 let body_string: Option<Vec<u8>> = None;
2143
2144 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2146 Ok(sig) => sig,
2147 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2148 };
2149
2150 query_params.push(("signature".to_string(), signature));
2152 }
2153
2154 if !query_params.is_empty() {
2156 req_builder = req_builder.query(&query_params);
2157 }
2158
2159
2160 if let Some(ref user_agent) = configuration.user_agent {
2162 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2163 }
2164
2165 for (header_name, header_value) in header_params {
2167 req_builder = req_builder.header(&header_name, &header_value);
2168 }
2169
2170
2171 let req = req_builder.build()?;
2172 let resp = configuration.client.execute(req).await?;
2173
2174 let status = resp.status();
2175 let content_type = resp
2176 .headers()
2177 .get("content-type")
2178 .and_then(|v| v.to_str().ok())
2179 .unwrap_or("application/octet-stream");
2180 let content_type = super::ContentType::from(content_type);
2181
2182 if !status.is_client_error() && !status.is_server_error() {
2183 let content = resp.text().await?;
2184 match content_type {
2185 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2186 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CreateUserDataStreamV3Resp`"))),
2187 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CreateUserDataStreamV3Resp`")))),
2188 }
2189 } else {
2190 let content = resp.text().await?;
2191 let entity: Option<CreateUserDataStreamV3Error> = serde_json::from_str(&content).ok();
2192 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2193 }
2194}
2195
2196pub async fn delete_open_orders_v3(configuration: &configuration::Configuration, params: DeleteOpenOrdersV3Params) -> Result<Vec<Vec<models::SpotDeleteOpenOrdersV3RespInner>>, Error<DeleteOpenOrdersV3Error>> {
2198
2199 let uri_str = format!("{}/api/v3/openOrders", configuration.base_path);
2200 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
2201
2202 let mut query_params: Vec<(String, String)> = Vec::new();
2204
2205 query_params.push(("symbol".to_string(), params.symbol.to_string()));
2206 if let Some(ref param_value) = params.recv_window {
2207 query_params.push(("recvWindow".to_string(), param_value.to_string()));
2208 }
2209 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
2210
2211 let mut header_params = std::collections::HashMap::new();
2213
2214 if let Some(ref binance_auth) = configuration.binance_auth {
2216 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2218
2219 let body_string: Option<Vec<u8>> = None;
2221
2222 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2224 Ok(sig) => sig,
2225 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2226 };
2227
2228 query_params.push(("signature".to_string(), signature));
2230 }
2231
2232 if !query_params.is_empty() {
2234 req_builder = req_builder.query(&query_params);
2235 }
2236
2237
2238 if let Some(ref user_agent) = configuration.user_agent {
2240 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2241 }
2242
2243 for (header_name, header_value) in header_params {
2245 req_builder = req_builder.header(&header_name, &header_value);
2246 }
2247
2248
2249 let req = req_builder.build()?;
2250 let resp = configuration.client.execute(req).await?;
2251
2252 let status = resp.status();
2253 let content_type = resp
2254 .headers()
2255 .get("content-type")
2256 .and_then(|v| v.to_str().ok())
2257 .unwrap_or("application/octet-stream");
2258 let content_type = super::ContentType::from(content_type);
2259
2260 if !status.is_client_error() && !status.is_server_error() {
2261 let content = resp.text().await?;
2262 match content_type {
2263 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2264 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<Vec<models::SpotDeleteOpenOrdersV3RespInner>>`"))),
2265 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<Vec<models::SpotDeleteOpenOrdersV3RespInner>>`")))),
2266 }
2267 } else {
2268 let content = resp.text().await?;
2269 let entity: Option<DeleteOpenOrdersV3Error> = serde_json::from_str(&content).ok();
2270 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2271 }
2272}
2273
2274pub async fn delete_order_list_v3(configuration: &configuration::Configuration, params: DeleteOrderListV3Params) -> Result<models::DeleteOrderListV3Resp, Error<DeleteOrderListV3Error>> {
2276
2277 let uri_str = format!("{}/api/v3/orderList", configuration.base_path);
2278 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
2279
2280 let mut query_params: Vec<(String, String)> = Vec::new();
2282
2283 query_params.push(("symbol".to_string(), params.symbol.to_string()));
2284 if let Some(ref param_value) = params.order_list_id {
2285 query_params.push(("orderListId".to_string(), param_value.to_string()));
2286 }
2287 if let Some(ref param_value) = params.list_client_order_id {
2288 query_params.push(("listClientOrderId".to_string(), param_value.to_string()));
2289 }
2290 if let Some(ref param_value) = params.new_client_order_id {
2291 query_params.push(("newClientOrderId".to_string(), param_value.to_string()));
2292 }
2293 if let Some(ref param_value) = params.recv_window {
2294 query_params.push(("recvWindow".to_string(), param_value.to_string()));
2295 }
2296 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
2297
2298 let mut header_params = std::collections::HashMap::new();
2300
2301 if let Some(ref binance_auth) = configuration.binance_auth {
2303 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2305
2306 let body_string: Option<Vec<u8>> = None;
2308
2309 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2311 Ok(sig) => sig,
2312 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2313 };
2314
2315 query_params.push(("signature".to_string(), signature));
2317 }
2318
2319 if !query_params.is_empty() {
2321 req_builder = req_builder.query(&query_params);
2322 }
2323
2324
2325 if let Some(ref user_agent) = configuration.user_agent {
2327 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2328 }
2329
2330 for (header_name, header_value) in header_params {
2332 req_builder = req_builder.header(&header_name, &header_value);
2333 }
2334
2335
2336 let req = req_builder.build()?;
2337 let resp = configuration.client.execute(req).await?;
2338
2339 let status = resp.status();
2340 let content_type = resp
2341 .headers()
2342 .get("content-type")
2343 .and_then(|v| v.to_str().ok())
2344 .unwrap_or("application/octet-stream");
2345 let content_type = super::ContentType::from(content_type);
2346
2347 if !status.is_client_error() && !status.is_server_error() {
2348 let content = resp.text().await?;
2349 match content_type {
2350 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2351 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeleteOrderListV3Resp`"))),
2352 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::DeleteOrderListV3Resp`")))),
2353 }
2354 } else {
2355 let content = resp.text().await?;
2356 let entity: Option<DeleteOrderListV3Error> = serde_json::from_str(&content).ok();
2357 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2358 }
2359}
2360
2361pub async fn delete_order_v3(configuration: &configuration::Configuration, params: DeleteOrderV3Params) -> Result<models::DeleteOrderV3Resp, Error<DeleteOrderV3Error>> {
2363
2364 let uri_str = format!("{}/api/v3/order", configuration.base_path);
2365 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
2366
2367 let mut query_params: Vec<(String, String)> = Vec::new();
2369
2370 query_params.push(("symbol".to_string(), params.symbol.to_string()));
2371 if let Some(ref param_value) = params.order_id {
2372 query_params.push(("orderId".to_string(), param_value.to_string()));
2373 }
2374 if let Some(ref param_value) = params.orig_client_order_id {
2375 query_params.push(("origClientOrderId".to_string(), param_value.to_string()));
2376 }
2377 if let Some(ref param_value) = params.new_client_order_id {
2378 query_params.push(("newClientOrderId".to_string(), param_value.to_string()));
2379 }
2380 if let Some(ref param_value) = params.cancel_restrictions {
2381 query_params.push(("cancelRestrictions".to_string(), param_value.to_string()));
2382 }
2383 if let Some(ref param_value) = params.recv_window {
2384 query_params.push(("recvWindow".to_string(), param_value.to_string()));
2385 }
2386 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
2387
2388 let mut header_params = std::collections::HashMap::new();
2390
2391 if let Some(ref binance_auth) = configuration.binance_auth {
2393 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2395
2396 let body_string: Option<Vec<u8>> = None;
2398
2399 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2401 Ok(sig) => sig,
2402 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2403 };
2404
2405 query_params.push(("signature".to_string(), signature));
2407 }
2408
2409 if !query_params.is_empty() {
2411 req_builder = req_builder.query(&query_params);
2412 }
2413
2414
2415 if let Some(ref user_agent) = configuration.user_agent {
2417 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2418 }
2419
2420 for (header_name, header_value) in header_params {
2422 req_builder = req_builder.header(&header_name, &header_value);
2423 }
2424
2425
2426 let req = req_builder.build()?;
2427 let resp = configuration.client.execute(req).await?;
2428
2429 let status = resp.status();
2430 let content_type = resp
2431 .headers()
2432 .get("content-type")
2433 .and_then(|v| v.to_str().ok())
2434 .unwrap_or("application/octet-stream");
2435 let content_type = super::ContentType::from(content_type);
2436
2437 if !status.is_client_error() && !status.is_server_error() {
2438 let content = resp.text().await?;
2439 match content_type {
2440 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2441 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeleteOrderV3Resp`"))),
2442 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::DeleteOrderV3Resp`")))),
2443 }
2444 } else {
2445 let content = resp.text().await?;
2446 let entity: Option<DeleteOrderV3Error> = serde_json::from_str(&content).ok();
2447 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2448 }
2449}
2450
2451pub async fn delete_user_data_stream_v3(configuration: &configuration::Configuration, params: DeleteUserDataStreamV3Params) -> Result<serde_json::Value, Error<DeleteUserDataStreamV3Error>> {
2453
2454 let uri_str = format!("{}/api/v3/userDataStream", configuration.base_path);
2455 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
2456
2457 let mut query_params: Vec<(String, String)> = Vec::new();
2459
2460 query_params.push(("listenKey".to_string(), params.listen_key.to_string()));
2461
2462 let mut header_params = std::collections::HashMap::new();
2464
2465 if let Some(ref binance_auth) = configuration.binance_auth {
2467 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2469
2470 let body_string: Option<Vec<u8>> = None;
2472
2473 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2475 Ok(sig) => sig,
2476 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2477 };
2478
2479 query_params.push(("signature".to_string(), signature));
2481 }
2482
2483 if !query_params.is_empty() {
2485 req_builder = req_builder.query(&query_params);
2486 }
2487
2488
2489 if let Some(ref user_agent) = configuration.user_agent {
2491 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2492 }
2493
2494 for (header_name, header_value) in header_params {
2496 req_builder = req_builder.header(&header_name, &header_value);
2497 }
2498
2499
2500 let req = req_builder.build()?;
2501 let resp = configuration.client.execute(req).await?;
2502
2503 let status = resp.status();
2504 let content_type = resp
2505 .headers()
2506 .get("content-type")
2507 .and_then(|v| v.to_str().ok())
2508 .unwrap_or("application/octet-stream");
2509 let content_type = super::ContentType::from(content_type);
2510
2511 if !status.is_client_error() && !status.is_server_error() {
2512 let content = resp.text().await?;
2513 match content_type {
2514 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2515 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `serde_json::Value`"))),
2516 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `serde_json::Value`")))),
2517 }
2518 } else {
2519 let content = resp.text().await?;
2520 let entity: Option<DeleteUserDataStreamV3Error> = serde_json::from_str(&content).ok();
2521 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2522 }
2523}
2524
2525pub async fn get_account_commission_v3(configuration: &configuration::Configuration, params: GetAccountCommissionV3Params) -> Result<models::GetAccountCommissionV3Resp, Error<GetAccountCommissionV3Error>> {
2527
2528 let uri_str = format!("{}/api/v3/account/commission", configuration.base_path);
2529 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2530
2531 let mut query_params: Vec<(String, String)> = Vec::new();
2533
2534 query_params.push(("symbol".to_string(), params.symbol.to_string()));
2535
2536 let mut header_params = std::collections::HashMap::new();
2538
2539 if let Some(ref binance_auth) = configuration.binance_auth {
2541 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2543
2544 let body_string: Option<Vec<u8>> = None;
2546
2547 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2549 Ok(sig) => sig,
2550 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2551 };
2552
2553 query_params.push(("signature".to_string(), signature));
2555 }
2556
2557 if !query_params.is_empty() {
2559 req_builder = req_builder.query(&query_params);
2560 }
2561
2562
2563 if let Some(ref user_agent) = configuration.user_agent {
2565 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2566 }
2567
2568 for (header_name, header_value) in header_params {
2570 req_builder = req_builder.header(&header_name, &header_value);
2571 }
2572
2573
2574 let req = req_builder.build()?;
2575 let resp = configuration.client.execute(req).await?;
2576
2577 let status = resp.status();
2578 let content_type = resp
2579 .headers()
2580 .get("content-type")
2581 .and_then(|v| v.to_str().ok())
2582 .unwrap_or("application/octet-stream");
2583 let content_type = super::ContentType::from(content_type);
2584
2585 if !status.is_client_error() && !status.is_server_error() {
2586 let content = resp.text().await?;
2587 match content_type {
2588 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2589 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetAccountCommissionV3Resp`"))),
2590 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetAccountCommissionV3Resp`")))),
2591 }
2592 } else {
2593 let content = resp.text().await?;
2594 let entity: Option<GetAccountCommissionV3Error> = serde_json::from_str(&content).ok();
2595 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2596 }
2597}
2598
2599pub async fn get_account_v3(configuration: &configuration::Configuration, params: GetAccountV3Params) -> Result<models::GetAccountV3Resp, Error<GetAccountV3Error>> {
2601
2602 let uri_str = format!("{}/api/v3/account", configuration.base_path);
2603 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2604
2605 let mut query_params: Vec<(String, String)> = Vec::new();
2607
2608 if let Some(ref param_value) = params.omit_zero_balances {
2609 query_params.push(("omitZeroBalances".to_string(), param_value.to_string()));
2610 }
2611 if let Some(ref param_value) = params.recv_window {
2612 query_params.push(("recvWindow".to_string(), param_value.to_string()));
2613 }
2614 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
2615
2616 let mut header_params = std::collections::HashMap::new();
2618
2619 if let Some(ref binance_auth) = configuration.binance_auth {
2621 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2623
2624 let body_string: Option<Vec<u8>> = None;
2626
2627 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2629 Ok(sig) => sig,
2630 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2631 };
2632
2633 query_params.push(("signature".to_string(), signature));
2635 }
2636
2637 if !query_params.is_empty() {
2639 req_builder = req_builder.query(&query_params);
2640 }
2641
2642
2643 if let Some(ref user_agent) = configuration.user_agent {
2645 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2646 }
2647
2648 for (header_name, header_value) in header_params {
2650 req_builder = req_builder.header(&header_name, &header_value);
2651 }
2652
2653
2654 let req = req_builder.build()?;
2655 let resp = configuration.client.execute(req).await?;
2656
2657 let status = resp.status();
2658 let content_type = resp
2659 .headers()
2660 .get("content-type")
2661 .and_then(|v| v.to_str().ok())
2662 .unwrap_or("application/octet-stream");
2663 let content_type = super::ContentType::from(content_type);
2664
2665 if !status.is_client_error() && !status.is_server_error() {
2666 let content = resp.text().await?;
2667 match content_type {
2668 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2669 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetAccountV3Resp`"))),
2670 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetAccountV3Resp`")))),
2671 }
2672 } else {
2673 let content = resp.text().await?;
2674 let entity: Option<GetAccountV3Error> = serde_json::from_str(&content).ok();
2675 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2676 }
2677}
2678
2679pub async fn get_agg_trades_v3(configuration: &configuration::Configuration, params: GetAggTradesV3Params) -> Result<Vec<models::SpotGetAggTradesV3RespItem>, Error<GetAggTradesV3Error>> {
2681
2682 let uri_str = format!("{}/api/v3/aggTrades", configuration.base_path);
2683 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2684
2685 let mut query_params: Vec<(String, String)> = Vec::new();
2687
2688 query_params.push(("symbol".to_string(), params.symbol.to_string()));
2689 if let Some(ref param_value) = params.from_id {
2690 query_params.push(("fromId".to_string(), param_value.to_string()));
2691 }
2692 if let Some(ref param_value) = params.start_time {
2693 query_params.push(("startTime".to_string(), param_value.to_string()));
2694 }
2695 if let Some(ref param_value) = params.end_time {
2696 query_params.push(("endTime".to_string(), param_value.to_string()));
2697 }
2698 if let Some(ref param_value) = params.limit {
2699 query_params.push(("limit".to_string(), param_value.to_string()));
2700 }
2701
2702 let mut header_params = std::collections::HashMap::new();
2704
2705 if let Some(ref binance_auth) = configuration.binance_auth {
2707 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2709
2710 let body_string: Option<Vec<u8>> = None;
2712
2713 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2715 Ok(sig) => sig,
2716 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2717 };
2718
2719 query_params.push(("signature".to_string(), signature));
2721 }
2722
2723 if !query_params.is_empty() {
2725 req_builder = req_builder.query(&query_params);
2726 }
2727
2728
2729 if let Some(ref user_agent) = configuration.user_agent {
2731 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2732 }
2733
2734 for (header_name, header_value) in header_params {
2736 req_builder = req_builder.header(&header_name, &header_value);
2737 }
2738
2739
2740 let req = req_builder.build()?;
2741 let resp = configuration.client.execute(req).await?;
2742
2743 let status = resp.status();
2744 let content_type = resp
2745 .headers()
2746 .get("content-type")
2747 .and_then(|v| v.to_str().ok())
2748 .unwrap_or("application/octet-stream");
2749 let content_type = super::ContentType::from(content_type);
2750
2751 if !status.is_client_error() && !status.is_server_error() {
2752 let content = resp.text().await?;
2753 match content_type {
2754 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2755 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::SpotGetAggTradesV3RespItem>`"))),
2756 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::SpotGetAggTradesV3RespItem>`")))),
2757 }
2758 } else {
2759 let content = resp.text().await?;
2760 let entity: Option<GetAggTradesV3Error> = serde_json::from_str(&content).ok();
2761 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2762 }
2763}
2764
2765pub async fn get_all_order_list_v3(configuration: &configuration::Configuration, params: GetAllOrderListV3Params) -> Result<Vec<models::GetAllOrderListV3RespItem>, Error<GetAllOrderListV3Error>> {
2767
2768 let uri_str = format!("{}/api/v3/allOrderList", configuration.base_path);
2769 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2770
2771 let mut query_params: Vec<(String, String)> = Vec::new();
2773
2774 if let Some(ref param_value) = params.from_id {
2775 query_params.push(("fromId".to_string(), param_value.to_string()));
2776 }
2777 if let Some(ref param_value) = params.start_time {
2778 query_params.push(("startTime".to_string(), param_value.to_string()));
2779 }
2780 if let Some(ref param_value) = params.end_time {
2781 query_params.push(("endTime".to_string(), param_value.to_string()));
2782 }
2783 if let Some(ref param_value) = params.limit {
2784 query_params.push(("limit".to_string(), param_value.to_string()));
2785 }
2786 if let Some(ref param_value) = params.recv_window {
2787 query_params.push(("recvWindow".to_string(), param_value.to_string()));
2788 }
2789 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
2790
2791 let mut header_params = std::collections::HashMap::new();
2793
2794 if let Some(ref binance_auth) = configuration.binance_auth {
2796 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2798
2799 let body_string: Option<Vec<u8>> = None;
2801
2802 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2804 Ok(sig) => sig,
2805 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2806 };
2807
2808 query_params.push(("signature".to_string(), signature));
2810 }
2811
2812 if !query_params.is_empty() {
2814 req_builder = req_builder.query(&query_params);
2815 }
2816
2817
2818 if let Some(ref user_agent) = configuration.user_agent {
2820 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2821 }
2822
2823 for (header_name, header_value) in header_params {
2825 req_builder = req_builder.header(&header_name, &header_value);
2826 }
2827
2828
2829 let req = req_builder.build()?;
2830 let resp = configuration.client.execute(req).await?;
2831
2832 let status = resp.status();
2833 let content_type = resp
2834 .headers()
2835 .get("content-type")
2836 .and_then(|v| v.to_str().ok())
2837 .unwrap_or("application/octet-stream");
2838 let content_type = super::ContentType::from(content_type);
2839
2840 if !status.is_client_error() && !status.is_server_error() {
2841 let content = resp.text().await?;
2842 match content_type {
2843 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2844 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetAllOrderListV3RespItem>`"))),
2845 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::GetAllOrderListV3RespItem>`")))),
2846 }
2847 } else {
2848 let content = resp.text().await?;
2849 let entity: Option<GetAllOrderListV3Error> = serde_json::from_str(&content).ok();
2850 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2851 }
2852}
2853
2854pub async fn get_all_orders_v3(configuration: &configuration::Configuration, params: GetAllOrdersV3Params) -> Result<Vec<models::GetAllOrdersV3RespItem>, Error<GetAllOrdersV3Error>> {
2856
2857 let uri_str = format!("{}/api/v3/allOrders", configuration.base_path);
2858 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2859
2860 let mut query_params: Vec<(String, String)> = Vec::new();
2862
2863 query_params.push(("symbol".to_string(), params.symbol.to_string()));
2864 if let Some(ref param_value) = params.order_id {
2865 query_params.push(("orderId".to_string(), param_value.to_string()));
2866 }
2867 if let Some(ref param_value) = params.start_time {
2868 query_params.push(("startTime".to_string(), param_value.to_string()));
2869 }
2870 if let Some(ref param_value) = params.end_time {
2871 query_params.push(("endTime".to_string(), param_value.to_string()));
2872 }
2873 if let Some(ref param_value) = params.limit {
2874 query_params.push(("limit".to_string(), param_value.to_string()));
2875 }
2876 if let Some(ref param_value) = params.recv_window {
2877 query_params.push(("recvWindow".to_string(), param_value.to_string()));
2878 }
2879 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
2880
2881 let mut header_params = std::collections::HashMap::new();
2883
2884 if let Some(ref binance_auth) = configuration.binance_auth {
2886 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2888
2889 let body_string: Option<Vec<u8>> = None;
2891
2892 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2894 Ok(sig) => sig,
2895 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2896 };
2897
2898 query_params.push(("signature".to_string(), signature));
2900 }
2901
2902 if !query_params.is_empty() {
2904 req_builder = req_builder.query(&query_params);
2905 }
2906
2907
2908 if let Some(ref user_agent) = configuration.user_agent {
2910 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2911 }
2912
2913 for (header_name, header_value) in header_params {
2915 req_builder = req_builder.header(&header_name, &header_value);
2916 }
2917
2918
2919 let req = req_builder.build()?;
2920 let resp = configuration.client.execute(req).await?;
2921
2922 let status = resp.status();
2923 let content_type = resp
2924 .headers()
2925 .get("content-type")
2926 .and_then(|v| v.to_str().ok())
2927 .unwrap_or("application/octet-stream");
2928 let content_type = super::ContentType::from(content_type);
2929
2930 if !status.is_client_error() && !status.is_server_error() {
2931 let content = resp.text().await?;
2932 match content_type {
2933 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2934 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetAllOrdersV3RespItem>`"))),
2935 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::GetAllOrdersV3RespItem>`")))),
2936 }
2937 } else {
2938 let content = resp.text().await?;
2939 let entity: Option<GetAllOrdersV3Error> = serde_json::from_str(&content).ok();
2940 Err(Error::ResponseError(ResponseContent { status, content, entity }))
2941 }
2942}
2943
2944pub async fn get_avg_price_v3(configuration: &configuration::Configuration, params: GetAvgPriceV3Params) -> Result<models::GetAvgPriceV3Resp, Error<GetAvgPriceV3Error>> {
2946
2947 let uri_str = format!("{}/api/v3/avgPrice", configuration.base_path);
2948 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2949
2950 let mut query_params: Vec<(String, String)> = Vec::new();
2952
2953 query_params.push(("symbol".to_string(), params.symbol.to_string()));
2954
2955 let mut header_params = std::collections::HashMap::new();
2957
2958 if let Some(ref binance_auth) = configuration.binance_auth {
2960 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
2962
2963 let body_string: Option<Vec<u8>> = None;
2965
2966 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
2968 Ok(sig) => sig,
2969 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
2970 };
2971
2972 query_params.push(("signature".to_string(), signature));
2974 }
2975
2976 if !query_params.is_empty() {
2978 req_builder = req_builder.query(&query_params);
2979 }
2980
2981
2982 if let Some(ref user_agent) = configuration.user_agent {
2984 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2985 }
2986
2987 for (header_name, header_value) in header_params {
2989 req_builder = req_builder.header(&header_name, &header_value);
2990 }
2991
2992
2993 let req = req_builder.build()?;
2994 let resp = configuration.client.execute(req).await?;
2995
2996 let status = resp.status();
2997 let content_type = resp
2998 .headers()
2999 .get("content-type")
3000 .and_then(|v| v.to_str().ok())
3001 .unwrap_or("application/octet-stream");
3002 let content_type = super::ContentType::from(content_type);
3003
3004 if !status.is_client_error() && !status.is_server_error() {
3005 let content = resp.text().await?;
3006 match content_type {
3007 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3008 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetAvgPriceV3Resp`"))),
3009 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetAvgPriceV3Resp`")))),
3010 }
3011 } else {
3012 let content = resp.text().await?;
3013 let entity: Option<GetAvgPriceV3Error> = serde_json::from_str(&content).ok();
3014 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3015 }
3016}
3017
3018pub async fn get_depth_v3(configuration: &configuration::Configuration, params: GetDepthV3Params) -> Result<models::GetDepthV3Resp, Error<GetDepthV3Error>> {
3019
3020 let uri_str = format!("{}/api/v3/depth", configuration.base_path);
3021 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3022
3023 let mut query_params: Vec<(String, String)> = Vec::new();
3025
3026 query_params.push(("symbol".to_string(), params.symbol.to_string()));
3027 if let Some(ref param_value) = params.limit {
3028 query_params.push(("limit".to_string(), param_value.to_string()));
3029 }
3030
3031 let mut header_params = std::collections::HashMap::new();
3033
3034 if let Some(ref binance_auth) = configuration.binance_auth {
3036 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3038
3039 let body_string: Option<Vec<u8>> = None;
3041
3042 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3044 Ok(sig) => sig,
3045 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3046 };
3047
3048 query_params.push(("signature".to_string(), signature));
3050 }
3051
3052 if !query_params.is_empty() {
3054 req_builder = req_builder.query(&query_params);
3055 }
3056
3057
3058 if let Some(ref user_agent) = configuration.user_agent {
3060 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3061 }
3062
3063 for (header_name, header_value) in header_params {
3065 req_builder = req_builder.header(&header_name, &header_value);
3066 }
3067
3068
3069 let req = req_builder.build()?;
3070 let resp = configuration.client.execute(req).await?;
3071
3072 let status = resp.status();
3073 let content_type = resp
3074 .headers()
3075 .get("content-type")
3076 .and_then(|v| v.to_str().ok())
3077 .unwrap_or("application/octet-stream");
3078 let content_type = super::ContentType::from(content_type);
3079
3080 if !status.is_client_error() && !status.is_server_error() {
3081 let content = resp.text().await?;
3082 match content_type {
3083 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3084 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetDepthV3Resp`"))),
3085 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetDepthV3Resp`")))),
3086 }
3087 } else {
3088 let content = resp.text().await?;
3089 let entity: Option<GetDepthV3Error> = serde_json::from_str(&content).ok();
3090 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3091 }
3092}
3093
3094pub async fn get_exchange_info_v3(configuration: &configuration::Configuration, params: GetExchangeInfoV3Params) -> Result<models::SpotGetExchangeInfoV3Resp, Error<GetExchangeInfoV3Error>> {
3096
3097 let uri_str = format!("{}/api/v3/exchangeInfo", configuration.base_path);
3098 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3099
3100 let mut query_params: Vec<(String, String)> = Vec::new();
3102
3103 if let Some(ref param_value) = params.symbol {
3104 query_params.push(("symbol".to_string(), param_value.to_string()));
3105 }
3106 if let Some(ref param_value) = params.symbols {
3107 match "multi" {
3108 "multi" => {
3109 for p in param_value {
3110 query_params.push(("symbols".to_string(), p.to_string()));
3111 }
3112 },
3113 _ => {
3114 let joined = param_value.iter()
3115 .map(|p| p.to_string())
3116 .collect::<Vec<String>>()
3117 .join(",");
3118 query_params.push(("symbols".to_string(), joined));
3119 }
3120 };
3121 }
3122 if let Some(ref param_value) = params.permissions {
3123 query_params.push(("permissions".to_string(), param_value.to_string()));
3124 }
3125 if let Some(ref param_value) = params.show_permission_sets {
3126 query_params.push(("showPermissionSets".to_string(), param_value.to_string()));
3127 }
3128 if let Some(ref param_value) = params.symbol_status {
3129 query_params.push(("symbolStatus".to_string(), param_value.to_string()));
3130 }
3131
3132 let mut header_params = std::collections::HashMap::new();
3134
3135 if let Some(ref binance_auth) = configuration.binance_auth {
3137 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3139
3140 let body_string: Option<Vec<u8>> = None;
3142
3143 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3145 Ok(sig) => sig,
3146 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3147 };
3148
3149 query_params.push(("signature".to_string(), signature));
3151 }
3152
3153 if !query_params.is_empty() {
3155 req_builder = req_builder.query(&query_params);
3156 }
3157
3158
3159 if let Some(ref user_agent) = configuration.user_agent {
3161 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3162 }
3163
3164 for (header_name, header_value) in header_params {
3166 req_builder = req_builder.header(&header_name, &header_value);
3167 }
3168
3169
3170 let req = req_builder.build()?;
3171 let resp = configuration.client.execute(req).await?;
3172
3173 let status = resp.status();
3174 let content_type = resp
3175 .headers()
3176 .get("content-type")
3177 .and_then(|v| v.to_str().ok())
3178 .unwrap_or("application/octet-stream");
3179 let content_type = super::ContentType::from(content_type);
3180
3181 if !status.is_client_error() && !status.is_server_error() {
3182 let content = resp.text().await?;
3183 match content_type {
3184 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3185 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SpotGetExchangeInfoV3Resp`"))),
3186 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::SpotGetExchangeInfoV3Resp`")))),
3187 }
3188 } else {
3189 let content = resp.text().await?;
3190 let entity: Option<GetExchangeInfoV3Error> = serde_json::from_str(&content).ok();
3191 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3192 }
3193}
3194
3195pub async fn get_historical_trades_v3(configuration: &configuration::Configuration, params: GetHistoricalTradesV3Params) -> Result<Vec<models::GetHistoricalTradesV3RespItem>, Error<GetHistoricalTradesV3Error>> {
3197
3198 let uri_str = format!("{}/api/v3/historicalTrades", configuration.base_path);
3199 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3200
3201 let mut query_params: Vec<(String, String)> = Vec::new();
3203
3204 query_params.push(("symbol".to_string(), params.symbol.to_string()));
3205 if let Some(ref param_value) = params.limit {
3206 query_params.push(("limit".to_string(), param_value.to_string()));
3207 }
3208 if let Some(ref param_value) = params.from_id {
3209 query_params.push(("fromId".to_string(), param_value.to_string()));
3210 }
3211
3212 let mut header_params = std::collections::HashMap::new();
3214
3215 if let Some(ref binance_auth) = configuration.binance_auth {
3217 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3219
3220 let body_string: Option<Vec<u8>> = None;
3222
3223 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3225 Ok(sig) => sig,
3226 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3227 };
3228
3229 query_params.push(("signature".to_string(), signature));
3231 }
3232
3233 if !query_params.is_empty() {
3235 req_builder = req_builder.query(&query_params);
3236 }
3237
3238
3239 if let Some(ref user_agent) = configuration.user_agent {
3241 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3242 }
3243
3244 for (header_name, header_value) in header_params {
3246 req_builder = req_builder.header(&header_name, &header_value);
3247 }
3248
3249
3250 let req = req_builder.build()?;
3251 let resp = configuration.client.execute(req).await?;
3252
3253 let status = resp.status();
3254 let content_type = resp
3255 .headers()
3256 .get("content-type")
3257 .and_then(|v| v.to_str().ok())
3258 .unwrap_or("application/octet-stream");
3259 let content_type = super::ContentType::from(content_type);
3260
3261 if !status.is_client_error() && !status.is_server_error() {
3262 let content = resp.text().await?;
3263 match content_type {
3264 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3265 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetHistoricalTradesV3RespItem>`"))),
3266 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::GetHistoricalTradesV3RespItem>`")))),
3267 }
3268 } else {
3269 let content = resp.text().await?;
3270 let entity: Option<GetHistoricalTradesV3Error> = serde_json::from_str(&content).ok();
3271 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3272 }
3273}
3274
3275pub async fn get_klines_v3(configuration: &configuration::Configuration, params: GetKlinesV3Params) -> Result<Vec<Vec<models::GetKlinesV3200ResponseInnerInner>>, Error<GetKlinesV3Error>> {
3277
3278 let uri_str = format!("{}/api/v3/klines", configuration.base_path);
3279 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3280
3281 let mut query_params: Vec<(String, String)> = Vec::new();
3283
3284 query_params.push(("symbol".to_string(), params.symbol.to_string()));
3285 query_params.push(("interval".to_string(), params.interval.to_string()));
3286 if let Some(ref param_value) = params.start_time {
3287 query_params.push(("startTime".to_string(), param_value.to_string()));
3288 }
3289 if let Some(ref param_value) = params.end_time {
3290 query_params.push(("endTime".to_string(), param_value.to_string()));
3291 }
3292 if let Some(ref param_value) = params.time_zone {
3293 query_params.push(("timeZone".to_string(), param_value.to_string()));
3294 }
3295 if let Some(ref param_value) = params.limit {
3296 query_params.push(("limit".to_string(), param_value.to_string()));
3297 }
3298
3299 let mut header_params = std::collections::HashMap::new();
3301
3302 if let Some(ref binance_auth) = configuration.binance_auth {
3304 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3306
3307 let body_string: Option<Vec<u8>> = None;
3309
3310 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3312 Ok(sig) => sig,
3313 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3314 };
3315
3316 query_params.push(("signature".to_string(), signature));
3318 }
3319
3320 if !query_params.is_empty() {
3322 req_builder = req_builder.query(&query_params);
3323 }
3324
3325
3326 if let Some(ref user_agent) = configuration.user_agent {
3328 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3329 }
3330
3331 for (header_name, header_value) in header_params {
3333 req_builder = req_builder.header(&header_name, &header_value);
3334 }
3335
3336
3337 let req = req_builder.build()?;
3338 let resp = configuration.client.execute(req).await?;
3339
3340 let status = resp.status();
3341 let content_type = resp
3342 .headers()
3343 .get("content-type")
3344 .and_then(|v| v.to_str().ok())
3345 .unwrap_or("application/octet-stream");
3346 let content_type = super::ContentType::from(content_type);
3347
3348 if !status.is_client_error() && !status.is_server_error() {
3349 let content = resp.text().await?;
3350 match content_type {
3351 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3352 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<Vec<models::GetKlinesV3200ResponseInnerInner>>`"))),
3353 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<Vec<models::GetKlinesV3200ResponseInnerInner>>`")))),
3354 }
3355 } else {
3356 let content = resp.text().await?;
3357 let entity: Option<GetKlinesV3Error> = serde_json::from_str(&content).ok();
3358 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3359 }
3360}
3361
3362pub async fn get_my_allocations_v3(configuration: &configuration::Configuration, params: GetMyAllocationsV3Params) -> Result<Vec<models::GetMyAllocationsV3RespItem>, Error<GetMyAllocationsV3Error>> {
3364
3365 let uri_str = format!("{}/api/v3/myAllocations", configuration.base_path);
3366 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3367
3368 let mut query_params: Vec<(String, String)> = Vec::new();
3370
3371 query_params.push(("symbol".to_string(), params.symbol.to_string()));
3372 if let Some(ref param_value) = params.start_time {
3373 query_params.push(("startTime".to_string(), param_value.to_string()));
3374 }
3375 if let Some(ref param_value) = params.end_time {
3376 query_params.push(("endTime".to_string(), param_value.to_string()));
3377 }
3378 if let Some(ref param_value) = params.from_allocation_id {
3379 query_params.push(("fromAllocationId".to_string(), param_value.to_string()));
3380 }
3381 if let Some(ref param_value) = params.limit {
3382 query_params.push(("limit".to_string(), param_value.to_string()));
3383 }
3384 if let Some(ref param_value) = params.order_id {
3385 query_params.push(("orderId".to_string(), param_value.to_string()));
3386 }
3387 if let Some(ref param_value) = params.recv_window {
3388 query_params.push(("recvWindow".to_string(), param_value.to_string()));
3389 }
3390 if let Some(ref param_value) = params.timestamp {
3391 query_params.push(("timestamp".to_string(), param_value.to_string()));
3392 }
3393
3394 let mut header_params = std::collections::HashMap::new();
3396
3397 if let Some(ref binance_auth) = configuration.binance_auth {
3399 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3401
3402 let body_string: Option<Vec<u8>> = None;
3404
3405 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3407 Ok(sig) => sig,
3408 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3409 };
3410
3411 query_params.push(("signature".to_string(), signature));
3413 }
3414
3415 if !query_params.is_empty() {
3417 req_builder = req_builder.query(&query_params);
3418 }
3419
3420
3421 if let Some(ref user_agent) = configuration.user_agent {
3423 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3424 }
3425
3426 for (header_name, header_value) in header_params {
3428 req_builder = req_builder.header(&header_name, &header_value);
3429 }
3430
3431
3432 let req = req_builder.build()?;
3433 let resp = configuration.client.execute(req).await?;
3434
3435 let status = resp.status();
3436 let content_type = resp
3437 .headers()
3438 .get("content-type")
3439 .and_then(|v| v.to_str().ok())
3440 .unwrap_or("application/octet-stream");
3441 let content_type = super::ContentType::from(content_type);
3442
3443 if !status.is_client_error() && !status.is_server_error() {
3444 let content = resp.text().await?;
3445 match content_type {
3446 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3447 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetMyAllocationsV3RespItem>`"))),
3448 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::GetMyAllocationsV3RespItem>`")))),
3449 }
3450 } else {
3451 let content = resp.text().await?;
3452 let entity: Option<GetMyAllocationsV3Error> = serde_json::from_str(&content).ok();
3453 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3454 }
3455}
3456
3457pub async fn get_my_prevented_matches_v3(configuration: &configuration::Configuration, params: GetMyPreventedMatchesV3Params) -> Result<Vec<models::GetMyPreventedMatchesV3RespItem>, Error<GetMyPreventedMatchesV3Error>> {
3459
3460 let uri_str = format!("{}/api/v3/myPreventedMatches", configuration.base_path);
3461 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3462
3463 let mut query_params: Vec<(String, String)> = Vec::new();
3465
3466 query_params.push(("symbol".to_string(), params.symbol.to_string()));
3467 if let Some(ref param_value) = params.prevented_match_id {
3468 query_params.push(("preventedMatchId".to_string(), param_value.to_string()));
3469 }
3470 if let Some(ref param_value) = params.order_id {
3471 query_params.push(("orderId".to_string(), param_value.to_string()));
3472 }
3473 if let Some(ref param_value) = params.from_prevented_match_id {
3474 query_params.push(("fromPreventedMatchId".to_string(), param_value.to_string()));
3475 }
3476 if let Some(ref param_value) = params.limit {
3477 query_params.push(("limit".to_string(), param_value.to_string()));
3478 }
3479 if let Some(ref param_value) = params.recv_window {
3480 query_params.push(("recvWindow".to_string(), param_value.to_string()));
3481 }
3482 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
3483
3484 let mut header_params = std::collections::HashMap::new();
3486
3487 if let Some(ref binance_auth) = configuration.binance_auth {
3489 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3491
3492 let body_string: Option<Vec<u8>> = None;
3494
3495 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3497 Ok(sig) => sig,
3498 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3499 };
3500
3501 query_params.push(("signature".to_string(), signature));
3503 }
3504
3505 if !query_params.is_empty() {
3507 req_builder = req_builder.query(&query_params);
3508 }
3509
3510
3511 if let Some(ref user_agent) = configuration.user_agent {
3513 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3514 }
3515
3516 for (header_name, header_value) in header_params {
3518 req_builder = req_builder.header(&header_name, &header_value);
3519 }
3520
3521
3522 let req = req_builder.build()?;
3523 let resp = configuration.client.execute(req).await?;
3524
3525 let status = resp.status();
3526 let content_type = resp
3527 .headers()
3528 .get("content-type")
3529 .and_then(|v| v.to_str().ok())
3530 .unwrap_or("application/octet-stream");
3531 let content_type = super::ContentType::from(content_type);
3532
3533 if !status.is_client_error() && !status.is_server_error() {
3534 let content = resp.text().await?;
3535 match content_type {
3536 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3537 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetMyPreventedMatchesV3RespItem>`"))),
3538 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::GetMyPreventedMatchesV3RespItem>`")))),
3539 }
3540 } else {
3541 let content = resp.text().await?;
3542 let entity: Option<GetMyPreventedMatchesV3Error> = serde_json::from_str(&content).ok();
3543 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3544 }
3545}
3546
3547pub async fn get_my_trades_v3(configuration: &configuration::Configuration, params: GetMyTradesV3Params) -> Result<Vec<models::GetMyTradesV3RespItem>, Error<GetMyTradesV3Error>> {
3549
3550 let uri_str = format!("{}/api/v3/myTrades", configuration.base_path);
3551 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3552
3553 let mut query_params: Vec<(String, String)> = Vec::new();
3555
3556 query_params.push(("symbol".to_string(), params.symbol.to_string()));
3557 if let Some(ref param_value) = params.order_id {
3558 query_params.push(("orderId".to_string(), param_value.to_string()));
3559 }
3560 if let Some(ref param_value) = params.start_time {
3561 query_params.push(("startTime".to_string(), param_value.to_string()));
3562 }
3563 if let Some(ref param_value) = params.end_time {
3564 query_params.push(("endTime".to_string(), param_value.to_string()));
3565 }
3566 if let Some(ref param_value) = params.from_id {
3567 query_params.push(("fromId".to_string(), param_value.to_string()));
3568 }
3569 if let Some(ref param_value) = params.limit {
3570 query_params.push(("limit".to_string(), param_value.to_string()));
3571 }
3572 if let Some(ref param_value) = params.recv_window {
3573 query_params.push(("recvWindow".to_string(), param_value.to_string()));
3574 }
3575 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
3576
3577 let mut header_params = std::collections::HashMap::new();
3579
3580 if let Some(ref binance_auth) = configuration.binance_auth {
3582 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3584
3585 let body_string: Option<Vec<u8>> = None;
3587
3588 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3590 Ok(sig) => sig,
3591 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3592 };
3593
3594 query_params.push(("signature".to_string(), signature));
3596 }
3597
3598 if !query_params.is_empty() {
3600 req_builder = req_builder.query(&query_params);
3601 }
3602
3603
3604 if let Some(ref user_agent) = configuration.user_agent {
3606 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3607 }
3608
3609 for (header_name, header_value) in header_params {
3611 req_builder = req_builder.header(&header_name, &header_value);
3612 }
3613
3614
3615 let req = req_builder.build()?;
3616 let resp = configuration.client.execute(req).await?;
3617
3618 let status = resp.status();
3619 let content_type = resp
3620 .headers()
3621 .get("content-type")
3622 .and_then(|v| v.to_str().ok())
3623 .unwrap_or("application/octet-stream");
3624 let content_type = super::ContentType::from(content_type);
3625
3626 if !status.is_client_error() && !status.is_server_error() {
3627 let content = resp.text().await?;
3628 match content_type {
3629 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3630 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetMyTradesV3RespItem>`"))),
3631 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::GetMyTradesV3RespItem>`")))),
3632 }
3633 } else {
3634 let content = resp.text().await?;
3635 let entity: Option<GetMyTradesV3Error> = serde_json::from_str(&content).ok();
3636 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3637 }
3638}
3639
3640pub async fn get_open_order_list_v3(configuration: &configuration::Configuration, params: GetOpenOrderListV3Params) -> Result<Vec<models::GetOpenOrderListV3RespItem>, Error<GetOpenOrderListV3Error>> {
3641
3642 let uri_str = format!("{}/api/v3/openOrderList", configuration.base_path);
3643 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3644
3645 let mut query_params: Vec<(String, String)> = Vec::new();
3647
3648 if let Some(ref param_value) = params.recv_window {
3649 query_params.push(("recvWindow".to_string(), param_value.to_string()));
3650 }
3651 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
3652
3653 let mut header_params = std::collections::HashMap::new();
3655
3656 if let Some(ref binance_auth) = configuration.binance_auth {
3658 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3660
3661 let body_string: Option<Vec<u8>> = None;
3663
3664 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3666 Ok(sig) => sig,
3667 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3668 };
3669
3670 query_params.push(("signature".to_string(), signature));
3672 }
3673
3674 if !query_params.is_empty() {
3676 req_builder = req_builder.query(&query_params);
3677 }
3678
3679
3680 if let Some(ref user_agent) = configuration.user_agent {
3682 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3683 }
3684
3685 for (header_name, header_value) in header_params {
3687 req_builder = req_builder.header(&header_name, &header_value);
3688 }
3689
3690
3691 let req = req_builder.build()?;
3692 let resp = configuration.client.execute(req).await?;
3693
3694 let status = resp.status();
3695 let content_type = resp
3696 .headers()
3697 .get("content-type")
3698 .and_then(|v| v.to_str().ok())
3699 .unwrap_or("application/octet-stream");
3700 let content_type = super::ContentType::from(content_type);
3701
3702 if !status.is_client_error() && !status.is_server_error() {
3703 let content = resp.text().await?;
3704 match content_type {
3705 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3706 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetOpenOrderListV3RespItem>`"))),
3707 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::GetOpenOrderListV3RespItem>`")))),
3708 }
3709 } else {
3710 let content = resp.text().await?;
3711 let entity: Option<GetOpenOrderListV3Error> = serde_json::from_str(&content).ok();
3712 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3713 }
3714}
3715
3716pub async fn get_open_orders_v3(configuration: &configuration::Configuration, params: GetOpenOrdersV3Params) -> Result<Vec<models::GetOpenOrdersV3RespItem>, Error<GetOpenOrdersV3Error>> {
3718
3719 let uri_str = format!("{}/api/v3/openOrders", configuration.base_path);
3720 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3721
3722 let mut query_params: Vec<(String, String)> = Vec::new();
3724
3725 if let Some(ref param_value) = params.symbol {
3726 query_params.push(("symbol".to_string(), param_value.to_string()));
3727 }
3728 if let Some(ref param_value) = params.recv_window {
3729 query_params.push(("recvWindow".to_string(), param_value.to_string()));
3730 }
3731 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
3732
3733 let mut header_params = std::collections::HashMap::new();
3735
3736 if let Some(ref binance_auth) = configuration.binance_auth {
3738 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3740
3741 let body_string: Option<Vec<u8>> = None;
3743
3744 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3746 Ok(sig) => sig,
3747 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3748 };
3749
3750 query_params.push(("signature".to_string(), signature));
3752 }
3753
3754 if !query_params.is_empty() {
3756 req_builder = req_builder.query(&query_params);
3757 }
3758
3759
3760 if let Some(ref user_agent) = configuration.user_agent {
3762 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3763 }
3764
3765 for (header_name, header_value) in header_params {
3767 req_builder = req_builder.header(&header_name, &header_value);
3768 }
3769
3770
3771 let req = req_builder.build()?;
3772 let resp = configuration.client.execute(req).await?;
3773
3774 let status = resp.status();
3775 let content_type = resp
3776 .headers()
3777 .get("content-type")
3778 .and_then(|v| v.to_str().ok())
3779 .unwrap_or("application/octet-stream");
3780 let content_type = super::ContentType::from(content_type);
3781
3782 if !status.is_client_error() && !status.is_server_error() {
3783 let content = resp.text().await?;
3784 match content_type {
3785 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3786 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetOpenOrdersV3RespItem>`"))),
3787 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::GetOpenOrdersV3RespItem>`")))),
3788 }
3789 } else {
3790 let content = resp.text().await?;
3791 let entity: Option<GetOpenOrdersV3Error> = serde_json::from_str(&content).ok();
3792 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3793 }
3794}
3795
3796pub async fn get_order_list_v3(configuration: &configuration::Configuration, params: GetOrderListV3Params) -> Result<models::GetOrderListV3Resp, Error<GetOrderListV3Error>> {
3798
3799 let uri_str = format!("{}/api/v3/orderList", configuration.base_path);
3800 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3801
3802 let mut query_params: Vec<(String, String)> = Vec::new();
3804
3805 if let Some(ref param_value) = params.order_list_id {
3806 query_params.push(("orderListId".to_string(), param_value.to_string()));
3807 }
3808 if let Some(ref param_value) = params.orig_client_order_id {
3809 query_params.push(("origClientOrderId".to_string(), param_value.to_string()));
3810 }
3811 if let Some(ref param_value) = params.recv_window {
3812 query_params.push(("recvWindow".to_string(), param_value.to_string()));
3813 }
3814 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
3815
3816 let mut header_params = std::collections::HashMap::new();
3818
3819 if let Some(ref binance_auth) = configuration.binance_auth {
3821 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3823
3824 let body_string: Option<Vec<u8>> = None;
3826
3827 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3829 Ok(sig) => sig,
3830 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3831 };
3832
3833 query_params.push(("signature".to_string(), signature));
3835 }
3836
3837 if !query_params.is_empty() {
3839 req_builder = req_builder.query(&query_params);
3840 }
3841
3842
3843 if let Some(ref user_agent) = configuration.user_agent {
3845 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3846 }
3847
3848 for (header_name, header_value) in header_params {
3850 req_builder = req_builder.header(&header_name, &header_value);
3851 }
3852
3853
3854 let req = req_builder.build()?;
3855 let resp = configuration.client.execute(req).await?;
3856
3857 let status = resp.status();
3858 let content_type = resp
3859 .headers()
3860 .get("content-type")
3861 .and_then(|v| v.to_str().ok())
3862 .unwrap_or("application/octet-stream");
3863 let content_type = super::ContentType::from(content_type);
3864
3865 if !status.is_client_error() && !status.is_server_error() {
3866 let content = resp.text().await?;
3867 match content_type {
3868 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3869 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetOrderListV3Resp`"))),
3870 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetOrderListV3Resp`")))),
3871 }
3872 } else {
3873 let content = resp.text().await?;
3874 let entity: Option<GetOrderListV3Error> = serde_json::from_str(&content).ok();
3875 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3876 }
3877}
3878
3879pub async fn get_order_v3(configuration: &configuration::Configuration, params: GetOrderV3Params) -> Result<models::GetOrderV3Resp, Error<GetOrderV3Error>> {
3881
3882 let uri_str = format!("{}/api/v3/order", configuration.base_path);
3883 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3884
3885 let mut query_params: Vec<(String, String)> = Vec::new();
3887
3888 query_params.push(("symbol".to_string(), params.symbol.to_string()));
3889 if let Some(ref param_value) = params.order_id {
3890 query_params.push(("orderId".to_string(), param_value.to_string()));
3891 }
3892 if let Some(ref param_value) = params.orig_client_order_id {
3893 query_params.push(("origClientOrderId".to_string(), param_value.to_string()));
3894 }
3895 if let Some(ref param_value) = params.recv_window {
3896 query_params.push(("recvWindow".to_string(), param_value.to_string()));
3897 }
3898 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
3899
3900 let mut header_params = std::collections::HashMap::new();
3902
3903 if let Some(ref binance_auth) = configuration.binance_auth {
3905 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3907
3908 let body_string: Option<Vec<u8>> = None;
3910
3911 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3913 Ok(sig) => sig,
3914 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3915 };
3916
3917 query_params.push(("signature".to_string(), signature));
3919 }
3920
3921 if !query_params.is_empty() {
3923 req_builder = req_builder.query(&query_params);
3924 }
3925
3926
3927 if let Some(ref user_agent) = configuration.user_agent {
3929 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3930 }
3931
3932 for (header_name, header_value) in header_params {
3934 req_builder = req_builder.header(&header_name, &header_value);
3935 }
3936
3937
3938 let req = req_builder.build()?;
3939 let resp = configuration.client.execute(req).await?;
3940
3941 let status = resp.status();
3942 let content_type = resp
3943 .headers()
3944 .get("content-type")
3945 .and_then(|v| v.to_str().ok())
3946 .unwrap_or("application/octet-stream");
3947 let content_type = super::ContentType::from(content_type);
3948
3949 if !status.is_client_error() && !status.is_server_error() {
3950 let content = resp.text().await?;
3951 match content_type {
3952 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3953 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetOrderV3Resp`"))),
3954 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetOrderV3Resp`")))),
3955 }
3956 } else {
3957 let content = resp.text().await?;
3958 let entity: Option<GetOrderV3Error> = serde_json::from_str(&content).ok();
3959 Err(Error::ResponseError(ResponseContent { status, content, entity }))
3960 }
3961}
3962
3963pub async fn get_ping_v3(configuration: &configuration::Configuration) -> Result<serde_json::Value, Error<GetPingV3Error>> {
3965
3966 let uri_str = format!("{}/api/v3/ping", configuration.base_path);
3967 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3968
3969 let mut query_params: Vec<(String, String)> = Vec::new();
3971
3972
3973 let mut header_params = std::collections::HashMap::new();
3975
3976 if let Some(ref binance_auth) = configuration.binance_auth {
3978 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
3980
3981 let body_string: Option<Vec<u8>> = None;
3983
3984 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
3986 Ok(sig) => sig,
3987 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
3988 };
3989
3990 query_params.push(("signature".to_string(), signature));
3992 }
3993
3994 if !query_params.is_empty() {
3996 req_builder = req_builder.query(&query_params);
3997 }
3998
3999
4000 if let Some(ref user_agent) = configuration.user_agent {
4002 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4003 }
4004
4005 for (header_name, header_value) in header_params {
4007 req_builder = req_builder.header(&header_name, &header_value);
4008 }
4009
4010
4011 let req = req_builder.build()?;
4012 let resp = configuration.client.execute(req).await?;
4013
4014 let status = resp.status();
4015 let content_type = resp
4016 .headers()
4017 .get("content-type")
4018 .and_then(|v| v.to_str().ok())
4019 .unwrap_or("application/octet-stream");
4020 let content_type = super::ContentType::from(content_type);
4021
4022 if !status.is_client_error() && !status.is_server_error() {
4023 let content = resp.text().await?;
4024 match content_type {
4025 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4026 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `serde_json::Value`"))),
4027 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `serde_json::Value`")))),
4028 }
4029 } else {
4030 let content = resp.text().await?;
4031 let entity: Option<GetPingV3Error> = serde_json::from_str(&content).ok();
4032 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4033 }
4034}
4035
4036pub async fn get_rate_limit_order_v3(configuration: &configuration::Configuration, params: GetRateLimitOrderV3Params) -> Result<Vec<models::GetRateLimitOrderV3RespItem>, Error<GetRateLimitOrderV3Error>> {
4038
4039 let uri_str = format!("{}/api/v3/rateLimit/order", configuration.base_path);
4040 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4041
4042 let mut query_params: Vec<(String, String)> = Vec::new();
4044
4045 if let Some(ref param_value) = params.recv_window {
4046 query_params.push(("recvWindow".to_string(), param_value.to_string()));
4047 }
4048 query_params.push(("timestamp".to_string(), params.timestamp.to_string()));
4049
4050 let mut header_params = std::collections::HashMap::new();
4052
4053 if let Some(ref binance_auth) = configuration.binance_auth {
4055 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
4057
4058 let body_string: Option<Vec<u8>> = None;
4060
4061 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
4063 Ok(sig) => sig,
4064 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
4065 };
4066
4067 query_params.push(("signature".to_string(), signature));
4069 }
4070
4071 if !query_params.is_empty() {
4073 req_builder = req_builder.query(&query_params);
4074 }
4075
4076
4077 if let Some(ref user_agent) = configuration.user_agent {
4079 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4080 }
4081
4082 for (header_name, header_value) in header_params {
4084 req_builder = req_builder.header(&header_name, &header_value);
4085 }
4086
4087
4088 let req = req_builder.build()?;
4089 let resp = configuration.client.execute(req).await?;
4090
4091 let status = resp.status();
4092 let content_type = resp
4093 .headers()
4094 .get("content-type")
4095 .and_then(|v| v.to_str().ok())
4096 .unwrap_or("application/octet-stream");
4097 let content_type = super::ContentType::from(content_type);
4098
4099 if !status.is_client_error() && !status.is_server_error() {
4100 let content = resp.text().await?;
4101 match content_type {
4102 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4103 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetRateLimitOrderV3RespItem>`"))),
4104 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::GetRateLimitOrderV3RespItem>`")))),
4105 }
4106 } else {
4107 let content = resp.text().await?;
4108 let entity: Option<GetRateLimitOrderV3Error> = serde_json::from_str(&content).ok();
4109 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4110 }
4111}
4112
4113pub async fn get_ticker24hr_v3(configuration: &configuration::Configuration, params: GetTicker24hrV3Params) -> Result<models::SpotGetTicker24hrV3Resp, Error<GetTicker24hrV3Error>> {
4115
4116 let uri_str = format!("{}/api/v3/ticker/24hr", configuration.base_path);
4117 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4118
4119 let mut query_params: Vec<(String, String)> = Vec::new();
4121
4122 if let Some(ref param_value) = params.symbol {
4123 query_params.push(("symbol".to_string(), param_value.to_string()));
4124 }
4125 if let Some(ref param_value) = params.symbols {
4126 query_params.push(("symbols".to_string(), param_value.to_string()));
4127 }
4128 if let Some(ref param_value) = params.r#type {
4129 query_params.push(("type".to_string(), param_value.to_string()));
4130 }
4131
4132 let mut header_params = std::collections::HashMap::new();
4134
4135 if let Some(ref binance_auth) = configuration.binance_auth {
4137 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
4139
4140 let body_string: Option<Vec<u8>> = None;
4142
4143 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
4145 Ok(sig) => sig,
4146 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
4147 };
4148
4149 query_params.push(("signature".to_string(), signature));
4151 }
4152
4153 if !query_params.is_empty() {
4155 req_builder = req_builder.query(&query_params);
4156 }
4157
4158
4159 if let Some(ref user_agent) = configuration.user_agent {
4161 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4162 }
4163
4164 for (header_name, header_value) in header_params {
4166 req_builder = req_builder.header(&header_name, &header_value);
4167 }
4168
4169
4170 let req = req_builder.build()?;
4171 let resp = configuration.client.execute(req).await?;
4172
4173 let status = resp.status();
4174 let content_type = resp
4175 .headers()
4176 .get("content-type")
4177 .and_then(|v| v.to_str().ok())
4178 .unwrap_or("application/octet-stream");
4179 let content_type = super::ContentType::from(content_type);
4180
4181 if !status.is_client_error() && !status.is_server_error() {
4182 let content = resp.text().await?;
4183 match content_type {
4184 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4185 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SpotGetTicker24hrV3Resp`"))),
4186 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::SpotGetTicker24hrV3Resp`")))),
4187 }
4188 } else {
4189 let content = resp.text().await?;
4190 let entity: Option<GetTicker24hrV3Error> = serde_json::from_str(&content).ok();
4191 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4192 }
4193}
4194
4195pub async fn get_ticker_book_ticker_v3(configuration: &configuration::Configuration, params: GetTickerBookTickerV3Params) -> Result<models::SpotGetTickerBookTickerV3Resp, Error<GetTickerBookTickerV3Error>> {
4197
4198 let uri_str = format!("{}/api/v3/ticker/bookTicker", configuration.base_path);
4199 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4200
4201 let mut query_params: Vec<(String, String)> = Vec::new();
4203
4204 if let Some(ref param_value) = params.symbol {
4205 query_params.push(("symbol".to_string(), param_value.to_string()));
4206 }
4207 if let Some(ref param_value) = params.symbols {
4208 query_params.push(("symbols".to_string(), param_value.to_string()));
4209 }
4210
4211 let mut header_params = std::collections::HashMap::new();
4213
4214 if let Some(ref binance_auth) = configuration.binance_auth {
4216 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
4218
4219 let body_string: Option<Vec<u8>> = None;
4221
4222 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
4224 Ok(sig) => sig,
4225 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
4226 };
4227
4228 query_params.push(("signature".to_string(), signature));
4230 }
4231
4232 if !query_params.is_empty() {
4234 req_builder = req_builder.query(&query_params);
4235 }
4236
4237
4238 if let Some(ref user_agent) = configuration.user_agent {
4240 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4241 }
4242
4243 for (header_name, header_value) in header_params {
4245 req_builder = req_builder.header(&header_name, &header_value);
4246 }
4247
4248
4249 let req = req_builder.build()?;
4250 let resp = configuration.client.execute(req).await?;
4251
4252 let status = resp.status();
4253 let content_type = resp
4254 .headers()
4255 .get("content-type")
4256 .and_then(|v| v.to_str().ok())
4257 .unwrap_or("application/octet-stream");
4258 let content_type = super::ContentType::from(content_type);
4259
4260 if !status.is_client_error() && !status.is_server_error() {
4261 let content = resp.text().await?;
4262 match content_type {
4263 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4264 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SpotGetTickerBookTickerV3Resp`"))),
4265 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::SpotGetTickerBookTickerV3Resp`")))),
4266 }
4267 } else {
4268 let content = resp.text().await?;
4269 let entity: Option<GetTickerBookTickerV3Error> = serde_json::from_str(&content).ok();
4270 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4271 }
4272}
4273
4274pub async fn get_ticker_price_v3(configuration: &configuration::Configuration, params: GetTickerPriceV3Params) -> Result<models::SpotGetTickerPriceV3Resp, Error<GetTickerPriceV3Error>> {
4276
4277 let uri_str = format!("{}/api/v3/ticker/price", configuration.base_path);
4278 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4279
4280 let mut query_params: Vec<(String, String)> = Vec::new();
4282
4283 if let Some(ref param_value) = params.symbol {
4284 query_params.push(("symbol".to_string(), param_value.to_string()));
4285 }
4286 if let Some(ref param_value) = params.symbols {
4287 query_params.push(("symbols".to_string(), param_value.to_string()));
4288 }
4289
4290 let mut header_params = std::collections::HashMap::new();
4292
4293 if let Some(ref binance_auth) = configuration.binance_auth {
4295 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
4297
4298 let body_string: Option<Vec<u8>> = None;
4300
4301 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
4303 Ok(sig) => sig,
4304 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
4305 };
4306
4307 query_params.push(("signature".to_string(), signature));
4309 }
4310
4311 if !query_params.is_empty() {
4313 req_builder = req_builder.query(&query_params);
4314 }
4315
4316
4317 if let Some(ref user_agent) = configuration.user_agent {
4319 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4320 }
4321
4322 for (header_name, header_value) in header_params {
4324 req_builder = req_builder.header(&header_name, &header_value);
4325 }
4326
4327
4328 let req = req_builder.build()?;
4329 let resp = configuration.client.execute(req).await?;
4330
4331 let status = resp.status();
4332 let content_type = resp
4333 .headers()
4334 .get("content-type")
4335 .and_then(|v| v.to_str().ok())
4336 .unwrap_or("application/octet-stream");
4337 let content_type = super::ContentType::from(content_type);
4338
4339 if !status.is_client_error() && !status.is_server_error() {
4340 let content = resp.text().await?;
4341 match content_type {
4342 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4343 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SpotGetTickerPriceV3Resp`"))),
4344 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::SpotGetTickerPriceV3Resp`")))),
4345 }
4346 } else {
4347 let content = resp.text().await?;
4348 let entity: Option<GetTickerPriceV3Error> = serde_json::from_str(&content).ok();
4349 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4350 }
4351}
4352
4353pub async fn get_ticker_trading_day_v3(configuration: &configuration::Configuration, params: GetTickerTradingDayV3Params) -> Result<models::SpotGetTickerTradingDayV3Resp, Error<GetTickerTradingDayV3Error>> {
4355
4356 let uri_str = format!("{}/api/v3/ticker/tradingDay", configuration.base_path);
4357 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4358
4359 let mut query_params: Vec<(String, String)> = Vec::new();
4361
4362 query_params.push(("symbol".to_string(), params.symbol.to_string()));
4363 query_params.push(("symbols".to_string(), params.symbols.to_string()));
4364 if let Some(ref param_value) = params.time_zone {
4365 query_params.push(("timeZone".to_string(), param_value.to_string()));
4366 }
4367 if let Some(ref param_value) = params.r#type {
4368 query_params.push(("type".to_string(), param_value.to_string()));
4369 }
4370
4371 let mut header_params = std::collections::HashMap::new();
4373
4374 if let Some(ref binance_auth) = configuration.binance_auth {
4376 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
4378
4379 let body_string: Option<Vec<u8>> = None;
4381
4382 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
4384 Ok(sig) => sig,
4385 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
4386 };
4387
4388 query_params.push(("signature".to_string(), signature));
4390 }
4391
4392 if !query_params.is_empty() {
4394 req_builder = req_builder.query(&query_params);
4395 }
4396
4397
4398 if let Some(ref user_agent) = configuration.user_agent {
4400 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4401 }
4402
4403 for (header_name, header_value) in header_params {
4405 req_builder = req_builder.header(&header_name, &header_value);
4406 }
4407
4408
4409 let req = req_builder.build()?;
4410 let resp = configuration.client.execute(req).await?;
4411
4412 let status = resp.status();
4413 let content_type = resp
4414 .headers()
4415 .get("content-type")
4416 .and_then(|v| v.to_str().ok())
4417 .unwrap_or("application/octet-stream");
4418 let content_type = super::ContentType::from(content_type);
4419
4420 if !status.is_client_error() && !status.is_server_error() {
4421 let content = resp.text().await?;
4422 match content_type {
4423 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4424 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SpotGetTickerTradingDayV3Resp`"))),
4425 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::SpotGetTickerTradingDayV3Resp`")))),
4426 }
4427 } else {
4428 let content = resp.text().await?;
4429 let entity: Option<GetTickerTradingDayV3Error> = serde_json::from_str(&content).ok();
4430 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4431 }
4432}
4433
4434pub async fn get_ticker_v3(configuration: &configuration::Configuration, params: GetTickerV3Params) -> Result<models::SpotGetTickerV3Resp, Error<GetTickerV3Error>> {
4436
4437 let uri_str = format!("{}/api/v3/ticker", configuration.base_path);
4438 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4439
4440 let mut query_params: Vec<(String, String)> = Vec::new();
4442
4443 query_params.push(("symbol".to_string(), params.symbol.to_string()));
4444 query_params.push(("symbols".to_string(), params.symbols.to_string()));
4445 if let Some(ref param_value) = params.window_size {
4446 query_params.push(("windowSize".to_string(), param_value.to_string()));
4447 }
4448 if let Some(ref param_value) = params.r#type {
4449 query_params.push(("type".to_string(), param_value.to_string()));
4450 }
4451
4452 let mut header_params = std::collections::HashMap::new();
4454
4455 if let Some(ref binance_auth) = configuration.binance_auth {
4457 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
4459
4460 let body_string: Option<Vec<u8>> = None;
4462
4463 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
4465 Ok(sig) => sig,
4466 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
4467 };
4468
4469 query_params.push(("signature".to_string(), signature));
4471 }
4472
4473 if !query_params.is_empty() {
4475 req_builder = req_builder.query(&query_params);
4476 }
4477
4478
4479 if let Some(ref user_agent) = configuration.user_agent {
4481 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4482 }
4483
4484 for (header_name, header_value) in header_params {
4486 req_builder = req_builder.header(&header_name, &header_value);
4487 }
4488
4489
4490 let req = req_builder.build()?;
4491 let resp = configuration.client.execute(req).await?;
4492
4493 let status = resp.status();
4494 let content_type = resp
4495 .headers()
4496 .get("content-type")
4497 .and_then(|v| v.to_str().ok())
4498 .unwrap_or("application/octet-stream");
4499 let content_type = super::ContentType::from(content_type);
4500
4501 if !status.is_client_error() && !status.is_server_error() {
4502 let content = resp.text().await?;
4503 match content_type {
4504 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4505 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SpotGetTickerV3Resp`"))),
4506 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::SpotGetTickerV3Resp`")))),
4507 }
4508 } else {
4509 let content = resp.text().await?;
4510 let entity: Option<GetTickerV3Error> = serde_json::from_str(&content).ok();
4511 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4512 }
4513}
4514
4515pub async fn get_time_v3(configuration: &configuration::Configuration) -> Result<models::GetTimeV3Resp, Error<GetTimeV3Error>> {
4517
4518 let uri_str = format!("{}/api/v3/time", configuration.base_path);
4519 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4520
4521 let mut query_params: Vec<(String, String)> = Vec::new();
4523
4524
4525 let mut header_params = std::collections::HashMap::new();
4527
4528 if let Some(ref binance_auth) = configuration.binance_auth {
4530 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
4532
4533 let body_string: Option<Vec<u8>> = None;
4535
4536 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
4538 Ok(sig) => sig,
4539 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
4540 };
4541
4542 query_params.push(("signature".to_string(), signature));
4544 }
4545
4546 if !query_params.is_empty() {
4548 req_builder = req_builder.query(&query_params);
4549 }
4550
4551
4552 if let Some(ref user_agent) = configuration.user_agent {
4554 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4555 }
4556
4557 for (header_name, header_value) in header_params {
4559 req_builder = req_builder.header(&header_name, &header_value);
4560 }
4561
4562
4563 let req = req_builder.build()?;
4564 let resp = configuration.client.execute(req).await?;
4565
4566 let status = resp.status();
4567 let content_type = resp
4568 .headers()
4569 .get("content-type")
4570 .and_then(|v| v.to_str().ok())
4571 .unwrap_or("application/octet-stream");
4572 let content_type = super::ContentType::from(content_type);
4573
4574 if !status.is_client_error() && !status.is_server_error() {
4575 let content = resp.text().await?;
4576 match content_type {
4577 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4578 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetTimeV3Resp`"))),
4579 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetTimeV3Resp`")))),
4580 }
4581 } else {
4582 let content = resp.text().await?;
4583 let entity: Option<GetTimeV3Error> = serde_json::from_str(&content).ok();
4584 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4585 }
4586}
4587
4588pub async fn get_trades_v3(configuration: &configuration::Configuration, params: GetTradesV3Params) -> Result<Vec<models::GetTradesV3RespItem>, Error<GetTradesV3Error>> {
4590
4591 let uri_str = format!("{}/api/v3/trades", configuration.base_path);
4592 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4593
4594 let mut query_params: Vec<(String, String)> = Vec::new();
4596
4597 query_params.push(("symbol".to_string(), params.symbol.to_string()));
4598 if let Some(ref param_value) = params.limit {
4599 query_params.push(("limit".to_string(), param_value.to_string()));
4600 }
4601
4602 let mut header_params = std::collections::HashMap::new();
4604
4605 if let Some(ref binance_auth) = configuration.binance_auth {
4607 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
4609
4610 let body_string: Option<Vec<u8>> = None;
4612
4613 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
4615 Ok(sig) => sig,
4616 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
4617 };
4618
4619 query_params.push(("signature".to_string(), signature));
4621 }
4622
4623 if !query_params.is_empty() {
4625 req_builder = req_builder.query(&query_params);
4626 }
4627
4628
4629 if let Some(ref user_agent) = configuration.user_agent {
4631 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4632 }
4633
4634 for (header_name, header_value) in header_params {
4636 req_builder = req_builder.header(&header_name, &header_value);
4637 }
4638
4639
4640 let req = req_builder.build()?;
4641 let resp = configuration.client.execute(req).await?;
4642
4643 let status = resp.status();
4644 let content_type = resp
4645 .headers()
4646 .get("content-type")
4647 .and_then(|v| v.to_str().ok())
4648 .unwrap_or("application/octet-stream");
4649 let content_type = super::ContentType::from(content_type);
4650
4651 if !status.is_client_error() && !status.is_server_error() {
4652 let content = resp.text().await?;
4653 match content_type {
4654 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4655 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GetTradesV3RespItem>`"))),
4656 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::GetTradesV3RespItem>`")))),
4657 }
4658 } else {
4659 let content = resp.text().await?;
4660 let entity: Option<GetTradesV3Error> = serde_json::from_str(&content).ok();
4661 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4662 }
4663}
4664
4665pub async fn get_ui_klines_v3(configuration: &configuration::Configuration, params: GetUiKlinesV3Params) -> Result<Vec<Vec<models::GetKlinesV3200ResponseInnerInner>>, Error<GetUiKlinesV3Error>> {
4667
4668 let uri_str = format!("{}/api/v3/uiKlines", configuration.base_path);
4669 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4670
4671 let mut query_params: Vec<(String, String)> = Vec::new();
4673
4674 query_params.push(("symbol".to_string(), params.symbol.to_string()));
4675 query_params.push(("interval".to_string(), params.interval.to_string()));
4676 if let Some(ref param_value) = params.start_time {
4677 query_params.push(("startTime".to_string(), param_value.to_string()));
4678 }
4679 if let Some(ref param_value) = params.end_time {
4680 query_params.push(("endTime".to_string(), param_value.to_string()));
4681 }
4682 if let Some(ref param_value) = params.time_zone {
4683 query_params.push(("timeZone".to_string(), param_value.to_string()));
4684 }
4685 if let Some(ref param_value) = params.limit {
4686 query_params.push(("limit".to_string(), param_value.to_string()));
4687 }
4688
4689 let mut header_params = std::collections::HashMap::new();
4691
4692 if let Some(ref binance_auth) = configuration.binance_auth {
4694 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
4696
4697 let body_string: Option<Vec<u8>> = None;
4699
4700 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
4702 Ok(sig) => sig,
4703 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
4704 };
4705
4706 query_params.push(("signature".to_string(), signature));
4708 }
4709
4710 if !query_params.is_empty() {
4712 req_builder = req_builder.query(&query_params);
4713 }
4714
4715
4716 if let Some(ref user_agent) = configuration.user_agent {
4718 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4719 }
4720
4721 for (header_name, header_value) in header_params {
4723 req_builder = req_builder.header(&header_name, &header_value);
4724 }
4725
4726
4727 let req = req_builder.build()?;
4728 let resp = configuration.client.execute(req).await?;
4729
4730 let status = resp.status();
4731 let content_type = resp
4732 .headers()
4733 .get("content-type")
4734 .and_then(|v| v.to_str().ok())
4735 .unwrap_or("application/octet-stream");
4736 let content_type = super::ContentType::from(content_type);
4737
4738 if !status.is_client_error() && !status.is_server_error() {
4739 let content = resp.text().await?;
4740 match content_type {
4741 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4742 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<Vec<models::GetKlinesV3200ResponseInnerInner>>`"))),
4743 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<Vec<models::GetKlinesV3200ResponseInnerInner>>`")))),
4744 }
4745 } else {
4746 let content = resp.text().await?;
4747 let entity: Option<GetUiKlinesV3Error> = serde_json::from_str(&content).ok();
4748 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4749 }
4750}
4751
4752pub async fn update_user_data_stream_v3(configuration: &configuration::Configuration, params: UpdateUserDataStreamV3Params) -> Result<serde_json::Value, Error<UpdateUserDataStreamV3Error>> {
4754
4755 let uri_str = format!("{}/api/v3/userDataStream", configuration.base_path);
4756 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
4757
4758 let mut query_params: Vec<(String, String)> = Vec::new();
4760
4761
4762 let mut header_params = std::collections::HashMap::new();
4764
4765 if let Some(ref binance_auth) = configuration.binance_auth {
4767 header_params.insert("X-MBX-APIKEY".to_string(), binance_auth.api_key().to_string());
4769
4770 let body_string: Option<Vec<u8>> = None;
4772
4773 let signature = match binance_auth.sign(Some(&query_params), body_string.as_deref()) {
4775 Ok(sig) => sig,
4776 Err(e) => return Err(Error::Generic(format!("Failed to sign request: {}", e))),
4777 };
4778
4779 query_params.push(("signature".to_string(), signature));
4781 }
4782
4783 if !query_params.is_empty() {
4785 req_builder = req_builder.query(&query_params);
4786 }
4787
4788
4789 if let Some(ref user_agent) = configuration.user_agent {
4791 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4792 }
4793
4794 for (header_name, header_value) in header_params {
4796 req_builder = req_builder.header(&header_name, &header_value);
4797 }
4798
4799 let mut multipart_form_params = std::collections::HashMap::new();
4800 multipart_form_params.insert("listenKey", params.listen_key.to_string());
4801 req_builder = req_builder.form(&multipart_form_params);
4802
4803 let req = req_builder.build()?;
4804 let resp = configuration.client.execute(req).await?;
4805
4806 let status = resp.status();
4807 let content_type = resp
4808 .headers()
4809 .get("content-type")
4810 .and_then(|v| v.to_str().ok())
4811 .unwrap_or("application/octet-stream");
4812 let content_type = super::ContentType::from(content_type);
4813
4814 if !status.is_client_error() && !status.is_server_error() {
4815 let content = resp.text().await?;
4816 match content_type {
4817 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4818 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `serde_json::Value`"))),
4819 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `serde_json::Value`")))),
4820 }
4821 } else {
4822 let content = resp.text().await?;
4823 let entity: Option<UpdateUserDataStreamV3Error> = serde_json::from_str(&content).ok();
4824 Err(Error::ResponseError(ResponseContent { status, content, entity }))
4825 }
4826}
4827