📖 Guides

Hyperliquid Self Trade Prevention: How STP Works (2026)

⚠️ Disclosure: Some links on this page are affiliate links. If you sign up through them, I may earn a commission — at no extra cost to you. I only review tools I actually use.
About this guide: I'm Lawrence, the writer behind supa.is. Between February and May 2026 I've published 150+ articles on supa.is across crypto and brokerage tooling — including 30+ Hyperliquid-specific guides (recent examples: Hyperliquid Order Types Explained, Hyperliquid Maker vs Taker Fees, Hyperliquid First Trade Pending Fix). The most-repeated reader question across that Hyperliquid archive is exactly how self-trade prevention works, which is why I'm publishing this standardized guide instead of answering one-off.

Trading on a decentralized exchange like Hyperliquid comes with a unique set of mechanics that differ from traditional centralized exchanges. One of the most critical mechanisms for protecting traders from accidental losses is Self-Trade Prevention (STP). If you have multiple open orders in the same market, or if you are running automated trading bots, your buy orders can cross your sell orders. Without STP, this results in self-trading—buying from yourself at a price that is often worse than the current market rate, effectively bleeding your capital through unnecessary fees and slippage.

Understanding how Hyperliquid handles self-trade prevention is essential for anyone managing multiple positions or using algorithmic strategies. In this guide, we will break down how STP works on Hyperliquid, the different modes available, and why getting it right matters for your trading efficiency.

What is Self-Trade Prevention (STP)?

Self-trade prevention is a mechanism designed to prevent a trader from accidentally buying and selling the same asset simultaneously. It happens when a trader has an open buy order and an open sell order for the same trading pair, and the price moves in a way that causes these orders to cross.

Imagine you have a limit buy order for ETH at $2,500 and a limit sell order for ETH at $2,550. If the market price suddenly drops to $2,525, your sell order might get filled by your own buy order. Without STP, you would have just bought ETH at $2,525 and sold it at $2,525. You made zero profit, but you paid both the maker and taker fees, resulting in a net loss.

For manual traders, this is rare. But for traders running multiple strategies, grid bots, or high-frequency algorithms, self-trading is a constant risk. Hyperliquid's STP mechanism ensures that your orders don't eat into your own capital, preserving your edge and keeping your fee costs low.

How Hyperliquid's STP Mechanism Works

Hyperliquid's self-trade prevention operates at the matching engine level. When an order is placed or modified, the engine evaluates whether filling it would result in a self-trade. If a conflict is detected, the engine applies the active STP rule.

According to Hyperliquid's official documentation, STP is handled transparently. The system automatically detects when an incoming order would match against an existing order from the same user. Instead of allowing the trade to execute, the engine cancels one of the orders to prevent the self-trade.

The specific behavior depends on the STP mode you have configured. Hyperliquid provides flexibility, allowing traders to choose how the engine should react when a self-trade is imminent. This is particularly important because different trading strategies require different STP behaviors. For instance, a market-making bot might want to cancel the resting order, while a trend-following bot might prefer to cancel the incoming order.

STP Modes on Hyperliquid

Hyperliquid offers multiple STP modes to accommodate different trading styles. Knowing which mode to use can save you from unexpected order cancellations and fee losses.

1. Cancel Maker (Cancel the Resting Order)

In this mode, if an incoming order would trigger a self-trade, the resting order (the maker) is cancelled. The incoming order (the taker) is allowed to continue matching against the rest of the order book.

This is the most common mode for market makers and grid traders. If your grid bot places a buy order at $100 and a sell order at $101, and the price suddenly spikes to $100.50, your buy order would be cancelled, allowing your sell order to fill against the actual market instead of your own buy order. This prevents you from buying from yourself, but it does mean your resting order is removed from the book.

2. Cancel Taker (Cancel the Incoming Order)

In this mode, the incoming order (the taker) is cancelled if it would result in a self-trade. The resting order remains on the book.

This mode is useful for traders who want to keep their limit orders active on the order book and don't want them to be cancelled by sudden price movements. If you have a large limit sell order and a sudden spike in buying pressure causes your buy orders to cross it, your buy orders will be cancelled instead of your sell order. This preserves your liquidity provision but might result in missed entry points.

💡 Hyperliquid

Like what you're reading? Try it yourself — this link supports ChartedTrader at no cost to you.

Start Trading on Hyperliquid →
🎁 You receive: 4% fee discount on first $25M volume · per account, lifetime

3. Cancel Both

In this mode, both the resting order and the incoming order are cancelled if a self-trade is detected. This is the most conservative approach, ensuring that no self-trade occurs and that neither order remains on the book to potentially cause issues later. It's rarely used by active traders because it results in the highest order cancellation rate, but it provides the strictest protection against accidental self-trading.

Why STP Matters for Your Trading

The real cost of self-trading isn't just the zero-profit trade—it's the double fee hit. You pay the maker fee and the taker fee for a trade that nets you nothing. If you're running a grid bot, a self-trade can also mess up your logic, causing it to misinterpret the signal and place the wrong subsequent orders. STP stops this bleeding at the source.

Configuring STP Settings on Hyperliquid

Hyperliquid allows traders to adjust their STP mode directly from the trading interface through the order settings or preferences menu. The available modes include Cancel Maker, Cancel Taker, and Cancel Both, allowing users to select the behavior that best aligns with their strategy.

