💹

Financial Services > Investment & Wealth Management

Trading & Broking

Retail and institutional trading platforms, order management systems, exchange connectivity, and algorithmic trading — the technology powering India's stock markets

160M+

Demat Accounts

₹1L Cr+

Daily Volume

<1ms

Order Latency

12M+

Zerodha Users

What Engineers Miss When They First Enter Trading & Broking

Trading and broking technology is where latency requirements that would be considered absurd in any other domain are simply table stakes. In co-location HFT environments, the conversation is about microseconds — the time for a network packet to travel from one rack to another. In retail trading, engineers are building for a different but equally demanding constraint: millions of users trying to place orders in the first 15 minutes of market open, which means order management systems that are designed for the same throughput as a payment network but with the real-time position risk calculations of a hedge fund.

India's retail trading boom — from 40 million demat accounts in 2019 to 160 million by 2024 — is the context for everything that Zerodha, Upstox, and Groww built during this period. These companies were not just competing on UI; they were racing to replace their core trading infrastructure fast enough to handle a 4x growth in users and a 20x growth in order volumes without a circuit breaker event on a volatile trading day. The engineering culture that came out of this period — extreme focus on system capacity headroom, obsessive monitoring of order processing latency by market segment, pre-emptive circuit breakers at the broker level — is what made these platforms credible at scale.

Institutional trading adds a different dimension. Institutional OMS systems process orders worth hundreds of crores per ticket, route them across multiple execution venues, break them into child orders using algorithmic strategies (VWAP, TWAP, implementation shortfall), and monitor total portfolio risk in real time. The SEBI algorithmic trading framework, peak order ratio requirements, and exchange circuit breaker rules are all operational constraints that institutional technology teams have to build around — and they change often enough that keeping the compliance layer current is itself a significant engineering workload.

What Teams Actually Do Day To Day

  • 1Build and maintain the order management system that accepts client orders, validates them against risk limits, routes them to the exchange via FIX protocol or exchange-specific APIs, tracks their lifecycle through pending/executed/cancelled/rejected states, and updates position and margin in real time.
  • 2Operate the exchange connectivity layer — co-location servers at NSE and BSE, exchange-specific binary APIs, FIX drop-copy sessions for confirmation receipt, and the failover logic that routes orders through backup connectivity when primary connectivity degrades.
  • 3Maintain the real-time risk engine that checks margin sufficiency before order placement, monitors portfolio-level Greeks for derivatives positions, tracks intraday exposure against SEBI's peak order to trade ratio limits, and triggers auto-square-off when margin falls below the minimum threshold.
  • 4Build the back-office settlement pipeline that processes end-of-day contract notes, computes brokerage and tax charges, generates the P&L statement, instructs the clearing corporation (NSCCL/BOISL) on settlement obligations, and reconciles settled positions against internal records.
  • 5Develop and certify algorithmic trading strategies through the SEBI algo audit process, implement order throttling and maximum loss circuit breakers, and maintain the kill switch infrastructure that can halt all outstanding orders across all exchanges within milliseconds.

One End-to-End Flow: A Retail Investor Places an Intraday Options Order

An options order on Zerodha or Upstox goes through margin check, OMS, exchange connectivity, matching engine confirmation, and real-time position update — all within the window between the user tapping 'Buy' and seeing 'Order Placed'.

1

User enters order details in the trading app

The client app validates the order client-side (contract is in permitted list, quantity is valid lot size, price is within circuit limits) and sends it to the broker's API gateway. The request includes symbol, expiry, strike, call/put, quantity, order type (market/limit/SL), and the session token that authenticates the request.

Systems Involved

Client app, API gateway, authentication service

Where It Usually Breaks

API gateway overload during high-volatility events (budget day, RBI policy, index option expiry) causes order submission failures that the user sees as timeouts. Horizontal scaling of the API gateway tier with pre-allocated capacity for peak periods is the standard mitigation.

2

Margin is checked before order is accepted

The risk engine calculates the margin requirement for the order — SEBI's SPAN + exposure margin for F&O positions — and checks whether the client's available margin is sufficient. This check must be atomic with the order creation to prevent two simultaneous orders from both seeing sufficient margin when only one can be filled.

Systems Involved

Risk engine, margin calculation service, client funds ledger

Where It Usually Breaks

