tvscreener¶
Python library to retrieve data from TradingView Screener
Features¶
- 6 Screener Types: Stock, Crypto, Forex, Bond, Futures, and Coin
- Pythonic Filtering: Use
>,<,>=,<=,==,!=operators directly on fields - 3,500+ Fields: Access all TradingView fields including fundamentals, technicals, and more
- Index Filtering: Filter by S&P 500, NASDAQ 100, Dow Jones, and 50+ other indices
- Multi-Timeframe: Use any technical indicator with different timeframes
- Real-time Streaming: Stream live data updates
- Styled Output: Beautiful formatted tables matching TradingView's style
Quick Example¶
from tvscreener import StockScreener, StockField, IndexSymbol
ss = StockScreener()
# Filter S&P 500 stocks
ss.set_index(IndexSymbol.SP500)
# Pythonic filtering
ss.where(StockField.PRICE > 50)
ss.where(StockField.PE_RATIO_TTM.between(10, 25))
ss.where(StockField.RELATIVE_STRENGTH_INDEX_14 < 40)
# Select fields
ss.select(
StockField.NAME,
StockField.PRICE,
StockField.CHANGE_PERCENT,
StockField.PE_RATIO_TTM,
StockField.RELATIVE_STRENGTH_INDEX_14
)
# Sort and limit
ss.sort_by(StockField.MARKET_CAPITALIZATION, ascending=False)
ss.set_range(0, 100)
df = ss.get()
Try the Code Generator¶
Build screener queries visually with our web app:
:material-rocket-launch: Launch Code Generator
Installation¶
Documentation¶
-
:material-clock-fast:{ .lg .middle } Quick Start
Get up and running in 5 minutes
-
:material-filter:{ .lg .middle } Filtering Guide
Complete reference for filtering stocks
-
:material-chart-line:{ .lg .middle } Stock Screening
Value, dividend, momentum strategies
-
:material-chart-timeline:{ .lg .middle } Technical Analysis
RSI, MACD, multi-timeframe screens
Why tvscreener?¶
| Feature | tvscreener | Others |
|---|---|---|
| Type-safe fields | StockField.PRICE |
"close" strings |
| Pythonic syntax | field > 100 |
SQL-like builders |
| Index filtering | set_index(SP500) |
Manual symbol lists |
| Field discovery | search("rsi") |
Read docs |
| All fields | select_all() |
List each one |
| Streaming | Built-in | DIY |
License¶
MIT License - See LICENSE for details.
Not affiliated with TradingView. This library accesses publicly available data from the TradingView website.