pub async fn instrument_lookup<M: InstrumentSource + ?Sized>(
md: &M,
query: InstrumentQuery,
id: &InstrumentId,
)Expand description
Instrument directory: a search finds the instrument, and its trading parameters are usable for order sizing.
Checks:
md.find(query)succeeds and the result contains an instrument with the same [brokapi_core::InstrumentKey] asid;md.trading_params(id)succeeds withlot_size > 0andprice_step > 0. Both are used to round order quantities and prices, so zero would make every order invalid.
query must be a search that finds id. The mock must list that instrument and serve its parameters.
§Panics
With [conformance:instrument_lookup] <reason> when a call fails, the instrument is not found, or a
parameter is not positive.
§Examples
let query = InstrumentQuery::ByTicker { ticker: "SBER".into(), exchange: None };
brokapi_conformance::instrument_lookup(&md, query, &sber).await;