Installation
This guide covers how to install the Hyperliquid Python SDK for both regular use and for development purposes.
Standard Installation
For most users, installing the SDK is a simple process using pip
.
pip install hyperliquid-python-sdk
This command will download and install the latest stable version of the package from the Python Package Index (PyPI).
Core Dependencies
The SDK relies on a few key libraries to function. These are automatically installed when you use pip
:
eth-account
: For handling Ethereum-style account creation and message signing.eth-utils
: Provides utility functions for Ethereum-related data.requests
: For making HTTP requests to the Hyperliquid REST API.websocket-client
: To connect to and handle real-time data from the WebSocket API.msgpack
: For efficient serialization of data in API requests.
Development Setup
If you plan to contribute to the SDK or want to install it from the source, you'll need to set up a development environment. This project uses Poetry for dependency management.
Prerequisites
- Python 3.10: The development environment requires Python 3.10. You can manage Python versions using a tool like
pyenv
. - Poetry: Download and install Poetry by following their official installation guide. A recommended way is:
curl -sSL https://install.python-poetry.org | POETRY_VERSION=1.4.1 python3 -
Installation Steps
-
Clone the Repository:
git clone https://github.com/hyperliquid-dex/hyperliquid-python-sdk.git cd hyperliquid-python-sdk
-
Configure Poetry Environment: Point Poetry to your Python 3.10 installation. For example, if you installed it with Homebrew on macOS:
poetry env use /path/to/your/python3.10
-
Install Dependencies: The project includes a
Makefile
to simplify common tasks. Use theinstall
command to create a virtual environment and install all required dependencies from thepoetry.lock
file.
This is equivalent to runningmake install
poetry install
. -
Install Type Stubs (Optional but Recommended): To ensure MyPy has all necessary type information for static analysis, you can install additional type stubs:
make install-types
Your development environment is now set up. You can activate the virtual environment by running poetry shell
within the project directory.