Metadata-Version: 2.4
Name: jugaad-xbrl
Version: 0.1.0
Summary: Parse NSE Integrated Filing (quarterly financial results) XBRL files
License: YOLO LICENSE
                                     Version 2, July 29 2016
        
        THIS SOFTWARE LICENSE IS PROVIDED "ALL CAPS" SO THAT YOU KNOW IT IS SUPER
        SERIOUS AND YOU DON'T MESS AROUND WITH COPYRIGHT LAW BECAUSE YOU WILL GET IN
        TROUBLE HERE ARE SOME OTHER BUZZWORDS COMMONLY IN THESE THINGS WARRANTIES
        LIABILITY CONTRACT TORT LIABLE CLAIMS RESTRICTION MERCHANTABILITY. NOW HERE'S
        THE REAL LICENSE:
        
        0. jugaad-xbrl is in public domain.
        1. Do whatever you want with it.
        2. Stop emailing me about it!
Project-URL: Repository, https://github.com/jugaad-py/jugaad-xbrl
Project-URL: Issues, https://github.com/jugaad-py/jugaad-xbrl/issues
Keywords: NSE,XBRL,SEBI,financial results,India,stocks
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Office/Business :: Financial
Classifier: Intended Audience :: Financial and Insurance Industry
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pyyaml
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Requires-Dist: openpyxl; extra == "dev"
Requires-Dist: build; extra == "dev"
Requires-Dist: twine; extra == "dev"
Dynamic: license-file

# jugaad-xbrl

Parse the XBRL filings that Indian listed companies publish on NSE for their quarterly financial results (the SEBI "Integrated Filing – Financials").

- Reads the machine-readable `xbrl` XML, from a path, raw bytes or a file object.
- Handles all six filing formats: Ind AS, NBFC (Ind AS), Banking, Life Insurance, General Insurance and Other than Bank.
- Joins the facts with the SEBI taxonomy, so you get labelled statements and not just flat elements.
- Offers cross-format fields (`net_profit`, `eps_basic`, ...) that mean the same thing for a bank, an insurer and an IT company.

## Install

```
pip install jugaad-xbrl
```

Python 3.9 or newer. The only runtime dependency is PyYAML.

## Usage

```python
from jugaad_xbrl import parse

f = parse("INTEGRATED_FILING_INDAS_..._WEB.xml")   # path, bytes, or binary file object
f.format                  # "indas"
f.reporting_period        # 2026-07-01..2026-09-30

# Cross-format fields. Values are absolute rupees, EPS is rupees per share,
# and None means this format does not file that field.
c = f.canonical()
c.net_profit, c.eps_basic, c.total_assets

# Any raw taxonomy concept for the current reporting period
f.get("ProfitLossForPeriod")

# Labelled statements, with the taxonomy's tree and ordering
stmt = f.statement("100200")          # results; also by role id
for depth, item in stmt.walk():
    print("  " * depth, item.label, item.values)
stmt.rows                             # dimensional rows (segments, related-party transactions, ...)

# Everything in the file, unmodified
f.facts                               # Fact(concept, value, context, unit, decimals)
```

In-memory use works the same way:

```python
import httpx
f = parse(httpx.get(url).content)
```

## Things to know

- **Formats use different element names.** For example, net profit is `ProfitLossForPeriod` (Ind AS, NBFC), `ProfitLossForThePeriod` (Banking), `ProfitLossAfterTaxAndExtraordinaryItems` (Life) and `ProfitLossAfterTax` (General). The canonical layer hides this. `jugaad_xbrl/specs/canonical/*.yaml` holds the mappings.
- **Standalone and consolidated are separate filings.** Parse each file on its own. The format is detected from the file.
- **Units.** Monetary values are always absolute rupees, whatever rounding the filer chose. Ratios are fractions (`0.0111` is 1.11%).
- **Filers sometimes use the wrong field.** Check the `...ExplanatoryTextBlock` facts when a number looks odd. The reader keeps them.
- **Taxonomy lag.** Live filings use the 2026-01-31 taxonomy, but NSE only publishes the 2025-01-31 zips. A few concepts, such as `DescriptionOfOther…`, are therefore unlabelled. Their facts are still returned.
- The `other_than_bank` canonical mapping is unverified, as no sample filing was available.

## Development

```
python3 -m venv .venv && .venv/bin/pip install -U pip && .venv/bin/pip install -e ".[dev]"
bash download_specs.sh                        # raw taxonomies and sample filings into ./specs (git-ignored)
.venv/bin/python tools/build_taxonomy.py      # regenerate jugaad_xbrl/specs/taxonomy/*.json
.venv/bin/python -m pytest -q tests
```

The taxonomy JSON is generated from NSE's native linkbase files and cross-checked in tests against the xlsx that ships in each taxonomy zip. See `AGENTS.md` for the code layout and `nse_integrated_filing_xbrl.md` for the filing format reference.

Not affiliated with NSE or SEBI.
