Skip to main content

An open source Python wrapper for Uniswap V2

Project description

Pyuniswap

License

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


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)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyuniswap-1.0.0-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

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

Hashes for pyuniswap-1.0.0.tar.gz
Algorithm Hash digest
SHA256 a5db60ad5107cd3ba744f9f892ec599cd5a29942479e03d3e9f2b27a7fa09699
MD5 465084aa7882820d538f222460ba29ee
BLAKE2b-256 d50a7adb4c37f72cc644d40024d307a3ac403539c4be0b354bb58b80294b2ba3

See more details on using hashes here.

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

Hashes for pyuniswap-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 80ba6ec529cf31c6d9e0c1eb6bb3e71d09e4b93dc096abb78eafb683374c9daf
MD5 f5e0e82eb0255471698801a4f3441858
BLAKE2b-256 d8989787cc7e24faa2e6d49fe36c9aa20f1aee939a9c89d623416598ac0886f5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page