<p align="center">
<img width="350" height="350" src="https://user-images.githubusercontent.com/9441295/107376524-d96b5880-6a9e-11eb-9eba-094c439cfb07.png">
</p>
# uniswap-python
[![GitHub Actions](https://github.com/shanefontaine/uniswap-python/workflows/Test/badge.svg)](https://github.com/shanefontaine/uniswap-python/actions)
[![codecov](https://codecov.io/gh/uniswap-python/uniswap-python/branch/master/graph/badge.svg?token=VHAZHHLFX8)](https://codecov.io/gh/uniswap-python/uniswap-python)
[![Downloads](https://pepy.tech/badge/uniswap-python)](https://pepy.tech/project/uniswap-python)
[![License](http://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/shanefontaine/uniswap-python/master/LICENSE)
[![PyPI](https://img.shields.io/pypi/v/uniswap-python)](https://pypi.org/project/uniswap-python/)
[![Typechecking: Mypy](http://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)
[![GitPOAP Badge](https://public-api.gitpoap.io/v1/repo/uniswap-python/uniswap-python/badge)](https://www.gitpoap.io/gh/uniswap-python/uniswap-python)
[![GitHub Repo stars](https://img.shields.io/github/stars/uniswap-python/uniswap-python?style=social)](https://github.com/uniswap-python/uniswap-python/stargazers)
[![Twitter Follow](https://img.shields.io/twitter/follow/UniswapPython?label=Follow&style=social)](https://twitter.com/UniswapPython)
The unofficial Python client for [Uniswap](https://uniswap.io/).
Documentation is available at https://uniswap-python.com/
**Want to help implement support for Uniswap v4?** See [issue #337](https://github.com/uniswap-python/uniswap-python/issues/337)
## Functionality
* A simple to use Python wrapper for all available contract functions and variables
* A basic CLI to get prices and token metadata
* Simple parsing of data returned from the Uniswap contract
### Supports
- Uniswap v3 (as of v0.5.0)
- Including beta support for Arbitrum & Optimism deployments (as of v0.5.4)
- Uniswap v2 (as of v0.4.0)
- Uniswap v1 (deprecated)
- Various forks (untested, but should work)
- Honeyswap (xDai)
- Pancakeswap (BSC)
- Sushiswap (mainnet)
## Getting Started
See our [Getting started guide](https://uniswap-python.com/getting-started.html) in the documentation.
## Testing
Unit tests are under development using the pytest framework. Contributions are welcome!
Test are run on a fork of the main net using ganache-cli. You need to install it with `npm install -g ganache-cli` before running tests.
To run the full test suite, in the project directory set the `PROVIDER` env variable to a mainnet provider, and run:
```sh
poetry install
export PROVIDER= # URL of provider, e.g. https://mainnet.infura.io/v3/...
make test
# or...
poetry run pytest --capture=no # doesn't capture output (verbose)
```
## Support our continued work!
You can support us on [Gitcoin Grants](https://gitcoin.co/grants/2631/uniswap-python).
## Authors
* [Shane Fontaine](https://twitter.com/shanecoin)
* [Erik Bjäreholt](https://twitter.com/ErikBjare)
* [@liquid-8](https://github.com/liquid-8)
* ...and [others](https://github.com/uniswap-python/uniswap-python/graphs/contributors)
*Want to help out with development? We have funding to those that do! See [#181](https://github.com/uniswap-python/uniswap-python/discussions/181)*
Contributors also earn this beautiful [GitPOAP](https://gitpoap.notion.site/What-s-a-GitPOAP-5b085daac4b4429994b5231be028b3d9) for their contributions!
<a href="https://www.gitpoap.io/gh/uniswap-python/uniswap-python">
<img src="https://assets.poap.xyz/gitpoap-2022-uniswap-python-contributor-2022-logo-1664825191444.png" width="256px">
</a>
## Changelog
_0.7.2_
* Updated: Default fee is not applied when using Uniswap V3. Default fee for Uniswap V1 and V2 is still 0.3%.
* Updated: `InvalidFeeTier` exception is raised when a tier is not supported by the protocol version. See all supported tiers in [`uniswap.fee.FeeTier`](./uniswap/fee.py#L12)
_0.7.1_
* incomplete changelog
_0.7.0_
* incomplete changelog
_0.5.4_
* added use of gas estimation instead of a fixed gas limit (to support Arbitrum)
* added `use_estimate_gas` constructor argument (used in testing)
* added constants/basic support for Arbitrum, Optimism, Polygon, and Fantom. (untested)
* incomplete changelog
_0.5.3_
* incomplete changelog
_0.5.2_
* incomplete changelog
_0.5.1_
* Updated dependencies
* Fixed minor typing issues
_0.5.0_
* Basic support for Uniswap V3
* Added new methods `get_price_input` and `get_price_output`
* Made a lot of previously public methods private
* Added documentation site
* Removed ENS support (which was probably broken to begin with)
_0.4.6_
* Bug fix: Update bleach package from 3.1.4 to 3.3.0
_0.4.5_
* Bug fix: Use .eth instead of .ens
_0.4.4_
* General: Add new logo for Uniswap V2
* Bug fix: Invalid balance check (#25)
* Bug fix: Fixed error when passing WETH as token
_0.4.3_
* Allow kwargs in `approved` decorator.
_0.4.2_
* Add note about Uniswap V2 support
_0.4.1_
* Update changelog for PyPi and clean up
_0.4.0_
_A huge thank you [Erik Bjäreholt](https://github.com/ErikBjare) for adding Uniswap V2 support, as well as all changes in this version!_
* Added support for Uniswap v2
* Handle arbitrary tokens (by address) using the factory contract
* Switched from setup.py to pyproject.toml/poetry
* Switched from Travis to GitHub Actions
* For CI to work in your repo, you need to set the secret MAINNET_PROVIDER. I use Infura.
* Running tests on a local fork of mainnet using ganache-cli (started as a fixture)
* Fixed tests for make_trade and make_trade_output
* Added type annotations to the entire codebase and check them with mypy in CI
* Formatted entire codebase with black
* Moved stuff around such that the basic import becomes from uniswap import Uniswap (instead of from uniswap.uniswap import UniswapWrapper)
* Fixed misc bugs
_0.3.3_
* Provide token inputs as addresses instead of names
_0.3.2_
* Add ability to transfer tokens after a trade
* Add tests for this new functionality
_0.3.1_
* Add tests for all types of trades
_0.3.0_
* Add ability to make all types of trades
* Add example to README
_0.2.1_
* Add liquidity tests
_0.2.0_
* Add liquidity and ERC20 pool methods
_0.1.1_
* Major README update
_0.1.0_
* Add market endpoints
* Add tests for market endpoints
Raw data
{
"_id": null,
"home_page": "https://github.com/starascendin/uniswap-python",
"name": "uniswap-python-route",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0.0,>=3.7.2",
"maintainer_email": null,
"keywords": "uniswap, ethereum, exchange, trading",
"author": "Shane Fontaine",
"author_email": "shane6fontaine@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/e9/56/d12b01118a7eb46d6d2b639dcc032919fdc18586cd5dde54151cdeb5ca0f/uniswap_python_route-0.7.2.tar.gz",
"platform": null,
"description": "<p align=\"center\">\n <img width=\"350\" height=\"350\" src=\"https://user-images.githubusercontent.com/9441295/107376524-d96b5880-6a9e-11eb-9eba-094c439cfb07.png\">\n</p>\n\n# uniswap-python\n\n[![GitHub Actions](https://github.com/shanefontaine/uniswap-python/workflows/Test/badge.svg)](https://github.com/shanefontaine/uniswap-python/actions)\n[![codecov](https://codecov.io/gh/uniswap-python/uniswap-python/branch/master/graph/badge.svg?token=VHAZHHLFX8)](https://codecov.io/gh/uniswap-python/uniswap-python)\n[![Downloads](https://pepy.tech/badge/uniswap-python)](https://pepy.tech/project/uniswap-python)\n[![License](http://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/shanefontaine/uniswap-python/master/LICENSE)\n[![PyPI](https://img.shields.io/pypi/v/uniswap-python)](https://pypi.org/project/uniswap-python/)\n[![Typechecking: Mypy](http://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)\n[![GitPOAP Badge](https://public-api.gitpoap.io/v1/repo/uniswap-python/uniswap-python/badge)](https://www.gitpoap.io/gh/uniswap-python/uniswap-python)\n\n[![GitHub Repo stars](https://img.shields.io/github/stars/uniswap-python/uniswap-python?style=social)](https://github.com/uniswap-python/uniswap-python/stargazers)\n[![Twitter Follow](https://img.shields.io/twitter/follow/UniswapPython?label=Follow&style=social)](https://twitter.com/UniswapPython)\n\nThe unofficial Python client for [Uniswap](https://uniswap.io/).\n\nDocumentation is available at https://uniswap-python.com/\n\n**Want to help implement support for Uniswap v4?** See [issue #337](https://github.com/uniswap-python/uniswap-python/issues/337)\n\n## Functionality\n\n* A simple to use Python wrapper for all available contract functions and variables\n* A basic CLI to get prices and token metadata\n* Simple parsing of data returned from the Uniswap contract\n\n### Supports\n\n - Uniswap v3 (as of v0.5.0)\n - Including beta support for Arbitrum & Optimism deployments (as of v0.5.4)\n - Uniswap v2 (as of v0.4.0)\n - Uniswap v1 (deprecated)\n - Various forks (untested, but should work)\n - Honeyswap (xDai)\n - Pancakeswap (BSC)\n - Sushiswap (mainnet)\n\n## Getting Started\n\nSee our [Getting started guide](https://uniswap-python.com/getting-started.html) in the documentation.\n\n## Testing\n\nUnit tests are under development using the pytest framework. Contributions are welcome!\n\nTest are run on a fork of the main net using ganache-cli. You need to install it with `npm install -g ganache-cli` before running tests.\n\nTo run the full test suite, in the project directory set the `PROVIDER` env variable to a mainnet provider, and run:\n\n```sh\npoetry install\nexport PROVIDER= # URL of provider, e.g. https://mainnet.infura.io/v3/...\nmake test\n# or...\npoetry run pytest --capture=no # doesn't capture output (verbose)\n```\n\n## Support our continued work!\n\nYou can support us on [Gitcoin Grants](https://gitcoin.co/grants/2631/uniswap-python).\n\n## Authors\n\n* [Shane Fontaine](https://twitter.com/shanecoin)\n* [Erik Bj\u00e4reholt](https://twitter.com/ErikBjare)\n* [@liquid-8](https://github.com/liquid-8)\n* ...and [others](https://github.com/uniswap-python/uniswap-python/graphs/contributors)\n\n*Want to help out with development? We have funding to those that do! See [#181](https://github.com/uniswap-python/uniswap-python/discussions/181)*\n\nContributors also earn this beautiful [GitPOAP](https://gitpoap.notion.site/What-s-a-GitPOAP-5b085daac4b4429994b5231be028b3d9) for their contributions!\n\n<a href=\"https://www.gitpoap.io/gh/uniswap-python/uniswap-python\">\n <img src=\"https://assets.poap.xyz/gitpoap-2022-uniswap-python-contributor-2022-logo-1664825191444.png\" width=\"256px\">\n</a>\n\n## Changelog\n\n_0.7.2_\n\n* Updated: Default fee is not applied when using Uniswap V3. Default fee for Uniswap V1 and V2 is still 0.3%.\n* Updated: `InvalidFeeTier` exception is raised when a tier is not supported by the protocol version. See all supported tiers in [`uniswap.fee.FeeTier`](./uniswap/fee.py#L12)\n\n_0.7.1_\n\n* incomplete changelog\n\n_0.7.0_\n\n* incomplete changelog\n\n_0.5.4_\n\n* added use of gas estimation instead of a fixed gas limit (to support Arbitrum)\n* added `use_estimate_gas` constructor argument (used in testing)\n* added constants/basic support for Arbitrum, Optimism, Polygon, and Fantom. (untested)\n* incomplete changelog\n\n_0.5.3_\n\n* incomplete changelog\n\n_0.5.2_\n\n* incomplete changelog\n\n_0.5.1_\n\n* Updated dependencies\n* Fixed minor typing issues\n\n_0.5.0_\n\n* Basic support for Uniswap V3\n* Added new methods `get_price_input` and `get_price_output`\n* Made a lot of previously public methods private\n* Added documentation site\n* Removed ENS support (which was probably broken to begin with)\n\n_0.4.6_\n\n* Bug fix: Update bleach package from 3.1.4 to 3.3.0\n\n_0.4.5_\n* Bug fix: Use .eth instead of .ens\n\n_0.4.4_\n\n* General: Add new logo for Uniswap V2\n* Bug fix: Invalid balance check (#25)\n* Bug fix: Fixed error when passing WETH as token\n\n_0.4.3_\n\n* Allow kwargs in `approved` decorator.\n\n_0.4.2_\n\n* Add note about Uniswap V2 support\n\n_0.4.1_\n\n* Update changelog for PyPi and clean up\n\n_0.4.0_\n\n_A huge thank you [Erik Bj\u00e4reholt](https://github.com/ErikBjare) for adding Uniswap V2 support, as well as all changes in this version!_\n\n* Added support for Uniswap v2\n* Handle arbitrary tokens (by address) using the factory contract\n* Switched from setup.py to pyproject.toml/poetry\n* Switched from Travis to GitHub Actions\n* For CI to work in your repo, you need to set the secret MAINNET_PROVIDER. I use Infura.\n* Running tests on a local fork of mainnet using ganache-cli (started as a fixture)\n* Fixed tests for make_trade and make_trade_output\n* Added type annotations to the entire codebase and check them with mypy in CI\n* Formatted entire codebase with black\n* Moved stuff around such that the basic import becomes from uniswap import Uniswap (instead of from uniswap.uniswap import UniswapWrapper)\n* Fixed misc bugs\n\n_0.3.3_\n* Provide token inputs as addresses instead of names\n\n_0.3.2_\n* Add ability to transfer tokens after a trade\n* Add tests for this new functionality\n\n_0.3.1_\n* Add tests for all types of trades\n\n_0.3.0_\n* Add ability to make all types of trades\n* Add example to README\n\n_0.2.1_\n* Add liquidity tests\n\n_0.2.0_\n* Add liquidity and ERC20 pool methods\n\n_0.1.1_\n* Major README update\n\n_0.1.0_\n* Add market endpoints\n* Add tests for market endpoints\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "An unofficial Python wrapper for the decentralized exchange Uniswap",
"version": "0.7.2",
"project_urls": {
"Homepage": "https://github.com/starascendin/uniswap-python",
"Repository": "https://github.com/starascendin/uniswap-python"
},
"split_keywords": [
"uniswap",
" ethereum",
" exchange",
" trading"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9ac05938c48eca55abdd796b9c963f7ccf6e28d76945712ae13ee76e09ca67f4",
"md5": "e20552a8f92dc1075c37ca24f587b4ac",
"sha256": "d4a6070b3f1b3d671b33cab9355aed1072ce163f14f9c88a91f9f08761e209f3"
},
"downloads": -1,
"filename": "uniswap_python_route-0.7.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e20552a8f92dc1075c37ca24f587b4ac",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0.0,>=3.7.2",
"size": 39683,
"upload_time": "2024-04-14T16:44:55",
"upload_time_iso_8601": "2024-04-14T16:44:55.285810Z",
"url": "https://files.pythonhosted.org/packages/9a/c0/5938c48eca55abdd796b9c963f7ccf6e28d76945712ae13ee76e09ca67f4/uniswap_python_route-0.7.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "e956d12b01118a7eb46d6d2b639dcc032919fdc18586cd5dde54151cdeb5ca0f",
"md5": "c69c7751e39e1b05bb69fa801181bd28",
"sha256": "25ca80217730410a8fb716ed343ceb3006deb45df99dc9b09129dcc9ebc0937f"
},
"downloads": -1,
"filename": "uniswap_python_route-0.7.2.tar.gz",
"has_sig": false,
"md5_digest": "c69c7751e39e1b05bb69fa801181bd28",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0.0,>=3.7.2",
"size": 35061,
"upload_time": "2024-04-14T16:44:57",
"upload_time_iso_8601": "2024-04-14T16:44:57.074812Z",
"url": "https://files.pythonhosted.org/packages/e9/56/d12b01118a7eb46d6d2b639dcc032919fdc18586cd5dde54151cdeb5ca0f/uniswap_python_route-0.7.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-14 16:44:57",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "starascendin",
"github_project": "uniswap-python",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "uniswap-python-route"
}