pub struct BinanceRestClient { /* private fields */ }Expand description
Binance REST client for making authenticated API calls
Implementations§
Source§impl BinanceRestClient
impl BinanceRestClient
Sourcepub fn new_hmac(api_key: SmartString, secret_key: SmartString) -> Self
pub fn new_hmac(api_key: SmartString, secret_key: SmartString) -> Self
Create a new Binance REST client with HMAC authentication
Sourcepub fn new_ed25519(
api_key: SmartString,
private_key: SmartString,
) -> Result<Self>
pub fn new_ed25519( api_key: SmartString, private_key: SmartString, ) -> Result<Self>
Create a new Binance REST client with Ed25519 authentication
Sourcepub fn new_with_auth(auth: BinanceAuth) -> Self
pub fn new_with_auth(auth: BinanceAuth) -> Self
Create a new Binance REST client from existing BinanceAuth
Sourcepub fn with_api_url(self, api_url: SmartString) -> Self
pub fn with_api_url(self, api_url: SmartString) -> Self
Set a custom API URL (for testing or using testnet)
Sourcepub async fn place_order(
&self,
params: PlaceOrderParams,
) -> Result<BinanceOrderResponse>
pub async fn place_order( &self, params: PlaceOrderParams, ) -> Result<BinanceOrderResponse>
Place a new order on Binance
Sourcepub async fn cancel_order(
&self,
symbol: &str,
client_order_id: &str,
) -> Result<BinanceOrderResponse>
pub async fn cancel_order( &self, symbol: &str, client_order_id: &str, ) -> Result<BinanceOrderResponse>
Cancel an existing order on Binance
Sourcepub async fn get_order_status(
&self,
symbol: &str,
client_order_id: &str,
) -> Result<BinanceOrderResponse>
pub async fn get_order_status( &self, symbol: &str, client_order_id: &str, ) -> Result<BinanceOrderResponse>
Get order status from Binance
Sourcepub async fn cancel_all_orders(
&self,
symbol: &str,
) -> Result<Vec<BinanceOrderResponse>>
pub async fn cancel_all_orders( &self, symbol: &str, ) -> Result<Vec<BinanceOrderResponse>>
Cancel all open orders for a specific symbol
Sourcepub async fn get_exchange_info(&self) -> Result<BinanceExchangeInfo>
pub async fn get_exchange_info(&self) -> Result<BinanceExchangeInfo>
Get exchange information (public endpoint, no authentication required)
Sourcepub async fn create_listen_key(&self) -> Result<String>
pub async fn create_listen_key(&self) -> Result<String>
Create a new listen key for user data stream
Sourcepub async fn refresh_listen_key(&self, listen_key: &str) -> Result<()>
pub async fn refresh_listen_key(&self, listen_key: &str) -> Result<()>
Refresh existing listen key to keep it active
Sourcepub async fn delete_listen_key(&self, listen_key: &str) -> Result<()>
pub async fn delete_listen_key(&self, listen_key: &str) -> Result<()>
Delete a listen key
Sourcepub async fn place_oco_order(
&self,
params: OcoOrderParams<'_>,
) -> Result<BinanceOcoResponse>
pub async fn place_oco_order( &self, params: OcoOrderParams<'_>, ) -> Result<BinanceOcoResponse>
Place an OCO (One-Cancels-Other) order
Sourcepub async fn place_sor_order(
&self,
params: SorOrderParams<'_>,
) -> Result<BinanceSorResponse>
pub async fn place_sor_order( &self, params: SorOrderParams<'_>, ) -> Result<BinanceSorResponse>
Place a SOR (Smart Order Routing) order
Sourcepub async fn place_native_batch_orders(
&self,
orders: Vec<BinanceNativeOrder>,
) -> Result<Vec<BatchOrderResult>>
pub async fn place_native_batch_orders( &self, orders: Vec<BinanceNativeOrder>, ) -> Result<Vec<BatchOrderResult>>
Place multiple orders using native Binance batch API (max 5 orders)
Sourcepub async fn place_batch_orders(
&self,
params: BatchOrderParams,
) -> Result<Vec<Result<BinanceOrderResponse>>>
pub async fn place_batch_orders( &self, params: BatchOrderParams, ) -> Result<Vec<Result<BinanceOrderResponse>>>
Place multiple orders in a batch (uses native API for ≤5 orders, concurrent for larger batches)
Sourcepub async fn place_batch_orders_improved(
&self,
orders: SmallVec<[Order; 8]>,
) -> Result<BatchResult<BinanceOrderResponse>>
pub async fn place_batch_orders_improved( &self, orders: SmallVec<[Order; 8]>, ) -> Result<BatchResult<BinanceOrderResponse>>
Place multiple orders with improved error handling that separates transport from per-order errors
Sourcepub async fn cancel_order_list(
&self,
symbol: &str,
order_list_id: i64,
) -> Result<BinanceOcoResponse>
pub async fn cancel_order_list( &self, symbol: &str, order_list_id: i64, ) -> Result<BinanceOcoResponse>
Cancel an order list (OCO, OTO, etc.)
Sourcepub async fn amend_order_keep_priority(
&self,
symbol: &str,
client_order_id: &str,
new_quantity: Decimal,
) -> Result<BinanceAmendResponse>
pub async fn amend_order_keep_priority( &self, symbol: &str, client_order_id: &str, new_quantity: Decimal, ) -> Result<BinanceAmendResponse>
Amend an order keeping queue priority (reduce quantity only)
Sourcepub async fn test_sor_order(&self, params: SorOrderParams<'_>) -> Result<()>
pub async fn test_sor_order(&self, params: SorOrderParams<'_>) -> Result<()>
Test SOR order placement (validation only)
Sourcepub fn generate_ws_auth(&self) -> Result<SmartString>
pub fn generate_ws_auth(&self) -> Result<SmartString>
Generate WebSocket authentication message This exposes the unified auth system’s WebSocket functionality
Sourcepub async fn get_sor_config(&self) -> Result<Vec<BinanceSorConfig>>
pub async fn get_sor_config(&self) -> Result<Vec<BinanceSorConfig>>
Get SOR configuration from exchange info
Sourcepub async fn get_my_allocations(&self, symbol: &str) -> Result<OwnedValue>
pub async fn get_my_allocations(&self, symbol: &str) -> Result<OwnedValue>
Get allocations for SOR trades
Trait Implementations§
Source§impl Clone for BinanceRestClient
impl Clone for BinanceRestClient
Source§fn clone(&self) -> BinanceRestClient
fn clone(&self) -> BinanceRestClient
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source. Read more