Skip to main content

Funding

Struct Funding 

Source
pub struct Funding<'a, T> { /* private fields */ }
Expand description

Accessor for authenticated funding-account and asset endpoints.

Obtain one via OkxClient::funding. All methods require credentials. Mutating endpoints operate on the funding account, not the trading account.

Implementations§

Source§

impl<'a, T: Transport> Funding<'a, T>

Source

pub async fn get_currencies( &self, ccy: Option<&str>, ) -> Result<Vec<Currency>, Error>

Retrieve currency metadata and chain settings.

GET /api/v5/asset/currencies. Authenticated.

§Errors

Returns Error::Configuration without credentials, Error::Api on a non-zero OKX code, or transport/decode errors.

Source

pub async fn get_balances( &self, ccy: Option<&str>, ) -> Result<Vec<FundingBalance>, Error>

Retrieve funding-account balances.

GET /api/v5/asset/balances. Authenticated.

§Errors

See get_currencies.

Source

pub async fn get_non_tradable_assets( &self, ccy: Option<&str>, ) -> Result<Vec<NonTradableAsset>, Error>

Retrieve non-tradable assets.

GET /api/v5/asset/non-tradable-assets. Authenticated.

§Errors

See get_currencies.

Source

pub async fn get_deposit_address( &self, ccy: &str, ) -> Result<Vec<DepositAddress>, Error>

Retrieve deposit addresses for a currency.

GET /api/v5/asset/deposit-address. Authenticated.

§Errors

See get_currencies.

Source

pub async fn funds_transfer( &self, request: &FundsTransferRequest, ) -> Result<Vec<TransferResult>, Error>

Transfer funds between OKX account types.

POST /api/v5/asset/transfer. Authenticated.

§Errors

See get_currencies.

Source

pub async fn transfer_state( &self, trans_id: &str, transfer_type: Option<&str>, ) -> Result<Vec<TransferState>, Error>

Retrieve the state of a funds transfer.

GET /api/v5/asset/transfer-state. Authenticated.

§Errors

See get_currencies.

Source

pub async fn withdrawal( &self, request: &WithdrawalRequest, ) -> Result<Vec<WithdrawalResult>, Error>

Withdraw funds from OKX.

POST /api/v5/asset/withdrawal. Authenticated. This is a real asset movement endpoint; build requests deliberately with WithdrawalRequest::new.

§Errors

See get_currencies.

Source

pub async fn get_deposit_history( &self, request: &DepositHistoryRequest, ) -> Result<Vec<DepositRecord>, Error>

Retrieve deposit history.

GET /api/v5/asset/deposit-history. Authenticated.

§Errors

See get_currencies.

Source

pub async fn purchase_redempt( &self, ccy: &str, amt: &str, side: &str, rate: &str, ) -> Result<Vec<PurchaseRedemptResult>, Error>

Subscribe or redeem savings through the legacy purchase/redemption endpoint.

POST /api/v5/asset/purchase_redempt. Authenticated.

§Errors

See get_currencies.

Source

pub async fn get_bills( &self, request: &FundingBillsRequest, ) -> Result<Vec<FundingBill>, Error>

Retrieve funding-account bills.

GET /api/v5/asset/bills. Authenticated.

§Errors

See get_currencies.

Source

pub async fn get_deposit_lightning( &self, request: &DepositLightningRequest, ) -> Result<Vec<DepositLightning>, Error>

Create or retrieve a Lightning Network deposit invoice.

GET /api/v5/asset/deposit-lightning. Authenticated.

§Errors

See get_currencies.

Source

pub async fn withdrawal_lightning( &self, request: &WithdrawalLightningRequest, ) -> Result<Vec<WithdrawalLightning>, Error>

Withdraw through the Lightning Network.

POST /api/v5/asset/withdrawal-lightning. Authenticated.

§Errors

See get_currencies.

Source

pub async fn cancel_withdrawal( &self, wd_id: &str, ) -> Result<Vec<WithdrawalResult>, Error>

Cancel a withdrawal.

POST /api/v5/asset/cancel-withdrawal. Authenticated.

§Errors

See get_currencies.

Source

pub async fn convert_dust_assets( &self, ccy: &[&str], ) -> Result<Vec<ConvertDustAssetsResult>, Error>

Convert small balances into another asset.

POST /api/v5/asset/convert-dust-assets. Authenticated.

§Errors

See get_currencies.

Source

pub async fn get_asset_valuation( &self, ccy: Option<&str>, ) -> Result<Vec<AssetValuation>, Error>

Retrieve total asset valuation.

GET /api/v5/asset/asset-valuation. Authenticated.

§Errors

See get_currencies.

Source

pub async fn get_deposit_withdraw_status( &self, request: &DepositWithdrawStatusRequest, ) -> Result<Vec<DepositWithdrawStatus>, Error>

Retrieve deposit/withdrawal status.

GET /api/v5/asset/deposit-withdraw-status. Authenticated.

§Errors

See get_currencies.

Source

pub async fn get_withdrawal_history( &self, request: &WithdrawalHistoryRequest, ) -> Result<Vec<WithdrawalRecord>, Error>

Retrieve withdrawal history.

GET /api/v5/asset/withdrawal-history. Authenticated.

§Errors

See get_currencies.

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

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

§

impl<'a, T> UnwindSafe for Funding<'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<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> 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<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