Skip to main content

TradingView Screener API

Project description

TradingView Screener API

Python library to retrieve data from TradingView Screener.

tradingview-screener.png

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

dataframe.png

Installation

$ 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tvscreener-0.0.1.tar.gz (20.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tvscreener-0.0.1-py3-none-any.whl (26.6 kB view details)

Uploaded Python 3

File details

Details for the file tvscreener-0.0.1.tar.gz.

File metadata

  • Download URL: tvscreener-0.0.1.tar.gz
  • Upload date:
  • Size: 20.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for tvscreener-0.0.1.tar.gz
Algorithm Hash digest
SHA256 ce92978c03264fc3a902f79d530745f58718495e4944b16fc7195eae0097b4ce
MD5 5aa1f6d645f0b15b64cf20b8c8098820
BLAKE2b-256 e00a0368f9746e011510ee4a00277b9d7453696ad99262489b6e5017386001f4

See more details on using hashes here.

File details

Details for the file tvscreener-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: tvscreener-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 26.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for tvscreener-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4dfe720cc76cca9ef045b0ff363f48c1a6f4fedb59ed56c83ac66759729ea0c7
MD5 02f8ba5ebc010e82e1a74f933a671601
BLAKE2b-256 68091203d59f7bc37395c987d96bc60c62be64013e9ba3482e0cf6e021c75dc9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page