pub struct BybitClient { /* private fields */ }Expand description
A thin wrapper over the Bybit v5 REST API.
Implementations§
Source§impl BybitClient
impl BybitClient
Sourcepub fn new(
config: BybitConfig,
credentials: Option<BybitCredentials>,
exchange: ExchangeId,
) -> Self
pub fn new( config: BybitConfig, credentials: Option<BybitCredentials>, exchange: ExchangeId, ) -> Self
Build a new client optionally configured with credentials.
Sourcepub fn testnet(credentials: Option<BybitCredentials>) -> Self
pub fn testnet(credentials: Option<BybitCredentials>) -> Self
Convenience helper for the Bybit testnet.
pub fn get_credentials(&self) -> Option<BybitCredentials>
pub fn exchange(&self) -> ExchangeId
pub fn get_ws_url(&self) -> String
Sourcepub async fn server_time(&self) -> BrokerResult<u128>
pub async fn server_time(&self) -> BrokerResult<u128>
Fetch Bybit server time (docs/v5/market/time.mdx).
Sourcepub async fn list_executions_since(
&self,
since: DateTime<Utc>,
) -> BrokerResult<Vec<BybitExecution>>
pub async fn list_executions_since( &self, since: DateTime<Utc>, ) -> BrokerResult<Vec<BybitExecution>>
Fetch executions (fills) since the provided timestamp (inclusive), paginated.
Maps the response into framework-native Fill records.
Trait Implementations§
Source§impl ExecutionClient for BybitClient
impl ExecutionClient for BybitClient
Source§fn info(&self) -> BrokerInfo
fn info(&self) -> BrokerInfo
Return metadata about the connector for telemetry.
Source§fn place_order<'life0, 'async_trait>(
&'life0 self,
request: OrderRequest,
) -> Pin<Box<dyn Future<Output = BrokerResult<Order>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn place_order<'life0, 'async_trait>(
&'life0 self,
request: OrderRequest,
) -> Pin<Box<dyn Future<Output = BrokerResult<Order>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Place a new order on the exchange.
Source§fn cancel_order<'life0, 'async_trait>(
&'life0 self,
order_id: OrderId,
symbol: Symbol,
) -> Pin<Box<dyn Future<Output = BrokerResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn cancel_order<'life0, 'async_trait>(
&'life0 self,
order_id: OrderId,
symbol: Symbol,
) -> Pin<Box<dyn Future<Output = BrokerResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Cancel an existing order by identifier.
Source§fn amend_order<'life0, 'async_trait>(
&'life0 self,
request: OrderUpdateRequest,
) -> Pin<Box<dyn Future<Output = BrokerResult<Order>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn amend_order<'life0, 'async_trait>(
&'life0 self,
request: OrderUpdateRequest,
) -> Pin<Box<dyn Future<Output = BrokerResult<Order>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Amend an existing order in-place when the exchange supports it.
Source§fn list_open_orders<'life0, 'async_trait>(
&'life0 self,
symbol: Symbol,
) -> Pin<Box<dyn Future<Output = BrokerResult<Vec<Order>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_open_orders<'life0, 'async_trait>(
&'life0 self,
symbol: Symbol,
) -> Pin<Box<dyn Future<Output = BrokerResult<Vec<Order>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get all open orders for a symbol.
Source§fn account_balances<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = BrokerResult<Vec<AccountBalance>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn account_balances<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = BrokerResult<Vec<AccountBalance>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Retrieve the latest known account balances.
Source§fn positions<'life0, 'life1, 'async_trait>(
&'life0 self,
symbols: Option<&'life1 Vec<Symbol>>,
) -> Pin<Box<dyn Future<Output = BrokerResult<Vec<Position>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn positions<'life0, 'life1, 'async_trait>(
&'life0 self,
symbols: Option<&'life1 Vec<Symbol>>,
) -> Pin<Box<dyn Future<Output = BrokerResult<Vec<Position>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Retrieve the current open positions.
Source§fn list_instruments<'life0, 'life1, 'async_trait>(
&'life0 self,
category: &'life1 str,
) -> Pin<Box<dyn Future<Output = BrokerResult<Vec<Instrument>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_instruments<'life0, 'life1, 'async_trait>(
&'life0 self,
category: &'life1 str,
) -> Pin<Box<dyn Future<Output = BrokerResult<Vec<Instrument>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Retrieve instrument metadata for the provided market category.
Source§fn list_order_fills<'life0, 'life1, 'async_trait>(
&'life0 self,
order_id: &'life1 str,
symbol: Symbol,
) -> Pin<Box<dyn Future<Output = Result<Vec<Fill>, BrokerError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn list_order_fills<'life0, 'life1, 'async_trait>(
&'life0 self,
order_id: &'life1 str,
symbol: Symbol,
) -> Pin<Box<dyn Future<Output = Result<Vec<Fill>, BrokerError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Retrieve historical fills for an order when the exchange exposes this API.
Auto Trait Implementations§
impl !RefUnwindSafe for BybitClient
impl !UnwindSafe for BybitClient
impl Freeze for BybitClient
impl Send for BybitClient
impl Sync for BybitClient
impl Unpin for BybitClient
impl UnsafeUnpin for BybitClient
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