Build a daily stock market movers report in Python
In this tutorial you will build a daily market report with the top gainers, top losers and most active US stocks: price, percent change and volume. It uses Yahoo Finance Turbo and about 35 lines of Python. Not investment advice.
What you need: Python 3.8+, pip install requests, and a free RapidAPI key.
1. Subscribe to the free plan
- Open the Yahoo Finance Turbo on RapidAPI and subscribe to the free Basic plan (20 requests a month).
- Copy your
X-RapidAPI-Keyand export it:
export RAPIDAPI_KEY=your_key
2. A small helper to call the API
The helper sends your key, retries rate limits (HTTP 429) and server errors (5xx) with a growing wait, and stops with the API’s error message on anything else.
"""Print today's top stock gainers, losers and most active names.
Uses Yahoo Finance Turbo on RapidAPI:
https://rapidapi.com/apiwren-apiwren-default/api/yahoo-finance-turbo
"""
import os, sys, time
import requests
HOST = "yahoo-finance-turbo.p.rapidapi.com"
HEADERS = {"X-RapidAPI-Key": os.environ["RAPIDAPI_KEY"], "X-RapidAPI-Host": HOST}
def get(path, **params):
"""GET one endpoint. Retries rate limits (429) and server errors (5xx)."""
for attempt in range(4):
r = requests.get(f"https://{HOST}{path}", headers=HEADERS, params=params, timeout=90)
retry = r.status_code == 429 or r.status_code in range(500, 600)
if retry and attempt != 3:
time.sleep(float(r.headers.get("Retry-After") or 2 ** (attempt + 1)))
continue
if not r.ok:
sys.exit(f"HTTP {r.status_code}: {r.text[:300]}")
body = r.json()
if isinstance(body, dict) and body.get("success") is False:
sys.exit(f"API error: {body.get('error')}")
return body
3. Read a predefined screen
/screeners/get-symbols-by-predefined takes a Yahoo screen ID in scrIds (day_gainers, day_losers, most_actives and others) and a count.
def screener(scr_id, count=8):
body = get("/screeners/get-symbols-by-predefined", scrIds=scr_id, count=count, region="US")
return body["finance"]["result"][0]["quotes"]
4. Print the report
Three screens, three requests.
def main():
for scr_id, title in (("day_gainers", "Top gainers"), ("day_losers", "Top losers"),
("most_actives", "Most active")):
print(title)
for q in screener(scr_id):
print(f" {q['symbol'].ljust(6)} {q['regularMarketPrice']:9.2f} "
f"{q['regularMarketChangePercent']:+7.2f}% vol {q['regularMarketVolume']:13,} "
f"{q.get('shortName', '')[:30]}")
print()
if __name__ == "__main__":
main()
5. Run it
python yahoo_market_movers.py
Real output from a run on 2026-11-28:
Top gainers
GUNN 6.38 +23.88% vol 37,788 Gunnison Copper Corp.
XP 16.99 +18.07% vol 23,920,261 XP Inc.
IQMX 7.76 +17.58% vol 955,917 IQM Quantum Computers Oyj
VERA 34.26 +16.14% vol 2,804,003 Vera Therapeutics, Inc.
SNDK 85.36 +15.96% vol 97,928,204 Sandisk Corporation
AYA 22.84 +15.01% vol 1,292,411 Aya Gold & Silver Inc.
COHR 223.79 +14.07% vol 7,155,447 Coherent Corp.
AXTI 36.37 +13.73% vol 8,038,778 AXT Inc
Top losers
VRTX 534.57 -5.24% vol 2,130,854 Vertex Pharmaceuticals Incorpo
RHI 37.83 -3.98% vol 798,000 Robert Half Inc.
WIX 65.25 -3.79% vol 461,938 Wix.com Ltd.
FRHC 169.01 -3.74% vol 61,128 Freedom Holding Corp.
SFM 51.37 -3.66% vol 1,150,234 Sprouts Farmers Market, Inc.
ERO 21.60 -3.44% vol 2,379,224 Ero Copper Corp.
BSP 45.03 -2.72% vol 2,145,699 Bending Spoons S.p.A.
IONS 29.16 -2.67% vol 2,170,792 Ionis Pharmaceuticals, Inc.
Most active
NVDA 150.49 +0.80% vol 185,759,641 NVIDIA Corporation
ANT 91.88 +10.98% vol 143,747,654 Anthropic, PBC
BBD 2.80 +15.23% vol 114,323,109 Banco Bradesco Sa
SNDK 85.36 +15.96% vol 97,928,204 Sandisk Corporation
INTC 57.40 +5.38% vol 76,574,098 Intel Corporation
RIG 5.18 +2.98% vol 68,496,881 Transocean Ltd (Switzerland)
NU 12.91 +4.45% vol 68,473,719 Nu Holdings Ltd.
GRAB 2.87 +1.06% vol 66,911,411 Grab Holdings Limited
The complete script is in examples/yahoo_market_movers.py.
Tips
- Other screen IDs include
undervalued_growth_stocks,growth_technology_stocksandsmall_cap_gainers. - Run it after the US close from cron and post it to Slack or Discord.
- Add
/stock/v3/get-chartfor a sparkline of each mover.
Next steps
- Yahoo Finance Turbo on RapidAPI: all endpoints, plans and the live playground.
- Yahoo Finance Turbo overview and more tutorials.
- Questions? Email terrelllouis056@gmail.com.