Skip to main content

uniswap-sdk: SDK for Uniswap smart contracts

Project description

Uniswap SDK

NOTE: Work In Progress

Usage

NOTE: Sketch of potential usage

from ape_tokens import tokens
from uniswap_sdk import v2 as uni_v2

# Uses v2's TWAP oracle pricing algorithm
price = uni_v2.price(base=tokens["USDC"], quote=tokens["YFI"])
print(f"Buying 100k USDC worth of YFI at {price} USDC/YFI")

# Will automatically discover best possible route for given trade on Uniswap v2
# NOTE: Slippage and timeout are configurable
uni_v2.swap(base=tokens["USDC"], quote=tokens["YFI"], amount_in="100_000 USDC", sender=trader)
# Eventual goal?
import uniswap_sdk as uni

# Finds most liquid price across v2 and v3
price = uni.price(base=tokens["USDC"], quote=tokens["YFI"])

# Performs best swap between v2 and v3
uni.swap(base=tokens["USDC"], quote=tokens["YFI"], amount_in="100_000 USDC", sender=trader)

Dependencies

  • python3 version 3.7 or greater, python3-dev

Installation

via pip

You can install the latest release via pip:

pip install uniswap_sdk

via setuptools

You can clone the repository and use setuptools for the most up-to-date version:

git clone https://github.com/SilverBackLtd/uniswap-sdk.git
cd uniswap-sdk
python3 setup.py install

Quick Usage

TODO: Describe library overview in code

Development

This project is in development and should be considered a beta. Things might not be in their final state and breaking changes may occur. Comments, questions, criticisms and pull requests are welcomed.

License

This project is licensed under the Apache 2.0.

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

uniswap-sdk-0.1.0b1.tar.gz (28.4 kB view details)

Uploaded Source

Built Distribution

uniswap_sdk-0.1.0b1-py3-none-any.whl (20.9 kB view details)

Uploaded Python 3

File details

Details for the file uniswap-sdk-0.1.0b1.tar.gz.

File metadata

  • Download URL: uniswap-sdk-0.1.0b1.tar.gz
  • Upload date:
  • Size: 28.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.15

File hashes

Hashes for uniswap-sdk-0.1.0b1.tar.gz
Algorithm Hash digest
SHA256 0c4367c4a956a756a3a1f6382047b59c0e1a7a0e0701ee3a630ddf01bf39fb7a
MD5 4205f5fccb1d5626895f935839920ed6
BLAKE2b-256 7017e4334ae72d8e60252d01e79f3b05fa3ce212f3c7650ac01314f0446b02f5

See more details on using hashes here.

File details

Details for the file uniswap_sdk-0.1.0b1-py3-none-any.whl.

File metadata

File hashes

Hashes for uniswap_sdk-0.1.0b1-py3-none-any.whl
Algorithm Hash digest
SHA256 2a433cc2fd4da3de8205cde7346771361d2586cf566edda3de8e924cc6f6f5ac
MD5 b75f63c6143466e20d8855b48ac0c40d
BLAKE2b-256 aa256786b18016a2b51dec9e459664d8356f800e5620deee648387833236b0a1

See more details on using hashes here.

Supported by

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