binance-sdk 70.1.1

This is a lightweight library that works as a connector to the Binance public API.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
/*
 * Stocks Trading REST API
 *
 * REST APIs for Binance Stocks Trading. All endpoints under `/sapi/v1/equity/_*`.
 *
 * The version of the OpenAPI document: 1.0.0
 *
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

#![allow(unused_imports)]
use http::Method;
use serde::de::DeserializeOwned;
use serde_json::Value;
use std::collections::BTreeMap;

use crate::common::{config::ConfigurationRestApi, models::RestApiResponse, utils::send_request};

mod apis;
mod models;

pub use apis::*;
pub use models::*;

#[derive(Debug, Clone)]
pub struct RestApi {
    configuration: ConfigurationRestApi,
    account_api_client: AccountApiClient,
    market_data_api_client: MarketDataApiClient,
    tokenized_api_client: TokenizedApiClient,
    trade_api_client: TradeApiClient,
    user_data_streams_api_client: UserDataStreamsApiClient,
}

impl RestApi {
    pub fn new(configuration: ConfigurationRestApi) -> Self {
        let account_api_client = AccountApiClient::new(configuration.clone());
        let market_data_api_client = MarketDataApiClient::new(configuration.clone());
        let tokenized_api_client = TokenizedApiClient::new(configuration.clone());
        let trade_api_client = TradeApiClient::new(configuration.clone());
        let user_data_streams_api_client = UserDataStreamsApiClient::new(configuration.clone());

        Self {
            configuration,
            account_api_client,
            market_data_api_client,
            tokenized_api_client,
            trade_api_client,
            user_data_streams_api_client,
        }
    }

    /// Send an unsigned request to the API
    ///
    /// # Arguments
    ///
    /// * `endpoint` - The API endpoint to send the request to
    /// * `method` - The HTTP method to use for the request
    /// * `query_params` - A map of query parameters to send with the request
    /// * `body_params` - A map of body parameters to send with the request
    ///
    /// # Returns
    ///
    /// A `RestApiResponse` containing the deserialized response data on success, or an error if the request fails
    ///
    /// # Errors
    ///
    /// Returns an `anyhow::Error` if the HTTP request fails or if parsing the response fails
    pub async fn send_request<R: DeserializeOwned + Send + 'static>(
        &self,
        endpoint: &str,
        method: Method,
        query_params: BTreeMap<String, Value>,
        body_params: BTreeMap<String, Value>,
    ) -> anyhow::Result<RestApiResponse<R>> {
        send_request::<R>(
            &self.configuration,
            endpoint,
            method,
            query_params,
            body_params,
            None,
            false,
        )
        .await
    }

    /// Send a signed request to the API
    ///
    /// # Arguments
    ///
    /// * `endpoint` - The API endpoint to send the request to
    /// * `method` - The HTTP method to use for the request
    /// * `query_params` - A map of query parameters to send with the request
    /// * `body_params` - A map of body parameters to send with the request
    ///
    /// # Returns
    ///
    /// A `RestApiResponse` containing the deserialized response data on success, or an error if the request fails
    ///
    /// # Errors
    ///
    /// Returns an `anyhow::Error` if the HTTP request fails or if parsing the response fails
    pub async fn send_signed_request<R: DeserializeOwned + Send + 'static>(
        &self,
        endpoint: &str,
        method: Method,
        query_params: BTreeMap<String, Value>,
        body_params: BTreeMap<String, Value>,
    ) -> anyhow::Result<RestApiResponse<R>> {
        send_request::<R>(
            &self.configuration,
            endpoint,
            method,
            query_params,
            body_params,
            None,
            true,
        )
        .await
    }

    /// Sign US Equity Disclaimer (TRADE)
    ///
    /// Records the user's acknowledgement and acceptance of the US equity disclaimer. This must be completed before the account can access certain US equity trading features. The acceptance is tied to the account associated with the API key.
    ///
    /// Weight: 1
    ///
    /// Security Type: TRADE
    ///
    /// # Arguments
    ///
    /// - `params`: [`SignUsEquityDisclaimerParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::SignUsEquityDisclaimerResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will return an [`anyhow::Error`] if:
    /// - the HTTP request fails
    /// - any parameter is invalid
    /// - the response cannot be parsed
    /// - or one of the following occurs:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/en/docs/catalog/advanced-trading-stocks-trading/api/rest-api/account#sign-us-equity-disclaimer).
    ///
    pub async fn sign_us_equity_disclaimer(
        &self,
        params: SignUsEquityDisclaimerParams,
    ) -> anyhow::Result<RestApiResponse<models::SignUsEquityDisclaimerResponse>> {
        self.account_api_client
            .sign_us_equity_disclaimer(params)
            .await
    }

    /// Exchange Info (`MARKET_DATA`)
    ///
    /// Returns current exchange trading rules and the list of tradable US-equity symbols. `MARKET_DATA` endpoint — requires an API key (`X-MBX-APIKEY`) but no signature. Response is served from a server-side cache.
    ///
    /// Weight: 1
    ///
    /// Security Type: `MARKET_DATA`
    ///
    /// # Arguments
    ///
    /// - `params`: [`ExchangeInfoParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::ExchangeInfoResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will return an [`anyhow::Error`] if:
    /// - the HTTP request fails
    /// - any parameter is invalid
    /// - the response cannot be parsed
    /// - or one of the following occurs:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/en/docs/catalog/advanced-trading-stocks-trading/api/rest-api/market-data#exchange-info).
    ///
    pub async fn exchange_info(
        &self,
        params: ExchangeInfoParams,
    ) -> anyhow::Result<RestApiResponse<models::ExchangeInfoResponse>> {
        self.market_data_api_client.exchange_info(params).await
    }

    /// Latest Quote (`MARKET_DATA`)
    ///
    /// Returns the latest best bid / best ask for a single US-equity ticker. The returned value is at most ~5 seconds stale. Returns an **empty response body** (not the literal `null`) when no quote is available for the supplied ticker (e.g. the ticker is unknown, halted, or de-listed).
    ///
    /// Weight: 1
    ///
    /// Security Type: `MARKET_DATA`
    ///
    /// # Arguments
    ///
    /// - `params`: [`LatestQuoteParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::LatestQuoteResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will return an [`anyhow::Error`] if:
    /// - the HTTP request fails
    /// - any parameter is invalid
    /// - the response cannot be parsed
    /// - or one of the following occurs:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/en/docs/catalog/advanced-trading-stocks-trading/api/rest-api/market-data#latest-quote).
    ///
    pub async fn latest_quote(
        &self,
        params: LatestQuoteParams,
    ) -> anyhow::Result<RestApiResponse<models::LatestQuoteResponse>> {
        self.market_data_api_client.latest_quote(params).await
    }

    /// Tokenized Assets (`MARKET_DATA`)
    ///
    /// Returns the list of all tokenized assets currently available for mint / redeem, together with each asset's underlying equity symbol and conversion multiplier. `MARKET_DATA` endpoint — requires an API key (`X-MBX-APIKEY`) but no signature. Response is served from a server-side cache.
    ///
    /// Weight: 1
    ///
    /// Security Type: `MARKET_DATA`
    ///
    /// # Arguments
    ///
    /// - `params`: [`TokenizedAssetsParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::TokenizedAssetsResponseInner>>`] on success.
    ///
    /// # Errors
    ///
    /// This function will return an [`anyhow::Error`] if:
    /// - the HTTP request fails
    /// - any parameter is invalid
    /// - the response cannot be parsed
    /// - or one of the following occurs:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/en/docs/catalog/advanced-trading-stocks-trading/api/rest-api/market-data#tokenized-assets).
    ///
    pub async fn tokenized_assets(
        &self,
    ) -> anyhow::Result<RestApiResponse<Vec<models::TokenizedAssetsResponseInner>>> {
        self.market_data_api_client.tokenized_assets().await
    }

    /// Tokenized Convert History (`USER_DATA`)
    ///
    /// Paged history of mint / redeem conversions for the caller. Cursor-style pagination — supply the `nextLastId` from the previous page's response to fetch the next page.
    ///
    /// Weight: 1
    ///
    /// Security Type: `USER_DATA`
    ///
    /// # Arguments
    ///
    /// - `params`: [`TokenizedConvertHistoryParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::TokenizedConvertHistoryResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will return an [`anyhow::Error`] if:
    /// - the HTTP request fails
    /// - any parameter is invalid
    /// - the response cannot be parsed
    /// - or one of the following occurs:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/en/docs/catalog/advanced-trading-stocks-trading/api/rest-api/tokenized#tokenized-convert-history).
    ///
    pub async fn tokenized_convert_history(
        &self,
        params: TokenizedConvertHistoryParams,
    ) -> anyhow::Result<RestApiResponse<models::TokenizedConvertHistoryResponse>> {
        self.tokenized_api_client
            .tokenized_convert_history(params)
            .await
    }

    /// Tokenized Convert Status (`USER_DATA`)
    ///
    /// Query the current status of a single mint / redeem request by its `issuerRequestId`. Returns an empty object when no record matches (caller's ID scope only).
    ///
    /// Weight: 1
    ///
    /// Security Type: `USER_DATA`
    ///
    /// # Arguments
    ///
    /// - `params`: [`TokenizedConvertStatusParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::TokenizedConvertStatusResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will return an [`anyhow::Error`] if:
    /// - the HTTP request fails
    /// - any parameter is invalid
    /// - the response cannot be parsed
    /// - or one of the following occurs:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/en/docs/catalog/advanced-trading-stocks-trading/api/rest-api/tokenized#tokenized-convert-status).
    ///
    pub async fn tokenized_convert_status(
        &self,
        params: TokenizedConvertStatusParams,
    ) -> anyhow::Result<RestApiResponse<models::TokenizedConvertStatusResponse>> {
        self.tokenized_api_client
            .tokenized_convert_status(params)
            .await
    }

    /// Tokenized Mint (TRADE)
    ///
    /// Mint a tokenized asset from an underlying equity holding. The caller's underlying equity (e.g. `AAPL`) is burned (or locked), and the corresponding tokenized asset (e.g. `AAPLB`) is credited. The tokenized asset is resolved server-side from `underlyingAsset`; callers only provide the underlying ticker and quantity. Mint is asynchronous: the endpoint returns an `issuerRequestId` immediately with a transient status; poll `/tokenized/convert-status` to observe the terminal state, or inspect `/tokenized/history` for the full record. Rate limit: 50 requests / min (UID).
    ///
    /// Weight: 1
    ///
    /// Security Type: TRADE
    ///
    /// # Arguments
    ///
    /// - `params`: [`TokenizedMintParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::TokenizedMintResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will return an [`anyhow::Error`] if:
    /// - the HTTP request fails
    /// - any parameter is invalid
    /// - the response cannot be parsed
    /// - or one of the following occurs:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/en/docs/catalog/advanced-trading-stocks-trading/api/rest-api/tokenized#tokenized-mint).
    ///
    pub async fn tokenized_mint(
        &self,
        params: TokenizedMintParams,
    ) -> anyhow::Result<RestApiResponse<models::TokenizedMintResponse>> {
        self.tokenized_api_client.tokenized_mint(params).await
    }

    /// Tokenized Redeem (TRADE)
    ///
    /// Redeem a tokenized asset back into the underlying equity. The caller's tokenized asset (e.g. `AAPLB`) is burned, and the corresponding underlying equity (e.g. `AAPL`) is released. The underlying asset is resolved server-side from `tokenizedAsset`; callers only provide the tokenized asset and quantity. Redeem is asynchronous: the endpoint returns an `issuerRequestId` immediately with a transient status; poll `/tokenized/convert-status` to observe the terminal state, or inspect `/tokenized/history` for the full record. Rate limit: 200 requests / min (UID).
    ///
    /// Weight: 1
    ///
    /// Security Type: TRADE
    ///
    /// # Arguments
    ///
    /// - `params`: [`TokenizedRedeemParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::TokenizedRedeemResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will return an [`anyhow::Error`] if:
    /// - the HTTP request fails
    /// - any parameter is invalid
    /// - the response cannot be parsed
    /// - or one of the following occurs:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/en/docs/catalog/advanced-trading-stocks-trading/api/rest-api/tokenized#tokenized-redeem).
    ///
    pub async fn tokenized_redeem(
        &self,
        params: TokenizedRedeemParams,
    ) -> anyhow::Result<RestApiResponse<models::TokenizedRedeemResponse>> {
        self.tokenized_api_client.tokenized_redeem(params).await
    }

    /// Cancel All Equity Orders (TRADE)
    ///
    /// Cancel all open orders for the caller. No request body is required — the scope is all of the caller's open orders. The downstream service handles idempotency; to inspect per-order outcomes, query `/order/history` after the call.
    ///
    /// Weight: 1
    ///
    /// Security Type: TRADE
    ///
    /// # Arguments
    ///
    /// - `params`: [`CancelAllEquityOrdersParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::CancelAllEquityOrdersResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will return an [`anyhow::Error`] if:
    /// - the HTTP request fails
    /// - any parameter is invalid
    /// - the response cannot be parsed
    /// - or one of the following occurs:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/en/docs/catalog/advanced-trading-stocks-trading/api/rest-api/trade#cancel-all-equity-orders).
    ///
    pub async fn cancel_all_equity_orders(
        &self,
        params: CancelAllEquityOrdersParams,
    ) -> anyhow::Result<RestApiResponse<models::CancelAllEquityOrdersResponse>> {
        self.trade_api_client.cancel_all_equity_orders(params).await
    }

    /// Cancel Equity Order (TRADE)
    ///
    /// Cancel a single open order by its `orderId`.
    ///
    /// Weight: 1
    ///
    /// Security Type: TRADE
    ///
    /// # Arguments
    ///
    /// - `params`: [`CancelEquityOrderParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::CancelEquityOrderResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will return an [`anyhow::Error`] if:
    /// - the HTTP request fails
    /// - any parameter is invalid
    /// - the response cannot be parsed
    /// - or one of the following occurs:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/en/docs/catalog/advanced-trading-stocks-trading/api/rest-api/trade#cancel-equity-order).
    ///
    pub async fn cancel_equity_order(
        &self,
        params: CancelEquityOrderParams,
    ) -> anyhow::Result<RestApiResponse<models::CancelEquityOrderResponse>> {
        self.trade_api_client.cancel_equity_order(params).await
    }

    /// Current Open Orders (`USER_DATA`)
    ///
    /// Query all unfinished (open) orders for the caller. No business parameters are needed — user identity is derived from the signature.
    ///
    /// Weight: 1
    ///
    /// Security Type: `USER_DATA`
    ///
    /// # Arguments
    ///
    /// - `params`: [`CurrentOpenOrdersParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::CurrentOpenOrdersResponseInner>>`] on success.
    ///
    /// # Errors
    ///
    /// This function will return an [`anyhow::Error`] if:
    /// - the HTTP request fails
    /// - any parameter is invalid
    /// - the response cannot be parsed
    /// - or one of the following occurs:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/en/docs/catalog/advanced-trading-stocks-trading/api/rest-api/trade#current-open-orders).
    ///
    pub async fn current_open_orders(
        &self,
        params: CurrentOpenOrdersParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::CurrentOpenOrdersResponseInner>>> {
        self.trade_api_client.current_open_orders(params).await
    }

    /// Equity Order Detail (`USER_DATA`)
    ///
    /// Returns a single order along with its trade execution list. Callers can only read their own orders — the user identity is derived from the signed request.
    ///
    /// Weight: 1
    ///
    /// Security Type: `USER_DATA`
    ///
    /// # Arguments
    ///
    /// - `params`: [`EquityOrderDetailParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::EquityOrderDetailResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will return an [`anyhow::Error`] if:
    /// - the HTTP request fails
    /// - any parameter is invalid
    /// - the response cannot be parsed
    /// - or one of the following occurs:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/en/docs/catalog/advanced-trading-stocks-trading/api/rest-api/trade#equity-order-detail).
    ///
    pub async fn equity_order_detail(
        &self,
        params: EquityOrderDetailParams,
    ) -> anyhow::Result<RestApiResponse<models::EquityOrderDetailResponse>> {
        self.trade_api_client.equity_order_detail(params).await
    }

    /// Equity Order History (`USER_DATA`)
    ///
    /// Paged order history for the caller. Filters by symbol, order type, side, status, and time range.
    ///
    /// Weight: 1
    ///
    /// Security Type: `USER_DATA`
    ///
    /// # Arguments
    ///
    /// - `params`: [`EquityOrderHistoryParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::EquityOrderHistoryResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will return an [`anyhow::Error`] if:
    /// - the HTTP request fails
    /// - any parameter is invalid
    /// - the response cannot be parsed
    /// - or one of the following occurs:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/en/docs/catalog/advanced-trading-stocks-trading/api/rest-api/trade#equity-order-history).
    ///
    pub async fn equity_order_history(
        &self,
        params: EquityOrderHistoryParams,
    ) -> anyhow::Result<RestApiResponse<models::EquityOrderHistoryResponse>> {
        self.trade_api_client.equity_order_history(params).await
    }

    /// Equity Trade History (`USER_DATA`)
    ///
    /// Paged equity trade (per-fill) history for the caller. Each row is one execution, not one order — a partially filled order produces multiple rows. Filters by symbol, side, specific `orderId`, and time range.
    ///
    /// Weight: 1
    ///
    /// Security Type: `USER_DATA`
    ///
    /// # Arguments
    ///
    /// - `params`: [`EquityTradeHistoryParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::EquityTradeHistoryResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will return an [`anyhow::Error`] if:
    /// - the HTTP request fails
    /// - any parameter is invalid
    /// - the response cannot be parsed
    /// - or one of the following occurs:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/en/docs/catalog/advanced-trading-stocks-trading/api/rest-api/trade#equity-trade-history).
    ///
    pub async fn equity_trade_history(
        &self,
        params: EquityTradeHistoryParams,
    ) -> anyhow::Result<RestApiResponse<models::EquityTradeHistoryResponse>> {
        self.trade_api_client.equity_trade_history(params).await
    }

    /// Place Equity Order (TRADE)
    ///
    /// Place a new equity order. Supports all combinations of `LIMIT` / `MARKET` × `BUY` / `SELL`. For `LIMIT BUY` orders the commission fee is automatically computed and reserved by the server at placement time — callers submit `price` and `quantity` only, no `fee` field is required.
    ///
    /// **Field combination matrix**
    ///
    /// | Side | `OrderType` | Required | Forbidden | | ---- | --------- | -------- | --------- | | BUY | LIMIT | `price`, `quantity`, `tradingSession` | `notional` | | BUY | MARKET | `notional` | `price`, `quantity`, `tradingSession` | | SELL | LIMIT | `price`, `quantity`, `tradingSession` | `notional` | | SELL | MARKET | `quantity` | `price`, `notional`, `tradingSession` |
    ///
    /// **Fractional shares**: when `quantity` has a decimal component, or an order is placed by `notional`, it is treated as a fractional-share order. A fractional-share `GTC` order must be paired with `tradingSession = EXTENDED` or `24H`.
    ///
    /// Rate limit: 200 requests / min (UID).
    ///
    /// Weight: 1
    ///
    /// Security Type: TRADE
    ///
    /// # Arguments
    ///
    /// - `params`: [`PlaceEquityOrderParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::PlaceEquityOrderResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will return an [`anyhow::Error`] if:
    /// - the HTTP request fails
    /// - any parameter is invalid
    /// - the response cannot be parsed
    /// - or one of the following occurs:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/en/docs/catalog/advanced-trading-stocks-trading/api/rest-api/trade#place-equity-order).
    ///
    pub async fn place_equity_order(
        &self,
        params: PlaceEquityOrderParams,
    ) -> anyhow::Result<RestApiResponse<models::PlaceEquityOrderResponse>> {
        self.trade_api_client.place_equity_order(params).await
    }

    /// Create / Renew Listen Key (`USER_STREAM`)
    ///
    /// Create a new stock user-data-stream `listenKey`, or renew an existing one. Calling this endpoint for the same user with an active `listenKey` extends its validity; if there is no active key, a new one is issued. Use the returned `listenKey` to subscribe to the stock user data stream.
    ///
    /// Weight: 1
    ///
    /// Security Type: `USER_STREAM`
    ///
    /// # Arguments
    ///
    /// - `params`: [`CreateRenewListenKeyParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::CreateRenewListenKeyResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will return an [`anyhow::Error`] if:
    /// - the HTTP request fails
    /// - any parameter is invalid
    /// - the response cannot be parsed
    /// - or one of the following occurs:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/en/docs/catalog/advanced-trading-stocks-trading/api/rest-api/user-data-streams#create-renew-listen-key).
    ///
    pub async fn create_renew_listen_key(
        &self,
        params: CreateRenewListenKeyParams,
    ) -> anyhow::Result<RestApiResponse<models::CreateRenewListenKeyResponse>> {
        self.user_data_streams_api_client
            .create_renew_listen_key(params)
            .await
    }
}