pub struct Quote {
pub slippage_bips: u32,
pub smart_slippage: Option<bool>,
}Expand description
Quote-level slippage settings embedded in app-data.
Records the slippage tolerance the user chose when placing the order, so solvers and analytics can reconstruct the original intent.
§Example
use cow_app_data::Quote;
// 0.5 % slippage with smart slippage enabled
let quote = Quote::new(50).with_smart_slippage();
assert_eq!(quote.slippage_bips, 50);
assert_eq!(quote.smart_slippage, Some(true));Fields§
§slippage_bips: u32Slippage tolerance in basis points (e.g. 50 = 0.5 %).
smart_slippage: Option<bool>Whether smart (dynamic per-trade) slippage is enabled.
Implementations§
Source§impl Quote
impl Quote
Sourcepub const fn new(slippage_bips: u32) -> Self
pub const fn new(slippage_bips: u32) -> Self
Construct a Quote with the given slippage tolerance.
§Parameters
slippage_bips— slippage tolerance in basis points.50= 0.5 %,100= 1 %,10_000= 100 %.
§Returns
A new Quote with smart_slippage set to None (disabled).
Chain with_smart_slippage to enable it.
§Example
use cow_app_data::Quote;
let q = Quote::new(50);
assert_eq!(q.slippage_bips, 50);
assert_eq!(q.smart_slippage, None);Sourcepub const fn with_smart_slippage(self) -> Self
pub const fn with_smart_slippage(self) -> Self
Enable dynamic (smart) slippage adjustment.
When enabled, the protocol may adjust the slippage tolerance per-trade based on market conditions rather than using a fixed value.
§Returns
self with smart_slippage set to Some(true).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Quote
impl<'de> Deserialize<'de> for Quote
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Quote
impl RefUnwindSafe for Quote
impl Send for Quote
impl Sync for Quote
impl Unpin for Quote
impl UnsafeUnpin for Quote
impl UnwindSafe for Quote
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.