pub struct MarketMakingControl {
pub bid_intensity: f64,
pub ask_intensity: f64,
}Expand description
Optimal market-making control: a pair of fill intensities.
bid_intensity is the rate at which the market maker’s bid quote is filled
(sell market orders hitting the bid); ask_intensity is the rate at which
its ask quote is filled (buy market orders hitting the ask).
Fields§
§bid_intensity: f64Optimal bid fill intensity.
ask_intensity: f64Optimal ask fill intensity.
Implementations§
Source§impl MarketMakingControl
impl MarketMakingControl
Sourcepub fn new(bid_intensity: f64, ask_intensity: f64) -> Self
pub fn new(bid_intensity: f64, ask_intensity: f64) -> Self
Creates a market-making control from bid and ask intensities.
§Examples
use solver::models::market_making::MarketMakingControl;
let c = MarketMakingControl::new(1.5, 2.0);
assert_eq!(c.bid_intensity, 1.5);
assert_eq!(c.ask_intensity, 2.0);Sourcepub fn to_spreads(&self, a: f64, kappa: f64) -> SpreadResult
pub fn to_spreads(&self, a: f64, kappa: f64) -> SpreadResult
Recovers the bid/ask half-spreads from the fill intensities.
Inverts the exponential fill model lambda = a * exp(-kappa * delta).
§Panics
Panics if a or kappa is not positive.
§Examples
use solver::models::market_making::MarketMakingControl;
let a: f64 = 140.0;
let kappa: f64 = 1.5;
let c = MarketMakingControl::new(a * (-1.5_f64).exp(), a * (-2.0_f64).exp());
let spreads = c.to_spreads(a, kappa);
assert!((spreads.bid_spread - 1.0).abs() < 1e-12);
assert!((spreads.ask_spread - 2.0 / 1.5).abs() < 1e-12);Trait Implementations§
Source§impl Clone for MarketMakingControl
impl Clone for MarketMakingControl
Source§fn clone(&self) -> MarketMakingControl
fn clone(&self) -> MarketMakingControl
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 moreimpl Copy for MarketMakingControl
Source§impl Debug for MarketMakingControl
impl Debug for MarketMakingControl
Source§impl PartialEq for MarketMakingControl
impl PartialEq for MarketMakingControl
impl StructuralPartialEq for MarketMakingControl
Auto Trait Implementations§
impl Freeze for MarketMakingControl
impl RefUnwindSafe for MarketMakingControl
impl Send for MarketMakingControl
impl Sync for MarketMakingControl
impl Unpin for MarketMakingControl
impl UnsafeUnpin for MarketMakingControl
impl UnwindSafe for MarketMakingControl
Blanket Implementations§
impl<T> Boilerplate for T
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