screenercli 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. screenercli-0.1.0/LICENSE +21 -0
  2. screenercli-0.1.0/PKG-INFO +302 -0
  3. screenercli-0.1.0/README.md +276 -0
  4. screenercli-0.1.0/pyproject.toml +41 -0
  5. screenercli-0.1.0/screener_cli/__init__.py +3 -0
  6. screenercli-0.1.0/screener_cli/cli.py +223 -0
  7. screenercli-0.1.0/screener_cli/formatters/__init__.py +1 -0
  8. screenercli-0.1.0/screener_cli/formatters/json_fmt.py +27 -0
  9. screenercli-0.1.0/screener_cli/formatters/text_fmt.py +246 -0
  10. screenercli-0.1.0/screener_cli/models.py +83 -0
  11. screenercli-0.1.0/screener_cli/parsers/__init__.py +1 -0
  12. screenercli-0.1.0/screener_cli/parsers/balance_sheet.py +49 -0
  13. screenercli-0.1.0/screener_cli/parsers/cash_flow.py +47 -0
  14. screenercli-0.1.0/screener_cli/parsers/peers.py +210 -0
  15. screenercli-0.1.0/screener_cli/parsers/profit_loss.py +46 -0
  16. screenercli-0.1.0/screener_cli/parsers/pros_cons.py +70 -0
  17. screenercli-0.1.0/screener_cli/parsers/quarterly.py +23 -0
  18. screenercli-0.1.0/screener_cli/parsers/ratios.py +45 -0
  19. screenercli-0.1.0/screener_cli/parsers/shareholding.py +88 -0
  20. screenercli-0.1.0/screener_cli/parsers/utils.py +175 -0
  21. screenercli-0.1.0/screener_cli/scraper.py +232 -0
  22. screenercli-0.1.0/screenercli.egg-info/PKG-INFO +302 -0
  23. screenercli-0.1.0/screenercli.egg-info/SOURCES.txt +26 -0
  24. screenercli-0.1.0/screenercli.egg-info/dependency_links.txt +1 -0
  25. screenercli-0.1.0/screenercli.egg-info/entry_points.txt +2 -0
  26. screenercli-0.1.0/screenercli.egg-info/requires.txt +6 -0
  27. screenercli-0.1.0/screenercli.egg-info/top_level.txt +1 -0
  28. screenercli-0.1.0/setup.cfg +4 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,302 @@
