Skip to main content

AssetManager

Struct AssetManager 

Source
pub struct AssetManager {
    pub client: Client,
    pub recv_window: u16,
}

Fields§

§client: Client§recv_window: u16

Implementations§

Source§

impl AssetManager

Source

pub async fn get_settlement_record<'a>( &self, req: SettlementRecordRequest<'a>, ) -> Result<SettlementRecordResponse, BybitError>

Get USDC session settlement records

Query session settlement records of USDC perpetual and futures. During periods of extreme market volatility, this interface may experience increased latency or temporary delays in data delivery.

§Arguments
  • req - A SettlementRecordRequest containing the query parameters
§Returns

Returns a Result containing SettlementRecordResponse if successful, or BybitError if an error occurs.

Source

pub async fn get_coin_exchange_records<'a>( &self, req: CoinExchangeRecordRequest<'a>, ) -> Result<CoinExchangeRecordResponse, BybitError>

Get coin exchange records

Query the coin exchange records. It sometimes has 5 secs delay.

§Arguments
  • req - A CoinExchangeRecordRequest containing the query parameters
§Returns

Returns a Result containing CoinExchangeRecordResponse if successful, or BybitError if an error occurs.

Source

pub async fn get_coin_info<'a>( &self, req: CoinInfoRequest<'a>, ) -> Result<CoinInfoResponse, BybitError>

Get coin information

Query coin information, including chain information, withdraw and deposit status.

§Arguments
  • req - A CoinInfoRequest containing the query parameters
§Returns

Returns a Result containing CoinInfoResponse if successful, or BybitError if an error occurs.

Source

pub async fn get_sub_uid(&self) -> Result<SubUidResponse, BybitError>

Get sub UID list

Query the sub UIDs under a main UID. It returns up to 2000 sub accounts. Query by the master UID’s api key only.

§Returns

Returns a Result containing SubUidResponse if successful, or BybitError if an error occurs.

Source

pub async fn get_delivery_record<'a>( &self, req: DeliveryRecordRequest<'a>, ) -> Result<DeliveryRecordResponse, BybitError>

Get delivery record

Query delivery records of Inverse Futures, USDC Futures, USDT Futures and Options, sorted by deliveryTime in descending order. During periods of extreme market volatility, this interface may experience increased latency or temporary delays in data delivery.

§Arguments
  • req - A DeliveryRecordRequest containing the query parameters
§Returns

Returns a Result containing DeliveryRecordResponse if successful, or BybitError if an error occurs.

Source

pub async fn get_single_coin_balance<'a>( &self, req: SingleCoinBalanceRequest<'a>, ) -> Result<SingleCoinBalanceResponse, BybitError>

Get single coin balance

Query the balance of a specific coin in a specific account type. Supports querying sub UID’s balance. Also, you can check the transferable amount from master to sub account, sub to master account or sub to sub account, especially for user who has an institutional loan.

During periods of extreme market volatility, this interface may experience increased latency or temporary delays in data delivery.

§Arguments
  • req - A SingleCoinBalanceRequest containing the query parameters
§Returns

Returns a Result containing SingleCoinBalanceResponse if successful, or BybitError if an error occurs.

Source

pub async fn get_all_coins_balance<'a>( &self, req: AllCoinsBalanceRequest<'a>, ) -> Result<AllCoinsBalanceResponse, BybitError>

Get all coins balance

You could get all coin balance of all account types under the master account, and sub account.

During periods of extreme market volatility, this interface may experience increased latency or temporary delays in data delivery.

§Arguments
  • req - A AllCoinsBalanceRequest containing the query parameters
§Returns

Returns a Result containing AllCoinsBalanceResponse if successful, or BybitError if an error occurs.

Source

pub async fn get_withdrawable_amount<'a>( &self, req: WithdrawableAmountRequest<'a>, ) -> Result<WithdrawableAmountResponse, BybitError>

Get withdrawable amount

Query the withdrawable amount for a specific coin.

During periods of extreme market volatility, this interface may experience increased latency or temporary delays in data delivery.

§Arguments
  • req - A WithdrawableAmountRequest containing the query parameters
§Returns

