TradingView Screener API
Project description
TradingView Screener API
Python library to retrieve data from TradingView Screener.
Main Features
- Query Stock, Forex and Crypto Screener
- All the fields available (~250 fields)
- Any time interval (no need to be a registered user)
- Filters by any fields, symbols, markets, countries, etc.
- Get the results as a Pandas Dataframe
Installation
The source code is currently hosted on GitHub at: https://github.com/houseofai/tvscreener
Binary installers for the latest released version are available at the Python Package Index (PyPI)
# or PyPI
pip install tvscreener
From pip + GitHub:
$ pip install git+https://github.com/houseofai/tradingview-screener@main
Usage
For Stocks screener:
import tvscreener as tvs
ss = tvs.StockScreener()
df = ss.get()
# ... returns a dataframe with 150 rows by default
For Forex screener:
import tvscreener as tvs
fs = tvs.ForexScreener()
df = fs.get()
For Crypto screener:
import tvscreener as tvs
cs = tvs.CryptoScreener()
df = cs.get()
Options
Range
By default, it gets the 150 first results. You can change this by setting the range
option:
import tvscreener as tvs
ss = tvs.StockScreener()
ss.set_range(0, 10000)
df = ss.get()
# or to get the last 500 rows:
ss.set_range(9500, 10000)
df = ss.get()
Sorting
While it is easier to sort on the Pandas Dataframe, you can also sort directly on the screener:
import tvscreener as tvs
ss = tvs.StockScreener()
ss.sort_by('market_cap_basic', 'desc')
df = ss.get()
Note that market_cap_basic
is the default sorting option for stocks
Filters
Markets
Filter by markets:
Default: america
import tvscreener as tvs
ss = tvs.StockScreener()
ss.set_markets('america', 'france', 'japan')
df = ss.get()
You can list the markets with:
from generate import tvdata
print(tvdata.stock['markets'])
# ['america', 'uk', 'india', 'spain', 'russia', 'australia', ...]
By Columns
Filter by columns:
import tvscreener as tvs
ss = tvs.StockScreener()
ss.add_filter('Recommend.All', tvs.filter.FilterOperator.IN_RANGE, values=[0.5, 1]) # Strong BUY
df = ss.get()
Recommend.All
corresponds to the TECHNICAL RATING
column.
You can get a list of all columns available with:
from ignore import tvdata
print(tvdata.stock['columns'].keys()) # ['ChaikinMoneyFlow', 'MoneyFlow', 'Value.Traded', 'after_tax_margin', ...]
print(tvdata.forex['columns'].keys()) # ['ask', 'bid', 'country', 'sector', ...]
print(tvdata.crypto['columns'].keys()) # ['24h_vol_change|5', '24h_vol|5', 'ask', 'average_volume_10d_calc', ...]
Time intervals
Change the time interval of the technical data:
Default: Daily (TimeInterval.DAILY
)
import tvscreener as tvs
ss = tvs.StockScreener()
df = ss.get(tvs.TimeInterval.THIRTY_MINUTES)
Debugging
Print the request URL and the payload:
import tvscreener as tvs
ss = tvs.StockScreener()
df = ss.get(print_request=True)
TODO
- Crypto Coins screener
- ETF screener
- More Built-in filters
- Query historical data
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 tvscreener-0.0.11-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0fe06a61286b04fc7b76d6b9be420905c1e7960d060c3558a3bebed39e703dc7 |
|
MD5 | 37628d588b7c09c047448098270c7c14 |
|
BLAKE2b-256 | d8b9df5037e4e7dc2f64e4ef537a34da7e98bfd0c22882ba1e7ad930c2d7d44c |