Skip to main content

OrderType

Enum OrderType 

Source
pub enum OrderType {
Show 17 variants Market, Limit { price: f64, }, StopMarket { stop_price: f64, }, StopLimit { stop_price: f64, limit_price: f64, }, TrailingStop { callback_rate: f64, activation_price: Option<f64>, }, Oco { price: f64, stop_price: f64, stop_limit_price: Option<f64>, }, Bracket { price: Option<f64>, take_profit: f64, stop_loss: f64, }, Iceberg { price: f64, display_quantity: f64, }, Twap { duration_seconds: u64, interval_seconds: Option<u64>, }, PostOnly { price: f64, }, Ioc { price: Option<f64>, }, Fok { price: f64, }, Gtd { price: f64, expire_time: i64, }, ReduceOnly { price: Option<f64>, }, Oto { entry_price: Option<f64>, secondary_order: Box<OrderType>, }, ConditionalPlan { trigger_price: f64, trigger_direction: TriggerDirection, order_after_trigger: Box<OrderType>, }, DcaRecurring { interval_seconds: u64, total_cycles: Option<u32>, price_limit: Option<f64>, },
}
Expand description

Unified order type enum — covers all order variants across 24 exchanges.

A connector matches only the variants it supports natively. For unsupported variants it returns ExchangeError::UnsupportedOperation.

Reading this enum IS reading the capability matrix for order types.

Variants§

§

Market

Plain market order — executes at best available price.

24/24 exchanges support this.

§

Limit

Limit order — executes at price or better.

24/24 exchanges support this.

Fields

§price: f64

Limit price. Mandatory.

§

StopMarket

Stop market — triggers a market order when stop_price is reached.

19/24: Binance, Bybit, OKX, KuCoin, Kraken, Coinbase, GateIO, Bitfinex, Bitstamp, MEXC, HTX, Bitget, BingX, Phemex, CryptoCom, Deribit, HyperLiquid, Paradex, dYdX.

Fields

§stop_price: f64

Price at which the stop triggers and a market order is placed.

§

StopLimit

Stop limit — triggers a limit order when stop_price is reached.

19/24: same exchanges as StopMarket minus some CEX spot-only.

Fields

§stop_price: f64

Price at which the stop triggers.

§limit_price: f64

Limit price of the order that gets placed after trigger.

§

TrailingStop

Trailing stop — follows best price by callback_rate percent.

10/24: Binance Futures, Bybit, OKX, KuCoin Futures, Bitget, BingX, Phemex, Deribit, HyperLiquid, Paradex.

Fields

§callback_rate: f64

Distance from peak price as a percentage (e.g. 1.0 = 1%).

§activation_price: Option<f64>

Optional price at which trailing tracking begins.

§

Oco

OCO (One-Cancels-the-Other) — a limit order paired with a stop order. When one fills or triggers, the other is automatically cancelled.

7/24: Binance Spot, Gemini, Kraken, KuCoin Spot, GateIO, OKX, HTX.

Fields

§price: f64

Limit side price (must be above market for sell, below for buy).

§stop_price: f64

Stop trigger price.

§stop_limit_price: Option<f64>

Limit price after the stop triggers (None = market after trigger).

§

Bracket

Bracket order — entry + attached TP + SL, all in one atomic request.

9/24: Bybit, OKX, Phemex, Bitget, BingX, Deribit, HyperLiquid, Paradex, dYdX.

Fields

§price: Option<f64>

Entry limit price (None = market entry).

§take_profit: f64

Take-profit trigger price.

§stop_loss: f64

Stop-loss trigger price.

§

Iceberg

Iceberg order — large order split into smaller visible chunks.

8/24: Binance, Bybit, OKX, KuCoin, GateIO, Bitfinex, Bitstamp, Deribit.

Fields

§price: f64

Full order price.

§display_quantity: f64

Size of each visible slice placed on the book.

§

Twap

TWAP (Time-Weighted Average Price) — algorithmic order splitting execution over a time window.

7/24: Binance (algo), Bybit (algo), OKX (algo), KuCoin (algo), Bitget (algo), BingX (algo), HyperLiquid.

Fields

§duration_seconds: u64

Total duration to split execution over, in seconds.

§interval_seconds: Option<u64>

Optional sub-order interval in seconds. Exchange default if None.

§

PostOnly

Post-Only limit — rejected if it would immediately match. Guarantees maker fee.

20/24: all except AMM-style DEXes (no maker/taker concept).

Fields

§price: f64

Limit price.

§

Ioc

Immediate-Or-Cancel — fills what it can immediately, cancels the rest.

21/24: all except AMM-based DEXes.

Fields

§price: Option<f64>

Limit price (None = market price for IOC market sweep).

§

Fok

Fill-Or-Kill — must fill in full immediately or the entire order is cancelled.

17/24: Binance, Bybit, OKX, KuCoin, Kraken, GateIO, Bitfinex, Bitstamp, Gemini, MEXC, HTX, Bitget, Phemex, Deribit, HyperLiquid, Paradex, dYdX.

Fields

§price: f64

Limit price (mandatory — FOK with market price is rare).

§

Gtd

Good-Till-Date — limit order that expires at expire_time.

8/24: Binance, Bybit, OKX, KuCoin, Kraken, Bitget, Deribit, Paradex.

Fields

§price: f64

Limit price.

§expire_time: i64

Unix timestamp (ms) after which the order is cancelled.

§

ReduceOnly

Reduce-Only limit — only allowed to reduce an open position.

19/24: all futures-capable exchanges. Returns UnsupportedOperation for spot-only exchanges.

Fields

§price: Option<f64>

Limit price (None = market).

§

Oto

OTO (One-Triggers-the-Other) — the secondary order is only placed if and when the primary (entry) order fills.

~8/24: Bybit, OKX, Binance, KuCoin, Phemex, HyperLiquid, Paradex, dYdX.

Fields

§entry_price: Option<f64>

Optional entry price (None = market entry).

§secondary_order: Box<OrderType>

The secondary order to place after the entry fills.

§

ConditionalPlan

Conditional plan — places an order of any type once a price trigger condition is met.

~12/24: Bybit, OKX, Binance Futures, KuCoin, GateIO, Bitget, BingX, Phemex, Deribit, HyperLiquid, Paradex, dYdX.

Fields

§trigger_price: f64

Price level that activates the order.

§trigger_direction: TriggerDirection

Direction — does price need to go above or below trigger_price?

§order_after_trigger: Box<OrderType>

The order to submit once the trigger fires.

§

DcaRecurring

DCA (Dollar-Cost Averaging) recurring order — automatically repeats at a fixed interval for a number of cycles or indefinitely.

~5/24: Binance (algo), Bybit (algo), OKX (algo), Bitget (algo), BingX (algo).

Fields

§interval_seconds: u64

Interval between each DCA sub-order in seconds.

§total_cycles: Option<u32>

Total number of cycles before the plan terminates. None = run indefinitely until manually stopped.

§price_limit: Option<f64>

Optional maximum price (for buys) or minimum price (for sells). Sub-orders are skipped if the market price exceeds this limit.

Trait Implementations§

Source§

impl Clone for OrderType

Source§

fn clone(&self) -> OrderType

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for OrderType

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for OrderType

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<OrderType, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for OrderType

Source§

fn eq(&self, other: &OrderType) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for OrderType

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for OrderType

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more