Skip to content

Trading8 min read

How to build a Hyperliquid trading bot, with or without code

Ways to run a Hyperliquid trading bot: the Python SDK, API wallets, open-source tools and no-code builders, plus how to backtest a crypto strategy honestly.

, Founder of Hypr Markets

Published

On this page

A Hyperliquid trading bot is a program that places and manages orders on Hyperliquid by itself, following rules you set. You can write one with Hyperliquid's official Python SDK, run an open-source bot framework that already connects to the exchange, or use a no-code crypto trading bot builder where rules are blocks instead of code.

This guide is for traders deciding which route to take. It covers how bots connect to Hyperliquid safely, how to backtest a crypto strategy without fooling yourself, why paper trading comes before real money, and the risks that stay with you whichever route you choose. A bot follows rules faster than a person can. It does not make the rules any better, and nothing here promises that a bot will make money.

Ways to run a Hyperliquid trading bot

Write your own with the official SDK

Hyperliquid maintains an official Python SDK and lists community SDKs for Rust and TypeScript, plus a CCXT integration, on its HyperCore tools page. The SDK handles request signing, which Hyperliquid's signing docs recommend over building signatures by hand. Writing your own gives full control, and full responsibility for every bug.

Use an API wallet, never your main key

A bot should sign with an API wallet (also called an agent wallet), a separate key your main account approves to trade on its behalf. The SDK's setup uses your main wallet's address as the account and the API wallet's private key as the signer. Node provider Chainstack's API reference states that agents "can place and cancel orders but cannot withdraw funds".

Hyperliquid's page on nonces and API wallets adds practical rules: use one API wallet per trading process, because nonces are tracked per signer, and do not reuse an API wallet's address after it is deregistered, because previously signed actions could be replayed. Per the exchange endpoint docs, an account can have one unnamed and up to three named API wallets, and an approval can expire at most 180 days ahead.

Use an open-source bot framework

  • Hummingbot lists a Hyperliquid perpetual connector, with testnet support, for use with its perpetual strategies and scripts.
  • Freqtrade documents Hyperliquid in its exchange notes, including futures with isolated and cross margin. It recommends an API wallet rather than your main key, and warns that Hyperliquid offers only 5,000 historic candles, which limits backtests.

Frameworks save you writing the plumbing, but you still configure, host and watch them.

Use a no-code bot builder

A no-code builder lets you assemble rules ("enter when RSI crosses below 30, exit at 2% profit or a 1% stop") from blocks and run them without a server of your own. The trade-off is flexibility: you can only express what the blocks support.

RouteSkills neededWho runs itMain risk
Your own code on the SDKProgramming, serversYouBugs, key handling
Open-source frameworkConfiguration, serversYouMisconfiguration, unattended failures
No-code builderTrading rules onlyThe builder's platformLimits of the blocks, platform dependence

How to backtest a crypto strategy

A backtest replays a strategy over past prices to see how it would have done. It is useful for one thing: rejecting bad ideas cheaply. It cannot prove a good one.

Include every cost

  • Fees. Hyperliquid charges a fee on every fill, opening and closing, and a front end can add a builder fee. See Hyperliquid fees explained.
  • Funding. Perp positions pay or receive funding every hour, and Hyperliquid's funding docs cap it at 0.5% an hour. A strategy that holds for days needs it in the model. See funding rates explained.
  • Slippage. Assume you fill worse than the candle's close, and worse still in thin markets or for large orders.

A hypothetical example of what costs do to a small edge:

Per round trip (example)Value
Average gross gain per trade0.30%
Hyperliquid taker fee, open and close (0.045% each)0.09%
Builder fee, open and close (0.05% each)0.10%
Slippage, open and close (0.05% each)0.10%
Net gain per trade0.01%

A strategy that looked good before costs barely breaks even after them.

Use enough data, and know where it comes from

Hyperliquid's info endpoint makes only the most recent 5,000 candles available for a market. At 1-hour candles that is under seven months. Hyperliquid's historical data archive holds order book snapshots and asset contexts but no candles, and comes with no guarantee of timely updates. For longer tests, record data yourself or use a data provider, and test across calm and violent markets.

Guard against overfitting

Every setting you try is another chance to fit noise. Bailey, Borwein, López de Prado and Zhu showed in the Notices of the AMS that the more configurations are tried, the higher the probability that the best backtest is overfit, and that a backtest which does not report how many configurations were tried cannot be judged. Three habits help:

  1. Sweep, then look for plateaus. Run a parameter sweep and prefer a range of settings that all work over one sharp peak.
  2. Walk forward. Fit settings on one window of history, test them on the next window the strategy has not seen, and roll forward. If results collapse out of sample, the strategy was fitted to the past.
  3. Count your trials. Write down how many versions you tested, and be more skeptical the higher the number.

