Custom Bars (OHLC)

GET
/v2/aggs/ticker/{stocksTicker}/range/{multiplier}/{timespan}/{from}/{to}

Retrieve aggregated historical OHLC (Open, High, Low, Close) and volume data for a specified stock ticker over a custom date range and time interval in Eastern Time (ET). Aggregates are constructed exclusively from qualifying trades that meet specific conditions. If no eligible trades occur within a given timeframe, no aggregate bar is produced, resulting in an empty interval that indicates a lack of trading activity during that period. Users can tailor their data by adjusting the multiplier and timespan parameters (e.g., a 5-minute bar), covering pre-market, regular market, and after-hours sessions. This flexibility supports a broad range of analytical and visualization needs.

Use Cases: Data visualization, technical analysis, backtesting strategies, market research.

Path Parameters
stocksTicker
string
required
Specify a case-sensitive ticker symbol. For example, AAPL represents Apple Inc.
multiplier
integer
required
The size of the timespan multiplier.
timespan
enum (string)
required
The size of the time window.
from
string
required
The start of the aggregate time window. Either a date with the format YYYY-MM-DD or a millisecond timestamp.
to
string
required
The end of the aggregate time window. Either a date with the format YYYY-MM-DD or a millisecond timestamp.
Query Parameters
adjusted
boolean
Whether or not the results are adjusted for splits. By default, results are adjusted. Set this to false to get results that are NOT adjusted for splits.
sort
enum (string)
Sort the results by timestamp. `asc` will return results in ascending order (oldest at the top), `desc` will return results in descending order (newest at the top).
limit
integer
Limits the number of base aggregates queried to create the aggregate results. Max 50000 and Default 5000. Read more about how limit is used to calculate aggregate results in our article on Aggregate Data API Improvements.
Response Attributes
ticker
string
The exchange symbol that this item is traded under.
adjusted
boolean
Whether or not this response was adjusted for splits.
queryCount
integer
The number of aggregates (minute or day) used to generate the response.
request_id
string
A request id assigned by the server.
resultsCount
integer
The total number of results for this request.
status
string
The status of this request's response.
results
array (object)
optional
An array of results containing the requested data.
c
number
The close price for the symbol in the given time period.
h
number
The highest price for the symbol in the given time period.
l
number
The lowest price for the symbol in the given time period.
n
integer
optional
The number of transactions in the aggregate window.
o
number
The open price for the symbol in the given time period.
otc
boolean
optional
Whether or not this aggregate is for an OTC ticker. This field will be left off if false.
t
integer
The Unix millisecond timestamp for the start of the aggregate window.
v
number
The trading volume of the symbol in the given time period.
vw
number
optional
The volume weighted average price.
next_url
string
optional
If present, this value can be used to fetch the next page of data.
Code Examples
Query URL
GET
Log in or Sign up to Polygon to run a query. It's free.
Scroll to see updated query response
Response Object
Did you find this page helpful?
Do you still need help with something?