Skip to main content

Client

Struct Client 

Source
pub struct Client { /* private fields */ }
Expand description

Bybit V5 REST client.

Cloning is cheap, and clones share the connection pool, the rate limiter state and the clock offset measured by Client::sync_time: clone the client into tasks instead of wrapping it in Arc.

Implementations§

Source§

impl Client

Source

pub fn new(cfg: Config) -> Result<Self, Error>

Create a client. Fails if a header value (API key, referer) is invalid, api_secret is set without api_key, or the proxy URL is invalid.

Source

pub async fn sync_time(&self) -> Result<i64, Error>

Measure the offset between the Bybit server clock and the local clock and use it for all signed requests from now on. Returns the offset in milliseconds (positive: the local clock is behind).

Bybit rejects signed requests whose timestamp is not within [server_time - recv_window, server_time + 1000) (retCode 10002). Call this after creating the client, periodically in long-running programs (clocks drift) and after a 10002 error. The offset is estimated as server_time - (sent_at + received_at) / 2, so its error is at most half the round trip.

Source

pub fn time_offset(&self) -> i64

Offset applied to signed requests: server clock minus local clock, milliseconds. 0 until Client::sync_time is called.

Source

pub fn clock(&self) -> ServerClock

The server clock estimate used for signing. Clones share the offset; pass it to ws::Config::server_clock so that stream authentication uses the same offset.

Source

pub fn server_timestamp(&self) -> Timestamp

Current server time estimated from the local clock and Client::time_offset, milliseconds. Use it for the WebSocket auth message (create_outgoing_message_auth_at).

Source§

impl Client

Source

pub async fn get_server_time(&self) -> Result<Response<ServerTime>, Error>

Get Bybit Server Time. See also Client::sync_time.

Source

pub async fn get_kline( &self, params: &GetKLinesParams, ) -> Result<Response<KLine>, Error>

Get Kline. Query the kline data. Charts are returned in groups based on the requested interval.

Covers: Spot / USDT contract / USDC contract / Inverse contract

Source

pub async fn get_mark_price_kline( &self, params: &GetKLinesParams, ) -> Result<Response<PriceKLine>, Error>

Get Mark Price Kline. Query the mark price kline data. Charts are returned in groups based on the requested interval.

Covers: linear / inverse

Source

pub async fn get_index_price_kline( &self, params: &GetKLinesParams, ) -> Result<Response<PriceKLine>, Error>

Get Index Price Kline. Query the index price kline data. Charts are returned in groups based on the requested interval.

Covers: linear / inverse

Source

pub async fn get_premium_index_price_kline( &self, params: &GetKLinesParams, ) -> Result<Response<PriceKLine>, Error>

Get Premium Index Price Kline. Retrieve the premium index price kline data. Charts are returned in groups based on the requested interval.

Covers: linear

Source

pub async fn get_tickers( &self, params: &GetTickersParams, ) -> Result<Response<Ticker>, Error>

Get Tickers Query for the latest price snapshot, best bid/ask price, and trading volume in the last 24 hours. If category=option, symbol or baseCoin must be passed.

Source

pub async fn get_orderbook( &self, params: &GetOrderbookParams, ) -> Result<Response<Orderbook>, Error>

Get Orderbook. Query for orderbook depth data.

Covers: Spot / USDT contract / USDC contract / Inverse contract / Option

Source

pub async fn get_instruments_info( &self, params: &GetInstrumentsInfoParams, ) -> Result<Response<InstrumentsInfo>, Error>

Get Instruments Info. Query the specifications of online trading pairs.

Source

pub async fn get_public_recent_trading_history( &self, params: &GetTradesParams, ) -> Result<Response<Trade>, Error>

Get Recent Public Trades. Query recent public trading data.

Source

pub async fn get_funding_rate_history( &self, params: &GetFundingRateHistoryParams, ) -> Result<Response<FundingRateHistory>, Error>

