Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ jobs:
runs-on: ubuntu-24.04
strategy:
matrix:
python-version: ['3.9', '3.11']
# https://devguide.python.org/versions/
# 3.9: lower bound = lowest Python non-EOL version
# 3.13: upper bound = latest Python stable version
python-version: ['3.9', '3.13']
steps:
- uses: actions/checkout@v4

Expand Down
14 changes: 11 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,19 +1,27 @@
#* Variables
SHELL := /usr/bin/env bash -o pipefail -o errexit

#* Lockfile handling
lockfile-update:
poetry lock -n

lockfile-update-full:
poetry lock -n --regenerate

#* Installation
install:
poetry lock -n --no-update && poetry export --without-hashes > requirements.txt
poetry install -n
-poetry run mypy --install-types --non-interactive ./

install-types:
poetry run mypy --install-types --non-interactive ./

#* Poetry
poetry-download:
curl -sSL https://install.python-poetry.org | python -

#* Formatters
codestyle:
poetry run pyupgrade --exit-zero-even-if-changed --py37-plus **/*.py
poetry run pyupgrade --exit-zero-even-if-changed --py39-plus **/*.py
poetry run isort --settings-path pyproject.toml ./
poetry run black --config pyproject.toml ./

Expand Down
5 changes: 3 additions & 2 deletions examples/basic_staking.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ def main():
print(json.dumps(user_stakes, indent=2))

# Get the user staking reward history and print information
user_staking_rewards= info.user_staking_rewards(address)
user_staking_rewards = info.user_staking_rewards(address)
print("Most recent staking rewards:")
print(json.dumps(user_staking_rewards[:5], indent=2))


if __name__ == "__main__":
main()
main()
1 change: 1 addition & 0 deletions examples/rounding.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
Prices are precise to the lesser of 5 significant figures or 6 decimals.
You can find the szDecimals for an asset by making a meta request to the info endpoint
"""

import json

import example_utils
Expand Down
2 changes: 1 addition & 1 deletion hyperliquid/exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def market_close(
cloid: Optional[Cloid] = None,
builder: Optional[BuilderInfo] = None,
) -> Any:
address = self.wallet.address
address: str = self.wallet.address
if self.account_address:
address = self.account_address
if self.vault_address:
Expand Down
9 changes: 4 additions & 5 deletions hyperliquid/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@ def __init__(
spot_meta: Optional[SpotMeta] = None,
):
super().__init__(base_url)
self.ws_manager: Optional[WebsocketManager] = None
if not skip_ws:
self.ws_manager = WebsocketManager(self.base_url)
self.ws_manager.start()
else:
self.ws_manager = None
if meta is None:
meta = self.meta()

Expand Down Expand Up @@ -500,7 +499,7 @@ def user_fees(self, address: str) -> Any:
}
"""
return self.post("/info", {"type": "userFees", "user": address})

def user_staking_summary(self, address: str) -> Any:
"""Retrieve the staking summary associated with a user.
POST /info
Expand All @@ -516,7 +515,7 @@ def user_staking_summary(self, address: str) -> Any:
}
"""
return self.post("/info", {"type": "delegatorSummary", "user": address})

def user_staking_delegations(self, address: str) -> Any:
"""Retrieve the user's staking delegations.
POST /info
Expand All @@ -533,7 +532,7 @@ def user_staking_delegations(self, address: str) -> Any:
]
"""
return self.post("/info", {"type": "delegations", "user": address})

def user_staking_rewards(self, address: str) -> Any:
"""Retrieve the historic staking rewards associated with a user.
POST /info
Expand Down
2 changes: 1 addition & 1 deletion hyperliquid/utils/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def __str__(self):

def __repr__(self):
return str(self._raw_cloid)

@staticmethod
def from_int(cloid: int) -> Cloid:
return Cloid(f"{cloid:#034x}")
Expand Down
3,160 changes: 1,904 additions & 1,256 deletions poetry.lock

Large diffs are not rendered by default.

17 changes: 9 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Poetry pyproject.toml: https://python-poetry.org/docs/pyproject/
[build-system]
requires = ["poetry_core>=1.0.0"]
requires = ["poetry-core>=2.0.0"]
build-backend = "poetry.core.masonry.api"

[tool.poetry]
Expand All @@ -27,44 +27,45 @@ classifiers = [ #! Update me
"Topic :: Software Development :: Libraries :: Python Modules",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]

[tool.poetry.scripts]
# Entry points for the package https://python-poetry.org/docs/pyproject/#scripts
"hyperliquid-python-sdk" = "hyperliquid.__main__:app"

[tool.poetry.dependencies]
python = "^3.8"
python = "^3.9"
eth-utils = ">=2.1.0,<6.0.0"
eth-account = ">=0.10.0,<0.14.0"
websocket-client = "^1.5.1"
requests = "^2.31.0"
msgpack = "^1.0.5"

[tool.poetry.dev-dependencies]
python = "3.10.10"
[tool.poetry.group.dev.dependencies]
python = "^3.10"
pytest = "^7.2.1"
pytest-recording = "^0.12.2"
bandit = "^1.7.1"
black = "^22.3.0"
black = "^24.8.0"
darglint = "^1.8.1"
isort = {extras = ["colors"], version = "^5.10.1"}
mypy = "^0.981"
mypy = "^0.991"
mypy-extensions = "^0.4.3"
pre-commit = "^2.15.0"
pydocstyle = "^6.1.1"
pylint = "^2.11.1"
pyupgrade = "^2.29.1"
safety = "^1.10.3"
safety = "^2.2.1"
coverage = "^6.1.2"
coverage-badge = "^1.1.0"
pytest-cov = "^4.0.0"
vcrpy = { version = "^7.0.0", python = "3.10.10" }
types-requests = "^2.31.0"

[tool.black]
line-length = 120
Expand Down
79 changes: 0 additions & 79 deletions requirements-ci.txt

This file was deleted.

23 changes: 0 additions & 23 deletions requirements.txt

This file was deleted.