Skip to content

Integration DAG: Trading hours

Why this page is structured this way: Trading hours is the highest-throughput phase. Per-order, the pre-trade RMS pipeline is a tight sequential chain that runs in milliseconds. Aggregated, the system runs millions of those chains per day plus an outer loop (trade-booking → MTM → margin-recompute) plus four time-locked peak-margin snapshots. Three DAGs cover these layers separately.

  • 3 ASCII DAGs: per-order pre-trade pipeline, intraday execution-and-snapshot loop, closing window.
  • 28 unique integration nodes.
  • Peak-margin snapshots at 11:30 / 12:30 / 13:30 / 14:30 are the most consequential time-locked events; missing one or having a shortfall during one triggers DMF penalty.
  • Per-trade pipeline runs in single-digit milliseconds; orchestration overhead must stay below ~5ms or order latency degrades.

Once the market opens at 09:15, the broker’s tech stack settles into an OMS/RMS loop that repeats per order: validate, release, execute, book, update margin, repeat. Surveillance runs in parallel at the exchange level (NORMS), with the broker’s mirror surveillance system catching exchange-side flags and adding broker-specific rules (intraday OTR caps, GSM/ASM intervention). Four times during the session — at 11:30, 12:30, 13:30, 14:30 — the clearing corp captures a margin snapshot; the broker must have sufficient client-collected margin in each.

DAG 1 — Per-order pre-trade pipeline (millisecond-scale)

Section titled “DAG 1 — Per-order pre-trade pipeline (millisecond-scale)”
TH-ORDER-RECV (web / mobile / dealer / API / FIX inbound)
TH-PT-SEGMENT_CHECK (segment active for client?)
│ fail → reject
▼ pass
TH-PT-MARGIN_LOCK (compute required margin; reserve against available)
│ fail → reject
▼ pass
TH-PT-MWPL_CHECK (derivatives only)
│ fail → reject
▼ pass
TH-PT-ORDER_TYPE (NRML / MIS / CO / BO validation)
│ fail → reject
▼ pass
TH-PT-SURV_CHECK (GSM / ASM / restricted-stock / illiquid)
│ fail → reject
▼ pass
TH-PT-RELEASE (OMS submits to exchange via FIX / CTCL / API)
TH-EX-ACK (exchange order ID returned)
TH-EX-MATCH (if matched, trade confirmation returned)

DAG 2 — Intraday execution loop + peak-margin snapshots