Get Funding Rate History. Query for historical funding rates. Each request returns up to 200 rows of data.

Covers: linear / inverse

Source

pub async fn get_open_interest( &self, params: &GetOpenInterestParams, ) -> Result<Response<OpenInterest>, Error>

Get Open Interest. Get the open interest of each symbol.

Covers: linear / inverse

Source

pub async fn get_historical_volatility( &self, params: &GetHistoricalVolatilityParams, ) -> Result<Response<Vec<HistoricalVolatilityEntry>>, Error>

Get Historical Volatility. Query option historical volatility.

Covers: option only

Note: the result is returned as a top-level JSON array, so the response wraps Vec<HistoricalVolatilityEntry> directly.

Source

pub async fn get_insurance( &self, params: &GetInsuranceParams, ) -> Result<Response<Insurance>, Error>

Get Insurance. Query for Bybit insurance pool data (1 day delay).

Source

pub async fn get_risk_limit( &self, params: &GetRiskLimitParams, ) -> Result<Response<RiskLimit>, Error>

Get Risk Limit. Query for the risk limit.

Covers: linear / inverse

Source

pub async fn get_delivery_price( &self, params: &GetDeliveryPriceParams, ) -> Result<Response<DeliveryPrice>, Error>

Get Delivery Price. Get the delivery price for option and USDC futures contracts.

Covers: linear / inverse / option

Source§

impl Client

Source

pub async fn place_order( &self, request: &PlaceOrderRequest, ) -> Result<Response<PlaceOrderResponse>, Error>

Place Order This endpoint supports to create the order for Spot, Margin trading, USDT perpetual, USDT futures, USDC perpetual, USDC futures, Inverse Futures and Options.

INFO: Supported order type (orderType): Limit order: orderType=Limit, it is necessary to specify order qty and price.

Market order: orderType=Market, execute at the best price in the Bybit market until the transaction is completed. When selecting a market order, the “price” can be empty. In the futures trading system, in order to protect traders against the serious slippage of the Market order, Bybit trading engine will convert the market order into an IOC limit order for matching. If there are no orderbook entries within price slippage limit, the order will not be executed. If there is insufficient liquidity, the order will be cancelled. The slippage threshold refers to the percentage that the order price deviates from the mark price. You can learn more here: Adjustments to Bybit’s Derivative Trading Price Limit Mechanism Supported timeInForce strategy: GTC IOC FOK PostOnly: If the order would be filled immediately when submitted, it will be cancelled. The purpose of this is to protect your order during the submission process. If the matching system cannot entrust the order to the order book due to price changes on the market, it will be cancelled. RPI: Retail Price Improvement order. Assigned market maker can place this kind of order, and it is a post only order, only match with the order from Web or APP.

How to create a conditional order: When submitting an order, if triggerPrice is set, the order will be automatically converted into a conditional order. In addition, the conditional order does not occupy the margin. If the margin is insufficient after the conditional order is triggered, the order will be cancelled.

Take profit / Stop loss: You can set TP/SL while placing orders. Besides, you could modify the position’s TP/SL.

Order quantity: The quantity of perpetual contracts you are going to buy/sell. For the order quantity, Bybit only supports positive number at present.

Order price: Place a limit order, this parameter is required. If you have position, the price should be higher than the liquidation price. For the minimum unit of the price change, please refer to the priceFilter > tickSize field in the instruments-info endpoint.

orderLinkId: You can customize the active order ID. We can link this ID to the order ID in the system. Once the active order is successfully created, we will send the unique order ID in the system to you. Then, you can use this order ID to cancel active orders, and if both orderId and orderLinkId are entered in the parameter input, Bybit will prioritize the orderId to process the corresponding order. Meanwhile, your customized order ID should be no longer than 36 characters and should be unique.

