Skip to main content

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:

ParameterTypeDefaultDescription
datestring (YYYY-MM-DD)nullSpecific date to force-download
testing_modebooleanfalseIf 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

EndpointDescription
GET /stocksSearch symbols with optional segment filter
GET /chart-dataOHLCV data for equity charts
GET /market-summaryMarket breadth and index data

F&O​

EndpointDescription
GET /fo-expiriesAvailable expiry dates for a symbol
GET /fo-strikesStrike prices for symbol + expiry + type
GET /fo-dataOHLCV data for F&O contracts
GET /option-chain/chainFull 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.

EndpointDescription
GET /tickersRoot underlyings with option IEOD data
GET /rangeEarliest/latest bar for a resolved contract (ticker+opttype+expiry+strike+dates)
GET /previewCapped on-page row preview
GET /downloadFull 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).

EndpointDescription
GET /spot-symbolsMCX spot symbols (scr_mcx_master typ=20) — also the FUT/OPT underlying picker
GET /spot-chartDaily OHLC for one spot instrument (scr_mcxsp_eod)
GET /expiriesDated expiries for an underlying's FUT or OPT contracts
GET /strikesStrikes for an underlying/expiry/option-type (OPT)
GET /contractResolve one FUT/OPT contract's masid (expiry_date=CONTINUOUS for the rolling near-month FUT)
GET /fo-chartDaily OHLCV+OI for one resolved FUT/OPT masid (scr_mcxfo_eod)

Full interactive documentation: http://localhost:8000/docs