dalalos 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.
@@ -0,0 +1,5 @@
1
+ dist/
2
+ .venv*/
3
+ __pycache__/
4
+ *.egg-info/
5
+ .pytest_cache/
dalalos-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 DalalOS
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.
dalalos-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,208 @@
1
+ Metadata-Version: 2.5
2
+ Name: dalalos
3
+ Version: 0.1.0
4
+ Summary: Python client for DalalOS: NSE/BSE company financials, shareholding, filings, corporate actions, insider trades, FII/DII flows and end-of-day prices
5
+ Project-URL: Homepage, https://dalalos.in
6
+ Project-URL: Documentation, https://dalalos.in/docs/python-quickstart
7
+ Project-URL: Repository, https://github.com/BeyondNoww/DalalOS-Indian-Stock-Research
8
+ Project-URL: Pricing, https://dalalos.in/pricing
9
+ Author: DalalOS
10
+ License-Expression: MIT
11
+ License-File: LICENSE
12
+ Keywords: api,bse,financial statements,fundamentals,indian stock market,nse,shareholding
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Intended Audience :: Financial and Insurance Industry
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3 :: Only
19
+ Classifier: Programming Language :: Python :: 3.9
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Programming Language :: Python :: 3.13
24
+ Classifier: Programming Language :: Python :: 3.14
25
+ Classifier: Topic :: Office/Business :: Financial
26
+ Classifier: Topic :: Office/Business :: Financial :: Investment
27
+ Classifier: Typing :: Typed
28
+ Requires-Python: >=3.9
29
+ Requires-Dist: requests>=2.25
30
+ Provides-Extra: pandas
31
+ Requires-Dist: pandas>=1.3; extra == 'pandas'
32
+ Provides-Extra: test
33
+ Requires-Dist: pytest>=7; extra == 'test'
34
+ Description-Content-Type: text/markdown
35
+
36
+ # dalalos
37
+
38
+ Python client for DalalOS: NSE/BSE company financials, shareholding, filings, corporate actions, insider trades, FII/DII flows and end-of-day prices.
39
+
40
+ It wraps the DalalOS REST API (`https://mcp.dalalos.in/v1`). Every method returns the API's JSON unchanged, including `source`, `as_of`, `cached_at`, `stale` and the source links on each row, so you can cite where a figure came from and when.
41
+
42
+ - Get an API key (free tier, no card): https://dalalos.in/dashboard/keys
43
+ - REST reference: https://dalalos.in/docs/rest-api
44
+ - Python quickstart: https://dalalos.in/docs/python-quickstart
45
+ - Source and issues: https://github.com/BeyondNoww/DalalOS-Indian-Stock-Research/tree/main/python
46
+
47
+ ## Install
48
+
49
+ ```bash
50
+ pip install dalalos # needs only requests
51
+ pip install "dalalos[pandas]" # adds .to_frame()
52
+ ```
53
+
54
+ Python 3.9 or newer.
55
+
56
+ ## Example
57
+
58
+ ```python
59
+ from dalalos import Client
60
+
61
+ c = Client() # reads DALALOS_API_KEY; or Client(api_key="...")
62
+ r = c.financials("TCS", period_type="annual", from_fy=2024, to_fy=2026)
63
+ for p in r["data"]["periods"]:
64
+ print(p["fiscal_label"], p["income"]["revenue"], p["income"]["net_income"])
65
+ ```
66
+
67
+ Output (run on 6 Dec 2026; figures in rupees, from the company's BSE XBRL filings):
68
+
69
+ ```text
70
+ FY26 2670210000000.0 494540000000.0
71
+ FY25 2553240000000.0 487970000000.0
72
+ FY24 2408930000000.0 460990000000.0
73
+ ```
74
+
75
+ Each period also carries `source_document_url`, the filing the figures were read from, and the response carries `meta.history` (how far back this company's data goes) and `meta.credits_charged`.
76
+
77
+ `q` arguments take an NSE symbol, an ISIN or a BSE code. Some BSE-only companies have an empty `nse_symbol`; use their `isin` or `bse_code`.
78
+
79
+ ## Methods
80
+
81
+ | Method | REST route | Returns |
82
+ | --- | --- | --- |
83
+ | `search(q, limit)` | `GET /search` | Securities matching a name, NSE symbol, BSE code or ISIN |
84
+ | `resolve(q)` | `GET /search` | The first match as one dict (`isin`, `nse_symbol`, `bse_code`, `name`, `sector`) |
85
+ | `profile(q)` | `GET /stocks/{q}/profile` | Company identity, market data, business and management |
86
+ | `quote(q)` | `GET /stocks/{q}/quote` | Latest end-of-day price, volume, market cap, P/E, P/B, 52-week range |
87
+ | `quotes(symbols)` | `GET /quotes` | End-of-day quotes for up to 20 symbols |
88
+ | `price_history(q, days, adjusted, interval)` | `GET /stocks/{q}/price-history` | OHLCV bars with delivery %, VWAP, 50/200-day averages |
89
+ | `financials(q, period_type, limit, from_fy, to_fy, from_, to, statement_type)` | `GET /stocks/{q}/financials` | P&L, balance sheet, cash flow, TTM, margins, growth, segments |
90
+ | `annual_financials(q, ...)`, `quarterly_financials(q, ...)` | `GET /stocks/{q}/financials` | Same, with `period_type` set |
91
+ | `financial_versions(q, period_type, limit, statement_type, period_end)` | `GET /stocks/{q}/financials/versions` | Every stored version of a filing (original, revised, re-parsed) |
92
+ | `financial_changes(since, limit, revision_kind, after_id)` | `GET /changes/financials` | Filings stored since a time, across all companies |
93
+ | `ratios()` | `GET /ratios` | The metric registry used by the screener |
94
+ | `screen(sort_by, order, limit, **filters)` | `GET /screen` | Companies passing filters such as `pe_max=20`, `roe_min=0.15`, `sector="Information Technology"` |
95
+ | `screen_query(query, dialect, sort_by, order, limit, snapshot_id)` | `POST /screen/query` | Companies matching an expression such as `Return on capital employed > 22%` |
96
+ | `shareholding(q, limit, from_, to, from_fy, to_fy)` | `GET /stocks/{q}/shareholding` | Promoter, FII, DII and public holding by quarter, with BSE source links |
97
+ | `pledge_trend(q, limit)` | `GET /stocks/{q}/pledge-trend` | Promoter pledge by quarter |
98
+ | `events(q, days, from_, to, category, limit, cursor)` (alias `announcements`) | `GET /stocks/{q}/events` | BSE corporate announcements with the filing PDF link |
99
+ | `documents(q, days, from_, to, document_type, limit, cursor)` | `GET /stocks/{q}/documents` | Results, annual reports, presentations, call transcripts, by type |
100
+ | `corporate_actions(q, years, from_, to, types)` | `GET /stocks/{q}/corporate-actions` | Splits, bonuses, dividends, buybacks with ex-dates and source links |
101
+ | `dividends(q, years, from_, to)` | `GET /stocks/{q}/dividends` | Dividend history, trailing yield and payout |
102
+ | `insider_trades(symbol, days, from_, to, category, side, min_value_inr, include_derivatives, group_by, limit)` | `GET /insider-trades` | SEBI PIT insider buys, sells and pledges, market-wide or for one company |
103
+ | `bulk_block_deals(q, deal_type, exchange, days, from_date, to_date, cursor, limit)` | `GET /stocks/{q}/bulk-block-deals` | NSE and BSE bulk and block deals |
104
+ | `fii_dii(from_, to, segment)` | `GET /market-fii-dii-flow` | Daily FII and DII cash-market buy, sell and net (Rs crore) |
105
+ | `freshness()` | `GET /freshness` | When each dataset was last refreshed |
106
+ | `get(path, **params)`, `post(path, body)` | any `/v1` route | For routes without a named method, for example `c.get("/indices")` |
107
+
108
+ Python reserves `from`, so date ranges take `from_` and send it as `from`.
109
+
110
+ ### Paging
111
+
112
+ These iterators follow the API's cursor and yield one row at a time:
113
+
114
+ ```python
115
+ for e in c.iter_events("RELIANCE", from_="2024-01-01", to="2026-11-30"):
116
+ print(e["filed_at"], e["subject"])
117
+ ```
118
+
119
+ | Iterator | Follows |
120
+ | --- | --- |
121
+ | `iter_events(q, ...)` (alias `iter_announcements`) | `meta.next_cursor` |
122
+ | `iter_documents(q, ...)` | `meta.next_cursor` |
123
+ | `iter_bulk_block_deals(q, ...)` | `next_cursor` while `has_more` |
124
+ | `iter_financial_changes(since, ...)` | `next_since` and `next_after_id` while `has_more` |
125
+
126
+ On ranged events and documents, pages after the first cost no credit.
127
+
128
+ ### pandas
129
+
130
+ ```python
131
+ df = c.price_history("TCS", days=10).to_frame()
132
+ print(df[["date", "close", "volume"]].tail(3).to_string(index=False))
133
+ ```
134
+
135
+ ```text
136
+ date close volume
137
+ 2026-12-02 2522.3 3530115
138
+ 2026-12-03 2500.0 2581082
139
+ 2026-12-04 2546.0 3788761
140
+ ```
141
+
142
+ `to_frame()` picks the row list inside `data` (`bars`, `periods`, `results`, `events`, ...) and flattens nested fields, so financials give columns such as `income.revenue`. Pass `key=` to choose another list. `dalalos.to_frame(response)` does the same as a function.
143
+
144
+ ## More output (run on 6 Dec 2026)
145
+
146
+ ```python
147
+ r = c.quote("TCS")
148
+ print(r["data"]["price"], r["as_of"], r["source"])
149
+ # 2546.0 2026-12-04 nse-bhavcopy
150
+
151
+ for q in c.shareholding("TCS", limit=2)["data"]["periods"]:
152
+ print(q["period_end"], q["promoter_pct"], q["fii_pct"], q["dii_pct"], q["source_url"])
153
+ # 2026-09-30 71.77 9.01 13.57 https://www.bseindia.com/corporates/shpSecurities?scripcd=532540&qtrid=131.00
154
+ # 2026-06-30 71.77 9.06 13.47 https://www.bseindia.com/corporates/shpSecurities?scripcd=532540&qtrid=130.00
155
+
156
+ for d in c.fii_dii(from_="2026-12-03", to="2026-12-05")["data"]["results"]:
157
+ print(d["trade_date"], d["fii_net"], d["dii_net"])
158
+ # 2026-12-03 -1096.08 18.03
159
+ # 2026-12-04 -456.31 743.19
160
+
161
+ for a in c.corporate_actions("TCS", years=2)["data"]["actions"][:2]:
162
+ print(a["ex_date"], a["event_type"], a["sub_type"], a["amount"])
163
+ # 2026-10-14 dividend interim 12.0
164
+ # 2026-07-15 dividend interim 12.0
165
+ ```
166
+
167
+ ## Errors
168
+
169
+ Errors raise a typed exception carrying `status`, `reason_code`, the API's `message` and the parsed `body`:
170
+
171
+ | Status | Exception | Meaning |
172
+ | --- | --- | --- |
173
+ | 400 | `BadRequestError` | A parameter is wrong; the message names it |
174
+ | 401 | `AuthenticationError` | Key missing, mistyped or revoked |
175
+ | 402 | `QuotaExceededError` | Credits used up or too low; has `credits_needed`, `credits_remaining` |
176
+ | 403 | `PermissionDeniedError` | The plan does not include this route |
177
+ | 404 | `NotFoundError` | No company matches the symbol, ISIN or BSE code |
178
+ | 409 | `ConflictError` | For example `snapshot_expired` while paging a screen |
179
+ | 429 | `RateLimitError` | Too many requests; has `retry_after` from the `Retry-After` header |
180
+ | 5xx | `ServerError` | The service could not answer |
181
+
182
+ All inherit from `DalalOSError`. On 429 the client waits for `Retry-After` and retries up to `max_retries` times (default 2) before raising.
183
+
184
+ ```python
185
+ from dalalos import Client, NotFoundError
186
+
187
+ try:
188
+ Client().quote("ZZZNOTACOMPANY")
189
+ except NotFoundError as e:
190
+ print(e.status, e.reason_code) # 404 not_found
191
+ ```
192
+
193
+ ## Limits
194
+
195
+ - End-of-day prices and exchange filings. No live ticks, no intraday data, no order placement.
196
+ - Price history: `days` up to 1825 and at most 750 bars per call; a longer daily window comes back as weekly bars.
197
+ - Financials and shareholding ranges (`from_fy`/`to_fy` or `from_`/`to`) span at most 10 years. How far back data goes depends on the company: TCS annual figures start at FY22, for example. `meta.history` reports it.
198
+ - FII/DII: at most 366 days per call; data starts 2006-04-04.
199
+ - `screen` returns at most 100 rows; `quotes` takes at most 20 symbols.
200
+ - Each call uses credits; a ranged call can use more than one. The response reports `meta.credits_charged` where it applies. Credits per plan: https://dalalos.in/pricing
201
+
202
+ Showing data publicly needs Business+ and covers filings data only. See [display rights](https://dalalos.in/docs/display-rights).
203
+
204
+ Not investment advice. DalalOS returns reported facts and mechanically computed ratios; it does not issue buy or sell calls.
205
+
206
+ ## Licence
207
+
208
+ MIT. The client code is MIT licensed; the hosted service and the data it returns are governed by the DalalOS terms (https://dalalos.in/terms).
@@ -0,0 +1,173 @@
1
+ # dalalos
2
+
3
+ Python client for DalalOS: NSE/BSE company financials, shareholding, filings, corporate actions, insider trades, FII/DII flows and end-of-day prices.
4
+
5
+ It wraps the DalalOS REST API (`https://mcp.dalalos.in/v1`). Every method returns the API's JSON unchanged, including `source`, `as_of`, `cached_at`, `stale` and the source links on each row, so you can cite where a figure came from and when.
6
+
7
+ - Get an API key (free tier, no card): https://dalalos.in/dashboard/keys
8
+ - REST reference: https://dalalos.in/docs/rest-api
9
+ - Python quickstart: https://dalalos.in/docs/python-quickstart
10
+ - Source and issues: https://github.com/BeyondNoww/DalalOS-Indian-Stock-Research/tree/main/python
11
+
12
+ ## Install
13
+
14
+ ```bash
15
+ pip install dalalos # needs only requests
16
+ pip install "dalalos[pandas]" # adds .to_frame()
17
+ ```
18
+
19
+ Python 3.9 or newer.
20
+
21
+ ## Example
22
+
23
+ ```python
24
+ from dalalos import Client
25
+
26
+ c = Client() # reads DALALOS_API_KEY; or Client(api_key="...")
27
+ r = c.financials("TCS", period_type="annual", from_fy=2024, to_fy=2026)
28
+ for p in r["data"]["periods"]:
29
+ print(p["fiscal_label"], p["income"]["revenue"], p["income"]["net_income"])
30
+ ```
31
+
32
+ Output (run on 6 Dec 2026; figures in rupees, from the company's BSE XBRL filings):
33
+
34
+ ```text
35
+ FY26 2670210000000.0 494540000000.0
36
+ FY25 2553240000000.0 487970000000.0
37
+ FY24 2408930000000.0 460990000000.0
38
+ ```
39
+
40
+ Each period also carries `source_document_url`, the filing the figures were read from, and the response carries `meta.history` (how far back this company's data goes) and `meta.credits_charged`.
41
+
42
+ `q` arguments take an NSE symbol, an ISIN or a BSE code. Some BSE-only companies have an empty `nse_symbol`; use their `isin` or `bse_code`.
43
+
44
+ ## Methods
45
+
46
+ | Method | REST route | Returns |
47
+ | --- | --- | --- |
48
+ | `search(q, limit)` | `GET /search` | Securities matching a name, NSE symbol, BSE code or ISIN |
49
+ | `resolve(q)` | `GET /search` | The first match as one dict (`isin`, `nse_symbol`, `bse_code`, `name`, `sector`) |
50
+ | `profile(q)` | `GET /stocks/{q}/profile` | Company identity, market data, business and management |
51
+ | `quote(q)` | `GET /stocks/{q}/quote` | Latest end-of-day price, volume, market cap, P/E, P/B, 52-week range |
52
+ | `quotes(symbols)` | `GET /quotes` | End-of-day quotes for up to 20 symbols |
53
+ | `price_history(q, days, adjusted, interval)` | `GET /stocks/{q}/price-history` | OHLCV bars with delivery %, VWAP, 50/200-day averages |
54
+ | `financials(q, period_type, limit, from_fy, to_fy, from_, to, statement_type)` | `GET /stocks/{q}/financials` | P&L, balance sheet, cash flow, TTM, margins, growth, segments |
55
+ | `annual_financials(q, ...)`, `quarterly_financials(q, ...)` | `GET /stocks/{q}/financials` | Same, with `period_type` set |
56
+ | `financial_versions(q, period_type, limit, statement_type, period_end)` | `GET /stocks/{q}/financials/versions` | Every stored version of a filing (original, revised, re-parsed) |
57
+ | `financial_changes(since, limit, revision_kind, after_id)` | `GET /changes/financials` | Filings stored since a time, across all companies |
58
+ | `ratios()` | `GET /ratios` | The metric registry used by the screener |
59
+ | `screen(sort_by, order, limit, **filters)` | `GET /screen` | Companies passing filters such as `pe_max=20`, `roe_min=0.15`, `sector="Information Technology"` |
60
+ | `screen_query(query, dialect, sort_by, order, limit, snapshot_id)` | `POST /screen/query` | Companies matching an expression such as `Return on capital employed > 22%` |
61
+ | `shareholding(q, limit, from_, to, from_fy, to_fy)` | `GET /stocks/{q}/shareholding` | Promoter, FII, DII and public holding by quarter, with BSE source links |
62
+ | `pledge_trend(q, limit)` | `GET /stocks/{q}/pledge-trend` | Promoter pledge by quarter |
63
+ | `events(q, days, from_, to, category, limit, cursor)` (alias `announcements`) | `GET /stocks/{q}/events` | BSE corporate announcements with the filing PDF link |
64
+ | `documents(q, days, from_, to, document_type, limit, cursor)` | `GET /stocks/{q}/documents` | Results, annual reports, presentations, call transcripts, by type |
65
+ | `corporate_actions(q, years, from_, to, types)` | `GET /stocks/{q}/corporate-actions` | Splits, bonuses, dividends, buybacks with ex-dates and source links |
66
+ | `dividends(q, years, from_, to)` | `GET /stocks/{q}/dividends` | Dividend history, trailing yield and payout |
67
+ | `insider_trades(symbol, days, from_, to, category, side, min_value_inr, include_derivatives, group_by, limit)` | `GET /insider-trades` | SEBI PIT insider buys, sells and pledges, market-wide or for one company |
68
+ | `bulk_block_deals(q, deal_type, exchange, days, from_date, to_date, cursor, limit)` | `GET /stocks/{q}/bulk-block-deals` | NSE and BSE bulk and block deals |
69
+ | `fii_dii(from_, to, segment)` | `GET /market-fii-dii-flow` | Daily FII and DII cash-market buy, sell and net (Rs crore) |
70
+ | `freshness()` | `GET /freshness` | When each dataset was last refreshed |
71
+ | `get(path, **params)`, `post(path, body)` | any `/v1` route | For routes without a named method, for example `c.get("/indices")` |
72
+
73
+ Python reserves `from`, so date ranges take `from_` and send it as `from`.
74
+
75
+ ### Paging
76
+
77
+ These iterators follow the API's cursor and yield one row at a time:
78
+
79
+ ```python
80
+ for e in c.iter_events("RELIANCE", from_="2024-01-01", to="2026-11-30"):
81
+ print(e["filed_at"], e["subject"])
82
+ ```
83
+
84
+ | Iterator | Follows |
85
+ | --- | --- |
86
+ | `iter_events(q, ...)` (alias `iter_announcements`) | `meta.next_cursor` |
87
+ | `iter_documents(q, ...)` | `meta.next_cursor` |
88
+ | `iter_bulk_block_deals(q, ...)` | `next_cursor` while `has_more` |
89
+ | `iter_financial_changes(since, ...)` | `next_since` and `next_after_id` while `has_more` |
90
+
91
+ On ranged events and documents, pages after the first cost no credit.
92
+
93
+ ### pandas
94
+
95
+ ```python
96
+ df = c.price_history("TCS", days=10).to_frame()
97
+ print(df[["date", "close", "volume"]].tail(3).to_string(index=False))
98
+ ```
99
+
100
+ ```text
101
+ date close volume
102
+ 2026-12-02 2522.3 3530115
103
+ 2026-12-03 2500.0 2581082
104
+ 2026-12-04 2546.0 3788761
105
+ ```
106
+
107
+ `to_frame()` picks the row list inside `data` (`bars`, `periods`, `results`, `events`, ...) and flattens nested fields, so financials give columns such as `income.revenue`. Pass `key=` to choose another list. `dalalos.to_frame(response)` does the same as a function.
108
+
109
+ ## More output (run on 6 Dec 2026)
110
+
111
+ ```python
112
+ r = c.quote("TCS")
113
+ print(r["data"]["price"], r["as_of"], r["source"])
114
+ # 2546.0 2026-12-04 nse-bhavcopy
115
+
116
+ for q in c.shareholding("TCS", limit=2)["data"]["periods"]:
117
+ print(q["period_end"], q["promoter_pct"], q["fii_pct"], q["dii_pct"], q["source_url"])
118
+ # 2026-09-30 71.77 9.01 13.57 https://www.bseindia.com/corporates/shpSecurities?scripcd=532540&qtrid=131.00
119
+ # 2026-06-30 71.77 9.06 13.47 https://www.bseindia.com/corporates/shpSecurities?scripcd=532540&qtrid=130.00
120
+
121
+ for d in c.fii_dii(from_="2026-12-03", to="2026-12-05")["data"]["results"]:
122
+ print(d["trade_date"], d["fii_net"], d["dii_net"])
123
+ # 2026-12-03 -1096.08 18.03
124
+ # 2026-12-04 -456.31 743.19
125
+
126
+ for a in c.corporate_actions("TCS", years=2)["data"]["actions"][:2]:
127
+ print(a["ex_date"], a["event_type"], a["sub_type"], a["amount"])
128
+ # 2026-10-14 dividend interim 12.0
129
+ # 2026-07-15 dividend interim 12.0
130
+ ```
131
+
132
+ ## Errors
133
+
134
+ Errors raise a typed exception carrying `status`, `reason_code`, the API's `message` and the parsed `body`:
135
+
136
+ | Status | Exception | Meaning |
137
+ | --- | --- | --- |
138
+ | 400 | `BadRequestError` | A parameter is wrong; the message names it |
139
+ | 401 | `AuthenticationError` | Key missing, mistyped or revoked |
140
+ | 402 | `QuotaExceededError` | Credits used up or too low; has `credits_needed`, `credits_remaining` |
141
+ | 403 | `PermissionDeniedError` | The plan does not include this route |
142
+ | 404 | `NotFoundError` | No company matches the symbol, ISIN or BSE code |
143
+ | 409 | `ConflictError` | For example `snapshot_expired` while paging a screen |
144
+ | 429 | `RateLimitError` | Too many requests; has `retry_after` from the `Retry-After` header |
145
+ | 5xx | `ServerError` | The service could not answer |
146
+
147
+ All inherit from `DalalOSError`. On 429 the client waits for `Retry-After` and retries up to `max_retries` times (default 2) before raising.
148
+
149
+ ```python
150
+ from dalalos import Client, NotFoundError
151
+
152
+ try:
153
+ Client().quote("ZZZNOTACOMPANY")
154
+ except NotFoundError as e:
155
+ print(e.status, e.reason_code) # 404 not_found
156
+ ```
157
+
158
+ ## Limits
159
+
160
+ - End-of-day prices and exchange filings. No live ticks, no intraday data, no order placement.
161
+ - Price history: `days` up to 1825 and at most 750 bars per call; a longer daily window comes back as weekly bars.
162
+ - Financials and shareholding ranges (`from_fy`/`to_fy` or `from_`/`to`) span at most 10 years. How far back data goes depends on the company: TCS annual figures start at FY22, for example. `meta.history` reports it.
163
+ - FII/DII: at most 366 days per call; data starts 2006-04-04.
164
+ - `screen` returns at most 100 rows; `quotes` takes at most 20 symbols.
165
+ - Each call uses credits; a ranged call can use more than one. The response reports `meta.credits_charged` where it applies. Credits per plan: https://dalalos.in/pricing
166
+
167
+ Showing data publicly needs Business+ and covers filings data only. See [display rights](https://dalalos.in/docs/display-rights).
168
+
169
+ Not investment advice. DalalOS returns reported facts and mechanically computed ratios; it does not issue buy or sell calls.
170
+
171
+ ## Licence
172
+
173
+ MIT. The client code is MIT licensed; the hosted service and the data it returns are governed by the DalalOS terms (https://dalalos.in/terms).
@@ -0,0 +1,57 @@
1
+ # Testing
2
+
3
+ Two suites live in `tests/`:
4
+
5
+ - `test_client.py`: 47 unit tests with a fake `requests` session. They check that each method calls the right route with the right parameter names, that the response body is returned unchanged, the typed exceptions for 400/401/402/403/404/409/429/5xx, `Retry-After` handling on 429, the cursor iterators and `to_frame()`. No network.
6
+ - `test_live.py`: 26 smoke tests against `https://mcp.dalalos.in/v1`, skipped unless `DALALOS_API_KEY` is set. The whole file uses about 30 credits.
7
+
8
+ ```bash
9
+ pip install -e ".[pandas,test]"
10
+ pytest tests/test_client.py
11
+ DALALOS_API_KEY=... pytest tests/test_live.py -v
12
+ ```
13
+
14
+ ## Live run, 6 Dec 2026
15
+
16
+ Run twice: from the source tree (Python 3.9.25), then from the built wheel `dalalos-0.1.0-py3-none-any.whl` installed in a fresh Python 3.9.25 virtual environment. Both runs: 73 passed (47 unit, 26 live).
17
+
18
+ | Method | Live call | Result |
19
+ | --- | --- | --- |
20
+ | `search` | `search("tata consultancy", limit=3)` | TCS returned (ISIN INE467B01029, BSE 532540) |
21
+ | `resolve` | `resolve("TCS")` | One dict with `isin` and `bse_code` |
22
+ | `quote` | `quote("TCS")` | Price 2546.0, `as_of` 2026-12-04, source `nse-bhavcopy` |
23
+ | `quote` (BSE-only) | `quote("543895")` | Quote by BSE code; `nse_symbol` empty |
24
+ | `quotes` | `quotes(["TCS", "INFY"])` | Two rows, one per symbol |
25
+ | `profile` | `profile("INFY")` | `identity`, `market`, `fundamentals`, ... |
26
+ | `financials` (annual, range) | `financials("TCS", period_type="annual", from_fy=2024, to_fy=2026)` | FY26, FY25, FY24 with `source_document_url`; `meta.credits_charged` 2. With `from_fy=2022` the history note says TCS data starts 2022-03-31 |
27
+ | `quarterly_financials` | `quarterly_financials("INFY", limit=2)` | Two quarterly periods |
28
+ | `financial_versions` | `financial_versions("TCS", period_type="annual", limit=2)` | `versions` list |
29
+ | `financial_changes` | `financial_changes(since=<7 days ago>, limit=2)` | `changes`, `has_more`, `next_since`, `next_after_id` |
30
+ | `iter_financial_changes` | first 3 rows, `limit=2` | 3 distinct `version_id`s across 2 pages |
31
+ | `ratios` | `ratios()` | Metric registry with more than 10 metrics |
32
+ | `screen` | `screen(sector="Information Technology", roe_min=0.25, limit=3)` | TCS, INFY, OFSS; 20 matches |
33
+ | `screen_query` | `screen_query("Return on capital employed > 22% AND Market Capitalization > 500", limit=3)` | 3 rows, `pagination.snapshot_id` set |
34
+ | `shareholding` | `shareholding("TCS", limit=2)` | 2026-09-30: promoter 71.77, FII 9.01, DII 13.57, BSE `source_url` |
35
+ | `pledge_trend` | `pledge_trend("TCS", limit=2)` | Two periods |
36
+ | `events` | `events("RELIANCE", days=30, limit=3)` | `events` list, `meta.next_cursor` set |
37
+ | `iter_events` | first 5 rows, `days=60, limit=3` | 5 distinct `news_id`s across 2 pages |
38
+ | `documents` | `documents("RELIANCE", document_type="annual_report", limit=2)` | Every row has `source_url` |
39
+ | `iter_documents` | first 3 rows, `days=120, limit=2` | 3 rows across 2 pages |
40
+ | `corporate_actions` | `corporate_actions("TCS", years=3)` | Dividends with `ex_date` and BSE `source_url` |
41
+ | `dividends` | `dividends("TCS", years=2)` | `dividends`, `annual_totals`, `dividend_yield` |
42
+ | `insider_trades` | `insider_trades(days=30, limit=3)` | `results`, `from_date`, `total_matched` |
43
+ | `bulk_block_deals` | `bulk_block_deals("RELIANCE", exchange="all", days=1825, limit=2)` | Two deals, `has_more` true, `next_cursor` set |
44
+ | `iter_bulk_block_deals` | first 3 rows, `limit=2` | 3 rows across 2 pages |
45
+ | `fii_dii` | `fii_dii(from_="2026-11-24", to="2026-12-05")` | Daily rows with `fii_net`, `dii_net` |
46
+ | `price_history` + `to_frame()` | `price_history("TCS", days=10)` | 7 daily bars; DataFrame with `close` |
47
+ | `price_history` (long) | `price_history("TCS", days=1825)` | `interval` weekly, 261 bars, `resampled_reason` set |
48
+ | `freshness` | `freshness()` | Dataset refresh status |
49
+ | `NotFoundError` | `quote("ZZZNOTACOMPANY")` | 404 `not_found` raised |
50
+ | `AuthenticationError` | `quote` with an invalid key | 401 raised |
51
+
52
+ ## Not covered live
53
+
54
+ - `post()` and `get()` with routes other than those above (covered by unit tests).
55
+ - `RateLimitError`, `QuotaExceededError`, `PermissionDeniedError`, `ConflictError` and `ServerError`: unit tests only, since triggering them live would spend credits or need another plan.
56
+ - `screen_query` paging with `snapshot_id` across a refresh (409 `snapshot_expired`).
57
+ - Ranged `iter_events` / `iter_documents` over several years (costs more credits); the cursor logic is the same as the trailing-window run above.
@@ -0,0 +1,52 @@
1
+ [build-system]
2
+ requires = ["hatchling>=1.21"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "dalalos"
7
+ version = "0.1.0"
8
+ description = "Python client for DalalOS: NSE/BSE company financials, shareholding, filings, corporate actions, insider trades, FII/DII flows and end-of-day prices"
9
+ readme = "README.md"
10
+ requires-python = ">=3.9"
11
+ license = "MIT"
12
+ license-files = ["LICENSE"]
13
+ authors = [{ name = "DalalOS" }]
14
+ keywords = ["nse", "bse", "indian stock market", "fundamentals", "financial statements", "shareholding", "api"]
15
+ classifiers = [
16
+ "Development Status :: 4 - Beta",
17
+ "Intended Audience :: Developers",
18
+ "Intended Audience :: Financial and Insurance Industry",
19
+ "Operating System :: OS Independent",
20
+ "Programming Language :: Python :: 3",
21
+ "Programming Language :: Python :: 3 :: Only",
22
+ "Programming Language :: Python :: 3.9",
23
+ "Programming Language :: Python :: 3.10",
24
+ "Programming Language :: Python :: 3.11",
25
+ "Programming Language :: Python :: 3.12",
26
+ "Programming Language :: Python :: 3.13",
27
+ "Programming Language :: Python :: 3.14",
28
+ "Topic :: Office/Business :: Financial",
29
+ "Topic :: Office/Business :: Financial :: Investment",
30
+ "Typing :: Typed",
31
+ ]
32
+ dependencies = ["requests>=2.25"]
33
+
34
+ [project.optional-dependencies]
35
+ pandas = ["pandas>=1.3"]
36
+ test = ["pytest>=7"]
37
+
38
+ [project.urls]
39
+ Homepage = "https://dalalos.in"
40
+ Documentation = "https://dalalos.in/docs/python-quickstart"
41
+ Repository = "https://github.com/BeyondNoww/DalalOS-Indian-Stock-Research"
42
+ Pricing = "https://dalalos.in/pricing"
43
+
44
+ [tool.hatch.build.targets.wheel]
45
+ packages = ["src/dalalos"]
46
+
47
+ [tool.hatch.build.targets.sdist]
48
+ include = ["src/dalalos", "tests", "README.md", "LICENSE", "TESTING.md", "pyproject.toml"]
49
+
50
+ [tool.pytest.ini_options]
51
+ testpaths = ["tests"]
52
+ markers = ["live: calls the real API; needs DALALOS_API_KEY"]
@@ -0,0 +1,39 @@
1
+ """Python client for DalalOS: NSE/BSE company financials, shareholding, filings,
2
+ corporate actions, insider trades, FII/DII flows and end-of-day prices.
3
+
4
+ from dalalos import Client
5
+ c = Client() # reads DALALOS_API_KEY
6
+ c.quote("RELIANCE")
7
+ """
8
+
9
+ from ._version import __version__
10
+ from .client import DEFAULT_BASE_URL, Client
11
+ from .errors import (
12
+ AuthenticationError,
13
+ BadRequestError,
14
+ ConflictError,
15
+ DalalOSError,
16
+ NotFoundError,
17
+ PermissionDeniedError,
18
+ QuotaExceededError,
19
+ RateLimitError,
20
+ ServerError,
21
+ )
22
+ from .response import Response, to_frame
23
+
24
+ __all__ = [
25
+ "__version__",
26
+ "Client",
27
+ "DEFAULT_BASE_URL",
28
+ "Response",
29
+ "to_frame",
30
+ "DalalOSError",
31
+ "BadRequestError",
32
+ "AuthenticationError",
33
+ "QuotaExceededError",
34
+ "PermissionDeniedError",
35
+ "NotFoundError",
36
+ "ConflictError",
37
+ "RateLimitError",
38
+ "ServerError",
39
+ ]
@@ -0,0 +1 @@
1
+ __version__ = "0.1.0"