The margin check and order accept are two separate operations unless implemented with a reservation pattern. High-frequency retail users who place multiple orders in quick succession can exhaust margin through simultaneous approvals before any order reaches the exchange.

3

Order is sent to the exchange via FIX protocol

The OMS creates an internal order record, assigns a broker order ID, and sends the order to the exchange via the FIX protocol session. For NSE derivatives, this goes through the exchange's CTCL (Computer-to-Computer Link) API. The FIX message includes the broker code, client code, and order parameters.

Systems Involved

OMS, FIX engine, exchange CTCL API

Where It Usually Breaks

FIX session drops during exchange-side maintenance windows leave the OMS uncertain about the status of orders that were in flight. Orders must be reconciled against the exchange's order book dump before the next trading day begins.

4

Exchange matching engine processes the order

The NSE or BSE matching engine receives the order and attempts to match it against resting orders at the specified or better price. For a market order, matching is immediate if any counterpart exists. For a limit order, the order rests in the book until a matching counterpart arrives or the order is cancelled.

Systems Involved

Exchange matching engine

Where It Usually Breaks

Exchange circuit breakers can pause matching for a contract when the price moves beyond allowed limits. Orders placed just before a circuit breaker fires are held in queue — the client's margin is committed but the position is not yet established.

5

Execution confirmation is received and position is updated

The exchange sends an execution report back to the broker via drop-copy FIX session. The OMS updates the order status to executed, the risk engine updates the client's live position and margin utilisation, and the user's app shows the fill confirmation. For intraday positions, auto-square-off timers are activated.

Systems Involved

OMS execution processor, risk engine, client notification service

Where It Usually Breaks

Delayed drop-copy acknowledgements cause the client's displayed position to lag the actual exchange position. If the client places a second order based on the stale display, they may exceed intended position size.

Technology Architecture — How Trading & Broking Platforms Are Built

The diagram below reflects how production Trading & Broking systems are structured at scale — nine layers from client channels through edge security, API gateway, domain microservices, polyglot data stores, async event streaming, analytics, external partners, and cloud infrastructure. Solid arrows show synchronous REST/gRPC calls; dashed arrows show async event flows via Kafka or a message queue.

Trading & Broking — Enterprise Architecture ReferenceSolid arrows: synchronous calls (REST / gRPC) · Dashed arrows: async event flows (Kafka / Message Queue)CLIENTS & CHANNELSWeb SPAiOS / AndroidAdmin PortalPartner API3rd-Party WebhooksBatch / CronEDGE SECURITY & DELIVERYCDN (CloudFront / Akamai) · DDoS Shield · WAF (OWASP rules) · SSL/TLS Termination · Global Load Balancer (ALB / NLB)API GATEWAYKong / AWS API Gateway / NGINX / ApigeeRate Limiting · Routing · Versioning · Throttling · BFF PatternIDENTITY & ACCESSOAuth 2.0 · OpenID Connect · SAML 2.0JWT · RBAC · MFA · SSOCORE DOMAIN MICROSERVICES · REST / gRPC📋 Order Management System …Order creation and validationPre-trade compliance and risk che…POST /api/v1/ordersFidessa OMS🔌 Exchange Gateway & Conne…FIX/CTCL protocol connectivityOrder submission to NSE/BSEPOST /gateway/orders/newNSE NOW🛡️ Real-Time Risk & Margin …Margin availability checkIntraday exposure monitoringPOST /api/v1/risk/margin-checkODIN Risk🤖 Algorithmic & Automated …Strategy configuration and backte…Real-time signal generationPOST /api/v1/strategiesZerodha StreakService Mesh: mTLS · Circuit Breaker (Resilience4j / Hystrix) · Service Discovery (Consul / Eureka) · Distributed Tracing (Jaeger)DATA PERSISTENCE · PolyglotPostgreSQLOLTPRedisPrimaryRedis CacheCacheElasticsearchSearchS3 / BlobObjectASYNC MESSAGING & EVENTSApache Kafka / SQSPub/Sub · TopicsDead Letter QueueError HandlingStream ProcessorFlink / SparkANALYTICS & DATA PLATFORMData Warehouse (BigQuery / Snowflake / Redshift) · ETL/ELT (dbt / Airflow) · BI Tools (Tableau / Metabase) · ML Feature StoreEXTERNAL INTEGRATIONS & PARTNERSExchange GatewayBrokerRisk ManagementPortfolio SystemSettlementNSE Co-locationPLATFORM: AWS / NSE Co-location · Kubernetes (EKS/AKS/GKE) · Docker · Helm · ArgoCD · CI/CD (GitHub Actions) · IaC (Terraform)OBSERVABILITY: ELK / Datadog · Prometheus / Grafana · Jaeger · PagerDutySECURITY: TLS 1.3 · Vault / KMS · SAST/DAST · SOC2 / ISO 27001Sync (REST / gRPC)Async (Kafka / Events)Each service owns its bounded context · CQRS & Event Sourcing where applicable · Polyglot persistence per domain

