pub struct OrderParams {
pub symbol: String,
pub side: OrderSide,
pub order_type: OrderType,
pub amount: Decimal,
pub price: Option<Decimal>,
pub stop_price: Option<Decimal>,
pub time_in_force: Option<TimeInForce>,
pub client_order_id: Option<String>,
pub reduce_only: Option<bool>,
pub post_only: Option<bool>,
}Expand description
Parameters for creating orders.
Provides convenience constructors for common order types and a builder pattern for advanced customization.
§Example
use ccxt_core::types::params::OrderParams;
use ccxt_core::types::TimeInForce;
use rust_decimal_macros::dec;
// Market buy order
let order = OrderParams::market_buy("BTC/USDT", dec!(0.01));
// Limit sell order with options
let order = OrderParams::limit_sell("BTC/USDT", dec!(0.01), dec!(50000))
.time_in_force(TimeInForce::IOC)
.client_id("my-order-123")
.reduce_only();Fields§
§symbol: StringTrading symbol (e.g., “BTC/USDT”).
side: OrderSideOrder side (buy/sell).
order_type: OrderTypeOrder type (market/limit/etc.).
amount: DecimalOrder amount/quantity.
price: Option<Decimal>Limit price (required for limit orders).
stop_price: Option<Decimal>Stop/trigger price (for stop orders).
time_in_force: Option<TimeInForce>Time in force policy.
client_order_id: Option<String>Client-assigned order ID.
reduce_only: Option<bool>Reduce-only flag (futures).
post_only: Option<bool>Post-only flag (maker only).
Implementations§
Source§impl OrderParams
impl OrderParams
Sourcepub fn market_buy(symbol: &str, amount: Decimal) -> OrderParams
pub fn market_buy(symbol: &str, amount: Decimal) -> OrderParams
Create a market buy order.
Sourcepub fn market_sell(symbol: &str, amount: Decimal) -> OrderParams
pub fn market_sell(symbol: &str, amount: Decimal) -> OrderParams
Create a market sell order.
Sourcepub fn limit_buy(symbol: &str, amount: Decimal, price: Decimal) -> OrderParams
pub fn limit_buy(symbol: &str, amount: Decimal, price: Decimal) -> OrderParams
Create a limit buy order.
Sourcepub fn limit_sell(symbol: &str, amount: Decimal, price: Decimal) -> OrderParams
pub fn limit_sell(symbol: &str, amount: Decimal, price: Decimal) -> OrderParams
Create a limit sell order.
Sourcepub fn side(self, side: OrderSide) -> OrderParams
pub fn side(self, side: OrderSide) -> OrderParams
Set the order side.
Sourcepub fn stop_price(self, price: Decimal) -> OrderParams
pub fn stop_price(self, price: Decimal) -> OrderParams
Set the stop/trigger price.
Sourcepub fn time_in_force(self, tif: TimeInForce) -> OrderParams
pub fn time_in_force(self, tif: TimeInForce) -> OrderParams
Set the time in force policy.
Sourcepub fn client_id(self, id: &str) -> OrderParams
pub fn client_id(self, id: &str) -> OrderParams
Set the client order ID.
Sourcepub fn reduce_only(self) -> OrderParams
pub fn reduce_only(self) -> OrderParams
Mark the order as reduce-only.
Sourcepub fn post_only(self) -> OrderParams
pub fn post_only(self) -> OrderParams
Mark the order as post-only (maker only).
Trait Implementations§
Source§impl Clone for OrderParams
impl Clone for OrderParams
Source§fn clone(&self) -> OrderParams
fn clone(&self) -> OrderParams
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for OrderParams
impl RefUnwindSafe for OrderParams
impl Send for OrderParams
impl Sync for OrderParams
impl Unpin for OrderParams
impl UnwindSafe for OrderParams
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