CLI tool that scrapes screener.in and returns structured financial data optimised for LLM agents.
Project description
screener-cli
A Python command-line tool that scrapes screener.in company pages and returns structured financial data optimised for consumption by LLM coding agents (JSON by default) or human-readable terminal output.
Features
- Fetches all major financial sections: Quarterly Results, Profit & Loss, Balance Sheet, Cash Flow, Key Ratios, Shareholding Pattern, and Pros/Cons.
- Outputs clean, normalised JSON (commas stripped,
%values as floats, empty cells asnull). - Optional
--format textmode renders colour-coded tables in the terminal using Rich. - TTL-based in-memory cache (5 minutes) so multiple sub-commands on the same ticker only fetch the page once per session.
- Automatic fallback from
consolidated→standalonewith a warning when the consolidated view is unavailable. - Graceful error handling for missing sections, rate-limiting (HTTP 429 with exponential back-off), and invalid tickers.
Requirements
- Python 3.11+
- An internet connection (screener.in is a public site; no API key required)
Installation
From PyPI (recommended)
pip install screenercli
From source (for development)
git clone <repo-url> screener-cli
cd screener-cli
pip install -e .
After installation the screener command is available in your shell.
Usage
screener [OPTIONS] SYMBOL COMMAND [ARGS]...
Global options
| Option | Values | Default | Description |
|---|---|---|---|
--view |
consolidated / standalone |
consolidated |
Which financial view to fetch (see below) |
--format |
json / text |
json |
Output format |
--no-cache |
flag | off | Bypass the in-memory TTL cache |
--version |
— | — | Print version and exit |
--view explained
| Value | Meaning |
|---|---|
consolidated |
Shows the combined financial position of the parent company and all its subsidiaries as a single entity. Most large listed companies publish consolidated results; this is the default. |
standalone |
Shows the financial position of only the parent company, excluding its subsidiaries. Useful when you want to analyse the parent in isolation. |
If the requested view is unavailable for a ticker, the CLI automatically falls back to the other view and prints a warning.
Commands
| Command | Description |
|---|---|
quarterly-results |
Last 13 quarters of P&L |
profit-loss |
Annual P&L with compounded growth tables |
balance-sheet |
Annual Balance Sheet |
cash-flow |
Annual Cash Flow statement |
ratios |
Key operating ratios over the years |
shareholding |
Quarterly promoter / FII / DII / public holding |
pros-cons |
Screener-generated pros, cons, about blurb and key metrics |
peer-comparison |
Industry peers with valuation and performance metrics |
all |
All sections combined into one JSON payload |
Examples
Get quarterly results (JSON — ready for an agent)
screener RELIANCE quarterly-results
{
"section": "Quarterly Results",
"unit": "Rs. Crores",
"currency": "INR",
"period_type": "quarterly",
"headers": ["Jun 2023", "Sep 2023", "Dec 2023", "Mar 2024", "Jun 2024"],
"rows": [
{"label": "Sales", "values": [207559, 231886, 225086, 236533, 231784], ...},
{"label": "Net Profit", "values": [18258, 19878, 19641, 21243, 17445], ...}
],
"footnotes": []
}
Get balance sheet as human-readable table
screener --format text RELIANCE balance-sheet
Get standalone profit & loss for TCS
screener --view standalone TCS profit-loss
Get all data sections as a single JSON payload
screener INFY all
Pipe output to a file for offline agent consumption
screener HDFC all > hdfc_data.json
Get pros/cons and company about
screener --format text WIPRO pros-cons
Get peer comparison (JSON)
screener RELIANCE peer-comparison
Get peer comparison as a terminal table
screener --format text TCS peer-comparison
JSON Output Schema
Every financial-table command returns an object matching the following structure:
{
"section": "string",
"unit": "Rs. Crores",
"currency": "INR",
"period_type": "annual | quarterly",
"headers": ["Mar 2020", "Mar 2021", ...],
"rows": [
{
"label": "Sales",
"values": [123456, 234567, null],
"unit": null,
"is_subtotal": false
}
],
"footnotes": []
}
The all command wraps everything under a top-level envelope:
{
"symbol": "RELIANCE",
"view": "consolidated",
"scraped_at": "2026-03-13T10:00:00+00:00",
"source_url": "https://www.screener.in/company/RELIANCE/consolidated/",
"sections": {
"quarterly_results": { ... },
"profit_loss": {
"table": { ... },
"growth_tables": [
{"label": "Compounded Sales Growth", "periods": ["10 Years", "5 Years"], "values": ["14%", "12%"]}
]
},
"balance_sheet": { ... },
"cash_flow": { ... },
"ratios": { ... },
"shareholding": {
"period_type": "quarterly",
"headers": [...],
"rows": [...],
"latest": {"Promoters": 49.6, "FIIs": 24.3, "DIIs": 13.5, "Public": 12.6}
},
"pros_cons": {
"pros": ["..."],
"cons": ["..."],
"about": "Reliance Industries Limited...",
"key_metrics": {"Market Cap": "17,45,678 Cr", "P/E": "24.5"}
},
"peer_comparison": {
"sector": "Energy",
"industry": "Oil, Gas & Consumable Fuels",
"sub_industry": "Petroleum Products",
"sub_sub_industry": "Refineries & Marketing",
"indices": ["BSE Sensex", "Nifty 50", "BSE 500"],
"columns": ["Name", "CMP Rs.", "P/E", "Mar Cap Rs.Cr.", "Div Yld %", "NP Qtr Rs.Cr.", "Qtr Profit Var %", "Sales Qtr Rs.Cr.", "Qtr Sales Var %", "ROCE %"],
"peers": [
{"rank": 1, "name": "Reliance Industries", "url": "/company/RELIANCE/", "values": {"CMP Rs.": 1380.7, "P/E": 24.35, "Mar Cap Rs.Cr.": 1868897.82, "Div Yld %": 0.4, "ROCE %": 9.69}},
{"rank": 2, "name": "I O C L", "url": "/company/IOC/", "values": {"CMP Rs.": 156.54, "P/E": 6.18, "Mar Cap Rs.Cr.": 221067.66, "Div Yld %": 4.47, "ROCE %": 7.36}}
]
}
}
}
Error Codes
| Exit code | Reason |
|---|---|
0 |
Success |
1 |
Company not found, rate limited, timeout, or scraper error |
Errors are printed to stderr so stdout always contains clean JSON.
Tips for LLM Agents
- Use the
allcommand to fetch everything in a single HTTP request. - All numeric values are
float | null— no string parsing needed. - Percentage rows (e.g. OPM %) are identified by
"unit": "%"on the row. - Balance Sheet rows include
"unit": "liability"or"unit": "asset"to distinguish blocks. - Cash Flow rows include
"unit": "Operating" | "Investing" | "Financing" | "Net". - The
latestfield inshareholdingalways gives the most recent quarter's breakdown. peer_comparison.peersis an ordered list (rank 1 = the queried company itself). Each peer'svaluesdict has the same keys aspeer_comparison.columns(minus "Name").peer_comparison.sector / industry / sub_industry / sub_sub_industrygive the full industry hierarchy.- The columns in the peer table are whichever columns the screener.in user has configured — always check
columnsbefore readingvalues.
Responsible Use
- screener.in is a free public service. Please add a delay between requests if running batch jobs.
- Respect
robots.txt. Do not use this tool for bulk or automated mass scraping. - The tool adds a 1-second courtesy delay between retries and caches pages for 5 minutes.
Project Structure
screener_cli/
├── cli.py # Click-based CLI entry point
├── scraper.py # HTTP fetch, error handling, TTL cache
├── models.py # Dataclasses for typed output
├── parsers/
│ ├── utils.py # Generic table parser shared by all sections
│ ├── quarterly.py
│ ├── profit_loss.py
│ ├── balance_sheet.py
│ ├── cash_flow.py
│ ├── ratios.py
│ ├── shareholding.py
│ ├── pros_cons.py
│ └── peers.py # Peer comparison parser
└── formatters/
├── json_fmt.py # JSON serialiser
└── text_fmt.py # Rich terminal renderer
pyproject.toml
requirements.txt
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file screenercli-0.1.1.tar.gz.
File metadata
- Download URL: screenercli-0.1.1.tar.gz
- Upload date:
- Size: 23.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
546e63310d3dc0a7e693ebfc6e26606610fb9916b4e4a029ba5837b66bc3664e
|
|
| MD5 |
2581f377e0c5128e5d9f60098eea40ab
|
|
| BLAKE2b-256 |
4b1521a5554ad2efc5be4a5fe330b5b80688c8f426af5651a711bf2698ad131e
|
Provenance
The following attestation bundles were made for screenercli-0.1.1.tar.gz:
Publisher:
publish.yml on mayur1064/screenercli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
screenercli-0.1.1.tar.gz -
Subject digest:
546e63310d3dc0a7e693ebfc6e26606610fb9916b4e4a029ba5837b66bc3664e - Sigstore transparency entry: 1102540092
- Sigstore integration time:
-
Permalink:
mayur1064/screenercli@08d916d2fd197435fbdb6c18d461745c08e2e7b4 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/mayur1064
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@08d916d2fd197435fbdb6c18d461745c08e2e7b4 -
Trigger Event:
push
-
Statement type:
File details
Details for the file screenercli-0.1.1-py3-none-any.whl.
File metadata
- Download URL: screenercli-0.1.1-py3-none-any.whl
- Upload date:
- Size: 26.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5814b8b89cabce57e2b1af86df3b27f3e53df779a3949701799134075de184df
|
|
| MD5 |
5161f832d98d88804ba950cadf32ad68
|
|
| BLAKE2b-256 |
28783468386c6fbcf388b60d963246e2893ce8cc966297670ebf60b0ab61dbf0
|
Provenance
The following attestation bundles were made for screenercli-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on mayur1064/screenercli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
screenercli-0.1.1-py3-none-any.whl -
Subject digest:
5814b8b89cabce57e2b1af86df3b27f3e53df779a3949701799134075de184df - Sigstore transparency entry: 1102540127
- Sigstore integration time:
-
Permalink:
mayur1064/screenercli@08d916d2fd197435fbdb6c18d461745c08e2e7b4 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/mayur1064
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@08d916d2fd197435fbdb6c18d461745c08e2e7b4 -
Trigger Event:
push
-
Statement type: