🔧 PROGRESS: Import path fixes and type cleanup
- Fixed missing imports in backtesting and risk-data crates - Corrected ConnectionStatus usage patterns - Fixed ConfigManager constructor calls - Resolved Interactive Brokers config conversions - Added proper Decimal import patterns NEXT: Aggressive duplicate type system elimination with parallel agents 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -222,6 +222,7 @@ pub use crate::utils::{
|
||||
use tokio::sync::broadcast;
|
||||
// Import canonical types from trading_engine prelude per TYPE_GOVERNANCE.md
|
||||
use common::prelude::*;
|
||||
use trading_engine::types::prelude::OrderEvent; // Add missing OrderEvent import
|
||||
|
||||
// Import shared configuration from foxhunt-config-crate
|
||||
use config::{DataModuleConfig, DataModuleSettings};
|
||||
@@ -260,7 +261,17 @@ impl DataManager {
|
||||
// REMOVED: Polygon client initialization
|
||||
|
||||
let ib_client = if let Some(ib_config) = &config.interactive_brokers {
|
||||
Some(brokers::InteractiveBrokersAdapter::new(ib_config.clone()))
|
||||
let broker_config = brokers::IBConfig {
|
||||
host: ib_config.host.clone(),
|
||||
port: ib_config.port,
|
||||
client_id: ib_config.client_id as i32,
|
||||
account_id: std::env::var("IB_ACCOUNT_ID").unwrap_or_else(|_| "DU123456".to_string()),
|
||||
connection_timeout: ib_config.timeout_seconds,
|
||||
heartbeat_interval: 30,
|
||||
max_reconnect_attempts: 5,
|
||||
request_timeout: 30,
|
||||
};
|
||||
Some(brokers::InteractiveBrokersAdapter::new(broker_config))
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
@@ -550,7 +550,7 @@ impl BenzingaHFTIntegration {
|
||||
signal_config: &SignalConfig,
|
||||
rate_limiter: &Arc<RwLock<HashMap<Symbol, VecDeque<DateTime<Utc>>>>>,
|
||||
) -> Option<TradingSignal> {
|
||||
let symbol = event.symbol()?.clone();
|
||||
let symbol = event.symbol().clone();
|
||||
let now = Utc::now();
|
||||
|
||||
// Check rate limiting
|
||||
|
||||
@@ -352,7 +352,7 @@ impl BenzingaProviderFactory {
|
||||
config: BenzingaStreamingConfig,
|
||||
) -> crate::error::Result<BenzingaHFTIntegration> {
|
||||
// Create a default config manager for now - this needs proper implementation
|
||||
let config_manager = config::ConfigManager::new_in_memory()?;
|
||||
let config_manager = config::ConfigManager::new(None, None, None).await?;
|
||||
BenzingaHFTIntegration::new(config_manager).await
|
||||
}
|
||||
|
||||
|
||||
@@ -1037,8 +1037,7 @@ impl RealTimeProvider for ProductionBenzingaProvider {
|
||||
*status = ConnectionStatus::connected();
|
||||
}
|
||||
|
||||
self.metrics.record_connection_success();
|
||||
self.connected.store(true, Ordering::Relaxed);
|
||||
self.metrics.successful_connections.fetch_add(1, Ordering::Relaxed);
|
||||
|
||||
// Start background tasks
|
||||
self.start_background_tasks().await?;
|
||||
@@ -1069,7 +1068,10 @@ impl RealTimeProvider for ProductionBenzingaProvider {
|
||||
*status = ConnectionStatus::disconnected();
|
||||
}
|
||||
|
||||
self.connection_status.write().await.is_connected = false;
|
||||
{
|
||||
let mut status = self.connection_status.write().await;
|
||||
status.state = ConnectionState::Disconnected;
|
||||
}
|
||||
info!("Disconnected from Benzinga WebSocket stream");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -1037,7 +1037,7 @@ impl RealTimeProvider for BenzingaStreamingProvider {
|
||||
if let Some(tx) = self.event_tx.lock().await.as_ref() {
|
||||
let status_event = MarketDataEvent::ConnectionStatus(ConnectionEvent {
|
||||
provider: "benzinga".to_string(),
|
||||
status: ConnectionState::Connected,
|
||||
status: ConnectionStatus::connected(),
|
||||
message: Some("Connected to Benzinga streaming API".to_string()),
|
||||
timestamp: Utc::now(),
|
||||
});
|
||||
@@ -1081,7 +1081,7 @@ impl RealTimeProvider for BenzingaStreamingProvider {
|
||||
if let Some(tx) = self.event_tx.lock().await.as_ref() {
|
||||
let status_event = MarketDataEvent::ConnectionStatus(ConnectionEvent {
|
||||
provider: "benzinga".to_string(),
|
||||
status: ConnectionState::Disconnected,
|
||||
status: ConnectionStatus::disconnected(),
|
||||
message: Some("Disconnected from Benzinga streaming API".to_string()),
|
||||
timestamp: Utc::now(),
|
||||
});
|
||||
|
||||
@@ -427,7 +427,14 @@ impl TrainingDataPipeline {
|
||||
Arc::new(RwLock::new(FeatureProcessor::new(config.features.clone())?));
|
||||
|
||||
// Initialize data validator
|
||||
let validator = Arc::new(DataValidator::new(config.validation.clone())?);
|
||||
let data_validation_config = DataValidationConfig {
|
||||
enabled: config.validation.enabled,
|
||||
max_missing_percentage: config.validation.max_missing_percentage,
|
||||
outlier_detection: config.validation.outlier_detection.clone(),
|
||||
min_data_points: config.validation.min_data_points,
|
||||
quality_threshold: config.validation.quality_threshold,
|
||||
};
|
||||
let validator = Arc::new(DataValidator::new(data_validation_config)?);
|
||||
|
||||
// Initialize storage manager with default config
|
||||
let storage_config = TrainingStorageConfig::default();
|
||||
|
||||
@@ -57,24 +57,8 @@ pub enum MarketDataEvent {
|
||||
UnusualOptions(crate::providers::common::UnusualOptionsEvent),
|
||||
}
|
||||
|
||||
/// Quote event structure
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct QuoteEvent {
|
||||
/// Symbol
|
||||
pub symbol: String,
|
||||
/// Bid price
|
||||
pub bid: Option<Decimal>,
|
||||
/// Ask price
|
||||
pub ask: Option<Decimal>,
|
||||
/// Bid size
|
||||
pub bid_size: Option<Decimal>,
|
||||
/// Ask size
|
||||
pub ask_size: Option<Decimal>,
|
||||
/// Exchange
|
||||
pub exchange: Option<String>,
|
||||
/// Timestamp
|
||||
pub timestamp: chrono::DateTime<chrono::Utc>,
|
||||
}
|
||||
// Use canonical QuoteEvent from trading_engine
|
||||
pub use trading_engine::types::QuoteEvent;
|
||||
|
||||
// TradeEvent removed - use canonical version from trading_engine::types::TradeEvent
|
||||
pub use trading_engine::types::TradeEvent;
|
||||
|
||||
Reference in New Issue
Block a user