fx-pricing 0.1.0

Pricing engine with risk-based adjustments for FX trading. Calculates bid/ask spreads, applies risk adjustments based on position exposure, and integrates with AI/ML services for volatility prediction to optimize pricing.
Documentation
//! Spread calculation models

use fx_utils::Price;

/// Spread model for calculating bid/ask spreads
pub trait SpreadModel {
    fn calculate_spread(&self, mid_price: Price, volatility: f64) -> Price;
}

/// Simple fixed spread model
pub struct FixedSpreadModel {
    spread_bps: u64, // Spread in basis points
}

impl FixedSpreadModel {
    pub fn new(spread_bps: u64) -> Self {
        Self { spread_bps }
    }
}

impl SpreadModel for FixedSpreadModel {
    fn calculate_spread(&self, mid_price: Price, _volatility: f64) -> Price {
        // Calculate spread as basis points of mid price
        let spread = (mid_price.0 * self.spread_bps) / 10000;
        Price(spread)
    }
}