# Use Stocktwits Trending API

**Use case:** 

Use Stocktwits Trending API to collect up to 30 current trending messages. Include posts with any trader sentiment, with or without a price target.

## Input

```json
{
  "mode": "trending",
  "symbols": [
    "AAPL",
    "TSLA",
    "NVDA",
    "SPY",
    "MSTR"
  ],
  "usernames": [],
  "maxMessagesPerTarget": 30,
  "sentiment": "all",
  "onlyPriceTargets": false,
  "includeAuthorReceivedLikes": false,
  "authorPostsForReceivedLikes": 30
}
```

## Output

```json
{
  "recordType": {
    "label": "Result type",
    "format": "string"
  },
  "messageId": {
    "label": "Message ID",
    "format": "integer"
  },
  "matchedInput": {
    "label": "Matched input",
    "format": "string"
  },
  "body": {
    "label": "Body",
    "format": "string"
  },
  "createdAt": {
    "label": "Created at",
    "format": "string"
  },
  "sourceSentiment": {
    "label": "Source sentiment",
    "format": "string"
  },
  "likes": {
    "label": "Likes",
    "format": "integer"
  },
  "rank": {
    "label": "Rank",
    "format": "integer"
  },
  "symbol": {
    "label": "Symbol",
    "format": "string"
  },
  "title": {
    "label": "Title",
    "format": "string"
  },
  "exchange": {
    "label": "Exchange",
    "format": "string"
  },
  "watchlistCount": {
    "label": "Watchlist count",
    "format": "integer"
  },
  "trendScore": {
    "label": "Trend score",
    "format": "number"
  }
}
```

## How it works

### 1. Sign up on Apify or log in

The Stocktwits Scraper Actor is ready to run with the inputs already set for "Use Stocktwits Trending API". [Sign up or log in](https://console.apify.com/create-task-from-example/QGfmmtCEU0YrcVb67) and you'll land in Apify Console with a copy of this exact task.

### 2. Start the "Use Stocktwits Trending API" task

The Stocktwits Scraper Actor will start running based on the input automatically. You can also change all the input fields, like result type, ticker symbols, and more, to match your specific use case.

### 3. Receive the "Use Stocktwits Trending API" output

Monitor the progress in real time. You will be notified as soon as your dataset is complete and ready for review. Each result includes data such as result type, message id, matched input, and more.

### 4. Integrate into your workflow

The final output is delivered in JSON, CSV, or Excel format, ready to be plugged into your workflow. You can also [run the "Use Stocktwits Trending API" task via API](https://apify.com/maximedupre/stocktwits-scraper.md).

## FAQ

### What does the Stocktwits Trending API task return?

The Use Stocktwits Trending API task returns up to 30 public Stocktwits messages for the trending feed. Each row can hold the message ID, text, date, author, likes, cashtags, and the author's sentiment label.

### Can I filter the Stocktwits Trending API task by bullish or bearish sentiment?

The Use Stocktwits Trending API task can keep only messages that the author marked Bullish or Bearish. Set sentiment to bullish or bearish. The value all keeps every message.

### Can the Stocktwits Trending API task return only posts with a price target?

The Use Stocktwits Trending API task returns only posts with a price target when you turn on onlyPriceTargets. Leave it off to get posts with or without a price target.

### Can the Stocktwits Trending API task collect older Stocktwits messages?

The Use Stocktwits Trending API task can collect older messages with olderThanMessageId. It saves only messages with a lower ID. Use newerThanMessageId to get only messages that are newer than an ID.

### How do I change the message limit in the Stocktwits Trending API task?

The Use Stocktwits Trending API task uses maxMessagesPerTarget, now set to 30. Change it to read more or fewer messages. Set 0 to read until the public feed has no more messages.

### How much does the Stocktwits Trending API task cost?

The Use Stocktwits Trending API task charges once for each row saved to the dataset: $0.00045 on the Apify Free plan and $0.00005 on paid plans. Author like counts cost extra and are off by default.

### Can I run the Stocktwits Trending API task from the Apify API?

The Use Stocktwits Trending API task can run from the Apify API. Start the task with your Apify token, then read the results from its dataset as JSON.

### Can I use the Stocktwits Trending API task with Python?

The Use Stocktwits Trending API task works with the Apify Python client. Call the task by its ID, wait for the run, and then read the dataset items in your Python code.

### Can I schedule the Stocktwits Trending API task to run on its own?

The Use Stocktwits Trending API task can run on an Apify schedule, such as every hour or every day. Each run saves a new dataset.

### Which file formats can I download from the Stocktwits Trending API task?

The Use Stocktwits Trending API task saves rows to an Apify dataset. You can download it as JSON, CSV, Excel, XML, or HTML.

## About this Actor

This example demonstrates how to use [Stocktwits Scraper](https://apify.com/maximedupre/stocktwits-scraper.md) with a specific input configuration. Visit the [Actor detail page](https://apify.com/maximedupre/stocktwits-scraper.md) to learn more, explore other use cases, and run it yourself.


## How to integrate an Actor?

This Task's input is already configured above. Use it as-is rather than inventing a new one.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For full API examples (JavaScript, Python, CLI, MCP, OpenAPI), see this Task's Actor page: https://apify.com/maximedupre/stocktwits-scraper.md

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).
