A single option trade can look cheap and still pay seven different charges. In this episode of Inside Kestrel we build the Indian cost model line by line.
Intro
One Option Trade, Seven Charges
You sell one lot of a NIFTY call at two hundred rupees. The premium you collect is thirteen thousand rupees. By the end of the trade, seven separate charges have taken a bite, and one of them is not even a fee on the fee. Today we build the exact receipt, in code.
- One sale, seven charges
- Premium collected: Rs 13,000
Where We Are in the Series
In the last episode we built the simulated venue and its fill rules, so we know when and at what price an order fills. This episode answers a different question: once a fill exists, exactly how many rupees does it cost? Slippage stays in episode ten. Here we only count fees.
- Ep 10: when and where fills happen
- Ep 11: what each fill costs
Learning Goals
By the end you will be able to compute the exact Indian cost of any fill, and you will understand why brokerage is charged per order, not per fill, and how Kestrel spreads that charge across partial fills without ever overcharging. We will also be honest about what the model leaves out.
- Exact cost per fill
- Brokerage per order, not per fill
- Known limits
The Flat Model
Two Models Per Asset Class
Every asset class in the cost configuration can use one of two models. The first is called flat, and it is the default. The second is called india, and it knows about every statutory charge. We start with flat, because it is the baseline the india model is measured against.
- flat: the default
- india: full statutory model
The Flat Formula
The flat cost is a per-unit amount times quantity, plus basis points of notional. Then a floor is applied: the cost is at least the minimum. Finally, if a maximum percent of notional is set, the cost is capped at that percent of notional. Three steps: add, floor, cap.
- add per-unit and bps parts
- floor at the minimum
- cap at max percent, if set
Flat Model by Numbers
Take illustrative settings: zero per unit, five basis points, a minimum of ten rupees. A fill with notional one lakh gives five basis points, which is fifty rupees, above the floor, so we pay fifty. A fill with notional ten thousand gives five rupees, the floor lifts it to ten. Simple, predictable, and good for quick experiments.
- Rs 1,00,000 at 5 bps: pay Rs 50
- Rs 10,000 at 5 bps: floor lifts to Rs 10
Why Flat Is Not Enough
The flat model cannot say that selling costs more than buying, because it has no notion of side. It cannot say that GST applies to some charges and not others. And it cannot say that brokerage is charged once per order. Indian markets have all three features, so we need the india model.
- No side awareness
- No per-charge GST rule
- No per-order brokerage
The India Model
Start With Notional
In the india model everything starts from notional, N. N is quantity times price times the contract multiplier. For options, the price is the premium. So sixty-five units at a premium of two hundred gives thirteen thousand, not the strike value of lakhs. Forgetting that multiplier is a classic bug.
- N = qty x price x multiplier
- Options: price is the premium
The Seven Components
From N we derive seven charges. Brokerage, charged per order. Securities or commodity transaction tax, the STT or CTT, with different rates for buy and sell. The exchange transaction charge. The SEBI fee. Stamp duty, buy side only. The IPFT charge. And finally GST. Let us take them in turn.
- Brokerage, STT, exchange, SEBI
- Stamp, IPFT, GST
Brokerage: Per Order
Brokerage is per order. For percentage-based products it is the smaller of a rupee cap, here twenty rupees, and a basis-point fraction of the order value. For others it is simply a flat amount per order. Notice the word order: it depends on the whole order, not on how many fills it took.
- min(brokeragePerOrder, bps x order value)
- Or a flat amount per order
STT, Exchange, SEBI, IPFT
The transaction tax has a buy rate and a sell rate, each in basis points of notional. The exchange charge is one rate. The SEBI fee is ten rupees per crore, which is a hundredth of a basis point. The IPFT charge is one paisa per crore. All four are just a rate times N.
- Each is a rate times N
- SEBI: Rs 10 per crore
- IPFT: Rs 0.01 per crore
Stamp Duty, Buy Side Only
Stamp duty is charged on the buy side only. When you sell, the stamp component is exactly zero. It is a small thing, but it is the reason a round trip is not symmetric, and the model must carry the side all the way down to this line.
- Buy: stamp applies
- Sell: stamp is zero
GST Is Selective
GST is eighteen percent, but only on brokerage, exchange charge, SEBI fee and IPFT. It is not charged on STT, and not on stamp duty. So GST is not a tax on the total. It is a tax on the service charges. Keep this in mind, because it is the subtle one.
- 18% of brokerage + exchange + SEBI + IPFT
- Not on STT, not on stamp
Default Rates
A Warning About Rates
Before we see numbers, a clear warning. These rates are the code's defaults, called indiaFeeDefaults, as of 2026, after the 2026 budget changed the transaction tax. They change over time. They are not advice, and you must always check them against your own broker's contract note.
- Code defaults, as of 2026
- Rates change; not advice
Equity: Intraday and Delivery
For equity intraday: brokerage is the smaller of twenty rupees and zero point zero three percent. STT is zero point zero two five percent on the sell side. Exchange is zero point zero zero three zero seven percent on NSE and zero point zero zero three seven five on BSE. Stamp is zero point zero zero three percent. Delivery changes the picture: brokerage is the smaller of twenty and zero point three percent, STT is zero point one percent on both sides, and stamp is zero point zero one five percent.
- Intraday: STT 0.025% sell only
- Delivery: STT 0.1% both sides
Futures and Options
Futures: brokerage is the smaller of twenty and zero point zero three percent, STT is zero point zero five percent on sell, NSE exchange is zero point zero zero one eight three percent, stamp is zero point zero zero two percent. Options are charged on the premium: twenty rupees flat per order, STT zero point one five percent on sell, NSE exchange zero point zero three five five three percent, BSE zero point zero three two five percent, stamp zero point zero zero three percent.
- Futures: STT sell 0.05%
- Options: Rs 20 flat, STT sell 0.15%
Reading the Table
Notice the pattern. The exchange charge on options is about twenty times the futures rate, yet it applies to a small premium rather than to a huge contract value. That is why the notional definition matters so much: the same rate table gives wildly different rupee costs depending on what N means for the product.
- Rate is only half the story
- The base N decides the rupees
Code Walkthrough
The Function Signature
Here is the function that does all of it. computeIndiaFees takes the fee schedule, the side, the fill notional, and a brokerage figure that has already been decided. Notice that brokerage is an input, not something computed here. That separation is the whole trick for partial fills, and we will come back to it.
- Schedule, side, notional, brokerage
- Brokerage arrives precomputed
Absolute Notional and Side
The first two lines take the absolute value of the notional, so signed quantities cannot produce negative fees, and read whether the side is a buy. Fees are always positive costs. A sell fill might carry a negative signed notional in other parts of the engine, and this line makes that irrelevant.
- std::abs keeps fees positive
- buy flag drives STT and stamp
STT and the Rate Lines
Now the charges. STT picks the buy rate or the sell rate with a ternary, divides by ten thousand to turn basis points into a fraction, and multiplies by n. Exchange, SEBI and IPFT follow the same shape. Stamp is the odd one out: it is the buy rate on a buy and a literal zero otherwise.
- bps / 1e4 times n
- Stamp: buy rate or 0.0
The GST Line
The last line is the GST line. Read the parentheses carefully: gstRate times the sum of brokerage, exchange, SEBI and IPFT. The variable f dot stt does not appear. Neither does stamp. The rule we stated earlier is not a comment or a convention; it is literally the set of terms inside the brackets.
- GST base is four terms
- STT and stamp are outside
The Full Function
Put together, the function is ten lines of pure arithmetic. No state, no I/O, no hidden lookups. It returns a FeeBreakdown, a struct with one named field per charge. A pure function like this is trivial to test against a contract note, and that is exactly what we want from money code.
- Pure function, no state
- Returns a FeeBreakdown
Worked Examples
Receipt One: Selling an Option
Now the receipt. Sell sixty-five NIFTY calls at two hundred. N is thirteen thousand. Brokerage is flat twenty. STT at zero point one five percent is nineteen point five zero. Exchange at zero point zero three five five three percent is four point six one eight nine. SEBI is one point three paise. IPFT is a hundred-thousandth of a rupee.
- N = 65 x 200 = 13,000
- STT 19.50, exchange 4.6189
Receipt One: GST and Total
GST: add brokerage twenty, exchange four point six one eight nine, SEBI and IPFT, which gives twenty-four point six three one nine one three. Multiply by eighteen percent, and you get four point four three three seven. The total is forty-eight rupees fifty-seven paise, about zero point three seven percent of the premium.
- GST: 18% x 24.631913 = 4.4337
- Total Rs 48.57, 0.37% of premium
Receipt Two: Selling a Future
Now one NIFTY future lot of sixty-five, sold at twenty-two thousand eight hundred. N is fourteen lakh eighty-two thousand. Brokerage is twenty, because zero point zero three percent of that is far above the cap. STT at zero point zero five percent is seven hundred forty-one. Exchange is twenty-seven point one two. SEBI is one point four eight two. IPFT is about a paisa and a half in thousandths.
- N = 14,82,000
- STT Rs 741, exchange Rs 27.12
Receipt Two: Total
GST is eighteen percent of the service charges, roughly eight rupees seventy-five. The total comes to seven hundred ninety-eight rupees thirty-five paise. Look at the proportion: STT alone is more than nine-tenths of the bill. With futures, the tax dominates and brokerage is almost a rounding error.
- GST about Rs 8.75
- Total Rs 798.35; STT dominates
Stacked Bars: Option vs Future
Draw both receipts as stacked bars, each normalised to its own total. The option bar is a mix: STT about forty percent, brokerage about forty percent, exchange and GST making up most of the rest. The future bar is almost entirely STT. Same function, same schedule, completely different anatomy. That is why you cannot summarise cost with one number.
- Option: brokerage and STT balanced
- Future: STT is almost everything
Per-Order Brokerage
The Partial Fill Problem
Now the subtle part. An order of one hundred shares may arrive as several fills. Brokerage belongs to the order, but the engine processes fills one at a time. If every fill paid twenty rupees, a fragmented order would be charged many times over. If every fill paid its own capped percentage, the total could drift above the true order charge.
- Order may fill in pieces
- Brokerage belongs to the order
The Incremental Idea
The fix is incremental billing. Define brokerage as a function of cumulative order value. Each fill pays the brokerage of the cumulative value after this fill, minus the brokerage of the cumulative value before it. The pieces telescope, so the sum over all fills is exactly the brokerage of the whole order.
- Pay B(after) minus B(before)
- Sum telescopes to B(order)
The Code Lines
In code: already is zero for the first fill, otherwise indiaBrokerage of the schedule on the prior cumulative value. The brokerage for this fill is indiaBrokerage on prior plus this fill's notional, minus already, clamped at zero by std max. That clamp guards against any floating-point oddity going negative.
- already = charge so far
- This fill pays the increment
- max(0.0, ...) guards negatives
Worked Partial Fill
Intraday buy of one hundred shares at one thousand. Order value is one lakh. Zero point zero three percent of that is thirty, and the cap is twenty, so the order should cost exactly twenty. First fill: sixty shares, sixty thousand rupees, zero point zero three percent is eighteen, under the cap, so it pays eighteen. Second fill: cumulative one lakh gives twenty, minus eighteen already paid, so it pays two. Total twenty.
- 60 shares: min(20, 18) = Rs 18
- 40 shares: 20 minus 18 = Rs 2
Why Fees Stay Separate
Because brokerage is passed into computeIndiaFees, the other charges remain per fill and proportional to each fill's notional, while GST automatically follows whatever brokerage that fill paid. STT, exchange, SEBI and stamp split naturally across fills because they are linear in notional. Only brokerage is non-linear, so only brokerage needs the incremental trick.
- Linear charges split on their own
- Only brokerage needs increments
Pitfalls and Limits
Three Classic Mistakes
Three mistakes to avoid. First, charging twenty rupees on every partial fill, which overcharges fragmented orders. Second, putting STT inside the GST base, which inflates GST. Third, forgetting the multiplier when computing N, which makes every percentage charge wrong by the lot size. Each one is easy to write and silent in a backtest.
- Rs 20 per partial fill
- GST on STT
- Forgetting the multiplier
What Is Not Modelled
Be honest about the limits. The model does not charge STT on exercise of options. It does not round to the paisa the way a contract note does. It leaves out clearing and depository charges, and it ignores state caps on stamp duty. These are real, but small or situational compared with the main charges.
- No STT on exercise
- No paisa rounding
- No clearing or DP charges
- No stamp state caps
Live Fills Carry Zero
One more boundary. Live fills carry a commission of zero. When a real order fills at the broker, the model does not guess the fee; the broker's contract note is the truth. The cost model exists for backtests and paper trading, where no real contract note exists. Fees are attached to each Fill as a FeeBreakdown and written to fills dot csv in columns for brokerage, stt, exchange, sebi, stamp, ipft and gst.
- Live fills: commission 0
- Contract note is the truth
- fills.csv has 7 fee columns
Recap
Recap
To recap. Flat costs are add, floor, cap. The india model starts from notional, quantity times price times multiplier, and derives brokerage, STT, exchange, SEBI, stamp, IPFT and GST. GST covers only the service charges. Brokerage is per order, so each fill pays the increment of the cumulative charge, and the order total is exactly the capped figure.
- Flat: add, floor, cap
- India: seven charges from N
- GST on service charges only
- Brokerage by increments
Next Episode and Subscribe
Remember, every rate here is the code's default as of 2026, illustrative, and not advice. Next time we price the options themselves with Black-Scholes and back out implied volatility by bisection.
- Next: Black-Scholes and implied vol
- Subscribe for the series