Additional Endpoints
Let's look at some other endpoints Polygon provides.
Ticker types endpoint
The ticker types endpoint can be used to get a list of all ticker types available for different securities on Polygon.
The base URL for the ticker endpoint is as follows:
https://api.polygon.io/v3/reference/tickers/types
Request parameters
By default, we get a list of all available ticker types. However, we can filter our search by providing some additional request parameters. An overview of the request parameters that can be provided to this endpoint is given in the table below:
Name | Type | Category | Description |
| String | Optional | The type of security whose ticker types we want. Accepted input: |
| String | Optional | This is used to filter our search by location. Accepted input: |
Let’s call this endpoint in the following code. Click the “Run” button to view the output of the ticker types 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/types');// Define Header Parameters hereconst headerParameters = {authorization: `Bearer ${apiKey}`};// Setting API call optionsconst options = {method: 'GET',headers: headerParameters,};// Function to make API callasync function TickerType() {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 callTickerType();
Here’s an explanation for the above code:
Line 8: We define the endpoint URL.
Line 22-32: We define the
TickerType
function, which calls the endpoint.Line 35: We call the
TickerType
function.
Response fields
The following table provides details of the attributes in the response object.
Name | Type | Description |
| Object | This contains details about tickers. |
| Integer | The number of results returned. |
| String | The response status to our query. |
| String | The ID associated with our query. |
Conditions endpoint
Conditions define the rules of buying and selling securities in any market. They are used as guidelines by traders to make important decisions. The conditions endpoint gives a list of conditions used by Polygon.
The base URL for this endpoint is as follows:
https://api.polygon.io/v3/reference/conditions
Request parameters
By default, the conditions endpoint returns a list of all conditions that Polygon uses. However, we can filter these results by providing some additional request parameters.
The following table gives details about possible request parameters:
Name | Type | Category | Description |
| String | Optional | The specific security we are looking for. Possible input parameters: |
| String | Optional | The type of data we are looking for. Possible input parameters: |
| Integer | Optional | The ID of a specific condition we are looking for. |
| String | Optional | Filter response based on securities information processors. Possible input parameters: |
| String | Optional | Order responses based on the Possible input parameters: |
| Integer | Optional | The number of results required. By default, the limit is |
| String | Optional | This sorts the results based on the given input. Possible input parameters: |
Let’s see the response to this query with its default parameters 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/conditions');// 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 Conditions() {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 callConditions();
Here’s an explanation for the above code:
Line 8: We define the endpoint URL.
Lines 23–32: We define the
Conditions
function, which calls the endpoint.Line 35: We call the
Conditions
function.
Response fields
The following table gives details about the attributes in the response object:
Name | Type | Description |
| Object | This includes details about each condition. |
| String | The response status to our query. |
| String | The ID associated with our query. |
| Integer | The number of results given in response. |
| String | The URL to the next page. |