Skip to content

Commit b60f412

Browse files
committed
Add live node test for databento crate
1 parent 72f01d7 commit b60f412

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

crates/adapters/databento/bin/node_test.rs

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,12 @@ use std::path::PathBuf;
1717

1818
use nautilus_common::enums::Environment;
1919
use nautilus_core::env::get_env_var;
20-
use nautilus_databento::factories::{DatabentoDataClientFactory, DatabentoLiveClientConfig};
20+
use nautilus_databento::{
21+
actor::{DatabentoSubscriberActor, DatabentoSubscriberActorConfig},
22+
factories::{DatabentoDataClientFactory, DatabentoLiveClientConfig},
23+
};
2124
use nautilus_live::node::LiveNode;
22-
use nautilus_model::identifiers::TraderId;
25+
use nautilus_model::identifiers::{ClientId, InstrumentId, TraderId};
2326
use tokio::time::Duration;
2427

2528
// Run with `cargo run -p nautilus-databento --bin databento-node-test --features live`
@@ -53,7 +56,6 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
5356
"⚠️ Publishers file not found at: {}",
5457
publishers_filepath.display()
5558
);
56-
println!(" This is expected in CI/test environments");
5759
}
5860

5961
// Configure Databento client
@@ -66,17 +68,27 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
6668

6769
let client_factory = Box::new(DatabentoDataClientFactory::new());
6870

71+
// Create and register a Databento subscriber actor
72+
let client_id = ClientId::new("DATABENTO");
73+
let instrument_ids = vec![
74+
InstrumentId::from("ES.c.0.GLBX"),
75+
// Add more instruments as needed
76+
];
77+
6978
// Build the live node with Databento data client
7079
let mut node = LiveNode::builder(node_name, trader_id, environment)?
7180
.with_load_state(false)
7281
.with_save_state(false)
73-
.add_data_client(
74-
Some("DATABENTO".to_string()), // Use custom name
75-
client_factory,
76-
Box::new(databento_config),
77-
)?
82+
.add_data_client(None, client_factory, Box::new(databento_config))?
7883
.build()?;
7984

85+
// TODO: Move this into trader registration
86+
let actor_config = DatabentoSubscriberActorConfig::new(instrument_ids, client_id);
87+
let cache = node.kernel().cache();
88+
let clock = node.kernel().clock();
89+
let actor = DatabentoSubscriberActor::new(actor_config, cache, clock);
90+
node.add_actor(Box::new(actor))?;
91+
8092
node.start().await?;
8193

8294
// Let it run briefly to ensure all components are properly initialized

0 commit comments

Comments
 (0)