Industry Players & Real Applications

🇮🇳 Indian Companies

Zerodha

Discount Broker / Fintech

Go, Python, Kite Platform

India's largest broker by active clients, built Kite & Pi

Upstox

Discount Broker

Java, React Native, AWS

Tiger Global backed, 12M+ customers

Angel One

Full-Service + Discount

SmartAPI, Java

Listed company, AI-driven advisory

ICICI Direct

Bank-backed Broker

Custom OMS, Java

Integrated with ICICI banking

HDFC Securities

Bank-backed Broker

Custom Platform, Java

Part of HDFC Group

Motilal Oswal

Full-Service Broker

Custom + Vendored OMS

Research-heavy full-service

🌍 Global Companies

Interactive Brokers

USA/Global

Global Broker

C++, TWS Platform

Professional and institutional trader favorite

Charles Schwab

USA

Retail + Institutional

Custom + Apex Clearing

TD Ameritrade acquired

Citadel Securities

USA

Market Maker / HFT

C++, FPGA, Co-location

Largest US retail order router

Virtu Financial

USA

HFT / Market Maker

Custom Low-Latency Stack

Algo market making globally

Robinhood

USA

Retail Fintech Broker

Python, AWS, React Native

Commission-free trading pioneer

Revolut Trading

UK/Europe

Neobank + Broker

Microservices, AWS

Embedded trading in super app

🛠️ Enterprise Platform Vendors

Fidessa (ION Group)

OMS, EMS, Algo Trading

Enterprise institutional OMS leader

Bloomberg EMSX

Execution Management System

Buy-side EMS integrated with Terminal

FlexTrade

FlexOMS, FlexEMS

Multi-asset OMS/EMS

ODIN (Financial Technologies)

ODIN Trading Platform

Widely used in Indian brokers

Tradetron

Algo Strategy Platform

Indian algo trading platform

Core Systems

These are the foundational systems that power Trading & Broking operations. Understanding these systems — what they do, how they integrate, and their APIs — is essential for anyone working in this domain.

Business Flows

Key Business Flows Every Developer Should Know.Business flows are where domain knowledge directly impacts code quality. Each flow represents a real business process that your code must correctly implement — including all the edge cases, failure modes, and regulatory requirements that aren't obvious from the happy path.

The detailed step-by-step breakdown of each flow — including the exact API calls, data entities, system handoffs, and failure handling — is covered below. Study these carefully. The difference between a developer who “knows the code” and one who “knows the domain” is exactly this: the domain-knowledgeable developer reads a flow and immediately spots the missing error handling, the missing audit log, the missing regulatory check.

Technology Stack

Real Industry Technology Stack — What Trading & Broking Teams Actually Use. Every technology choice in Trading & Brokingis driven by specific requirements — reliability, compliance, performance, or integration capabilities. Here's what you'll encounter on real projects and, more importantly, why these technologies were chosen.

The pattern across Trading & Broking is consistent: battle-tested backend frameworks for business logic, relational databases for transactional correctness, message brokers for event-driven workflows, and cloud platforms for infrastructure. Modern Trading & Brokingplatforms increasingly adopt containerisation (Docker, Kubernetes), CI/CD pipelines, and observability tools — the same DevOps practices you'd find at any modern tech company, just with stricter compliance requirements.

⚙️ backend

Go

Ultra-low-latency trading APIs — used by Zerodha (Kite)

C++

HFT engines, exchange gateways, matching engine

Java

OMS, risk systems, institutional platforms

Python

Algo strategy development, analytics, backtesting

🖥️ frontend

React / Next.js

Web trading terminal, portfolio views

React Native / Flutter

Mobile trading apps

WebSocket

Real-time market data streaming to frontend

🗄️ database

PostgreSQL

Order history, client data, trade records

Redis

Live positions, real-time P&L, session data

