Retrieves a compressed JSON file with the 5 minute sentiment data for all symbols for the day.
Request Method | HTTP GET |
Accept | application/json |
URL |
https://api-gw-prd.stocktwits.com/api-middleware/external/sentiment/v2/charts |
Query Parameters |
zoom (required) - The granularity level for the symbols charts
Allowed values:
https://api-gw-prd.stocktwits.com/api-middleware/external/sentiment/v2/charts?zoom=1D |
Compression | Gzip. The endpoint redirects to a gzipped file URL that gets automatically downloaded. File size = 15MB approximately. |
Read Timeout | Set a read timeout on your client, and ensure that it is set to a value beyond 30 seconds. |
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 |
---|---|---|
307 | Success | Redirect to sentiment data file. |
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 together with gzip for decompressing the file.
curl -u 'username':'password' -JL "https://api-gw-prd.stocktwits.com/api-middleware/external/sentiment/v2/charts?zoom=1D" | gzip -d > output.json
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" -JL "https://api-gw-prd.stocktwits.com/api-middleware/external/sentiment/v2/charts?zoom=1D" | gzip -d > output.json
The following example request is accomplished using a python script with the requests library.
''' This script uses the "urllib" library to get the sentiment data file. The "gzip" and "shutil" libraries are used to decompress the file. No pip installation is needed as these libraries are part of the standard library. ''' import urllib.request import base64 import gzip import shutil username = "myusername" password = "mypassword" credentials = f"{username}:{password}" encoded_credentials = base64.b64encode(credentials.encode("utf-8")).decode("utf-8") zoom = "1D" output_file = "output.json" url = f"https://api-gw-prd.stocktwits.com/api-middleware/external/sentiment/v2/charts?zoom={zoom}" # urllib handles redirects (including 307) automatically with urllib.request.urlopen(urllib.request.Request(url, headers={"Authorization": f"Basic {encoded_credentials}"})) as response: compressed_file = output_file + ".gz" with open(compressed_file, "wb") as f: shutil.copyfileobj(response, f) # Decompress with gzip.open(compressed_file, "rb") as f_in: with open(output_file, "wb") as f_out: shutil.copyfileobj(f_in, f_out) print(f"✅ File saved to {output_file}")
The response object contains a JSON object that's basically a dictionary where the key is the symbol and the value is another dictionary containing each 5 minute sentiment data point for the day, for that symbol.
Below we provide information about each symbol's JSON object format
Field | Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
data |
Contains a list of 5 minute sentiment data points for all symbols for the day with the format below. |
Field | Description |
---|---|
date |
Contains the ISO 8601 formatted timestamp representing the point in time for this data point |
sN |
Contains the sentiment normalized value. |
mN |
Contains the messages normalized value. |
pN |
Contains the participation ratio normalized value. |
now
Field | Description |
---|---|
date |
Contains the ISO 8601 formatted timestamp representing the point in time for this data point |
sN |
Contains the sentiment normalized value. |
mN |
Contains the messages normalized value. |
pN |
Contains the participation ratio normalized value. |
{ "AAPL":{ "data":[ { "date":"2025-09-10T13:05:00Z", "mN":0, "sN":50, "pN":0 }, { "date":"2025-09-10T13:10:00Z", "mN":0, "sN":50, "pN":0 }, { "date":"2025-09-10T13:15:00Z", "mN":0, "sN":50, "pN":0 } ], "now":{ "date":"2025-09-10T13:15:00Z", "mN":0, "sN":50, "pN":0 } } }