Skip to main content

Market Neutral Bot

Learn how the Market Neutral Bot uses strategies like arbitrage and spread trading to reduce risk and earn steady returns in crypto.

Written by Jacob

Market Neutral Bot

We recommend using Cross Margin Mode for safer trading. Note that using Isolated Margin can carry a higher risk of position liquidation. We also recommend using Hedge Mode to prevent positions from offsetting or closing each other.

Meet our advanced Market Neutral Bot! It's designed to enhance your trading experience by leveraging quantitative methods to find profitable opportunities in the cryptocurrency market. The bot uses statistical models to detect price relationships across various cryptocurrency pairs.


Statistical Trading Engine

Our Market Neutral Bot uses a statistical arbitrage approach to uncover potentially profitable trading opportunities. By analyzing historical market data and applying mean reversion principles, the bot identifies and acts on inefficiencies in price relationships between crypto futures pairs. This data-driven strategy helps the bot adapt to evolving market conditions and maintain consistent performance across market cycles.

How Does the Market Neutral Bot Work?

This bot applies a market-neutral trading strategy based on mean reversion analysis, specifically designed for trading crypto futures pairs. The process is systematic and data-driven, consisting of four key stages:

Data Collection & Preparation

  • The bot uses 3 months of historical price data for all tracked cryptocurrencies.

  • This dataset serves as the foundation for all subsequent modeling, including volatility clustering and cointegration testing.

  • By relying on a consistent training period, the bot ensures model stability and relevance to current market conditions.

Volatility Clustering

  • To manage risk and improve selection accuracy, coins are grouped into two volatility clusters: Low Volatility (L) and High Volatility (H).

  • Volatility is assessed using two complementary metrics:

    • Short-Term Predicted Volatility: Estimated from the last 15 days using a GARCH model.

    • Long-Term Historical Volatility: Calculated from the full 90-day dataset.

  • Outliers are removed using interquartile range filtering to ensure clustering is robust and not skewed by extreme values.

  • Each coin is labeled L or H, allowing the bot to focus on coherent volatility groups during cointegration testing.

Johansen Test for Cointegration

  • Within each volatility cluster, the bot evaluates every possible combination of 2 coins for long-term price relationships.

  • The Johansen test is used to detect cointegration—meaning the prices move together over time, even if they drift apart in the short term.

  • If a group is found to be cointegrated, the bot saves:

    • The list of coins in the group

    • The beta weights (indicating how much of each coin to trade)

    • Key statistical outputs (trace statistics and critical values)

Spread Filtering & Ranking

  • All cointegrated spreads are ranked based on the strength of their cointegration, measured as the difference between the trace statistic and critical value.

  • The bot then selects the best spreads while applying a similarity filter to ensure no two selected spreads share more than 50% of the same coins.

  • This prevents overexposure to any single asset and promotes portfolio diversification.

Market Analysis & Execution

Once the optimal spreads are selected, the bot proceeds with the following steps:

Stationarity & Standardization

  • The bot constructs a synthetic spread from the cointegrated group and verifies that the spread remains stationary over time.

  • Spread prices are standardized into Z-scores to measure deviations from the mean.

Strategy Entry & Exit

  • When a significant deviation is detected (Z-score crosses above 0.99 or below 0.01), the bot executes multi-leg limit orders to enter a trade.

  • Positions are held until the spread reverts toward its median (Z-score returns to 0.50), at which point the bot exits profitably.

Risk & Portfolio Management

  • The bot enforces strict risk controls, including per-coin exposure limits and total portfolio allocation caps.

  • Trading fees are factored into all P&L calculations to ensure realistic performance modeling.

Settings Description

The Market Neutral Bot offers a range of configurable settings that allow you to fine-tune strategy behavior, risk management, and execution logic. Below is a detailed breakdown of each setting in a table view.

Position Settings

Setting

Description

Take Profit (%)

The percentage by which the spread price must move in your favor for the position to be closed automatically with a profit.

Stop Loss (%)

The percentage by which the spread price must move against your position to trigger an automatic exit at a loss.

Legs Stop Loss (%)

Closes the entire spread position if any single leg declines by the specified percentage.

Order Type

Setting

Description

Auto

The bot automatically selects the most cost-efficient and slippage-aware method to enter the spread.

Market

Both legs of the spread are executed immediately using market orders.

Two Leg Entry

Places limit orders for both legs; if one fills, the other executes via a market order.

Volatility

Setting

Description

High

Only trade spreads from the high volatility cluster.

Low

Only trade spreads from the low volatility cluster.

Both

Trade spreads from both volatility clusters.

Quantile Group

Setting

Description

1%

Entry is triggered only when the Z-score is in the top 1% of historical deviations (i.e., extremely overbought or oversold).

5%

Entry is triggered when the Z-score is in the top 5% of historical deviations.

10%

Entry is triggered when the Z-score is in the top 10% of historical deviations.

Trade Direction

Setting

Description

Mean Reversion

Enters when the spread deviates significantly, expecting it to revert to the mean.

Trend

Enters in the direction of spread movement, aiming to capture momentum.

Z-Score Rolling Window

Setting

Description

288

Short-term window (approx. 3 day with 15-minute data).

2880

Longer-term window (approx. 30 days with 15-minute data).

Entry Conditions

Setting

Description

Out of the Channel

Enters when the Z-score moves outside the predefined channel.

Into the Channel

Enters when the Z-score moves back inside the channel from an extreme.

Outside the Channel

Similar to “Out of the Channel”—triggers when Z-score exits the normal range.

Summary

The WunderTrading Market Neutral Bot systematically identifies groups of 2 cryptocurrencies that move together, waits for temporary price divergences, enters positions to bet on reversion, and exits when the relationship normalizes. By combining volatility clustering, cointegration testing, and careful spread selection, the bot aims to deliver consistent, market-neutral returns while managing risk and diversification.

Did this answer your question?