InfluxDB / Kdb+

Tick data, time-series market data (HFT uses kdb+)

Apache Kafka

Trade event streaming, market data distribution

💡 protocols

FIX Protocol

Industry standard for order routing to exchanges

CTCL (NSE)

NSE's broker connectivity protocol

WebSocket / SSE

Real-time price streaming to clients

NEAT/BOLT

NSE/BSE legacy trading terminals

☁️ cloud

AWS

Most modern brokers — Upstox, Angel One

NSE Co-location

HFT firms — physical servers at NSE data centre

Azure

Enterprise institutional platforms

Interview Questions

Q1.Explain the lifecycle of a trade order from placement to settlement.

1) Order Entry — investor places order in app, 2) Pre-trade risk check — margin, limits, compliance, 3) OMS routing — order sent to exchange gateway, 4) Exchange matching — matched against counterpart order, 5) Trade confirmation — fill sent back via FIX ExecutionReport, 6) Post-trade processing — allocation, position update, trade reporting, 7) Clearing — NSCCL nets positions, calculates obligations, 8) Settlement (T+1) — CDSL/NSDL credits securities, funds settle via clearing bank.

Q2.What is the FIX protocol and what are its key message types?

FIX (Financial Information eXchange) is the industry standard messaging protocol for electronic trading. Key messages: NewOrderSingle (place order) — tag 35=D; ExecutionReport (fills, rejections) — tag 35=8; OrderCancelRequest — tag 35=F; OrderCancelReplaceRequest (modify) — tag 35=G; Heartbeat — tag 35=0; MarketDataRequest/SnapshotFullRefresh for quotes. FIX uses tag=value pairs. Important tags: 49=SenderCompID, 56=TargetCompID, 55=Symbol, 54=Side (1=Buy, 2=Sell), 38=OrderQty, 44=Price.

Q3.How does SPAN margin work for F&O?

SPAN (Standard Portfolio Analysis of Risk) calculates margin for F&O by scanning 16 risk scenarios (price up/down × 3, volatility up/down, time decay) and takes the worst-case loss. Components: Scanning Risk (worst scenario loss) + Inter-month spread credit + Delivery margin + Net Option Value. SEBI mandates SPAN margins. Example: Buying 1 lot Nifty Call — OTM options have lower SPAN but deep ITM or short positions require higher. Brokers can charge extra 'exposure margin' above SPAN.

Q4.What happens during a circuit breaker?

Circuit breakers halt trading when indices fall rapidly. Index circuit breakers (NSE): 10% move → 45 min halt (if before 1 PM); 15% move → 1h45m halt; 20% move → rest of day halt. Stock-level circuits: 5%, 10%, or 20% daily bands — trading paused for 15 min on breach. System impact: Pending orders may be cancelled or frozen, risk systems flag exposure, brokers notify clients, square-off may be triggered for leveraged positions. System must handle order status updates correctly post-circuit.

Q5.Explain how a discount broker like Zerodha achieves low latency.

1) Co-location — servers physically located at NSE/BSE data centres, reducing network hops from 10ms to <1ms, 2) Optimised network stack — kernel bypass networking (DPDK/RDMA), 3) Language choice — Go for API servers (low GC pause), C++ for exchange gateway, 4) In-memory state — positions and risk in Redis, avoid DB round-trips, 5) Async processing — Kafka for non-critical paths, synchronous only for order critical path, 6) Pre-allocated memory — avoid GC in hot path, 7) Direct Market Access (DMA) — no broker intervention in order routing.

Glossary & Key Terms

OMS

Order Management System — manages the full order lifecycle

EMS

Execution Management System — focused on smart order routing and execution

FIX

Financial Information eXchange — messaging protocol for electronic trading

VWAP

Volume Weighted Average Price — benchmark for execution algorithms

TWAP

Time Weighted Average Price — executes order evenly over time period

DMA

Direct Market Access — direct order routing to exchange without broker intervention

Co-location

Placing trading servers at exchange data centre for minimum latency

NSCCL

NSE Clearing Corporation — clears and settles NSE trades

SPAN

Standard Portfolio Analysis of Risk — F&O margin calculation methodology

MTM

Mark-to-Market — revaluing positions at current market prices

Circuit Breaker

Automatic market halt when price moves beyond defined threshold

HFT

High-Frequency Trading — microsecond-speed algorithmic trading strategies