Quant Insider Profile picture
Sep 18 25 tweets 4 min read Read on X
A Detailed Breakdown of High-Frequency Trading Strategy: Order Book Skew Reversion Strategy 🧵with Python code Implementation

Shared by @christinaqi

Like, Retweet and comment "Done", to receive the code for the strategy Image
Key Terminology

Feature (Predictor): An independent variable believed to have predictive value regarding future price movements. In machine learning, these are known as features; in statistics or econometrics, they are called predictors or regressors.
Trading Signal: The output generated by feeding one or more features into a mathematical model. This signal guides trading decisions.

Trading Rule: A hardcoded decision-making criterion. For example, "If the price drops by 1%, buy 100 shares."
Strategy: A combination of trading decisions derived from trading rules and signals. Strategies can be:

Rule-based: Relying solely on predefined trading rules.
Model-based: Utilizing mathematical models and signals to inform decisions.
The Strategy Explained

1. Features Used

Order Book Skew

The skew is a measure of imbalance between the resting bid depth (volume of buy orders, vb​) and the resting ask depth (volume of sell orders, va) at the top of the order book. Image
Interpretation:

Positive Skew: Indicates higher bid depth than ask depth, suggesting upward price pressure.

Negative Skew: Indicates higher ask depth than bid depth, suggesting downward price pressure.
2. Trading Rules

The strategy employs simple trading rules based on the skew:

Buy Signal: Condition: Skew exceeds a positive threshold (k).

Action: Buy a minimum quantity (e.g., 1 lot). Image
Sell Signal:

Condition: Skew falls below a negative threshold (−k-k−k).
Action: Sell a minimum quantity (e.g., 1 lot). Image
Parameters

Threshold k: Determines when the skew is significant enough to trigger a trade.

Limit LLL: Caps the skew to avoid acting on extreme values that may be due to market anomalies or spoofing

Position Limit: Maximum allowable open position (e.g., 10 lots) to manage risk
3. Risk Management

Position Limits

Purpose: Prevents the accumulation of excessively large positions that could exceed margin requirements or risk thresholds.

Implementation:
Trades are only executed if the absolute value of the current position is below the predefined limit.
This ensures the strategy remains within acceptable risk parameters.

Avoiding Spoofing

Spoofing Concern: Large skew values might be artificially created by traders attempting to manipulate the market.
Mitigation:
Introduce the limit LLL to ignore skew values that are too extreme.
This filters out potential false signals due to market manipulation.
4. Additional Considerations

Mean Reversion

Concept: Prices tend to revert to their mean over time. If prices deviate significantly, they may be more likely to move back toward the average.
Application:
Incorporate rules to only buy when the price is at least one standard deviation below recent history and sell when above.

Use a fixed lookback period (e.g., 30 minutes) to calculate the mean and standard deviation.
Bid-Ask Bounce
Concept: There is often a negative autocorrelation between consecutive price changes, especially in markets with a FIFO (First-In-First-Out) order matching system.

Application:
Only buy after a price downtick and sell after a price uptick.
Capitalizes on short-term reversals in price movements

5. Implementation

Step-by-Step Process

Data : Gather real-time order book data, including bid and ask volumes at the top of the book

Calculate Skew: Compute the skew using the provided formula at each time interval
Apply Trading Rules:

Evaluate the skew against the thresholds k and L.
Check the current position against the position limit.

Execute Trades:

If conditions are met, execute a buy or sell order for the minimum quantity.
Risk Monitoring:

Continuously monitor positions and ensure adherence to position limits.

Adjust thresholds as necessary based on market conditions (though over-optimization should be avoided).
Parameter Selection

Threshold k: Determines sensitivity to skew changes.

A smaller k leads to more frequent trades; a larger k results in fewer trades with potentially higher confidence.

Limit L:Filters out extreme skew values.
Set based on historical analysis of skew
distribution to exclude outliers.

Position Limit:

Based on capital availability and risk tolerance.
Should be conservative to prevent excessive exposure.

Order Execution
Minimum Quantity:Trades are executed for the minimum allowable quantity (e.g., 1 lot) to reduce
market impact and slippage.

Adjust according to market liquidity and trading costs.

6. Optimization

Objective