Open orders up limit: Perps & Futures: a) Each account can hold a maximum of 500 active orders simultaneously per symbol. b) conditional orders: each account can hold a maximum of 10 active orders simultaneously per symbol. Spot: 500 orders in total, including a maximum of 30 open TP/SL orders, a maximum of 30 open conditional orders for each symbol per account Option: a maximum of 50 open orders per account

Rate limit: Please refer to rate limit table. If you need to raise the rate limit, please contact your client manager or submit an application via here

Risk control limit notice: Bybit will monitor on your API requests. When the total number of orders of a single user (aggregated the number of orders across main account and subaccounts) within a day (UTC 0 - UTC 24) exceeds a certain upper limit, the platform will reserve the right to remind, warn, and impose necessary restrictions. Customers who use API default to acceptance of these terms and have the obligation to cooperate with adjustments.

Reduce only orders: If reduceOnly=true and order qty > max order qty, the order will automatically be split up into multiple orders.

Spot Stop Order Spot supports TP/SL order, Conditional order, however, the system logic is different between classic account and Unified account classic account: When the stop order is created, you will get an order ID. After it is triggered, you will get a new order ID Unified account: When the stop order is created, you will get an order ID. After it is triggered, the order ID will not be changed

Source

pub async fn amend_order( &self, request: &AmendOrderRequest, ) -> Result<Response<AmendOrderResponse>, Error>

Amend Order info You can only modify unfilled or partially filled orders.

Source

pub async fn cancel_order( &self, request: &CancelOrderRequest, ) -> Result<Response<CancelOrderResponse>, Error>

Cancel Order important You must specify orderId or orderLinkId to cancel the order. If orderId and orderLinkId do not match, the system will process orderId first. You can only cancel unfilled or partially filled orders.

Source

pub async fn get_open_closed_orders( &self, params: &GetOpenClosedOrdersParams, ) -> Result<Response<CursorPagination<Order>>, Error>

Get Open & Closed Orders. Primarily query unfilled or partially filled orders in real-time, but also supports querying recent 500 closed status (Cancelled, Filled) orders. Please see the usage of request param openOnly. And to query older order records, please use the order history interface.

Tip UTA2.0 can query filled, canceled, and rejected orders to the most recent 500 orders for spot, linear, inverse and option categories UTA1.0 can query filled, canceled, and rejected orders to the most recent 500 orders for spot, linear, and option categories. The inverse category is not subject to this limitation. You can query by symbol, baseCoin, orderId and orderLinkId, and if you pass multiple params, the system will process them according to this priority: orderId > orderLinkId > symbol > baseCoin. The records are sorted by the createdTime from newest to oldest.

info classic account spot can return open orders only After a server release or restart, filled, canceled, and rejected orders of Unified account should only be queried through order history.

Source

pub async fn get_open_closed_orders_all( &self, params: &GetOpenClosedOrdersParams, ) -> Result<Vec<Order>, Error>

Collect all pages of open/closed orders into a single Vec. Repeatedly calls get_open_closed_orders following next_page_cursor until the last page is reached (see MAX_PAGES).

Source

pub async fn cancel_all_orders( &self, request: &CancelAllOrdersRequest, ) -> Result<Response<CancelAllOrdersResponse>, Error>

Cancel All Orders. Cancel all open orders. Support linear, inverse, spot, and option.

Source

pub async fn get_order_history( &self, params: &GetOrderHistoryParams, ) -> Result<Response<CursorPagination<Order>>, Error>

Get Order History. Query order history. As order creation/cancellation is asynchronous, the data returned may be delayed. Supports up to 2 years of data.

Source

pub async fn get_order_history_all( &self, params: &GetOrderHistoryParams, ) -> Result<Vec<Order>, Error>

Collect all pages of order history into a single Vec.

Source

pub async fn place_orders_batch( &self, request: &PlaceOrderBatchRequest, ) -> Result<Response<List<PlaceOrderBatchResult>>, Error>

