pub struct Heston {}Expand description
Heston Stochastic Volatility Model for Market Making
Extends the Avellaneda-Stoikov model by adding stochastic volatility to the mid-price. The value function depends on both inventory and current variance.
§Dynamics
- $dS_t = S_0 \sqrt{v_t} dW^S_t$
- $dv_t = \kappa_v (\theta - v_t) dt + \xi \sqrt{v_t} dW^v_t$
This reduced HJB model has state [q, v] only (no spot state). To align with
a multiplicative market process where price diffusion scales with S_t, we
freeze spot at a reference level price_scale (typically initial price).
Fields§
§gamma: f64Risk aversion for inventory holding.
kappa_m: f64Order filling intensity decay ($\kappa$).
a: f64Base order arrival intensity ($A$).
v_kappa: f64Mean reversion speed for variance ($\kappa_v$).
v_theta: f64Long-run mean variance ($\theta$).
v_xi: f64Volatility of variance (vol-of-vol, $\xi$).
rho: f64Correlation between price and variance Brownian motions ($\rho$).
price_scale: f64Reference spot level used to map relative variance into absolute price-risk scale.
dv: f64Grid step size for the variance dimension.
dq: f64Grid step for inventory dimension (defaults to 1.0 for integer grid).
q_min: f64Minimum inventory (lower hard boundary). Defaults to -infinity (no constraint).
q_max: f64Maximum inventory (upper hard boundary). Defaults to +infinity (no constraint).
terminal_condition: TerminalConditionTerminal condition for the value function at T. Defaults to Zero.
Implementations§
Source§impl Heston
impl Heston
pub fn new(gamma: f64, kappa_m: f64, a: f64) -> Self
pub fn with_terminal_condition( self, terminal_condition: TerminalCondition, ) -> Self
pub fn with_inventory_bounds(self, q_min: f64, q_max: f64) -> Self
pub fn with_variance_params(self, v_kappa: f64, v_theta: f64, v_xi: f64) -> Self
pub fn with_rho(self, rho: f64) -> Self
pub fn with_price_scale(self, price_scale: f64) -> Self
pub fn with_dv(self, dv: f64) -> Self
pub fn with_dq(self, dq: f64) -> Self
Sourcepub fn with_grid_steps(self, dx: &[f64; 2]) -> Self
pub fn with_grid_steps(self, dx: &[f64; 2]) -> Self
Sets grid step sizes from a Grid<2>. Dimension 0 = inventory (dq), Dimension 1 = variance (dv).
Sourcepub fn build_process(&self) -> HestonProcess
pub fn build_process(&self) -> HestonProcess
Constructs a HestonProcess matching this model’s variance parameters and
correlation. Uses price_scale as the initial spot and v_theta as the initial
variance so that the process starts in its stationary regime.
pub fn get_spreads(&self, _q: f64, _v: f64, grads: &Gradients<2>) -> (f64, f64)
Trait Implementations§
impl Copy for Heston
Source§impl Model<2> for Heston
impl Model<2> for Heston
Source§type Process = HestonProcess
type Process = HestonProcess
() for models without a corresponding market_model process.Source§fn process(&self) -> HestonProcess
fn process(&self) -> HestonProcess
Source§fn optimize(&self, state: &[f64; 2], grads: &Gradients<2>) -> ControlOutput<2>
fn optimize(&self, state: &[f64; 2], grads: &Gradients<2>) -> ControlOutput<2>
Source§fn terminal(&self, state: &[f64; 2]) -> f64
fn terminal(&self, state: &[f64; 2]) -> f64
Source§fn constant_discount_rate(&self) -> Option<f64>
fn constant_discount_rate(&self) -> Option<f64>
Source§fn next_step(
&self,
current_state: &[f64; 2],
dt: f64,
noise: &[f64; 2],
) -> [f64; 2]
fn next_step( &self, current_state: &[f64; 2], dt: f64, noise: &[f64; 2], ) -> [f64; 2]
Source§fn is_diffusion_dimension(&self, dim: usize) -> bool
fn is_diffusion_dimension(&self, dim: usize) -> bool
Source§fn is_integer_dimension(&self, dim: usize) -> bool
fn is_integer_dimension(&self, dim: usize) -> bool
Source§fn gradient_step(&self, dim: usize) -> f64
fn gradient_step(&self, dim: usize) -> f64
Source§fn fill_rate_base(&self, _state: &[f64; 2]) -> f64
fn fill_rate_base(&self, _state: &[f64; 2]) -> f64
Source§fn fill_rate_decay(&self) -> f64
fn fill_rate_decay(&self) -> f64
Source§fn discount_rate(&self, _state: &[f64; N]) -> f64
fn discount_rate(&self, _state: &[f64; N]) -> f64
Source§fn apply_constraint(&self, _state: &[f64; N], value: f64) -> f64
fn apply_constraint(&self, _state: &[f64; N], value: f64) -> f64
Auto Trait Implementations§
impl Freeze for Heston
impl RefUnwindSafe for Heston
impl Send for Heston
impl Sync for Heston
impl Unpin for Heston
impl UnsafeUnpin for Heston
impl UnwindSafe for Heston
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more