Section titled “DAG 2 — Intraday execution loop + peak-margin snapshots”
TH-EX-MATCH (from DAG 1)
TH-TRADE-BOOK (broker OMS records the trade)
├──► TH-MTM-UPDATE (running MTM on open positions)
├──► TH-MARGIN-RECOMPUTE (per-client margin re-snapshot)
├──► TH-SURV-OTR_INCR (OTR accumulator tick)
├──► TH-SURV-PATTERN (manipulative-trade flagging — async)
▼ loops back to next order
╔═══════════════════════════════════════╗
║ Time-locked at 11:30/12:30/13:30/14:30 ║
║ ║
║ TH-SNAP-PEAK_MARGIN ║
║ │ ║
║ ▼ ║
║ TH-SNAP-DMF_ROW (one per snapshot) ║
║ │ ║
║ └──► aggregated post-EOD ║
╚═══════════════════════════════════════╝
(runs in parallel with execution loop)
TH-BD-WINDOW (block-deal: 08:45-09:00 morning, 14:35-15:05 afternoon)
TH-BD-REPORT (separate reporting flow)
TH-TG-DETECT (technical glitch — event-triggered)
TH-TG-REPORT (intraday submission to SEBI within prescribed minutes)
TH-CW-START (15:30; continuous trading ends)
TH-CW-AUCTION (call-auction window for closing price)
TH-CW-PRICE_DISC (settlement-price discovery)
TH-CW-FINAL_MARGIN (post-closing margin snapshot for record)
(hands off to EOD phase)
node_idoperationdepends_onblocksparallel_eligibleidempotentretry_policyrollbackslafailure_surfacespec_source
TH-ORDER-RECVOrder capture (web / mobile / dealer / API / FIX)[entry]TH-PT-SEGMENT_CHECK[none]no (user-keyed)none[none]< 100msclient UI[industry typical]
TH-PT-SEGMENT_CHECKIs segment active for this client?TH-ORDER-RECVTH-PT-MARGIN_LOCK[none]yes (local lookup)nonereject order< 1msOMS reject code[industry typical]
TH-PT-MARGIN_LOCKCompute SPAN+ELM+exposure; reserve against availableTH-PT-SEGMENT_CHECKTH-PT-MWPL_CHECK[none]yes (order-keyed)nonerelease margin reservation< 2msOMS rejectMargin compliance domain
TH-PT-MWPL_CHECKMarket-Wide Position Limit (derivatives)TH-PT-MARGIN_LOCKTH-PT-ORDER_TYPE[none]yesnonerelease margin< 1msOMS rejectNSE F&O MWPL circulars
TH-PT-ORDER_TYPENRML / MIS / CO / BO validationTH-PT-MWPL_CHECKTH-PT-SURV_CHECK[none]yesnonerelease margin< 1msOMS reject[industry typical]
TH-PT-SURV_CHECKGSM / ASM / restricted / illiquidTH-PT-ORDER_TYPETH-PT-RELEASE[none]yesnonerelease margin< 1msOMS rejectSurveillance domain
TH-PT-RELEASEOMS sends order to exchangeTH-PT-SURV_CHECKTH-EX-ACK[none]conditional (order-id-keyed)1× on FIX disconnect; manual on persistentrelease margin if final fail< 2msOMS reject / FIX session errorNSE/BSE/MCX FIX specs
TH-EX-ACKExchange returns order IDTH-PT-RELEASETH-EX-MATCH or [exit-after-day][none]n/an/arelease margin if order rejected< 5ms typicalOMS / FIX session[industry typical]
TH-EX-MATCHExchange matches order, returns trade confTH-EX-ACKTH-TRADE-BOOK[none]n/an/a[none]event-drivenOMS[industry typical]
TH-TRADE-BOOKOMS records the tradeTH-EX-MATCHTH-MTM-UPDATE, TH-MARGIN-RECOMPUTE, TH-SURV-OTR_INCR, TH-SURV-PATTERN[none]yes (trade-id keyed)3× then critical alert[none]< 10msOMS / back-office[industry typical]
TH-MTM-UPDATEMTM on open positionsTH-TRADE-BOOKnext pre-trade margin computeparallel-with margin-recompute / OTR / patternyes[none]< 5msRMS[industry typical]
TH-MARGIN-RECOMPUTEPer-client margin envelope refreshTH-TRADE-BOOKnext TH-PT-MARGIN_LOCKparallelyes[none]< 5msRMSMargin compliance domain
TH-SURV-OTR_INCROTR accumulator tickTH-TRADE-BOOKTH-SURV-OTR_BREACH (event)parallelyes[none]< 1mssurveillance consoleNSE NORMS
TH-SURV-PATTERNManipulative-trade pattern flag (async)TH-TRADE-BOOKTH-SURV-FLAG (downstream review)parallelyesasync best-effort[none]< 100mssurveillance queueNSE NORMS + social-media surveillance
TH-SNAP-PEAK_MARGINCapture client margin state at fixed clock[time-trigger 11:30/12:30/13:30/14:30]TH-SNAP-DMF_ROW[none]yes (snapshot-id keyed)retry next-cycle if missed (DMF row)[none]< 30s after triggerclearing corp DMF rejectMargin compliance domain
TH-SNAP-DMF_ROWGenerate DMF row from snapshotTH-SNAP-PEAK_MARGINEOD-DMF-AGGREGATEparallel-with continued executionyes[none]< 1sops queue / DMF reconciliationClearing-corp DMF specs
TH-BD-WINDOWBlock-deal window detection (08:45-09:00, 14:35-15:05)[time-trigger]TH-BD-REPORTparallel-with executionyesn/a[none]window-boundn/aBSE/NSE block-deal circulars
TH-BD-REPORTBlock-deal reporting flowTH-BD-WINDOW[exit][none]yes[none]< 5m post-windowops queueexchange block-deal circulars
TH-TG-DETECTTechnical glitch event detection[event-trigger]TH-TG-REPORTparallelyes (incident-id)none (event-triggered)[none]event-drivenops consoleCyber security / technical glitch SEBI Aug-2023 circular
TH-TG-REPORTSEBI intraday glitch reportTH-TG-DETECT[exit][none]yes1× then escalation[none]within prescribed minsSEBI portalSEBI Aug 2023 technical-glitch circular
TH-CW-START15:30 closing-window trigger[time-trigger]TH-CW-AUCTION[none]yes (date-keyed)none (time)[none]scheduledn/a[industry typical]
TH-CW-AUCTIONCall-auction for closing priceTH-CW-STARTTH-CW-PRICE_DISC[none]n/a (exchange-side)n/a[none]< 10mexchangeNSE/BSE closing-auction circulars
TH-CW-PRICE_DISCSettlement-price discoveryTH-CW-AUCTIONTH-CW-FINAL_MARGIN[none]n/an/a[none]< 1mexchangeNSE/BSE closing-auction circulars
TH-CW-FINAL_MARGINPost-closing margin recordTH-CW-PRICE_DISCEOD-* (hand-off)[none]yes[none]< 1mRMS[industry typical]
  • [gotcha] Per-order pre-trade RMS budget is single-digit milliseconds. Anything slower starts showing as order-rejection latency that traders notice within hours. Most brokers measure each pre-trade node’s P99 latency continuously, with alerts at >3× baseline.
  • [industry practice] The 4 peak-margin snapshots (11:30 / 12:30 / 13:30 / 14:30) are time-locked at the clearing corp side, not the broker side. The broker’s job is to ensure margin position is stable at those exact clock times — pre-computing margin at 11:25 / 12:25 / 13:25 / 14:25 (the “settled state” five minutes before snapshot) is a common optimization.
  • [risk trade-off] Async surveillance (TH-SURV-PATTERN) doesn’t block order execution. If real-time detection were stricter, brokers would catch more market manipulation but introduce latency that the trading-experience product team would push back on. Most brokers tune the balance toward async + post-EOD review.
  • [cost optimization] The block-deal window (TH-BD-WINDOW) sees concentrated activity; some brokers route block-deal orders through a separate OMS lane to avoid degrading the main retail-order pipeline during the window.

2026-05-14


AI-generated and not legal, financial, or compliance advice. See the project README for full disclaimer.