API Reference
The TradeEntry backend exposes a REST API at http://localhost:8000/api.
Interactive docs are available at http://localhost:8000/docs (Swagger UI) and http://localhost:8000/redoc.
Bhav Downloader
Base path: /api/bhav-downloader
POST /download
Trigger a background bhav copy download.
Query Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
date | string (YYYY-MM-DD) | null | Specific date to force-download |
testing_mode | boolean | false | If true, single-date mode |
Response:
{ "success": true, "message": "Full bhav copy sync started in background." }
GET /status
Returns real-time download status from stats.json.
Response:
{
"success": true,
"status": "RUNNING",
"progress": 45,
"last_log": "Downloading equity bhav for 2025-01-14...",
"logs": [ ... ],
"history": [ ... ]
}
GET /last-update
Returns the most recent synced dates for equity and F&O.
Response:
{
"success": true,
"last_updated": "2025-01-14",
"last_equity": "2025-01-14",
"last_fo": "2025-01-14",
"next_trading_date": "2025-01-15"
}
GET /ami-files
List all AmiBroker export files.
Response:
{
"success": true,
"count": 120,
"env": "LOCAL",
"path": "C:/ami-data",
"files": [
{ "name": "20250114.txt", "date": "2025-01-14", "size": 204800, "size_kb": 200.0 }
]
}
GET /ami-file/{filename}
Download a single AMI file. Filename must match YYYYMMDD.txt.
POST /ami-download
Download one or more AMI files. Single file returns text/plain; multiple returns a ZIP archive.
Request Body:
{ "files": ["20250114.txt", "20250115.txt"] }
Stocks
Base path: /api
| Endpoint | Description |
|---|---|
GET /stocks | Search symbols with optional segment filter |
GET /chart-data | OHLCV data for equity charts |
GET /market-summary | Market breadth and index data |
F&O
| Endpoint | Description |
|---|---|
GET /fo-expiries | Available expiry dates for a symbol |
GET /fo-strikes | Strike prices for symbol + expiry + type |
GET /fo-data | OHLCV data for F&O contracts |
GET /option-chain/chain | Full option chain for symbol + expiry |
IEOD Options
Base path: /api/ieod-options. Options-only sibling of /api/ieod-spotfut (SPOT/FUT) — see
backend/app/api/ieod_options.py. Wraps nseieod.nseIEOD.Con_Price_Getter for 1-minute
historical CE/PE contract bars; kept as a separate router rather than merged into
ieod-spotfut. Full parameter reference: API — External Partners.
| Endpoint | Description |
|---|---|
GET /tickers | Root underlyings with option IEOD data |
GET /range | Earliest/latest bar for a resolved contract (ticker+opttype+expiry+strike+dates) |
GET /preview | Capped on-page row preview |
GET /download | Full CSV for the range |
MCX Chart
Base path: /api/mcx-chart. Read-only data-serving for EOD Chart's Exchange=MCX path —
kept separate from /api/mcx-downloader (sync/AMI management only). See
backend/app/api/mcx_chart.py. Daily bars only (MCX EOD has no intraday staging table).
| Endpoint | Description |
|---|---|
GET /spot-symbols | MCX spot symbols (scr_mcx_master typ=20) — also the FUT/OPT underlying picker |
GET /spot-chart | Daily OHLC for one spot instrument (scr_mcxsp_eod) |
GET /expiries | Dated expiries for an underlying's FUT or OPT contracts |
GET /strikes | Strikes for an underlying/expiry/option-type (OPT) |
GET /contract | Resolve one FUT/OPT contract's masid (expiry_date=CONTINUOUS for the rolling near-month FUT) |
GET /fo-chart | Daily OHLCV+OI for one resolved FUT/OPT masid (scr_mcxfo_eod) |
Full interactive documentation:
http://localhost:8000/docs