It's important to choose the right mode for your strategy. If you are a market maker, Cancel Maker is usually the best choice. If you are a trend follower who wants to keep your limit orders active, Cancel Taker might be better. If you are unsure, Cancel Maker is generally the safest default.

Common STP Scenarios and How to Handle Them

Understanding how STP works in practice can help you avoid common pitfalls. Here are a few scenarios to consider:

Scenario 1: The Sudden Price Spike

You have a limit buy order at $1,000 and a limit sell order at $1,010. The market suddenly spikes to $1,005. Without STP, your sell order would fill against your buy order. With Cancel Maker STP, your buy order is cancelled, and your sell order fills against the market. With Cancel Taker STP, your sell order remains, and your buy order is cancelled.

Scenario 2: The Grid Bot Overlap

You are running a grid bot that places multiple buy and sell orders. The price moves up, causing your buy orders to cross your sell orders. With STP enabled, the engine prevents the self-trade by cancelling the appropriate orders based on your STP mode. This ensures your grid bot continues to operate without wasting fees on self-trades.

Scenario 3: The High-Frequency Strategy

You are running a high-frequency strategy that places and cancels orders rapidly. The rapid order flow increases the risk of self-trading. STP ensures that your orders don't accidentally match against each other, preserving the integrity of your strategy.

How STP Differs from Other Exchanges

Unlike centralized exchanges where STP is usually a rigid, unchangeable default, Hyperliquid lets you pick your mode. Because it operates on-chain, the cancellations are transparent—you can trace exactly why an order was killed, which is a huge advantage when debugging a bot.

Best Practices for Using STP on Hyperliquid

Don't just leave STP on the default. If you're a market maker, Cancel Maker is your friend; if you're a trend follower, Cancel Taker keeps your limit orders alive. Also, keep an eye on your order book—if you're seeing a lot of unexpected cancellations, your STP mode might be fighting your strategy. Test with small size first, especially in volatile markets where STP triggers more often.

Conclusion

Self-trade prevention is a critical feature for any trader on Hyperliquid. It protects you from accidental self-trades, saves you from unnecessary fees, and ensures that your trading strategy operates as intended. By understanding how STP works and choosing the right STP mode for your strategy, you can trade with confidence and efficiency.

Whether you are a manual trader or an algorithmic trader, taking the time to configure your STP settings can make a significant difference in your trading performance. Don't let self-trades eat into your profits—use Hyperliquid's STP mechanism to your advantage.

Ready to start trading on Hyperliquid with confidence? Start Trading on Hyperliquid today and take advantage of the 4% fee discount on the first $25M of volume (excludes Vaults and sub-accounts) for new users, as of July 2026.

Risk Warning

Risk Warning: Crypto trading involves substantial risk of loss. Never invest more than you can afford to lose. This is not financial advice.

FAQ

What happens if I don't use STP on Hyperliquid?

If you don't use STP, your orders might cross and result in self-trades. This means you would buy from yourself, paying both maker and taker fees for a trade that yields zero profit, effectively losing money.

Can I change my STP settings at any time?

Yes, you can change your STP settings at any time directly from the Hyperliquid trading interface. Just navigate to the order settings and select your preferred mode.

Which STP mode is best for grid trading?

For grid trading, Cancel Maker is usually the best choice. It ensures that your resting orders are cancelled if they would result in a self-trade, allowing your incoming orders to fill against the actual market.

Does STP affect my trading fees?

Yes, STP helps you avoid unnecessary fees by preventing self-trades. Without STP, you would pay both maker and taker fees for trades that yield zero profit.

Is STP enabled by default on Hyperliquid?

Yes, STP is enabled by default on Hyperliquid. However, you can adjust the STP mode to better suit your trading strategy.

Continue with Hyperliquid

Browse the Hyperliquid guide hub for the complete user journey.

Official reference: Hyperliquid documentation.

🧮 Free Hyperliquid calculators

Fee Calculator →
Hyperliquid vs centralized exchange fee comparison
PnL & Liquidation →
Perp PnL + liquidation price
Position Size →
Risk-aware position sizing for HL perps
Hyperliquid

Ready to get started? Use the link below — it helps support ChartedTrader at no cost to you.

Start Trading on Hyperliquid →
🎁 You receive: 4% fee discount on first $25M volume · per account, lifetime
📈

About the author

I'm a systematic trader running live strategies on IB (USDJPY momentum) and Hyperliquid (crypto perps). Every tool reviewed here is something I've used with real capital. Questions? Reach out.

📚 Related Articles

📖
Guides

OKX Web3 Wallet to Hyperliquid: Bridge USDC (2026 Guide)

Bridge USDC from your OKX Web3 self-custody wallet into Hyperliquid: which chain to start on, in-wallet swap vs external bridge, costs, and pitfalls.

May 5, 2026 ⏱ 13 min read
📖
Guides

Hyperliquid One-Block Finality Explained (2026)

Understand how Hyperliquid's one-block finality works to prevent MEV and front-running. Learn why execution security matters for crypto traders.

July 11, 2026 ⏱ 10 min read
⚖️
Comparisons

Hyperliquid vs Bybit Perpetuals: DEX vs CEX Compared (2026)

Hyperliquid vs Bybit perpetuals compared: custody, KYC, fees, leverage, and on-ramps. Cited 2026-04 numbers and a real trader's take on which fits which profile.

May 1, 2026 ⏱ 12 min read