Margin is the constraint most automated strategies discover the hard way, because it is the only input to the system that changes without anyone doing anything. Your position is identical to what it was at 09:20. Volatility has risen. The margin required for that unchanged position is now higher, and the shortfall is yours to fund.
The two components
Layered model
Portfolio requirement plus an operating buffer
SPAN and exposure determine the broker requirement; strategy headroom is an additional internal constraint, not an exchange credit.
SPAN models worst-case portfolio loss and recognises offsets. Exposure margin adds an instrument-dependent buffer and recognises fewer hedge benefits. Open orders and temporary naked-leg states can raise the immediate requirement. The strategy then adds its own headroom below available funds so an intraday parameter increase does not force a rejection or liquidation.
Broker-reported required margin is the source of truth. The internal utilisation ceiling decides how much of that available capacity the strategy is allowed to use.
SPAN margin
Exposure margin
What it covers
Worst-case one-day loss across a scenario grid
An additional buffer over SPAN
How it is set
Exchange risk model, portfolio-level
Percentage of notional, instrument-dependent
Recognises hedges
Yes — this is the main benefit of the portfolio approach
Largely no
Changes intraday
Yes, with volatility parameters
Less frequently
The important property is that SPAN is computed on the portfolio, not per position. A hedged structure requires materially less SPAN than the sum of its legs, because the scenario grid recognises that the legs offset. This is why the order in which an automated strategy places legs matters — a great deal.
Upfront collection and peak margin
Trend chart
Why the intraday peak matters even when the book ends flat
An illustrative session reaches 95% utilisation at 11:00 before falling; the peak remains the relevant risk observation.
Illustrative margin utilisation starts at 42 percent at 09:20, rises to 63 percent at 10:00 and 95 percent at 11:00, then falls to 68 percent at 13:30 and 51 percent at 15:20. A 70 percent internal ceiling would have blocked additional risk before the 95 percent peak even though end-of-day utilisation is low.
Illustrative percentages matching the article’s peak-margin example. Production limits should use broker snapshots and instrument-specific stress history.
Two regulatory changes matter operationally. Full upfront margin collection means the required margin must be available before the order, not settled afterward — so an automated strategy cannot rely on intraday funding arriving later. And peak margin reporting means brokers monitor the highest margin utilisation across snapshots during the day, not just the end-of-day figure.
The practical consequence for a strategy that opens and closes positions through the session: a brief spike in utilisation counts. A strategy that is flat at 15:30 but touched 95% utilisation at 11:00 was, from a margin perspective, running at 95%.
What this forces into your design
Check available margin before every order, from the broker rather than from an internal estimate.
Treat the peak, not the average, as the number you are sizing against.
Leave headroom for an intraday parameter revision — the requirement can rise while you hold.
Handle the insufficient-margin rejection as a first-class outcome, with a defined response, not as an exception.
How much headroom
Decision tree
Pre-trade margin decisions should fail closed
A trade proceeds only when fresh broker data and the projected basket both fit under the internal ceiling.
First query broker available and utilised margin. If the query fails or data is stale, reject the trade. If fresh, ask the broker margin calculator for the complete projected basket in its intended leg order. If that fails, reject. Compute projected utilisation including the basket. If above the internal ceiling, resize or skip. If below, send through a basket or risk-reducing leg order and monitor the resulting peak.
Unknown margin is not zero margin. Refusing an ambiguous trade is cheaper than discovering the requirement after one leg fills.
There is no universal number, but there is a defensible way to derive one: size so that the strategy survives the largest margin increase you have historically observed on the instrument, plus the largest position the strategy can take.
Peak
Size against this
Not average utilisation
Before
When to check margin
Every order, from the broker
Days
Physical settlement ramp
Begins before expiry, not on it
The one case that needs a separate rule is physical settlement. Margin on physically-settled stock derivatives escalates in the sessions before expiry, so a position that is comfortably margined early in the week can trigger a shortfall later without moving. Expiry day mechanics covers the settlement side; the margin side needs a days-to-expiry trigger that closes or rolls the position well before expiry day itself.
A margin check worth having
margin_gate.pypython
class MarginGate: """Pre-trade margin check. Sits alongside the position-limit gate.""" def __init__(self, broker, utilisation_ceiling: float = 0.70): self.broker = broker # Ceiling well below 100%: the requirement can rise intraday on an # unchanged position, and peak utilisation is what gets measured. self.ceiling = utilisation_ceiling def allows(self, projected_margin: float) -> bool: try: available = self.broker.available_margin() used = self.broker.utilised_margin() except Exception: # An unknown margin state is not a green light. Refusing a trade # costs one missed signal; proceeding blind costs a rejection at # best and an unhedged leg at worst. return False total = available + used if total <= 0: return False return (used + projected_margin) / total <= self.ceiling
The gate refuses on ambiguity. A failed margin query is not permission to proceed.
Common ways this goes wrong
Symptom
Underlying cause
Order rejected for margin on a hedged structure
Naked leg placed first; portfolio benefit not yet recognised
Margin shortfall with no new trades
Intraday parameter revision, or a physical-settlement ramp
Strategy stops trading mid-session
Utilisation ceiling reached; usually correct behaviour, but alert on it
Peak utilisation far above expectation
Sizing against average rather than the strategy’s maximum position
One leg of two filled
Margin sufficient for the first leg only; use a basket order
Every row here is a design problem rather than a market problem, which is the useful thing about margin: unlike slippage, it is knowable in advance. The broker will tell you the requirement for a basket of orders before you send them, and a strategy that asks is a strategy that does not get surprised.
Frequently asked questions
What is the difference between SPAN and exposure margin?
SPAN margin covers the worst-case one-day loss computed across a scenario grid at the portfolio level, so it recognises offsetting legs in a hedged structure. Exposure margin is an additional buffer on top, generally a percentage of notional, and it largely does not recognise hedges. Total requirement is the sum of both.
Why did my margin requirement increase without me trading?
SPAN parameters are revised by the exchange during the day, and a rise in volatility increases the worst-case loss on an unchanged position. Physically-settled stock derivatives add a second cause: margin escalates in the sessions leading up to expiry, so a position that was comfortably funded early in the week can trigger a shortfall later without moving.
Does the order in which I place legs affect margin?
Yes, significantly. Margin is computed on the portfolio, so a hedged structure requires much less than the sum of its legs — but only once both legs exist. Placing the naked leg first means being margined as an unhedged position for that moment, which can cause a rejection and leave you with one leg of a two-leg structure. Use a basket or multi-leg order facility so the portfolio is evaluated as a whole.
What margin utilisation should an automated strategy target?
Well below 100% — a ceiling around 70% is a defensible starting point, because the requirement can rise intraday on an unchanged position and because peak utilisation rather than average is what gets measured. Derive your own figure from the largest margin increase historically observed on the instrument combined with the largest position the strategy can take.
Should I calculate SPAN margin myself or query the broker?
Query the broker. Reimplementing SPAN locally is substantial work that drifts out of sync as the exchange revises parameters. Every major Indian broker exposes an endpoint that takes a basket of orders and returns the requirement. Treat a failure to reach that endpoint as a refusal to trade rather than as permission to proceed.