VertiStratInsights Main website ↗

How to use market_screener_rag: backtested stock strategies by country

Sunday, October 18, 2026

market_screener_rag is an offline command-line tool that tells you which stock-picking approach survived backtesting in each of six markets and applies it to a bundled snapshot of company data.

Open-source tools · How-to · Equity screening research

How to use market_screener_rag: backtested stock strategies by country

Skip to article content
Text Size

Revised · v1.0.0 · what changed

6markets covered: India, US, Korea, Japan, Europe, China
+4.83%Korea long/short edge per 6 months, t-stat 4.17 (gross)
15names in the India long list in the demo
0API keys or model downloads needed

Code: github.com/herrrickshaw/market_screener_rag

Watch the walkthrough

Watch on YouTube: youtu.be/3hloP1KwL5I

What it is for

Most stock factors do not work everywhere. This tool keeps a short knowledge base of what the authors' backtests found for each market, including the results that failed. It reports each strategy's historical earnings with its significance tests (t-stat and Deflated Sharpe), and it states clearly when a market has no edge.

You can ask it for a market's strategy, run that market's screen on a bundled snapshot of company ratios to see example picks, list the historical earnings of every strategy, or ask a free-form question. Answers come from the stored backtest results. The tool does not invent numbers.

It is for learning and research. It is not a trading system.

Who it is for

  • Students and analysts who want to see how backtested evidence differs by market
  • Engineers who want a small example of a rule-based knowledge base with TF-IDF search (no model, no API)
  • Anyone who wants a plain-language look at why nulls and failed strategies matter
Not for.
  • Investment advice. The README and every output say research and education only
  • Live trading. All earnings are gross of costs and short-borrow, on survivorship-biased universes
  • Using the picks as they are. The snapshot is bundled data, not a live feed, so validate each name yourself

What you need

RequirementWhyHow to get it
Python 3runs screener_rag.pypython.org, or brew install python. The repo does not state a minimum version
pandas, scikit-learn, tabulatethe three packages in requirements.txt: tables, TF-IDF search and table printingpip install -r requirements.txt
Disk and RAMsmall bundled data files and chartsA few tens of MB. Any laptop will do
Internet accessonly to clone the repo and install packagesNot needed to run the tool afterwards
API keys, GPU, model downloadsnot requiredThe README says there is no paid API and no model download. A local LM Studio or ollama server is mentioned only as an optional extra

Get the code and an AI assistant

You do not have to be a programmer. Get the repository, give it to an AI assistant, and ask in plain language. Any of these routes works:

ToolWhat you needBest for
GitHubFree account to fork or star; git to clone, or the green Code button, then Download ZIP, or open in CodespacesGetting the code and keeping up with updates
Claude CodeClaude subscription or API key; run claude inside the cloned folderLetting the AI read and run the whole repo
Gemini CLIGoogle account; run gemini inside the cloned folderThe same hands-on workflow with Gemini
Claude.ai, Gemini or ChatGPT in the browserA chat account; upload README.md and the files you care about (or paste the output of git ls-files)Understanding the project and asking questions without installing anything
Other tools (Copilot Chat, Cursor, Codex CLI)Open the cloned folder in the tool and point it at README.md firstEditing and extending the code
git clone https://github.com/herrrickshaw/market_screener_rag.git
cd market_screener_rag
claude      # or: gemini

Install

  1. Clone the repo and create a virtual environment.
    git clone https://github.com/herrrickshaw/market_screener_rag.git
    cd market_screener_rag
    python3 -m venv .venv
    source .venv/bin/activate
  2. Install the three dependencies.
    pip install -r requirements.txt

Quick start: commands and what you should see

See the winning strategy for one market (Korea).

python screener_rag.py strategy KR

A page headed Korea, winning strategy (backtested). Character: mean-reversion. Book: full long/short. It lists the long and short rules and the earnings, including +4.83% per 6 months at t 4.17, and ends with the verdict TRUST and a research-only note.

Compare the historical earnings of every market's strategy.

python screener_rag.py earnings

A table with one row per market (India, US, Korea, Europe, Japan, China), each with its strategy, earnings and significance. Japan shows +6.6% per 6 months (t 4.84). China shows value failing, with a spread near 0% (t 0.04), which the tool labels a real null result.

Apply the India screen to the bundled snapshot.

python screener_rag.py screen IN

A long list of 15 cheap-for-quality names with PE, PB, ROE and a valuation score, all marked UNDERPRICED. It ends with: no short book, because shorting fails in India (-1.0% per 6 months), and a note that the list is gross of costs and not investment advice.

