TradingView API: Screen stocks by country, sector and size
Finds publicly listed stocks in a country, filtered by sector, US-dollar market cap band and minimum dividend yield, in the requested order. Quotes may be delayed.
Unofficial. Not affiliated with or endorsed by TradingView.
Inputs
Values from the run on Oct 23, 2026, shown under Output.
- Sort optional
sort Order stocks by market cap, daily gain, daily loss, or dividend yield, for example largest_first.
largest_first (default)
One of
largest_first,biggest_gainers,biggest_losers,highest_dividend.- Sector optional
sector TradingView stock sector, for example Technology, Finance, or Health Technology.
Not set
- Country optional
country Country of the stock exchange, for example United States or Canada.
United States (default)
- Max Results optional
max_results Maximum number of stocks to return, for example 20.
20 (default)
Whole number from 1 to 100.
- Company Size optional
company_size Market cap band: small under 2 billion, mid 2-10 billion, large over 10 billion, or any.
any (default)
One of
small,mid,large,any.- Minimum Dividend Yield (%) optional
minimum_dividend_yield_percent Minimum dividend yield as a percent, for example 3.5.
Not set
Number 0 or more.
Input as JSON
{}Output
{ "stocks": [ { "price": 212.21, "sector": "Electronic technology", "ticker": "NVDA", "company": "NVIDIA Corporation", "currency": "USD", "exchange": "NASDAQ", "pe_ratio": 26.826030895254473, "market_cap": 5114261000000, "tradingview_link": "https://www.tradingview.com/symbols/NASDAQ-NVDA/" , "change_percent_today": -4.396990584313191, "dividend_yield_percent": 0.234265891787178 }, { "price": 348.22, "sector": "Electronic technology", "ticker": "AAPL", "company": "Apple Inc.", "currency": "USD", "exchange": "NASDAQ", "pe_ratio": 39.918379512340515, "market_cap": 5081985500000, "tradingview_link": "https://www.tradingview.com/symbols/NASDAQ-AAPL/" , "change_percent_today": 1.2296869095031886, "dividend_yield_percent": 0.308148492688741 }, { "price": 320.76, "sector": "Technology services", "ticker": "GOOG", "company": "Alphabet Inc.", "currency": "USD", "exchange": "NASDAQ", "pe_ratio": 16.114301216258987, "market_cap": 3946087312500, "tradingview_link": "https://www.tradingview.com/symbols/NASDAQ-GOOG/" , "change_percent_today": -3.0790149569421357, "dividend_yield_percent": 0.259857984589817 } ]}Code
curl https://api.fous.com/v1/runs \ -H "Authorization: Bearer $FOUS_API_KEY" \ -H "Content-Type: application/json" \ -d '{"method":"tradingview.com/screen_stocks","input":{}}' # Save as fous.py, then run: python3 fous.pyimport json, os, timefrom urllib.error import HTTPErrorfrom urllib.request import Request, urlopenAPI = "https://api.fous.com/v1/runs" KEY = os.environ["FOUS_API_KEY"]HEADERS = { "Authorization": f"Bearer {KEY}", "Content-Type": "application/json" ,}def call(url, body=None): data = json.dumps(body).encode() if body else None request = Request(url, data, HEADERS) try: with urlopen(request, timeout=120) as r: return r.status, json.load(r) except HTTPError as error: message = json.load(error)["error"]["message"] raise RuntimeError(message) from errorstatus, run = call(API, { "method": "tradingview.com/screen_stocks" , "input": {}})# 202: still going after 30 s. Ask again until it ends.while status == 202: time.sleep(2) status, run = call(f"{API}/{run['id']}")print(json.dumps(run["data"], indent=2))// Save as fous.mjs, then run: node fous.mjsconst api = "https://api.fous.com/v1/runs" ;const headers = { Authorization: `Bearer ${process.env.FOUS_API_KEY}`, "Content-Type": "application/json" ,};let response = await fetch(api, { method: "POST", headers, body: JSON.stringify({ "method": "tradingview.com/screen_stocks" , "input": {} }), signal: AbortSignal.timeout(120_000),});let run = await response.json();// 202: still going after 30 s. Ask again until it ends.while (response.status === 202) { await new Promise((done) => setTimeout(done, 2_000)); response = await fetch(`${api}/${run.id}`, { headers }); run = await response.json();}if (!response.ok) throw new Error(run.error.message);console.log(run.data);# Connect your agent to Fous once, over MCP (Streamable HTTP):# https://api.fous.com/mcp# Set FOUS_API_KEY first: create a key at https://app.fous.com/keys.# Claude Codeclaude mcp add \ --scope user \ --transport http fous https://api.fous.com/mcp \ --header "Authorization: Bearer ${FOUS_API_KEY:?Set FOUS_API_KEY to your Fous API key}"# Codexcodex mcp add fous \ --url https://api.fous.com/mcp \ --bearer-token-env-var FOUS_API_KEY# Cursor, VS Code, Windsurf, Cline and morenpx -y add-mcp https://api.fous.com/mcp -g -n fous \ --header "Authorization: Bearer ${FOUS_API_KEY:?Set FOUS_API_KEY to your Fous API key}"# Then ask your agent:# "Use Fous to run tradingview.com/screen_stocks# with {}"Over HTTP, the answer’s data holds the output. A run still going after 30 seconds answers 202 with its id: ask GET /v1/runs/{id} until it ends.
Schema
Input schema
{ "type": "object", "properties": { "sort": { "enum": [ "largest_first", "biggest_gainers", "biggest_losers", "highest_dividend" ], "type": "string", "default": "largest_first", "description": "Order stocks by market cap, daily gain, daily loss, or dividend yield, for example largest_first." }, "sector": { "type": "string", "description": "TradingView stock sector, for example Technology, Finance, or Health Technology." }, "country": { "type": "string", "default": "United States", "description": "Country of the stock exchange, for example United States or Canada." }, "max_results": { "type": "integer", "default": 20, "maximum": 100, "minimum": 1, "description": "Maximum number of stocks to return, for example 20." }, "company_size": { "enum": [ "small", "mid", "large", "any" ], "type": "string", "default": "any", "description": "Market cap band: small under 2 billion, mid 2-10 billion, large over 10 billion, or any." }, "minimum_dividend_yield_percent": { "type": "number", "minimum": 0, "description": "Minimum dividend yield as a percent, for example 3.5." } }}Output schema
{ "type": "object", "required": [ "stocks" ], "properties": { "stocks": { "type": "array", "items": { "type": "object", "required": [ "company", "ticker", "exchange", "price", "currency", "change_percent_today", "market_cap", "pe_ratio", "dividend_yield_percent", "sector", "tradingview_link" ], "properties": { "price": { "type": [ "number", "null" ] }, "sector": { "type": [ "string", "null" ] }, "ticker": { "type": "string" }, "company": { "type": "string" }, "currency": { "type": [ "string", "null" ] }, "exchange": { "type": "string" }, "pe_ratio": { "type": [ "number", "null" ] }, "market_cap": { "type": [ "number", "null" ] }, "tradingview_link": { "type": "string" }, "change_percent_today": { "type": [ "number", "null" ] }, "dividend_yield_percent": { "type": [ "number", "null" ] } }, "additionalProperties": false }, "description": "Matching stocks in the selected order." } }, "additionalProperties": false}- Price
- 1 credit per completed run (1¢ with pay as you go); failed runs are free.
- Method
tradingview.com/screen_stocks- Returns
- company, ticker, exchange, price, currency, daily change, market cap, P/E, dividend yield, sector, TradingView link
Use it from your agent
Give your agent this line. It reads SKILL.md, gets a Fous API key and connects the Fous MCP server. Its run then takes the method tradingview.com/screen_stocks with the inputs above.
Ask your agent
- Show me the 15 largest US Health Technology stocks with market cap over 10 billion dollars
- Which Canadian Finance companies pay a dividend yield above 4 percent? List their tickers and P/E ratios.
- Find mid-cap Technology stocks in the United States, 2 to 10 billion market cap, sorted by biggest daily gainers
- I need a list of top 25 German Energy companies sorted by highest dividend yield, with prices in euros
- On tradingview.com, screen for small-cap Consumer Goods stocks in Japan that had the biggest daily losses today
See more
All TradingView methodsReturns TradingView's buy, sell and neutral technical indicator summary for a stock, cryptocurrency or currency pair. Not investment advice.
tradingview.com/get_technical_ratingScreens US-listed stocks on Finviz by sector, company size, minimum dividend yield, maximum P/E ratio and market signal, ranked by market value, today's gain or dividend yield.
finviz.com/screen_stocksRanks public companies worldwide, or by country and industry, by market cap, revenue, earnings, employees or dividend yield. When both a country and an industry are set, the industry ranking order is kept and only companies from that country are shown.
companiesmarketcap.com/list_largest_companiesGet a delayed US-listed stock snapshot from its ticker or company name. Analyst labels summarize Finviz's 1-5 mean score; dividend yield uses the estimated dividend when available. Missing metrics return null.
finviz.com/get_stock_snapshotLists Yahoo Finance's top gainers, top losers, most active stocks, or regional trending tickers in Yahoo's order, with price, change, volume and market cap.
finance.yahoo.com/list_market_moversLists MSN Money's current leading stock gainers, losers, or most-active shares in a selected market, in MSN's order. Lists may contain fewer than 50 stocks and prices may be delayed.
msn.com/list_market_moversLooks up a public company's size, financial figures and completed-year market-cap history from its name or ticker.
companiesmarketcap.com/get_company_sizeLooks up a stock by company name or ticker on Stock Analysis and returns its valuation ratios and company statistics, with the date the figures were last updated.
stockanalysis.com/get_key_statistics