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§
Source§impl AvellanedaStoikov
impl AvellanedaStoikov
Sourcepub fn get_spreads(&self, derivs: &StateDerivatives<2>) -> (f64, f64)
pub fn get_spreads(&self, derivs: &StateDerivatives<2>) -> (f64, f64)
Computes the optimal bid/ask spreads based on current value function gradients.
§formula
$$ \delta^* = \frac{1}{\gamma} \ln(1 + \frac{\gamma}{\kappa}) \pm \frac{\partial V}{\partial q} $$
Sourcepub fn fill_rate_base(&self, _state: &[f64; 2]) -> f64
pub fn fill_rate_base(&self, _state: &[f64; 2]) -> f64
The base arrival intensity used 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 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 ControlProblem<2> for AvellanedaStoikov
impl ControlProblem<2> for AvellanedaStoikov
Source§type Control = MarketMakingControl
type Control = MarketMakingControl
The action type. For Merton this is a scalar portfolio fraction; for
market making it is a pair of bid/ask intensities.
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
Returns the control that maximizes the driver at
(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
Returns the running reward
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
Returns the backward driver consumed by the BSDE regression solver. Read more
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
Returns the infinitesimal generator
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>
Constant discount rate hint. Defaults to
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]
Advances the state one step under the optimal control at forward time
t.Source§fn is_reduced_value(&self) -> bool
fn is_reduced_value(&self) -> bool
Whether the value this problem solves is a reduced value. Read more
Source§fn is_diffusion_dimension(&self, dim: usize) -> bool
fn is_diffusion_dimension(&self, dim: usize) -> bool
Whether a dimension is driven by Brownian diffusion.
Source§fn gradient_step(&self, _dim: usize) -> f64
fn gradient_step(&self, _dim: usize) -> f64
Physical finite-difference step for a dimension, used by mesh-free
gradient stencils.
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
Returns the full HJB driver
f(t,x,u) + L^u V. Read moreSource§impl EllipticControlProblem<2> for AvellanedaStoikov
impl EllipticControlProblem<2> for AvellanedaStoikov
Source§fn dimension_kind(&self, dim: usize) -> DimensionKind
fn dimension_kind(&self, dim: usize) -> DimensionKind
Discretization kind for
dim.Source§fn transport(
&self,
state: &[f64; 2],
control: &Self::Control,
derivs: &StateDerivatives<2>,
) -> Transport<2>
fn transport( &self, state: &[f64; 2], control: &Self::Control, derivs: &StateDerivatives<2>, ) -> Transport<2>
Transport coefficients and residual source for the given control and
derivatives. Read more
Source§fn boundary_conditions(&self) -> BoundaryConditions<N>
fn boundary_conditions(&self) -> BoundaryConditions<N>
Boundary conditions for each dimension. Read more
Source§impl PdeProblem<2> for AvellanedaStoikov
impl PdeProblem<2> for AvellanedaStoikov
Source§fn dimension_kind(&self, dim: usize) -> DimensionKind
fn dimension_kind(&self, dim: usize) -> DimensionKind
Discretization kind for
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>
Transport and local source for the given control and derivatives. Read more
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>
Jump kernel for arbitrary-amplitude jump dimensions. Read more
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