https://github.com/adrienc21/uniswap-mm

Uniswap - Simple Market Maker

https://github.com/adrienc21/uniswap-mm

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.3%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

Uniswap - Simple Market Maker

Basic Info
  • Host: GitHub
  • Owner: AdrienC21
  • License: mit
  • Language: Python
  • Default Branch: main
  • Size: 161 KB
Statistics
  • Stars: 2
  • Watchers: 1
  • Forks: 1
  • Open Issues: 0
  • Releases: 0
Created about 5 years ago · Last pushed about 5 years ago
Metadata Files
Readme License

README.md

Uniswap - Simple Market Maker

Uniswap - Simple Market Maker is a Python library that can be used to process transactions on Uniswap.

Installation

Clone this repository :

bash git clone https://github.com/AdrienC21/uniswap-mm.git

Usage

Edit the file config.py with the following information :

python address = "" # (str) Wallet Address ("0x...") private_key = "" # (str) Wallet private key ("0x...") provider = "" # (str) url of mainnet (ex : "https://mainnet.infura.io/v3/...")

Edit the file transaction_information.py :

```bash sell (str) : "buy" or "sell". If set to "buy", we want to buy using If set to "sell", we want to sell to obtain

coin_a (str) : name of the first crypto used in the transaction. The name has to be the one used in coinmarketcap.com url

coinb (str) : name of the second crypto used in the transaction. amount (float) : quantity of crypto to exchange (in wei) minmax (float) : if we want to buy , it s the maximum amount of input tokens that can be required before the transaction reverts. if we want to sell , it s the minimum amount of output tokens that must be received for the transaction not to revert.

destaddress (str) : Default=config.address. Address that will receive <coinb> deadline (int) : Maximum amount of time in seconds we wait for the transaction not to revert.

Example :

status = "sell" coina = "ethereum" coinb = "basic-attention-token" amount = 0.005 minmax = 0. destaddress = config.address deadline = 600 ```

Run the file runmarketmaker.py to process a swap on Uniswap. The hash transaction will be print in the console.

Quick Overview

The library is a wrapper of an already existing Web3 / Uniswap wrapper entitled uniswap-python-v2. The file uniswap_tools.py has been modified to correct some errors and to add an automatic extraction of the average gas used on Uniswap and an estimation of the current gas price (function inside gas.py).

Utils.py contains the core functions and transaction_information.py and config.py contain parameters that need to be edited.

runmarkmetmaker.py execute a trade.

An estimation of gas parameters and the address of the different crypto we want to use are found by scrapping crypto websites (Coinmarketcap and Crypto).

Those features are obtained here :

alt text

alt text

Documentation

gas.py

get_gas python d = get_gas() gas = get_gas()["gas"] gasPrice = get_gas()["gasPrice"] Scrap the web to obtain data relative to gas on ethereum platform.

utils.py

extract_token ```python

Link corresponding to BAT is :

https://coinmarketcap.com/fr/currencies/basic-attention-token/

Hence coin_name = basic-attention-token" if we want to use BAT

coinname = "basic-attention-token" tokenaddress = extracttoken(coinname)

token_address = "0x0d8775f648430679a709e98d2b0cb6250d2887ef"

``` Extract the contract address of the token coinname based on etherscan.io database. The name coinname must be the one contained in its coinmarketcap's url.

exchange ```python from uniswap_tools import *

address : wallet address, ChecksumAddress format

client = UniswapV2Client(address, config.private_key, provider=config.provider)

status = "sell" coina = "ethereum" coinb = "basic-attention-token" amount = 0.005 minmax = 0. destaddress = config.address deadline = 600 # 10 minutes

t = exchange(client, status, coina, coinb, amountf, minmaxf, destaddress, deadline=600)

t : hash transaction need to be converted in string using t.hex()

``` Process a transaction on Uniswap.

License

MIT

Owner

  • Name: Adrien Carrel
  • Login: AdrienC21
  • Kind: user
  • Location: London

Quantitative Researcher MSc Imperial College London (Advanced Computing) MEng CentraleSupélec (Applied Mathematics, Diplôme d'ingénieur)

GitHub Events

Total
  • Watch event: 1
Last Year
  • Watch event: 1

Issues and Pull Requests

Last synced: over 1 year ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels