pub struct AvellanedaImpact {
pub gamma: f64,
pub sigma: f64,
pub kappa: f64,
pub a: f64,
pub xi: f64,
}Expand description
Avellaneda-Stoikov Model with Market Impact
Models a market maker whose trades permanently impact the mid-price. The inventory penalty is adjusted implicitly by the cost of moving the price against oneself.
§Dynamics
- $S_t \to S_t + \xi$ (Buy) or $S_t - \xi$ (Sell)
- Impact is linear and permanent.
Fields§
§gamma: f64§sigma: f64§kappa: f64§a: f64§xi: f64Permanent market impact parameter ($\xi$). A trade of size 1 moves the price by $\xi$.
Implementations§
Trait Implementations§
Source§impl Clone for AvellanedaImpact
impl Clone for AvellanedaImpact
Source§fn clone(&self) -> AvellanedaImpact
fn clone(&self) -> AvellanedaImpact
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 AvellanedaImpact
impl Model<2> for AvellanedaImpact
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 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.
Source§fn next_step_controlled(
&self,
current_state: &[f64; N],
_control: &ControlOutput<N>,
dt: f64,
noise: &[f64; N],
) -> [f64; N]
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 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).
Auto Trait Implementations§
impl Freeze for AvellanedaImpact
impl RefUnwindSafe for AvellanedaImpact
impl Send for AvellanedaImpact
impl Sync for AvellanedaImpact
impl Unpin for AvellanedaImpact
impl UnsafeUnpin for AvellanedaImpact
impl UnwindSafe for AvellanedaImpact
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