How does Polygon create the OHLCV (open, high, low, close, volume) aggregate bars?
Polygon uses the “Sale Conditions” attached to each trade to determine if that trade is eligible to update the aggregate
You can use the Conditions endpoint to answer this question. For example, if you want to know how condition ‘2’ on a stock trade affects the OHLCV, you can make the following request:
{
"results": [
{ "id": 2,
"type": "sale_condition",
"name": "Average Price Trade",
"asset_class": "stocks",
"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
}
},
"data_types": [
"trade"
]
}
],
"status": "OK",
"request_id": "ff53e56b645039df61bd933737b2ce92",
"count": 1
}
The Conditions endpoint allows for filtering based on
The same concept applies to Options data as well . The rules for updating the OHLCV are inside the
The Securities Information Processors publish two sets of guidelines for aggregating based on these sale conditions: the consolidated processing guidelines and the “Market Center” processing guidelines. (See the CTA Output Specification, pg. 64, or the UTP Output Specification, pg. 43, for the sale conditions matrices and their guidelines for aggregation. Also see OPRA Output Specifications, pg. 24, for the option’s sale conditions and guidelines).
The Market Center guidelines are meant for aggregating on a per-exchange basis. On the other hand, Polygon.io currently only offers aggregates for the “consolidated” feed (meaning trades from all exchanges), so only the consolidated rules apply. In this particular case, the ‘consolidated’ rules show that sale condition 2 (or “Average Price Trade”) only updates the volume, but not high and low:
Note that OPRA and the Securities Information Processors publish end-of-day daily aggregate data, so their guidelines apply primarily to daily bars. Because we publish minute aggregates, for such data there are slight differences: in particular, trades in extended-hours markets can update OHLC for minute bars (otherwise there would be no minute aggregates during extended trading hours!).
Talk with our market data experts
Reimagining financial market data for the 21st century.
Can’t find the answer you’re looking for? Contact our team.
Stocks
Aggregates
FAQ
Aggregates
FAQ
Aggregates