Read more than the return

Look at maximum drawdown, the number of trades, time in the market and a risk-adjusted measure such as the Sharpe ratio. A strategy with 12 trades in a year has not shown you much.

Paper trade before going live

A backtest cannot show latency, partial fills, rejected orders, rate limits or a server that restarts at the wrong moment. Paper trading runs the strategy on live prices without real orders, so you see how it behaves now rather than in the past. Hyperliquid also runs a testnet with a faucet for testing real order flow without real money.

When you go live, start with a small allocation, decide in advance the loss at which you stop the bot, and compare live fills with the paper results for a few weeks.

Risks of running a trading bot

  • Losses. A bot can lose money quickly and repeatedly, especially in a market unlike the one it was tested on.
  • Leverage and liquidation. A leveraged position can lose all the margin behind it. The guide to isolated vs cross margin explains how margin mode changes what is at risk.
  • Bugs and outages. A wrong sign, a stuck loop or a dropped connection can place orders you never intended or leave a position without its stop.
  • Key security. A leaked API wallet key cannot withdraw, but it can trade your account into the ground.
  • Promises. Treat any bot sold with promised returns as a red flag.

Strategy Studio: a no-code Hyperliquid trading bot builder

Operators on Hypr Markets can give their clients Strategy Studio, a no-code bot builder inside their branded terminal. It is on Scale, the "Contact us" tier on the pricing page. Clients keep their own wallets, and Hyperliquid matches and settles every trade.

Clients drag blocks into five lanes: Enter, Exit, Protect, Size and Limits. Each block reads as a sentence with values the client can edit, like "RSI of 14 candles crosses below 30", and a preview reruns after every change.

  • 66 blocks, with perps signals built in: funding, open interest, premium and distance to liquidation.
  • 14 starter templates, each saying plainly when it works and when it struggles.
  • Backtests with Sharpe, drawdown, fees and funding, plus a parameter sweep and a walk-forward check for overfitting.
  • Paper first. Strategies run on paper and go live only when the operator allows it. The operator sets the minimum paper days before a strategy can go live.
  • A monitor that answers "why did it trade?" for every decision.

The guardrails sit with the operator:

GuardrailWhat it does
Deploy checksStop a deploy that has no way out of a trade
Operator caps per traderLimits on strategies, allocation, leverage and slippage
Per-strategy limitsDaily loss pause, drawdown stop and maximum orders an hour
Emergency stopOne stop for every strategy on the terminal
Trading keyStrategies trade through a key that cannot withdraw

Also on Scale, pairs and baskets trade the z-score of the spread between two markets, with dollar-neutral or beta-neutral sizing, or baskets of 2 to 12 markets, with every leg sent in one exchange action and unwound if a leg does not fill. An AI strategy builder, which turns a plain-words idea into blocks on the board, is rolling out.

The features page lists every module by plan.

Frequently asked questions

Can I build a Hyperliquid trading bot without coding?

Yes. No-code builders let you assemble entry, exit and risk rules from blocks. On Hypr Markets, Strategy Studio (Scale) offers 66 blocks in five lanes and 14 templates, with backtests and paper trading before any strategy goes live. Without a builder, open-source frameworks such as Freqtrade and Hummingbot need configuration but little or no code.

Can a Hyperliquid trading bot withdraw my funds?

Not if it runs through an API wallet. API wallets (agent wallets) can place and cancel orders but cannot withdraw funds. They can still lose money by trading, so set position limits and a loss limit for every bot.

How do I backtest a crypto strategy?

Replay the strategy over past prices with every cost included: trading fees on each fill, funding for perps and realistic slippage. Use a parameter sweep to find stable settings, check them with a walk-forward test on data the strategy has not seen, and paper trade before using real money.

How much historical data does Hyperliquid provide for backtests?

Hyperliquid's API makes the most recent 5,000 candles available per market. Its public archive holds order book snapshots and asset contexts but no candles. Longer histories need data you record yourself or get from a data provider.

Do trading bots make money?

Some do, many do not, and none can be relied on to. A bot executes rules consistently, but if the rules have no edge after costs, it loses consistently too. Test honestly, start small and never trade money you cannot afford to lose.

All articles