Tickers
Learn to get details about the available tickers.
We'll cover the following
Tickers are a unique combination of letters used to represent securities. Every security has a ticker associated with it. The following table gives examples of some of the more common ones:
A List of Tickers
Security | Market | Ticker |
Nike Inc. | Stock | NKE |
Asia Broadband Inc. | OTC | AABB |
Argentine Peso - US Dollar | Forex | C:ARSUSD |
Bitcoin - Japanese Yen | Cryptocurrency | X:BTCJPY |
Polygon API provides various endpoints to get information about tickers. Let’s discuss them in this lesson.
The ticker symbols endpoint
The ticker symbols endpoint returns a list of all available ticker symbols and their details on Polygon, which are used as an input parameter in various other endpoints.
The base URL for the tickers endpoint is given below:
https://api.polygon.io/v3/reference/tickers
By default, the ticker symbols endpoint lists all the available tickers. However, we can limit the response by providing some optional parameters.
The table below gives an overview of request parameters for the ticker symbols endpoint.
Request Parameters
Name | Type | Category | Description |
| String | Optional | This gets details about a specific ticker. |
| String | Optional | This specifies the type of tickers. Accepted input: |
| String | Optional | This specifies the market. Accepted input: |
| String | Optional | This specifies the primary exchange of the security in ISO format. |
| String | Optional | This gets tickers available on a specified date. By default, it is set to the latest date available. |
| String | Optional | This searches for tickers by providing a keyword |
| Boolean | Optional | If this is |
| String | Optional | The field orders the results. Accepted input: |
| String | Optional | This field orders the results based on the |
| Integer | Optional | This is the limit of results required. By default, it is set to |
Following are some additional filters provided by Polygon, which can be applied to ticker
:
.lt
: Less than.gt
: Greater than.lte
: Less than equal to.gte
: Greater than equal to
To apply the less-than filter on ticker
, we’ll pass ticker.lt
in our query parameters. In return, we’ll get a list of results where the value of ticker
is less than the value defined in the query. For example, if we want results in which the value of ticker
is less than B
, we can write the following in our query parameters:
const queryParameters = new URLSearchParams({"ticker.lt" : 'B',});
Let’s try to call this endpoint in the following code:
// Importing libraries hereimport fetch from "node-fetch";// Define API key hereconst apiKey = '{{API_KEY}}';// Define endpoint URL hereconst endpointUrl = new URL('https://api.polygon.io/v3/reference/tickers');// Define Header Parameters hereconst headerParameters = {authorization: `Bearer ${apiKey}`};// Define Query Parameters hereconst queryParameters = new URLSearchParams({market: 'fx',limit: 10});// Setting API call optionsconst options = {method: 'GET',headers: headerParameters,};// Function to make API callasync function Ticker() {try {endpointUrl.search = queryParameters;const response = await fetch(endpointUrl, options);// Custom function for printing the API responseprintResponse(response);}catch (error) {// Custom function for printing the error messageprintError(error);}}// Calling function to make API callTicker();
Here’s an explanation for the above code:
Line 8: We define the endpoint URL.
Lines 11–13: We define the API key in the header parameter.
Lines 16–19: We define the query parameters, set the
limit
to10
, and only fetch results related to forex.Lines 22–25: We define the options parameters and set the request type as
GET
.Lines 28–40: We define the
Ticker
function, which calls the endpoint.Lines 29–35: We call the API in a try block and print the response.
Lines 36–39: We define a catch block to catch all errors and exceptions and print them.
Line 43: We call the
Ticker
function.
Response Fields
Name | Type | Description |
| Object | This contains details about the ticker. |
| String | The ticker associated with the asset. |
| String | The name of the asset. |
| Enum | The market the asset belongs to. Possible output: |
| Enum | The location of the asset. Possible output: |
| String | The code of the primary exchange of the asset. |
| String | The type of asset. |
| Boolean | This is |
| String | The name of the currency the asset is traded under. |
| String | This represents the last time the ticker was updated. |
| String | The response status to our query. |
| String | The ID associated with our query. |
| Integer | The number of results returned. |
| String | The URL to the next page in case the response spans multiple pages. |
The ticker details endpoint
Fetching details about a specific ticker and its parent organization is often required. These details can be accessed through the ticker details endpoint available in the Polygon API.
The base URL for the ticker details endpoint is as follows:
https://api.polygon.io/v3/reference/tickers/{Ticker}
The following table gives an overview of request parameters given to the ticker details endpoint.
Request Parameters
Name | Type | Category | Description |
| String | Mandatory | The ticker whose details we want. |
| String | Optional | This gets information about a ticker for a specific date given in the YYYY-MM-DD format. |
Let’s try to call this endpoint in the following code. Try to change the value of the ticker by clicking the “Edit” button. Click “Run” to see the output of this endpoint.
// Importing libraries hereimport fetch from "node-fetch";// Define API key hereconst apiKey = '{{API_KEY}}';// Define endpoint URL hereconst endpointUrl = new URL(`https://api.polygon.io/v3/reference/tickers/{{TICKER}}`);// Define Header Parameters hereconst headerParameters = {authorization: `Bearer ${apiKey}`};// Setting API call optionsconst options = {method: 'GET',headers: headerParameters,};// Function to make API callasync function TickerDetails() {try {const response = await fetch(endpointUrl, options);// Custom function for printing the API responseprintResponse(response);}catch (error) {// Custom function for printing the error messageprintError(error);}}// Calling function to make API callTickerDetails();
Here’s an explanation for the above code:
Line 8: We define the endpoint URL.
Lines 22–33: We define the
TickerDetails
function, which calls the endpoint.Line 36: We call the
TickerDetails
function.
The details of the attributes found in the response object are given in the table below:
Response Fields
Name | Type | Description |
| Object | This contains details about tickers. |
| String | The ticker associated with the asset. |
| String | The name of the asset. |
| Enum | The market the asset belongs to. Possible output: |
| Enum | The location of the asset. Possible output: |
| String | The type of asset. |
| String | This is |
| Boolean | The name of the currency the asset is traded under. |
| String | The most recent close price of the asset multiplied by weighted outstanding shares. |
| String | The phone number of the ticker's company. |
| Object | The company's address. |
| String | The description of the company. |
| String | The standard industrial classification code for this ticker. |
| String | The description of the standard industrial classification code for this ticker. |
| String | The last date the asset was traded. |
| String | The primary root of the ticker. |
| String | The URL to the company's homepage. |
| The total number of employees in the ticker's company. | |
| String | The date (in the YYYY-MM-DD format) the ticker was made public. |
| Object | This includes the URLs to the company's logo and icon. |
| String | The response status to our query. |
| String | The ID associated with our query. |
The ticker news endpoint
While trading securities, keeping ourselves up-to-date with the news is crucial. The ticker news endpoint gives the latest news articles about tickers.
The base URL for this endpoint is as follows:
https://api.polygon.io/v2/reference/news
By default, the ticker news endpoint returns all available articles related to tickers in Polygon. However, we can provide some request parameters to filter our results.
The following table gives details about the available request parameters:
Request Parameters
Name | Type | Category | Description |
| String | Optional | The ticker whose details we want. |
| String | Optional | This fetches news articles published on the date specified in the format YYYY-MM-DD. |
| String | Optional | The field used to order the results. Accepted input: |
| String | Optional | This field orders the results based on the |
| Integer | Optional | This defines the number of news articles to return. By default, it is set to |
Note: Additional filters, such as,
.lt
(less than),.gt
(greater than),.lte
(less than equal to), and.gte
(greater than equal to), can be applied to theticker
andpublished_utc
fields.
Let’s call the ticker news endpoint in the following code:
// Importing libraries hereimport fetch from "node-fetch";// Define API key hereconst apiKey = '{{API_KEY}}';// Define endpoint URL hereconst endpointUrl = new URL('https://api.polygon.io/v2/reference/news');// Define Header Parameters hereconst headerParameters = {authorization: `Bearer ${apiKey}`,contentType: 'application/json',};// Setting API call optionsconst options = {method: 'GET',headers: headerParameters,};// Function to make API callasync function TickerNews() {try {const response = await fetch(endpointUrl, options);// Custom function for printing the API responseprintResponse(response);}catch (error) {// Custom function for printing the error messageprintError(error);}}// Calling function to make API callTickerNews();
Here’s an explanation for the above code:
Line 8: We define the endpoint URL.
Lines 23–34: We define the function
TickerNews
, which calls the endpoint.Line 37: We call the
TickerNews
function.
The following table details the attributes given in the response object.
Response Fields
Name | Type | Description |
| Object | This contains details about the news article, including a description, URL link, image URL, publisher information, author information, and so on. |
| String | The ID associated with the article. |
| Object | This contains information about the publisher of the news article. |
| String | The title of the news article. |
| String | The name of the author of this article. |
| String | The date the news article was published. |
| String | The URL of the news article. |
| Array | This includes all the tickers associated with the ticker. |
| String | The amp URL of the news article—used to access the article on a mobile device. |
| String | The URL of the image in the article. |
| String | This is a description of the news article. |
| Array | This contains the keywords associated with the news article. |
| Integer | The number of results returned. |
| String | The response status to our query. |
| String | The ID associated with our query. |
| String | If the news article spans multiple pages, this provides the URL of the next page. |