Thinking global, living local

How to use india-trade-tracker: India chapter-wise exports and imports from official DGFT data

October 19, 2026

A free, chapter-level (2-digit HS) view of India's merchandise exports and imports from the official Export-Import Data Bank, plus World Bank, NIRYAT and UN Comtrade collectors, stored in DuckDB.

Open-Source Tools · How-To · Agri & trade trackers

How to use india-trade-tracker: India chapter-wise exports and imports from official DGFT data

Skip to article content
Text Size

Revised · v1.0.0 · what changed

17tests passed in the demo
97HS chapters per flow per financial year in the committed snapshot
US$ 441.4 bnFY2025-26 exports, sum of chapters
US$ 775.7 bnFY2025-26 imports, sum of chapters

Code: github.com/herrrickshaw/india-trade-tracker

Watch the walkthrough

Watch on YouTube: youtu.be/NY4CgXgSsT0

Why it is useful

  • Exporters, policy students and analysts who want India's trade by product group without a paid vendor get a chapter-by-chapter table straight from the government's own data bank.
  • It replaces repeated manual downloads from a JavaScript-heavy website: a Selenium collector handles the form and stores each pull in DuckDB with the pull date.
  • The committed CSV snapshot already holds two financial years for both flows, so the demo ran with no browser and no network: 17 tests passed and the queries below took seconds.
  • Evidence from the run: summing the chapters reproduced the official FY2024-25 totals the README cites (about US$ 438 bn exports, about US$ 721 bn imports).

What it is for

india-trade-tracker collects India's annual merchandise exports and imports by 2-digit HS chapter (US$ million, current and previous year, growth percent) from the DGFT / Department of Commerce Export-Import Data Bank, using headless Chrome because the site is JS-rendered.

It also pulls a World Bank trade indicator panel, bilateral monthly data and HS8 detail from the NIRYAT portal, and India chapter totals from the UN Comtrade public preview API.

Who it is for

  • Students and researchers studying India's trade structure
  • Exporters and consultants scanning which chapters are growing or shrinking
  • Developers building trade dashboards
Not for.
  • Legal or customs-classification advice: this is not legal advice and not an official customs reference
  • Shipment-level or company-level data (it is chapter totals, not bills of lading)
  • Investment decisions: not investment advice

What you need

RequirementWhyHow to get it
Python 3 with duckdb and selenium (pytest for tests)requirements.txt lists duckdb and seleniumpip install -r requirements.txt
Google Chrome (only for live EIDB collection)The EIDB site is JS-rendered, so the collector drives headless ChromeInstall Chrome; Selenium 4 fetches chromedriver itself. Not needed for the snapshot, the tests or the NIRYAT collectors
A terminal and gitTo clone and runTerminal on macOS/Linux, or Git Bash/WSL on Windows
No API keys or accountsAll sources are openNone needed

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/india-trade-tracker.git
cd india-trade-tracker
claude      # or: gemini

Install

  1. Clone and enter the repo
    git clone https://github.com/herrrickshaw/india-trade-tracker.git
    cd india-trade-tracker
  2. Create a virtual environment and install dependencies
    python3 -m venv .venv && source .venv/bin/activate
    pip install -r requirements.txt pytest

Quick start: commands and what you should see

Run the test suite (no browser or network needed)

python -m pytest -q

17 passed in about 1.5 seconds.

Pull a financial year live from EIDB (needs Chrome and network; not run in this demo)

python3 collectors/eidb_trade.py --year 2024

Chapter rows for exports and imports are written to data/trade.duckdb.

Query the committed snapshot with DuckDB

python3 -c "import duckdb; print(duckdb.sql(\"select flow, fy_start, count(*) chapters, round(sum(cur_year_usd_mn)) usd_mn from read_csv_auto('data/eidb_chapter_trade_snapshot.csv') group by all order by 1,2\"))"

Four rows (exports and imports for two financial years), 97 chapters each.

Sample outputs

Real output from a run on the date shown in the sources line; trimmed to fit.

Totals by flow and financial year (sum of chapters, US$ million)

group the snapshot by flow, fy_start
flow     fy_start  chapters  usd_mn
exports  2024      97        437,685
exports  2025      97        441,427
imports  2024      97        721,174
imports  2025      97        775,689

Implied balance: FY2024-25 -283,489; FY2025-26 -334,262

fy_start 2024 means FY2024-25. FY2024-25 was pulled 21 Jul 2026 and FY2025-26 on 15 Sep 2026.

Top export chapters, FY2025-26 (US$ million)

flow='exports', fy_start=2025, order by cur_year_usd_mn desc
27 Mineral fuels, oils         55,871  (-16.7%)
85 Electrical machinery        53,976  (+22.5%)
84 Nuclear reactors, machinery 36,630  (+9.4%)
71 Pearls, precious stones     28,344  (-5.4%)
87 Vehicles (non-rail)         25,973  (+14.7%)

Growth is versus FY2024-25, as reported by the source.

Top import chapters, FY2025-26 (US$ million)

flow='imports', fy_start=2025, order by cur_year_usd_mn desc
27 Mineral fuels, oils         203,416 (-6.9%)
71 Pearls, precious stones     109,429 (+23.0%)
85 Electrical machinery        104,825 (+18.3%)
84 Nuclear reactors, machinery  74,002 (+15.1%)
29 Organic chemicals            25,411 (-4.4%)

Mineral fuels is the largest line on both sides of the ledger.

Ways to use it

MethodHow it works
Command line collectorsRun collectors/eidb_trade.py for EIDB, worldbank_trade.py, niryat_bilateral.py, niryat_hs8.py or comtrade_chapters.py; each writes to data/trade.duckdb.
SQL on the CSV snapshotsRead the committed CSVs under data/ directly with DuckDB or pandas.
Colab notebookThe README links a Colab notebook for a no-install try-out.
Through an AI assistantOpen the cloned folder in Claude Code or Gemini CLI and ask for tables or charts in plain English, or upload README.md and the snapshot CSV to a chat assistant.

Sample prompts for your AI assistant

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

  • Explain this repository in plain English: what trade data does it collect and from where?
  • From data/eidb_chapter_trade_snapshot.csv, list the five fastest-growing import chapters in FY2025-26 with value above US$ 5 billion.
  • Build a trade-balance-by-chapter table for FY2025-26 by joining exports and imports on hs_code, and chart the biggest deficits.
  • Read README.md and tell me what each collector needs (Chrome, network, keys) and which ones I can run without a browser.
  • Compare the chapter totals in the snapshot with the World Bank trade indicators and explain any differences in definition.

Limits and honest caveats

  • Not legal advice and not an official statistic; figures are as published by the Department of Commerce data bank and may be revised.
  • I did not run the live EIDB collector (needs Chrome and network). Outputs shown come from the committed snapshot and the test suite, run 19 Oct 2026.
  • The snapshot holds only two financial years (FY2024-25 and FY2025-26) at 2-digit chapter level; the FY2025-26 pull was made on 15 Sep 2026, so check how complete that year is before relying on it.
  • Chapter totals are annual; monthly series and 4/6/8-digit drill-down are on the README roadmap. NIRYAT HS8 data exists but is limited to a few partner countries.
  • The NIRYAT collector disables TLS verification because of a certificate mismatch on that site, per the README; understand that trade-off before using it.
  • The 'sum of chapters' totals are my aggregation of the committed rows.

Sources: the india-trade-tracker README, tests and data/eidb_chapter_trade_snapshot.csv; pytest and DuckDB queries run on 19 October 2026 on a fresh clone.

Revision history.
  • v1.0.0 — 19 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.