pub struct AvellanedaDrift {
pub gamma: f64,
pub sigma: f64,
pub kappa: f64,
pub a: f64,
pub mu: f64,
}Expand description
Avellaneda-Stoikov Model with Drift
Adds a drift term $\mu$ to the mid-price process: $dS_t = \mu dt + \sigma dW_t$. The optimal quotes are skewed based on the expected future price movement.
Fields§
§gamma: f64§sigma: f64§kappa: f64§a: f64§mu: f64Price drift parameter ($\mu$).
Implementations§
Source§impl AvellanedaDrift
impl AvellanedaDrift
Sourcepub fn get_spreads(&self, grads: &Gradients<2>) -> (f64, f64)
pub fn get_spreads(&self, grads: &Gradients<2>) -> (f64, f64)
Computes optimal spreads, adjusted for drift.
Trait Implementations§
Source§impl Clone for AvellanedaDrift
impl Clone for AvellanedaDrift
Source§fn clone(&self) -> AvellanedaDrift
fn clone(&self) -> AvellanedaDrift
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 AvellanedaDrift
impl Model<2> for AvellanedaDrift
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 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.
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).Auto Trait Implementations§
impl Freeze for AvellanedaDrift
impl RefUnwindSafe for AvellanedaDrift
impl Send for AvellanedaDrift
impl Sync for AvellanedaDrift
impl Unpin for AvellanedaDrift
impl UnsafeUnpin for AvellanedaDrift
impl UnwindSafe for AvellanedaDrift
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