Git Product home page Git Product logo

pyuniswap's Introduction

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!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.