The Polygon.io Indices API provides REST endpoints that let you query the latest indices data from thousands of industry leaders including S&P, Dow Jones, FTSE Russell, and more. You can find candlesticks, snapshots, and more for each index.
Pass your API key in the query string like follows:
Alternatively, you can add an Authorization header to the request with your API Key as the token in the following form:
Many of Polygon.io's REST endpoints allow you to extend query parameters with inequalities like date.lt=2023-01-01 (less than) and date.gte=2023-01-01 (greater than or equal to) to search ranges of values. You can also use the field name without any extension to query for exact equality. Fields that support extensions will have an "Additional filter parameters" dropdown beneath them in the docs that detail the supported extensions for that parameter.
By default, all endpoints return a JSON response. Users with Indices Starter plan and above can request a CSV response by including 'Accept': 'text/csv' as a request parameter.
Get aggregate bars for an index over a given date range in custom time window sizes.
For example, if timespan = ‘minute’ and multiplier = ‘5’ then 5-minute bars will be returned.
The ticker symbol of Index.
The size of the timespan multiplier.
The size of the time window.
The start of the aggregate time window. Either a date with the format YYYY-MM-DD or a millisecond timestamp.
The end of the aggregate time window. Either a date with the format YYYY-MM-DD or a millisecond timestamp.
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).
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.
The exchange symbol that this item is traded under.
The number of aggregates (minute or day) used to generate the response.
A request id assigned by the server.
The total number of results for this request.
The status of this request's response.
The close value for the symbol in the given time period.
The highest value for the symbol in the given time period.
The lowest value for the symbol in the given time period.
The open value for the symbol in the given time period.
The Unix Msec timestamp for the start of the aggregate window.
{
"queryCount": 2,
"request_id": "0cf72b6da685bcd386548ffe2895904a",
"results": [
{
"c": "4,048.42",
"h": "4,050.00",
"l": "3,980.31",
"n": 1,
"o": "4,048.26",
"t": 1678221133236
},
{
"c": "4,048.42",
"h": "4,050.00",
"l": "3,980.31",
"n": 1,
"o": "4,048.26",
"t": 1678221139690
}
],
"resultsCount": 2,
"status": "OK",
"ticker": "I:SPX"
}
Get the previous day's open, high, low, and close (OHLC) for the specified index.
The ticker symbol of Index.
The exchange symbol that this item is traded under.
The number of aggregates (minute or day) used to generate the response.
A request id assigned by the server.
The total number of results for this request.
The status of this request's response.
The close value for the symbol in the given time period.
The highest value for the symbol in the given time period.
The lowest value for the symbol in the given time period.
The open value for the symbol in the given time period.
The Unix Msec timestamp for the start of the aggregate window.
{
"queryCount": 1,
"request_id": "b2170df985474b6d21a6eeccfb6bee67",
"results": [
{
"T": "SPX",
"c": "4,048.42",
"h": "4,050.00",
"l": "3,980.31",
"o": "4,048.26",
"t": 1678221584688
}
],
"resultsCount": 1,
"status": "OK",
"ticker": "I:SPX"
}
Get the open, close and afterhours values of a index symbol on a certain date.
The ticker symbol of Index.
The date of the requested open/close in the format YYYY-MM-DD.
The close value of the ticker symbol in after hours trading.
The close value for the symbol in the given time period.
The requested date.
The highest value for the symbol in the given time period.
The lowest value for the symbol in the given time period.
The open value for the symbol in the given time period.
The open value of the ticker symbol in pre-market trading.
The status of this request's response.
The exchange symbol that this item is traded under.
{
"afterHours": "4,078.49",
"close": "4,045.64",
"from": "2023-01-09",
"high": "4,078.49",
"low": "4,051.82",
"open": "4,055.15",
"preMarket": "4,078.49",
"status": "OK",
"symbol": "SPX"
}
Get the simple moving average (SMA) for a ticker symbol over a given time range.
The ticker symbol for which to get simple moving average (SMA) data.
Query by timestamp. Either a date with the format YYYY-MM-DD or a millisecond timestamp.
The size of the aggregate time window.
Whether or not the aggregates used to calculate the simple moving average are adjusted for splits. By default, aggregates are adjusted. Set this to false to get results that are NOT adjusted for splits.
The window size used to calculate the simple moving average (SMA). i.e. a window size of 10 with daily aggregates would result in a 10 day moving average.
The value in the aggregate which will be used to calculate the simple moving average. i.e. 'close' will result in using close values to calculate the simple moving average (SMA).
Whether or not to include the aggregates used to calculate this indicator in the response.
The order in which to return the results, ordered by timestamp.
Limit the number of results returned, default is 10 and max is 5000
If present, this value can be used to fetch the next page of data.
A request id assigned by the server.
The close price for the symbol in the given time period.
The highest price for the symbol in the given time period.
The lowest price for the symbol in the given time period.
The number of transactions in the aggregate window.
The open price for the symbol in the given time period.
Whether or not this aggregate is for an OTC ticker. This field will be left off if false.
The Unix Msec timestamp for the start of the aggregate window.
The trading volume of the symbol in the given time period.
The volume weighted average price.
The URL which can be used to request the underlying aggregates used in this request.
The Unix Msec timestamp from the last aggregate used in this calculation.
The indicator value for this period.
The status of this request's response.
{
"next_url": "https://api.polygon.io/v1/indicators/sma/I:SPX?cursor=YWRqdXN0ZWQ9dHJ1ZSZhcD0lN0IlMjJ2JTIyJTNBMCUyQyUyMm8lMjIlM0EwJTJDJTIyYyUyMiUzQTQwNDcuNDEwMDAwMDAwMDAwMyUyQyUyMmglMjIlM0EwJTJDJTIybCUyMiUzQTAlMkMlMjJ0JTIyJTNBMTY3ODA4MjQwMDAwMCU3RCZhcz0mZXhwYW5kX3VuZGVybHlpbmc9ZmFsc2UmbGltaXQ9MTAmb3JkZXI9ZGVzYyZzZXJpZXNfdHlwZT1jbG9zZSZ0aW1lc3Bhbj1kYXkmdGltZXN0YW1wLmx0PTE2NzgxNjUyMDAwMDAmd2luZG93PTU",
"request_id": "a47d1beb8c11b6ae897ab76cdbbf35a3",
"results": {
"underlying": {
"url": "https://api.polygon.io/v2/aggs/ticker/I:SPX/range/1/day/1063281600000/1678725829099?limit=35&sort=desc"
},
"values": [
{
"timestamp": 1678165200000,
"value": 4035.913999999998
}
]
},
"status": "OK"
}
Get the exponential moving average (EMA) for a ticker symbol over a given time range.
The ticker symbol for which to get exponential moving average (EMA) data.
Query by timestamp. Either a date with the format YYYY-MM-DD or a millisecond timestamp.
The size of the aggregate time window.
Whether or not the aggregates used to calculate the exponential moving average are adjusted for splits. By default, aggregates are adjusted. Set this to false to get results that are NOT adjusted for splits.
The window size used to calculate the exponential moving average (EMA). i.e. a window size of 10 with daily aggregates would result in a 10 day moving average.
The value in the aggregate which will be used to calculate the exponential moving average. i.e. 'close' will result in using close values to calculate the exponential moving average (EMA).
Whether or not to include the aggregates used to calculate this indicator in the response.
The order in which to return the results, ordered by timestamp.
Limit the number of results returned, default is 10 and max is 5000
If present, this value can be used to fetch the next page of data.
A request id assigned by the server.
The close price for the symbol in the given time period.
The highest price for the symbol in the given time period.
The lowest price for the symbol in the given time period.
The number of transactions in the aggregate window.
The open price for the symbol in the given time period.
Whether or not this aggregate is for an OTC ticker. This field will be left off if false.
The Unix Msec timestamp for the start of the aggregate window.
The trading volume of the symbol in the given time period.
The volume weighted average price.
The URL which can be used to request the underlying aggregates used in this request.
The Unix Msec timestamp from the last aggregate used in this calculation.
The indicator value for this period.
The status of this request's response.
{
"next_url": "https://api.polygon.io/v1/indicators/ema/I:SPX?cursor=YWRqdXN0ZWQ9dHJ1ZSZhcD0lN0IlMjJ2JTIyJTNBMCUyQyUyMm8lMjIlM0EwJTJDJTIyYyUyMiUzQTQwNDcuNDEwMDAwMDAwMDAwMyUyQyUyMmglMjIlM0EwJTJDJTIybCUyMiUzQTAlMkMlMjJ0JTIyJTNBMTY3ODA4MjQwMDAwMCU3RCZhcz0mZXhwYW5kX3VuZGVybHlpbmc9ZmFsc2UmbGltaXQ9MTAmb3JkZXI9ZGVzYyZzZXJpZXNfdHlwZT1jbG9zZSZ0aW1lc3Bhbj1kYXkmdGltZXN0YW1wLmx0PTE2NzgxNjUyMDAwMDAmd2luZG93PTU",
"request_id": "a47d1beb8c11b6ae897ab76cdbbf35a3",
"results": {
"underlying": {
"url": "https://api.polygon.io/v2/aggs/ticker/I:SPX/range/1/day/1063281600000/1678726291180?limit=35&sort=desc"
},
"values": [
{
"timestamp": 1678165200000,
"value": 4033.086001449211
}
]
},
"status": "OK"
}
Get moving average convergence/divergence (MACD) for a ticker symbol over a given time range.
The ticker symbol for which to get MACD data.
Query by timestamp. Either a date with the format YYYY-MM-DD or a millisecond timestamp.
The size of the aggregate time window.
Whether or not the aggregates used to calculate the MACD are adjusted for splits. By default, aggregates are adjusted. Set this to false to get results that are NOT adjusted for splits.
The short window size used to calculate MACD data.
The long window size used to calculate MACD data.
The window size used to calculate the MACD signal line.
The value in the aggregate which will be used to calculate the MACD. i.e. 'close' will result in using close values to calculate the MACD.
Whether or not to include the aggregates used to calculate this indicator in the response.
The order in which to return the results, ordered by timestamp.
Limit the number of results returned, default is 10 and max is 5000
If present, this value can be used to fetch the next page of data.
A request id assigned by the server.
The close price for the symbol in the given time period.
The highest price for the symbol in the given time period.
The lowest price for the symbol in the given time period.
The number of transactions in the aggregate window.
The open price for the symbol in the given time period.
Whether or not this aggregate is for an OTC ticker. This field will be left off if false.
The Unix Msec timestamp for the start of the aggregate window.
The trading volume of the symbol in the given time period.
The volume weighted average price.
The URL which can be used to request the underlying aggregates used in this request.
The indicator value for this period.
The indicator value for this period.
The Unix Msec timestamp from the last aggregate used in this calculation.
The indicator value for this period.
The status of this request's response.
{
"next_url": "https://api.polygon.io/v1/indicators/macd/I:SPX?cursor=YWN0aXZlPXRydWUmZGF0ZT0yMDIxLTA0LTI1JmxpbWl0PTEmb3JkZXI9YXNjJnBhZ2VfbWFya2VyPUElN0M5YWRjMjY0ZTgyM2E1ZjBiOGUyNDc5YmZiOGE1YmYwNDVkYzU0YjgwMDcyMWE2YmI1ZjBjMjQwMjU4MjFmNGZiJnNvcnQ9dGlja2Vy",
"request_id": "a47d1beb8c11b6ae897ab76cdbbf35a3",
"results": {
"underlying": {
"url": "https://api.polygon.io/v2/aggs/ticker/I:SPX/range/1/day/1063281600000/1678726155743?limit=129&sort=desc"
},
"values": [
{
"histogram": 10.897861258863195,
"signal": -25.314340901212,
"timestamp": 1678168800000,
"value": -14.416479642348804
},
{
"histogram": 15.308854617117138,
"signal": -28.038806215927796,
"timestamp": 1678165200000,
"value": -12.729951598810658
}
]
},
"status": "OK"
}
Get the relative strength index (RSI) for a ticker symbol over a given time range.
The ticker symbol for which to get relative strength index (RSI) data.
Query by timestamp. Either a date with the format YYYY-MM-DD or a millisecond timestamp.
The size of the aggregate time window.
Whether or not the aggregates used to calculate the relative strength index are adjusted for splits. By default, aggregates are adjusted. Set this to false to get results that are NOT adjusted for splits.
The window size used to calculate the relative strength index (RSI).
The value in the aggregate which will be used to calculate the relative strength index. i.e. 'close' will result in using close values to calculate the relative strength index (RSI).
Whether or not to include the aggregates used to calculate this indicator in the response.
The order in which to return the results, ordered by timestamp.
Limit the number of results returned, default is 10 and max is 5000
If present, this value can be used to fetch the next page of data.
A request id assigned by the server.
The close price for the symbol in the given time period.
The highest price for the symbol in the given time period.
The lowest price for the symbol in the given time period.
The number of transactions in the aggregate window.
The open price for the symbol in the given time period.
Whether or not this aggregate is for an OTC ticker. This field will be left off if false.
The Unix Msec timestamp for the start of the aggregate window.
The trading volume of the symbol in the given time period.
The volume weighted average price.
The URL which can be used to request the underlying aggregates used in this request.
The Unix Msec timestamp from the last aggregate used in this calculation.
The indicator value for this period.
The status of this request's response.
{
"next_url": "https://api.polygon.io/v1/indicators/rsi/I:SPX?cursor=YWRqdXN0ZWQ9dHJ1ZSZhcD0lN0IlMjJ2JTIyJTNBMCUyQyUyMm8lMjIlM0EwJTJDJTIyYyUyMiUzQTQwNDcuNDEwMDAwMDAwMDAwMyUyQyUyMmglMjIlM0EwJTJDJTIybCUyMiUzQTAlMkMlMjJ0JTIyJTNBMTY3ODA4MjQwMDAwMCU3RCZhcz0mZXhwYW5kX3VuZGVybHlpbmc9ZmFsc2UmbGltaXQ9MTAmb3JkZXI9ZGVzYyZzZXJpZXNfdHlwZT1jbG9zZSZ0aW1lc3Bhbj1kYXkmdGltZXN0YW1wLmx0PTE2NzgxNjUyMDAwMDAmd2luZG93PTU",
"request_id": "a47d1beb8c11b6ae897ab76cdbbf35a3",
"results": {
"underlying": {
"url": "https://api.polygon.io/v2/aggs/ticker/I:SPX/range/1/day/1063281600000/1678725829099?limit=35&sort=desc"
},
"values": [
{
"timestamp": 1678165200000,
"value": 82.621486402274
}
]
},
"status": "OK"
}
Comma separated list of tickers
The error while looking for this ticker.
The market status for the market that trades this ticker.
The error message while looking for this ticker.
Name of Index.
The value of the change for the index from the previous trading day.
The percent of the change for the index from the previous trading day.
The closing value for the index of the day.
The highest value for the index of the day.
The lowest value for the index of the day.
The open value for the index of the day.
The closing value for the index of previous trading day.
Ticker of asset queried.
The indices market.
Value of Index.
The status of this request's response.
{
"request_id": "6a7e466379af0a71039d60cc78e72282",
"results": [
{
"market_status": "closed",
"name": "S&P 500",
"session": {
"change": -50.01,
"change_percent": -1.45,
"close": 3822.39,
"high": 3834.41,
"low": 38217.11,
"open": 3827.38,
"previous_close": 3812.19
},
"ticker": "I:SPX",
"type": "indices",
"value": 3822.39
},
{
"error": "NOT_FOUND",
"message": "Ticker not found.",
"ticker": "APx"
},
{
"error": "NOT_ENTITLED",
"message": "Not entitled to this ticker.",
"ticker": "APy"
}
],
"status": "OK"
}
Query all ticker symbols which are supported by Polygon.io. This API currently includes Stocks/Equities, Crypto, and Forex.
Specify a ticker symbol. Defaults to empty string which queries all tickers.
Specify the type of the tickers. Find the types that we support via our Ticker Types API. Defaults to empty string which queries all types.
Filter by market type. By default all markets are included.
Specify the primary exchange of the asset in the ISO code format. Find more information about the ISO codes at the ISO org website. Defaults to empty string which queries all exchanges.
Specify the CUSIP code of the asset you want to search for. Find more information about CUSIP codes at their website. Defaults to empty string which queries all CUSIPs.
Note: Although you can query by CUSIP, due to legal reasons we do not return the CUSIP in the response.
Specify the CIK of the asset you want to search for. Find more information about CIK codes at their website. Defaults to empty string which queries all CIKs.
Specify a point in time to retrieve tickers available on that date. Defaults to the most recent available date.
Search for terms within the ticker and/or company name.
Specify if the tickers returned should be actively traded on the queried date. Default is true.
Order results based on the sort
field.
Limit the number of results returned, default is 100 and max is 1000.
Sort field used for ordering.
The total number of results for this request.
If present, this value can be used to fetch the next page of data.
A request id assigned by the server.
An array of tickers that match your query.
Note: Although you can query by CUSIP, due to legal reasons we do not return the CUSIP in the response.
Whether or not the asset is actively traded. False means the asset has been delisted.
The CIK number for this ticker. Find more information here.
The composite OpenFIGI number for this ticker. Find more information here
The name of the currency that this asset is traded with.
The last date that the asset was traded.
The information is accurate up to this time.
The locale of the asset.
The market type of the asset.
The name of the asset. For stocks/equities this will be the companies registered name. For crypto/fx this will be the name of the currency or coin pair.
The ISO code of the primary listing exchange for this asset.
The share Class OpenFIGI number for this ticker. Find more information here
The exchange symbol that this item is traded under.
The type of the asset. Find the types that we support via our Ticker Types API.
The status of this request's response.
{
"count": 1,
"next_url": "https://api.polygon.io/v3/reference/tickers?cursor=YWN0aXZlPXRydWUmZGF0ZT0yMDIxLTA0LTI1JmxpbWl0PTEmb3JkZXI9YXNjJnBhZ2VfbWFya2VyPUElN0M5YWRjMjY0ZTgyM2E1ZjBiOGUyNDc5YmZiOGE1YmYwNDVkYzU0YjgwMDcyMWE2YmI1ZjBjMjQwMjU4MjFmNGZiJnNvcnQ9dGlja2Vy",
"request_id": "e70013d92930de90e089dc8fa098888e",
"results": [
{
"active": true,
"cik": "0001090872",
"composite_figi": "BBG000BWQYZ5",
"currency_name": "usd",
"last_updated_utc": "2021-04-25T00:00:00Z",
"locale": "us",
"market": "stocks",
"name": "Agilent Technologies Inc.",
"primary_exchange": "XNYS",
"share_class_figi": "BBG001SCTQY4",
"ticker": "A",
"type": "CS"
}
],
"status": "OK"
}
Filter by asset class.
Filter by locale.
The total number of results for this request.
A request ID assigned by the server.
An identifier for a group of similar financial instruments.
A code used by Polygon.io to refer to this ticker type.
A short description of this ticker type.
An identifier for a geographical location.
The status of this request's response.
{
"count": 1,
"request_id": "31d59dda-80e5-4721-8496-d0d32a654afe",
"results": [
{
"asset_class": "stocks",
"code": "CS",
"description": "Common Stock",
"locale": "us"
}
],
"status": "OK"
}
The market close time on the holiday (if it's not closed).
The date of the holiday.
Which market the record is for.
The name of the holiday.
The market open time on the holiday (if it's not closed).
The status of the market on the holiday.
[
{
"date": "2020-11-26T00:00:00.000Z",
"exchange": "NYSE",
"name": "Thanksgiving",
"status": "closed"
},
{
"date": "2020-11-26T00:00:00.000Z",
"exchange": "NASDAQ",
"name": "Thanksgiving",
"status": "closed"
},
{
"date": "2020-11-26T00:00:00.000Z",
"exchange": "OTC",
"name": "Thanksgiving",
"status": "closed"
},
{
"close": "2020-11-27T18:00:00.000Z",
"date": "2020-11-27T00:00:00.000Z",
"exchange": "NASDAQ",
"name": "Thanksgiving",
"open": "2020-11-27T14:30:00.000Z",
"status": "early-close"
},
{
"close": "2020-11-27T18:00:00.000Z",
"date": "2020-11-27T00:00:00.000Z",
"exchange": "NYSE",
"name": "Thanksgiving",
"open": "2020-11-27T14:30:00.000Z",
"status": "early-close"
}
]
Get the current trading status of the exchanges and overall financial markets.
Whether or not the market is in post-market hours.
The status of the crypto market.
The status of the forex market.
Whether or not the market is in pre-market hours.
The status of the Nasdaq market.
The status of the NYSE market.
The status of the OTC market.
The status of the market as a whole.
The current time of the server.
{
"afterHours": true,
"currencies": {
"crypto": "open",
"fx": "open"
},
"earlyHours": false,
"exchanges": {
"nasdaq": "extended-hours",
"nyse": "extended-hours",
"otc": "closed"
},
"market": "extended-hours",
"serverTime": "2020-11-10T22:37:37.000Z"
}
The Polygon.io Stocks WebSocket API provides streaming access to the latest stock market data from all US stock exchanges. You can specify which channels you want to consume by sending instructions in the form of actions. Our WebSockets emit events to notify you when an event has occurred in a channel you've subscribed to.
Our WebSocket APIs are based on entitlements that control which WebSocket Clusters you can connect to and which kinds of data you can access. You can login to see examples that include your API key and are personalized to your entitlements.
With a premium Indices plan, you will be able to use a single connection to the Indices Cluster. If another connection attempts to connect to the Indices Cluster simultaneously, the current connection will be disconnected. If you need more simultaneous connections to this cluster, you can contact support.
Connecting to a cluster:
On connection you will receive the following message:
[{
"ev":"status",
"status":"connected",
"message": "Connected Successfully"
}]
You must authenticate before you can make any other requests.
On successful authentication you will receive the following message:
[{
"ev":"status",
"status":"auth_success",
"message": "authenticated"
}]
Once authenticated, you can request a stream. You can request multiple streams in the same request.
You can also request multiple streams from the same cluster.
Things happen very quickly in the world of finance, which means a Polygon.io WebSocket client must be able to handle many incoming messages per second. Due to the nature of the WebSocket protocol, if a client is slow to consume messages from the server, Polygon.io's server must buffer messages and send them only as fast as the client can consume them. To help prevent the message buffer from getting too long, Polygon.io may send more than one JSON object in a single WebSocket message. We accomplish this by wrapping all messages in a JSON array, and adding more objects to the array if the message buffer is getting longer. For example, consider a WebSocket message with a single trade event in it:
[
{"ev":"T","sym":"MSFT","i":"50578","x":4,"p":215.9721,"s":100,"t":1611082428813,"z":3}
]
If your client is consuming a bit slow, or 2+ events happened in very short succession, you may receive a single WebSocket message with more than one event inside it, like this:
[
{"ev":"T","sym":"MSFT","i":"50578","x":4,"p":215.9721,"s":100,"t":1611082428813,"z":3},
{"ev":"T","sym":"MSFT","i":"12856","x":4,"p":215.989,"s":1,"c":[37],"t":1611082428814,"z":3}
]
Note that if a client is consuming messages too slowly for too long, Polygon.io's server-side buffer may get too large. If that happens, Polygon.io will terminate the WebSocket connection. You can check your account dashboard to see if a connection was terminated as a slow consumer. If this happens to you consistently, consider subscribing to fewer symbols or channels.
Stream real-time minute aggregates for a given index ticker symbol.
Specify an index ticker using "I:" prefix or use * to subscribe to all index tickers. You can also use a comma separated list to subscribe to multiple index tickers. You can retrieve available index tickers from our Index Tickers API.
The event type.
The symbol representing the given index.
Today's official opening value.
The opening index value for this aggregate window.
The closing index value for this aggregate window.
The highest index value for this aggregate window.
The lowest index value for this aggregate window.
The timestamp of the starting index for this aggregate window in Unix Milliseconds.
The timestamp of the ending index for this aggregate window in Unix Milliseconds.
{
"ev": "AM",
"sym": "I:SPX",
"op": 3985.67,
"o": 3985.67,
"c": 3985.67,
"h": 3985.67,
"l": 3985.67,
"s": 1678220675805,
"e": 1678220675805
}
Real-time value for a given index ticker symbol.
Specify an index ticker using "I:" prefix or use * to subscribe to all index tickers. You can also use a comma separated list to subscribe to multiple index tickers. You can retrieve available index tickers from our Index Tickers API.
The event type.
The value of the index.
The assigned ticker of the index.
The Timestamp in Unix MS.
{
"ev": "V",
"val": 3988.5,
"T": "I:SPX",
"t": 1678220098130
}