Place Batch Orders. Supports up to 20 orders per request. Per-item results are in response.ret_ext_info.list (parallel to response.result.list).

Source

pub async fn amend_orders_batch( &self, request: &AmendOrderBatchRequest, ) -> Result<Response<List<AmendOrderBatchResult>>, Error>

Amend Batch Orders. Supports up to 20 orders per request. Per-item results are in response.ret_ext_info.list (parallel to response.result.list).

Source

pub async fn cancel_orders_batch( &self, request: &CancelOrderBatchRequest, ) -> Result<Response<List<CancelOrderBatchResult>>, Error>

Cancel Batch Orders. Supports up to 20 orders per request. Per-item results are in response.ret_ext_info.list (parallel to response.result.list).

Source

pub async fn get_spot_borrow_check( &self, params: &GetSpotBorrowCheckParams, ) -> Result<Response<SpotBorrowCheck>, Error>

Get Spot Borrow Check. Query the maximum quantity for purchase or sale, and check the borrowable quantity based on the fee types.

Covers: spot only. Requires authentication.

Source§

impl Client

Source

pub async fn get_position_info( &self, params: &GetPositionInfoParams, ) -> Result<Response<CursorPagination<Position>>, Error>

Query real-time position data, such as position size, cumulative realized PNL, etc. Query real-time position data, such as position size, cumulative realized PNL, etc.

INFO

Source

pub async fn get_position_info_all( &self, params: &GetPositionInfoParams, ) -> Result<Vec<Position>, Error>

Collect all pages of position info into a single Vec. Repeatedly calls get_position_info following next_page_cursor until the last page is reached (see MAX_PAGES).

Source

pub async fn set_leverage( &self, request: &SetLeverageRequest, ) -> Result<Response<EmptyResult>, Error>

Set Leverage. Set the leverage for a position. Only for isolated margin mode.

Source

pub async fn set_trading_stop( &self, request: &SetTradingStopRequest, ) -> Result<Response<EmptyResult>, Error>

Set Trading Stop. Set take profit, stop loss, or trailing stop for a position.

Source

pub async fn switch_cross_isolated_margin( &self, request: &SwitchCrossIsolatedMarginRequest, ) -> Result<Response<EmptyResult>, Error>

Switch Cross/Isolated Margin. Switch the margin mode for a symbol between cross and isolated.

Source

pub async fn switch_position_mode( &self, request: &SwitchPositionModeRequest, ) -> Result<Response<EmptyResult>, Error>

Switch Position Mode. Switch between one-way (merged single) and hedge (both sides) position mode.

Source

pub async fn set_auto_add_margin( &self, request: &SetAutoAddMarginRequest, ) -> Result<Response<EmptyResult>, Error>

Set Auto Add Margin. Turn on/off auto-add-margin for an isolated margin position.

Source

pub async fn set_risk_limit( &self, request: &SetRiskLimitRequest, ) -> Result<Response<SetRiskLimitResponse>, Error>

Set Risk Limit. Set the risk limit for a position. The response includes the new risk limit and its value.

Source

pub async fn get_closed_pnl( &self, params: &GetClosedPnlParams, ) -> Result<Response<CursorPagination<ClosedPnl>>, Error>

Get Closed P&L. Query the closed profit and loss records of positions.

Source

pub async fn get_closed_pnl_all( &self, params: &GetClosedPnlParams, ) -> Result<Vec<ClosedPnl>, Error>

Collect all pages of closed P&L into a single Vec.

Source

pub async fn get_execution_list( &self, params: &GetExecutionListParams, ) -> Result<Response<CursorPagination<ExecutionEntry>>, Error>

Get Execution List. Query users’ execution (trading) records, sorted by execTime descending.

Source

pub async fn get_execution_list_all( &self, params: &GetExecutionListParams, ) -> Result<Vec<ExecutionEntry>, Error>

Collect all pages of execution list entries into a single Vec.

Source§

impl Client

Source

