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 RestError::Configuration if no credentials are set,
RestError::Okx 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 RestError::Configuration if no credentials are set,
RestError::Okx 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 RestError::Configuration if no credentials are set,
RestError::Okx 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 RestError::Configuration if no credentials are set,
RestError::Okx 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 RestError::Configuration if no credentials are set,
RestError::Okx 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 RestError::Configuration if no credentials are set,
RestError::Okx 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 RestError::Configuration if no credentials are set,
RestError::Okx 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 RestError::Configuration if no credentials are set,
RestError::Okx 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 RestError::Configuration if no credentials are set,
RestError::Okx 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 RestError::Configuration if no credentials are set,
RestError::Okx 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 RestError::Configuration if no credentials are set,
RestError::Okx 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 RestError::Configuration if no credentials are set,
RestError::Okx 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 RestError::Configuration if no credentials are set,
RestError::Okx 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 RestError::Configuration if no credentials are set,
RestError::Okx on a non-zero OKX code, or transport/decode errors.