rust_okx/api/account/api.rs
1use crate::client::OkxClient;
2use crate::error::Error;
3use crate::model::InstType;
4use crate::transport::Transport;
5
6use super::endpoints::*;
7use super::internal::*;
8use super::requests::*;
9use super::responses::*;
10
11/// Accessor for the authenticated account endpoints.
12///
13/// Obtain one via [`OkxClient::account`](crate::OkxClient::account). All methods
14/// require credentials; calling them without credentials returns
15/// [`Error::Configuration`].
16pub struct Account<'a, T> {
17 client: &'a OkxClient<T>,
18}
19
20impl<'a, T: Transport> Account<'a, T> {
21 pub(crate) fn new(client: &'a OkxClient<T>) -> Self {
22 Self { client }
23 }
24
25 /// Retrieve the trading-account balance.
26 ///
27 /// `GET /api/v5/account/balance`. Authenticated. Pass `ccy` to filter to one
28 /// or more comma-separated currencies (e.g. `Some("BTC,USDT")`). The result
29 /// is a single [`AccountBalance`].
30 ///
31 /// # Errors
32 ///
33 /// Returns [`Error::Configuration`] if no credentials are set,
34 /// [`Error::Api`] on a non-zero OKX code, or transport/decode errors.
35 pub async fn get_balance(&self, ccy: Option<&str>) -> Result<Vec<AccountBalance>, Error> {
36 let query = BalanceQuery { ccy };
37 self.client.get(BALANCE, &query, true).await
38 }
39
40 /// Retrieve open positions.
41 ///
42 /// `GET /api/v5/account/positions`. Authenticated. Both filters are
43 /// optional; omit them to return all positions.
44 ///
45 /// # Errors
46 ///
47 /// See [`get_balance`](Self::get_balance).
48 pub async fn get_positions(
49 &self,
50 inst_type: Option<InstType>,
51 inst_id: Option<&str>,
52 ) -> Result<Vec<Position>, Error> {
53 let query = PositionsQuery {
54 inst_type: inst_type.as_ref(),
55 inst_id,
56 };
57 self.client.get(POSITIONS, &query, true).await
58 }
59
60 /// Retrieve account position risk.
61 ///
62 /// `GET /api/v5/account/account-position-risk`. Authenticated.
63 ///
64 /// # Errors
65 ///
66 /// See [`get_balance`](Self::get_balance).
67 pub async fn get_position_risk(
68 &self,
69 inst_type: Option<InstType>,
70 ) -> Result<Vec<PositionRisk>, Error> {
71 let query = PositionRiskQuery {
72 inst_type: inst_type.as_ref(),
73 };
74 self.client.get(POSITION_RISK, &query, true).await
75 }
76
77 /// Retrieve account configuration.
78 ///
79 /// `GET /api/v5/account/config`. Authenticated.
80 ///
81 /// # Errors
82 ///
83 /// See [`get_balance`](Self::get_balance).
84 pub async fn get_account_config(&self) -> Result<Vec<AccountConfig>, Error> {
85 self.client.get(ACCOUNT_CONFIG, &NoQuery, true).await
86 }
87
88 /// Retrieve recent account bills.
89 ///
90 /// `GET /api/v5/account/bills`. Authenticated.
91 ///
92 /// # Errors
93 ///
94 /// See [`get_balance`](Self::get_balance).
95 pub async fn get_account_bills(
96 &self,
97 request: &BillsRequest,
98 ) -> Result<Vec<AccountBill>, Error> {
99 self.client.get(BILLS, request, true).await
100 }
101
102 /// Retrieve archived account bills.
103 ///
104 /// `GET /api/v5/account/bills-archive`. Authenticated.
105 ///
106 /// # Errors
107 ///
108 /// See [`get_balance`](Self::get_balance).
109 pub async fn get_account_bills_archive(
110 &self,
111 request: &BillsArchiveRequest,
112 ) -> Result<Vec<AccountBill>, Error> {
113 self.client.get(BILLS_ARCHIVE, request, true).await
114 }
115
116 /// Set the account position mode.
117 ///
118 /// `POST /api/v5/account/set-position-mode`. Authenticated.
119 ///
120 /// # Errors
121 ///
122 /// See [`get_balance`](Self::get_balance).
123 pub async fn set_position_mode(
124 &self,
125 pos_mode: &str,
126 ) -> Result<Vec<SetPositionModeResult>, Error> {
127 let body = SetPositionModeBody { pos_mode };
128 self.client.post(SET_POSITION_MODE, &body, true).await
129 }
130
131 /// Set leverage for an instrument or currency.
132 ///
133 /// `POST /api/v5/account/set-leverage`. Authenticated.
134 ///
135 /// # Errors
136 ///
137 /// See [`get_balance`](Self::get_balance).
138 pub async fn set_leverage(
139 &self,
140 request: &SetLeverageRequest,
141 ) -> Result<Vec<LeverageInfo>, Error> {
142 self.client.post(SET_LEVERAGE, request, true).await
143 }
144
145 /// Retrieve leverage settings.
146 ///
147 /// `GET /api/v5/account/leverage-info`. Authenticated.
148 ///
149 /// # Errors
150 ///
151 /// See [`get_balance`](Self::get_balance).
152 pub async fn get_leverage(
153 &self,
154 request: &LeverageRequest,
155 ) -> Result<Vec<LeverageInfo>, Error> {
156 self.client.get(GET_LEVERAGE, request, true).await
157 }
158
159 /// Retrieve maximum tradable size for an instrument.
160 ///
161 /// `GET /api/v5/account/max-size`. Authenticated.
162 ///
163 /// # Errors
164 ///
165 /// See [`get_balance`](Self::get_balance).
166 pub async fn get_max_order_size(
167 &self,
168 request: &MaxOrderSizeRequest,
169 ) -> Result<Vec<MaxOrderSize>, Error> {
170 self.client.get(MAX_ORDER_SIZE, request, true).await
171 }
172
173 /// Retrieve maximum available size for an instrument.
174 ///
175 /// `GET /api/v5/account/max-avail-size`. Authenticated.
176 ///
177 /// # Errors
178 ///
179 /// See [`get_balance`](Self::get_balance).
180 pub async fn get_max_avail_size(
181 &self,
182 request: &MaxAvailableSizeRequest,
183 ) -> Result<Vec<MaxAvailableSize>, Error> {
184 self.client.get(MAX_AVAILABLE_SIZE, request, true).await
185 }
186
187 /// Increase or decrease margin for a position.
188 ///
189 /// `POST /api/v5/account/position/margin-balance`. Authenticated.
190 ///
191 /// # Errors
192 ///
193 /// See [`get_balance`](Self::get_balance).
194 pub async fn adjust_margin(
195 &self,
196 request: &AdjustMarginRequest,
197 ) -> Result<Vec<AdjustMarginResult>, Error> {
198 self.client.post(ADJUST_MARGIN, request, true).await
199 }
200
201 /// Retrieve trade fee rates.
202 ///
203 /// `GET /api/v5/account/trade-fee`. Authenticated.
204 ///
205 /// # Errors
206 ///
207 /// See [`get_balance`](Self::get_balance).
208 pub async fn get_fee_rates(&self, request: &FeeRatesRequest) -> Result<Vec<FeeRate>, Error> {
209 self.client.get(FEE_RATES, request, true).await
210 }
211
212 /// Retrieve account-available instruments.
213 ///
214 /// `GET /api/v5/account/instruments`. Authenticated.
215 ///
216 /// # Errors
217 ///
218 /// See [`get_balance`](Self::get_balance).
219 pub async fn get_account_instruments(
220 &self,
221 request: &AccountInstrumentsRequest,
222 ) -> Result<Vec<AccountInstrument>, Error> {
223 self.client.get(ACCOUNT_INSTRUMENTS, request, true).await
224 }
225
226 /// Retrieve the maximum loan amount.
227 ///
228 /// `GET /api/v5/account/max-loan`. Authenticated.
229 ///
230 /// # Errors
231 ///
232 /// See [`get_balance`](Self::get_balance).
233 pub async fn get_max_loan(&self, request: &MaxLoanRequest) -> Result<Vec<MaxLoan>, Error> {
234 self.client.get(MAX_LOAN, request, true).await
235 }
236
237 /// Retrieve interest-accrued records.
238 ///
239 /// `GET /api/v5/account/interest-accrued`. Authenticated.
240 ///
241 /// # Errors
242 ///
243 /// See [`get_balance`](Self::get_balance).
244 pub async fn get_interest_accrued(
245 &self,
246 request: &InterestAccruedRequest,
247 ) -> Result<Vec<InterestAccrued>, Error> {
248 self.client.get(INTEREST_ACCRUED, request, true).await
249 }
250
251 /// Retrieve interest rates.
252 ///
253 /// `GET /api/v5/account/interest-rate`. Authenticated.
254 ///
255 /// # Errors
256 ///
257 /// See [`get_balance`](Self::get_balance).
258 pub async fn get_interest_rate(&self, ccy: Option<&str>) -> Result<Vec<InterestRate>, Error> {
259 let query = BalanceQuery { ccy };
260 self.client.get(INTEREST_RATE, &query, true).await
261 }
262
263 /// Set the greeks display type.
264 ///
265 /// `POST /api/v5/account/set-greeks`. Authenticated.
266 ///
267 /// # Errors
268 ///
269 /// See [`get_balance`](Self::get_balance).
270 pub async fn set_greeks(&self, greeks_type: &str) -> Result<Vec<SetGreeksResult>, Error> {
271 let body = SetGreeksBody { greeks_type };
272 self.client.post(SET_GREEKS, &body, true).await
273 }
274
275 /// Set isolated margin transfer mode.
276 ///
277 /// `POST /api/v5/account/set-isolated-mode`. Authenticated.
278 ///
279 /// # Errors
280 ///
281 /// See [`get_balance`](Self::get_balance).
282 pub async fn set_isolated_mode(
283 &self,
284 iso_mode: &str,
285 mode_type: &str,
286 ) -> Result<Vec<SetIsolatedModeResult>, Error> {
287 let body = SetIsolatedModeBody {
288 iso_mode,
289 mode_type,
290 };
291 self.client.post(SET_ISOLATED_MODE, &body, true).await
292 }
293
294 /// Retrieve maximum withdrawal amounts.
295 ///
296 /// `GET /api/v5/account/max-withdrawal`. Authenticated.
297 ///
298 /// # Errors
299 ///
300 /// See [`get_balance`](Self::get_balance).
301 pub async fn get_max_withdrawal(&self, ccy: Option<&str>) -> Result<Vec<MaxWithdrawal>, Error> {
302 let query = BalanceQuery { ccy };
303 self.client.get(MAX_WITHDRAWAL, &query, true).await
304 }
305
306 /// Borrow or repay margin.
307 ///
308 /// `POST /api/v5/account/borrow-repay`. Authenticated.
309 ///
310 /// # Errors
311 ///
312 /// See [`get_balance`](Self::get_balance).
313 pub async fn borrow_repay(
314 &self,
315 request: &BorrowRepayRequest,
316 ) -> Result<Vec<BorrowRepayResult>, Error> {
317 self.client.post(BORROW_REPAY, request, true).await
318 }
319
320 /// Retrieve borrow/repay history.
321 ///
322 /// `GET /api/v5/account/borrow-repay-history`. Authenticated.
323 ///
324 /// # Errors
325 ///
326 /// See [`get_balance`](Self::get_balance).
327 pub async fn get_borrow_repay_history(
328 &self,
329 request: &BorrowRepayHistoryRequest,
330 ) -> Result<Vec<BorrowRepayHistory>, Error> {
331 self.client.get(BORROW_REPAY_HISTORY, request, true).await
332 }
333
334 /// Retrieve borrowing rate and limit information.
335 ///
336 /// `GET /api/v5/account/interest-limits`. Authenticated.
337 ///
338 /// # Errors
339 ///
340 /// See [`get_balance`](Self::get_balance).
341 pub async fn get_interest_limits(
342 &self,
343 request: &InterestLimitsRequest,
344 ) -> Result<Vec<InterestLimit>, Error> {
345 self.client.get(INTEREST_LIMITS, request, true).await
346 }
347
348 /// Calculate simulated margin information.
349 ///
350 /// `POST /api/v5/account/simulated_margin`. Authenticated. This is separate
351 /// from [`OkxClientBuilder::demo_trading`](crate::OkxClientBuilder::demo_trading),
352 /// which only toggles the OKX simulated-trading header.
353 ///
354 /// # Errors
355 ///
356 /// See [`get_balance`](Self::get_balance).
357 pub async fn get_simulated_margin(
358 &self,
359 request: &SimulatedMarginRequest,
360 ) -> Result<Vec<SimulatedMargin>, Error> {
361 self.client.post(SIMULATED_MARGIN, request, true).await
362 }
363
364 /// Retrieve greeks.
365 ///
366 /// `GET /api/v5/account/greeks`. Authenticated.
367 ///
368 /// # Errors
369 ///
370 /// See [`get_balance`](Self::get_balance).
371 pub async fn get_greeks(&self, ccy: Option<&str>) -> Result<Vec<Greek>, Error> {
372 let query = BalanceQuery { ccy };
373 self.client.get(GREEKS, &query, true).await
374 }
375
376 /// Retrieve position history.
377 ///
378 /// `GET /api/v5/account/positions-history`. Authenticated.
379 ///
380 /// # Errors
381 ///
382 /// See [`get_balance`](Self::get_balance).
383 pub async fn get_positions_history(
384 &self,
385 request: &PositionsHistoryRequest,
386 ) -> Result<Vec<PositionHistory>, Error> {
387 self.client.get(POSITIONS_HISTORY, request, true).await
388 }
389
390 /// Retrieve account position tiers.
391 ///
392 /// `GET /api/v5/account/position-tiers`. Authenticated.
393 ///
394 /// # Errors
395 ///
396 /// See [`get_balance`](Self::get_balance).
397 pub async fn get_account_position_tiers(
398 &self,
399 request: &AccountPositionTiersRequest,
400 ) -> Result<Vec<AccountPositionTier>, Error> {
401 self.client.get(ACCOUNT_POSITION_TIERS, request, true).await
402 }
403
404 /// Retrieve the account risk state.
405 ///
406 /// `GET /api/v5/account/risk-state`. Authenticated.
407 ///
408 /// # Errors
409 ///
410 /// See [`get_balance`](Self::get_balance).
411 pub async fn get_risk_state(&self) -> Result<Vec<RiskState>, Error> {
412 self.client.get(RISK_STATE, &NoQuery, true).await
413 }
414
415 /// Set account risk offset type.
416 ///
417 /// `POST /api/v5/account/set-riskOffset-type`. Authenticated.
418 ///
419 /// # Errors
420 ///
421 /// See [`get_balance`](Self::get_balance).
422 pub async fn set_risk_offset_type(
423 &self,
424 risk_offset_type: &str,
425 ) -> Result<Vec<SetRiskOffsetTypeResult>, Error> {
426 let body = TypeBody {
427 value: risk_offset_type,
428 };
429 self.client.post(SET_RISK_OFFSET_TYPE, &body, true).await
430 }
431
432 /// Set account auto-loan mode.
433 ///
434 /// `POST /api/v5/account/set-auto-loan`. Authenticated.
435 ///
436 /// # Errors
437 ///
438 /// See [`get_balance`](Self::get_balance).
439 pub async fn set_auto_loan(&self, auto_loan: bool) -> Result<Vec<SetAutoLoanResult>, Error> {
440 let body = SetAutoLoanBody { auto_loan };
441 self.client.post(SET_AUTO_LOAN, &body, true).await
442 }
443
444 /// Set the account level.
445 ///
446 /// `POST /api/v5/account/set-account-level`. Authenticated.
447 ///
448 /// # Errors
449 ///
450 /// See [`get_balance`](Self::get_balance).
451 pub async fn set_account_level(
452 &self,
453 acct_lv: &str,
454 ) -> Result<Vec<SetAccountLevelResult>, Error> {
455 let body = SetAccountLevelBody { acct_lv };
456 self.client.post(SET_ACCOUNT_LEVEL, &body, true).await
457 }
458
459 /// Activate option trading.
460 ///
461 /// `POST /api/v5/account/activate-option`. Authenticated.
462 ///
463 /// # Errors
464 ///
465 /// See [`get_balance`](Self::get_balance).
466 pub async fn activate_option(&self) -> Result<Vec<ActivateOptionResult>, Error> {
467 self.client.post(ACTIVATE_OPTION, &EmptyBody {}, true).await
468 }
469
470 /// Build simulated positions and equity.
471 ///
472 /// `POST /api/v5/account/position-builder`. Authenticated.
473 ///
474 /// # Errors
475 ///
476 /// See [`get_balance`](Self::get_balance).
477 pub async fn position_builder(
478 &self,
479 request: &PositionBuilderRequest,
480 ) -> Result<Vec<PositionBuilderResult>, Error> {
481 self.client.post(POSITION_BUILDER, request, true).await
482 }
483
484 /// Retrieve VIP-loan interest accrued records.
485 ///
486 /// `GET /api/v5/account/vip-interest-accrued`. Authenticated.
487 ///
488 /// # Errors
489 ///
490 /// See [`get_balance`](Self::get_balance).
491 pub async fn get_vip_interest_accrued(
492 &self,
493 request: &VipInterestAccruedRequest,
494 ) -> Result<Vec<VipInterestAccrued>, Error> {
495 self.client.get(VIP_INTEREST_ACCRUED, request, true).await
496 }
497
498 /// Retrieve VIP-loan interest deducted records.
499 ///
500 /// `GET /api/v5/account/vip-interest-deducted`. Authenticated.
501 ///
502 /// # Errors
503 ///
504 /// See [`get_balance`](Self::get_balance).
505 pub async fn get_vip_interest_deducted(
506 &self,
507 request: &VipInterestDeductedRequest,
508 ) -> Result<Vec<VipInterestDeducted>, Error> {
509 self.client.get(VIP_INTEREST_DEDUCTED, request, true).await
510 }
511
512 /// Retrieve VIP-loan orders.
513 ///
514 /// `GET /api/v5/account/vip-loan-order-list`. Authenticated.
515 ///
516 /// # Errors
517 ///
518 /// See [`get_balance`](Self::get_balance).
519 pub async fn get_vip_loan_order_list(
520 &self,
521 request: &VipLoanOrderListRequest,
522 ) -> Result<Vec<VipLoanOrder>, Error> {
523 self.client.get(VIP_LOAN_ORDER_LIST, request, true).await
524 }
525
526 /// Retrieve a VIP-loan order detail.
527 ///
528 /// `GET /api/v5/account/vip-loan-order-detail`. Authenticated.
529 ///
530 /// # Errors
531 ///
532 /// See [`get_balance`](Self::get_balance).
533 pub async fn get_vip_loan_order_detail(
534 &self,
535 request: &VipLoanOrderDetailRequest,
536 ) -> Result<Vec<VipLoanOrder>, Error> {
537 self.client.get(VIP_LOAN_ORDER_DETAIL, request, true).await
538 }
539
540 /// Retrieve fixed-loan borrowing limits.
541 ///
542 /// `GET /api/v5/account/fixed-loan/borrowing-limit`. Authenticated.
543 ///
544 /// # Errors
545 ///
546 /// See [`get_balance`](Self::get_balance).
547 pub async fn get_fixed_loan_borrowing_limit(
548 &self,
549 request: &FixedLoanBorrowingLimitRequest,
550 ) -> Result<Vec<FixedLoanBorrowingLimit>, Error> {
551 self.client
552 .get(FIXED_LOAN_BORROWING_LIMIT, request, true)
553 .await
554 }
555
556 /// Request a fixed-loan borrowing quote.
557 ///
558 /// `POST /api/v5/account/fixed-loan/borrowing-quote`. Authenticated.
559 ///
560 /// # Errors
561 ///
562 /// See [`get_balance`](Self::get_balance).
563 pub async fn fixed_loan_borrowing_quote(
564 &self,
565 request: &FixedLoanBorrowingQuoteRequest,
566 ) -> Result<Vec<FixedLoanBorrowingQuote>, Error> {
567 self.client
568 .post(FIXED_LOAN_BORROWING_QUOTE, request, true)
569 .await
570 }
571
572 /// Place a fixed-loan borrowing order.
573 ///
574 /// `POST /api/v5/account/fixed-loan/borrowing-order`. Authenticated.
575 ///
576 /// # Errors
577 ///
578 /// See [`get_balance`](Self::get_balance).
579 pub async fn fixed_loan_borrowing_order(
580 &self,
581 request: &FixedLoanBorrowingOrderRequest,
582 ) -> Result<Vec<FixedLoanBorrowingOrder>, Error> {
583 self.client
584 .post(FIXED_LOAN_BORROWING_ORDER, request, true)
585 .await
586 }
587
588 /// Amend a fixed-loan borrowing order.
589 ///
590 /// `POST /api/v5/account/fixed-loan/amend-borrowing-order`. Authenticated.
591 ///
592 /// # Errors
593 ///
594 /// See [`get_balance`](Self::get_balance).
595 pub async fn amend_fixed_loan_borrowing_order(
596 &self,
597 request: &FixedLoanAmendBorrowingOrderRequest,
598 ) -> Result<Vec<FixedLoanBorrowingOrder>, Error> {
599 self.client
600 .post(FIXED_LOAN_AMEND_BORROWING_ORDER, request, true)
601 .await
602 }
603
604 /// Manually reborrow a fixed-loan order.
605 ///
606 /// `POST /api/v5/account/fixed-loan/manual-reborrow`. Authenticated.
607 ///
608 /// # Errors
609 ///
610 /// See [`get_balance`](Self::get_balance).
611 pub async fn fixed_loan_manual_reborrow(
612 &self,
613 request: &FixedLoanManualReborrowRequest,
614 ) -> Result<Vec<FixedLoanBorrowingOrder>, Error> {
615 self.client
616 .post(FIXED_LOAN_MANUAL_REBORROW, request, true)
617 .await
618 }
619
620 /// Repay a fixed-loan borrowing order.
621 ///
622 /// `POST /api/v5/account/fixed-loan/repay-borrowing-order`. Authenticated.
623 ///
624 /// # Errors
625 ///
626 /// See [`get_balance`](Self::get_balance).
627 pub async fn repay_fixed_loan_borrowing_order(
628 &self,
629 request: &FixedLoanRepayBorrowingOrderRequest,
630 ) -> Result<Vec<FixedLoanBorrowingOrder>, Error> {
631 self.client
632 .post(FIXED_LOAN_REPAY_BORROWING_ORDER, request, true)
633 .await
634 }
635
636 /// Retrieve fixed-loan borrowing orders.
637 ///
638 /// `GET /api/v5/account/fixed-loan/borrowing-orders-list`. Authenticated.
639 ///
640 /// # Errors
641 ///
642 /// See [`get_balance`](Self::get_balance).
643 pub async fn get_fixed_loan_borrowing_orders_list(
644 &self,
645 request: &FixedLoanBorrowingOrdersListRequest,
646 ) -> Result<Vec<FixedLoanBorrowingOrder>, Error> {
647 self.client
648 .get(FIXED_LOAN_BORROWING_ORDERS_LIST, request, true)
649 .await
650 }
651
652 /// Manually borrow or repay spot liabilities.
653 ///
654 /// `POST /api/v5/account/spot-manual-borrow-repay`. Authenticated.
655 ///
656 /// # Errors
657 ///
658 /// See [`get_balance`](Self::get_balance).
659 pub async fn spot_manual_borrow_repay(
660 &self,
661 request: &SpotManualBorrowRepayRequest,
662 ) -> Result<Vec<SpotBorrowRepayResult>, Error> {
663 self.client
664 .post(SPOT_MANUAL_BORROW_REPAY, request, true)
665 .await
666 }
667
668 /// Set automatic repayment for spot borrow/repay.
669 ///
670 /// `POST /api/v5/account/set-auto-repay`. Authenticated.
671 ///
672 /// # Errors
673 ///
674 /// See [`get_balance`](Self::get_balance).
675 pub async fn set_auto_repay(
676 &self,
677 request: &SetAutoRepayRequest,
678 ) -> Result<Vec<SetAutoRepayResult>, Error> {
679 self.client.post(SET_AUTO_REPAY, request, true).await
680 }
681
682 /// Retrieve spot borrow/repay history.
683 ///
684 /// `GET /api/v5/account/spot-borrow-repay-history`. Authenticated.
685 ///
686 /// # Errors
687 ///
688 /// See [`get_balance`](Self::get_balance).
689 pub async fn get_spot_borrow_repay_history(
690 &self,
691 request: &SpotBorrowRepayHistoryRequest,
692 ) -> Result<Vec<SpotBorrowRepayHistory>, Error> {
693 self.client
694 .get(SPOT_BORROW_REPAY_HISTORY, request, true)
695 .await
696 }
697
698 /// Set automatic earn for the account.
699 ///
700 /// `POST /api/v5/account/set-auto-earn`. Authenticated.
701 ///
702 /// # Errors
703 ///
704 /// See [`get_balance`](Self::get_balance).
705 pub async fn set_auto_earn(
706 &self,
707 request: &SetAutoEarnRequest,
708 ) -> Result<Vec<SetAutoEarnResult>, Error> {
709 self.client.post(SET_AUTO_EARN, request, true).await
710 }
711}