use fx_utils::Price;
pub trait SpreadModel {
fn calculate_spread(&self, mid_price: Price, volatility: f64) -> Price;
}
pub struct FixedSpreadModel {
spread_bps: u64, }
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 {
let spread = (mid_price.0 * self.spread_bps) / 10000;
Price(spread)
}
}