Skip to content

Commit

Permalink
fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Fogapod authored and Igosuki committed May 24, 2024
1 parent e28bdc8 commit c3ab0e9
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 16 deletions.
2 changes: 0 additions & 2 deletions examples/binance_websockets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,6 @@ async fn mark_price_websocket(logger_tx: UnboundedSender<WebsocketEvent>) {
Ok(())
});



if let Err(e) = web_socket.connect_futures(&mark_price).await {
println!("Connection error: {e}");
}
Expand Down
2 changes: 1 addition & 1 deletion src/futures/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ impl FuturesAccount {

/// Get currently open orders
pub async fn get_open_orders(&self, symbol: impl Into<String>) -> Result<Vec<Order>> {
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
}

Expand Down
2 changes: 1 addition & 1 deletion src/futures/market.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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?;
Expand Down
2 changes: 1 addition & 1 deletion src/futures/ws_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
12 changes: 3 additions & 9 deletions src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,10 @@ pub fn to_f64(v: &Value) -> f64 {
v.as_str().unwrap().parse().unwrap()
}

pub fn get_timestamp() -> Result<u64> {
Ok(Utc::now().timestamp_millis() as u64)
}
pub fn get_timestamp() -> Result<u64> { 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";
Expand All @@ -108,6 +104,4 @@ pub fn bool_to_string(b: bool) -> String {
}
}

pub fn bool_to_string_some(b: bool) -> Option<String> {
Some(bool_to_string(b))
}
pub fn bool_to_string_some(b: bool) -> Option<String> { Some(bool_to_string(b)) }
2 changes: 1 addition & 1 deletion src/websockets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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") }
Expand Down
3 changes: 2 additions & 1 deletion src/ws_model.rs
Original file line number Diff line number Diff line change
@@ -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")]
Expand Down

0 comments on commit c3ab0e9

Please sign in to comment.