pub struct AvellanedaStoikov {
pub gamma: f64,
pub sigma: f64,
pub kappa: f64,
pub a: f64,
}Expand description
The classic Avellaneda-Stoikov market making model.
Models a market maker optimizing bid/ask quotes to maximize utility of terminal wealth while penalizing inventory risk.
§Dynamics
- Price: $dS_t = \sigma dW_t$
- Inventory: $dq_t = dN^{buy}_t - dN^{sell}_t$
- Cash: $dX_t = (S_t + \delta_a) dN^{sell}_t - (S_t - \delta_b) dN^{buy}_t$
Fields§
§gamma: f64Risk aversion parameter ($\gamma$). Controls the penalty for holding inventory.
sigma: f64Volatility of the mid-price ($\sigma$).
kappa: f64Order filling probability parameter ($\kappa$). Intensity decay rate.
a: f64Base order arrival intensity ($A$).
Implementations§
Trait Implementations§
Source§impl Clone for AvellanedaStoikov
impl Clone for AvellanedaStoikov
Source§fn clone(&self) -> AvellanedaStoikov
fn clone(&self) -> AvellanedaStoikov
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Model<2> for AvellanedaStoikov
impl Model<2> for AvellanedaStoikov
Source§type Process = ()
type Process = ()
The underlying stochastic process driving the continuous state dimensions.
Set to
() 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>
Given the current state and value function gradients ($\nabla V$), computations the optimal controls. Read more
Source§fn terminal(&self, _state: &[f64; 2]) -> f64
fn terminal(&self, _state: &[f64; 2]) -> 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>
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; 2],
dt: f64,
noise: &[f64; 2],
) -> [f64; 2]
fn next_step( &self, current_state: &[f64; 2], dt: f64, noise: &[f64; 2], ) -> [f64; 2]
Simulates the next state for BSDE exploration.
Default implementation is a simple random walk: x’ = x + sqrt(dt) * noise
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]
Simulates the next state for Coupled FBSDE exploration where dynamics depend on control.
Default implementation falls back to
next_step (Decoupled).Source§fn is_diffusion_dimension(&self, dim: usize) -> bool
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
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 fill_rate_base(&self, _state: &[f64; 2]) -> f64
fn fill_rate_base(&self, _state: &[f64; 2]) -> f64
Base order arrival rate $A$ used for intensity-to-spread conversion.
May depend on the current state (e.g. Hawkes lambda). Defaults to 1.0.
Source§fn fill_rate_decay(&self) -> f64
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
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
fn apply_constraint(&self, _state: &[f64; N], value: f64) -> f64
Optional constraint application (e.g. for American options)
Default implementation does nothing.
Auto Trait Implementations§
impl Freeze for AvellanedaStoikov
impl RefUnwindSafe for AvellanedaStoikov
impl Send for AvellanedaStoikov
impl Sync for AvellanedaStoikov
impl Unpin for AvellanedaStoikov
impl UnsafeUnpin for AvellanedaStoikov
impl UnwindSafe for AvellanedaStoikov
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
Mutably borrows from an owned value. Read more
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> ⓘ
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 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> ⓘ
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