Off-chain HIP-2 Hyperliquidity market maker for Hyperliquid spot markets
Project description
pyperliquidity
A Python implementation of HIP-2 "Hyperliquidity" market-making algorithm. While HIP-2's logic runs fully on-chain, certain spot markets (especially bridged assets) are unable to use this feature. pyperliquidity recovers HIP-2 behavior using an off-chain market maker.
Core concept: Uniswap V2 / infinite-range liquidity pools, but on an order book.
Installation
pip install pyperliquidity
For development:
git clone https://github.com/AlliedToasters/pyperliquidity.git
cd pyperliquidity
python3 -m venv .venv
.venv/bin/pip install -e ".[dev]"
Quick Start
- Create a config file — copy and edit the example:
cp config.example.toml config.toml
Key parameters in config.toml:
[strategy]
coin = "@1434" # Spot pair symbol
start_px = 0.01 # Initial price (bottom of the grid)
n_orders = 100 # Number of price levels
order_sz = 1000.0 # Tokens per tranche
[allocation]
allocated_token = 1000.0
allocated_usdc = 500.0
- Set environment variables for your Hyperliquid wallet:
export PYPERLIQUIDITY_PRIVATE_KEY="0x..."
export PYPERLIQUIDITY_WALLET="0x..."
- Run the market maker:
pyperliquidity run --config config.toml
See config.example.toml for all available parameters including tuning, rate limit, and reconciliation settings.
Architecture
WebSocket Feeds ──► StateManager ──► QuotingEngine ──► OrderDiffer ──► BatchEmitter ──► API
▲ (single source (pure math, (dead zone + (budget-aware, │
│ of truth) no I/O) level-index prioritized) │
└──────────── orderUpdates / userFills / webData2 ──────────────────────────────────────┘
- QuotingEngine — pure math, no I/O. Translates inventory position on a geometric price grid into desired orders.
- OrderDiffer — dead-zone filtering and tolerance checks to minimize unnecessary API calls.
- BatchEmitter — budget-aware, prioritized order emission that respects Hyperliquid's rate limit model.
- WsState — WebSocket-first state management with periodic REST reconciliation.
Development
This project uses OpenSpec for spec-driven development. Domain specs live in openspec/specs/.
.venv/bin/pytest # Run tests
.venv/bin/mypy src/ # Type check
.venv/bin/ruff check src/ # Lint
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyperliquidity-0.2.5.tar.gz.
File metadata
- Download URL: pyperliquidity-0.2.5.tar.gz
- Upload date:
- Size: 138.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a07a466a293727d86bf021939fd634dc56872cda8aca0e0df4a8f221777889fb
|
|
| MD5 |
18d6e38da11bb636654918f7dae61a9e
|
|
| BLAKE2b-256 |
0ec67d8527cd0dc14c755a4f322b930c0a0a3ea474b1a03fbf58fec0023095ce
|
Provenance
The following attestation bundles were made for pyperliquidity-0.2.5.tar.gz:
Publisher:
release.yml on AlliedToasters/pyperliquidity
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyperliquidity-0.2.5.tar.gz -
Subject digest:
a07a466a293727d86bf021939fd634dc56872cda8aca0e0df4a8f221777889fb - Sigstore transparency entry: 1042917819
- Sigstore integration time:
-
Permalink:
AlliedToasters/pyperliquidity@4b12b79554ad8f1e9152386a23dbd4d63dc48bd7 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/AlliedToasters
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@4b12b79554ad8f1e9152386a23dbd4d63dc48bd7 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pyperliquidity-0.2.5-py3-none-any.whl.
File metadata
- Download URL: pyperliquidity-0.2.5-py3-none-any.whl
- Upload date:
- Size: 24.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2a45e1fa9542c1e525236c6860a8c8588b8edde3265deaac46f0e626942fea5b
|
|
| MD5 |
42132391c3e1883dc873058061696737
|
|
| BLAKE2b-256 |
1da2bc12cb82f8a3e00b1b4d1fcbf5025233e4c84ba6efea6ec51f69026ddeb3
|
Provenance
The following attestation bundles were made for pyperliquidity-0.2.5-py3-none-any.whl:
Publisher:
release.yml on AlliedToasters/pyperliquidity
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyperliquidity-0.2.5-py3-none-any.whl -
Subject digest:
2a45e1fa9542c1e525236c6860a8c8588b8edde3265deaac46f0e626942fea5b - Sigstore transparency entry: 1042917823
- Sigstore integration time:
-
Permalink:
AlliedToasters/pyperliquidity@4b12b79554ad8f1e9152386a23dbd4d63dc48bd7 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/AlliedToasters
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@4b12b79554ad8f1e9152386a23dbd4d63dc48bd7 -
Trigger Event:
push
-
Statement type: