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

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