API Guide — External Options-Simulator Team
This is the only access surface given to the outsourced team building/testing an options
simulator against TradeEntry's price data — no VPS/SSH credentials, no direct database access,
no repo access. Everything below is a normal HTTPS API call against https://tradeentry.in.
See User System Design for how the underlying rank/auth system works, and API Reference for the full internal endpoint list — this page is the external-audience subset of that, framed for onboarding rather than as a reference table.
1. Getting an account
- Register normally at
https://www.tradeentry.in(email/mobile, whatever the signup form asks). The account starts asFREEand can't call these endpoints yet. - An admin promotes the account to
DEVELOPERrank via the existing admin panel (POST /api/admin/users/{usrid}/category). Until that happens, every call below returns401 Unauthorized.
DEVELOPER rank also grants every other DEVELOPER-gated route (bhav downloader, holiday
master, MCX sync, etc.), not just the price endpoints below — a deliberate simplification
(no new restricted category was built) rather than an oversight. See
backend/alembic history / the "External-team API access" plan for context if this needs
tightening later.
2. Logging in
POST /api/auth/login
Content-Type: application/json
{ "email": "you@example.com", "password": "..." }
Response includes an access token (JWT, ~15 minutes) and a refresh token (~14 days). Send the access token on every request:
Authorization: Bearer <access_token>
When it expires, get a new one without logging in again:
POST /api/auth/refresh
Content-Type: application/json
{ "refresh_token": "..." }
There is no separate API key — this is the same login every other user goes through.
3. Two separate data surfaces
These are deliberately not merged — pick the one that matches what you're building against.
3a. EOD (end-of-day) options data — /api/option-chain/*
Daily-close snapshots: underlyings, expiries, strikes, and a full CE/PE chain (LTP, OI,
volume) for one date at a time. See backend/app/api/option_chain.py.
GET /api/option-chain/underlyings
GET /api/option-chain/expiry-dates/{underly_id}
GET /api/option-chain/strikes?underly_id=...&expiry_date=...
GET /api/option-chain/chain?underly_id=...&expiry_date=...&trading_date=...
3b. IEOD (intraday, 1-minute) options data — /api/ieod-options/*
1-minute historical option bars for a specific contract. Use the EOD endpoints above to find
the underlying/expiry/strike you want first, then pull bars here. See
backend/app/api/ieod_options.py.
GET /api/ieod-options/tickers
GET /api/ieod-options/range?ticker=NIFTY&opttype=CE&expiry=2024-01-04&strike=19800&fromdate=2024-01-04&todate=2024-01-04
GET /api/ieod-options/preview?ticker=NIFTY&opttype=CE&expiry=2024-01-04&strike=19800&fromdate=2024-01-04&todate=2024-01-04&limit=500
GET /api/ieod-options/download?ticker=NIFTY&opttype=CE&expiry=2024-01-04&strike=19800&fromdate=2024-01-04&todate=2024-01-04
Parameters:
ticker— root underlying, e.g.NIFTY,BANKNIFTY.opttype—CEorPE.expiry— an explicit date (YYYY-MM-DD), orM1/M2/... (n-th monthly expiry fromfromdate), orW1/W2/... (n-th weekly expiry).strike—ATM(resolved automatically from the underlying's price onfromdate) or an explicit strike value.fromdate/todate—YYYY-MM-DD./previewalso takeslimit(max 2000) for a capped on-page sample;/downloadreturns the full CSV for the range.
/download streams a CSV with columns: Ticker, Date, Time, Open, High, Low, Close, Volume, OI.
/previewreturns the same rows as JSON, capped atlimit`.
3c. IEOD (intraday, 1-minute) spot/futures data — /api/ieod-spotfut/*
1-minute historical bars for the underlying, matching the options data in 3b. Use this to track delta/gamma against the underlying's actual path. See backend/app/api/ieod_spotfut.py.
GET /api/ieod-spotfut/tickers
GET /api/ieod-spotfut/range?ticker=NIFTY&mode=SPOT
GET /api/ieod-spotfut/preview?ticker=NIFTY&mode=SPOT&fromdate=2024-01-04&todate=2024-01-04&limit=500
GET /api/ieod-spotfut/download?ticker=NIFTY&mode=SPOT&fromdate=2024-01-04&todate=2024-01-04
Parameters:
ticker— root underlying, e.g.NIFTY,BANKNIFTY.mode—SPOTorFUT(continuous near-month futures).fromdate/todate—YYYY-MM-DD./previewtakeslimit(max 2000) for a capped sample;/downloadreturns the full CSV limitlessly.
3d. EOD (end-of-day) spot/futures data
For daily-closing underlying data corresponding to the EOD option chain snapshots in 3a, query the general chart API:
GET /api/chart-data?symbol=NIFTY&segment=Index
Parameters:
symbol— e.g.NIFTYorRELIANCEsegment—Indexfor indices,CMfor equity/stocks.
4. Not available
- No live/real-time price or option-chain feed — everything above is historical.
- No greeks or payoff/strategy calculations — that logic isn't built server-side; compute it client-side from the OHLC bars/chain data above.
- No rate limiting is enforced today — be a good citizen anyway (don't poll
/downloadin a tight loop; cache what you fetch).