Skip to main content

instrument_ref

Function instrument_ref 

Source
pub fn instrument_ref(id: &InstrumentId) -> String
Expand description

Value for the instrument_id request fields: figi, instrument_uid or ticker_classcode.

A Uid or Figi native id is passed as is. A TickerClass (or SymbolMic) becomes TICKER_CLASSCODE, for example SBER_TQBR. No network call is made and the id is not checked against the directory.

§Examples

use brokapi_core::{InstrumentId, InstrumentKey, NativeId};
use brokapi_tbank::ids::instrument_ref;

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