Retrieves detailed sentiment analysis, message volume, and participation metrics for a given symbol across different timeframes.
Request Method | HTTP GET |
Accept | application/json |
URL |
https://api-gw-prd.stocktwits.com/api-middleware/external/sentiment/v2/{symbol}/chart |
Path Parameters |
symbol (required) - Stock symbol to get sentiment analysis for (e.g., AAPL, NIFTY50.NSE)
https://api-gw-prd.stocktwits.com/api-middleware/external/sentiment/v2/AAPL/chart |
Query Parameters |
zoom (required) - The granularity level for this symbol's charts
Allowed values:
https://api-gw-prd.stocktwits.com/api-middleware/external/sentiment/v2/AAPL/chart?zoom=1W |
Compression | Gzip. To connect to the stream using Gzip compression, simply send an Accept-Encoding header in the connection request. The header should look like the following:
Accept-Encoding: gzip |
Read Timeout | Set a read timeout on your client, and ensure that it is set to a value beyond 30 seconds. |
Authentication | Basic Authentication using username and password |
The following responses may be returned by the API for these requests. Most error codes are returned with a string with additional details in the body. For non-200 responses, clients should attempt to reconnect.
Status | Text | Description |
---|---|---|
200 | Success | Sentiment data successfully returned. |
401 | Unauthorized | HTTP authentication failed due to invalid credentials. Verify that your login combination matches this site, and that your user has the needed permissions. |
503 | Service Unavailable | Stocktwits server issue. Retry using an exponential backoff pattern. If no notice about this issue has been posted on this site under status, email support@stocktwits.com. |
The following example request is accomplished using cURL on the command line.
curl -u 'username':'password' -H"Accept: application/json" "https://api-gw-prd.stocktwits.com/api-middleware/external/sentiment/v2/AAPL/chart?zoom=1D"
If you are working on Windows, you may need to use double quotes instead of single quotes for the username and password.
curl -u "username":"password" -H"Accept: application/json" "https://api-gw-prd.stocktwits.com/api-middleware/external/sentiment/v2/AAPL/chart?zoom=1D"
The following example request is accomplished using a python script with the requests library.
''' This script uses the "requests" library to get sentiment data. It should be installed using pip before running this script. ''' import requests from requests.auth import HTTPBasicAuth username = "myusername" password = "mypassword" symbol = "AAPL" zoom = "1D" # Create a request to get sentiment data try: resp = requests.get( f"https://api-gw-prd.stocktwits.com/api-middleware/external/sentiment/v2/{symbol}/chart", params={"zoom": zoom}, auth=HTTPBasicAuth(username, password), headers={"Accept": "application/json"} ) except Exception as e: print(f"Error creating request: {e}") exit() # Check for errors on the response a HTTP status code of 200 is expected if resp.status_code != 200: print(f"Error response: {resp.status_code} {resp.reason}") exit() # Print the response data try: print(resp.json()) except Exception as e: print(f"Error reading response: {e}") exit()
The response object contains a "data" field a dictionary where the key is the date and the value is the data point.
Field | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
dateTime |
Contains the metrics for the given dateTime
|
sentimentNormalizedLabel |
Returns a string representing the normalized sentiment attitude or activity level of a given score.
Possible values:
|
messageVolumeNormalizedLabel |
Returns a string representing the normalized volume attitude or activity level of a given score.
Possible values:
|
{ "data": { "2025-04-29T13:30:00Z": { "dateTime": "2025-04-29T13:30:00Z", "messageVolumeNormalized": 31, "messageVolumeNormalizedLabel": "LOW", "sentimentNormalized": 65, "sentimentNormalizedLabel": "BULLISH" }, "2025-04-29T13:35:00Z": { "dateTime": "2025-04-29T13:35:00Z", "messageVolumeNormalized": 31, "messageVolumeNormalizedLabel": "LOW", "sentimentNormalized": 65, "sentimentNormalizedLabel": "BULLISH" } // Additional time series data points follow the same format } }