Ask a free-form question.

python screener_rag.py ask "does value work in china"

The line (best match: China), then the China page. The verdict is that value-reversion fails in China (a powered null) and that a value screen should not be run there.

See the one finding that holds across markets.

python screener_rag.py universal

A short note that momentum/trend in bull regimes is the one metric that works in nearly every market and survives the multiple-testing check. Mean-reversion is fragile everywhere.

Ways to use it

MethodHow it works
Command linepython screener_rag.py with the commands strategy, screen, earnings, universal and ask, as listed in the README.
Read the knowledge basewinning_strategies.json holds the per-market rules and results. The bundled data/ folder holds the ratio snapshot the screen runs on.
Learn the termsGLOSSARY.md explains momentum, PE, t-stat and Deflated Sharpe in plain English. Charts such as edge_matrix.png are in the repo root.
Through an AI assistantOpen the cloned folder in Claude Code or Gemini CLI and ask it to run commands and explain the output. The repo has no web UI or Python API documented.

Sample prompts for your AI assistant

Copy, paste and edit the parts in [brackets].

  • Read README.md and GLOSSARY.md and explain in plain English what a t-stat and a Deflated Sharpe ratio tell me about a strategy.
  • Run python screener_rag.py earnings and summarise which markets have a tested edge, which have a null result, and which do not have enough data.
  • Explain why the tool says there is no short book in India, and show me where that comes from in winning_strategies.json.
  • I want to see how screen rules are applied. Walk me through the screen code in screener_rag.py for Korea, step by step, without changing anything.
  • How would I add my own market or strategy to winning_strategies.json? List the fields I would need and the data I would have to bring.
  • List every reason I should not trade on these picks, using the limits written in the README.

Limits and honest caveats

  • Research and education only. Not investment advice.
  • All earnings are gross of costs and short-borrow, on survivorship-biased universes. Read the spreads, not the levels.
  • Capacity is small: roughly 300 to 500 thousand dollars before the illiquidity edge decays. The tool says the real edge is illiquidity, not size.
  • Annualised figures are indicative, not compounded guarantees.
  • The Japan panel is a sample of about 1,437 firms, and China coverage is thin (426 of about 3,454 liquid stocks).
  • The screen runs on a bundled snapshot of ratios, not live data. Validate each name before acting on it.
  • The repo has no test suite or evaluation harness. The demo ran the command-line tool only, so the backtests were not re-run or independently checked.
  • The demo showed only the first lines of the India screen. The output shown in the video is trimmed.

Sources: the market_screener_rag README, GLOSSARY.md, requirements.txt and winning_strategies.json, and the demo run of 18 October 2026.

Revision history.
  • v1.0.0 — 18 October 2026 — first published.

About this article: Researched, written and edited by Umashankar Triplicane Dwarakanathan, with AI research assistance; every figure is meant to trace to the primary source cited. See the Editorial Policy for how sourcing, AI use and corrections work.

Umashankar Triplicane Dwarakanathan
Contact Us
Umashankar Triplicane Dwarakanathan
Investment Promotion & Energy-Sector Leader · Chennai, Tamil Nadu, India
LinkedIn → GitHub → Email +91 78273 81696
How this site works

Data-led analysis of India's trade, currency and industrial policy. Every article is built from primary official sources, and every figure links back to the release, table or filing it came from.

Sources. DGCI&S TradeStat (imports/exports, HSN-wise) · PIB (government press releases, January 2017 to today, refreshed daily) · RBI (circulars, balance of payments) · MoSPI (CPI/WPI, IIP) · PARIVESH (environmental clearances) · CCIL (bond yields) · BIS (policy rates) · SEBI, NSE/BSE and SEC filings for company data.

Interpretation. Figures carry their vintage and retrieval date; estimates and press-reported numbers are labelled as such; where sources disagree, both are shown. Corrections are made visibly, never silently. Articles are written with AI assistance from the cited sources — AI-generated text can misstate figures even when working from real material, so verify any number that matters to a decision against the linked primary source.

footer

Browse all articles by topic

Every piece on this blog, grouped. Or read the full index.

Agriculture & FertilisersAI ToolsChemicalsClimate & CarbonEnergy & FuelsGas & LNGImport SubstitutionIndustrial PolicyMarkets & FinanceMobility & EVPrices & InflationTextilesTrade & Tariffs

Each topic is a live archive page that updates itself as pieces are labelled. It replaces a hand-kept list that had fallen 18 articles behind.