Returns a Result containing WithdrawableAmountResponse if successful, or BybitError if an error occurs.

Source

pub async fn create_internal_transfer<'a>( &self, req: InternalTransferRequest<'a>, ) -> Result<InternalTransferResponse, BybitError>

Create internal transfer

Create the internal transfer between different account types under the same UID.

§Arguments
  • req - A InternalTransferRequest containing the transfer parameters
§Returns

Returns a Result containing InternalTransferResponse if successful, or BybitError if an error occurs.

Source

pub async fn get_internal_transfer_records<'a>( &self, req: InternalTransferRecordsRequest<'a>, ) -> Result<InternalTransferRecordsResponse, BybitError>

Get internal transfer records

Query the internal transfer records between different account types under the same UID.

§Arguments
  • req - A InternalTransferRecordsRequest containing the query parameters
§Returns

Returns a Result containing InternalTransferRecordsResponse if successful, or BybitError if an error occurs.

Source

pub async fn create_universal_transfer<'a>( &self, req: UniversalTransferRequest<'a>, ) -> Result<UniversalTransferResponse, BybitError>

Create universal transfer

Transfer between sub-sub or main-sub.

§Arguments
  • req - A UniversalTransferRequest containing the transfer parameters
§Returns

Returns a Result containing UniversalTransferResponse if successful, or BybitError if an error occurs.

Source

pub async fn get_universal_transfer_records<'a>( &self, req: UniversalTransferRecordsRequest<'a>, ) -> Result<UniversalTransferRecordsResponse, BybitError>

Get universal transfer records

Query universal transfer records.

§Arguments
  • req - A UniversalTransferRecordsRequest containing the query parameters
§Returns

Returns a Result containing UniversalTransferRecordsResponse if successful, or BybitError if an error occurs.

Source

pub async fn get_transferable_coin_list<'a>( &self, req: TransferableCoinRequest<'a>, ) -> Result<TransferableCoinResponse, BybitError>

Get transferable coin list

Query the transferable coin list between each account type.

§Arguments
  • req - A TransferableCoinRequest containing the query parameters
§Returns

Returns a Result containing TransferableCoinResponse if successful, or BybitError if an error occurs.

Source

pub async fn set_deposit_account<'a>( &self, req: SetDepositAccountRequest<'a>, ) -> Result<SetDepositAccountResponse, BybitError>

Set deposit account

Set auto transfer account after deposit. The same function as the setting for Deposit on web GUI.

Only main UID can access.

§Arguments
  • req - A SetDepositAccountRequest containing the account type
§Returns

Returns a Result containing SetDepositAccountResponse if successful, or BybitError if an error occurs.

Source

pub async fn get_deposit_records<'a>( &self, req: DepositRecordRequest<'a>, ) -> Result<DepositRecordResponse, BybitError>

Get deposit records (on-chain)

Query deposit records.

  • endTime - startTime should be less than 30 days. Query last 30 days records by default.
  • Support using main or sub UID api key to query deposit records respectively.
§Arguments
  • req - A DepositRecordRequest containing the query parameters
§Returns

Returns a Result containing DepositRecordResponse if successful, or BybitError if an error occurs.

Source

pub async fn get_sub_deposit_records<'a>( &self, req: SubDepositRecordRequest<'a>, ) -> Result<SubDepositRecordResponse, BybitError>

Get sub deposit records (on-chain)

Query subaccount’s deposit records by main UID’s API key.

  • endTime - startTime should be less than 30 days. Queries for the last 30 days worth of records by default.
§Arguments
  • req - A SubDepositRecordRequest containing the query parameters
§Returns

Returns a Result containing SubDepositRecordResponse if successful, or BybitError if an error occurs.

Source

pub async fn get_internal_deposit_records<'a>( &self, req: InternalDepositRecordRequest<'a>, ) -> Result<InternalDepositRecordResponse, BybitError>

Get internal deposit records (off-chain)

Query deposit records within the Bybit platform. These transactions are not on the blockchain.

  • The maximum difference between the start time and the end time is 30 days
  • Support to get deposit records by Master or Sub Member Api Key
§Arguments
  • req - A InternalDepositRecordRequest containing the query parameters
