Hyperliquid Funding Rate Carry Bot
An open-source funding rate carry bot for Hyperliquid. It is a directional perp strategy, not market-neutral arbitrage: the bot opens the side that receives funding, caps hold time, and limits concurrent positions.
This Is Funding Carry, Not Market-Neutral Arb
The bot scans Hyperliquid perp markets for unusually large predicted funding rates. If funding is strongly positive, it opens a short so the position receives funding. If funding is strongly negative, it opens a long for the same reason.
That is useful, but it is not true arbitrage. There is no hedge leg. The bot takes outright directional perp exposure while it waits to collect funding, so price movement can easily dominate the funding income.
The strategy is best understood as directional funding carry: a way to monetize extreme positioning when you are willing to wear the underlying market risk.
What The Current Implementation Tracks
Every bot-opened position is tracked in process memory with its open time plus the next top-of-hour funding settlement. The bot will hold that position until that next settlement before closing it just because funding normalized, which reduces trivial churn around noisy snapshots.
You can bound exposure with `--max-positions` and `--max-hold-hours`. If a market still looks attractive but the bot is already at its cap, it leaves the extra opportunity alone instead of stacking risk indefinitely.
The bot also continues to leave manual positions alone. It only auto-manages positions it opened itself during the current process lifetime, and if you manually change the side or size it stops managing that symbol.
Parameters And Sizing
`--threshold` is measured in funding percent per hour. `--interval` is the polling cadence in seconds. `--max-positions` controls breadth and `--max-hold-hours` is a hard hold cap for bot-opened positions.
`--size` is asset-unit size, reused across every market the bot touches. That means a single value like `0.01` behaves very differently on BTC than it does on a low-priced alt. If you want tighter per-market control, you would still need to extend the bot.
Scan-only mode is still available when you want to inspect opportunities without placing any trades.
Where The Risk Really Is
The main risk is straightforward: the bot may receive funding and still lose money on price. A position earning funding into a strong trend can still perform badly if the market keeps moving against it.
This implementation also does not persist its bot-managed settlement-tracking state across restarts. If you restart the process, previously opened positions are no longer treated as bot-managed positions for minimum-hold logic.
So the value here is transparency and a cleaner starting point, not a claim that this is finished institutional funding arbitrage infrastructure.
Command-Line Arguments
| Flag | Description | Default |
|---|---|---|
| --threshold | Funding threshold in % per hour that triggers a trade | 0.01 |
| --size | Position size in asset units, reused across symbols | 100 |
| --interval | Polling cadence in seconds | 300 |
| --max-positions | Maximum concurrent bot-opened positions | 5 |
| --max-hold-hours | Maximum hold time for a bot-opened position | 24 |
| --scan-only | Print opportunities without trading | false |
Risk Warnings
- ■This is directional carry, not market-neutral arbitrage.
- ■Funding can reverse before you collect enough to justify the price risk.
- ■A single `--size` value is reused across symbols and can mis-size alt exposure badly.
- ■Bot-managed hold tracking is process-local and resets on restart.
Get Started
Run the linked repo from its root with the exact entrypoint this strategy exposes.
1. Clone the repo
$ git clone https://github.com/atlasdetitan/hyperliquid-trading-bots.git
$ cd hyperliquid-trading-bots
2. Install dependencies
$ python3 -m pip install -r requirements.txt
3. Configure credentials
$ printf 'PRIVATE_KEY=0x...\\n' > .env
Generate an agent wallet at app.hyperliquid.xyz/API and set PRIVATE_KEY in .env. If you use an agent wallet, add ACCOUNT_ADDRESS for the authorizing main wallet. Scan-only mode can skip credentials.
4. Run the repo entrypoint
Live trading example
$ python3 strategies/funding_arb/bot.py --threshold 0.01 --size 0.01 --interval 300 --max-positions 3 --max-hold-hours 12
Scan-only example: python3 strategies/funding_arb/bot.py --scan-only
DEPLOY ON HYPERLIQUID
Run this bot on the fastest on-chain perpetuals exchange