use crate::error::OkxResult;
use crate::rest::RestClient;
use crate::types::request::account::*;
use crate::types::response::account::*;
impl RestClient {
pub async fn get_balance(&self, params: &GetBalanceRequest) -> OkxResult<Vec<AccountBalance>> {
self.get_signed("/api/v5/account/balance", Some(params))
.await
}
pub async fn get_positions(&self, params: &GetPositionsRequest) -> OkxResult<Vec<Position>> {
self.get_signed("/api/v5/account/positions", Some(params))
.await
}
pub async fn get_positions_history(
&self,
params: &GetPositionsHistoryRequest,
) -> OkxResult<Vec<Position>> {
self.get_signed("/api/v5/account/positions-history", Some(params))
.await
}
pub async fn get_account_position_risk(
&self,
params: &GetAccountPositionRiskRequest,
) -> OkxResult<Vec<AccountRiskState>> {
self.get_signed("/api/v5/account/account-position-risk", Some(params))
.await
}
pub async fn get_bills(&self, params: &GetBillsRequest) -> OkxResult<Vec<serde_json::Value>> {
self.get_signed("/api/v5/account/bills", Some(params)).await
}
pub async fn get_bills_archive(
&self,
params: &GetBillsRequest,
) -> OkxResult<Vec<serde_json::Value>> {
self.get_signed("/api/v5/account/bills-archive", Some(params))
.await
}
pub async fn get_account_config(&self) -> OkxResult<Vec<AccountConfig>> {
self.get_signed::<AccountConfig, ()>("/api/v5/account/config", None)
.await
}
pub async fn set_position_mode(
&self,
params: &SetPositionModeRequest,
) -> OkxResult<Vec<SetResult>> {
self.post_signed("/api/v5/account/set-position-mode", params)
.await
}
pub async fn set_leverage(&self, params: &SetLeverageRequest) -> OkxResult<Vec<LeverageInfo>> {
self.post_signed("/api/v5/account/set-leverage", params)
.await
}
pub async fn get_leverage(&self, params: &GetLeverageRequest) -> OkxResult<Vec<LeverageInfo>> {
self.get_signed("/api/v5/account/leverage-info", Some(params))
.await
}
pub async fn get_max_buy_sell_amount(
&self,
params: &GetMaxBuySellAmountRequest,
) -> OkxResult<Vec<MaxBuySellAmount>> {
self.get_signed("/api/v5/account/max-size", Some(params))
.await
}
pub async fn get_max_avail_size(
&self,
params: &GetMaxAvailSizeRequest,
) -> OkxResult<Vec<serde_json::Value>> {
self.get_signed("/api/v5/account/max-avail-size", Some(params))
.await
}
pub async fn get_max_loan(
&self,
params: &GetMaxLoanRequest,
) -> OkxResult<Vec<serde_json::Value>> {
self.get_signed("/api/v5/account/max-loan", Some(params))
.await
}
pub async fn get_fee_rates(&self, params: &GetFeeRatesRequest) -> OkxResult<Vec<FeeRate>> {
self.get_signed("/api/v5/account/trade-fee", Some(params))
.await
}
pub async fn get_interest_accrued(
&self,
params: &GetInterestAccruedRequest,
) -> OkxResult<Vec<serde_json::Value>> {
self.get_signed("/api/v5/account/interest-accrued", Some(params))
.await
}
pub async fn get_interest_rate(&self) -> OkxResult<Vec<serde_json::Value>> {
self.get_signed::<serde_json::Value, ()>("/api/v5/account/interest-rate", None)
.await
}
pub async fn get_max_withdrawals(
&self,
params: &GetMaxWithdrawalsRequest,
) -> OkxResult<Vec<MaxWithdrawal>> {
self.get_signed("/api/v5/account/max-withdrawal", Some(params))
.await
}
pub async fn set_greeks(&self, params: &SetGreeksRequest) -> OkxResult<Vec<SetResult>> {
self.post_signed("/api/v5/account/set-greeks", params).await
}
pub async fn set_isolated_mode(
&self,
params: &SetIsolatedModeRequest,
) -> OkxResult<Vec<SetResult>> {
self.post_signed("/api/v5/account/set-isolated-mode", params)
.await
}
pub async fn get_account_risk_state(&self) -> OkxResult<Vec<AccountRiskState>> {
self.get_signed::<AccountRiskState, ()>("/api/v5/account/risk-state", None)
.await
}
pub async fn set_mmp_config(&self, params: &SetMmpConfigRequest) -> OkxResult<Vec<SetResult>> {
self.post_signed("/api/v5/account/mmp-config", params).await
}
pub async fn get_mmp_config(&self, params: &GetMmpConfigRequest) -> OkxResult<Vec<MmpConfig>> {
self.get_signed("/api/v5/account/mmp-config", Some(params))
.await
}
pub async fn set_account_level(
&self,
params: &SetAccountLevelRequest,
) -> OkxResult<Vec<SetResult>> {
self.post_signed("/api/v5/account/set-account-level", params)
.await
}
pub async fn change_position_margin(
&self,
params: &ChangePositionMarginRequest,
) -> OkxResult<Vec<serde_json::Value>> {
self.post_signed("/api/v5/account/position/margin-balance", params)
.await
}
pub async fn borrow_repay(
&self,
params: &BorrowRepayRequest,
) -> OkxResult<Vec<serde_json::Value>> {
self.post_signed("/api/v5/account/borrow-repay", params)
.await
}
pub async fn get_borrow_repay_history(
&self,
params: &GetBorrowRepayHistoryRequest,
) -> OkxResult<Vec<serde_json::Value>> {
self.get_signed("/api/v5/account/borrow-repay-history", Some(params))
.await
}
pub async fn get_greeks(&self, params: &GetGreeksRequest) -> OkxResult<Vec<serde_json::Value>> {
self.get_signed("/api/v5/account/greeks", Some(params))
.await
}
pub async fn set_auto_loan(&self, params: &SetAutoLoanRequest) -> OkxResult<Vec<SetResult>> {
self.post_signed("/api/v5/account/set-auto-loan", params)
.await
}
pub async fn get_account_bill_subtypes(
&self,
params: &GetAccountBillSubtypesRequest,
) -> OkxResult<Vec<AccountBillTypeDefinition>> {
self.get_signed("/api/v5/account/subtypes", Some(params))
.await
}
pub async fn request_bills_history_archive(
&self,
params: &BillsHistoryArchiveRequest,
) -> OkxResult<Vec<AccountHistoryBill>> {
self.post_signed("/api/v5/account/bills-history-archive", params)
.await
}
pub async fn get_bills_history_archive_link(
&self,
params: &BillsHistoryArchiveRequest,
) -> OkxResult<Vec<AccountHistoryBill>> {
self.get_signed("/api/v5/account/bills-history-archive", Some(params))
.await
}
pub async fn set_trading_config(
&self,
params: &SetTradingConfigRequest,
) -> OkxResult<Vec<SetTradingConfigResult>> {
self.post_signed("/api/v5/account/set-trading-config", params)
.await
}
pub async fn precheck_set_delta_neutral(
&self,
params: &PrecheckSetDeltaNeutralRequest,
) -> OkxResult<Vec<PrecheckSetDeltaNeutralResult>> {
self.get_signed("/api/v5/account/precheck-set-delta-neutral", Some(params))
.await
}
pub async fn move_positions(
&self,
params: &MovePositionsRequest,
) -> OkxResult<Vec<MovePositionsResult>> {
self.post_signed("/api/v5/account/move-positions", params)
.await
}
pub async fn get_move_positions_history(
&self,
params: &GetMovePositionsHistoryRequest,
) -> OkxResult<Vec<MovePositionsResult>> {
self.get_signed("/api/v5/account/move-positions-history", Some(params))
.await
}
}