pub async fn get_wallet_balance( &self, params: &GetWalletBalanceParams, ) -> Result<Response<List<WalletBalance>>, Error>

Obtain wallet balance, query asset information of each currency. By default, currency information with assets or liabilities of 0 is not returned.

Source

pub async fn get_transaction_log( &self, params: &GetTransactionLogParams, ) -> Result<Response<CursorPagination<TransactionLog>>, Error>

Get Transaction Log Query for transaction logs in your Unified account. It supports up to 2 years worth of data.

Source

pub async fn get_transaction_log_all( &self, params: &GetTransactionLogParams, ) -> Result<Vec<TransactionLog>, Error>

Collect all pages of transaction log entries into a single Vec. Repeatedly calls get_transaction_log following next_page_cursor until the last page is reached (see MAX_PAGES).

Source

pub async fn get_account_info(&self) -> Result<Response<AccountInfo>, Error>

Query the account information, like margin mode, account mode, etc.

Source

pub async fn get_fee_rate( &self, params: &GetFeeRateParams, ) -> Result<Response<List<FeeRateEntry>>, Error>

Get Fee Rate. Get the trading fee rate.

Requires authentication.

Source

pub async fn set_margin_mode( &self, request_body: &SetMarginModeRequest, ) -> Result<Response<SetMarginModeResponse>, Error>

Set Margin Mode. Switch between regular margin, isolated margin, and portfolio margin.

Requires authentication.

Source

pub async fn upgrade_to_uta( &self, ) -> Result<Response<UpgradeToUtaResult>, Error>

Upgrade to Unified Account (Pro). Upgrades an account to Unified Account Pro (UTA2.0 Pro). No open orders may exist during the upgrade.

Requires authentication.

Source

pub async fn get_borrow_history( &self, params: &GetBorrowHistoryParams, ) -> Result<Response<CursorPagination<BorrowHistoryEntry>>, Error>

Get Borrow History. Get interest records, sorted in reverse order of creation time.

Requires authentication. Unified account only.

Source

pub async fn get_borrow_history_all( &self, params: &GetBorrowHistoryParams, ) -> Result<Vec<BorrowHistoryEntry>, Error>

Collect all pages of borrow history entries into a single Vec. Repeatedly calls get_borrow_history following next_page_cursor until the last page is reached.

Source

pub async fn get_collateral_info( &self, params: &GetCollateralInfoParams, ) -> Result<Response<List<CollateralInfoEntry>>, Error>

Get Collateral Info. Query the collateral ratio, and information of the collateral ratio tier, for each currency.

Requires authentication. Unified account only.

Source§

impl Client

Source

pub async fn get_api_key_information( &self, ) -> Result<Response<APIKeyInformation>, Error>

Get API Key Information. Get the information of the api key. Use the api key pending to be checked to call the endpoint. Both master and sub user’s api key are applicable.

Source§

impl Client

Source

pub async fn internal_transfer( &self, request: &InternalTransferRequest, ) -> Result<Response<TransferResult>, Error>

Create Internal Transfer. Transfer between different account types under the same UID.

Requires authentication.

Source

pub async fn get_internal_transfer_records( &self, params: &GetInternalTransferRecordsParams, ) -> Result<Response<CursorPagination<InternalTransferEntry>>, Error>

Get Internal Transfer Records. Query the internal transfer records between different account types under the same UID.

Requires authentication.

Source

pub async fn universal_transfer( &self, request: &UniversalTransferRequest, ) -> Result<Response<TransferResult>, Error>

Create Universal Transfer. Transfer between a master account and its sub-accounts, or between two sub-accounts.

Requires authentication. Requires the master UID’s API key, or a sub-account key with the SubMemberTransferList permission (may only transfer to the master account).

Source

pub async fn get_universal_transfer_records( &self, params: &GetUniversalTransferRecordsParams, ) -> Result<Response<CursorPagination<UniversalTransferEntry>>, Error>

