Skip to content

Commit

Permalink
chore(rust): update CI.
Browse files Browse the repository at this point in the history
  • Loading branch information
nkaz001 committed Nov 20, 2024
1 parent db28606 commit 6c71ed5
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 26 deletions.
9 changes: 8 additions & 1 deletion connector/src/binancefutures/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,14 @@ impl From<BinanceFuturesError> 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));
Expand Down
15 changes: 3 additions & 12 deletions hftbacktest/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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]
Expand Down
12 changes: 0 additions & 12 deletions hftbacktest/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,18 +87,6 @@ impl From<anyhow::Error> for Value {
}
}

#[cfg(feature = "use_reqwest")]
impl From<reqwest::Error> 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 {
Expand Down
2 changes: 1 addition & 1 deletion py-hftbacktest/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }

0 comments on commit 6c71ed5

Please sign in to comment.