Capturing any Public Chart available in Tradingview
This tool has been developed to cater to the needs of the Unofficed community. Unofficed is a vibrant community of traders, developers, and enthusiasts passionate about financial markets and trading strategies.
Visit the Unofficed Community Chat to engage in discussions, share insights, and collaborate with fellow members. Join the community to explore a wealth of knowledge and resources related to trading and financial markets.
This Python script automates the process of capturing screenshots from TradingView charts and converting TradingView chart links into direct image URLs for sharing. It's a useful tool for traders and analysts who want to streamline the process of capturing and sharing TradingView chart images.
#Setup
- Access your chart settings on TradingView.
- Change the sharing settings for your chart to "Public."
- Copy the chart's public link.
- Paste the copied chart link inside the tview_ss.py.py script.
Before using this script, ensure you have the following prerequisites installed:
- Python (3.x recommended)
- Selenium library
- Chrome WebDriver
- xclip (for Linux systems)
You can install Python packages using pip:
pip install seleniumTo download Chrome WebDriver, visit ChromeDriver Downloads.
To install xclip, you can use the package manager specific to your Linux distribution. Ubuntu/Debian:
sudo apt-get update
sudo apt-get install xclipUsage Clone this repository to your local machine:
git clone https://github.com/your-username/tradingview-screenshot-capture.gitNavigate to the project directory:
cd tradingview-screenshot-captureRun the script, providing the desired TradingView symbol as an argument (default is "NONE"):
python capture_tradingview_screenshot.pyWait for the script to execute. It will capture the TradingView chart screenshot and provide you with a direct image URL.
You can also check the locally saved screenshot as "m7azfyek.png" in the main directory.
Example Output
Chart is ready for capture
https://www.tradingview.com/x/m7azfyek/
Chart Link: https://s3.tradingview.com/snapshots/m/m7azfyek.pngLicense This project is licensed under the MIT License. See the LICENSE file for details.
Acknowledgments This script uses Selenium to automate web interactions with TradingView. Special thanks to the TradingView platform for providing valuable financial charting tools.
There is another version of the program which is saved as tview_tkinter.py. It uses tkinter instead of xclip.
Unfortunately, both of the methods do not work using the Chrome headless version.
A third version of the script, tview_headless.py, has been added. This version is specifically designed to work with a headless Chrome browser, allowing screenshots to be captured without opening a visible browser window. This is useful for server-side execution or automated workflows.

