Segment
A segment is the instrument class used for trading a given index: cash, futures, or options. Each index setting has anactiveSegment that determines which segment drives automation (recurring buy, trailing sell). Segment-specific configuration lives under nested objects (cash, futures, options) in IndexSetting.
See Cash trading, Futures trading, and Options trading.
Recurring buy
An automated BUY strategy that places orders on a repeating interval while recurring status is on.- Source:
recurringOrder.controller.ts - API:
POST /api/recurringOrder - On start, places one buy immediately, then continues on the configured duration (
buyDuration,callBuyDuration, orputBuyDuration). - Reads live prices from
latestDataMapto resolve strikes and order prices. - Skips when the exchange is closed or tick data is missing.
Trailing sell
An automated SELL strategy for the options segment. After a completed unsold BUY, the system creates aScheduleOrder and a trailing loop watches index price against strike-match and target conditions.
Uses two 1-second loops:
- Schedule creation — per-index loop creates pending sell schedules after BUY completion.
- Trailing exit — global loop updates
strikeMatchPricefrom candle min/max and executes MARKET SELL on match.
pageAccess
A user-level permission array stored on theUser model. Each entry is an IndexSetting ObjectId reference.
Users with the
user role cannot access /users or /settings — those routes return 404. See Roles and access and Page access.
NRML / CNC / MIS
Kite product types that define margin and settlement behavior:
Product selection is set automatically by segment when starting recurring buy. See Settings reference.
CALL / PUT
Option rights (also called legs) for index options trading:
Trailing sell and leg switching (CALL ↔ PUT) apply to the options segment only. Flags like
isCallRecurringBuy, isPutRecurringBuy, and lastActiveRight control which leg is active.
Strike match
The exit price threshold for trailing sell. When indexbaseValue crosses strikeMatchPrice, the system places a MARKET SELL.
Initial calculation:
- PUT:
baseValue + strikeMatchValuePutDifference - CALL:
baseValue - strikeMatchValueCallDifference
- CALL — uses candle minimum
- PUT — uses candle maximum
strikeMatchValueCallDifference, strikeMatchValuePutDifference).
Dummy mode
A global setting (Setting.isDummyOrder) that routes orders to the DummyOrder collection instead of (or without) live Zerodha placement.
- Strategy logic (recurring buy, trailing sell, intervals) still runs normally.
- Useful for development, testing, and dry-run validation.
- Toggle from the dashboard header or via
POST /api/setting.
DummyOrder model.
latestDataMap
An in-memory cache on the backend (socket-manager.ts) that stores the most recent tick snapshot per index.
Updated every ~1 second from Kite WebSocket ticks via
marketDataEmitter. Automation controllers read from latestDataMap — they do not subscribe to Kite directly.
See latestDataMap and Data flow.