PART 3

Derivatives

A derivative is a contract, not a thing. Its value is a function of somebody else’s price — and everything difficult about trading one lives in the fine print: what you post, when you are marked, what you owe at expiry, and how fast your exposure changes while you are looking the other way.

Worked example: the cash-settled ARENA10 index future Black–Scholes, implemented on this page Seven widgets · nothing is recorded
Part 3.1

1What is it? A contract whose value is a function of another price

Buy a share of Apple and you own a fraction of a company: a legal claim on its assets and cash flows that exists whether or not anybody quotes it. Buy an option on Apple and you own a promise from a counterparty, whose value is a function f(S, t) of the Apple price and the time left. Nothing was created; risk was moved from one balance sheet to another. Every derivative is, in the end, someone else’s obligation.

1 · Transfer risk (hedging)

An airline needs jet fuel in six months and cannot store it. A pension fund owns $400 m of equity it does not want to sell but does not want the next 5 % drawdown either. Both buy a contract that pays when the thing they fear happens. The hedge is not a bet — it is the removal of a bet they were already carrying by accident.

2 · Capital efficiency (leverage)

A future on a $290 index costs $40 of posted margin, not $290 of cash — a 7.3× exposure ratio. That is the same economic position for 14 % of the capital. It is also the same loss, in full, on the whole $290 of notional, which is why Part 3 of this page is mostly about how that ends.

3 · Exposure you cannot own outright

You cannot buy “the S&P 500”, or 3-month interest rates, or “volatility”, or the difference between Brent and WTI. You can buy a contract whose payoff is defined on any of them. Derivatives are how a view becomes a position when the view is not a thing that trades.

Interactive · the four families

Almost every listed derivative is one of four shapes. Pick one — click, or tab to it and press Enter — to see its payoff, who owes what, and, most importantly, the fields your trading system has to carry for it that it never needed for a share.

Forward

—

