Market making algorithm development

We design and develop full-cycle blockchain solutions: from smart contract architecture to launching DeFi protocols, NFT marketplaces and crypto exchanges. Security audits, tokenomics, integration with existing infrastructure.
Showing 1 of 1 servicesAll 1306 services
Market making algorithm development
Complex
from 2 weeks to 3 months
FAQ
Blockchain Development Services
Blockchain Development Stages
Latest works
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1170
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1092
  • image_logo-advance_0.png
    B2B Advance company logo design
    563
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    830
  • image_logo-aider_0.jpg
    AIDER company logo development
    763
  • image_crm_chasseurs_493_0.webp
    CRM development for Chasseurs
    878

Development of Market-Making Algorithm

A market maker is a market participant who constantly posts buying and selling quotations. Their profit comes from the difference between bid and ask (spread). Market making provides liquidity to the market, for which exchanges pay rebates (discounts on fees or negative commissions). In crypto, market making has become a highly competitive niche, but for niche assets (mid-cap altcoins, perpetual futures with low liquidity) it remains highly profitable.

Basic Market-Making Model

Naive market making — post bid at X% below mid-price and ask at X% above. Problem: inventory risk. If price moves sharply in one direction, the market maker accumulates an unfavorable position.

Avellaneda-Stoikov model — mathematically optimal market-making strategy. Accounts for inventory risk and time horizon:

bid_price = mid - δ/2 - γσ²(T-t)q
ask_price = mid + δ/2 - γσ²(T-t)q

where:
δ  = spread (optimal)
γ  = risk aversion coefficient
σ  = asset volatility
q  = current inventory (in asset units)
T  = end of trading period
t  = current time

Key: with positive inventory (accumulated a lot of the asset) the algorithm shifts quotes down to sell excess faster. With negative — raises them to buy.

Inventory Management

Inventory risk is the main enemy of a market maker. If position goes beyond acceptable range:

Hard limit: if inventory > MAX_INVENTORY — stop posting orders on the corresponding side. Wait for execution.

Soft limit with skewing: gradually shift quotes against the direction of accumulated inventory. The more inventory — the stronger the shift.

Hedging: open a hedge position on another exchange or in perpetual futures. If accumulated a lot of BTC spot, sell BTC-PERP.

Spread Management

Spread should not be fixed — it adapts to market conditions:

Volatility-based spread: spread = base_spread × (current_volatility / mean_volatility). With high volatility spread widens — inventory risk is higher.

Order book depth: if liquidity in the book is low — adverse selection risk is higher, spread is wider.

Time of day: during periods of low activity spread widens.

Toxic flow: if recent trades were predominantly on one side — possible informed trading. Algorithm widens spread or temporarily removes quotes.

Multi-Level Quotes

Instead of one pair of orders (1 bid + 1 ask) post several levels:

Bid 3: mid - 0.5% × 1000 USDT
Bid 2: mid - 0.3% × 500 USDT
Bid 1: mid - 0.15% × 200 USDT
--- MID PRICE ---
Ask 1: mid + 0.15% × 200 USDT
Ask 2: mid + 0.3% × 500 USDT
Ask 3: mid + 0.5% × 1000 USDT

Orders closer to mid execute more often and receive rebate from the exchange. Distant ones — hedge against sharp movements.

Order Cancellation and Re-Quoting

Orders need to be regularly updated when mid-price changes:

Threshold-based re-quoting: if mid shifted more than N% — cancel old orders and post new ones.

Time-based re-quoting: forced update every T seconds.

Event-based: whenever there is any change in the best bid/ask in the order book.

Frequent order cancellations consume API request quota. Exchanges have rate limits. For Binance: 1200 requests/min HTTP, separate limits for WebSocket. Important to optimize update frequency.

Exchange Market-Making Programs

Major exchanges pay for providing liquidity:

Exchange Program Terms
Binance Liquidity Provider Rebate up to -0.005%
Bybit Market Maker Zero or negative maker fee
OKX Market Maker Special fee terms
Kraken Market Maker Maker rebate on request

To get these terms you need to maintain minimum uptime of quotes (>80% of time bid/ask within a certain range of mid) and minimum volume.

Monitoring and Metrics

P&L breakdown: spread income - inventory risk losses - fees.

Fill rate: percent of orders that executed. Too low → spread too wide. Too high → spread too narrow, lot of adverse selection.

Inventory exposure: current position in USD, maximum for session, average.

Uptime: percent of time quotes are posted.

Latency: time from receiving market update to posting/updating orders.

What We Develop

A market-making system: WebSocket integration with order book monitoring, inventory management with Avellaneda-Stoikov dynamics, adaptive spread calculation, multi-level quote strategy, order management and re-quoting, exchange rebate tracking, real-time P&L monitoring and optimization.