Skip to main content

market_data_history

Function market_data_history 

Source
pub async fn market_data_history<M: MarketDataSource + InstrumentSource + ?Sized>(
    md: &M,
    id: &InstrumentId,
    tf: Timeframe,
    candle_range: TimeRange,
    schedule_key: &str,
    schedule_range: TimeRange,
)
Expand description

The tape, candles, trading status and schedule of one instrument.

  • last_trades(limit) gives at least one trade and never more than limit. Prices and quantities are positive and the trades are for the right instrument.
  • candles(tf, candle_range) gives bars with low <= open, close <= high, closing after they open, for the asked timeframe and instrument.
  • trading_status names the instrument and is not Unknown.
  • schedule(schedule_key, schedule_range) gives sessions that start before they end. schedule_key is what the adapter calls an exchange (T-Bank "MOEX", Finam and BCS "TICKER@MARKET").

The scenario asks for last_trades with a limit of 2. The mock must serve the tape, candles for candle_range, a known trading status and at least one session in schedule_range.

§Panics

With [conformance:market_data_history] <reason> when a call fails or a check above fails.

§Examples

// 2026-10-19 00:00 UTC .. 2026-10-20 00:00 UTC
let day = TimeRange::new(
    UnixNanos::from_nanos(1_792_368_000_000_000_000),
    UnixNanos::from_nanos(1_792_454_400_000_000_000),
);
// BCS schedules are per instrument: "TICKER@CLASSCODE".
brokapi_conformance::market_data_history(&md, &sber, Timeframe::M1, day, "SBER@TQBR", day).await;