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 |
Full interactive documentation:
http://localhost:8000/docs