## Summary - **Total Agents**: 65 (24 coverage + 41 error fixes) - **Compilation Errors**: 194 → 0 ✅ - **New Tests**: 530+ tests (~17,500 lines) - **Success Rate**: 100% ## Phase 1: Test Coverage Expansion (Waves 1-3) - Wave 1-3: 24 agents deployed - Created comprehensive test suites across all modules - Added 530+ tests for baseline, advanced, and integration coverage ## Phase 2: Error Elimination (Waves 4-14) - Wave 4 (12 agents): Fixed 162 errors (Enum Display, tower util, borrow checker) - Wave 7 (1 agent): Fixed 52 ML proto errors (DataSource, Hyperparameters) - Wave 8 (1 agent): Fixed 33 Trading proto errors (SubmitOrderRequest) - Wave 12 (4 agents): Fixed 13 ComplianceRequirements field errors - Wave 13 (3 agents): Fixed 16 data crate test errors - Wave 14 (2 agents): Fixed final 2 data lib errors ## Infrastructure Improvements - Added MinIO Docker service for S3 E2E testing - Created S3Config::for_minio_testing() helper - Added storage test_helpers module - Fixed proto field mappings across all services - Added tower "util" feature for ServiceExt ## Key Error Patterns Fixed - Proto field name changes (120+ instances) - Enum Display trait usage (31 instances) - Borrow checker errors (20+ instances) - Missing methods/features (40+ instances) - Struct field additions (Order, ComplianceRequirements) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
135 lines
3.4 KiB
Rust
135 lines
3.4 KiB
Rust
//! Market data types for common use
|
|
|
|
use crate::types::{OrderSide, Price, Quantity, Symbol};
|
|
use chrono::{DateTime, Utc};
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
/// Market data event types
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[allow(clippy::module_name_repetitions)]
|
|
pub enum MarketDataEvent {
|
|
/// Trade execution event
|
|
Trade(TradeEvent),
|
|
/// Quote update (bid/ask) event
|
|
Quote(QuoteEvent),
|
|
/// Bar/candlestick data event
|
|
Bar(BarEvent),
|
|
/// Order book update event
|
|
OrderBook(OrderBookEvent),
|
|
/// News and market information event
|
|
News(NewsEvent),
|
|
}
|
|
|
|
/// Trade event
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct TradeEvent {
|
|
/// Trading symbol
|
|
pub symbol: Symbol,
|
|
/// Trade execution price
|
|
pub price: Price,
|
|
/// Trade quantity
|
|
pub quantity: Quantity,
|
|
/// Trade side (buy or sell)
|
|
pub side: OrderSide,
|
|
/// Trade execution timestamp
|
|
pub timestamp: DateTime<Utc>,
|
|
/// Unique trade identifier
|
|
pub trade_id: String,
|
|
}
|
|
|
|
/// Quote event
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct QuoteEvent {
|
|
/// Trading symbol
|
|
pub symbol: Symbol,
|
|
/// Best bid price
|
|
pub bid_price: Price,
|
|
/// Best bid quantity
|
|
pub bid_quantity: Quantity,
|
|
/// Best ask price
|
|
pub ask_price: Price,
|
|
/// Best ask quantity
|
|
pub ask_quantity: Quantity,
|
|
/// Quote timestamp
|
|
pub timestamp: DateTime<Utc>,
|
|
}
|
|
|
|
/// Bar event (OHLCV)
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct BarEvent {
|
|
/// Trading symbol
|
|
pub symbol: Symbol,
|
|
/// Opening price
|
|
pub open: Price,
|
|
/// Highest price
|
|
pub high: Price,
|
|
/// Lowest price
|
|
pub low: Price,
|
|
/// Closing price
|
|
pub close: Price,
|
|
/// Trading volume
|
|
pub volume: Quantity,
|
|
/// Bar timestamp
|
|
pub timestamp: DateTime<Utc>,
|
|
/// Bar time interval
|
|
pub interval: BarInterval,
|
|
}
|
|
|
|
/// Bar interval
|
|
#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
|
|
pub enum BarInterval {
|
|
/// 1-second interval
|
|
Second1,
|
|
/// 1-minute interval
|
|
Minute1,
|
|
/// 5-minute interval
|
|
Minute5,
|
|
/// 15-minute interval
|
|
Minute15,
|
|
/// 1-hour interval
|
|
Hour1,
|
|
/// 1-day interval
|
|
Day1,
|
|
}
|
|
|
|
/// Order book event
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct OrderBookEvent {
|
|
/// Trading symbol
|
|
pub symbol: Symbol,
|
|
/// Bid levels (price, quantity)
|
|
pub bids: Vec<(Price, Quantity)>,
|
|
/// Ask levels (price, quantity)
|
|
pub asks: Vec<(Price, Quantity)>,
|
|
/// Order book timestamp
|
|
pub timestamp: DateTime<Utc>,
|
|
}
|
|
|
|
/// News event
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct NewsEvent {
|
|
/// Related trading symbol (if applicable)
|
|
pub symbol: Option<Symbol>,
|
|
/// News headline
|
|
pub headline: String,
|
|
/// News content/body
|
|
pub content: String,
|
|
/// News publication timestamp
|
|
pub timestamp: DateTime<Utc>,
|
|
/// News source identifier
|
|
pub source: String,
|
|
}
|
|
|
|
impl MarketDataEvent {
|
|
/// Get the timestamp for any market data event
|
|
pub const fn timestamp(&self) -> Option<DateTime<Utc>> {
|
|
match self {
|
|
MarketDataEvent::Quote(q) => Some(q.timestamp),
|
|
MarketDataEvent::Trade(t) => Some(t.timestamp),
|
|
MarketDataEvent::Bar(b) => Some(b.timestamp),
|
|
MarketDataEvent::OrderBook(o) => Some(o.timestamp),
|
|
MarketDataEvent::News(n) => Some(n.timestamp),
|
|
}
|
|
}
|
|
}
|