Skip to main content

AvellanedaImpact

Struct AvellanedaImpact 

Source
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: f64

Permanent market impact parameter ($\xi$). A trade of size 1 moves the price by $\xi$.

Implementations§

Source§

impl AvellanedaImpact

Source

pub fn get_spreads(&self, grads: &Gradients<2>, q: f64) -> (f64, f64)

Computes optimal spreads, adjusted for market impact.

Trait Implementations§

Source§

impl Clone for AvellanedaImpact

Source§

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)

Performs copy-assignment from source. Read more
Source§

impl Model<2> for AvellanedaImpact

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; 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

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; 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

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

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 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 transform_noise(&self, _state: &[f64; N], noise: &[f64; N]) -> [f64; N]

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

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

Physical finite-difference step for each state dimension used by BSDE gradient stencils. 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