An open source Python wrapper for Uniswap V2
Project description
Pyuniswap
An open source python wrapper for Uniswap V2.
Provide a very simple way to trade in Uniswap with python.
Installation
You may manually install the project or use pip:
pip install pyuniswap
# or
pip install git+git://github.com/yyy20119/pyuniswap.git
Quick Start
from pyuniswap import pyuniswap
#target token address
prq_address = '0x362bc847a3a9637d3af6624eec853618a43ed7d2'
#your provider here
my_provider = 'https://mainnet.infura.io/v3/'
#Token object(every token is a object in pyuniswap)
prq = Token(prq_address, my_provider)
#connect your wallet
prq.connect_wallet('waller_address', 'private_key')
#check whether connected
prq.is_connected()
#token balance(the amount of token in your wallet)
balance=prq.balance()
#price of your token(default the amount of eth if swapping)
prq.price(balance)
#amount of the token(prq) received by swapping 1eth
prq.received_amount_by_swap(int(1e18)))
#swap 1eth to the token(prq)
prq.buy(int(1e18), slippage=0.05)
Github
More details:https://github.com/yyy20119/pyuniswap
Pull requests are welcome!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pyuniswap-1.0.0.tar.gz
(4.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyuniswap-1.0.0.tar.gz.
File metadata
- Download URL: pyuniswap-1.0.0.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.22.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a5db60ad5107cd3ba744f9f892ec599cd5a29942479e03d3e9f2b27a7fa09699
|
|
| MD5 |
465084aa7882820d538f222460ba29ee
|
|
| BLAKE2b-256 |
d50a7adb4c37f72cc644d40024d307a3ac403539c4be0b354bb58b80294b2ba3
|
File details
Details for the file pyuniswap-1.0.0-py3-none-any.whl.
File metadata
- Download URL: pyuniswap-1.0.0-py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.22.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
80ba6ec529cf31c6d9e0c1eb6bb3e71d09e4b93dc096abb78eafb683374c9daf
|
|
| MD5 |
f5e0e82eb0255471698801a4f3441858
|
|
| BLAKE2b-256 |
d8989787cc7e24faa2e6d49fe36c9aa20f1aee939a9c89d623416598ac0886f5
|