# StockTwits Scraper (`crawlerbros/stocktwits-scraper`) Actor

Scrape StockTwits - the social network for investors and traders. Get live message streams for any stock/crypto ticker, bullish/bearish sentiment, trending symbols, user timelines, and symbol search results. No login required.

- **URL**: https://apify.com/crawlerbros/stocktwits-scraper.md
- **Developed by:** [Crawler Bros](https://apify.com/crawlerbros) (community)
- **Categories:** Social media, Automation, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## StockTwits Scraper

Scrape [StockTwits](https://stocktwits.com) — the social network for investors and traders. Pull the live message stream for any stock or crypto ticker, bullish/bearish sentiment tags, trending symbols, market-wide trending messages, a user's post history, and ticker search results. No login, no API key, no cookies required.

### What this actor does

- **Five modes:** `symbolMessages`, `userMessages`, `trendingSymbols`, `trendingMessages`, `symbolSearch`
- **Sentiment tags:** captures each message's Bullish/Bearish self-tag when the author set one
- **Sentiment filter:** keep only Bullish, only Bearish, only tagged messages, or everything
- **Stream sort:** newest-first ("All") or StockTwits' algorithmically ranked "Top" messages
- **Trending data:** market-wide trending tickers (all asset classes or equities-only) with sector/industry and a trend summary
- **Engagement metrics:** like counts, reshare counts, follower counts
- **Empty fields are omitted**

### Output fields

#### Message records (`recordType: "message"`)

- `messageId`, `body`, `createdAt`
- `isDiscussion` — StockTwits' own flag for whether the post is part of a threaded discussion
- `sentiment` — `Bullish` or `Bearish`, only present if the author tagged one
- `symbol`, `symbols[]` — cashtags mentioned in the post
- `priceAtPost` — the ticker's price at the moment of posting, when StockTwits attached one
- `username`, `userDisplayName`, `userFollowers`, `userOfficial`, `userAvatarUrl`
- `likeCount`, `reshareCount`
- `source` — the posting client (web, iOS, Android, API, etc.)
- `mediaUrls[]` — attached chart/image URLs
- `stocktwitsUrl`, `stocktwitsUserUrl`

#### Symbol records (`recordType: "symbol"`)

- `symbol`, `symbolDisplay`, `title`, `exchange`, `region`
- `sector`, `industry`, `instrumentClass`
- `watchlistCount`, `isTrending`, `trendingScore`, `rank`
- `trendSummary` — StockTwits' AI-generated summary of why the ticker is trending
- `logoUrl`, `stocktwitsUrl`

### Input

| Field | Type | Default | Description |
|---|---|---|---|
| `mode` | select | `symbolMessages` | `symbolMessages` / `userMessages` / `trendingSymbols` / `trendingMessages` / `symbolSearch` |
| `symbol` | string | `AAPL` | Ticker for `symbolMessages` |
| `username` | string | – | StockTwits username for `userMessages` |
| `searchQuery` | string | – | Free-text query for `symbolSearch` |
| `streamFilter` | select | `all` | `all` (newest) or `top` (ranked) — `symbolMessages` only |
| `sentimentFilter` | select | `any` | `any` / `bullish` / `bearish` / `tagged` |
| `trendingCategory` | select | `all` | `all` or `equities` — `trendingSymbols` only |
| `maxItems` | integer | `30` | Hard cap on emitted records (1–1000) |

#### Example: latest AAPL sentiment stream

```json
{
  "mode": "symbolMessages",
  "symbol": "AAPL",
  "streamFilter": "all",
  "sentimentFilter": "tagged",
  "maxItems": 50
}
```

#### Example: top bullish GME messages

```json
{
  "mode": "symbolMessages",
  "symbol": "GME",
  "streamFilter": "top",
  "sentimentFilter": "bullish",
  "maxItems": 30
}
```

#### Example: today's trending equities

```json
{
  "mode": "trendingSymbols",
  "trendingCategory": "equities",
  "maxItems": 30
}
```

#### Example: search for a ticker

```json
{
  "mode": "symbolSearch",
  "searchQuery": "tesla",
  "maxItems": 20
}
```

### Use cases

- **Retail sentiment tracking** — measure bullish/bearish chatter volume for a ticker over time
- **Meme-stock monitoring** — watch trending symbols and their AI trend summaries in real time
- **Social trading research** — analyze influential traders' post history and engagement
- **Market-wide pulse checks** — sample the trending message stream across all tickers
- **Ticker discovery** — resolve company names to tradable symbols

### FAQ

**Do I need a StockTwits account or API key?** No. This actor uses StockTwits' public JSON endpoints, the same ones the stocktwits.com website itself calls.

**What does the `sentiment` field mean?** StockTwits lets authors optionally tag a post "Bullish" or "Bearish" when posting. Most messages have no tag — those are omitted from the field entirely rather than shown as a null/neutral value.

**What's the difference between `all` and `top` stream sort?** `all` returns the newest messages first (a live firehose). `top` returns StockTwits' algorithmic ranking, which favors messages with more engagement.

**Why do some `symbol` search results not look related to my query?** StockTwits search matches on ticker symbol and company name; a query like "elon" surfaces both car-company mentions and unrelated tickers whose name/ticker string contains the term.

**How far back does `symbolMessages` / `userMessages` go?** The actor pages backward through the cursor until `maxItems` is reached or StockTwits reports no more pages — there is no fixed lookback window, it depends on how much history StockTwits keeps queryable for that symbol/user.

**Is pricing data (`priceAtPost`) always present?** Only when StockTwits attached a live price snapshot to that specific post at the time it was made; historical messages or illiquid tickers often lack it.

**Why does `curl`/`wget` return 403 on `stocktwitsUrl` / `stocktwitsUserUrl` / `userAvatarUrl`?** stocktwits.com sits entirely behind a Cloudflare bot-challenge that blocks plain HTTP clients on every page (including the homepage itself), independent of this actor. The links are valid and open normally in any real web browser — this is a site-wide anti-bot characteristic, not a broken link.

# Actor input Schema

## `mode` (type: `string`):

What to fetch from StockTwits.

## `symbol` (type: `string`):

Ticker symbol to fetch the message stream for, e.g. `AAPL`, `TSLA`, `BTC.X`.

## `username` (type: `string`):

StockTwits username (without the @), e.g. `dschn`.

## `searchQuery` (type: `string`):

Free-text query to search for tickers/companies, e.g. `apple`, `tesla`.

## `streamFilter` (type: `string`):

`All` returns the newest messages; `Top` returns StockTwits' algorithmically ranked top messages for the symbol.

## `sentimentFilter` (type: `string`):

Only keep messages tagged with this sentiment. `Any` keeps all messages regardless of whether a sentiment tag is present.

## `trendingCategory` (type: `string`):

Which trending list to fetch.

## `maxItems` (type: `integer`):

Hard cap on emitted records.

## Actor input object example

```json
{
  "mode": "symbolMessages",
  "symbol": "AAPL",
  "streamFilter": "all",
  "sentimentFilter": "any",
  "trendingCategory": "all",
  "maxItems": 30
}
```

# Actor output Schema

## `records` (type: `string`):

Dataset containing all scraped StockTwits records.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "mode": "symbolMessages",
    "symbol": "AAPL",
    "streamFilter": "all",
    "sentimentFilter": "any",
    "trendingCategory": "all",
    "maxItems": 30
};

// Run the Actor and wait for it to finish
const run = await client.actor("crawlerbros/stocktwits-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "mode": "symbolMessages",
    "symbol": "AAPL",
    "streamFilter": "all",
    "sentimentFilter": "any",
    "trendingCategory": "all",
    "maxItems": 30,
}

# Run the Actor and wait for it to finish
run = client.actor("crawlerbros/stocktwits-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "mode": "symbolMessages",
  "symbol": "AAPL",
  "streamFilter": "all",
  "sentimentFilter": "any",
  "trendingCategory": "all",
  "maxItems": 30
}' |
apify call crawlerbros/stocktwits-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=crawlerbros/stocktwits-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/crY2YVlyVekuU4tBz/builds/f8re7wQDfmuhY6Pk3/openapi.json
