Struct BybitOrderRequest

Source
pub struct BybitOrderRequest {
Show 31 fields pub category: String, pub symbol: String, pub side: String, pub order_type: String, pub qty: String, pub price: Option<String>, pub time_in_force: Option<String>, pub order_link_id: Option<String>, pub position_idx: Option<u8>, pub reduce_only: Option<bool>, pub close_on_trigger: Option<bool>, pub is_leverage: Option<u8>, pub market_unit: Option<String>, pub slippage_tolerance_type: Option<String>, pub slippage_tolerance: Option<String>, pub order_filter: Option<String>, pub trigger_direction: Option<u8>, pub trigger_price: Option<String>, pub trigger_by: Option<String>, pub order_iv: Option<String>, pub take_profit: Option<String>, pub stop_loss: Option<String>, pub tp_trigger_by: Option<String>, pub sl_trigger_by: Option<String>, pub tpsl_mode: Option<String>, pub tp_limit_price: Option<String>, pub sl_limit_price: Option<String>, pub tp_order_type: Option<String>, pub sl_order_type: Option<String>, pub smp_type: Option<String>, pub mmp: Option<bool>,
}
Expand description

Bybit V5 order request parameters Comprehensive support for all V5 order types and parameters

Fields§

§category: String

Product category: “spot”, “linear”, “inverse”, “option”

§symbol: String

Trading symbol (e.g., “BTCUSDT”)

§side: String

Order side: “Buy” or “Sell”

§order_type: String

Order type: “Market”, “Limit”, “StopMarket”, “StopLimit”, etc.

§qty: String

Order quantity

§price: Option<String>

Order price (required for limit orders)

§time_in_force: Option<String>

Time in force: “GTC”, “IOC”, “FOK”, “PostOnly”

§order_link_id: Option<String>

Client order ID for tracking

§position_idx: Option<u8>

Position index for unified account: 0 (one-way), 1 (hedge-buy), 2 (hedge-sell)

§reduce_only: Option<bool>

Reduce only order flag

§close_on_trigger: Option<bool>

Close position on trigger for stop orders

§is_leverage: Option<u8>

Whether to borrow (margin trading). Unified account Spot trading only. 0: false (spot trading), 1: true (margin trading)

§market_unit: Option<String>

Unit for qty when creating Spot market orders for UTA account “baseCoin” or “quoteCoin”

§slippage_tolerance_type: Option<String>

Slippage tolerance type: “TickSize” or “Percent”

§slippage_tolerance: Option<String>

Slippage tolerance value TickSize: range [5, 2000], Percent: range [0.05, 1]

§order_filter: Option<String>

Order filter: “Order”, “tpslOrder”, “StopOrder” (Spot only)

§trigger_direction: Option<u8>

Conditional order trigger direction: 1 (rise to trigger), 2 (fall to trigger)

§trigger_price: Option<String>

Conditional order trigger price

§trigger_by: Option<String>

Trigger price type: “LastPrice”, “IndexPrice”, “MarkPrice”

§order_iv: Option<String>

Implied volatility for option orders (real value, e.g., 0.1 for 10%)

§take_profit: Option<String>

Take profit price

§stop_loss: Option<String>

Stop loss price

§tp_trigger_by: Option<String>

Take profit trigger price type: “MarkPrice”, “IndexPrice”, “LastPrice”

§sl_trigger_by: Option<String>

Stop loss trigger price type: “MarkPrice”, “IndexPrice”, “LastPrice”

§tpsl_mode: Option<String>

TP/SL mode: “Full” (entire position), “Partial” (partial position)

§tp_limit_price: Option<String>

Limit order price when take profit is triggered

§sl_limit_price: Option<String>

Limit order price when stop loss is triggered

§tp_order_type: Option<String>

Order type when take profit is triggered: “Market”, “Limit”

§sl_order_type: Option<String>

Order type when stop loss is triggered: “Market”, “Limit”

§smp_type: Option<String>

Self-match prevention type: “None”, “CancelMaker”, “CancelTaker”, “CancelBoth”

§mmp: Option<bool>

Market maker protection (option only)

Implementations§

Source§

impl BybitOrderRequest

Source

pub fn from_common(params: CommonOrderParams<'_>) -> EMSResult<Self>

Create a V5 order request from common order parameters Categories: “spot”, “linear”, “inverse”, “option”

Source

pub fn from_common_spot( symbol: &str, side: OrderSide, order_type: OrderType, quantity: Decimal, price: Option<Decimal>, time_in_force: Option<TimeInForce>, client_order_id: Option<&str>, ) -> EMSResult<Self>

Create a V5 order request from common order parameters with spot category (backwards compatibility) Defaults to spot category for backwards compatibility with existing tests

Source

pub fn builder() -> BybitOrderRequestBuilder

Create a builder for conditional orders (Stop/StopLimit) Use this method to create orders with trigger_price and other conditional parameters

Source

pub fn from_common_with_category( params: CommonOrderParams<'_>, ) -> EMSResult<Self>

Create a V5 order request from common order parameters with specified category Categories: “spot”, “linear”, “inverse”, “option”

Trait Implementations§

Source§

impl Debug for BybitOrderRequest

Source§

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

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

impl Serialize for BybitOrderRequest

Source§

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

Serialize this value into the given Serde serializer. Read more

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

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.

§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

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

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: 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
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: 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, 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.
§

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

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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

impl<T> ErasedDestructor for T
where T: 'static,