hyperliquid-python-sdk
Installation
pip install hyperliquid-python-sdk
Configuration
- Set the public key as the
account_addressin examples/config.json. - Set your private key as the
secret_keyin examples/config.json. - See the example of loading the config in examples/example_utils.py
[Optional] Generate a new API key for an API Wallet
Generate and authorize a new API private key on https://app.hyperliquid.xyz/API, and set the API wallet's private key as the secret_key in examples/config.json. Note that you must still set the public key of the main wallet not the API wallet as the account_address in examples/config.json
Usage Examples
from hyperliquid.info import Info
from hyperliquid.utils import constants
info = Info(constants.TESTNET_API_URL, skip_ws=True)
user_state = info.user_state("0xcd5051944f780a621ee62e39e493c489668acf4d")
print(user_state)
See examples for more complete examples. You can also checkout the repo and run any of the examples after configuring your private key e.g.
cp examples/config.json.example examples/config.json
vim examples/config.json
python examples/basic_order.py
Getting started with contributing to this repo
-
Download
Poetry: https://python-poetry.org/.- Note that in the install script you might have to set
symlinks=Trueinvenv.EnvBuilder. - Note that Poetry v2 is not supported, so you'll need to specify a specific version e.g. curl -sSL https://install.python-poetry.org | POETRY_VERSION=1.4.1 python3 -
- Note that in the install script you might have to set
-
Point poetry to correct version of python. For development we require python 3.10 exactly. Some dependencies have issues on 3.11, while older versions don't have correct typing support.
brew install python@3.10 && poetry env use /opt/homebrew/Cellar/python@3.10/3.10.16/bin/python3.10 -
Install dependencies:
make install
Makefile usage
CLI commands for faster development. See make help for more details.
check-safety Run safety checks on dependencies
cleanup Cleanup project
install Install dependencies from poetry.lock
install-types Find and install additional types for mypy
lint Alias for the pre-commit target
lockfile-update Update poetry.lock
lockfile-update-full Fully regenerate poetry.lock
poetry-download Download and install poetry
pre-commit Run linters + formatters via pre-commit, run "make pre-commit hook=black" to run only black
test Run tests with pytest
update-dev-deps Update development dependencies to latest versions
Releases
You can see the list of available releases on the GitHub Releases page.
We follow the Semantic Versions specification and use Release Drafter. As pull requests are merged, a draft release is kept up-to-date listing the changes, ready to publish when you’re ready. With the categories option, you can categorize pull requests in release notes using labels.
List of labels and corresponding titles
| Label | Title in Releases |
|---|---|
enhancement, feature |
Features |
bug, refactoring, bugfix, fix |
Fixes & Refactoring |
build, ci, testing |
Build System & CI/CD |
breaking |
Breaking Changes |
documentation |
Documentation |
dependencies |
Dependencies updates |
Building and releasing
Building a new version of the application contains steps:
- Bump the version of your package with
poetry version <version>. You can pass the new version explicitly, or a rule such asmajor,minor, orpatch. For more details, refer to the Semantic Versions standard. - Make a commit to
GitHub - Create a
GitHub release poetry publish --build
License
This project is licensed under the terms of the MIT license. See LICENSE for more details.
@misc{hyperliquid-python-sdk,
author = {Hyperliquid},
title = {SDK for Hyperliquid API trading with Python.},
year = {2024},
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {\url{https://github.com/hyperliquid-dex/hyperliquid-python-sdk}}
}
Credits
This project was generated with python-package-template.
Metadata
Release files for hyperliquid-python-sdk 0.24.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| hyperliquid_python_sdk-0.24.0.tar.gz | 25.5 kB | Without provenance | Details for hyperliquid_python_sdk-0.24.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| hyperliquid_python_sdk-0.24.0-py3-none-any.whl | Python 3 | none | any | Details for hyperliquid_python_sdk-0.24.0-py3-none-any.whl |
Total release size: 50.3 kB
Release files / hyperliquid_python_sdk-0.24.0.tar.gz
| Download URL | hyperliquid_python_sdk-0.24.0.tar.gz |
|---|---|
| Size | 25.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b3fba7c53f4faee41578df4ee19471393866a4a188e38d1fd05a0217b7a74868
|
|
BLAKE2b-256 checksum How to use checksums |
d5b29cd579de770c5746c4b3855b2a77858c657eafd9f26494707aca3dde7fed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.1 CPython/3.9.6 Darwin/24.6.0
|
Release files / hyperliquid_python_sdk-0.24.0-py3-none-any.whl
| Download URL | hyperliquid_python_sdk-0.24.0-py3-none-any.whl |
|---|---|
| Size | 24.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f472dd4f6d8ef0e66182c7627276400462c86fbc0929eb5b63feda3ae45605f6
|
|
BLAKE2b-256 checksum How to use checksums |
59fe6e869c47b361b4992885991c0063ba92cb10747523ea0a4cca6f74240d1e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.1 CPython/3.9.6 Darwin/24.6.0
|
Security for hyperliquid-python-sdk 0.24.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.