Skip to main content

instrument_id

Function instrument_id 

pub fn instrument_id(symbol: &str, category: &str) -> InstrumentId
Expand description

The id of an instrument: the symbol and the category.

The key is BTCUSDT@linear: the second part names the product category of the exchange, because the same symbol can trade as spot and as a perpetual. The native id is the pair as the exchange spells it.

§Examples

use brokapi_bybit::util::instrument_id;

let btc = instrument_id("BTCUSDT", "linear");
assert_eq!(btc.key.display(), "BTCUSDT@linear");