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.
Sourcepub const fn with_cloid(self, cloid: Cloid) -> Order
pub const fn with_cloid(self, cloid: Cloid) -> Order
Sent with this client order id.
Sourcepub const fn price(&self) -> Dec
pub const fn price(&self) -> Dec
p: the limit price, a market order’s bound, or a trigger’s fill price.
Sourcepub const fn size(&self) -> Dec
pub const fn size(&self) -> Dec
s: the size in the base asset; 0 on a whole-position take profit or stop loss.
Sourcepub const fn is_reduce_only(&self) -> bool
pub const fn is_reduce_only(&self) -> bool
r: whether it may only reduce a position.
Sourcepub const fn order_type(&self) -> OrderType
pub const fn order_type(&self) -> OrderType
t: a limit’s time in force, or a trigger.
Sourcepub const fn is_trigger(&self) -> bool
pub const fn is_trigger(&self) -> bool
Whether it is a trigger order: a take profit or stop loss.
Trait Implementations§
impl Copy for Order
impl Eq for Order
impl StructuralPartialEq for Order
Auto Trait Implementations§
impl Forget for Order
impl Freeze for Order
impl Move 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
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
key and return true if they are equal.