Get Universal Transfer Records.

Requires authentication. Requires the master UID’s API key, or a sub-account key with the SubMemberTransferList permission.

Source

pub async fn get_transferable_coins( &self, params: &GetTransferableCoinsParams, ) -> Result<Response<List<String>>, Error>

Get Transferable Coin. Query the transferable coins between two account types.

Requires authentication.

Source

pub async fn save_transfer_sub_member( &self, request: &SaveTransferSubMemberRequest, ) -> Result<Response<EmptyResult>, Error>

Enable Universal Transfer For Sub UID.

Deprecated by Bybit: all sub UIDs are now automatically enabled for universal transfer, so this call is no longer necessary. Kept for completeness. Requires the master UID’s API key.

Source

pub async fn get_transferable_sub_members( &self, ) -> Result<Response<TransferableSubMembers>, Error>

Get Sub UID (for universal transfer). Query the sub UIDs under a master account, and which of them are enabled for universal transfer.

Requires authentication. Requires the master UID’s API key.

Source

pub async fn get_account_coin_balance( &self, params: &GetAccountCoinBalanceParams, ) -> Result<Response<AccountCoinBalance>, Error>

Get Single Coin Balance. Query the balance of a specific coin in a specific account type, or the balance that is safe to transfer between two accounts.

Requires authentication.

Source

pub async fn get_asset_info( &self, params: &GetAssetInfoParams, ) -> Result<Response<AssetInfoResult>, Error>

Get Asset Info (Spot). Query for the balance of the Spot account.

Requires authentication.

Source

pub async fn get_deposit_allowed_coin_info( &self, params: &GetDepositAllowedCoinInfoParams, ) -> Result<Response<DepositAllowedCoinInfoResult>, Error>

Get Allowed Deposit Coin Info.

Requires authentication.

Source

pub async fn get_deposit_records( &self, params: &GetDepositRecordsParams, ) -> Result<Response<DepositRecords>, Error>

Get Deposit Records (on-chain).

Requires authentication.

Source

pub async fn get_sub_deposit_records( &self, params: &GetSubDepositRecordsParams, ) -> Result<Response<DepositRecords>, Error>

Get Sub Account Deposit Records (on-chain).

Requires authentication. Requires the master UID’s API key.

Source

pub async fn get_deposit_address( &self, params: &GetDepositAddressParams, ) -> Result<Response<DepositAddress>, Error>

Get Master Deposit Address.

Requires authentication.

Source

pub async fn get_sub_deposit_address( &self, params: &GetSubDepositAddressParams, ) -> Result<Response<DepositAddress>, Error>

Get Sub Account Deposit Address.

Requires authentication. Requires the master account’s API key.

Source

pub async fn get_withdrawal_records( &self, params: &GetWithdrawalRecordsParams, ) -> Result<Response<WithdrawRecords>, Error>

Get Withdrawal Records.

Requires authentication.

Source

pub async fn get_withdrawable_amount( &self, params: &GetWithdrawableAmountParams, ) -> Result<Response<WithdrawableAmountResult>, Error>

Get Withdrawable Amount. Query the amount available to withdraw for a coin, combined across the FUND, UTA, SPOT and EARN wallets, along with any amount still frozen pending deposit risk review.

Requires authentication.

Source

pub async fn withdraw( &self, request: &WithdrawRequest, ) -> Result<Response<WithdrawResult>, Error>

Withdraw. Create a withdrawal request.

Requires authentication.

Source

pub async fn cancel_withdrawal( &self, request: &CancelWithdrawalRequest, ) -> Result<Response<CancelWithdrawalResult>, Error>

Cancel Withdrawal. Cancel a pending withdrawal request.

Requires authentication.

Source

pub async fn get_coin_info( &self, params: &GetCoinInfoParams, ) -> Result<Response<CoinInfoResult>, Error>

