Market making is essentially a constant balancing act between execution probability and risk control. If your quotes are too conservative, you won’t get filled. If they are too aggressive, you get picked off when the market moves sharply.

This tension becomes even more pronounced in the cryptocurrency market, where prices move 24/7, sentiment shifts rapidly, and the order book structure exposes supply and demand in real time.

This naturally leads to a key question:
Can we dynamically adjust market making quotes using Order Book Imbalance?

This article breaks down a practical framework for doing exactly that, with a Python-oriented implementation mindset.

1. Market Making Is Not About Prediction, But Pricing

Many people mistakenly treat market making as a forecasting problem. In reality, it is not about predicting direction.

A market maker mainly cares about three things:

  • Where real liquidity exists around the current price
  • Which side of the book is more “urgent” (aggressive flow)
  • At what price levels orders are most likely to be filled without excessive adverse movement

In crypto markets (Cryptocurrency Market), the order book is one of the most direct sources of microstructure signals. If you can interpret its dynamics, you are already ahead of purely candle-based strategies.

2. Order Book Imbalance (OBI)

A common definition is:

Order Imbalance = (Bid Volume – Ask Volume) / (Bid Volume + Ask Volume)

You can compute it across different depth levels (e.g., top 5 levels, top 10 levels):

  • 0 : Buy pressure dominates
  • < 0 : Sell pressure dominates
  • ~ 0 : Balanced market

The key insight is not directional prediction, but:

It reflects which side of liquidity is more likely to be consumed.

3. Core Strategy: Dynamic Quote Adjustment

A traditional market making model uses:

Mid Price ± Spread / 2

However, this static approach fails when order book conditions shift.

We extend it to a dynamic model:

Bid Price = Mid – Spread/2 + α × Imbalance
Ask Price = Mid + Spread/2 + α × Imbalance

Where:

  • α controls aggressiveness
  • Imbalance shifts quote positioning

This allows quotes to adapt to real-time liquidity pressure.

4. From Order Book Data to Trading Signals

To implement this, real-time order book data is essential.

Using a multi-asset streaming feed (e.g., WebSocket market data API), you can subscribe to Level 2 / depth updates.

Python WebSocket Example (Optimized Market Data Subscription)

import json
import websocket
import uuid
import time

API_KEY = "YOUR_API_KEY"
SYMBOLS = ["BTCUSDT", "ETHUSDT", "XAUUSD"]

WS_URL = f"wss://quote.alltick.co/quote-b-ws-api?token={API_KEY}"

def build_subscribe_msg(symbols):
    return {
        "cmd_id": 22004,
        "seq_id": int(time.time()),
        "trace": str(uuid.uuid4()),
        "data": {
            "symbol_list": [{"code": s} for s in symbols]
        }
    }

def on_open(ws):
    print("WebSocket connected")
    ws.send(json.dumps(build_subscribe_msg(SYMBOLS)))

def on_message(ws, message):
    data = json.loads(message)

    if data.get("cmd_id") == 22998:
        tick = data["data"]

        code = tick["code"]
        price = float(tick["price"])
        volume = float(tick.get("volume", 0))
        direction = tick.get("trade_direction", 0)

        print(f"[{code}] price={price} volume={volume} dir={direction}")

def on_close(ws, close_status_code, close_msg):
    print("Reconnecting in 3s...")
    time.sleep(3)
    start()

def start():
    ws = websocket.WebSocketApp(
        WS_URL,
        on_open=on_open,
        on_message=on_message,
        on_close=on_close
    )
    ws.run_forever(ping_interval=10, ping_timeout=5)

if __name__ == "__main__":
    start()

This pipeline does three things:

  • Streams real-time order book / trade data
  • Extracts imbalance-driven signals
  • Enables dynamic quote updates

5. Why Order Book Imbalance Matters

The key risk in market making is adverse selection—being filled right before the market moves against you.

Order Book Imbalance helps by:

1. Detecting liquidity shifts early

  • Sudden bid accumulation
  • Rapid ask cancellation
  • Price not yet moved, but pressure already building

2. Avoiding wrong-side quoting

If imbalance < 0 (sell pressure), aggressive bid quoting increases risk of being consistently filled before drops.

3. Improving fill quality

Dynamic quotes improve execution probability in the direction of flow.

6. Advanced Improvement: Volatility Filtering

Imbalance alone can be noisy in high-volatility conditions.

A common adjustment:

if volatility > threshold:
    alpha *= 0.5

Interpretation:

  • High volatility → reduce aggressiveness
  • Stable market → allow tighter, more responsive quoting

7. Multi-Asset Extension: Cross-Market Signals

Once multiple assets are connected (BTC, ETH, FX, Gold), the model can expand into:

  • Cross-asset imbalance comparison
  • Volatility normalization
  • Liquidity migration detection

Examples:

  • BTC strong buy pressure + ETH weak → potential capital rotation
  • Gold up + USD down → macro-driven flow

Market making evolves from single-asset quoting to structured pricing across markets.

8. Final Insight: Market Making Is Reading Market Emotion

The order book is not just data—it is a real-time expression of market behavior.

  • Buy clustering = bullish pressure
  • Ask withdrawal = liquidity retreat
  • Imbalance = quantification of micro sentiment

The evolution of market making is not about increasingly complex prediction models, but:

Continuously adjusting quotes based on real-time liquidity pressure with low latency data.

In this sense, market making becomes less about “setting prices” and more about tracking the breathing rhythm of the market.