Skip to content

Commit

Permalink
Fixed bitmex test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
soulmachine committed Jul 5, 2024
1 parent 4f952b6 commit 77636fc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
22 changes: 11 additions & 11 deletions crypto-msg-parser/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "crypto-msg-parser"
version = "2.9.1"
version = "2.9.2"
authors = ["soulmachine <[email protected]>"]
edition = "2021"
description = "Parse websocket messages from cryptocurreny exchanges"
Expand All @@ -9,17 +9,17 @@ repository = "https://github.com/crypto-crawler/crypto-msg-parser/tree/main/cryp
keywords = ["cryptocurrency", "blockchain", "trading"]

[dependencies]
chrono = "0.4.31"
crypto-contract-value = "1.7.24"
chrono = "0.4.38"
crypto-contract-value = "1.7.25"
crypto-market-type = "1.1.6"
crypto-msg-type = "1.0.12"
crypto-message = "1.1.19"
crypto-pair = "2.3.19"
crypto-message = "1.1.21"
crypto-pair = "2.3.20"
if_chain = "1.0.2"
once_cell = "1.19.0"
reqwest = { version = "0.11.23", features = ["blocking", "gzip"] }
simple-error = "0.3.0"
serde = { version = "1.0.193", features = ["derive"] }
serde_json = "1.0.108"
strum = "0.25.0"
strum_macros = "0.25.3"
reqwest = { version = "0.12.5", features = ["blocking", "gzip"] }
simple-error = "0.3.1"
serde = { version = "1.0.203", features = ["derive"] }
serde_json = "1.0.120"
strum = "0.26.3"
strum_macros = "0.26.4"
14 changes: 8 additions & 6 deletions crypto-msg-parser/src/exchanges/bitmex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const EXCHANGE_NAME: &str = "bitmex";

// symbol -> tickSize
static SYMBOL_INDEX_AND_TICK_SIZE_MAP: Lazy<HashMap<String, (usize, f64)>> = Lazy::new(|| {
let mut m: HashMap<String, (usize, f64)> = vec![
let m: HashMap<String, (usize, f64)> = vec![
("A50G16", (65, 2.5)),
("A50H16", (67, 2.5)),
("A50J16", (72, 2.5)),
Expand Down Expand Up @@ -491,14 +491,16 @@ static SYMBOL_INDEX_AND_TICK_SIZE_MAP: Lazy<HashMap<String, (usize, f64)>> = Laz
.map(|x| (x.0.to_string(), x.1))
.collect();

let from_online = fetch_tick_sizes();
for (symbol, tick_size) in from_online {
m.insert(symbol, tick_size);
}
// deprecated by May 31st 2023
// let from_online = fetch_tick_sizes();
// for (symbol, tick_size) in from_online {
// m.insert(symbol, tick_size);
// }

m
});

#[allow(dead_code)]
fn fetch_tick_sizes() -> BTreeMap<String, (usize, f64)> {
#[derive(Serialize, Deserialize)]
#[allow(non_snake_case)]
Expand Down Expand Up @@ -566,7 +568,7 @@ struct RawOrder {
id: usize,
side: String, // Sell, Buy
size: Option<f64>, // None if action = delete
price: Option<f64>, // None if action = delete
price: Option<f64>, // always exists after May 31st 2023, see https://www.bitmex.com/app/wsAPI#OrderBookL2
timestamp: Option<String>,
#[serde(flatten)]
extra: HashMap<String, Value>,
Expand Down

0 comments on commit 77636fc

Please sign in to comment.