pub struct BybitRestClient { /* private fields */ }Expand description
Bybit V5 REST API client
Implementations§
Source§impl BybitRestClient
impl BybitRestClient
Sourcepub fn new(
api_key: impl Into<SmartString>,
secret_key: impl Into<SmartString>,
is_testnet: bool,
) -> Self
pub fn new( api_key: impl Into<SmartString>, secret_key: impl Into<SmartString>, is_testnet: bool, ) -> Self
Create a new Bybit REST client
Sourcepub async fn create_order(
&self,
request: BybitOrderRequest,
report_tx: Sender<ExecutionReport>,
) -> EMSResult<BybitOrderResponse>
pub async fn create_order( &self, request: BybitOrderRequest, report_tx: Sender<ExecutionReport>, ) -> EMSResult<BybitOrderResponse>
Create a single order
Sourcepub async fn create_batch_orders(
&self,
category: &str,
orders: SmallVec<[BybitOrderRequest; 10]>,
report_tx: Sender<ExecutionReport>,
) -> EMSResult<BatchResult<BybitOrderResponse>>
pub async fn create_batch_orders( &self, category: &str, orders: SmallVec<[BybitOrderRequest; 10]>, report_tx: Sender<ExecutionReport>, ) -> EMSResult<BatchResult<BybitOrderResponse>>
Create multiple orders in batch
Sourcepub async fn get_account_info(&self) -> EMSResult<BybitAccountInfo>
pub async fn get_account_info(&self) -> EMSResult<BybitAccountInfo>
Get account information including account type detection This is critical for V5 API compliance as different account types support different features and have different API behaviors
Sourcepub async fn get_wallet_balance(
&self,
account_type: &str,
coin: Option<&str>,
) -> EMSResult<Vec<BybitWalletBalance>>
pub async fn get_wallet_balance( &self, account_type: &str, coin: Option<&str>, ) -> EMSResult<Vec<BybitWalletBalance>>
Get wallet balance
Sourcepub async fn get_positions(
&self,
category: &str,
symbol: Option<&str>,
settle_coin: Option<&str>,
) -> EMSResult<Vec<BybitPosition>>
pub async fn get_positions( &self, category: &str, symbol: Option<&str>, settle_coin: Option<&str>, ) -> EMSResult<Vec<BybitPosition>>
Get positions
Sourcepub async fn cancel_order(
&self,
category: &str,
symbol: &str,
order_id: Option<&str>,
order_link_id: Option<&str>,
) -> EMSResult<()>
pub async fn cancel_order( &self, category: &str, symbol: &str, order_id: Option<&str>, order_link_id: Option<&str>, ) -> EMSResult<()>
Cancel a single order
Sourcepub async fn create_order_v5(
&self,
request: BybitOrderRequest,
report_tx: Sender<ExecutionReport>,
) -> EMSResult<BybitOrderResponse>
pub async fn create_order_v5( &self, request: BybitOrderRequest, report_tx: Sender<ExecutionReport>, ) -> EMSResult<BybitOrderResponse>
V5 Account-aware order creation with automatic account type detection
Sourcepub async fn create_batch_orders_v5(
&self,
category: &str,
orders: SmallVec<[BybitOrderRequest; 10]>,
report_tx: Sender<ExecutionReport>,
) -> EMSResult<BatchResult<BybitOrderResponse>>
pub async fn create_batch_orders_v5( &self, category: &str, orders: SmallVec<[BybitOrderRequest; 10]>, report_tx: Sender<ExecutionReport>, ) -> EMSResult<BatchResult<BybitOrderResponse>>
Create batch orders with account type awareness
Sourcepub async fn get_supported_categories(&self) -> EMSResult<Vec<SmartString>>
pub async fn get_supported_categories(&self) -> EMSResult<Vec<SmartString>>
Get supported categories for the current account type
Sourcepub async fn supports_feature(&self, feature: &str) -> EMSResult<bool>
pub async fn supports_feature(&self, feature: &str) -> EMSResult<bool>
Check if account supports a specific V5 feature
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BybitRestClient
impl !RefUnwindSafe for BybitRestClient
impl Send for BybitRestClient
impl Sync for BybitRestClient
impl Unpin for BybitRestClient
impl !UnwindSafe for BybitRestClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more