Domain Knowledge
Read this page before working on any feature that involves trading logic, market data, order flow, or NSE-specific behaviour. Never assume what a trading term means — look it up here first.
NSE Market Structure
Trading Sessions
| Session | Time (IST) | Description |
|---|---|---|
| Pre-open | 9:00 – 9:15 AM | Order collection, price discovery |
| Normal market | 9:15 AM – 3:30 PM | Continuous trading |
| Post-close | 3:40 – 4:00 PM | Closing price discovery |
Market Segments
| Segment | Code | Description |
|---|---|---|
| Equity Cash | EQ | Buying/selling shares |
| Futures | FUT | Derivative contracts on underlying |
| Call Options | CE | Right to buy at strike price |
| Put Options | PE | Right to sell at strike price |
NSE EOD Data (Bhav Copy)
What is a Bhav Copy?
A Bhav Copy is the official NSE end-of-day (EOD) data file published after market close every trading day. It contains OHLCV (Open, High, Low, Close, Volume) data for every traded instrument.
Equity Bhav Copy Fields
| Field | Description |
|---|---|
symbol | NSE trading symbol (e.g. RELIANCE, NIFTY50) |
sdate | Trading date |
open | Opening price |
high | Highest traded price |
low | Lowest traded price |
close | Closing price |
volume | Total shares traded |
delivery_qty | Shares delivered (not intraday) |
delivery_pct | Delivery as % of volume |
F&O Bhav Copy Additional Fields
| Field | Description |
|---|---|
expiry_date | Contract expiry date |
option_type | CE (call), PE (put), XX (futures) |
strike_price | Strike price for options (0 for futures) |
open_interest | Number of open contracts |
Options Terminology
| Term | Meaning |
|---|---|
| Strike Price | Price at which option holder can buy (CE) or sell (PE) |
| Expiry Date | Date the contract expires (monthly: last Thursday; weekly: every Thursday for NIFTY/BANKNIFTY) |
| Premium | Price paid to buy an option contract |
| Open Interest (OI) | Total number of outstanding contracts |
| ATM | At The Money — strike closest to current spot price |
| ITM | In The Money — option with intrinsic value |
| OTM | Out of The Money — option with no intrinsic value |
| Lot Size | Minimum quantity per contract (e.g. NIFTY = 25) |
Key NSE Indices
| Index | Composition | Lot Size |
|---|---|---|
| NIFTY 50 | Top 50 stocks by market cap | 25 |
| BANK NIFTY | Top banking stocks | 15 |
| MIDCAP NIFTY | Top midcap stocks | 75 |
| FINNIFTY | Financial services stocks | 40 |
Market Profile Concepts
Used in research/market-profile.md and any Market Profile features.
| Term | Meaning |
|---|---|
| TPO | Time Price Opportunity — each 30-min period a price was traded |
| POC | Point of Control — price level with most TPOs (highest volume) |
| Value Area | Price range containing 70% of all TPOs |
| VAH | Value Area High — upper boundary of value area |
| VAL | Value Area Low — lower boundary of value area |
| IB | Initial Balance — range of first 60 minutes of trading |
| Single Prints | Price levels traded in only one TPO period — unfilled gaps |
Neo Wave / Elliott Wave Basics
Used in research/neo-wave.md.
| Term | Meaning |
|---|---|
| Impulse Wave | 5-wave move in trend direction (1-2-3-4-5) |
| Corrective Wave | 3-wave counter-trend move (A-B-C) |
| Wave 3 | Never the shortest impulse wave |
| Wave 4 | Must not overlap Wave 1 territory (except diagonal) |
| Zigzag | Sharp correction: 5-3-5 structure |
| Flat | Sideways correction: 3-3-5 structure |
| Triangle | Contracting/expanding: 3-3-3-3-3 structure |
NSE Working Days
NSE is closed on:
- All Saturdays and Sundays
- NSE-declared holidays (published annually)
The utils.NSEWorkingDays() function returns a pandas DatetimeIndex of valid trading days between two dates, using the holiday calendar stored in the database.
Important: Do not use NSEWorkingDays() for AMI date enumeration — use a direct DB query instead.
See Debugging Prompts for the full explanation.
AMI Broker Data Format
AmiBroker is a technical analysis platform. TradeEntry exports EOD data in a specific text format that AmiBroker can import:
TICKER,DATE,OPEN,HIGH,LOW,CLOSE,VOLUME
RELIANCE,20250114,2450.00,2480.00,2440.00,2465.00,1234567
Files are named YYYYMMDD.txt and stored in the configured AMI_PATH.
TradeEntry-Specific Business Rules
These rules are specific to how this platform works — do not change them without senior approval.
| Rule | Detail |
|---|---|
| Data sync direction | Always NSE → DB → AMI (never reverse) |
| Rollback unit | Whole date — partial dates are never left in DB |
| AMI generation | Always triggered after equity sync, never before |
| Date validation | Only NSE working days are valid sdate values |
| Missing data | Logged in scr_missing_bhav — not silently ignored |
| F&O expiry | Monthly = last Thursday; Weekly = every Thursday |
Glossary
| Term | Definition |
|---|---|
| Bhav | Hindi/Marathi for "price" — hence "Bhav Copy" = price record |
| EOD | End of Day |
| OHLCV | Open, High, Low, Close, Volume |
| OI | Open Interest |
| FII | Foreign Institutional Investor |
| DII | Domestic Institutional Investor |
| PCR | Put-Call Ratio = Total PE OI / Total CE OI |
| Max Pain | Strike price at which option writers (sellers) face minimum loss |
| ORB | Opening Range Breakout — breakout from first N minutes range |
| VIX | India Volatility Index — measures expected NIFTY volatility |
If a term is missing from this page, add it before asking anyone.