quantlab.dataset.massive.vendor_check#

Check a day of one-minute Trade bars against Massive’s own minute aggregates.

Massive’s minute aggregates are kept only to check quantlab’s Trade bars against (ADR 0030). check_minute_bars compares one session’s bars with the vendor’s bars of the same day, after two alignments:

  • Labels. Massive labels a bar at its start (window_start); Trade bars are labelled at their end, so a vendor bar starting at t is compared with the Trade bar labelled t + 1 minute. Vendor bars whose shifted label is not a bar of the session (pre- and post-market) are counted as vendor_outside_session and not compared. The two still close bars on opposite sides: Massive’s bar is [t, t + 1m), a Trade bar (t, t + 1m], so a trade stamped exactly on a minute (to the nanosecond) falls in neighbouring bars on the two sides.

  • Symbols. Both sides are keyed by the Massive ticker (ADR 0031). A vendor ticker off the conversion’s roster is counted as vendor_off_roster and not compared.

Massive emits a minute bar only when it holds a trade that sets a price, so a Trade bar counts as present when it has prices (a close); a bar of volume-only trades (odd lots, mostly) is counted as ours_volume_only and not compared. Over the bars present on both sides, each of open, high, low, close, volume and n_trades (the vendor’s transactions) agrees when the two values are equal; a NaN price never agrees with a number. The result counts the agreements, names the bar with the largest difference of each variable, and samples the bars present on one side only. Differences are reported, never raised: CHECKED says the check ran, not that it passed, until tolerances are set.

Examples#

>>> check = check_minute_bars(bars, vendor, labels)
>>> check["status"], check["both"] == check["agree"]["close"]
('checked', True)

Functions

check_minute_bars

Compare one session's one-minute Trade bars with Massive's minute aggregates.