1#![doc = include_str!("MODELS.md")]
2
3pub mod traits;
4
5#[derive(Clone, Copy, Debug, PartialEq)]
7pub enum TerminalCondition {
8 Zero,
10 LiquidationCost,
13}
14
15pub(crate) fn normal_cdf(x: f64) -> f64 {
18 const P: f64 = 0.2316419;
19 const B: [f64; 5] = [
20 0.319381530,
21 -0.356563782,
22 1.781477937,
23 -1.821255978,
24 1.330274429,
25 ];
26 let t = 1.0 / (1.0 + P * x.abs());
27 let poly = t * (B[0] + t * (B[1] + t * (B[2] + t * (B[3] + t * B[4]))));
28 let phi = (-x * x / 2.0).exp() / (2.0 * std::f64::consts::PI).sqrt();
29 let cdf = 1.0 - phi * poly;
30 if x >= 0.0 { cdf } else { 1.0 - cdf }
31}
32
33pub mod american_put;
34pub mod avellaneda;
35pub mod avellaneda_drift;
36pub mod avellaneda_hawkes;
37pub mod avellaneda_impact;
38pub mod bilateral_hawkes;
39pub mod bilateral_hawkes_order_flow_imbalance;
40pub mod heston;
41pub mod heston_hawkes;
42pub mod kelly_hjb;