Skip to main content

extract_inst_family

Function extract_inst_family 

Source
pub fn extract_inst_family(symbol: &str) -> Result<Ustr>
Expand description

Extracts the instrument family from an OKX symbol string.

All OKX derivative symbols encode the family as the first two segments: BTC-USD-250328-92000-C -> BTC-USD, BTC-USDT-SWAP -> BTC-USDT.

ยงErrors

Returns an error if the symbol does not contain at least two dash-separated parts.