pub struct InstrumentFilters {
pub min_quantity: Decimal,
pub max_quantity: Decimal,
pub step_size: Decimal,
pub min_price: Decimal,
pub max_price: Decimal,
pub tick_size: Decimal,
pub min_notional: Decimal,
}Expand description
The order constraints for one instrument.
Fields§
§min_quantity: DecimalMinimum order quantity (LOT_SIZE minQty).
max_quantity: DecimalMaximum order quantity (LOT_SIZE maxQty); 0 means no maximum.
step_size: DecimalQuantity increment (LOT_SIZE stepSize); 0 means no stepping.
min_price: DecimalMinimum price (PRICE_FILTER minPrice).
max_price: DecimalMaximum price (PRICE_FILTER maxPrice); 0 means no maximum.
tick_size: DecimalPrice increment (PRICE_FILTER tickSize); 0 means no stepping.
min_notional: DecimalMinimum order notional (price * quantity); 0 means no minimum.
Implementations§
Source§impl InstrumentFilters
impl InstrumentFilters
Sourcepub fn round_quantity(&self, quantity: Decimal) -> Decimal
pub fn round_quantity(&self, quantity: Decimal) -> Decimal
Round a quantity down to the venue’s step size, so the result never exceeds the requested amount.
Sourcepub fn round_price(&self, price: Decimal) -> Decimal
pub fn round_price(&self, price: Decimal) -> Decimal
Round a price down to the venue’s tick size, putting it on the price grid the venue accepts.
Sourcepub fn validate(
&self,
quantity: Decimal,
price: Option<Decimal>,
) -> Result<(), Error>
pub fn validate( &self, quantity: Decimal, price: Option<Decimal>, ) -> Result<(), Error>
Validate a quantity and optional price against every filter.
§Errors
Returns Error::Filter naming the first filter the order violates:
quantity below min/above max/off the step grid, price below min/
above max/off the tick grid, or notional below the minimum.
Trait Implementations§
Source§impl Clone for InstrumentFilters
impl Clone for InstrumentFilters
Source§fn clone(&self) -> InstrumentFilters
fn clone(&self) -> InstrumentFilters
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for InstrumentFilters
impl Debug for InstrumentFilters
impl Eq for InstrumentFilters
Source§impl PartialEq for InstrumentFilters
impl PartialEq for InstrumentFilters
impl StructuralPartialEq for InstrumentFilters
Auto Trait Implementations§
impl Freeze for InstrumentFilters
impl RefUnwindSafe for InstrumentFilters
impl Send for InstrumentFilters
impl Sync for InstrumentFilters
impl Unpin for InstrumentFilters
impl UnsafeUnpin for InstrumentFilters
impl UnwindSafe for InstrumentFilters
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
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> 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> ⓘ
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> ⓘ
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