Skip to main content

ticker

Function ticker 

Source
pub fn ticker(id: &InstrumentId) -> Result<String, Error>
Expand description

Returns the ticker (for example SBER) of an instrument id.

§Errors

[brokapi_core::Error::Config] when the native id is not [NativeId::TickerClass], as in require_ticker_class.

§Examples

use brokapi_bcs::util::ticker;
use brokapi_core::{InstrumentId, InstrumentKey, NativeId};

let sber = InstrumentId::new(
    InstrumentKey::new("SBER", "TQBR"),
    NativeId::TickerClass { ticker: "SBER".into(), class_code: "TQBR".into() },
);
assert_eq!(ticker(&sber).unwrap(), "SBER");