TradingView API Python Client
Extract TradingView data with our TradingView API Python client. Get programmatic access to volume data, earnings per share, market capitalization, sector information, stock prices, price-to-earnings ratio, market trends, and more using simple Python code. Start free, no credit card required.

Trusted by industry leaders all over the world
Integrate our TradingView API
The Apify API client for Python is the official library that allows you to use TradingView API in Python, providing convenience functions and automatic retries on errors. Get started with simple pip installation and robust error handling built-in.
Python
JavaScript
HTTP
MCP
1from apify_client import ApifyClient2
3# Initialize the ApifyClient with your Apify API token4# Replace '<YOUR_API_TOKEN>' with your token.5client = ApifyClient("<YOUR_API_TOKEN>")6
7# Prepare the Actor input8run_input = {9 "symbols": [10 "NASDAQ:MSFT",11 "NASDAQ:GOOGL",12 "NASDAQ:AMZN",13 ],14 "proxy": {15 "useApifyProxy": True,16 "apifyProxyCountry": "US",17 },18}19
20# Run the Actor and wait for it to finish21run = client.actor("mscraper/tradingview-stock-scraper").call(run_input=run_input)22
23# Fetch and print Actor results from the run's dataset (if there are any)24print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])25for item in client.dataset(run["defaultDatasetId"]).iterate_items():26 print(item)27
28# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start
Get data with TradingView API Python client
Use our Python API client to extract TradingView stock data by providing proxy configuration options. The API returns structured data, including stock prices, ticker symbols, company descriptions, volume data, market capitalization, price-to-earnings ratios, earnings per share, sector classifications, and related news articles.
Input
{ "proxy": { "useApifyProxy": true, "apifyProxyCountry": "US" }, "symbols": [ "NASDAQ:MSFT", "NASDAQ:GOOGL", "NASDAQ:AMZN" ], "scrapeNewsHeadlines": false}
Output
{ "url": "<https://www.tradingview.com/symbols/NASDAQ-MSFT>", "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" } ], "price": "312.48 USD", "change": "0.24%", "sector": "Technology Services", "symbol": "NASDAQ:MSFT", "ticker": "MSFT", "volume": "8.964M", "logoUrl": "<https://s3-symbol-logo.tradingview.com/microsoft.svg>", "description": "Microsoft Corporation", "volumeChange": "-66.47%", "marketCapitalization": "2.323T USD", "priceToEarningsRatio": "33.87", "earningsPerShareDiluted": "9.23 USD"}
Sign up for Apify account01
Creating an account is quick and free — no credit card required. Your account gives you access to more than 5,000 scrapers and APIs.
Install Apify Python client02
Install the Apify Python client using pip: pip install apify-client. This package provides a simple interface to interact with TradingView API from your Python applications.
Get your Apify API token03
Go to settings in the Apify console and navigate to the “API & Integrations” tab. There, create a new token and save it for later.
Integrate TradingView API04
Navigate to the TradingView API page and click on the API dropdown menu in the top right corner. In the dropdown menu, you can see API clients, API endpoints, and more. Use the provided Python code examples to integrate TradingView API into your Python application.
Get your TradingView data via API05
The TradingView API returns structured JSON data that works perfectly with pandas, NumPy, and other Python data analysis libraries.

Why use Apify?
Never get blocked
Every plan (free included) comes with Apify Proxy, which is great for avoiding blocking and giving you access to geo-specific content.
Customers love us
We truly care about the satisfaction of our users and thanks to that we're one of the best-rated data extraction platforms on both G2 and Capterra.
Monitor your runs
With our latest monitoring features, you always have immediate access to valuable insights on the status of your web scraping tasks.
Export to various formats
Your datasets can be exported to any format that suits your data workflow, including Excel, CSV, JSON, XML, HTML table, JSONL, and RSS.
Integrate Apify to your workflow
You can integrate your Apify runs with platforms such as Zapier, Make, Keboola, Google Drive, or GitHub. Connect with practically any cloud service or web app.
Large developer community
Apify is built by developers, so you'll be in good hands if you have any technical questions. Our Discord server is always here to help!
Python-ready TradingView data extraction
Connect to hundreds of apps right away using ready-made integrations, or set up your own with webhooks and our API.
No, TradingView does not provide an official Python API client for accessing stock data programmatically. TradingView primarily operates as a charting platform without offering a public Python API client to access their stock information. This Python API client serves as an alternative solution to extract the data you need from their platform, focusing specifically on US market data with 1-day intervals.
Yes, you can try the TradingView Python API client for free! Apify provides $5 in free usage credits every month on the Free plan, which allows you to extract up to 100,000 results from TradingView completely free using the Python API client. This gives you plenty of opportunity to test the Python API client and see if it meets your data extraction needs before upgrading to a paid plan.
The Python TradingView API client retrieves comprehensive stock information including stock prices, ticker symbols (like NASDAQ:MSFT), company descriptions, price changes and percentages, trading volume and volume changes, market capitalization, price-to-earnings ratios, earnings per share, sector classifications (like Technology Services), company logos, and related news articles with publication dates. All data is returned in structured JSON format and can also be converted to CSV, Excel, XML, or RSS formats.
Yes, it is generally legal to use Python API clients to access publicly available financial data from TradingView for legitimate business purposes such as market analysis, research, or investment decisions. However, when implementing Python scripts for data collection, you should be mindful of personal data protection regulations like GDPR and ensure you have legitimate reasons for data collection. We recommend consulting with legal professionals if you're unsure about your specific Python-based scraping implementation and reading our comprehensive guide on web scraping legality.
Getting started with our TradingView Python API is easy — simply create a free Apify account, get your API token, and start using the TradingView API in Python, JavaScript, CLI, cURL, OpenAPI, or MCP.