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).
pub fn get_spreads(&self, derivs: &StateDerivatives<2>) -> (f64, f64)
Sourcepub fn fill_rate_base(&self, _state: &[f64; 2]) -> f64
pub fn fill_rate_base(&self, _state: &[f64; 2]) -> f64
The base arrival intensity used for intensity-to-spread conversion.
Sourcepub fn fill_rate_decay(&self) -> f64
pub fn fill_rate_decay(&self) -> f64
The fill-rate decay parameter used for intensity-to-spread conversion.
Trait Implementations§
Source§impl ControlProblem<2> for Heston
impl ControlProblem<2> for Heston
Source§type Control = MarketMakingControl
type Control = MarketMakingControl
Source§fn optimize(
&self,
_t: f64,
state: &[f64; 2],
derivs: &StateDerivatives<2>,
) -> Self::Control
fn optimize( &self, _t: f64, state: &[f64; 2], derivs: &StateDerivatives<2>, ) -> Self::Control
(t, state).Source§fn running_reward(
&self,
_t: f64,
_state: &[f64; 2],
control: &Self::Control,
) -> f64
fn running_reward( &self, _t: f64, _state: &[f64; 2], control: &Self::Control, ) -> f64
f(t,x,u).Source§fn bsde_driver(
&self,
_t: f64,
state: &[f64; 2],
control: &Self::Control,
_derivs: &StateDerivatives<2>,
dt: f64,
) -> f64
fn bsde_driver( &self, _t: f64, state: &[f64; 2], control: &Self::Control, _derivs: &StateDerivatives<2>, dt: f64, ) -> f64
Source§fn generator(
&self,
_t: f64,
state: &[f64; 2],
_control: &Self::Control,
derivs: &StateDerivatives<2>,
) -> f64
fn generator( &self, _t: f64, state: &[f64; 2], _control: &Self::Control, derivs: &StateDerivatives<2>, ) -> f64
L^u V for the given control and
derivative bundle.Source§fn constant_discount_rate(&self) -> Option<f64>
fn constant_discount_rate(&self) -> Option<f64>
None (state dependent).Source§fn next_step(
&self,
_t: f64,
state: &[f64; 2],
dt: f64,
noise: &[f64; 2],
) -> [f64; 2]
fn next_step( &self, _t: f64, state: &[f64; 2], dt: f64, noise: &[f64; 2], ) -> [f64; 2]
t.Source§fn next_step_controlled(
&self,
_t: f64,
state: &[f64; 2],
control: &Self::Control,
dt: f64,
noise: &[f64; 2],
) -> [f64; 2]
fn next_step_controlled( &self, _t: f64, state: &[f64; 2], control: &Self::Control, 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 gradient_step(&self, dim: usize) -> f64
fn gradient_step(&self, dim: usize) -> f64
Source§fn driver(
&self,
t: f64,
state: &[f64; N],
control: &Self::Control,
derivs: &StateDerivatives<N>,
) -> f64
fn driver( &self, t: f64, state: &[f64; N], control: &Self::Control, derivs: &StateDerivatives<N>, ) -> f64
f(t,x,u) + L^u V. Read moreSource§fn apply_constraint(&self, _state: &[f64; N], value: f64) -> f64
fn apply_constraint(&self, _state: &[f64; N], value: f64) -> f64
V >= payoff for an American option. Read moreSource§fn is_reduced_value(&self) -> bool
fn is_reduced_value(&self) -> bool
impl Copy for Heston
Source§impl PdeProblem<2> for Heston
impl PdeProblem<2> for Heston
Source§fn dimension_kind(&self, dim: usize) -> DimensionKind
fn dimension_kind(&self, dim: usize) -> DimensionKind
dim. Read moreSource§fn transport(
&self,
_t: f64,
state: &[f64; 2],
control: &Self::Control,
derivs: &StateDerivatives<2>,
) -> Transport<2>
fn transport( &self, _t: f64, state: &[f64; 2], control: &Self::Control, derivs: &StateDerivatives<2>, ) -> Transport<2>
Source§fn jump_kernel(
&self,
_t: f64,
_state: &[f64; N],
_control: &Self::Control,
_derivs: &StateDerivatives<N>,
transport: &Transport<N>,
) -> JumpKernel<N>
fn jump_kernel( &self, _t: f64, _state: &[f64; N], _control: &Self::Control, _derivs: &StateDerivatives<N>, transport: &Transport<N>, ) -> JumpKernel<N>
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