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>
impl<'a, T: Transport> Funding<'a, T>
Sourcepub async fn get_currencies(
&self,
ccy: Option<&str>,
) -> Result<Vec<Currency>, Error>
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.
Sourcepub async fn get_balances(
&self,
ccy: Option<&str>,
) -> Result<Vec<FundingBalance>, Error>
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.
Sourcepub async fn get_non_tradable_assets(
&self,
ccy: Option<&str>,
) -> Result<Vec<NonTradableAsset>, Error>
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.
Sourcepub async fn get_deposit_address(
&self,
ccy: &str,
) -> Result<Vec<DepositAddress>, Error>
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.
Sourcepub async fn funds_transfer(
&self,
request: &FundsTransferRequest,
) -> Result<Vec<TransferResult>, Error>
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.
Sourcepub async fn transfer_state(
&self,
trans_id: &str,
transfer_type: Option<&str>,
) -> Result<Vec<TransferState>, Error>
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.
Sourcepub async fn withdrawal(
&self,
request: &WithdrawalRequest,
) -> Result<Vec<WithdrawalResult>, Error>
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.
Sourcepub async fn get_deposit_history(
&self,
request: &DepositHistoryRequest,
) -> Result<Vec<DepositRecord>, Error>
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.
Sourcepub async fn purchase_redempt(
&self,
ccy: &str,
amt: &str,
side: &str,
rate: &str,
) -> Result<Vec<PurchaseRedemptResult>, Error>
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.
Sourcepub async fn get_bills(
&self,
request: &FundingBillsRequest,
) -> Result<Vec<FundingBill>, Error>
pub async fn get_bills( &self, request: &FundingBillsRequest, ) -> Result<Vec<FundingBill>, Error>
Sourcepub async fn get_deposit_lightning(
&self,
request: &DepositLightningRequest,
) -> Result<Vec<DepositLightning>, Error>
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.
Sourcepub async fn withdrawal_lightning(
&self,
request: &WithdrawalLightningRequest,
) -> Result<Vec<WithdrawalLightning>, Error>
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.
Sourcepub async fn cancel_withdrawal(
&self,
wd_id: &str,
) -> Result<Vec<WithdrawalResult>, Error>
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.
Sourcepub async fn convert_dust_assets(
&self,
ccy: &[&str],
) -> Result<Vec<ConvertDustAssetsResult>, Error>
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.
Sourcepub async fn get_asset_valuation(
&self,
ccy: Option<&str>,
) -> Result<Vec<AssetValuation>, Error>
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.
Sourcepub async fn get_deposit_withdraw_status(
&self,
request: &DepositWithdrawStatusRequest,
) -> Result<Vec<DepositWithdrawStatus>, Error>
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.
Sourcepub async fn get_withdrawal_history(
&self,
request: &WithdrawalHistoryRequest,
) -> Result<Vec<WithdrawalRecord>, Error>
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.