# TradingView Leaderboard Snapshot (`saffron_discussion/tradingview-leaderboard`) Actor

Snapshot market movers and leaderboards (stocks, crypto, forex, futures, ETFs) into a dataset for alerts and dashboards.

- **URL**: https://apify.com/saffron\_discussion/tradingview-leaderboard.md
- **Developed by:** [barry Alan](https://apify.com/saffron_discussion) (community)
- **Categories:** Developer tools, AI, Other
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.50 / 1,000 leaderboard rows

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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

## TradingView Leaderboard Snapshot

Capture a **market-movers / leaderboard** snapshot into a Dataset: top gainers, losers, and other ranked tabs across stocks, crypto, forex, futures, ETFs, bonds, and indices.

Built on [TradingView Data API](https://www.tradingviewapi.com) (`GET /api/leaderboard/{market}`). **Not** official TradingView. Each run is a **point-in-time snapshot** — schedule the Actor if you want recurring alerts.

### What you get

One leaderboard request per run, then **one Dataset row per ranked name**. Use it for:

- Daily “top gainers” Slack / email packs
- Dashboard tiles (price, change %, volume, market cap)
- A cheap alternative to a custom screener when you only need a named tab

`market` values: `stocks`, `crypto`, `forex`, `futures`, `etfs`, `indices`, `bonds`, `corporate-bonds`.

`tab` selects *which* board (gainers, losers, …). Default for stocks is `stocks_market_movers.gainers`. List valid tabs with:

`GET https://www.tradingviewapi.com/api/metadata/tabs?type=stocks`

(`type` is `stocks`, `indices`, `crypto`, `futures`, `currencies`, `bonds`, `corporate_bonds`, or `etfs`.)

Typical row fields: `rank`, `symbol`, `name`, `description`, `exchange`, `price`, `change`, `volume`, `marketcap`, `sector`, `analystrating`, plus `market`, `tab`, and `scrapedAt`.

### How to use

1. Pick `market` (default `stocks`).
2. Set `tab` if you need something other than default gainers.
3. Set `limit` (default 50, max **200**). This caps how many rows are written — it is configurable, not a hidden “5 rows only” cap.
4. Optionally pass `columnset` or `country` when the upstream tab needs them.
5. Run or schedule. Export JSON / CSV / Excel.

#### Example — US stock gainers

```json
{
  "market": "stocks",
  "tab": "stocks_market_movers.gainers",
  "limit": 30
}
```

### Input

| Field | Required | Description |
|-------|----------|-------------|
| `market` | yes | `stocks` | `crypto` | `forex` | `futures` | `etfs` | `indices` | `bonds` | `corporate-bonds` |
| `tab` | no | Tab id from metadata (default `stocks_market_movers.gainers`) |
| `limit` | no | Max rows to push (default 50, max 200) |
| `columnset` | no | Optional upstream column set |
| `country` | no | Optional country filter |

No user API key is required.

### Pricing (pay per event)

| Event | When |
|-------|------|
| `leaderboard-snapshot` | Once per run |
| `leaderboard-row` | Once per row pushed |

30 rows ⇒ 1× snapshot + 30× row events. Upstream may return more names than `limit`; extra names are discarded and not billed as rows.

### Limits and notes

- Snapshot only. Rankings move; schedule the Actor for a time series.
- Most markets need a valid `tab`. If a run is empty, check metadata tabs for that `type`.
- Not investment advice. Unofficial wrapper around [TradingView Data API](https://www.tradingviewapi.com).

### Related Actors

- [Screener Export](https://apify.com/saffron_discussion/tradingview-screener) — custom filters instead of a named tab
- [News & Calendar Digest](https://apify.com/saffron_discussion/tradingview-news-calendar)
- [Quote + TA Batch](https://apify.com/saffron_discussion/tradingview-quote-ta)
- [Fundamentals Card](https://apify.com/saffron_discussion/tradingview-fundamentals)

# Actor input Schema

## `market` (type: `string`):

Market

## `limit` (type: `integer`):

Limit

## `tab` (type: `string`):

Tab id from GET /api/metadata/tabs?type=... Default: stocks\_market\_movers.gainers

## `columnset` (type: `string`):

Columnset (optional)

## `country` (type: `string`):

Country (optional)

## `apiKey` (type: `string`):

API key override

## Actor input object example

```json
{
  "market": "stocks",
  "limit": 50,
  "tab": "stocks_market_movers.gainers"
}
```

# Actor output Schema

## `results` (type: `string`):

Default dataset with leaderboard rows.

# 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 = {
    "market": "stocks",
    "tab": "stocks_market_movers.gainers"
};

// Run the Actor and wait for it to finish
const run = await client.actor("saffron_discussion/tradingview-leaderboard").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 = {
    "market": "stocks",
    "tab": "stocks_market_movers.gainers",
}

# Run the Actor and wait for it to finish
run = client.actor("saffron_discussion/tradingview-leaderboard").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{
  "market": "stocks",
  "tab": "stocks_market_movers.gainers"
}' |
apify call saffron_discussion/tradingview-leaderboard --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,saffron_discussion/tradingview-leaderboard"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

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