Blog
Building a Market-Making Bot on Hyperliquid: Liquidity Provision and Profit Mechanics
A trader with $50,000 capital can deploy an algorithmic market-making strategy on Hyperliquid and potentially generate consistent revenue through bid-ask spreads, without paying gas fees per trade and without relying on a centralized exchange to hold custody of funds. The platform’s fully on-chain central limit order book processes up to 200,000 orders per second with sub-second block times, creating execution conditions that rival traditional financial market venues. That capability matters because market-making profitability depends on speed, order book depth, the cost of failed trades, and the precision with which a bot can detect and exploit temporary price dislocations.
Building a functional market-making algorithm on Hyperliquid requires understanding three layers: the technical infrastructure that enables rapid order placement and cancellation, the economic mechanics that determine spreads and inventory risk, and the operational framework for monitoring performance and managing drawdowns. A bot that ignores any of those layers will lose capital to adverse selection, larger traders, or simple execution errors. The goal of this guide is to walk through the actual process—not the marketing version—so that developers and traders can evaluate whether Hyperliquid’s architecture makes market-making viable for their specific capital and risk tolerance.
Why Hyperliquid’s architecture matters for market-making
The distinction between Hyperliquid and automated market maker platforms is fundamental. Most decentralized exchanges use liquidity pools and constant product formulae to price trades; Hyperliquid instead runs a central limit order book that operates identically to a traditional stock exchange or futures venue. When a market maker places an order, it sits in the book until matched by an incoming market order or canceled. That model creates genuine two-sided liquidity and allows market makers to express precise pricing preferences rather than gambling on a curve’s virtual reserves.
The mechanical advantage is immediate: zero gas fees for individual trades. On Ethereum or other Layer 1 blockchains, each limit order placement, cancellation, and partial fill can cost $5 to $50 in gas, making frequent rebalancing economically infeasible for most traders. Hyperliquid’s high-performance blockchain processes trading as core functionality rather than as an afterthought settled by expensive smart contract calls. The network’s HyperBFT consensus produces blocks in sub-second timeframes, meaning a market maker can post an order, observe the order book state, and cancel or adjust within milliseconds if conditions change. That speed differential is essential because market-making is fundamentally a race: the fastest accurate response to price movement captures spread profit rather than absorbing losses.
The order book itself is entirely transparent and on-chain. A market-making bot can consume the full order book state, including depth at every price level, with latency measured in tens of milliseconds. That transparency also means no hidden order flow, no preferential matching for certain users, and no liquidity disappearing into a dark pool. A market maker’s edge comes entirely from faster reaction time, better price prediction, and capital efficiency rather than from information asymmetry or preferential treatment.
Perpetual futures on Hyperliquid support up to 50x leverage and operate with a fully collateralized order book system. A $50,000 account can theoretically control $2.5 million notional exposure, though the actual prudent range depends on volatility, position duration, and the specific asset. This leverage enables a market maker to maintain wider position ranges on the same capital, which can be advantageous if the bot is designed to hedge through spot positions or offsetting contracts rather than betting on direction.
Core mechanics of order book market-making
A basic market-making algorithm maintains two standing orders: one buy limit order below the midpoint and one sell limit order above it. The spread between them is the «bid-ask spread» the market maker is willing to accept as compensation for risk. When the midpoint moves, the bot must update both orders or cancel and replace them to remain profitable. The actual implementation requires deciding: how wide should the spread be, how deep should orders be sized, and how frequently should the bot rebalance.
The spread must exceed three costs: the institutional trading costs of the assets the bot holds, the inventory risk incurred while holding unmatched orders, and the opportunity cost of capital. On Hyperliquid, a bot buying Bitcoin at 40,000 and selling at 40,100 collects a $100 spread per contract. But if Bitcoin moves to 40,200 before the sell order is filled, the bot has created a $100 loss relative to fair value, offsetting one fill’s profit. The wider the spread, the better the protection against adverse price movement, but also the fewer fills the bot receives because other market makers and aggressive traders will route to tighter spreads. The optimal spread is therefore dynamic: it should narrow when volatility is low and order book depth is high, and widen when volatility is high or the bot’s inventory is unbalanced.
Inventory management is the second lever. A market maker that consistently has more long positions than short positions will eventually accumulate a large directional bet, which concentrates risk and defeats the hedging purpose of market-making. Professional market makers use position tracking to detect skew and adjust order sizes asymmetrically: if the bot is long 100 contracts, it should size the sell orders larger and the buy orders smaller until equilibrium is restored. Hyperliquid’s spot market (available since the HyperEVM launch in February 2025) creates an additional option: a bot can hold long perpetual positions while selling spot tokens, or vice versa, creating a cash-and-carry or reverse cash-and-carry arbitrage alongside the market-making function.
The third consideration is execution latency and order acknowledgment. When a bot submits an order to Hyperliquid, it receives a confirmation that the order has been placed on-chain, but it does not yet know whether other orders have been matched against it. A well-designed bot should not assume an order has been filled until it observes the fill in a subsequent order book query or in a dedicated fills endpoint. This lag—typically under 500 milliseconds on Hyperliquid—is short compared to traditional markets, but it remains long enough for adverse selection if the bot rebalances prematurely and cancels an order that is about to fill profitably.
Technical implementation and API considerations
Hyperliquid publishes official REST and WebSocket APIs that allow a bot to query the current order book, submit and cancel orders, and stream updates in real time. The WebSocket connection is the critical path for a market-making bot because it delivers order book snapshots and trade updates with minimal latency. A bot should establish a WebSocket connection, request an order book snapshot at startup, and then apply deltas as they arrive rather than polling the REST API every 500 milliseconds, which would accumulate unnecessary latency.
The authentication mechanism uses signatures derived from the private key associated with the trading account. Unlike centralized exchanges, which issue API keys and secrets, Hyperliquid signs each API request with the account’s private key, meaning the bot itself must have access to the private key or to a hardware wallet that can sign requests. For an automated market-making bot running continuously, this creates a security tension: the bot needs to operate unattended, but the private key is the crown jewel of the account. The practical solution is to run the bot on a dedicated, low-security-surface VM with a private key that holds only the capital intended for the bot and no additional reserves. Alternatively, a trader can use an email-based account (part of Hyperliquid’s self-custody model) and delegate signing permissions to a smart contract or trusted service, though that approach introduces additional dependencies.
Order placement on Hyperliquid uses a command structure that specifies the asset, side (buy or sell), order size, limit price, and whether the order is post-only (meaning it will be rejected if it would immediately match against an existing order). A market-making bot should use post-only orders exclusively because the goal is to provide liquidity and collect the spread, not to aggressively buy or sell at market prices. A post-only order acts as a circuit breaker: if the bot’s price predictions are sufficiently wrong that aggressive traders are immediately willing to trade at the quoted prices, the bot’s orders will fail to place, which is actually protective because it prevents losses from stale quotes.
Capital allocation and position sizing
A $50,000 account deployed on Hyperliquid should not put all capital at risk simultaneously. The rule of thumb is to allocate no more than 20 to 40 percent of capital to active market-making orders at any given time, with the remainder reserved for adverse price moves, margin maintenance, or operational buffer. If the bot is maintaining buy orders at 39,900 and sell orders at 40,100 with 10 contracts each, it is committing $399,000 of buying power and $401,000 of selling power. On Hyperliquid, that exposure counts against the account’s margin utilization, which is capped at a certain percentage of total collateral to prevent liquidation spirals.
The actual position sizing should scale with realized volatility. Bitcoin perpetuals on Hyperliquid are currently volatile enough that a bot operating on a 5-minute rebalance cycle should expect typical moves of 50 to 100 basis points per cycle. If a bot is sized for 10 contracts on a $50,000 account and Bitcoin moves 1 percent adversely, the unrealized loss is approximately $4,000 to $5,000, which represents 8 to 10 percent of the account. That is acceptable for a trading strategy but only if the bot is profitable enough on average to offset such moves. If the bot generates $200 to $300 of daily spread profit but experiences daily drawdowns of $500 to $1,000, the strategy will fail within weeks.
To validate position sizing, a bot should be backtested on historical order book data before deployment. Hyperliquid publishes archived order book snapshots and trade data, allowing a developer to replay the exact market conditions from past days and measure what profit the bot’s algorithm would have generated. A realistic backtest will assume the bot’s orders are filled at the exact prices specified and include a slippage buffer for network latency (typically 5 to 20 basis points). If backtested profitability is marginal after accounting for all frictions, the live strategy will almost certainly lose money once real execution uncertainty and adverse selection are factored in.
Managing adverse selection and inventory risk
The core risk a market maker faces is that aggressive traders (and other bots) can observe the market maker’s orders and execute against the side that is currently losing money. If Bitcoin is accelerating upward and has just broken above 41,000, other traders will aggressively buy at the market maker’s buy-side orders while canceling the sell-side orders before they can be filled. The market maker then holds long inventory right as the move is happening, creating a loss. This dynamic is called adverse selection and it is the primary reason market makers fail.
A defensive strategy is to use order placement timing and spread widening to reduce adverse selection exposure. Rather than keeping orders posted at all times, a bot can poll the order book every few hundred milliseconds, calculate the fair price based on recent trades and implied volatility, update both orders in a single atomic batch, and then wait for the next refresh. The latency between refreshes creates a window during which the orders are stale, but if the refresh interval is short (under 500 milliseconds on Hyperliquid’s sub-second blocks), the staleness is minimal. During periods of high volatility (detected by measuring price movement over recent intervals), the bot should automatically widen the spread to compensate for the higher probability of adverse moves.
Another defensive tool is to use a volatility forecast based on recent realized volatility or implied volatility from other perpetual contracts. If Bitcoin’s 5-minute realized volatility has been 50 basis points per minute, the bot should widen its spread and reduce order sizes accordingly. If volatility drops to 10 basis points per minute, the bot can tighten the spread and increase sizes. This dynamic adjustment is what separates a profitable market-making strategy from one that bleeds out during high-volatility periods.
For more sophisticated implementations, a bot can also infer directional information from order book imbalance. If there are significantly more bid orders than ask orders at the same distance from the mid price, that often signals that buyers are more aggressive and the price is likely to move up. A market maker detecting such imbalance can bias its order placement slightly, moving the effective mid price slightly higher or lower to front-run the directional move and reduce adverse selection. This technique is subtle and should be applied conservatively because it requires confidence in the signal and careful calibration to avoid turning the bot into a directional trading algorithm.
Profitability factors and operational thresholds
A market-making bot’s profitability depends on four measurable factors: the spread collected per fill, the fill rate (how often orders are matched), the inventory holding period (how long positions remain unhedged), and the cost of capital. On Hyperliquid, because there are no gas fees, the cost per trade is entirely the spread paid to the liquidity taker (typically 0 to 5 basis points depending on the asset) plus the bid-ask spread the market maker is quoting.
A realistic expectation for a market-making bot on Bitcoin perpetuals is to collect 10 to 30 basis points of spread per fill, with fills occurring once every 5 to 20 minutes per order side, depending on volatility and order book depth. If a bot maintains 10 contracts of orders on each side, that translates to approximately 200 to 600 basis points (or 2 to 6 percent) of daily profit on a $50,000 account, which is 0.04 to 0.12 percent daily return. The range is wide because profitability depends entirely on market conditions, competition from other market makers, and whether the bot’s spreads are correctly calibrated.
A bot that generates only 0.02 percent daily profit will struggle because transaction costs, slippage on hedging trades, and operational risk will erode that margin. A bot reliably generating 0.1 percent daily profit is sustainable and can compound into significant returns over time. The threshold for «not worth the operational effort» is approximately 0.05 percent daily profit; below that, the risk of a single large adverse move or a bug in the algorithm will wipe out weeks of gains.
Operational considerations include hardware uptime, API reliability, and monitoring. A market-making bot should run on a machine with redundant network connectivity, automatic restart capabilities, and real-time alerting if the bot stops updating orders or if the account approaches a liquidation threshold. The bot should also publish logs of every trade, every order placement, and every cancellation so that performance can be reviewed post-hoc and the algorithm can be debugged. A bot running blind, with no visibility into what it is actually doing, will eventually behave in unexpected ways and lose capital.
Integration with broader ecosystem and DeFi opportunities
Since the HyperEVM launch in February 2025, Hyperliquid has expanded beyond perpetuals and spot trading to support a broader DeFi ecosystem. A market-making bot can now arbitrage between Hyperliquid’s spot market and external liquidity sources, lending opportunities within the ecosystem, or index tokens that track baskets of underlying assets. The economic mechanics remain the same: identify a mispricing, exploit it with minimal latency, and manage inventory risk. But the integration points have multiplied.
For example, a bot could deploy stablecoins in a lending protocol to earn yield while maintaining standing orders on the perpetual market. If fills on the perpetuals accumulate long Bitcoin, the bot can hedge by selling Bitcoin spot on Hyperliquid or lending it to generate additional yield. This type of integrated strategy requires careful accounting because the profit from market-making is distributed across multiple contracts and protocols, and a bug in one piece can contaminate the entire operation.
Developers interested in exploring these opportunities can review additional resources and technical details through sites.google.com/cryptowalletextensionus.com/hyperliquid/, where current API documentation and ecosystem tools are aggregated. The official Hyperliquid documentation remains the source of truth for API specifications and protocol updates, but external resources can provide context and example implementations that accelerate development.
Monitoring, drawdown management, and exit rules
A market-making bot should never run without explicit drawdown limits and exit rules. If the account loses 10 percent of its capital in a single day due to a market gap or an algorithmic error, the bot should automatically stop accepting new orders and allow only closing trades until the account is reset. If the account loses 20 to 30 percent cumulatively, the strategy should be abandoned until the root cause is identified and corrected. Continuing to deploy a broken algorithm is not a sign of conviction; it is a sign of poor risk management.
Daily performance monitoring should include at minimum: the total profit or loss (split by fills, holding costs, and slippage), the number of filled orders by side, the average spread collected, the maximum drawdown during the day, and the account’s current margin utilization. All of these metrics should be logged to a database or file so that weekly or monthly reviews can identify trends. A bot that generated consistent 0.1 percent daily profit in the first week but declined to 0.01 percent in the second week should trigger an investigation into whether the market has become more competitive, whether volatility has changed, or whether the algorithm has drifted.
Exit rules should also account for black swan events: sudden gaps in price due to macro news, exchange outages, or regulatory changes. Hyperliquid’s infrastructure is robust, but no exchange is guaranteed to stay online forever. A market-making bot should have a maximum position size it is willing to hold if normal exit routes are unavailable, and it should aggressively close positions during any period when system stability is in question. If Hyperliquid announces scheduled maintenance or if there are signs of network degradation, the bot should close all open orders and positions immediately rather than waiting for conditions to normalize.
Frequently asked questions
What minimum capital is required to run a profitable market-making bot on Hyperliquid?
A $50,000 account is viable for learning and small-scale profitability. However, because market-making returns are typically 0.05 to 0.15 percent daily, a $50,000 account generating 0.1 percent daily profit yields $50 per day in absolute terms. After accounting for hardware costs, operational overhead, and rebalancing friction, the true net return may be only $20 to $30 per day. Larger accounts ($500,000 or more) can deploy multiple algorithms and capture economies of scale in monitoring and infrastructure. Smaller accounts should focus on low-latency, low-overhead strategies or consider pooling capital with other traders.
Do market-making bots on Hyperliquid compete with each other, and does that reduce profitability?
Yes, competition from other bots and professional traders directly compresses spreads and reduces fill rates. As more market makers deploy capital, the equilibrium spread narrows, which benefits consumers but reduces each individual bot’s profit margin. The solution is to differentiate through better latency, superior inventory management, or capturing microstructure patterns that competitors have not identified. Bots that rely only on simple «maintain 10 basis point spread» rules will eventually underperform as others converge on the same strategy.
What happens if my market-making bot’s orders are still open when Hyperliquid experiences a sudden price gap?
If Bitcoin gaps from 40,000 to 42,000 overnight due to macro news, a bot’s buy orders are stranded underwater and will likely be filled at a loss. The sell-side orders will expire unfilled and leave the bot short inventory. To mitigate this risk, a bot should close all positions before high-impact news events (FOMC meetings, major economic releases) and maintain conservative position sizing relative to daily volatility. Historical drawdowns are the best guide: if the largest intraday move in Bitcoin is 3 percent, size the bot to survive a 5 percent gap without liquidation.