When I traded my first stock 23 years ago, I thought quant trading was all about expensive cars, lavish parties, and raging hangovers.
I was right.
But beneath this glamorous surface lies a less enticing, yet crucial aspect of the trading world.
A side tirelessly explored by countless quants and high-frequency trading firms.
It’s called market microstructure.
When most people hear “algorithmic trading,” their minds don’t immediately drift to seemingly mundane algorithms like TWAP, IS, and POV, designed to break up massive orders. Nor do they ponder the intricacies of limit book dynamics, tick size, or smart order routing.
These are not the life of the party.
But the truth is, market microstructure is the backbone of algorithmic trading
Understanding its inner workings is key to truly grasping what this world is all about.
How quants and HFTs REALLY make their money
At its core, algorithmic and quant trading relies on computer programs to execute trades based on specific criteria, such as price, time, and volume.
These algorithms, or algos, can execute trades faster and more accurately than humans, reducing the risk of human error and emotional decision-making.
Effective trading algorithms minimize costs while maximizing performance, adapting to market conditions, and using smart order routing.
And you don’t need to be a Wall Street trader to use them.
Trading, Costs, and Alpha
An order book is a list of buy and sell orders, organized by price levels. It includes the total size at each level. The bid-ask spread is the difference between the highest buy order and the lowest sell order.
Orders are sorted by price and arrival time. Each level has a minimum price change, called tick size, to keep things fair.
Many markets use a maker-taker fee structure.
Traders who place orders earn a maker fee when they’re not executed immediately. Those who execute orders against resting orders pay a taker fee.
This encourages more orders and improves market liquidity.
Trading costs include transaction fees. They also include hidden costs like bid-ask spread and market impact. These hidden costs are called slippage.
Backtesting frameworks like Zipline can accurately model slippage.
To reduce market impact, traders break large orders into smaller ones over time. This is where most algorithmic trading takes place.
Types of strategies
The Time-Weighted Average Price (TWAP) strategy spreads an order over time and trades at a constant rate.
The Volume-Weighted Average Price (VWAP) adjusts the trading rate to match historical trading volumes.
Implementation Shortfall (IS) minimizes the difference between the starting price and the actual execution price, balancing costs, alpha, and risk.
The Percent of Volume (POV) strategy participates at a certain rate of the traded volume, reducing risk in high-volume periods.
Brokers like Interactive Brokers let retail traders like us use these algorithms.
Opportunistic strategies like “Hide and Take” and Adaptive IS take advantage of good price or liquidity conditions.
“Hide and Take” stays hidden until opportunities come up, while Adaptive IS adjusts trading based on price changes compared to the starting price.
These strategies can be helpful or just react to random noise, increasing costs without benefits.
Order routing and pricing
In algorithmic trading, you need to decide the limit price, order size, and routing location for each smaller order.
When setting the price of a trade, it’s important to divide it into two parts: fair value (what the asset is worth) and edge (how much discount or premium to add). You want to choose the edge that will give you the most profit. You can calculate the probability of getting a fill for each edge value using past data.
Schedule-based strategies adjust the order size based on fill progress, using larger sizes to catch up or smaller sizes when ahead. Layering places multiple orders at different price levels in the book but may reveal size information. Reserve or iceberg orders hide the true size, but others may guess their presence.
A Smart Order Router (SOR) decides where to send the order. For marketable orders, the goal is to find the best price, possibly splitting the order among multiple locations. For non-marketable orders, the goal is to maximize the chance of being filled, which depends on the queue length, trading rate, and order size at the venue.
Evaluating performance also involves considering the risk tied to the trading strategy. A strategy with good average performance but high variability in results may be riskier and less attractive.
To assess risk, use risk metrics like standard deviation, value-at-risk (VaR), or conditional value-at-risk (CVaR).
Algorithmic trading requires a balance of strategy selection, order pricing, sizing, and routing. Effective trading algorithms minimize costs while maximizing performance, adapting to market conditions, and using smart order routing.