METADATA 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. Metadata-Version: 2.1
  2. Name: hyperliquid-python-sdk
  3. Version: 0.19.0
  4. Summary: SDK for Hyperliquid API trading with Python.
  5. Home-page: https://github.com/hyperliquid-dex/hyperliquid-python-sdk
  6. License: MIT
  7. Author: Hyperliquid
  8. Author-email: hello@hyperliquid.xyz
  9. Requires-Python: >=3.9,<4.0
  10. Classifier: Development Status :: 3 - Alpha
  11. Classifier: Intended Audience :: Developers
  12. Classifier: License :: OSI Approved :: MIT License
  13. Classifier: Operating System :: OS Independent
  14. Classifier: Programming Language :: Python :: 3
  15. Classifier: Programming Language :: Python :: 3.9
  16. Classifier: Programming Language :: Python :: 3.10
  17. Classifier: Programming Language :: Python :: 3.11
  18. Classifier: Programming Language :: Python :: 3
  19. Classifier: Programming Language :: Python :: 3.10
  20. Classifier: Programming Language :: Python :: 3.11
  21. Classifier: Programming Language :: Python :: 3.12
  22. Classifier: Programming Language :: Python :: 3.13
  23. Classifier: Programming Language :: Python :: 3.9
  24. Classifier: Topic :: Software Development :: Libraries :: Python Modules
  25. Requires-Dist: eth-account (>=0.10.0,<0.14.0)
  26. Requires-Dist: eth-utils (>=2.1.0,<6.0.0)
  27. Requires-Dist: msgpack (>=1.0.5,<2.0.0)
  28. Requires-Dist: requests (>=2.31.0,<3.0.0)
  29. Requires-Dist: websocket-client (>=1.5.1,<2.0.0)
  30. Project-URL: Repository, https://github.com/hyperliquid-dex/hyperliquid-python-sdk
  31. Description-Content-Type: text/markdown
  32. # hyperliquid-python-sdk
  33. <div align="center">
  34. [![Dependencies Status](https://img.shields.io/badge/dependencies-up%20to%20date-brightgreen.svg)](https://github.com/hyperliquid-dex/hyperliquid-python-sdk/pulls?utf8=%E2%9C%93&q=is%3Apr%20author%3Aapp%2Fdependabot)
  35. [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
  36. [![Security: bandit](https://img.shields.io/badge/security-bandit-green.svg)](https://github.com/PyCQA/bandit)
  37. [![Pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/hyperliquid-dex/hyperliquid-python-sdk/blob/master/.pre-commit-config.yaml)
  38. [![Semantic Versions](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--versions-e10079.svg)](https://github.com/hyperliquid-dex/hyperliquid-python-sdk/releases)
  39. [![License](https://img.shields.io/pypi/l/hyperliquid-python-sdk)](https://github.com/hyperliquid-dex/hyperliquid-python-sdk/blob/master/LICENSE.md)
  40. SDK for Hyperliquid API trading with Python.
  41. </div>
  42. ## Installation
  43. ```bash
  44. pip install hyperliquid-python-sdk
  45. ```
  46. ## Configuration
  47. - Set the public key as the `account_address` in examples/config.json.
  48. - Set your private key as the `secret_key` in examples/config.json.
  49. - See the example of loading the config in examples/example_utils.py
  50. ### [Optional] Generate a new API key for an API Wallet
  51. 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
  52. ## Usage Examples
  53. ```python
  54. from hyperliquid.info import Info
  55. from hyperliquid.utils import constants
  56. info = Info(constants.TESTNET_API_URL, skip_ws=True)
  57. user_state = info.user_state("0xcd5051944f780a621ee62e39e493c489668acf4d")
  58. print(user_state)
  59. ```
  60. See [examples](examples) for more complete examples. You can also checkout the repo and run any of the examples after configuring your private key e.g.
  61. ```bash
  62. cp examples/config.json.example examples/config.json
  63. vim examples/config.json
  64. python examples/basic_order.py
  65. ```
  66. ## Getting started with contributing to this repo
  67. 1. Download `Poetry`: https://python-poetry.org/.
  68. - Note that in the install script you might have to set `symlinks=True` in `venv.EnvBuilder`.
  69. - 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 -
  70. 2. 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.
  71. `brew install python@3.10 && poetry env use /opt/homebrew/Cellar/python@3.10/3.10.16/bin/python3.10`
  72. 3. Install dependencies:
  73. ```bash
  74. make install
  75. ```
  76. ### Makefile usage
  77. CLI commands for faster development. See `make help` for more details.
  78. ```bash
  79. check-safety Run safety checks on dependencies
  80. cleanup Cleanup project
  81. install Install dependencies from poetry.lock
  82. install-types Find and install additional types for mypy
  83. lint Alias for the pre-commit target
  84. lockfile-update Update poetry.lock
  85. lockfile-update-full Fully regenerate poetry.lock
  86. poetry-download Download and install poetry
  87. pre-commit Run linters + formatters via pre-commit, run "make pre-commit hook=black" to run only black
  88. test Run tests with pytest
  89. update-dev-deps Update development dependencies to latest versions
  90. ```
  91. ## Releases
  92. You can see the list of available releases on the [GitHub Releases](https://github.com/hyperliquid-dex/hyperliquid-python-sdk/releases) page.
  93. We follow the [Semantic Versions](https://semver.org/) specification and use [`Release Drafter`](https://github.com/marketplace/actions/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.
  94. ### List of labels and corresponding titles
  95. | **Label** | **Title in Releases** |
  96. | :-----------------------------------: | :---------------------: |
  97. | `enhancement`, `feature` | Features |
  98. | `bug`, `refactoring`, `bugfix`, `fix` | Fixes & Refactoring |
  99. | `build`, `ci`, `testing` | Build System & CI/CD |
  100. | `breaking` | Breaking Changes |
  101. | `documentation` | Documentation |
  102. | `dependencies` | Dependencies updates |
  103. ### Building and releasing
  104. Building a new version of the application contains steps:
  105. - Bump the version of your package with `poetry version <version>`. You can pass the new version explicitly, or a rule such as `major`, `minor`, or `patch`. For more details, refer to the [Semantic Versions](https://semver.org/) standard.
  106. - Make a commit to `GitHub`
  107. - Create a `GitHub release`
  108. - `poetry publish --build`
  109. ## License
  110. This project is licensed under the terms of the `MIT` license. See [LICENSE](LICENSE.md) for more details.
  111. ```bibtex
  112. @misc{hyperliquid-python-sdk,
  113. author = {Hyperliquid},
  114. title = {SDK for Hyperliquid API trading with Python.},
  115. year = {2024},
  116. publisher = {GitHub},
  117. journal = {GitHub repository},
  118. howpublished = {\url{https://github.com/hyperliquid-dex/hyperliquid-python-sdk}}
  119. }
  120. ```
  121. ## Credits
  122. This project was generated with [`python-package-template`](https://github.com/TezRomacH/python-package-template).