Skip to main content

SubAccount

Struct SubAccount 

Source
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>

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Auto Trait Implementations§

§

impl<'a, T> Freeze for SubAccount<'a, T>

§

impl<'a, T> RefUnwindSafe for SubAccount<'a, T>
where T: RefUnwindSafe,

§

impl<'a, T> Send for SubAccount<'a, T>
where T: Sync,

§

impl<'a, T> Sync for SubAccount<'a, T>
where T: Sync,

§

impl<'a, T> Unpin for SubAccount<'a, T>

§

impl<'a, T> UnsafeUnpin for SubAccount<'a, T>

§

impl<'a, T> UnwindSafe for SubAccount<'a, T>
where T: RefUnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more