pub struct Order {
pub symbol: String,
pub is_buy: bool,
pub price: f64,
pub size: f64,
pub reduce_only: bool,
pub iso: bool,
pub order_type: OrderType,
pub client_id: Option<Hash>,
pub commission: Option<Commission>,
}Expand description
A trading order
Fields§
§symbol: StringMarket symbol (e.g., “BTC-USD”)
is_buy: boolBuy (true) or Sell (false)
price: f64Price (0.0 for market orders)
size: f64Size/Quantity
reduce_only: boolReduce-only flag
iso: boolIsolated-margin lane flag
order_type: OrderTypeOrder type
client_id: Option<Hash>Client order ID (optional)
commission: Option<Commission>Optional builder-code fee paid by this order.
Builder codes are encoded as commission fees on the wire.
Implementations§
Source§impl Order
impl Order
Sourcepub fn limit(
symbol: impl Into<String>,
is_buy: bool,
price: f64,
size: f64,
tif: TimeInForce,
) -> Self
pub fn limit( symbol: impl Into<String>, is_buy: bool, price: f64, size: f64, tif: TimeInForce, ) -> Self
Create a new limit order
Sourcepub fn market(symbol: impl Into<String>, is_buy: bool, size: f64) -> Self
pub fn market(symbol: impl Into<String>, is_buy: bool, size: f64) -> Self
Create a market order
Sourcepub fn reduce_only(self) -> Self
pub fn reduce_only(self) -> Self
Set reduce-only flag
Sourcepub fn with_client_id(self, client_id: Hash) -> Self
pub fn with_client_id(self, client_id: Hash) -> Self
Set client order ID
pub fn iso(self) -> Self
pub fn with_commission(self, to: Pubkey, fee: u8) -> Result<Self>
pub fn with_builder_code(self, to: Pubkey, fee: u8) -> Result<Self>
Sourcepub fn with_random_client_id(self) -> Self
pub fn with_random_client_id(self) -> Self
Generate and set a random client order ID
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Order
impl<'de> Deserialize<'de> for Order
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
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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