# TradingView Stock / Crypto / CFD Scraper (`mscraper/tradingview-stock-scraper`) Actor

Extract information such as stock prices, trends, and news from the charting platform TradingView. Export the accumulated data to HTML, JSON, CSV, Excel, XML, or RSS and use it for further research.

- **URL**: https://apify.com/mscraper/tradingview-stock-scraper.md
- **Developed by:** [mscraper](https://apify.com/mscraper) (community)
- **Categories:** Other
- **Stats:** 125 total users, 3 monthly users, 100.0% runs succeeded, 26 bookmarks
- **User rating**: No ratings yet

## Pricing

$15.00/month + usage

To use this Actor, you pay a monthly rental fee to the developer. The rent is subtracted from your prepaid usage every month. You also pay for the Apify platform usage, which gets cheaper the higher Apify subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#rental-actors

## 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 Stock Scraper

### What does TradingView Stock Scraper do?

TradingView Stock Scraper is a specialized web scraping tool designed to extract crucial information about stock prices, trends, and news from the charting platform [TradingView](https://www.tradingview.com/screener/). It focuses on the overview of the US market with a 1-day time interval. Currently, it does not support other markets or different time intervals. The scraper exports the accumulated data to various formats like JSON, XML, CSV, or Excel.

### Why scrape TradingView?

Scraping data from TradingView can be beneficial for several business use cases:

➡️ **Market Analysis**: Gather real-time and historical data on stocks, monitor market trends, and make informed investment decisions.

➡️ **Competitor Analysis**: Keep an eye on the financial performance and market position of your competitors, and adjust your business strategies accordingly.

➡️ **Risk Management**: Monitor market volatility and trends to manage risk effectively.

➡️ **Data Journalism**: Use the scraped data to create stories and articles that are backed by accurate and up-to-date financial data.

➡️ **Academic Research**: Use the data for academic and financial research purposes.

### How to scrape TradingView?

Using TradingView Stock Scraper is a breeze. Just add your proxy configuration options in the input field, and click start. The scraper will do the rest, pulling all the relevant data from the platform.

### How much will it cost to scrape TradingView?

Apify gives you $5 free usage credits every month on the [Apify Free plan](https://apify.com/pricing). You can get up to 100,000 results per month from TradingView Scraper for that, so those 100,000 results will be completely free.

But if you need to get more data regularly from TradingView, you should grab an Apify subscription. We recommend our [$49/month Starter plan](https://apify.com/pricing) - you can get up to 1,000,000 every month with the $49 monthly plan!

Or get 10,000,000 results for $499 with the [Scale plan](https://apify.com/pricing) - wow!

### Input

TradingView Stock Scraper has the following input options. Click on the [input tab](https://apify.com/mscraper/tradingview-stock-scraper/input-schema) for more information.

### Custom Filters

You can filter results directly on the server side (before they are downloaded) using **Custom Filters**. This allows you to scrape only symbols that match specific criteria (e.g., "Rate of Change > 10").

#### IMPORTANT: Field Mapping

Filters must use the **TradingView Field Name**, which often differs from the **Output Key** in your JSON results.
For example, to filter by Rate of Change, you must use `ROC` (the TradingView field), even though the output JSON key is `rate_of_change`.

| TradingView Filter Field (`left`) | Output JSON Key           | Description        |
| :-------------------------------- | :------------------------ | :----------------- |
| `ROC`                             | `rate_of_change`          | Rate of Change     |
| `close`                           | `price`                   | Current Price      |
| `volume`                          | `volume`                  | Volume             |
| `market_cap_basic`                | `marketCapitalization`    | Market Cap         |
| `price_earnings_ttm`              | `priceToEarningsRatio`    | P/E Ratio          |
| `earnings_per_share_diluted_ttm`  | `earningsPerShareDiluted` | EPS (Diluted)      |
| `earnings_release_next_date`      | `earningsReleaseNextDate` | Next Earnings Date |
| `name`                            | `ticker`                  | Symbol Ticker      |

#### Available Operations

- `less`, `less_or_equal`
- `greater`, `greater_or_equal`
- `equal`, `nequal` (not equal)

#### Example Configuration

To scrape only symbols where **Rate of Change is 18 or less**:

```json
"customFilters": [
    {
        "left": "ROC",
        "operation": "less_or_equal",
        "right": "18"
    }
]
```

> **Note**: The `right` value is defined as a string for compatibility, but numeric strings (e.g. `"18"`) are automatically converted to numbers before filtering. Boolean strings (`"true"`, `"false"`) are also supported.

### Results

![Apify  -  TradingView Stock Scraper  output](https://i.imgur.com/LzWRZ2J.png)

```json
{
    "url": "https://www.tradingview.com/symbols/NASDAQ-MSFT",
    "symbol": "NASDAQ:MSFT",
    "logoUrl": "https://s3-symbol-logo.tradingview.com/microsoft.svg",
    "ticker": "MSFT",
    "description": "Microsoft Corporation",
    "price": "312.48 USD",
    "change": "0.24%",
    "volume": "8.964M",
    "volumeChange": "-66.47%",
    "marketCapitalization": "2.323T USD",
    "priceToEarningsRatio": "33.87",
    "earningsPerShareDiluted": "9.23 USD",
    "sector": "Technology Services",
    "news": [
        {
            "url": "https://www.tradingview.com/news/barchart:9419603cb094b:0-bump-up-your-long-term-portfolio-performance-with-low-beta-stocks/",
            "title": "Bump up Your Long Term Portfolio Performance With Low Beta Stocks",
            "published": "May 17, 2023 · 02:01 PM"
        }
    ]
}
```

### Is it legal to scrape TradingView?

Note that personal data is protected by GDPR in the European Union and by other regulations around the world.
You should not scrape personal data unless you have a legitimate reason to do so.
If you're unsure whether your reason is legitimate, consult your lawyers.
We also recommend that you read our blog post: [is web scraping legal?](https://blog.apify.com/is-web-scraping-legal/).

### Contact

Please feel free to browse through the diverse array of web scrapers available on [my Apify profile](https://apify.com/mscraper). If a custom solution or extra options are what you're seeking, don't hesitate to get in touch with me directly at <contact@mscraper.com>.

# Actor input Schema

## `symbols` (type: `array`):

Symbols to scrape (e.g., 'AAPL', 'BTCUSD', 'TVC:GOLD'). The scraper automatically detects the market (America, Crypto, CFD) for each symbol.

## `exchange` (type: `string`):

Optional fallback exchange (e.g. 'BINANCE') used ONLY if a symbol is not found in the global smart lists. Leave empty for mixed inputs.

## `customFilters` (type: `array`):

Custom filters to apply to the scanner (e.g. ROC > 10). 'Left' must be a valid TradingView field.

## `proxy` (type: `object`):

Select proxies to be used by your crawler.

## `scrapeNewsHeadlines` (type: `boolean`):

If checked then actor will scrape news headlines for each symbol.

## Actor input object example

```json
{
  "symbols": [
    "AAPL",
    "BTCUSD",
    "TVC:GOLD"
  ],
  "proxy": {
    "useApifyProxy": true,
    "apifyProxyCountry": "US"
  },
  "scrapeNewsHeadlines": false
}
```

# 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 = {
    "symbols": [
        "AAPL",
        "BTCUSD",
        "TVC:GOLD"
    ],
    "proxy": {
        "useApifyProxy": true,
        "apifyProxyCountry": "US"
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("mscraper/tradingview-stock-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 = {
    "symbols": [
        "AAPL",
        "BTCUSD",
        "TVC:GOLD",
    ],
    "proxy": {
        "useApifyProxy": True,
        "apifyProxyCountry": "US",
    },
}

# Run the Actor and wait for it to finish
run = client.actor("mscraper/tradingview-stock-scraper").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 '{
  "symbols": [
    "AAPL",
    "BTCUSD",
    "TVC:GOLD"
  ],
  "proxy": {
    "useApifyProxy": true,
    "apifyProxyCountry": "US"
  }
}' |
apify call mscraper/tradingview-stock-scraper --silent --output-dataset

```

## MCP server setup

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

```

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/hOfycUMuUpaFZvG7a/builds/VSfkEgrN4gfjkv00z/openapi.json
