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
Sourcepub fn get_spreads(
&self,
_lambda: f64,
derivs: &StateDerivatives<2>,
) -> (f64, f64)
pub fn get_spreads( &self, _lambda: f64, derivs: &StateDerivatives<2>, ) -> (f64, f64)
Computes optimal spreads based on current inventory and intensity. Note: The base intensity ‘A’ from standard Avellaneda is replaced by the state variable ‘lambda’.
Sourcepub fn fill_rate_base(&self, state: &[f64; 2]) -> f64
pub 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.
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 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 ControlProblem<2> for AvellanedaHawkes
impl ControlProblem<2> for AvellanedaHawkes
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
Source§impl PdeProblem<2> for AvellanedaHawkes
impl PdeProblem<2> for AvellanedaHawkes
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 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