GET /sentiment [DEPRECATED] 

Establishes a persistent connection to the Firehose sentiment stream, through which the realtime data will be delivered.


Request Specifications

Request Method HTTP GET
Accept text/event-stream

This should be specified in the header of the request.
URL Found on the stream's API Help page of your dashboard, using the following structure:

https://firestream.stocktwits.com/sentiment
Params The last streamed item received can be specified, the stream will attempt to continue from that point (if the item was sent in the past 24 hours).

https://firestream.stocktwits.com/sentiment?seq_id=49562553817515093231064627491680393519832340977378394114
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.

Responses

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 The connection was successfully opened, and new activities will be sent through as they arrive.
401 Unauthorized HTTP authentication failed due to invalid credentials. Verify that your login combination matches this sites.
406 Not Acceptable Generally, this occurs where your client fails to properly include the headers to accept gzip encoding from the stream, but can occur in other circumstances as well.

Will contain a JSON message similar to "This connection requires compression. To enable compression, send an 'Accept-Encoding: gzip' header in your request and be ready to uncompress the stream as it is read on the client end."
503 Service Unavailable stocktwits server issue. Reconnect using an exponential backoff pattern. If no notice about this issue has been posted on this site under status, email support@stocktwits.com.

Example curl Request

The following example request is accomplished using cURL on the command line.

curl --no-buffer -u 'username':'password' -H"Accept: text/event-stream" "https://firestream.stocktwits.com/sentiment"

Sentiment Data Format 

message_id

A unique ID for the message.

"message_id" : 5556662

seq_id

Sequence Id used to identify the streams position. Can be used for recovery for up to 24 hours. (Not present in backups)

"seq_id" : "49567487888076093524624994048752032346222860024699420674"

created_at

Timestamp of the message creation.

"created_at" : "2017-02-01T19:19:18Z"

user_id

A unique ID for the user.

"user_id" : 5556662

sentiment_score

The sentiment score for this message.

  • A very bearish message will have a score of -1
  • A neutral message will have a score of 0
  • A slightly bearish message will be -0.25, and inversely, a slightly bullish message will be 0.25.
"sentiment_score" : 0.854

symbols

A JSON list of stocks mentioned in the message.
Show Sub-field Details

Property Description
id A unique stock id.

"id" : 686
symbol The stock symbol,

"symbol" : "ABC"
title The stocks company title.

"title" : "Alpha Bravo Charlie, inc."
exchange The exchange this stock is found on.

"exchange" : "NASDAQ"
sector The stocks company sector.

"sector" : "Technology"
industry The stocks company industry.

"industry" : "Personal Computers"
"symbols": [{
    "id": 686,
    "symbol": "ABC",
    "title": "Alpha Bravo Charlie, inc.",
    "exchange": "NASDAQ",
    "sector": "Technology",
    "industry": "Personal Computers"
}],

Sample Payload 

{
  "message_id": 5556662,
  "seq_id" : "49567487888076093524624994048752032346222860024699420674",
  "created_at" : "2017-02-01T19:19:18Z",
  "user_id": 222222,
  "sentiment_score": 0.854,
  "symbols": [{
    "id": 686,
    "symbol": "ABC",
    "title": "Alpha Bravo Charlie, inc.",
    "exchange": "NASDAQ",
    "sector": "Technology",
    "industry": "Personal Computers"
  }]
}