1
+ Metadata-Version: 2.4
2
+ Name: screenercli
3
+ Version: 0.1.0
4
+ Summary: CLI tool that scrapes screener.in and returns structured financial data optimised for LLM agents.
5
+ License-Expression: MIT
6
+ Project-URL: Homepage, https://github.com/YOUR_USERNAME/screener-cli
7
+ Project-URL: Repository, https://github.com/YOUR_USERNAME/screener-cli
8
+ Project-URL: Bug Tracker, https://github.com/YOUR_USERNAME/screener-cli/issues
9
+ Keywords: finance,screener,stock,cli,agent
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Topic :: Office/Business :: Financial
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Financial and Insurance Industry
15
+ Classifier: Intended Audience :: Developers
16
+ Requires-Python: >=3.11
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE
19
+ Requires-Dist: requests>=2.31.0
20
+ Requires-Dist: beautifulsoup4>=4.12.0
21
+ Requires-Dist: lxml>=5.0.0
22
+ Requires-Dist: click>=8.1.0
23
+ Requires-Dist: rich>=13.0.0
24
+ Requires-Dist: cachetools>=5.3.0
25
+ Dynamic: license-file
26
+
27
+ # screener-cli
28
+
29
+ A Python command-line tool that scrapes [screener.in](https://www.screener.in) company pages and returns structured financial data optimised for consumption by LLM coding agents (JSON by default) or human-readable terminal output.
30
+
31
+ ---
32
+
33
+ ## Features
34
+
35
+ - Fetches all major financial sections: Quarterly Results, Profit & Loss, Balance Sheet, Cash Flow, Key Ratios, Shareholding Pattern, and Pros/Cons.
36
+ - Outputs clean, normalised JSON (commas stripped, `%` values as floats, empty cells as `null`).
37
+ - Optional `--format text` mode renders colour-coded tables in the terminal using [Rich](https://github.com/Textualize/rich).
38
+ - TTL-based in-memory cache (5 minutes) so multiple sub-commands on the same ticker only fetch the page once per session.
39
+ - Automatic fallback from `consolidated` → `standalone` with a warning when the consolidated view is unavailable.
40
+ - Graceful error handling for missing sections, rate-limiting (HTTP 429 with exponential back-off), and invalid tickers.
41
+
42
+ ---
43
+
44
+ ## Requirements
45
+
46
+ - Python **3.11+**
47
+ - An internet connection (screener.in is a public site; no API key required)
48
+
49
+ ---
50
+
51
+ ## Installation
52
+
53
+ ### From PyPI (recommended)
54
+
55
+ ```bash
56
+ pip install screenercli
57
+ ```
58
+
59
+ ### From source (for development)
60
+
61
+ ```bash
62
+ git clone <repo-url> screener-cli
63
+ cd screener-cli
64
+ pip install -e .
65
+ ```
66
+
67
+ After installation the `screener` command is available in your shell.
68
+
69
+ ---
70
+
71
+ ## Usage
72
+
73
+ ```
74
+ screener [OPTIONS] SYMBOL COMMAND [ARGS]...
75
+ ```
76
+
77
+ ### Global options
78
+
79
+ | Option | Values | Default | Description |
80
+ |--------|--------|---------|-------------|
81
+ | `--view` | `consolidated` / `standalone` | `consolidated` | Which balance sheet view to fetch |
82
+ | `--format` | `json` / `text` | `json` | Output format |
83
+ | `--no-cache` | flag | off | Bypass the in-memory TTL cache |
84
+ | `--version` | — | — | Print version and exit |
85
+
86
+ ### Commands
87
+
88
+ | Command | Description |
89
+ |---------|-------------|
90
+ | `quarterly-results` | Last 13 quarters of P&L |
91
+ | `profit-loss` | Annual P&L with compounded growth tables |
92
+ | `balance-sheet` | Annual Balance Sheet |
93
+ | `cash-flow` | Annual Cash Flow statement |
94
+ | `ratios` | Key operating ratios over the years |
95
+ | `shareholding` | Quarterly promoter / FII / DII / public holding |
96
+ | `pros-cons` | Screener-generated pros, cons, about blurb and key metrics |
97
+ | `peer-comparison` | Industry peers with valuation and performance metrics |
98
+ | `all` | All sections combined into one JSON payload |
99
+
100
+ ---
101
+
102
+ ## Examples
103
+
104
+ ### Get quarterly results (JSON — ready for an agent)
105
+
106
+ ```bash
107
+ screener RELIANCE quarterly-results
108
+ ```
109
+
110
+ ```json
111
+ {
112
+ "section": "Quarterly Results",
113
+ "unit": "Rs. Crores",
114
+ "currency": "INR",
115
+ "period_type": "quarterly",
116
+ "headers": ["Jun 2023", "Sep 2023", "Dec 2023", "Mar 2024", "Jun 2024"],
117
+ "rows": [
118
+ {"label": "Sales", "values": [207559, 231886, 225086, 236533, 231784], ...},
119
+ {"label": "Net Profit", "values": [18258, 19878, 19641, 21243, 17445], ...}
120
+ ],
121
+ "footnotes": []
122
+ }
123
+ ```
124
+
125
+ ### Get balance sheet as human-readable table
126
+
127
+ ```bash
128
+ screener --format text RELIANCE balance-sheet
129
+ ```
130
+
131
+ ### Get standalone profit & loss for TCS
132
+
133
+ ```bash
134
+ screener --view standalone TCS profit-loss
135
+ ```
136
+
137
+ ### Get all data sections as a single JSON payload
138
+
139
+ ```bash
140
+ screener INFY all
141
+ ```
142
+
143
+ ### Pipe output to a file for offline agent consumption
144
+
145
+ ```bash
146
+ screener HDFC all > hdfc_data.json
147
+ ```
148
+
149
+ ### Get pros/cons and company about
150
+
151
+ ```bash
152
+ screener --format text WIPRO pros-cons
153
+ ```
154
+
155
+ ### Get peer comparison (JSON)
156
+
157
+ ```bash
158
+ screener RELIANCE peer-comparison
159
+ ```
160
+
161
+ ### Get peer comparison as a terminal table
162
+
163
+ ```bash
164
+ screener --format text TCS peer-comparison
165
+ ```
166
+
167
+ ---
168
+
169
+ ## JSON Output Schema
170
+
171
+ Every financial-table command returns an object matching the following structure:
172
+
173
+ ```json
174
+ {
175
+ "section": "string",
176
+ "unit": "Rs. Crores",
177
+ "currency": "INR",
178
+ "period_type": "annual | quarterly",
179
+ "headers": ["Mar 2020", "Mar 2021", ...],
180
+ "rows": [
181
+ {
182
+ "label": "Sales",
183
+ "values": [123456, 234567, null],
184
+ "unit": null,
185
+ "is_subtotal": false
186
+ }
187
+ ],
188
+ "footnotes": []
189
+ }
190
+ ```
191
+
192
+ The `all` command wraps everything under a top-level envelope:
193
+
194
+ ```json
195
+ {
196
+ "symbol": "RELIANCE",
197
+ "view": "consolidated",
198
+ "scraped_at": "2026-03-13T10:00:00+00:00",
199
+ "source_url": "https://www.screener.in/company/RELIANCE/consolidated/",
200
+ "sections": {
201
+ "quarterly_results": { ... },
202
+ "profit_loss": {
203
+ "table": { ... },
204
+ "growth_tables": [
205
+ {"label": "Compounded Sales Growth", "periods": ["10 Years", "5 Years"], "values": ["14%", "12%"]}
206
+ ]
207
+ },
208
+ "balance_sheet": { ... },
209
+ "cash_flow": { ... },
210
+ "ratios": { ... },
211
+ "shareholding": {
212
+ "period_type": "quarterly",
213
+ "headers": [...],
214
+ "rows": [...],
215
+ "latest": {"Promoters": 49.6, "FIIs": 24.3, "DIIs": 13.5, "Public": 12.6}
216
+ },
217
+ "pros_cons": {
218
+ "pros": ["..."],
219
+ "cons": ["..."],
220
+ "about": "Reliance Industries Limited...",
221
+ "key_metrics": {"Market Cap": "17,45,678 Cr", "P/E": "24.5"}
222
+ },
223
+ "peer_comparison": {
224
+ "sector": "Energy",
225
+ "industry": "Oil, Gas & Consumable Fuels",
226
+ "sub_industry": "Petroleum Products",
227
+ "sub_sub_industry": "Refineries & Marketing",
228
+ "indices": ["BSE Sensex", "Nifty 50", "BSE 500"],
229
+ "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 %"],
230
+ "peers": [
231
+ {"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}},
232
+ {"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}}
233
+ ]
234
+ }
235
+ }
236
+ }
237
+ ```
238
+
239
+ ---
240
+
241
+ ## Error Codes
242
+
243
+ | Exit code | Reason |
244
+ |-----------|--------|
245
+ | `0` | Success |
246
+ | `1` | Company not found, rate limited, timeout, or scraper error |
247
+
248
+ Errors are printed to **stderr** so stdout always contains clean JSON.
249
+
250
+ ---
251
+
252
+ ## Tips for LLM Agents
253
+
254
+ - Use the `all` command to fetch everything in a single HTTP request.
255
+ - All numeric values are `float | null` — no string parsing needed.
256
+ - Percentage rows (e.g. OPM %) are identified by `"unit": "%"` on the row.
257
+ - Balance Sheet rows include `"unit": "liability"` or `"unit": "asset"` to distinguish blocks.
258
+ - Cash Flow rows include `"unit": "Operating" | "Investing" | "Financing" | "Net"`.
259
+ - The `latest` field in `shareholding` always gives the most recent quarter's breakdown.
260
+ - `peer_comparison.peers` is an ordered list (rank 1 = the queried company itself). Each peer's `values` dict has the same keys as `peer_comparison.columns` (minus "Name").
261
+ - `peer_comparison.sector / industry / sub_industry / sub_sub_industry` give the full industry hierarchy.
262
+ - The columns in the peer table are whichever columns the screener.in user has configured — always check `columns` before reading `values`.
263
+
264
+ ---
265
+
266
+ ## Responsible Use
267
+
268
+ - screener.in is a free public service. Please add a delay between requests if running batch jobs.
269
+ - Respect `robots.txt`. Do not use this tool for bulk or automated mass scraping.
270
+ - The tool adds a 1-second courtesy delay between retries and caches pages for 5 minutes.
271
+
272
+ ---
273
+
274
+ ## Project Structure
275
+
276
+ ```
277
+ screener_cli/
278
+ ├── cli.py # Click-based CLI entry point
279
+ ├── scraper.py # HTTP fetch, error handling, TTL cache
280
+ ├── models.py # Dataclasses for typed output
281
+ ├── parsers/
282
+ │ ├── utils.py # Generic table parser shared by all sections
283
+ │ ├── quarterly.py
284
+ │ ├── profit_loss.py
285
+ │ ├── balance_sheet.py
286
+ │ ├── cash_flow.py
287
+ │ ├── ratios.py
288
+ │ ├── shareholding.py
289
+ │ ├── pros_cons.py
290
+ │ └── peers.py # Peer comparison parser
291
+ └── formatters/
292
+ ├── json_fmt.py # JSON serialiser
293
+ └── text_fmt.py # Rich terminal renderer
294
+ pyproject.toml
295
+ requirements.txt
296
+ ```
297
+
298
+ ---
299
+
300
+ ## License
301
+
302
+ MIT
@@ -0,0 +1,276 @@
1
+ # screener-cli
2
+
3
+ A Python command-line tool that scrapes [screener.in](https://www.screener.in) company pages and returns structured financial data optimised for consumption by LLM coding agents (JSON by default) or human-readable terminal output.
4
+
5
+ ---
6
+
7
+ ## Features
8
+
9
+ - Fetches all major financial sections: Quarterly Results, Profit & Loss, Balance Sheet, Cash Flow, Key Ratios, Shareholding Pattern, and Pros/Cons.
10
+ - Outputs clean, normalised JSON (commas stripped, `%` values as floats, empty cells as `null`).
11
+ - Optional `--format text` mode renders colour-coded tables in the terminal using [Rich](https://github.com/Textualize/rich).
12
+ - TTL-based in-memory cache (5 minutes) so multiple sub-commands on the same ticker only fetch the page once per session.
13
+ - Automatic fallback from `consolidated` → `standalone` with a warning when the consolidated view is unavailable.
14
+ - Graceful error handling for missing sections, rate-limiting (HTTP 429 with exponential back-off), and invalid tickers.
15
+
16
+ ---
17
+
18
+ ## Requirements
19
+
20
+ - Python **3.11+**
21
+ - An internet connection (screener.in is a public site; no API key required)
22
+
23
+ ---
24
+
25
+ ## Installation
26
+
27
+ ### From PyPI (recommended)
28
+
29
+ ```bash
30
+ pip install screenercli
31
+ ```
32
+
33
+ ### From source (for development)
34
+
35
+ ```bash
36
+ git clone <repo-url> screener-cli
37
+ cd screener-cli
38
+ pip install -e .
39
+ ```
40
+
41
+ After installation the `screener` command is available in your shell.
42
+
43
+ ---
44
+
45
+ ## Usage
46
+
47
+ ```
48
+ screener [OPTIONS] SYMBOL COMMAND [ARGS]...
49
+ ```
50
+
51
+ ### Global options
52
+
53
+ | Option | Values | Default | Description |
54
+ |--------|--------|---------|-------------|
55
+ | `--view` | `consolidated` / `standalone` | `consolidated` | Which balance sheet view to fetch |
56
+ | `--format` | `json` / `text` | `json` | Output format |
57
+ | `--no-cache` | flag | off | Bypass the in-memory TTL cache |
58
+ | `--version` | — | — | Print version and exit |
59
+
60
+ ### Commands
61
+
62
+ | Command | Description |
63
+ |---------|-------------|
64
+ | `quarterly-results` | Last 13 quarters of P&L |
65
+ | `profit-loss` | Annual P&L with compounded growth tables |
66
+ | `balance-sheet` | Annual Balance Sheet |
67
+ | `cash-flow` | Annual Cash Flow statement |
68
+ | `ratios` | Key operating ratios over the years |
69
+ | `shareholding` | Quarterly promoter / FII / DII / public holding |
70
+ | `pros-cons` | Screener-generated pros, cons, about blurb and key metrics |
71
+ | `peer-comparison` | Industry peers with valuation and performance metrics |
72
+ | `all` | All sections combined into one JSON payload |
73
+
74
+ ---
75
+
76
+ ## Examples
77
+
78
+ ### Get quarterly results (JSON — ready for an agent)
79
+
80
+ ```bash
81
+ screener RELIANCE quarterly-results
82
+ ```
83
+
84
+ ```json
85
+ {
86
+ "section": "Quarterly Results",
87
+ "unit": "Rs. Crores",
88
+ "currency": "INR",
89
+ "period_type": "quarterly",
90
+ "headers": ["Jun 2023", "Sep 2023", "Dec 2023", "Mar 2024", "Jun 2024"],
91
+ "rows": [
92
+ {"label": "Sales", "values": [207559, 231886, 225086, 236533, 231784], ...},
93
+ {"label": "Net Profit", "values": [18258, 19878, 19641, 21243, 17445], ...}
94
+ ],
95
+ "footnotes": []
96
+ }
97
+ ```
98
+
99
+ ### Get balance sheet as human-readable table
100
+
101
+ ```bash
102
+ screener --format text RELIANCE balance-sheet
103
+ ```
104
+
105
+ ### Get standalone profit & loss for TCS
106
+
107
+ ```bash
108
+ screener --view standalone TCS profit-loss
109
+ ```
110
+
111
+ ### Get all data sections as a single JSON payload
112
+
113
+ ```bash
114
+ screener INFY all
115
+ ```
116
+
117
+ ### Pipe output to a file for offline agent consumption
118
+
119
+ ```bash
120
+ screener HDFC all > hdfc_data.json
121
+ ```
122
+
123
+ ### Get pros/cons and company about
124
+
125
+ ```bash
126
+ screener --format text WIPRO pros-cons
127
+ ```
128
+
129
+ ### Get peer comparison (JSON)
130
+
131
+ ```bash
132
+ screener RELIANCE peer-comparison
133
+ ```
134
+
135
+ ### Get peer comparison as a terminal table
136
+
137
+ ```bash
138
+ screener --format text TCS peer-comparison
139
+ ```
140
+
141
+ ---
142
+
143
+ ## JSON Output Schema
144
+
145
+ Every financial-table command returns an object matching the following structure:
146
+
147
+ ```json
148
+ {
149
+ "section": "string",
150
+ "unit": "Rs. Crores",
151
+ "currency": "INR",
152
+ "period_type": "annual | quarterly",
153
+ "headers": ["Mar 2020", "Mar 2021", ...],
154
+ "rows": [
155
+ {
156
+ "label": "Sales",
157
+ "values": [123456, 234567, null],
158
+ "unit": null,
159
+ "is_subtotal": false
160
+ }
161
+ ],
162
+ "footnotes": []
163
+ }
164
+ ```
165
+
166
+ The `all` command wraps everything under a top-level envelope:
167
+
168
+ ```json
169
+ {
170
+ "symbol": "RELIANCE",
171
+ "view": "consolidated",
172
+ "scraped_at": "2026-03-13T10:00:00+00:00",
173
+ "source_url": "https://www.screener.in/company/RELIANCE/consolidated/",
174
+ "sections": {
175
+ "quarterly_results": { ... },
176
+ "profit_loss": {
177
+ "table": { ... },
178
+ "growth_tables": [
179
+ {"label": "Compounded Sales Growth", "periods": ["10 Years", "5 Years"], "values": ["14%", "12%"]}
180
+ ]
181
+ },
182
+ "balance_sheet": { ... },
183
+ "cash_flow": { ... },
184
+ "ratios": { ... },
185
+ "shareholding": {
186
+ "period_type": "quarterly",
187
+ "headers": [...],
188
+ "rows": [...],
189
+ "latest": {"Promoters": 49.6, "FIIs": 24.3, "DIIs": 13.5, "Public": 12.6}
190
+ },
191
+ "pros_cons": {
192
+ "pros": ["..."],
193
+ "cons": ["..."],
194
+ "about": "Reliance Industries Limited...",
195
+ "key_metrics": {"Market Cap": "17,45,678 Cr", "P/E": "24.5"}
196
+ },
197
+ "peer_comparison": {
198
+ "sector": "Energy",
199
+ "industry": "Oil, Gas & Consumable Fuels",
200
+ "sub_industry": "Petroleum Products",
201
+ "sub_sub_industry": "Refineries & Marketing",
202
+ "indices": ["BSE Sensex", "Nifty 50", "BSE 500"],
203
+ "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 %"],
204
+ "peers": [
205
+ {"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}},
206
+ {"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}}
207
+ ]
208
+ }
209
+ }
210
+ }
211
+ ```
212
+
213
+ ---
214
+
215
+ ## Error Codes
216
+
217
+ | Exit code | Reason |
218
+ |-----------|--------|
219
+ | `0` | Success |
220
+ | `1` | Company not found, rate limited, timeout, or scraper error |
221
+
222
+ Errors are printed to **stderr** so stdout always contains clean JSON.
223
+
224
+ ---
225
+
226
+ ## Tips for LLM Agents
227
+
228
+ - Use the `all` command to fetch everything in a single HTTP request.
229
+ - All numeric values are `float | null` — no string parsing needed.
230
+ - Percentage rows (e.g. OPM %) are identified by `"unit": "%"` on the row.
231
+ - Balance Sheet rows include `"unit": "liability"` or `"unit": "asset"` to distinguish blocks.
232
+ - Cash Flow rows include `"unit": "Operating" | "Investing" | "Financing" | "Net"`.
233
+ - The `latest` field in `shareholding` always gives the most recent quarter's breakdown.
234
+ - `peer_comparison.peers` is an ordered list (rank 1 = the queried company itself). Each peer's `values` dict has the same keys as `peer_comparison.columns` (minus "Name").
235
+ - `peer_comparison.sector / industry / sub_industry / sub_sub_industry` give the full industry hierarchy.
236
+ - The columns in the peer table are whichever columns the screener.in user has configured — always check `columns` before reading `values`.
237
+
238
+ ---
239
+
240
+ ## Responsible Use
241
+
242
+ - screener.in is a free public service. Please add a delay between requests if running batch jobs.
243
+ - Respect `robots.txt`. Do not use this tool for bulk or automated mass scraping.
244
+ - The tool adds a 1-second courtesy delay between retries and caches pages for 5 minutes.
245
+
246
+ ---
247
+
248
+ ## Project Structure
249
+
250
+ ```
251
+ screener_cli/
252
+ ├── cli.py # Click-based CLI entry point
253
+ ├── scraper.py # HTTP fetch, error handling, TTL cache
254
+ ├── models.py # Dataclasses for typed output
255
+ ├── parsers/
256
+ │ ├── utils.py # Generic table parser shared by all sections
257
+ │ ├── quarterly.py
258
+ │ ├── profit_loss.py
259
+ │ ├── balance_sheet.py
260
+ │ ├── cash_flow.py
261
+ │ ├── ratios.py
262
+ │ ├── shareholding.py
263
+ │ ├── pros_cons.py
264
+ │ └── peers.py # Peer comparison parser
265
+ └── formatters/
266
+ ├── json_fmt.py # JSON serialiser
267
+ └── text_fmt.py # Rich terminal renderer
268
+ pyproject.toml
269
+ requirements.txt
270
+ ```
271
+
272
+ ---
273
+
274
+ ## License
275
+
276
+ MIT
@@ -0,0 +1,41 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "screenercli"
7
+ version = "0.1.0"
8
+ description = "CLI tool that scrapes screener.in and returns structured financial data optimised for LLM agents."
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ license = "MIT"
12
+ license-files = ["LICENSE"]
13
+ keywords = ["finance", "screener", "stock", "cli", "agent"]
14
+ classifiers = [
15
+ "Programming Language :: Python :: 3",
16
+ "Operating System :: OS Independent",
17
+ "Topic :: Office/Business :: Financial",
18
+ "Environment :: Console",
19
+ "Intended Audience :: Financial and Insurance Industry",
20
+ "Intended Audience :: Developers",
21
+ ]
22
+ dependencies = [
23
+ "requests>=2.31.0",
24
+ "beautifulsoup4>=4.12.0",
25
+ "lxml>=5.0.0",
26
+ "click>=8.1.0",
27
+ "rich>=13.0.0",
28
+ "cachetools>=5.3.0",
29
+ ]
30
+
31
+ [project.urls]
32
+ Homepage = "https://github.com/YOUR_USERNAME/screener-cli"
33
+ Repository = "https://github.com/YOUR_USERNAME/screener-cli"
34
+ "Bug Tracker" = "https://github.com/YOUR_USERNAME/screener-cli/issues"
35
+
36
+ [project.scripts]
37
+ screener = "screener_cli.cli:main"
38
+
39
+ [tool.setuptools.packages.find]
40
+ where = ["."]
41
+ include = ["screener_cli*"]
@@ -0,0 +1,3 @@
1
+ """screener_cli — CLI tool for scraping financial data from screener.in."""
2
+
3
+ __version__ = "0.1.0"