Skip to main content

DXSP (DeX SwaP), A defi swap helper package. Easy peasy Swap.

Project description

dxsp

DXSP (DeX SwaP), A defi swap helper package. Easy peasy Swap.

Pypi Version

Web3

coingecko

Install

pip install dxsp

How to use it

from dxsp import DexSwap
	dex = DexSwap(chain_id=10,wallet_address='0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',private_key='0x111111111117dc0aa78b770fa6a738034120c302',block_explorer_api='1X23Q4ACZ5T3KXG67WIAH7X8C510F1972TM')
	swap = await dex.get_swap('USDC','wBTC',10)

Features

2 swap protocol mode are supported:

  • 1inch API v5
  • Uniswap version 2 router protocol type

Limit SWAP via 1inch API v3 and Uniswap version to be done

Attributes

chain_id

refers to blockchains for the list of supported chains "1": "ethereum", "56": "binance", "42161": "arbitrum", "137": "polygon", "10": "optimism", "250": "fantom", "43114": "avalanche"

wallet_address

public address example: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE,

private_key

example 0x111111111117dc0aa78b770fa6a738034120c302,

block_explorer_api

API for the chain explorer used to track the status of a swap. refers to blockchains for the explorer url

w3

Web3 object

protocol_type

protocol to interact with the DEX optional and default value is "1inch". other accepted values "uniswap_v2", "1inch_limit","uniswap_v3","0x"

dex_exchange

optional default value refers to blockchains for the list of supported chains

base_trading_symbol

optional and default value is symbol 'USDC'

amount_trading_option

optional default value is 1. use for execute_order function.

  • 1:buy or sell %p percentage DEFAULT OPTION
  • 2:SELL all token in case of sell order for example

.Env

Mandatory

  • None

Optional

  • TOKENLIST: URL of a standard token list following tokenlist.org format
  • TESTTOKENLIST: URL of a standard testnet token list following tokenlist.org format

Example

SHORT

Swap 10 USDC for BITCOIN on OPT chain:

	from dxsp import DexSwap
	dex = DexSwap(chain_id=10,wallet_address='0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',private_key='0x111111111117dc0aa78b770fa6a738034120c302',block_explorer_api='1X23Q4ACZ5T3KXG67WIAH7X8C510F1972TM')
	swap = await dex.get_swap('USDC','wBTC',10)

LONG

example

	DexSwap details

Real case

TalkyTrader, submit trading order to CEX & DEX with messaging platform (Telegram, Matrix and Discord)

Roadmap

V1

- 1inch API v5 (#1 default)
- Uniswap version 2 router DEX type (#2)
- Limit SWAP via 1inch API v3 (#3)

V2

- Uniswap V3 Support
- Ox or other API based swap or orderbook platfrom

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

dxsp-0.0.42.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

dxsp-0.0.42-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file dxsp-0.0.42.tar.gz.

File metadata

  • Download URL: dxsp-0.0.42.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.3

File hashes

Hashes for dxsp-0.0.42.tar.gz
Algorithm Hash digest
SHA256 a31a6044581d771a1d6f26aafbe4d061ad099085b10ad59c291b87cc1c531a79
MD5 3bac866d5207d62d3b322c05a20ef500
BLAKE2b-256 91cef30a0c235327fd54e18d331d0778d008856b2f20258dc4c1c85b3a935a37

See more details on using hashes here.

File details

Details for the file dxsp-0.0.42-py3-none-any.whl.

File metadata

  • Download URL: dxsp-0.0.42-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.3

File hashes

Hashes for dxsp-0.0.42-py3-none-any.whl
Algorithm Hash digest
SHA256 a76335c42f805739135412dab034ef3918434b95208e43c9fdb0ad7b48b8691c
MD5 14bccd56a6efdc9f7169dfdf4d69a9ab
BLAKE2b-256 1c734d585eaed55c3640ebc92a02cb0f461b600655a2c513edcad9b7c3186efc

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