Skip to main content

matches

Function matches 

Source
pub fn matches(
    id: &InstrumentId,
    uid: &str,
    figi: &str,
    ticker: &str,
    class_code: &str,
) -> bool
Expand description

true when a broker message (identified by any of uid/figi/ticker+class) is about id.

A message matches when its ticker and class code equal the key of id, or when its uid (for a Uid id) or figi (for a Figi id) equals the native id. An empty uid or figi in the message never matches.

§Examples

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

let id = InstrumentId::new(InstrumentKey::new("SBER", "TQBR"), NativeId::Uid("uid-sber".into()));
assert!(matches(&id, "uid-sber", "", "", ""));
assert!(matches(&id, "", "", "SBER", "TQBR"));
assert!(!matches(&id, "uid-other", "", "GAZP", "TQBR"));