pub struct SubAccount<'a, T> { /* private fields */ }Expand description
Accessor for the sub-account management endpoints.
Obtain one via OkxClient::sub_account.
All methods require credentials.
Implementations§
Source§impl<'a, T: Transport> SubAccount<'a, T>
impl<'a, T: Transport> SubAccount<'a, T>
Sourcepub async fn get_subaccount_list(
&self,
request: &SubAccountListRequest,
) -> Result<Vec<SubAccountEntry>, Error>
pub async fn get_subaccount_list( &self, request: &SubAccountListRequest, ) -> Result<Vec<SubAccountEntry>, Error>
List sub-accounts of the master account.
GET /api/v5/users/subaccount/list. Authenticated.
§Errors
Returns [Error::InvalidRequest] if limit is outside 1–100,
[Error::Configuration] if no credentials are set,
[Error::Api] on a non-zero OKX code, or transport/decode errors.
Sourcepub async fn create_subaccount(
&self,
request: &CreateSubAccountRequest,
) -> Result<Vec<SubAccountEntry>, Error>
pub async fn create_subaccount( &self, request: &CreateSubAccountRequest, ) -> Result<Vec<SubAccountEntry>, Error>
Create a new sub-account.
POST /api/v5/users/subaccount/create-subaccount. Authenticated.
§Errors
Returns [Error::Configuration] if no credentials are set,
[Error::Api] on a non-zero OKX code, or transport/decode errors.
Sourcepub async fn create_subaccount_apikey(
&self,
request: &CreateSubAccountApiKeyRequest,
) -> Result<Vec<SubAccountApiKey>, Error>
pub async fn create_subaccount_apikey( &self, request: &CreateSubAccountApiKeyRequest, ) -> Result<Vec<SubAccountApiKey>, Error>
Create an API key for a sub-account.
POST /api/v5/users/subaccount/apikey. Authenticated.
§Errors
Returns [Error::Configuration] if no credentials are set,
[Error::Api] on a non-zero OKX code, or transport/decode errors.
Sourcepub async fn get_subaccount_apikeys(
&self,
request: &SubAccountApiKeysRequest,
) -> Result<Vec<SubAccountApiKey>, Error>
pub async fn get_subaccount_apikeys( &self, request: &SubAccountApiKeysRequest, ) -> Result<Vec<SubAccountApiKey>, Error>
List API keys of a sub-account.
GET /api/v5/users/subaccount/apikey. Authenticated.
§Errors
Returns [Error::Configuration] if no credentials are set,
[Error::Api] on a non-zero OKX code, or transport/decode errors.
Sourcepub async fn modify_subaccount_apikey(
&self,
request: &ModifySubAccountApiKeyRequest,
) -> Result<Vec<SubAccountApiKey>, Error>
pub async fn modify_subaccount_apikey( &self, request: &ModifySubAccountApiKeyRequest, ) -> Result<Vec<SubAccountApiKey>, Error>
Modify an API key of a sub-account.
POST /api/v5/users/subaccount/modify-apikey. Authenticated.
§Errors
Returns [Error::InvalidRequest] if none of label/perm/ip is set,
[Error::Configuration] if no credentials are set,
[Error::Api] on a non-zero OKX code, or transport/decode errors.
Sourcepub async fn delete_subaccount_apikey(
&self,
request: &DeleteSubAccountApiKeyRequest,
) -> Result<Vec<SubAccountApiKey>, Error>
pub async fn delete_subaccount_apikey( &self, request: &DeleteSubAccountApiKeyRequest, ) -> Result<Vec<SubAccountApiKey>, Error>
Delete an API key of a sub-account.
POST /api/v5/users/subaccount/delete-apikey. Authenticated.
§Errors
Returns [Error::Configuration] if no credentials are set,
[Error::Api] on a non-zero OKX code, or transport/decode errors.
Sourcepub async fn get_subaccount_trading_balances(
&self,
request: &SubAccountTradingBalancesRequest,
) -> Result<Vec<SubAccountTradingBalance>, Error>
pub async fn get_subaccount_trading_balances( &self, request: &SubAccountTradingBalancesRequest, ) -> Result<Vec<SubAccountTradingBalance>, Error>
Retrieve trading-account balances of a sub-account.
GET /api/v5/account/subaccount/balances. Authenticated.
§Errors
Returns [Error::Configuration] if no credentials are set,
[Error::Api] on a non-zero OKX code, or transport/decode errors.
Sourcepub async fn get_subaccount_funding_balances(
&self,
request: &SubAccountFundingBalancesRequest,
) -> Result<Vec<SubAccountFundingBalance>, Error>
pub async fn get_subaccount_funding_balances( &self, request: &SubAccountFundingBalancesRequest, ) -> Result<Vec<SubAccountFundingBalance>, Error>
Retrieve funding-account balances of a sub-account.
GET /api/v5/asset/subaccount/balances. Authenticated.
§Errors
Returns [Error::Configuration] if no credentials are set,
[Error::Api] on a non-zero OKX code, or transport/decode errors.
Sourcepub async fn get_subaccount_max_withdrawal(
&self,
request: &SubAccountMaxWithdrawalRequest,
) -> Result<Vec<SubAccountMaxWithdrawal>, Error>
pub async fn get_subaccount_max_withdrawal( &self, request: &SubAccountMaxWithdrawalRequest, ) -> Result<Vec<SubAccountMaxWithdrawal>, Error>
Retrieve the maximum withdrawal amount for a sub-account.
GET /api/v5/account/subaccount/max-withdrawal. Authenticated.
§Errors
Returns [Error::Configuration] if no credentials are set,
[Error::Api] on a non-zero OKX code, or transport/decode errors.
Sourcepub async fn get_subaccount_bills(
&self,
request: &SubAccountBillsRequest,
) -> Result<Vec<SubAccountBill>, Error>
pub async fn get_subaccount_bills( &self, request: &SubAccountBillsRequest, ) -> Result<Vec<SubAccountBill>, Error>
Retrieve asset bills for sub-accounts of the master account.
GET /api/v5/asset/subaccount/bills. Authenticated.
§Errors
Returns [Error::InvalidRequest] if limit is outside 1–100,
[Error::Configuration] if no credentials are set,
[Error::Api] on a non-zero OKX code, or transport/decode errors.
Sourcepub async fn get_subaccount_managed_bills(
&self,
request: &ManagedSubAccountBillsRequest,
) -> Result<Vec<ManagedSubAccountBill>, Error>
pub async fn get_subaccount_managed_bills( &self, request: &ManagedSubAccountBillsRequest, ) -> Result<Vec<ManagedSubAccountBill>, Error>
Retrieve asset bills for managed sub-accounts.
GET /api/v5/asset/subaccount/managed-subaccount-bills. Authenticated.
§Errors
Returns [Error::InvalidRequest] if limit is outside 1–100,
[Error::Configuration] if no credentials are set,
[Error::Api] on a non-zero OKX code, or transport/decode errors.
Sourcepub async fn transfer_between_subaccounts(
&self,
request: &SubAccountTransferRequest,
) -> Result<Vec<SubAccountTransferResult>, Error>
pub async fn transfer_between_subaccounts( &self, request: &SubAccountTransferRequest, ) -> Result<Vec<SubAccountTransferResult>, Error>
Transfer assets between funding or trading accounts of sub-accounts.
POST /api/v5/asset/subaccount/transfer. Authenticated. Use
SubAccountType to specify the account type on each side.
§Errors
Returns [Error::Configuration] if no credentials are set,
[Error::Api] on a non-zero OKX code, or transport/decode errors.
Sourcepub async fn set_subaccount_transfer_out(
&self,
request: &SetTransferOutRequest,
) -> Result<Vec<SetTransferOutResult>, Error>
pub async fn set_subaccount_transfer_out( &self, request: &SetTransferOutRequest, ) -> Result<Vec<SetTransferOutResult>, Error>
Enable or disable transfers out for one or more sub-accounts.
POST /api/v5/users/subaccount/set-transfer-out. Authenticated.
§Errors
Returns [Error::Configuration] if no credentials are set,
[Error::Api] on a non-zero OKX code, or transport/decode errors.
Sourcepub async fn get_entrust_subaccount_list(
&self,
) -> Result<Vec<EntrustSubAccount>, Error>
pub async fn get_entrust_subaccount_list( &self, ) -> Result<Vec<EntrustSubAccount>, Error>
List sub-accounts of an entrusted entity.
GET /api/v5/users/entrust-subaccount-list. Authenticated.
§Errors
Returns [Error::Configuration] if no credentials are set,
[Error::Api] on a non-zero OKX code, or transport/decode errors.