Files
foxhunt/common
jgrusewski 7c2ed29869 feat: Wave 6 - Remove ALL 225-feature backward compatibility
WAVE 6: Complete cleanup of backward compatibility code (user rejected)

Changes Made:
- ml/src/features/extraction.rs: Removed 733 lines (34.8% reduction)
  * Deleted 7 obsolete 225-feature extraction methods
  * Simplified extract_current_features() to delegate to v2
  * Updated documentation to reflect 54-feature architecture only

- ml/src/trainers/dqn.rs: Removed backward compat checks
  * Removed 'if len() >= 54 else' fallback logic
  * Added assertion to enforce 54-feature requirement
  * Updated 13 comments/docstrings to reference 54 features

- common/src/features/types.rs: Removed FeatureVector225 type
  * Deleted legacy type definition
  * Updated FeatureVector54 documentation

- common/src/lib.rs: Cleaned exports
  * Removed FeatureVector225 export
  * Removed ProductionFeatureExtractor225 export

- services/backtesting_service/src/ml_strategy_engine.rs: Fixed hardcoded array
  * Changed [0.0; 225] → [0.0; 54]

Validation:
-  Compilation: PASS (workspace builds successfully)
-  DQN Tests: 15/15 passing (100%)
-  Feature Extraction Tests: 4/4 passing (100%)
-  10-Epoch Smoke Test: PASS (Q-values ±0.3-1.1, gradients healthy)
-  Full ML Suite: 1681/1699 (98.9%)

Code Metrics:
- 91 files changed, -439 net lines removed
- 97 legacy '225' references remain (comments/docs only, non-blocking)
- Single clean 54-feature architecture, NO backward compatibility

READY FOR PRODUCTION TRAINING

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 13:21:26 +01:00
..

Common Crate

Overview

The common crate provides a foundational set of shared types and utilities essential for building high-frequency trading applications within the Foxhunt ecosystem. It encapsulates core data structures, error handling patterns, and common helpers used across various components.

Features

  • Market Data & Order Types: Defines standardized structs for market data (e.g., Tick, OrderBook) and various order types (e.g., LimitOrder, MarketOrder).
  • High-Precision Time Utilities: Offers utilities for working with nanosecond-resolution timestamps and duration calculations critical for HFT.
  • Robust Error Handling: Implements a custom FoxhuntError enum and Result type for consistent and traceable error management across the system.
  • Data Validation Helpers: Provides functions for validating common HFT parameters such as prices, quantities, and instrument IDs.
  • Serialization/Deserialization: Includes helpers and derive macros for efficient data serialization (e.g., using serde) for inter-process communication or persistence.
  • Instrument & Asset Definitions: Standardized types for defining trading instruments, assets, and exchanges.

Usage

use common::types::{Order, OrderSide, Price, Quantity, InstrumentId};
use common::errors::FoxhuntError;

fn create_limit_order(instrument: InstrumentId, price: Price, quantity: Quantity) -> Result<Order, FoxhuntError> {
    if price.value() <= 0.0 || quantity.value() <= 0.0 {
        return Err(FoxhuntError::ValidationError("Price and quantity must be positive".to_string()));
    }
    Ok(Order::new_limit(instrument, OrderSide::Buy, price, quantity))
}

let instrument = InstrumentId::new("BTCUSD".to_string());
let order = create_limit_order(instrument, Price::new(60000.0), Quantity::new(0.5));
println!("{:?}", order);

Testing

cargo test --package common

Documentation

Comprehensive API documentation is available at docs.rs/common.