Appearance

Personalize your experience

Mode
Accent Color
Direction

Market Foundations & Exchange Microstructure

0%
Lesson 12/12/Market Foundations/Indian Markets & SEBI/Regulation & Costs12 min

SEBI Algo Compliance, Order-to-Trade Ratio (OTR) & Self-Trade Guard

Market Foundations

Building exchange-compliant execution bots with OTR rate limiting, Self-Trade Prevention, and rejection circuit breakers.

Key Topics & Tags
sebi algoorder to trade ratiootrself trade preventionrate limit

Core Architecture & Intuition

Automated trading systems must respect exchange surveillance thresholds. High Order-to-Trade Ratios (flooding the exchange with order modifications without fills) attract exchange penalty slabs, and accidental self-trades (your own buy and sell orders matching under the same PAN) violate regulatory rules.

Every production bot should sit behind a Pre-Trade Gatekeeper that enforces modification hysteresis, checks open orders for self-crosses, and halts the strategy after 3 consecutive broker rejections.

Hover over key terms below for instant definitions: Order-to-Trade Ratio (OTR), Self-Trade Prevention (STP), and Rejection Circuit Breaker. For the complete mathematical derivation and edge-case analysis, open .

1. Tick / Bar FeedWebSocket / OHLCV2. Signal EngineDSL / Vector Math3. Risk GatekeeperMargin & Kill-Switch4. Broker RouterIdempotent REST APIDeterministic Execution Pipeline: Bar-Close Evaluation → Pre-Trade Risk Validation → Broker Order Tagging
Pre-trade compliance gateway enforcing OTR hysteresis, STP checks, and rejection circuit breakers.
!
Caution:Always lock your strategy state to `PENDING_ACK` before sending an order over the network so fast incoming ticks cannot fire duplicate orders while the HTTP request is in flight.

Interactive Concept Breakdown

  • Order-to-Trade Ratio (OTR) — Keep OTR below 15:1 by requiring at least a 2-tick price shift before modifying a resting limit order.
  • Self-Trade Prevention (STP) — Essential when running multiple strategies on the same index or option strike.
  • Rejection Circuit Breaker — Prevents runaway `while` loops from firing hundreds of rejected orders per minute.

Step-by-Step Execution Protocol: Regulation & Costs

  1. 1
    Add 2-Tick & 1.5s Modification Hysteresis
    Do not modify a resting limit order for single-tick noise.
  2. 2
    Verify No Opposing Resting Order on Same Strike
    Check internal open orders table before dispatching a crossable order.
  3. 3
    Trip Kill-Switch on 3 Consecutive Rejections
    Move strategy state to PAUSED and alert the operator immediately.

Parameters, Rules & Reference Matrix

Parameter / RuleTypeDefaultDescription
maxOTRratio< 15 : 1Safe Order-to-Trade ratio target.
modifyMinTicksticks>= 2 ticksMinimum price change required to modify a resting order.
maxRejectCountint3Consecutive rejections before halting strategy.

Implementation & Quantitative Model

pretrade-gatekeeper.ts
export function canDispatchOrder(consecutiveRejects: number, currentOtr: number, selfCrossDetected: boolean) {  if (consecutiveRejects >= 3) return { ok: false, reason: "MAX_REJECT_CIRCUIT_BREAKER" };  if (selfCrossDetected) return { ok: false, reason: "SELF_TRADE_PREVENTION" };  if (currentOtr > 25) return { ok: false, reason: "OTR_THROTTLE_ACTIVE" };  return { ok: true, reason: "APPROVED" };}

Desk Verification Checklist

Confirm before deploying live capital

  • Lock state to PENDING_ACK while an order request is in flight.
  • Halt bot execution automatically after 3 consecutive broker rejections.
  • Check open orders for potential self-trades before submitting new orders.

Cross-reference standard risk definitions such as drawdown, slippage, and when auditing your logs.

Full Trade School curriculum →