§Returns

Returns a Result containing InternalDepositRecordResponse if successful, or BybitError if an error occurs.

Source

pub async fn get_master_deposit_address<'a>( &self, req: MasterDepositAddressRequest<'a>, ) -> Result<MasterDepositAddressResponse, BybitError>

Get master deposit address

Query the deposit address information of MASTER account.

§Arguments
  • req - A MasterDepositAddressRequest containing the query parameters
§Returns

Returns a Result containing MasterDepositAddressResponse if successful, or BybitError if an error occurs.

Source

pub async fn get_sub_deposit_address<'a>( &self, req: SubDepositAddressRequest<'a>, ) -> Result<SubDepositAddressResponse, BybitError>

Get sub deposit address

Query the deposit address information of SUB account.

  • Use master UID’s api key only
  • Custodial sub account deposit address cannot be obtained
§Arguments
  • req - A SubDepositAddressRequest containing the query parameters
§Returns

Returns a Result containing SubDepositAddressResponse if successful, or BybitError if an error occurs.

Source

pub async fn get_withdrawal_address<'a>( &self, req: WithdrawalAddressRequest<'a>, ) -> Result<WithdrawalAddressResponse, BybitError>

Get withdrawal address list

Query the withdrawal addresses in the address book.

§Note

The API key for querying this endpoint must have withdrawal permissions.

§Arguments
  • req - A WithdrawalAddressRequest containing the query parameters
§Returns

Returns a Result containing WithdrawalAddressResponse if successful, or BybitError if an error occurs.

Source

pub async fn get_withdrawal_records<'a>( &self, req: WithdrawalRecordRequest<'a>, ) -> Result<WithdrawalRecordResponse, BybitError>

Get withdrawal records

Query withdrawal records.

§Notes
  • endTime - startTime should be less than 30 days. Query last 30 days records by default.
  • Can query by the master UID’s api key only
§Arguments
  • req - A WithdrawalRecordRequest containing the query parameters
§Returns

Returns a Result containing WithdrawalRecordResponse if successful, or BybitError if an error occurs.

Source

pub async fn get_vasp_list(&self) -> Result<VaspListResponse, BybitError>

Get available WASPs (Virtual Asset Service Providers)

This endpoint is used for querying the available WASPs. This API distinguishes which compliance zone the user belongs to and the corresponding list of exchanges based on the user’s UID.

§Arguments

None - This endpoint takes no parameters

§Returns

Returns a Result containing VaspListResponse if successful, or BybitError if an error occurs.

Source

pub async fn withdraw<'a>( &self, req: WithdrawRequest<'a>, ) -> Result<WithdrawResponse, BybitError>

Create a withdrawal

Withdraw assets from your Bybit account. You can make an off-chain transfer if the target wallet address is from Bybit. This means that no blockchain fee will be charged.

§Notes
  • Although the API rate limit for this endpoint is 5 req/s, there is also a secondary limit: you can only withdraw once every 10 seconds per chain/coin combination.
  • Make sure you have whitelisted your wallet address
  • Request by the master UID’s api key only
§Arguments
  • req - A WithdrawRequest containing the withdrawal parameters
§Returns

Returns a Result containing WithdrawResponse if successful, or BybitError if an error occurs.

Source

pub async fn cancel_withdraw<'a>( &self, req: CancelWithdrawRequest<'a>, ) -> Result<CancelWithdrawResponse, BybitError>

Cancel a withdrawal

Cancel the withdrawal

§Arguments
  • req - A CancelWithdrawRequest containing the withdrawal ID to cancel
§Returns

Returns a Result containing CancelWithdrawResponse if successful, or BybitError if an error occurs.

Trait Implementations§

Source§

impl Bybit for AssetManager

Source§

fn new(api_key: Option<String>, secret_key: Option<String>) -> AssetManager

Creates a new instance of the module with default configuration. Read more
Source§

fn new_with_config( config: &Config, api_key: Option<String>, secret_key: Option<String>, ) -> AssetManager

Creates a new instance of the module with custom configuration. Read more
Source§

impl Clone for AssetManager

Source§

fn clone(&self) -> AssetManager

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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