Who owes what

    Your system must model

      The engineering consequence. A share is one number in a portfolio: a quantity. A derivative is a row with a lifecycle — margin posted, a mark that is not the underlying’s price, an expiry date, a settlement rule, and a set of partial derivatives that change every tick. If your portfolio object cannot answer “what do I owe if this settles tonight?” you do not have a derivatives system, you have a spreadsheet that has not been tested yet.
      Part 3.2

      2How does it work? Family by family

      Three mechanics blocks. Futures first, because their machinery (margin, daily marks, cost of carry, settlement) is the machinery of every cleared derivative. Then options, where the payoff is non-linear and the sensitivities become the position. Then swaps, in one diagram.

      2.1 · Forwards versus futures — same payoff, completely different plumbing

      The forward: a bilateral promise

      You and a bank agree today: in 90 days you pay $292.75 and receive one unit of the index. Nothing changes hands now. The contract is a private agreement — negotiated size, negotiated date, negotiated collateral — and it is a credit exposure for the whole 90 days. If the index goes to $340, the bank owes you $47.25 per unit and your profit is only as good as the bank.

      • Traded OTC, by phone or by a dealer’s API; no public price
      • Any size, any date — perfect for a hedge with an odd shape
      • Hard to exit: you offset with a new forward, or negotiate a tear-up
      • Mark-to-market is an internal accounting entry, not a cash flow

      The future: the same promise, standardised and cleared

      An exchange publishes a contract — fixed size, fixed expiry, fixed settlement rule — and interposes a clearing house between the two sides. After the trade you are not facing the person who sold to you; you are facing the clearer, which is facing them. That single substitution (novation) is what makes an anonymous order book possible: you never have to price your counterparty’s credit.

      • Fungible: your long offsets anybody’s short, so you can exit by trading
      • Initial margin posted up front; variation margin paid in cash every day
      • The clearer takes credit risk and turns it into liquidity risk for you
      • Price is public and continuous — which is what makes the basis tradeable
      The trade the clearing house makes on your behalf. Bilateral credit risk (“will they pay in 90 days?”) becomes daily cash settlement (“can you pay today?”). Nobody accumulates a large unpaid loss, because the loss is collected every session. The failure mode moves: you no longer default because your counterparty went bust, you default because you were right eventually and out of cash on Tuesday.

      Interactive · margin account simulator

      A long position in the ARENA10 future, marked every settlement cycle. You post initial margin; each cycle’s price change is debited or credited in cash. When equity falls below the maintenance level, the clearer issues a margin call — top back up to initial, in cash, now. Step through a path and watch a position that is merely wrong for a while consume more cash than it ever risked.

      Maintenance is checked against the current notional, so a rising market raises the requirement too. Equity below zero means the clearer closes you out and sends the bill.

      Cycle
      0 / 20
      Equity
      $0
      Cash posted
      $0
      Margin calls
      0
      P&L on notional
      $0
      Return on cash
      0.0 %

      Basis and cost of carry — why the future is not the spot price

      A future for delivery in T years is not a forecast. It is spot plus the cost of holding spot until then. Borrow $S at rate r, buy the asset, collect its dividend or coupon yield q, deliver it at expiry: the only price that leaves you flat is

      F = S · e^((r − q) · T)    basis = F − S   (“contango” if positive, “backwardation” if negative)

      This is an arbitrage relation, not a model: if the future trades above F you sell the future, buy the basket with borrowed cash, and carry it to expiry for a locked-in profit — cash-and-carry. That is why the basis is one of the few signals in this course with a fair value you can actually write down. Note what happens as T → 0: the carry goes to zero and the future must converge to spot. Convergence is the mechanism a basis trade harvests.

      Interactive · fair value, basis and the carry trade

      Defaults are the ARENA10 base level (290.20 = the equal-weighted average of the ten listed names) with a 3-month contract.

      Fair value F
      —
      Fair basis
      —
      Market basis
      —
      Mispricing
      —
      Implied carry
      —
      Verdict
      —

      Cash versus physical settlement

      Physical

      At expiry the short delivers the asset and the long pays the price. Real, and full of operational teeth: warehouse receipts, delivery windows, grade adjustments, the famous risk of forgetting to roll a crude contract and being invoiced for 1,000 barrels. For a systematic system the requirement is blunt: a hard rule that flattens or rolls before the last trading day, enforced by the risk layer and not by a human remembering.

      Cash

      At expiry nobody delivers anything. The exchange computes a settlement level from a published reference — usually an average over a window, to make it hard to manipulate — and pays the difference in cash. Index futures, rate futures and every crypto perpetual work this way. Your system only needs the settlement formula and the timestamp.

      The platform’s worked example · ARENA10

      The course exchange lists exactly one derivative, and it is deliberately the simplest possible one: a cash-settled future on an equal-weighted index of the ten listed equities. Read the registration and the venue config together and you have the complete contract specification.

      # plugins/securities/futures.py
      INDEX_MEMBERS = ("AAPL", "MSFT", "NVDA", "TSLA", "AMZN",
                       "GOOGL", "META", "NFLX", "AMD", "INTC")
      
      def index_level(prices):
          """Equal-weighted average of the members."""
          v = [prices[s] for s in INDEX_MEMBERS if prices.get(s, 0) > 0]
          return sum(v) / len(v) if v else None
      
      arena.register_security(
          id="ARENA10", name="ARENA-10 Index Future",
          asset_type="future", base_price=290.20,
          price_fn=arena10_price_fn,
          vol=None,        # derived from members, not drawn
          tick_order=1,     # priced AFTER every member
      )
      # exchange/config.py — the contract spec
      FUTURES = {"ARENA10"}          # settles as a future
      
      # Initial margin per contract, each side. Symmetric:
      # a short carries the same requirement as a long.
      FUTURES_MARGIN_PER_CONTRACT = 40.0
      
      # Ticks between variation-margin settlements
      # — this venue's "daily" mark.
      FUTURES_SETTLE_TICKS = 300
      
      # How much the future's OWN book moves its mark.
      # ZERO: a cash-settled future is marked against
      # its index, so its book may trade at a basis
      # without moving the settlement price.
      FUTURES_MID_BLEND_WEIGHT = 0.0
      Read that last flag again. The future’s mark comes from the index, not from its own order book. So the ARENA10 book can print 293.60 while the index sits at 290.20 and the venue will still settle you at 290.20 — the basis is real money, left on the table for whichever team notices. Margin is a flat $40 per contract on a $290 notional, so one contract is 7.3× leverage, and the mark happens every 300 ticks whether you were watching or not. Three lines of config, three exam questions.

      Note also the pedagogical point in the module docstring: ARENA10 is the brokers’ first real hedge. A market maker who is long a basket of single names from quoting can sell the index against it, keep the spread income, and shed most of the directional risk. Before the future existed, the only way to reduce inventory risk was to stop quoting — which is to say, to stop earning.

      2.2 · Options — the payoff bends, and the bend is the whole subject

      A future is a linear promise: one point of index is one point of P&L, up or down, forever. An option is a right without an obligation, and that asymmetry is what makes the payoff a hinge instead of a line. Four attributes define one completely, and your system needs all four in the position row: call or put, long or short, strike K, expiry T. The fifth number, the premium, is what the market charges you for the hinge.

      Long is a right; short is an obligation

      The buyer pays premium up front and can never lose more than that. The seller receives premium up front and takes on an obligation that can cost far more — a naked short call is theoretically unbounded. Those two positions are not two sides of a symmetric coin: the buyer’s worst case is known at trade time, the seller’s is not. Everything about how they are margined and risk-managed follows from that.

      A call at strike K pays max(S−K, 0) at expiry; a put pays max(K−S, 0). That is the entire payoff definition, and it is two lines of code. Getting from there to a price is the hard part.

      Intrinsic value and time value

      Split any option premium in two. Intrinsic is what it would pay if expiry were now — max(S−K,0), never negative. Time value is the rest: everything you are paying for the possibility that the next weeks go your way.

      Time value is largest at the money and decays to zero at expiry, non-linearly: slow at first, then a cliff. It is also the only part of the premium that volatility can move. A deep in-the-money option is nearly all intrinsic and behaves almost like the underlying; a far out-of-the-money option is all time value, which is a polite way of saying it is a lottery ticket with a decay schedule.

      Deep OTM

      S = 100, K = 130 call. Intrinsic 0. All time value. Delta ~0.06 — barely responds to spot.

      At the money

      S = 100, K = 100. Intrinsic 0, maximum time value, maximum gamma. Delta ~0.5: the most uncertain option there is.

      Deep ITM

      S = 100, K = 70 call. Almost all intrinsic, delta ~0.97. A stock position with a coupon of decay attached.

      Moneyness

      Usually quoted as K/S or ln(K/S)/(σ√T) — strike distance measured in standard deviations, which is the only version that compares across names.

      Interactive · payoff-diagram builder

      Stack up to four legs. Every premium is priced by the Black–Scholes function further down this page at the volatility, rate and maturity you set, so the P&L line is honest about what the structure costs. The dashed line is the position’s value at expiry; the solid line is that minus what you paid. Load a preset, then disable one leg and watch which risk comes back.

      Rate fixed at 4.00 %. One contract = one unit of underlying, so every number is per unit — multiply by 100 for a listed US equity option.

      Net premium
      —
      Max profit
      —
      Max loss
      —
      Breakeven(s)
      —
      Delta now
      —
      OnSideInstrumentStrikeQtyPremium
      P&L at expiry (net of premium) Value at expiry (gross) Breakeven

      The Greeks are sensitivities, and they have units

      The premium is a function of five inputs. The Greeks are its partial derivatives — nothing deeper than that. What matters for a system is that each one converts a market move into a dollar number, and each one has a unit you must state or the number is meaningless.

      GreekDerivativeReads asWhat a system does with it
      Delta Δ∂V/∂Sunits of underlying per option Aggregate it to get portfolio exposure; hedge it to zero to isolate other risks.
      Gamma Γ∂²V/∂S²delta change per 1.00 of spot Sets how often you must rebalance. High gamma = your hedge is stale in minutes.
      Vega∂V/∂σ$ per volatility point The size of your view on volatility, whether or not you meant to have one.
      Theta Θ∂V/∂t$ per calendar day The rent. Long options pay it; short options collect it and owe the gamma.
      Rho ρ∂V/∂r$ per 1 % of rate Small for short-dated equity options; dominant for anything on rates.

      Black–Scholes is on this page in about twenty lines of JavaScript, and the widget below is its output. Treat it the way a desk does — not as truth, but as a translation device between a quoted premium and a set of sensitivities everyone agrees to measure the same way. Its assumptions (constant volatility, continuous hedging, lognormal returns) are all wrong in the direction that matters; its value is that it is wrong identically for everybody.

      Interactive · Greeks on a Black–Scholes option

      Premium
      —
      Intrinsic
      —
      Time value
      —
      Moneyness
      —
      Delta
      —
      Gamma
      —
      Vega / vol pt
      —
      Theta / day
      —

      Implied versus realised volatility

      Realised volatility is a measurement: the annualised standard deviation of the returns that already happened. Implied volatility is a quote — the σ you must feed Black–Scholes to reproduce the premium the market is charging. One looks backwards and is a fact; the other looks forwards and is an opinion with a bid-ask spread.

      The gap between them is the option market’s core trade. Implied 24 % against realised 17 % says options are expensive relative to how the underlying has actually been moving — sell volatility, hedge the delta, collect theta, and pray the regime holds. The premium is persistent (that is the variance risk premium) and so is the tail that periodically pays for it.

      What a systematic desk stores

      • A surface, not a number: implied vol per strike and per expiry. Equity index puts are systematically dearer than calls — the skew is a price, not an error.
      • The term structure: 1-week versus 3-month implied. Inversions are stress signals with a long track record.
      • A realised-vol estimator on the same clock as the implied quote, or the spread you compute is an artefact of your sampling.
      • Every Greek aggregated to the portfolio level, per underlying and in total — because that is the number risk limits are written against.

      2.3 · Swaps — exchanging one cash-flow stream for another

      A swap has no strike and no hinge. Two parties simply agree to exchange payment streams on a notional that never changes hands. The plain-vanilla interest-rate swap is the largest derivatives market on earth: one side pays a fixed rate, the other pays a floating reference (SOFR, EURIBOR), and only the net difference moves each period. Notional $100 m, fixed 3.5 %, floating 4.1 %, semiannual: the fixed payer receives 100m × (4.1−3.5) % / 2 = $300k and nothing else happens.

      Interactive · interest-rate swap cash flows

      You are the fixed payer / floating receiver — the position a borrower with a floating loan takes to become fixed, and the position a systematic book takes to be long rates.

      Net total
      —
      Best period
      —
      Worst period
      —
      Notional exchanged
      $0
      Floating received Fixed paid Net cash flow

      Total return swaps

      One side pays financing, the other pays the total return (price plus dividends) of an asset it may not own. Economically identical to a leveraged long, with the position sitting on a dealer’s balance sheet rather than yours. Archegos in 2021 is the standard case study in what happens when several dealers each write one and none can see the others.

      The modern cousin: perpetual futures

      Crypto perpetuals have no expiry, so they cannot converge to spot by expiring. Instead a funding rate is paid every eight hours from longs to shorts (or the reverse), proportional to the perp’s premium over the index. It is a swap bolted onto a future: the funding leg is the carry, made explicit and paid continuously.

      The numbers are not small. Funding of 0.03 % per 8 hours is 0.09 % per day and ~32.8 % per year. A carry trade — long spot, short perp, collect funding — is a real systematic strategy, and forgetting the funding leg is the single most common way a crypto backtest reports profits that never existed.

      Part 3.3

      3Why it matters: what the system has to persist

      Three concrete uses and one warning. The warning first, because it is the one that ends seasons: derivatives are the fastest way to turn a modest edge into a large position, and a large position into a closed account.

      Interactive · leverage and the liquidation level

      Set your account equity and how much notional you want against it. The widget computes the adverse move that takes your equity to the maintenance level — your liquidation distance — and expresses it in daily standard deviations, which is the only unit that tells you whether it will happen. Push the leverage slider and watch the distance collapse faster than your intuition does.

      Notional
      —
      Equity after move
      —
      Return on equity
      —
      Liquidating move
      —
      = daily sigmas
      —
      Status
      —
      LeverageNotionalLiquidating moveDaily sigmasOdds in 60 days
      Why leverage kills, stated precisely. Leverage does not change your expected return per unit of risk — it multiplies both sides. What it does change is the probability of hitting an absorbing barrier before the edge pays out. At 20× on a 1.5 % daily-vol asset, liquidation is roughly 1.7 daily sigmas away: a move that happens several times a quarter. Your strategy never gets to be right, because the position is gone. This is why professional sizing is written in units of volatility (“risk 0.4 % of equity per trade”) and never in units of notional.

      Use 1 · Hedge the delta you did not want

      A market maker ends the session long 640 shares across ten names because that is what the flow gave it. That inventory is a directional bet nobody chose. Compute the basket’s delta in index units, sell that many ARENA10 contracts, and the residual is the spread income you actually earned. The hedge costs margin and basis risk; it buys you the ability to keep quoting.

      The system requirement: a portfolio delta in one currency, recomputed on every fill, and a hedger that acts on a band rather than on every tick — otherwise you pay the spread to the market you are hedging in more often than you save.

      Use 2 · Express a view on volatility, not direction

      You believe the next earnings print moves the stock more than 4 %, but you have no idea which way. There is no stock position that expresses that. A delta-hedged straddle does: buy the hinge, sell the direction, and your P&L becomes roughly ½Γ(ΔS)² − ΘΔt — realised variance against implied. You are now trading the gap between two volatility numbers, which is a signal you can backtest.

      The system requirement: mark vega and gamma as first-class positions, and rehedge on a rule (time band or delta band) that you chose deliberately, because the rehedge policy is part of the strategy’s return.

      Use 3 · Trade the basis as a signal

      The fair value F = S·e^((r−q)T) is one of very few prices in this course with an arbitrage-enforced anchor. Compute it every tick, subtract the future’s market price, and you have a mean-reverting series with a known terminal value: zero, at expiry. On the course venue the anchor is even harder, because FUTURES_MID_BLEND_WEIGHT = 0.0 means the future’s own book cannot drag the settlement price with it.

      The system requirement: index level and future price on the same timestamp. A basis computed from a 200 ms-stale index is mostly a measurement of your own latency, and it will look like alpha right up until you trade it.

      Part 3.4

      4Five ways this goes wrong

      Every one of these has been shipped by a team that understood the theory perfectly. Open them.

      Marking a derivative at the underlying’s price

      The index is 290.20, so the future is worth 290.20 — no. The future is worth what the future is worth, and the difference is the basis: carry, plus whatever the order book is doing. Mark a long future position at spot and you will book a phantom loss on a contango contract every single day, then “discover” a mysterious profit at expiry when it converges.

      The reverse error is worse and more subtle: marking at the future’s own last trade when that is a stale or manipulated print. On the course venue the venue itself marks ARENA10 against the index (FUTURES_MID_BLEND_WEIGHT = 0.0), so your P&L and the exchange’s will diverge unless you copy that convention.

      Fix: store a mark source per instrument, not a mark. Then make your P&L reconcile against the venue’s PortfolioUpdate every settlement, and treat a persistent gap as a bug, never as an edge.

      Sizing by margin instead of by notional

      “I have $50,000 and margin is $40 per contract, so I can hold 1,250 contracts.” You can indeed open them. You are then long $362,500 of index against $50,000 of equity — 7.3× — and a 3 % move is 22 % of your account. The margin requirement is the broker’s tolerance for your default, not a statement about how much risk is sensible.

      The same error wearing a suit: risk limits written in contracts or shares. Ten contracts of a 1 %-vol contract and ten of a 6 %-vol contract are not the same limit, and a limit that cannot tell them apart is decoration.

      Fix: size on risk. Position = (risk budget in $) / (daily vol × notional per contract). Write every limit in dollars of daily volatility or dollars of 1 % move, and have the risk layer reject on that, before the order leaves the process.

      Treating delta as a constant

      You compute delta 0.52, short 52 units, and record “delta neutral” in the log. Spot moves 4 % and delta is 0.63; you are long 11 units and did not place a trade. That is gamma, and it is not an edge case — it is the defining property of the instrument you bought.

      Long gamma means the drift works for you (each rehedge sells high and buys low) but you pay theta for the privilege. Short gamma is the mirror image and is the reason so many “consistent-income” option books have exactly one bad month in their history.

      Fix: recompute Greeks from the current state on every mark, never cache them across a price move, and define the rehedge trigger explicitly — a delta band, a time band, or both. Log the hedge error so you can see how much of your P&L came from the rehedge policy rather than the view.

      Ignoring expiry, settlement and the roll

      A derivative position has a date on which it stops existing. A backtest that holds “the future” for two years is holding an instrument that does not exist; a live system without a roll rule holds a contract into its final settlement window and gets whatever the settlement formula says, which may be an average over a period when liquidity had already left.

      Then there is the splice. Chaining contract prices without adjusting for the roll gap manufactures a jump at every expiry, and a momentum signal will happily trade it. Back-adjusted series remove the jump but change every historical price level, so any rule with an absolute price in it is now wrong.

      Fix: keep expiry, last_trade and settle_rule on the instrument; make the risk layer force a flatten-or-roll N days out; and in research, build the continuous series explicitly, state the adjustment method, and never let a signal see an unadjusted splice.

      Reading option premium as income

      Selling out-of-the-money puts credits cash on day one and expires worthless most months. The equity curve is a beautiful straight line and the Sharpe ratio over two years is fictitious, because you have not sampled the event you were paid to insure. You did not find an edge; you sold a lottery ticket and pocketed the float.

      The premium is real — the variance risk premium is one of the most persistent effects in finance — but it is compensation for a specific, measurable, left-tail exposure. Book it as such: short gamma, short vega, unbounded loss, and margin that expands exactly when you can least fund it.

      Fix: for any short-option book, report the stress loss at −20 % spot and +15 volatility points next to the P&L, always. Size against that number, not against the premium collected. If the strategy does not survive the stress line, the straight line was never the strategy.

      Part 3.5

      5Check yourself

      Three questions, instant feedback, nothing recorded.

      Q1The ARENA10 index sits at 290.20. Financing is 5.0 %, the basket yields 1.5 %, and the 3-month future trades at 293.60. What does a systematic desk do?

      Q2You are long 100 calls at delta 0.52 and short 52 units of the underlying — “delta neutral”. Spot rallies 5 % and delta is now 0.68. What is true?

      Q3ARENA10 at 290.00. Initial margin 10 % (29.00 per contract), maintenance 7 % (20.30, held fixed). You are long. How far can the index fall before the margin call?

      Part 3.6

      6Do the work

      Build these, in this order

      • A fair_value(S, r, q, T) function and a live basis series against a future’s book. Plot it. Convince yourself it converges.
      • A payoff evaluator that takes a list of legs and returns value, P&L, breakevens and delta — the engine behind the builder above, and the thing you will reuse all season.
      • Black–Scholes with all five Greeks, checked against one known value (S=100, K=100, r=5 %, σ=20 %, T=1 → call = 10.4506).
      • A margin simulator for your own strategy’s worst historical 20 days. If it takes a margin call, your sizing is wrong, not unlucky.

      Questions worth arguing about

      • Daily mark-to-market removes credit risk by adding liquidity risk. For whom is that a good trade, and when is it not?
      • If implied vol exceeds realised vol on average, why is short volatility not free money? Answer in units of margin, not of philosophy.
      • A perpetual future has no expiry and therefore no convergence. What forces its price to the index at all, and what happens when that force is not enough?
      • Your basis signal is profitable in the backtest and flat live. Name the three most likely causes before you look.
      Code
      Get the code
      The starter repo is public: a trader, a broker and an exchange you can run on one laptop, with the cash-settled index future already listed. Use it as a template, clone, make install.
      Previous
      ← Part 2 · Asset Classes
      The underlyings. Every contract on this page is a promise about one of them.
      Next
      Part 4 · Market Types & Structure →
      Where these contracts trade, who stands between you and the other side, and why that changes the price.