pub struct AvellanedaHawkes {
pub gamma: f64,
pub sigma: f64,
pub kappa: f64,
pub alpha: f64,
pub beta: f64,
pub mu: f64,
pub lambda_step: f64,
pub dq: f64,
pub terminal_condition: TerminalCondition,
pub q_min: f64,
pub q_max: f64,
pub terminal_liquidation_half_spread: Option<f64>,
}Expand description
Avellaneda-Stoikov model with Hawkes Process for order arrival intensity.
State Space: [Inventory (q), Intensity (lambda)]
- q: Discrete inventory level
- lambda: Continuous order arrival intensity
Dynamics:
- q: Jumps ±1 upon fills.
- lambda: Mean-reverting jump-diffusion (approximated). d(lambda) = beta * (mu - lambda) * dt + alpha * dN_market where N_market is the market order counting process with intensity lambda.
The solver uses a grid-based approach. We approximate the Hawkes dynamics on the lambda dimension using an upwind finite difference scheme mapped to the solver’s jump interface.
Fields§
§gamma: f64§sigma: f64§kappa: f64§alpha: f64§beta: f64§mu: f64§lambda_step: f64§dq: f64Grid step size for inventory dimension (set from grid.dx[0] for FD).
terminal_condition: TerminalConditionTerminal condition V(T, q, lambda). Defaults to Zero.
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_liquidation_half_spread: Option<f64>Optional terminal liquidation half-spread used when terminal_condition is LiquidationCost. If None, uses the AS base spread.
Implementations§
Source§impl AvellanedaHawkes
impl AvellanedaHawkes
pub fn new( gamma: f64, sigma: f64, kappa: f64, alpha: f64, beta: f64, mu: f64, ) -> Self
pub fn with_terminal_liquidation_half_spread(self, half_spread: f64) -> Self
pub fn with_inventory_bounds(self, q_min: f64, q_max: f64) -> Self
pub fn with_terminal_condition( self, terminal_condition: TerminalCondition, ) -> Self
pub fn with_lambda_step(self, lambda_step: f64) -> Self
pub fn with_dq(self, dq: f64) -> Self
Trait Implementations§
Source§impl Clone for AvellanedaHawkes
impl Clone for AvellanedaHawkes
Source§fn clone(&self) -> AvellanedaHawkes
fn clone(&self) -> AvellanedaHawkes
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Model<2> for AvellanedaHawkes
impl Model<2> for AvellanedaHawkes
Source§fn fill_rate_base(&self, state: &[f64; 2]) -> f64
fn fill_rate_base(&self, state: &[f64; 2]) -> f64
The base arrival intensity is state-dependent: returns the current
intensity state[1] (clamped above 0) for intensity-to-spread conversion.
Source§type Process = ()
type Process = ()
() for models without a corresponding market_model process.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 next_step_controlled(
&self,
current_state: &[f64; 2],
control: &ControlOutput<2>,
dt: f64,
noise: &[f64; 2],
) -> [f64; 2]
fn next_step_controlled( &self, current_state: &[f64; 2], control: &ControlOutput<2>, dt: f64, noise: &[f64; 2], ) -> [f64; 2]
next_step (Decoupled).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_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
Auto Trait Implementations§
impl Freeze for AvellanedaHawkes
impl RefUnwindSafe for AvellanedaHawkes
impl Send for AvellanedaHawkes
impl Sync for AvellanedaHawkes
impl Unpin for AvellanedaHawkes
impl UnsafeUnpin for AvellanedaHawkes
impl UnwindSafe for AvellanedaHawkes
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