Skip to main content

HestonHawkes

Struct HestonHawkes 

Source
pub struct HestonHawkes {
    pub gamma: f64,
    pub kappa: f64,
    pub v_kappa: f64,
    pub v_theta: f64,
    pub v_xi: f64,
    pub rho: f64,
    pub dv: f64,
    pub alpha: f64,
    pub beta: f64,
    pub mu_lambda: f64,
    pub lambda_step: f64,
    pub dq: f64,
}
Expand description

Combined Heston-Hawkes Model for Market Making (N=3).

Merges stochastic volatility (Heston) with self-exciting order flow (Hawkes) into a single three-dimensional model, demonstrating seamless N=3 extensibility.

§State Space

[q, v, lambda] where:

  • q (dim 0): Inventory level (discrete, jump-controlled)
  • v (dim 1): Stochastic variance following CIR dynamics
  • lambda (dim 2): Hawkes order arrival intensity (mean-reverting with self-excitation)

§Dynamics

  • Inventory: $dq = +1$ (buy fill) or $-1$ (sell fill)
  • Variance: $dv_t = \kappa_v (\theta - v_t) dt + \xi \sqrt{v_t} dW^v_t$
  • Intensity: $d\lambda_t = \beta (\mu_\lambda - \lambda_t) dt + \alpha \lambda_t dt$

The optimal spreads incorporate both volatility risk premia (from Heston) and state-dependent arrival rates (from Hawkes).

Fields§

§gamma: f64

Risk aversion for inventory holding.

§kappa: f64

Order filling intensity decay.

§v_kappa: f64

Mean reversion speed for variance.

§v_theta: f64

Long-run mean variance.

§v_xi: f64

Volatility of variance.

§rho: f64

Correlation between price and variance Brownian motions ($\rho$). Enters the HJB through the cross-variation drift: $-\gamma \rho \xi v q$.

§dv: f64

Grid step size for variance dimension.

§alpha: f64

Self-excitation jump size.

§beta: f64

Mean-reversion speed of intensity.

§mu_lambda: f64

Baseline intensity level.

§lambda_step: f64

Grid step for intensity dimension.

§dq: f64

Grid step for inventory dimension.

Implementations§

Source§

impl HestonHawkes

Source

pub fn new(gamma: f64, kappa: f64) -> Self

Source

pub fn with_heston_params(self, v_kappa: f64, v_theta: f64, v_xi: f64) -> Self

Source

pub fn with_rho(self, rho: f64) -> Self

Source

pub fn with_hawkes_params(self, alpha: f64, beta: f64, mu_lambda: f64) -> Self

Source

pub fn with_grid_steps(self, dx: &[f64; 3]) -> Self

Sets grid step sizes from a Grid<3>. Dimension 0 = inventory (dq), Dimension 1 = variance (dv), Dimension 2 = intensity (lambda_step).

Source

pub fn get_spreads(&self, _q: f64, v: f64, grads: &Gradients<3>) -> (f64, f64)

Compute optimal bid/ask spreads given the current state and value gradients.

Combines the Heston volatility risk premium with the Hawkes intensity dependence.

Trait Implementations§

Source§

impl Clone for HestonHawkes

Source§

fn clone(&self) -> HestonHawkes

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for HestonHawkes

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Model<3> for HestonHawkes

Source§

fn fill_rate_base(&self, state: &[f64; 3]) -> f64

The base arrival intensity is state-dependent: returns the current intensity state[2] (clamped above 0) for intensity-to-spread conversion.

Source§

type Process = ()

The underlying stochastic process driving the continuous state dimensions. Set to () for models without a corresponding market_model process.
Source§

fn process(&self)

Returns the underlying stochastic process, if any.
Source§

fn optimize(&self, state: &[f64; 3], grads: &Gradients<3>) -> ControlOutput<3>

Given the current state and value function gradients ($\nabla V$), computations the optimal controls. Read more
Source§

fn terminal(&self, _state: &[f64; 3]) -> f64

Computes the terminal value function $V(T, x)$ (Final Condition). Usually represents liquidation cost or final utility of wealth.
Source§

fn constant_discount_rate(&self) -> Option<f64>

Optimization hint: Returns Some(r) if the discount rate is constant across all states. Returns None if it depends on state. Default implementation returns None (safe fallback).
Source§

fn next_step( &self, current_state: &[f64; 3], dt: f64, noise: &[f64; 3], ) -> [f64; 3]

Simulates the next state for BSDE exploration. Default implementation is a simple random walk: x’ = x + sqrt(dt) * noise
Source§

fn is_diffusion_dimension(&self, dim: usize) -> bool

Indicates if a dimension is driven by Brownian diffusion. If true, the BSDE backward step will skip the lambda_plus/minus drift term for this dimension (it is already handled by the forward simulation noise).
Source§

fn is_integer_dimension(&self, dim: usize) -> bool

Indicates if a dimension takes only integer values (e.g. inventory q). Controls BSDE initialization: integer dimensions are sampled discretely while continuous dimensions (even if non-diffusion) are sampled with uniform noise. Default: false (continuous).
Source§

fn gradient_step(&self, dim: usize) -> f64

Physical finite-difference step for each state dimension used by BSDE gradient stencils. Read more
Source§

fn fill_rate_decay(&self) -> f64

Order fill decay parameter $\kappa$ used for intensity-to-spread conversion. Defaults to 1.0 for non-market-making models. Override in market-making models.
Source§

fn discount_rate(&self, _state: &[f64; N]) -> f64

Optional discount rate at the given state. Default implementation returns 0.0.
Source§

fn apply_constraint(&self, _state: &[f64; N], value: f64) -> f64

Optional constraint application (e.g. for American options) Default implementation does nothing.
Source§

fn next_step_controlled( &self, current_state: &[f64; N], _control: &ControlOutput<N>, dt: f64, noise: &[f64; N], ) -> [f64; N]

Simulates the next state for Coupled FBSDE exploration where dynamics depend on control. Default implementation falls back to next_step (Decoupled).
Source§

fn transform_noise(&self, _state: &[f64; N], noise: &[f64; N]) -> [f64; N]

Optional transform for standard normal samples before forward stepping. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V