Get Coin Info. Query coin information, including chains, deposit/withdrawal limits, and fees.

Requires authentication.

Source

pub async fn get_exchange_order_record( &self, params: &GetExchangeOrderRecordParams, ) -> Result<Response<ExchangeOrderRecords>, Error>

Get Coin Exchange Records.

Requires authentication.

Source

pub async fn get_delivery_record( &self, params: &GetDeliveryRecordParams, ) -> Result<Response<CursorPagination<DeliveryRecord>>, Error>

Get Delivery Record. Query delivery records of USDC futures and Options, sorted by descending delivery time.

Requires authentication.

Source

pub async fn get_settlement_record( &self, params: &GetSettlementRecordParams, ) -> Result<Response<CursorPagination<SettlementRecord>>, Error>

Get USDC Session Settlement. Query session settlement records of USDC perpetual contracts.

Requires authentication.

Source

pub async fn get_coin_greeks( &self, params: &GetCoinGreeksParams, ) -> Result<Response<List<CoinGreeks>>, Error>

Get Coin Greeks. Query the current account’s Greeks information. Option only.

Requires authentication.

Source§

impl Client

Source

pub async fn get_leverage_token_info( &self, params: &GetLeverageTokenInfoParams, ) -> Result<Response<List<LeverageTokenInfo>>, Error>

👎Deprecated since 0.3.0:

Bybit shut down the leveraged token API on 2025-07-04; the endpoint returns HTTP 404

Get Leverage Token Info. Query leveraged token information, such as purchase/redeem limits and fees.

No authentication required.

Source

pub async fn get_leverage_token_market( &self, params: &GetLeverageTokenMarketParams, ) -> Result<Response<LeverageTokenMarket>, Error>

👎Deprecated since 0.3.0:

Bybit shut down the leveraged token API on 2025-07-04; the endpoint returns HTTP 404

Get Leverage Token Market. Query the leveraged token market data, such as net asset value and real leverage.

No authentication required.

Source

pub async fn purchase_leverage_token( &self, request: &PurchaseLeverageTokenRequest, ) -> Result<Response<PurchaseLeverageTokenResult>, Error>

👎Deprecated since 0.3.0:

Bybit shut down the leveraged token API on 2025-07-04; the endpoint returns HTTP 404

Purchase. Purchase a leveraged token.

Requires authentication.

Source

pub async fn redeem_leverage_token( &self, request: &RedeemLeverageTokenRequest, ) -> Result<Response<RedeemLeverageTokenResult>, Error>

👎Deprecated since 0.3.0:

Bybit shut down the leveraged token API on 2025-07-04; the endpoint returns HTTP 404

Redeem. Redeem a leveraged token.

Requires authentication.

Source

pub async fn get_leverage_token_order_records( &self, params: &GetLeverageTokenOrderRecordsParams, ) -> Result<Response<List<LeverageTokenOrderRecord>>, Error>

👎Deprecated since 0.3.0:

Bybit shut down the leveraged token API on 2025-07-04; the endpoint returns HTTP 404

Get Purchase/Redemption Records.

Requires authentication.

Source§

impl Client

Source

pub async fn switch_spot_margin_mode( &self, request: &SwitchSpotMarginModeRequest, ) -> Result<Response<SwitchSpotMarginModeResult>, Error>

Toggle Margin Trade. Turn spot margin trade on or off for the Unified account.

Requires authentication. The account must have completed spot margin activation (including the required quiz) beforehand.

Source

pub async fn set_spot_margin_leverage( &self, request: &SetSpotMarginLeverageRequest, ) -> Result<Response<EmptyResult>, Error>

Set Leverage. Set the maximum leverage for spot margin trade.

Requires authentication. The account must have completed spot margin activation (including the required quiz) beforehand.

Trait Implementations§

Source§

impl Clone for Client

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Client

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. 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<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> 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> 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> 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 = !

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

fn try_from(value: U) -> Result<T, !>

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