Skip to main content

id_from_parts

Function id_from_parts 

pub fn id_from_parts(
    uid: &str,
    figi: &str,
    ticker: &str,
    class_code: &str,
) -> InstrumentId
Expand description

Canonical id from the fields a broker message carries. Prefers the uid (stable across tickers).

The native id is the uid, else the figi, else ticker and class code. When the message has no ticker, the key holds the uid or figi in place of the symbol, until a message with a ticker arrives (the user data core learns the mapping).

§Examples

use brokapi_core::NativeId;
use brokapi_tbank::ids::id_from_parts;

let id = id_from_parts("", "", "GAZP", "TQBR");
assert!(matches!(id.native, NativeId::TickerClass { .. }));