Knowledge Base/How can I tell whether a specific trade updated the OHLCV aggregate bar?

How can I tell whether a specific trade updated the OHLCV aggregate bar?

Take the conditions array from the trade and look each code up on the conditions endpoint. Its update_rules field says whether that condition updates the high and low, the open and close, and the volume of a regular-hours minute bar or a daily bar.

Look the trade's conditions up. A US stock trade lists its sale condition codes in a conditions array, a regular trade has no such field at all, and /v3/reference/conditions holds the rules for each code. Support answers this question the same way. Pre-market and after-hours minute bars are the case to watch: they take their prices from Form T (12) trades, which the endpoint lists as not updating them. If you want the model rather than one trade's verdict, read How does Massive create aggregate bars?.

Applies to

  • Plans: any Stocks subscription. The conditions endpoint is reference data.
  • Endpoints: /v3/reference/conditions for the rules and /v3/trades/{ticker} for the trade's condition codes.
  • Asset classes: US stocks. Options and futures carry their own condition sets.

How to check one trade

  1. Pull the trade and read its conditions array.
  2. Look each code up, filtering with data_type=trade, singular, so you do not get the quote condition that shares the number.
  3. Read update_rules. For a regular-hours minute bar, from 09:30 to 16:00 ET, or for a daily bar, if every code says false for a field, that trade did not set it. Pre-market and after-hours minute bars also take their open, high, low and close from Form T (12) trades, unless the trade carries another code that says false, such as Odd Lot Trade (37), as Does a Form T trade update a pre-market minute bar's high, low, open and close? explains.
curl -X GET "https://api.massive.com/v3/reference/conditions?asset_class=stocks&data_type=trade&id=2&apiKey=YOUR_API_KEY"

Response

{
  "results": [
    {
      "id": 2,
      "type": "sale_condition",
      "name": "Average Price Trade",
      "sip_mapping": { "CTA": "B", "UTP": "W", "FINRA_TDDS": "W" },
      "update_rules": {
        "consolidated": { "updates_high_low": false, "updates_open_close": false, "updates_volume": true },
        "market_center": { "updates_high_low": false, "updates_open_close": false, "updates_volume": true }
      }
    }
  ],
  "status": "OK"
}

So condition 2 adds to volume and never touches price. A minute containing only average-price trades has volume but no open, high, low or close, and therefore no bar.

What the fields mean

The fields that mean something here are four, and three of them do the work:

FieldWhat it tells you
update_rules.consolidatedWhether the trade updates the consolidated tape's bar, which is what /v2/aggs returns
update_rules.market_centerWhether it updates that single venue's own bar. The two can differ
sip_mappingThe letter each plan uses for this condition, for reconciling against a CTA, UTP or FINRA feed
typeWhether this is a sale_condition for a trade or a quote_condition. Filter on data_type=trade

Why filter on data types

Filter on data_type=trade because the id space is shared. Asking for id=2 without the filter returns two records: sale condition 2, "Average Price Trade", and quote condition 2, "Regular One-Sided Open". Reading the wrong one gives a confident wrong answer, and there are 94 stock conditions in total across eight types.

If you see an error

Two results for one id means you did not filter by data type. Add &data_type=trade. The parameter is singular; a plural data_types is ignored and you get both records back.

A trade with no conditions field is an ordinary trade with no special handling: it updates everything. REST leaves the field out rather than sending an empty array, and the flat files leave the column blank.

A high or low you cannot find among the trades usually means you excluded a trade that is eligible, rather than that the bar is wrong. Check the conditions of the trades nearest the extreme.

Related


Was this article helpful?

Modernizing Wall St.

Reimagining financial market data for the 21st century.

Schedule a demo

Talk with our market data experts

Recommended

Can't find the answer you're looking for? Contact our team.
  • Title
    Are all indices available through the basic subscription tier?
    Data Coverage Category

    Data Coverage

    Indices Category

    Indices

    Description
    No, and the ones it withholds are the famous ones: SPX, DJI, RUT and VIX all need a paid Indices tier. Basic still reaches more than 10,000 of the 13,000-odd indices Massive publishes, and NDX and the Nasdaq Composite are among them.
  • Title
    Does Massive offer dark pool data?
    Data Coverage Category

    Data Coverage

    Stocks Category

    Stocks

    Description
    Yes. Off-exchange prints, which include dark pool executions, arrive on the ordinary trades feed and are identified by an exchange ID of 4. There is no separate dark pool endpoint, and no way to tell which individual venue a print came from.
  • Title
    Does Massive offer pre-market and after-hours data?
    FAQ Category

    FAQ

    Stocks Category

    Stocks

    Description
    Yes. Every extended-hours trade and quote is published, from 04:00 to 20:00 Eastern. There is no session parameter, so you select a session with timestamps, and expect far fewer aggregate bars outside regular hours because many extended-hours trades are odd lots that cannot set a price.