pub struct HestonModel {
pub mu: f64,
pub kappa: f64,
pub theta: f64,
pub xi: f64,
pub rho: f64,
}Expand description
The Heston stochastic volatility model: dS = μ S dt + √V S dW₁ dV = κ(θ - V) dt + ξ √V dW₂ with correlation corr(dW₁, dW₂) = ρ.
Uses Euler-Maruyama discretization.
Fields§
§mu: f64Drift μ of the asset.
kappa: f64Mean reversion speed κ > 0.
theta: f64Long-run variance θ > 0.
xi: f64Vol-of-vol ξ > 0.
rho: f64Correlation ρ ∈ (-1, 1).
Implementations§
Source§impl HestonModel
impl HestonModel
Sourcepub fn new(mu: f64, kappa: f64, theta: f64, xi: f64, rho: f64) -> Self
pub fn new(mu: f64, kappa: f64, theta: f64, xi: f64, rho: f64) -> Self
Create a new Heston model.
Sourcepub fn simulate(
&self,
s0: f64,
v0: f64,
t_end: f64,
n_steps: u32,
seed: u64,
) -> Vec<(f64, f64, f64)>
pub fn simulate( &self, s0: f64, v0: f64, t_end: f64, n_steps: u32, seed: u64, ) -> Vec<(f64, f64, f64)>
Simulate (S_t, V_t) paths using Euler-Maruyama.
Returns Vec<(time, S_t, V_t)>.
Sourcepub fn feller_condition_satisfied(&self) -> bool
pub fn feller_condition_satisfied(&self) -> bool
Feller condition check: 2κθ > ξ² ensures V never hits 0.
Sourcepub fn variance_long_run_mean(&self) -> f64
pub fn variance_long_run_mean(&self) -> f64
Long-run mean of the variance: θ.
Auto Trait Implementations§
impl Freeze for HestonModel
impl RefUnwindSafe for HestonModel
impl Send for HestonModel
impl Sync for HestonModel
impl Unpin for HestonModel
impl UnsafeUnpin for HestonModel
impl UnwindSafe for HestonModel
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more