Skip to main content

Domain Knowledge

Mandatory reading

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

SessionTime (IST)Description
Pre-open9:00 – 9:15 AMOrder collection, price discovery
Normal market9:15 AM – 3:30 PMContinuous trading
Post-close3:40 – 4:00 PMClosing price discovery

Market Segments

SegmentCodeDescription
Equity CashEQBuying/selling shares
FuturesFUTDerivative contracts on underlying
Call OptionsCERight to buy at strike price
Put OptionsPERight 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

FieldDescription
symbolNSE trading symbol (e.g. RELIANCE, NIFTY50)
sdateTrading date
openOpening price
highHighest traded price
lowLowest traded price
closeClosing price
volumeTotal shares traded
delivery_qtyShares delivered (not intraday)
delivery_pctDelivery as % of volume

F&O Bhav Copy Additional Fields

FieldDescription
expiry_dateContract expiry date
option_typeCE (call), PE (put), XX (futures)
strike_priceStrike price for options (0 for futures)
open_interestNumber of open contracts

Options Terminology

TermMeaning
Strike PricePrice at which option holder can buy (CE) or sell (PE)
Expiry DateDate the contract expires (monthly: last Thursday; weekly: every Thursday for NIFTY/BANKNIFTY)
PremiumPrice paid to buy an option contract
Open Interest (OI)Total number of outstanding contracts
ATMAt The Money — strike closest to current spot price
ITMIn The Money — option with intrinsic value
OTMOut of The Money — option with no intrinsic value
Lot SizeMinimum quantity per contract (e.g. NIFTY = 25)

Key NSE Indices

IndexCompositionLot Size
NIFTY 50Top 50 stocks by market cap25
BANK NIFTYTop banking stocks15
MIDCAP NIFTYTop midcap stocks75
FINNIFTYFinancial services stocks40

Market Profile Concepts

Used in research/market-profile.md and any Market Profile features.

TermMeaning
TPOTime Price Opportunity — each 30-min period a price was traded
POCPoint of Control — price level with most TPOs (highest volume)
Value AreaPrice range containing 70% of all TPOs
VAHValue Area High — upper boundary of value area
VALValue Area Low — lower boundary of value area
IBInitial Balance — range of first 60 minutes of trading
Single PrintsPrice levels traded in only one TPO period — unfilled gaps

Neo Wave / Elliott Wave Basics

Used in research/neo-wave.md.

TermMeaning
Impulse Wave5-wave move in trend direction (1-2-3-4-5)
Corrective Wave3-wave counter-trend move (A-B-C)
Wave 3Never the shortest impulse wave
Wave 4Must not overlap Wave 1 territory (except diagonal)
ZigzagSharp correction: 5-3-5 structure
FlatSideways correction: 3-3-5 structure
TriangleContracting/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.

RuleDetail
Data sync directionAlways NSE → DB → AMI (never reverse)
Rollback unitWhole date — partial dates are never left in DB
AMI generationAlways triggered after equity sync, never before
Date validationOnly NSE working days are valid sdate values
Missing dataLogged in scr_missing_bhav — not silently ignored
F&O expiryMonthly = last Thursday; Weekly = every Thursday

Glossary

TermDefinition
BhavHindi/Marathi for "price" — hence "Bhav Copy" = price record
EODEnd of Day
OHLCVOpen, High, Low, Close, Volume
OIOpen Interest
FIIForeign Institutional Investor
DIIDomestic Institutional Investor
PCRPut-Call Ratio = Total PE OI / Total CE OI
Max PainStrike price at which option writers (sellers) face minimum loss
ORBOpening Range Breakout — breakout from first N minutes range
VIXIndia Volatility Index — measures expected NIFTY volatility

If a term is missing from this page, add it before asking anyone.