pub struct BinanceExchange { /* private fields */ }Expand description
Binance exchange implementation providing order execution and market data access
Implementations§
Source§impl BinanceExchange
impl BinanceExchange
Sourcepub fn rest_client(&self) -> &BinanceRestClient
pub fn rest_client(&self) -> &BinanceRestClient
Get direct access to REST client for performance-critical operations
Sourcepub const fn websocket_client(&self) -> &BinanceWebSocketClient
pub const fn websocket_client(&self) -> &BinanceWebSocketClient
Get direct access to WebSocket client for performance-critical operations
Sourcepub fn create_rest_client(
api_key: String,
secret_key: String,
) -> BinanceRestClient
pub fn create_rest_client( api_key: String, secret_key: String, ) -> BinanceRestClient
Create standalone REST client with shared auth
Sourcepub fn create_websocket_client(
api_key: String,
secret_key: String,
) -> BinanceWebSocketClient
pub fn create_websocket_client( api_key: String, secret_key: String, ) -> BinanceWebSocketClient
Create standalone WebSocket client with shared auth
Sourcepub fn new_with_config(
api_key: String,
secret_key: String,
config: BinanceConfig,
) -> Self
pub fn new_with_config( api_key: String, secret_key: String, config: BinanceConfig, ) -> Self
Create a new Binance exchange adapter with custom major symbols
Sourcepub fn new_ed25519(api_key: String, private_key: String) -> Result<Self>
pub fn new_ed25519(api_key: String, private_key: String) -> Result<Self>
Create a new Binance exchange adapter with Ed25519 authentication
Sourcepub fn new_ed25519_with_config(
api_key: String,
private_key: String,
config: BinanceConfig,
) -> Result<Self>
pub fn new_ed25519_with_config( api_key: String, private_key: String, config: BinanceConfig, ) -> Result<Self>
Create a new Binance exchange adapter with Ed25519 authentication and custom configuration
Sourcepub async fn place_oco_order(
&self,
symbol: &str,
side: OrderSide,
quantity: Decimal,
above_type: &str,
below_type: &str,
above_price: Option<Decimal>,
below_price: Option<Decimal>,
above_stop_price: Option<Decimal>,
below_stop_price: Option<Decimal>,
report_tx: Sender<ExecutionReport>,
) -> Result<()>
pub async fn place_oco_order( &self, symbol: &str, side: OrderSide, quantity: Decimal, above_type: &str, below_type: &str, above_price: Option<Decimal>, below_price: Option<Decimal>, above_stop_price: Option<Decimal>, below_stop_price: Option<Decimal>, report_tx: Sender<ExecutionReport>, ) -> Result<()>
Place an OCO (One-Cancels-Other) order
§Arguments
symbol- Trading symbol (e.g., “BTCUSDT”)side- Order side (Buy/Sell)quantity- Order quantityabove_type- Order type for above price (STOP_LOSS_LIMIT,LIMIT_MAKER, etc.)below_type- Order type for below price (STOP_LOSS,STOP_LOSS_LIMIT, etc.)above_price- Limit price for above orderbelow_price- Limit price for below orderabove_stop_price- Stop price for above orderbelow_stop_price- Stop price for below orderreport_tx- Channel to send execution reports
Sourcepub async fn place_sor_order(
&self,
symbol: &str,
side: OrderSide,
order_type: OrderType,
quantity: Decimal,
price: Option<Decimal>,
time_in_force: Option<TimeInForce>,
report_tx: Sender<ExecutionReport>,
) -> Result<()>
pub async fn place_sor_order( &self, symbol: &str, side: OrderSide, order_type: OrderType, quantity: Decimal, price: Option<Decimal>, time_in_force: Option<TimeInForce>, report_tx: Sender<ExecutionReport>, ) -> Result<()>
Place a SOR (Smart Order Routing) order
§Arguments
symbol- Trading symbol (e.g., “BTCUSDT”)side- Order side (Buy/Sell)order_type- Order type (Limit/Market)quantity- Order quantityprice- Order price (required for LIMIT orders)time_in_force- Time in force (GTC/IOC/FOK)report_tx- Channel to send execution reports
Sourcepub async fn place_batch_orders(
&self,
orders: Vec<Order>,
report_tx: Sender<ExecutionReport>,
) -> Result<BatchResult<()>>
pub async fn place_batch_orders( &self, orders: Vec<Order>, report_tx: Sender<ExecutionReport>, ) -> Result<BatchResult<()>>
Sourcepub async fn get_sor_configuration(&self) -> Result<Vec<OwnedValue>>
pub async fn get_sor_configuration(&self) -> Result<Vec<OwnedValue>>
Get SOR configuration for available symbols
Trait Implementations§
Source§impl Clone for BinanceExchange
impl Clone for BinanceExchange
Source§impl Exchange for BinanceExchange
impl Exchange for BinanceExchange
Source§fn place_order<'life0, 'async_trait>(
&'life0 self,
order: Order,
report_tx: Sender<ExecutionReport>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn place_order<'life0, 'async_trait>(
&'life0 self,
order: Order,
report_tx: Sender<ExecutionReport>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Places a new order on the exchange
Source§fn cancel_order<'life0, 'async_trait>(
&'life0 self,
order_id: SmartString,
report_tx: Sender<ExecutionReport>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn cancel_order<'life0, 'async_trait>(
&'life0 self,
order_id: SmartString,
report_tx: Sender<ExecutionReport>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Cancels an existing order
Source§fn modify_order<'life0, 'async_trait>(
&'life0 self,
order_id: SmartString,
new_price: Option<Decimal>,
new_quantity: Option<Decimal>,
report_tx: Sender<ExecutionReport>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn modify_order<'life0, 'async_trait>(
&'life0 self,
order_id: SmartString,
new_price: Option<Decimal>,
new_quantity: Option<Decimal>,
report_tx: Sender<ExecutionReport>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Modifies an existing order
Source§fn cancel_all_orders<'life0, 'async_trait>(
&'life0 self,
instrument_id: Option<InstrumentId>,
_report_tx: Sender<ExecutionReport>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn cancel_all_orders<'life0, 'async_trait>(
&'life0 self,
instrument_id: Option<InstrumentId>,
_report_tx: Sender<ExecutionReport>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Cancels all open orders, optionally filtered by instrument
Source§fn get_order_status<'life0, 'life1, 'async_trait>(
&'life0 self,
order_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<OrderStatus>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_order_status<'life0, 'life1, 'async_trait>(
&'life0 self,
order_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<OrderStatus>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Retrieves the status of an order
Source§fn connect<'life0, 'async_trait>(
&'life0 self,
_report_sender: Sender<ExecutionReport>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn connect<'life0, 'async_trait>(
&'life0 self,
_report_sender: Sender<ExecutionReport>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Connects to the exchange
Source§fn disconnect<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn disconnect<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Disconnects from the exchange
Source§fn is_connected<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn is_connected<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Checks if connected to the exchange
Source§fn get_instruments<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<SmallVec<[InstrumentId; 32]>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_instruments<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<SmallVec<[InstrumentId; 32]>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Gets a list of instruments supported by this exchange
Auto Trait Implementations§
impl !Freeze for BinanceExchange
impl !RefUnwindSafe for BinanceExchange
impl Send for BinanceExchange
impl Sync for BinanceExchange
impl Unpin for BinanceExchange
impl !UnwindSafe for BinanceExchange
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