TradingView TA
raw JSON → 3.3.0 verified Sat May 09 auth: no python
Unofficial TradingView technical analysis API wrapper for Python. Provides buy/sell signals, indicator values, and symbol search. Current version 3.3.0, supports Python >=3.6. Release cadence irregular, focused on adding indicators and fixing TradingView algorithm changes.
pip install tradingview-ta Common errors
error AttributeError: 'NoneType' object has no attribute 'summary' ↓
cause get_analysis() returned None. This can happen if the symbol is invalid or network issue.
fix
Check symbol/exchange/screener validity. Add error handling: analysis = handler.get_analysis(); if analysis: print(analysis.summary)
error tradingview_ta.ta_handler.ExchangeNotFound ↓
cause Specified exchange name is not recognized (e.g., 'BINANCEUS' instead of 'BINANCE').
fix
Use valid exchange names from Exchange enum, e.g., Exchange.BINANCE, Exchange.NYSE.
error ModuleNotFoundError: No module named 'tradingview_ta' ↓
cause Package not installed or installed under a different name.
fix
Run 'pip install tradingview-ta' (note the underscore in import vs hyphen in package name).
Warnings
breaking Starting from v3.0.0, the interval parameter must be an Interval enum, not a string like '1h'. ↓
fix Use Interval.INTERVAL_1HOUR instead of '1h'.
breaking From v3.2.0, get_analysis() returns a dict-like object instead of a custom class with attributes directly. ↓
fix Access data via analysis.summary, analysis.indicators, analysis.time, analysis.ticker instead of analysis['summary'].
gotcha TradingView frequently changes its technical analysis algorithms, leading to inaccurate signals. The library updates indicators but may lag. ↓
fix Always verify signals with real chart; consider running in testing mode with a small amount.
gotcha The library is unofficial and rate-limits are not enforced by the library, but TradingView may block excessive requests. ↓
fix Implement your own rate limiting (e.g., 1 request per second). Use proxies if needed.
Imports
- TA_Handler wrong
from tradingview_ta.ta_handler import TA_Handlercorrectfrom tradingview_ta import TA_Handler - Interval
from tradingview_ta import Interval - Exchange
from tradingview_ta import Exchange
Quickstart
from tradingview_ta import TA_Handler, Interval, Exchange
# Example: Get analysis for BTCUSDT on Binance
handler = TA_Handler(
symbol="BTCUSDT",
screener="crypto",
exchange="BINANCE",
interval=Interval.INTERVAL_1HOUR,
)
analysis = handler.get_analysis()
print(analysis.summary)
print("RSI:", analysis.indicators["RSI"])