Chapter 21 Exercises
Algorithmic Trading Controls and Kill Switches
Exercise 21.1: Pre-Trade Control Classification
Difficulty: Introductory
For each of the following order rejection scenarios, identify which pre-trade risk control triggered the rejection and explain why the control exists.
a) A VWAP algorithm attempts to submit a buy order for 750,000 shares of a small-cap UK equity (average daily volume: 200,000 shares). The order is rejected.
b) A market-making algorithm submits a bid at £0.0175 for a bond currently priced at £98.50. The order is rejected.
c) A statistical arbitrage algorithm has accumulated a long position of 18,500 EUR/GBP contracts. It attempts to add another 2,000 contracts, which would bring the long position to 20,500. The configured maximum long position limit is 20,000. The order is rejected.
d) An execution algorithm has submitted 350 orders in the last 60 seconds. The configured maximum is 300 orders per minute. The 351st order is rejected.
e) An algorithm has generated intraday losses of €380,000 against an intraday loss limit of −€350,000. The next order is rejected and the kill switch activates.
f) A TWAP algorithm attempts to submit an order where quantity × price = €52 million. The configured maximum notional per order is €50 million. The order is rejected.
Exercise 21.2: Kill Switch Design
Difficulty: Intermediate
A mid-size European investment firm is designing its algorithmic trading kill switch system. The firm runs 12 algorithms across 5 trading venues (Euronext Amsterdam, XETRA, LSE, Cboe Europe, and Turquoise).
a) Identify the five key requirements a MiFID II / RTS 6 compliant kill switch must meet.
b) The risk manager proposes a kill switch design where: - Activation requires two-person authorization (risk manager + compliance officer) - Cancellation of outstanding orders is processed within 30 seconds - Kill switch covers 10 of 12 algorithms (two legacy algorithms cannot be reached by the system) - Kill switch is tested once per year
Evaluate this design against RTS 6 requirements. Identify all deficiencies.
c) Design a compliant kill switch system for this firm. Specify: activation authority, cancellation speed requirement, coverage requirement, testing frequency, and reactivation protocol.
d) Draft a one-page "Kill Switch Procedure" that would be included in the firm's annual self-assessment. Include: what triggers activation, who can activate, what happens on activation, and what is required before reactivation.
Exercise 21.3: Annual Self-Assessment Evaluation
Difficulty: Intermediate
You have been asked to review an investment firm's algorithmic trading annual self-assessment. The document contains the following:
"The firm operates algorithmic trading strategies for execution purposes and market-making in European equities. Pre-trade risk controls are in place including order size limits and price checks. The kill switch has been tested and is operational. We conduct regular reviews of our algorithms."
The attached algorithm inventory lists 8 algorithms. The firm's operations team advises that 11 algorithms are currently running in production (3 are execution algorithms not listed in the inventory, described as "standard tools").
a) Identify all deficiencies in this self-assessment against RTS 6 requirements. Be specific about what is missing or inadequate.
b) What specific documentation should support each required element of a compliant self-assessment?
c) The 3 unlisted execution algorithms have been running for 2 years. Under RTS 6, what steps must be taken immediately to remediate this gap? In what order?
d) Draft a self-assessment improvement action plan with timelines for remediation.
Coding Exercise 21.4: Extend the Pre-Trade Risk Controller
Difficulty: Coding — Intermediate
Using the PreTradeRiskController framework from the chapter:
-
Add the following additional checks to the controller: - Fat-finger price check: Reject any limit order where the price is more than
N × typical_spreadfrom the reference price. Add atypical_spreadfield toInstrumentRiskLimitsand a configurable multiplier. - Duplicate order detection: Reject orders that appear identical (same algorithm, instrument, side, quantity, and price) submitted within 5 seconds of a previous identical order. This catches duplicate order transmission bugs. - Maximum notional per minute: Track cumulative notional value of all orders submitted in the last 60 seconds per algorithm. Reject if it exceeds themax_total_notional_per_minutelimit. -
Add a
generate_risk_report()method that produces a daily risk report showing: - Total orders submitted vs. rejected (by rejection reason) - Peak order rate achieved (orders per second) - Maximum position reached per instrument - Any kill switch activations and their triggers -
Write unit tests (using Python's
unittestorpytest) for each new check: - A test that passes a fat-finger check - A test that fails a fat-finger check - A test that detects a duplicate order - A test that fails a per-minute notional limit -
Demonstrate the controller with a simulated 10-minute trading session producing at least 50 orders, including 5 intentional rejections across different controls.
Exercise 21.5: Market-Making Obligation Analysis
Difficulty: Applied
Quantum Markets Ltd is a high-frequency market maker on Euronext Amsterdam and XETRA. It has entered market-making agreements for 45 equities on each venue. Quantum's algorithm quotes continuously during normal market conditions but is programmed to withdraw (cancel all quotes) if:
- The bid-ask spread for an instrument widens by more than 5× the rolling 1-hour average
- Realized volatility (5-minute rolling) exceeds the 99th percentile of the prior 30-day distribution
- The algorithm's intraday loss exceeds −€200,000
During a market stress episode in October 2024, Quantum withdrew quotes across all 90 instruments within 4 seconds after EUR/USD moved sharply. The withdrawal lasted 18 minutes. The same conditions caused 12 other market makers to withdraw simultaneously, contributing to a liquidity vacuum in European mid-cap equities.
a) Which of Quantum's withdrawal triggers might constitute "exceptional circumstances" under MiFID II Article 17(3)?
b) The market-making agreement requires Quantum to quote for at least 50% of continuous trading hours. If Quantum withdrew for 18 minutes in a 7-hour trading day (420 minutes), does this breach the 50% requirement? Show your calculation.
c) The regulator is investigating whether Quantum's simultaneous withdrawal with other market makers constitutes a violation of its market-making agreement, even if each individual market maker's withdrawal was independently justified. What argument would the regulator make? What defense would Quantum present?
d) Should regulators require market makers to provide guaranteed liquidity during volatility events, even at the cost of widened spreads? Evaluate the tradeoffs from the perspectives of: (i) market integrity; (ii) market makers' risk management; (iii) end investors; (iv) systemic stability.
Research Exercise 21.6: Algorithmic Trading Enforcement Actions
Difficulty: Research-required
MiFID II / MAR algorithmic trading enforcement has increased since 2018. Research and analyze:
a) Identify two FCA enforcement actions (published on the FCA's website) related to algorithmic trading control failures since 2019. For each: describe the firm, the violation, the penalty, and the root cause.
b) The SEC and CFTC have also taken enforcement actions on algorithmic trading (primarily for spoofing and market manipulation). How does the US regulatory approach to algorithmic trading controls compare to MiFID II's framework? Are there substantive differences in what is required?
c) The FCA has published "Market Watch" newsletters with thematic observations on algorithmic trading. Search for the most recent Market Watch relevant to algorithmic trading controls. What did the FCA identify as the key weaknesses observed across firms?
d) Write a 250-word opinion: Is the annual self-assessment requirement (RTS 6) an effective regulatory tool, or does it risk becoming a "tick-box" compliance exercise? What could make it more effective?