diff --git a/hftbacktest/Cargo.toml b/hftbacktest/Cargo.toml index f8ee817..b64d21a 100644 --- a/hftbacktest/Cargo.toml +++ b/hftbacktest/Cargo.toml @@ -48,7 +48,7 @@ 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 } +iceoryx2 = { version = "0.4.1", optional = true, features = ["logger_tracing"] } hftbacktest-derive = { path = "../hftbacktest-derive", optional = true, version = "0.2.0" } [dev-dependencies] diff --git a/hftbacktest/examples/gridtrading_live.rs b/hftbacktest/examples/gridtrading_live.rs index 87ccdfa..f8f753f 100644 --- a/hftbacktest/examples/gridtrading_live.rs +++ b/hftbacktest/examples/gridtrading_live.rs @@ -1,6 +1,12 @@ use algo::gridtrading; use hftbacktest::{ - live::{LiveBot, LoggingRecorder}, + live::{ + ipc::iceoryx::IceoryxUnifiedChannel, + Instrument, + LiveBot, + LiveBotBuilder, + LoggingRecorder, + }, prelude::{Bot, HashMapMarketDepth}, }; @@ -8,10 +14,16 @@ mod algo; const ORDER_PREFIX: &str = "prefix"; -fn prepare_live() -> LiveBot { - let mut hbt = LiveBot::builder() - .register("binancefutures", "1000SHIBUSDT", 0.000001, 1.0) - .depth(|asset| HashMapMarketDepth::new(asset.tick_size, asset.lot_size)) +fn prepare_live() -> LiveBot { + let mut hbt = LiveBotBuilder::new() + .register(Instrument::new( + "binancefutures", + "1000SHIBUSDT", + 0.000001, + 1.0, + HashMapMarketDepth::new(0.000001, 1.0), + 0, + )) .build() .unwrap(); diff --git a/hftbacktest/examples/gridtrading_live_bybit.rs b/hftbacktest/examples/gridtrading_live_bybit.rs index a305358..cfae91f 100644 --- a/hftbacktest/examples/gridtrading_live_bybit.rs +++ b/hftbacktest/examples/gridtrading_live_bybit.rs @@ -1,6 +1,12 @@ use algo::gridtrading; use hftbacktest::{ - live::{LiveBot, LoggingRecorder}, + live::{ + ipc::iceoryx::IceoryxUnifiedChannel, + Instrument, + LiveBot, + LiveBotBuilder, + LoggingRecorder, + }, prelude::{Bot, ErrorKind, HashMapMarketDepth}, }; use tracing::error; @@ -9,10 +15,16 @@ mod algo; const ORDER_PREFIX: &str = "prefix"; -fn prepare_live() -> LiveBot { - let mut hbt = LiveBot::builder() - .register("bybit-futures", "BTCUSDT", 0.1, 0.001) - .depth(|asset| HashMapMarketDepth::new(asset.tick_size, asset.lot_size)) +fn prepare_live() -> LiveBot { + let mut hbt = LiveBotBuilder::new() + .register(Instrument::new( + "bybit-futures", + "BTCUSDT", + 0.1, + 0.001, + HashMapMarketDepth::new(0.000001, 1.0), + 0, + )) .error_handler(|error| { match error.kind { ErrorKind::ConnectionInterrupted => { diff --git a/hftbacktest/examples/live_order_error_handling.rs b/hftbacktest/examples/live_order_error_handling.rs index 3dfb327..c0b719d 100644 --- a/hftbacktest/examples/live_order_error_handling.rs +++ b/hftbacktest/examples/live_order_error_handling.rs @@ -1,6 +1,13 @@ use algo::gridtrading; use hftbacktest::{ - live::{BotError, LiveBot, LoggingRecorder}, + live::{ + ipc::iceoryx::IceoryxUnifiedChannel, + BotError, + Instrument, + LiveBot, + LiveBotBuilder, + LoggingRecorder, + }, prelude::{Bot, ErrorKind, HashMapMarketDepth, Value}, }; use tracing::error; @@ -9,9 +16,16 @@ mod algo; const ORDER_PREFIX: &str = "prefix"; -fn prepare_live() -> LiveBot { - let mut hbt = LiveBot::builder() - .register("binancefutures", "SOLUSDT", 0.001, 1.0) +fn prepare_live() -> LiveBot { + let mut hbt = LiveBotBuilder::new() + .register(Instrument::new( + "binancefutures", + "SOLUSDT", + 0.001, + 1.0, + HashMapMarketDepth::new(0.001, 1.0), + 0, + )) .error_handler(|error| { match error.kind { ErrorKind::ConnectionInterrupted => {