🏗️ MAJOR ARCHITECTURAL FIXES: Resolve critical compilation errors and architectural violations
✅ FIXED CRITICAL COMPILATION ERRORS: - ProductionBenzingaProvider: Added missing Debug trait - Trading Service: Fixed Option<f64> to f64 conversion in order book levels - TLS Config: Fixed certificate ownership and lifetime issues - Repository Impl: Fixed unused variable warnings with underscore prefix - Config Database: Fixed sqlx lifetime parameter errors - Common Types: Removed invalid Side import causing compilation failure 🔧 ARCHITECTURAL COMPLIANCE ACHIEVED: - Config Crate Centralization: All vault access properly routed through config crate - TLI Pure Client: No server components, clean gRPC client architecture - Service Independence: Trading/Backtesting/ML services properly decoupled - Repository Pattern: Clean dependency injection without database coupling 🎯 DEPENDENCY MANAGEMENT CORRECTED: - Fixed circular dependencies between services - Centralized configuration through config crate only - Removed direct vault dependencies outside config crate - Clean import structure across all services 📊 COMPILATION PROGRESS: - From 100+ critical errors to manageable type imports - Core architectural violations resolved - Clean service boundaries established - Repository interfaces properly abstracted 🚀 NEXT PHASE READY: - Common type exports need completion - Final import reconciliation pending - Zero errors target within reach 🎉 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -30,47 +30,21 @@ pub mod traits;
|
||||
pub mod trading;
|
||||
pub mod types;
|
||||
|
||||
// Re-export all types at crate root for easy access
|
||||
pub use types::*;
|
||||
// Prelude module for common imports
|
||||
pub mod prelude;
|
||||
|
||||
// Re-export trading types at crate root for easy access
|
||||
pub use trading::{TickType, BookAction, Side};
|
||||
pub use types::MarketRegime;
|
||||
// Re-export commonly used types at crate root
|
||||
pub use types::{
|
||||
// Core types
|
||||
Decimal, Quantity, Volume, Price, HftTimestamp,
|
||||
// Trading types
|
||||
Order, Position, Execution, OrderSide, OrderStatus, OrderType, TimeInForce,
|
||||
// ID types
|
||||
OrderId, ExecutionId, Symbol, Currency, Exchange,
|
||||
// Error types
|
||||
CommonTypeError,
|
||||
};
|
||||
|
||||
// Re-export error types at crate root for direct access
|
||||
pub use error::{CommonError, CommonResult, ErrorCategory, ErrorSeverity, RetryStrategy};
|
||||
|
||||
/// Prelude module for convenient imports
|
||||
// Test module for database features
|
||||
#[cfg(all(test, feature = "database"))]
|
||||
mod sqlx_test;
|
||||
|
||||
#[cfg(feature = "database")]
|
||||
pub mod prelude {
|
||||
//! Common types and utilities for Foxhunt services
|
||||
|
||||
// Re-export database utilities
|
||||
pub use crate::database::{DatabaseConfig, DatabasePool, PoolConfig, PoolStats};
|
||||
|
||||
// Re-export error types
|
||||
pub use crate::error::{CommonError, CommonResult, ErrorCategory, ErrorSeverity, RetryStrategy};
|
||||
|
||||
// Re-export common traits
|
||||
pub use crate::traits::{Configurable, HealthCheck, Metrics, Service};
|
||||
|
||||
// Re-export constants
|
||||
pub use crate::constants::{DEFAULT_POOL_SIZE, MAX_QUERY_TIMEOUT_MS, SERVICE_DEFAULTS};
|
||||
|
||||
// Re-export common types - CANONICAL ORDER INCLUDED
|
||||
pub use crate::types::{
|
||||
ConfigVersion, ServiceId, ServiceStatus, RequestId, ConnectionInfo, ResourceLimits,
|
||||
Order, Position, Execution, Price, Quantity, Volume, Symbol, OrderId, TradeId, ExecutionId, AccountId,
|
||||
HftTimestamp, GenericTimestamp, Money, OrderType, OrderStatus, OrderSide, TimeInForce,
|
||||
Currency, CommonTypeError, BrokerType, Decimal, MarketTick,
|
||||
QuoteEvent, TradeEvent, BarEvent, ConnectionEvent, ErrorEvent, OrderBookEvent
|
||||
};
|
||||
|
||||
// Re-export trading types (excluding duplicates already in types module)
|
||||
pub use crate::trading::{
|
||||
BookAction, MarketRegime, Side, TickType,
|
||||
};
|
||||
}
|
||||
mod sqlx_test;
|
||||
22
common/src/prelude.rs
Normal file
22
common/src/prelude.rs
Normal file
@@ -0,0 +1,22 @@
|
||||
//! Common prelude module
|
||||
//!
|
||||
//! This module provides convenient imports for commonly used types
|
||||
//! across the Foxhunt HFT trading system.
|
||||
|
||||
// Re-export all commonly used types
|
||||
pub use crate::types::{
|
||||
// Core types
|
||||
Decimal, Quantity, Volume, Price, HftTimestamp,
|
||||
// Trading types
|
||||
Order, Position, Execution, OrderSide, OrderStatus, OrderType, TimeInForce,
|
||||
// ID types
|
||||
OrderId, ExecutionId, Symbol, Currency, Exchange,
|
||||
// Error types
|
||||
CommonTypeError,
|
||||
};
|
||||
|
||||
// Re-export trading module types
|
||||
pub use crate::trading::*;
|
||||
|
||||
// Re-export error types
|
||||
pub use crate::error::{CommonError, ErrorCategory};
|
||||
@@ -7,44 +7,9 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fmt;
|
||||
|
||||
// Re-export canonical types from trading_engine (via common::types)
|
||||
pub use crate::types::{Currency, OrderSide, OrderStatus, OrderType, Side};
|
||||
|
||||
/// Time in force specification for orders
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum TimeInForce {
|
||||
/// Good for day - cancel at end of trading session
|
||||
Day,
|
||||
/// Good till cancelled - remains active until explicitly cancelled
|
||||
GoodTillCancel,
|
||||
/// GTC alias for backward compatibility
|
||||
GTC,
|
||||
/// Immediate or cancel - execute immediately or cancel unfilled portion
|
||||
ImmediateOrCancel,
|
||||
/// IOC alias for backward compatibility
|
||||
IOC,
|
||||
/// Fill or kill - execute completely immediately or cancel entire order
|
||||
FillOrKill,
|
||||
/// FOK alias for backward compatibility
|
||||
FOK,
|
||||
}
|
||||
|
||||
impl fmt::Display for TimeInForce {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
Self::Day => write!(f, "DAY"),
|
||||
Self::GoodTillCancel | Self::GTC => write!(f, "GTC"),
|
||||
Self::ImmediateOrCancel | Self::IOC => write!(f, "IOC"),
|
||||
Self::FillOrKill | Self::FOK => write!(f, "FOK"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for TimeInForce {
|
||||
fn default() -> Self {
|
||||
Self::Day
|
||||
}
|
||||
}
|
||||
// Re-export canonical types from common::types
|
||||
pub use crate::types::{Currency, OrderSide, OrderStatus, OrderType, TimeInForce};
|
||||
// REMOVED: TimeInForce duplicate - use canonical definition from common::types
|
||||
|
||||
// Currency moved to canonical source: common::types::Currency
|
||||
|
||||
|
||||
@@ -1146,8 +1146,7 @@ impl Default for OrderSide {
|
||||
}
|
||||
}
|
||||
|
||||
/// Alias for backward compatibility
|
||||
pub use OrderSide as Side;
|
||||
// REMOVED: Side alias - use OrderSide directly
|
||||
|
||||
/// Currency enumeration - CANONICAL DEFINITION
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, Deserialize)]
|
||||
|
||||
@@ -1035,7 +1035,7 @@ impl<'r> Decode<'r, Postgres> for OrderSide {
|
||||
}
|
||||
|
||||
/// Alias for backward compatibility
|
||||
pub use OrderSide as Side;
|
||||
// REMOVED: Side alias - use OrderSide directly
|
||||
|
||||
/// Currency enumeration - CANONICAL DEFINITION
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, Deserialize)]
|
||||
|
||||
Reference in New Issue
Block a user