Skip to main content

OrderHistoryRequest

Struct OrderHistoryRequest 

Source
pub struct OrderHistoryRequest<'a> {
    pub category: Category,
    pub symbol: Option<Cow<'a, str>>,
    pub base_coin: Option<Cow<'a, str>>,
    pub settle_coin: Option<Cow<'a, str>>,
    pub order_id: Option<Cow<'a, str>>,
    pub order_link_id: Option<Cow<'a, str>>,
    pub order_filter: Option<Cow<'a, str>>,
    pub order_status: Option<Cow<'a, str>>,
    pub start_time: Option<u64>,
    pub end_time: Option<u64>,
    pub limit: Option<u64>,
}
Expand description

Represents a request to retrieve order history on Bybit.

This struct defines parameters to query past orders, filtered by time, symbol, or status. In perpetual futures, order history is crucial for auditing performance and refining strategies. Bots should use this to analyze executed orders and adjust trading logic accordingly.

Fields§

§category: Category

The category of the trading product (e.g., Spot, Linear).

Specifies the market to query. Bots must set this to match the target market, typically Linear for perpetual futures.

§symbol: Option<Cow<'a, str>>

The trading pair symbol, e.g., “BTCUSDT”.

Filters orders by symbol. Bots can set this to focus on specific assets or leave it as None for all orders in the category.

§base_coin: Option<Cow<'a, str>>

The base coin of the trading pair (e.g., “BTC”).

Filters orders by the base asset. Useful for analyzing specific assets in perpetual futures trading.

§settle_coin: Option<Cow<'a, str>>

The settlement coin (e.g., “USDT”).

Filters orders by the quote asset. Useful for USDT-margined perpetual futures markets.

§order_id: Option<Cow<'a, str>>

The unique identifier of a specific order.

Allows querying a single order by its Bybit-provided ID. Bots should use this for precise historical analysis.

§order_link_id: Option<Cow<'a, str>>

The user-defined identifier of a specific order.

Allows querying a single order by its custom ID. Useful for tracking specific orders in perpetual futures strategies.

§order_filter: Option<Cow<'a, str>>

A filter to specify the order type (e.g., “tpslOrder”).

Targets specific order types, such as TP/SL orders. Bots should use this to analyze relevant orders in perpetual futures.

§order_status: Option<Cow<'a, str>>

The status of the orders to query (e.g., “Filled”, “Cancelled”).

Filters orders by their execution status. Bots can use this to focus on completed or canceled orders for performance analysis in perpetual futures.

§start_time: Option<u64>

The start time for the query (in milliseconds).

Filters orders created after this timestamp. Bots should use this to narrow down historical data for specific periods in perpetual futures trading.

§end_time: Option<u64>

The end time for the query (in milliseconds).

Filters orders created before this timestamp. Bots should pair this with start_time for precise time-based queries.

§limit: Option<u64>

The maximum number of orders to return.

Limits the response size, typically up to 50. Bots should set this to manage API response sizes and avoid rate limits in perpetual futures trading.

Implementations§

Source§

impl<'a> OrderHistoryRequest<'a>

Source

pub fn default() -> Self

Creates a default OrderHistoryRequest with predefined values.

Initializes a query with common defaults. Bots should modify fields to target specific historical orders in perpetual futures.

Source

pub fn new( category: Category, symbol: Option<&'a str>, base_coin: Option<&'a str>, settle_coin: Option<&'a str>, order_id: Option<&'a str>, order_link_id: Option<&'a str>, order_filter: Option<&'a str>, order_status: Option<&'a str>, start_time: Option<u64>, end_time: Option<u64>, limit: Option<u64>, ) -> Self

Creates a custom OrderHistoryRequest with specified parameters.

Allows bots to tailor the query fully. Ensure parameters are valid to avoid API errors in perpetual futures trading.

Trait Implementations§

Source§

impl<'a> Clone for OrderHistoryRequest<'a>

Source§

fn clone(&self) -> OrderHistoryRequest<'a>

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<'a> Default for OrderHistoryRequest<'a>

Source§

fn default() -> OrderHistoryRequest<'a>

Returns the “default value” for a type. 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> 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> 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> 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