From 6c71ed57ad529711caa0426413ac10e7b206bf1e Mon Sep 17 00:00:00 2001 From: nkaz001 Date: Wed, 20 Nov 2024 06:52:58 -0500 Subject: [PATCH] chore(rust): update CI. --- connector/src/binancefutures/mod.rs | 9 ++++++++- hftbacktest/Cargo.toml | 15 +++------------ hftbacktest/src/types.rs | 12 ------------ py-hftbacktest/Cargo.toml | 2 +- 4 files changed, 12 insertions(+), 26 deletions(-) diff --git a/connector/src/binancefutures/mod.rs b/connector/src/binancefutures/mod.rs index 5f06530..07a8150 100644 --- a/connector/src/binancefutures/mod.rs +++ b/connector/src/binancefutures/mod.rs @@ -59,7 +59,14 @@ impl From for Value { match value { BinanceFuturesError::InstrumentNotFound => Value::String(value.to_string()), BinanceFuturesError::InvalidRequest => Value::String(value.to_string()), - BinanceFuturesError::ReqError(error) => error.into(), + BinanceFuturesError::ReqError(error) => { + let mut map = HashMap::new(); + if let Some(code) = error.status() { + map.insert("status_code".to_string(), Value::String(code.to_string())); + } + map.insert("msg".to_string(), Value::String(error.to_string())); + Value::Map(map) + } BinanceFuturesError::OrderError { code, msg } => Value::Map({ let mut map = HashMap::new(); map.insert("code".to_string(), Value::Int(code)); diff --git a/hftbacktest/Cargo.toml b/hftbacktest/Cargo.toml index 8a0e169..b16dec9 100644 --- a/hftbacktest/Cargo.toml +++ b/hftbacktest/Cargo.toml @@ -21,12 +21,9 @@ rust-version = "1.81" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [features] -default = ["backtest", "live", "binancefutures", "bybit"] +default = ["backtest", "live"] backtest = ["zip", "uuid", "nom", "hftbacktest-derive"] -live = ["chrono", "tokio", "futures-util", "iceoryx2"] -use_reqwest = ["reqwest"] -binancefutures = ["serde", "serde_json", "tokio-tungstenite", "use_reqwest", "sha2", "hmac", "rand"] -bybit = ["serde", "serde_json", "tokio-tungstenite", "use_reqwest", "sha2", "hmac", "rand"] +live = ["chrono", "tokio", "futures-util", "iceoryx2", "rand"] unstable_fuse = [] [dependencies] @@ -36,19 +33,13 @@ thiserror = "2.0.3" dyn-clone = "1.0.17" bincode = "2.0.0-rc.3" chrono = { version = "0.4.33", optional = true } -serde = { version = "1.0.196", features = ["derive"], optional = true } -serde_json = { version = "1.0.113", optional = true } tokio = { version = "1.35.1", features = ["full"], optional = true } -tokio-tungstenite = { version = "0.24.0", features = ["rustls-tls-native-roots"], optional = true } -reqwest = { version = "0.12.3", default-features = false, features = ["json", "rustls-tls-native-roots"], optional = true } zip = { version = "2.1.3", optional = true } futures-util = { version = "0.3.30", optional = true } -sha2 = { version = "0.11.0-pre.3", optional = true } -hmac = { version = "0.13.0-pre.3", optional = true } -rand = { version = "0.8.5", optional = true } uuid = { version = "1.8.0", features = ["v4"], optional = true } nom = { version = "7.1.3", optional = true } iceoryx2 = { version = "0.4.1", optional = true, features = ["logger_tracing"] } +rand = { version = "0.8.5", optional = true } hftbacktest-derive = { path = "../hftbacktest-derive", optional = true, version = "0.2.0" } [dev-dependencies] diff --git a/hftbacktest/src/types.rs b/hftbacktest/src/types.rs index 0489cb2..6166a89 100644 --- a/hftbacktest/src/types.rs +++ b/hftbacktest/src/types.rs @@ -87,18 +87,6 @@ impl From for Value { } } -#[cfg(feature = "use_reqwest")] -impl From for Value { - fn from(value: reqwest::Error) -> Self { - let mut map = HashMap::new(); - if let Some(code) = value.status() { - map.insert("status_code".to_string(), Value::String(code.to_string())); - } - map.insert("msg".to_string(), Value::String(value.to_string())); - Value::Map(map) - } -} - /// Error conveyed through [`LiveEvent`]. #[derive(Clone, Debug, Decode, Encode)] pub struct LiveError { diff --git a/py-hftbacktest/Cargo.toml b/py-hftbacktest/Cargo.toml index ab85c42..4f9daa5 100644 --- a/py-hftbacktest/Cargo.toml +++ b/py-hftbacktest/Cargo.toml @@ -9,5 +9,5 @@ crate-type = ["cdylib"] [dependencies] pyo3 = { version = "0.23.1", features = ["extension-module"] } -hftbacktest = { path = "../hftbacktest", features = ["backtest"] } +hftbacktest = { path = "../hftbacktest", default-features = false, features = ["backtest"] } hftbacktest-derive = { path = "../hftbacktest-derive" } \ No newline at end of file