Files
foxhunt/crates/market-data/src/compile_test.rs
jgrusewski 9c3d741a08 refactor: restructure repo — crates/, bin/, testing/ layout
Move 17 library crates into crates/, CLI binary into bin/fxt,
consolidate 10 test crates into testing/, split config crate
from deployment config files.

Root directory reduced from 38+ to ~17 directories.
All Cargo.toml paths and build.rs proto refs updated.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 11:56:00 +01:00

46 lines
1.5 KiB
Rust

//! Compilation test without database dependency
use crate::{
error::MarketDataResult,
models::{BookSide, IndicatorType, OrderBook, PriceRecord, TechnicalIndicator},
};
use chrono::Utc;
use rust_decimal::prelude::*;
#[allow(unused)]
pub fn test_models_compile() -> MarketDataResult<()> {
// Test Price model
let mut price = PriceRecord::new("EURUSD".to_string(), Utc::now());
price.bid = Some(Decimal::from_str("1.0850").unwrap());
price.ask = Some(Decimal::from_str("1.0852").unwrap());
let _mid = price.mid_price();
let _spread = price.spread();
// Test OrderBook model
let mut order_book = OrderBook::new("EURUSD".to_string(), Utc::now());
let _best_bid = order_book.best_bid();
let _best_ask = order_book.best_ask();
// Test TechnicalIndicator model
let _indicator = TechnicalIndicator::new(
"EURUSD".to_string(),
IndicatorType::Sma,
Utc::now(),
Decimal::from_str("1.0851").unwrap(),
serde_json::json!({"period": 20}),
);
// Test OrderSide enum is hashable
use std::collections::HashMap;
let mut side_map: HashMap<BookSide, i32> = HashMap::new();
side_map.insert(BookSide::Bid, 1);
side_map.insert(BookSide::Ask, 2);
// Test IndicatorType enum is hashable
let mut indicator_map: HashMap<IndicatorType, String> = HashMap::new();
indicator_map.insert(IndicatorType::Sma, "SMA".to_string());
indicator_map.insert(IndicatorType::Ema, "EMA".to_string());
Ok(())
}