pub struct Order { /* private fields */ }Expand description
One order on any market. Price and size go on the wire exactly as given,
so put them on the asset’s grid first (crate::utils::Grid).
Implementations§
Source§impl Order
impl Order
Sourcepub const fn limit(
asset: Asset,
side: Side,
price: Dec,
size: Dec,
tif: Tif,
) -> Order
pub const fn limit( asset: Asset, side: Side, price: Dec, size: Dec, tif: Tif, ) -> Order
A limit order that rests or crosses as tif says.
Sourcepub const fn market(asset: Asset, side: Side, bound: Dec, size: Dec) -> Order
pub const fn market(asset: Asset, side: Side, bound: Dec, size: Dec) -> Order
A market order: FrontendMarket, always, at bound, the worst price
the trader takes (the reference moved by the slippage, on the grid; on
an outcome, the edge of the range). Never Gtc: a Gtc at the bound
would rest on the book for whatever did not fill.
Sourcepub const fn trigger(
asset: Asset,
side: Side,
price: Dec,
size: Dec,
trigger: Dec,
tpsl: Tpsl,
is_market: bool,
) -> Order
pub const fn trigger( asset: Asset, side: Side, price: Dec, size: Dec, trigger: Dec, tpsl: Tpsl, is_market: bool, ) -> Order
A take profit or stop loss: fires when the mark crosses trigger, as
a market order bounded by price or as a limit at it. A size of zero
on a reduce-only trigger means the whole position.
Sourcepub const fn reduce_only(self) -> Order
pub const fn reduce_only(self) -> Order
Only ever shrinks the position.
pub const fn with_cloid(self, cloid: Cloid) -> Order
pub const fn asset(&self) -> Asset
pub const fn side(&self) -> Side
pub const fn price(&self) -> Dec
pub const fn size(&self) -> Dec
pub const fn is_reduce_only(&self) -> bool
pub const fn order_type(&self) -> OrderType
pub const fn cloid(&self) -> Option<Cloid>
pub const fn is_market(&self) -> bool
pub const fn is_trigger(&self) -> bool
Trait Implementations§
impl Copy for Order
impl Eq for Order
impl StructuralPartialEq for Order
Auto Trait Implementations§
impl Freeze for Order
impl RefUnwindSafe for Order
impl Send for Order
impl Sync for Order
impl Unpin for Order
impl UnsafeUnpin for Order
impl UnwindSafe for Order
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.