A python module to scrape tradingview's technical analysis.
Project description
python-tradingview-ta
A python module to scrape tradingview's technical analysis.
Author: deathlyface
Features
Scrape analysis from TradingView, ex: from XLMBTC, to a list. Works by using selenium webdriver to scrape elements from tradingview's technical analysis widget.
Requirements
Installation
Using pip:
pip install tradingview_ta
Quickstart Example
from tradingview_ta import TA_Handler
xlmbtc = TA_Handler()
xlmbtc.pair = "xlmbtc"
xlmbtc.interval = "1m"
#xlmbtc.driver = "chrome"
#xlmbtc.headless = True
xlmbtc.start_driver()
analysis = xlmbtc.get_analysis()
print(analysis)
#Example output: ["Buy", 3, 10, 17]
Usage
Import module
from tradingview_ta import TA_Handler
Create an instance
ta_instance = TA_Handler()
It does not need to be ta_instance
. Name it whatever you want!
Set pair/ticker/symbol
ta_instance.symbol = "SYMBOL NAME"
Pair/Ticker/Symbol example: "btcusdt", "googl", "aapl", etc.
You may use the exchanger's name too, for example: "binance:btcusdt" or "nasdaq:aapl"
Set interval (default: 1 minute)
ta_instance.interval = "INTERVAL"
Available interval (case-sensitive):
- "1m" for 1 minute.
- "5m" for 5 minutes.
- "15m" for 15 minutes.
- "1h" for 1 hour.
- "4h" for 4 hours.
- "1D" for 1 day.
- "1W" for 1 week.
- "1M" for 1 month.
Set webdriver (default: chrome)
ta_instance.driver = "WEBDRIVER NAME"
Available webdriver: Chrome, Firefox, Safari, Edge. See selenium's documentation for webdriver installation.
Set headless (default: True)
ta_instance.headless = True/False
Headless means no GUI, so no browser tab will be opened.
Start webdriver
ta_instance.start_driver()
Start the previously setted up webdriver.
Get analysis
analysis = ta_instance.get_analysis()
The get_analysis()
function will return a list, containing the following value.
- The first index (string) shows the recommendation from TradingView, the value can contain "Buy", "Strong Buy", "Neutral", "Sell", or "Strong Sell".
- The second index (int) shows the number/count of Sell analysis
- The third index (int) shows the number/count of Neutral analysis
- The fourth index (int) shows the number/count of Buy analysis
Warning
Trading is a dangerous activity. Do not use tradingview's analysis to trade automatically without your supervision. I am not responsible for any financial loss.
Contributing
You can fork this repository or submit a pull request. Any pull request (documentation, bug fix, features, etc) are welcomed.
License
This package or software is available for free to all. You may share, edit, or do whatever you want. For more information please see the LICENSE file.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for tradingview_ta-2.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d8e8ddc746430e21c20df79a9e8c14208349e5447e3587d1608267cf3f2ec7b |
|
MD5 | 88026c112279ddb7808014cfea2a0a1e |
|
BLAKE2b-256 | 9a47dc0215d5f7db13982d417c0364db32467936151fce2570a5aae394be85fa |