diff --git a/examples/binance_websockets.rs b/examples/binance_websockets.rs index 40e7cfe..02f5fdb 100644 --- a/examples/binance_websockets.rs +++ b/examples/binance_websockets.rs @@ -207,8 +207,6 @@ async fn mark_price_websocket(logger_tx: UnboundedSender) { Ok(()) }); - - if let Err(e) = web_socket.connect_futures(&mark_price).await { println!("Connection error: {e}"); } diff --git a/src/futures/account.rs b/src/futures/account.rs index 98e0757..f62abee 100644 --- a/src/futures/account.rs +++ b/src/futures/account.rs @@ -95,7 +95,7 @@ impl FuturesAccount { /// Get currently open orders pub async fn get_open_orders(&self, symbol: impl Into) -> Result> { - let payload = build_signed_request_p(PairQuery{symbol: symbol.into()}, self.recv_window)?; + let payload = build_signed_request_p(PairQuery { symbol: symbol.into() }, self.recv_window)?; self.client.get_signed("/fapi/v1/openOrders", &payload).await } diff --git a/src/futures/market.rs b/src/futures/market.rs index 9ccc163..a58b863 100644 --- a/src/futures/market.rs +++ b/src/futures/market.rs @@ -422,7 +422,7 @@ impl FuturesMarket { end_time: end_time.into(), limit: limit.into(), pair: symbol.into(), - interval: Some(interval.into()) + interval: Some(interval.into()), }; let klines = self.client.get_d("/fapi/v1/indexPriceKlines", Some(query)).await?; diff --git a/src/futures/ws_model.rs b/src/futures/ws_model.rs index a254f2d..eadfa7f 100644 --- a/src/futures/ws_model.rs +++ b/src/futures/ws_model.rs @@ -163,7 +163,7 @@ pub struct Order { #[serde(rename = "pm")] pub price_match: PriceMatch, #[serde(rename = "gtd")] - pub good_till_date: u64 + pub good_till_date: u64, } #[derive(Clone, Debug, Deserialize)] diff --git a/src/util.rs b/src/util.rs index e5e36fe..da2a472 100644 --- a/src/util.rs +++ b/src/util.rs @@ -88,14 +88,10 @@ pub fn to_f64(v: &Value) -> f64 { v.as_str().unwrap().parse().unwrap() } -pub fn get_timestamp() -> Result { - Ok(Utc::now().timestamp_millis() as u64) -} +pub fn get_timestamp() -> Result { Ok(Utc::now().timestamp_millis() as u64) } /// Returns a duration in milliseconds for the `days` -pub fn days_millis(days: i64) -> i64 { - Duration::days(days).num_milliseconds() -} +pub fn days_millis(days: i64) -> i64 { Duration::days(days).num_milliseconds() } const TRUE: &str = "TRUE"; const FALSE: &str = "FALSE"; @@ -108,6 +104,4 @@ pub fn bool_to_string(b: bool) -> String { } } -pub fn bool_to_string_some(b: bool) -> Option { - Some(bool_to_string(b)) -} +pub fn bool_to_string_some(b: bool) -> Option { Some(bool_to_string(b)) } diff --git a/src/websockets.rs b/src/websockets.rs index 67380de..5ae5a7e 100644 --- a/src/websockets.rs +++ b/src/websockets.rs @@ -43,7 +43,7 @@ pub fn all_mini_ticker_stream() -> &'static str { "!miniTicker@arr" } pub fn mini_ticker_stream(symbol: &str) -> String { format!("{symbol}@miniTicker") } /// # Arguments -/// +/// /// * `symbol`: the market symbol /// * `update_speed`: 1 or 3 pub fn mark_price_stream(symbol: &str, update_speed: u8) -> String { format!("{symbol}@markPrice@{update_speed}s") } diff --git a/src/ws_model.rs b/src/ws_model.rs index 7ef287f..612895d 100644 --- a/src/ws_model.rs +++ b/src/ws_model.rs @@ -1,4 +1,5 @@ -use crate::rest_model::{string_or_float, Asks, Bids, ExecutionType, OrderBook, OrderSide, OrderStatus, OrderType, TimeInForce}; +use crate::rest_model::{string_or_float, Asks, Bids, ExecutionType, OrderBook, OrderSide, OrderStatus, OrderType, + TimeInForce}; #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(tag = "e")]