pub struct InstrumentRequest<'a> {
pub category: Category,
pub symbol: Option<Cow<'a, str>>,
pub symbol_type: Option<Cow<'a, str>>,
pub status: Option<Cow<'a, str>>,
pub base_coin: Option<Cow<'a, str>>,
pub limit: Option<u64>,
pub cursor: Option<Cow<'a, str>>,
}Expand description
Parameters for requesting instrument information.
This struct defines the parameters for querying instrument details via the /v5/market/instruments-info endpoint.
For perpetual futures, instrument info includes leverage, price filters, and lot size filters, which are critical
for configuring trading bot parameters.
Fields§
§category: CategoryThe product category (e.g., Linear, Inverse, Spot, Option).
Specifies the instrument type. For perpetual futures, use Linear or Inverse.
Bots must set this to filter relevant instruments.
symbol: Option<Cow<'a, str>>The trading pair symbol (e.g., “BTCUSDT”).
Optionally specifies a single trading pair. If unset, the API returns data for all instruments in the category, which may be voluminous. Bots should set this for specific pairs to reduce response size and latency.
symbol_type: Option<Cow<'a, str>>Symbol type filter (e.g., “spot”, “linear”, “inverse”).
The region to which the trading pair belongs. Only applicable for linear, inverse, and spot categories.
This can be used to filter instruments by their regional classification.
status: Option<Cow<'a, str>>Instrument status filter.
Filters instruments by their trading status:
linear&inverse&spot: By default returns onlyTradingsymbolsoption: By default returnsPreLaunch,Trading, andDelivering- Spot has
Tradingonly linear&inverse: when status=PreLaunch, it returns Pre-Market contracts
base_coin: Option<Cow<'a, str>>The base coin of the instrument (e.g., “BTC”).
Filters instruments by their base asset. For example, setting base_coin to "BTC" returns
all BTC-based instruments. Applies to linear, inverse, and option categories only.
For option category, returns BTC by default if not specified.
limit: Option<u64>The maximum number of instruments to return (1-1000, default: 500).
Controls the response size. Bots should set a reasonable limit to balance data completeness
and performance, especially when querying all instruments in a category.
Note: Spot does not support pagination, so limit and cursor are invalid for spot category.
cursor: Option<Cow<'a, str>>Cursor for pagination.
Use the nextPageCursor token from the response to retrieve the next page of the result set.
Note: Spot does not support pagination, so limit and cursor are invalid for spot category.
Implementations§
Source§impl<'a> InstrumentRequest<'a>
impl<'a> InstrumentRequest<'a>
Sourcepub fn default() -> InstrumentRequest<'a>
pub fn default() -> InstrumentRequest<'a>
Creates a default Instrument request.
Returns a request with category set to Linear and symbol set to "BTCUSDT".
Suitable for testing but should be customized for production to match specific trading needs.
Sourcepub fn new(
category: Category,
symbol: Option<&'a str>,
symbol_type: Option<&'a str>,
status: Option<&'a str>,
base_coin: Option<&'a str>,
limit: Option<u64>,
cursor: Option<&'a str>,
) -> InstrumentRequest<'a>
pub fn new( category: Category, symbol: Option<&'a str>, symbol_type: Option<&'a str>, status: Option<&'a str>, base_coin: Option<&'a str>, limit: Option<u64>, cursor: Option<&'a str>, ) -> InstrumentRequest<'a>
Constructs a new Instrument request with specified parameters.
Allows full customization. Bots should use this to tailor requests to their strategy,
ensuring category and symbol align with the instruments being traded.
Sourcepub fn validate(&self) -> Result<(), String>
pub fn validate(&self) -> Result<(), String>
Validates the request parameters according to API constraints.
Returns Ok(()) if the request is valid, or Err(String) with an error message.
Sourcepub fn linear(
symbol: Option<&'a str>,
symbol_type: Option<&'a str>,
status: Option<&'a str>,
base_coin: Option<&'a str>,
limit: Option<u64>,
cursor: Option<&'a str>,
) -> InstrumentRequest<'a>
pub fn linear( symbol: Option<&'a str>, symbol_type: Option<&'a str>, status: Option<&'a str>, base_coin: Option<&'a str>, limit: Option<u64>, cursor: Option<&'a str>, ) -> InstrumentRequest<'a>
Creates a request for linear perpetual futures.
Convenience method for creating requests for USDT-margined perpetual futures.
Sourcepub fn inverse(
symbol: Option<&'a str>,
symbol_type: Option<&'a str>,
status: Option<&'a str>,
base_coin: Option<&'a str>,
limit: Option<u64>,
cursor: Option<&'a str>,
) -> InstrumentRequest<'a>
pub fn inverse( symbol: Option<&'a str>, symbol_type: Option<&'a str>, status: Option<&'a str>, base_coin: Option<&'a str>, limit: Option<u64>, cursor: Option<&'a str>, ) -> InstrumentRequest<'a>
Creates a request for inverse perpetual futures.
Convenience method for creating requests for coin-margined perpetual futures.
Trait Implementations§
Source§impl<'a> Clone for InstrumentRequest<'a>
impl<'a> Clone for InstrumentRequest<'a>
Source§fn clone(&self) -> InstrumentRequest<'a>
fn clone(&self) -> InstrumentRequest<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more