Skip to main content

instrument_from_full

Function instrument_from_full 

Source
pub fn instrument_from_full(i: &Instrument) -> Instrument
Expand description

Full record of GetInstrumentBy to [Instrument].

exchange holds the class code (the board), for example TQBR. isin is None when the broker sends none.

§Examples

use brokapi_tbank::map::instrument::instrument_from_full;
use brokapi_tbank_protocol::v1::Instrument;

let record = Instrument { uid: "uid-sber".into(), ticker: "SBER".into(), class_code: "TQBR".into(), currency: "rub".into(), ..Default::default() };
let instrument = instrument_from_full(&record);
assert_eq!(instrument.id.key.symbol, "SBER");
assert_eq!(instrument.currency, "rub");
assert_eq!(instrument.isin, None);