pub struct KellyHjb {
pub sigma: f64,
pub kappa: f64,
pub a: f64,
pub q_min: f64,
pub q_max: f64,
pub dq: f64,
}Fields§
§sigma: f64§kappa: f64§a: f64§q_min: f64§q_max: f64§dq: f64Implementations§
Source§impl KellyHjb
impl KellyHjb
pub fn new(sigma: f64, kappa: f64, a: f64) -> Self
pub fn with_inventory_bounds(self, q_min: f64, q_max: f64) -> Self
Sourcepub fn get_spreads(&self, grads: &Gradients<2>) -> (f64, f64)
pub fn get_spreads(&self, grads: &Gradients<2>) -> (f64, f64)
Compute optimal bid/ask spreads from value-function gradients.
fwd[0] = dv/dq = v(q+1) - v(q), bwd[0] = v(q) - v(q-1) for dq=1. The x-dimension gradient enters through the finite-difference stencil on the grid and is handled by the solver’s operator.
Trait Implementations§
Source§impl Model<2> for KellyHjb
impl Model<2> for KellyHjb
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 KellyHjb
impl RefUnwindSafe for KellyHjb
impl Send for KellyHjb
impl Sync for KellyHjb
impl Unpin for KellyHjb
impl UnsafeUnpin for KellyHjb
impl UnwindSafe for KellyHjb
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