Goal: Find optimal values for k and L that maximize strategy performance without overfitting.
Methodology
Parameter Ranges: Define reasonable ranges based on domain knowledge (e.g., 1≤k≤5, 2≤L≤6).

Grid Search: Systematically evaluate combinations of k and L within the defined ranges.

Performance Metrics:

Sharpe Ratio: Measures risk-adjusted return.
Trade Count Adjustment: May divide the Sharpe Ratio by sqrt{n}​, where nnn is the number of trades, to account for statistical confidence.

Avoid Overfitting:

Keep the number of parameters low.

Avoid optimizing for multiple objectives simultaneously.
Use out-of-sample testing or cross-validation to assess robustness.
Optimization Techniques

Windowed Optimization:

Optimize parameters over rolling time windows to adapt to changing market conditions.

Balances responsiveness with stability.

Cross-Validation:

Split historical data into training and testing sets.

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Quant Insider

Quant Insider Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @QuantINsider_IQ

Sep 11
Statistical Arbitrage for Volatility with Options

This strategy seeks to capitalize on inefficiencies between the implied volatility (IV) priced into options and the realized volatility experienced by the underlying asset.

Here's a detailed Thread 🧵 Image
Exploiting Market Inefficiencies:

Beyond the Black-Scholes Model While the Black-Scholes model provides a theoretical framework, statistical arbitrage goes beyond it by capturing market inefficiencies.
30-Day Skew Targeting: The strategy might focus on the 30-day window leading up to expiration, where the skew (higher implied volatility for puts) tends to be elevated. Image
Read 20 tweets
Sep 10
Detailed Breakdown of Term Structure Trading: 🧵 Image
1. Overview of Term Structure Trading:
Term structure trading focuses on the dynamics of implied volatility (σimp) surfaces across different maturities (T).
The implied volatility surface σimp(K,T), where K is the strike price and T is time to maturity, often exhibits supply-demand imbalances.

These imbalances create arbitrage opportunities that traders can exploit.
Read 21 tweets
Sep 9
Thread: A Comprehensive Guide to Relative Value Volatility Trading 🧵 with mathematical breakdown

1/11 Image
1/ Introduction

Volatility pairs can be traded using options, variance swaps, or futures on volatility indices such as the VIX or vStoxx. Traders focus on indices with differing volatilities and skews, which play a crucial role in volatility market dynamics.
Popular indices for these trades include those with differing volatilities and skews, which significantly impact the volatility market dynamics.
Read 25 tweets
Sep 8
Gamma Exposure (GEX) is a critical concept in understanding how market makers and dealers hedge their positions in the options market and how these hedging activities influence market volatility and price movements

Detailed Thread on Gamma Exposure (GEX) and Its Market Impact🧵 Image
Gamma Exposure (GEX) is a critical concept in understanding how market makers and dealers hedge their positions in the options market and how these hedging activities influence market volatility and price movements.
Introduction to Gamma Exposure (GEX)

Measures the exposure of market makers to changes in the gamma of options contracts. Gamma (Γ) itself is the rate of change of delta (Δ),which measures how much an option's price will change with a $1 move in the underlying asset.131.8K
Read 20 tweets
Sep 4
Vanna and charm effects are important concepts in options trading, closely related to the Greek metrics used to measure and manage risk.

Detailed thread on Understanding and Trading Vanna and Charm effect for trading🧵
Image
Image
Vanna Effect

Vanna measures the sensitivity of an option's delta (Δ) to changes in implied volatility (σ).

Mathematically, it is the partial derivative of delta with respect to implied volatility: Image
Conceptual Understanding:

Volatility Gamma: Vanna is sometimes referred to as "volatility gamma" because it describes how delta changes when implied volatility changes. Image
Read 25 tweets
Jul 9
Detailed Break down of "The Barclays Trading Strategy that Outperforms the Market"🧵 Image
Key Points from Barclays' Report:

1. Retail Influence on Option Volumes:

Retail investors have significantly increased the volume of short-dated call options on large-cap stocks.

This surge is driven by zero-commission trading platforms and stimulus checks.
2. Retail Influence on Option Volumes:

Retail investors have significantly increased the volume of short-dated call options on large-cap stocks.

This surge is driven by zero-commission trading platforms and stimulus checks.
Read 19 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us!

:(