Skip to content
Sozhan Natarajan
← Projects
Active Started Aug 2026

My Stock Screener

A Python, FastAPI and React app that screens NSE equities against a configurable Minervini Trend Template on daily and 4-hour data.

Problem
Applying the same multi-rule trend checklist to a whole universe of NSE stocks, on two timeframes, every day, is slow and inconsistent by hand.
Outcome
A scheduled GitHub Actions job scans the universe, scores every stock out of 9 and commits CSV/Excel results. A FastAPI + React dashboard filters, ranks and tracks candidates without re-downloading market data.
Stack
  • Python
  • FastAPI
  • pandas
  • yfinance
  • Typer
  • SQLite
  • React
  • TypeScript
  • Vite
  • GitHub Actions
  • Docker

This is a personal research and screening tool. It does not provide investment advice.

How it works

The scanner is a Python package with a Typer CLI (minervini). A scan:

  1. downloads daily and 4-hour OHLCV candles for every symbol in nse_symbols.csv from Yahoo Finance via yfinance;
  2. computes indicators: 50/150/200-period moving averages, the 52-week range, and a relative-strength (RS) percentile across the universe;
  3. scores each stock against a nine-rule checklist and shortlists anything at or above the threshold (7/9 by default);
  4. writes the results to CSV and Excel under output/.

Architecture

flowchart TB
  cron["GitHub Actions cron<br/>daily 18:00 IST"] -->|minervini update| scan
  yf[Yahoo Finance] -->|yfinance| scan
  subgraph cli["minervini CLI (Python)"]
    direction TB
    scan[Download candles<br/>daily + 4H] --> ind[Indicators<br/>MAs, 52-week range, RS] --> rules[9-rule checklist<br/>score out of 9]
  end
  rules --> out[("output/*.csv, *.xlsx<br/>committed to git")]
  out --> api["FastAPI<br/>/api/stocks"]
  db[("SQLite watchlist")] <--> wl["FastAPI<br/>/api/watchlist"]
  api --> ui["React + TypeScript dashboard"]
  wl --> ui

The checklist

  1. Price above the 50-period moving average
  2. Price above the 150-period moving average
  3. Price above the 200-period moving average
  4. MA50 above MA150
  5. MA150 above MA200
  6. MA200 rising
  7. Price at least 25% above the 52-week low
  8. Price within 25% of the 52-week high
  9. Universe-relative RS rating at or above the threshold

Engineering decisions

  • Precompute, then serve. Downloading candles is the slow, network-bound step, so it runs as a batch job that writes files. The API only reads those files and applies filters such as minimum score and RS rating per request. Changing a filter never triggers a new download.
  • One CLI for people and CI. The same minervini scan, minervini update and minervini api commands run locally, from the Makefile and in the scheduled workflow, so there is no CI-only code path.
  • Scans as commits. A cron workflow runs every evening at 18:00 IST. It checks that the output files are non-empty and commits them only when they changed, so git history doubles as a record of past scans.
  • Small, boring persistence. The personal watchlist is a single SQLite table behind add/remove endpoints.
  • Quality gates. uv for environments, Ruff for lint and formatting, pytest for the data, indicator and rule modules, and CI on every change. The API ships as a python:3.12-slim image with uv.

Limitations and next steps

  • Market data comes from Yahoo Finance. Missing candles, corporate actions and intraday-history limits need validating against the charting source used for real decisions, and 4-hour results should be cross-checked on TradingView.
  • The RS rating is a project-defined percentile across the screening universe. It is not the proprietary IBD RS Rating.