dex.guru python sdk

Overview

dexguru-sdk.py

dexguru-logo

dexguru-sdk.py allows you to access dex.guru public methods from your async python scripts.

Installation

To install latest version, just run:

pip install dexguru-sdk

Getting Started

Take API key of your project from developers.dex.guru

import asyncio
from dexguru_sdk import DexGuru

YOUR_API_KEY = 'abc123'

sdk = DexGuru(api_key=YOUR_API_KEY)

async def main():
    response = await sdk.get_chains()
    return response

if __name__ == '__main__':
    asyncio.run(main())

Response

SDK response is Pydantic's models, so you can do whatever Pydantic allows with them.

You can find all models at dexguru_sdk.models:

class ChainModel(BaseModel):
    chain_id: int
    name: str
    description: str


class ChainsListModel(BaseModel):
    total: int
    data: List[ChainModel]
from typing import List
from dexguru_sdk.models import ChainModel, ChainsListModel


response: ChainsListModel
total: int = response.total
data: List[ChainModel] = response.data

if you need a simple dict from response, Pydantic can convert it:

response = response.dict()

Usage Examples

Ok, we want to see how your favorite wallets are trading:

import asyncio
from dexguru_sdk import DexGuru

sdk = DexGuru(api_key='my_sweet_key_from_sweet_project')

wallets = ['bot_wallet_address1', 'mistake_wallet_address2', 'heavy_wallet_address3']


async def main():
    wallets_info: WalletsListModel = await sdk.get_wallets_info(
        chain_id=1,
        wallet_addresses=wallets,
    )
    return wallets_info

if __name__ == '__main__':
    asyncio.run(main())

wallets_info.total == 2 because we have mistake in address2 and it was skipped

Print wallets_info object:

total=2 data=[
    WalletModel(
        wallet_address='bot_wallet_address1',
        volume_1m_usd=5000.123456,
        txns_1m=999999,
        category='bot',
        timestamp=1621635936 # last tx timestamp
    ),
    WalletModel(
        wallet_address='whale_wallet_address3',
        volume_1m_usd=107382.62431031652,
        txns_1m=8699,
        category='heavy',
        timestamp=1621635936 # last tx timestamp
    )]

Wow, they are good traders! Let's see what transactions they made:

wallets = ['bot_wallet_address1', 'mistake_wallet_address2', 'heavy_wallet_address3']

async def get_txs_from_list_of_wallets(wallets: List[str]) -> List:
    result = []
    for wallet in wallets:
        txs = await sdk.get_wallet_transactions(chain_id=1, wallet_address=wallet)
        result.append(txs)
    return result

if __name__ == '__main__':
    result = asyncio.run(get_txs_from_list_of_wallets(wallets))
You might also like...
The Python SDK for the Rackspace Cloud

pyrax Python SDK for OpenStack/Rackspace APIs DEPRECATED: Pyrax is no longer being developed or supported. See openstacksdk and the rackspacesdk plugi

:snake: Python SDK to query Scaleway APIs.

Scaleway SDK Python SDK to query Scaleway's APIs. Stable release: Development: Installation The package is available on pip. To install it in a virtua

Skyscanner Python SDK

Skyscanner Python SDK Important As of May 1st, 2020, the project is deprecated and no longer maintained. The latest update in v1.1.5 includes changing

WeChat SDK for Python
WeChat SDK for Python

___ __ _______ ________ ___ ___ ________ _________ ________ ___ ___ |\ \ |\ \|\ ___ \ |\ ____\|\ \|\ \|\ __ \|\___

Python SDK for the Buycoins API.

This library provides easy access to the Buycoins API using the Python programming language. It provides all the feature of the API so that you don't need to interact with the API directly. This library can be used with Python 3.6+

Graviti TensorBay Python SDK

TensorBay Python SDK is a python library to access TensorBay and manage your datasets. It provides: A pythonic way to access your

A Python script for rendering glTF files with V-Ray App SDK
A Python script for rendering glTF files with V-Ray App SDK

V-Ray glTF viewer Overview The V-Ray glTF viewer is a set of Python scripts for the V-Ray App SDK that allow the parsing and rendering of glTF (.gltf

qualysclient - a python SDK for interacting with the Qualys API

qualysclient - a python SDK for interacting with the Qualys API

A Python SDK for connecting devices to Microsoft Azure IoT services
A Python SDK for connecting devices to Microsoft Azure IoT services

V2 - We are now GA! This repository contains code for the Azure IoT SDKs for Python. This enables python developers to easily create IoT device soluti

Comments
  • Error installing packages

    Error installing packages

    I do pip install dexguru-sdk and I get:

    Building wheels for collected packages: ujson Building wheel for ujson (pyproject.toml) ... error error: subprocess-exited-with-error

    × Building wheel for ujson (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [5 lines of output] running bdist_wheel running build running build_ext building 'ujson' extension error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/ [end of output]

    note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for ujson Failed to build ujson ERROR: Could not build wheels for ujson, which is required to install pyproject.toml-based projects

    My VC++ version is: 14.28.29913.00 image

    Can you help me?

    opened by ricardbou 0
Owner
DexGuru
Guru️ knows a thing or two about what is going on at AMM DEXs
DexGuru
Graviti-python-sdk - Graviti Data Platform Python SDK

Graviti Python SDK Graviti Python SDK is a python library to access Graviti Data

Graviti 13 Dec 15, 2022
A wrapper for aqquiring Choice Coin directly through a Python Terminal. Leverages the TinyMan Python-SDK.

CHOICE_TinyMan_Wrapper A wrapper that allows users to acquire Choice Coin directly through their Terminal using ALGO and various Algorand Standard Ass

Choice Coin 16 Sep 24, 2022
AWS SDK for Python

Boto3 - The AWS SDK for Python Boto3 is the Amazon Web Services (AWS) Software Development Kit (SDK) for Python, which allows Python developers to wri

the boto project 7.8k Jan 8, 2023
Python SDK for Facebook's Graph API

Facebook Python SDK This client library is designed to support the Facebook Graph API and the official Facebook JavaScript SDK, which is the canonical

Mobolic 2.7k Jan 7, 2023
Box SDK for Python

Box Python SDK Installing Getting Started Authorization Server-to-Server Auth with JWT Traditional 3-legged OAuth2 Other Auth Options Usage Documentat

Box 371 Dec 29, 2022
The Official Dropbox API V2 SDK for Python

The offical Dropbox SDK for Python. Documentation can be found on Read The Docs. Installation Create an app via the Developer Console. Install via pip

Dropbox 828 Jan 5, 2023
Evernote SDK for Python

Evernote SDK for Python Evernote API version 1.28 This SDK is intended for use with Python 2.X For Evernote's beta Python 3 SDK see https://github.com

Evernote 612 Dec 30, 2022
Python SDK for IEX Cloud

iexfinance Python SDK for IEX Cloud. Architecture mirrors that of the IEX Cloud API (and its documentation). An easy-to-use toolkit to obtain data for

Addison Lynch 640 Jan 7, 2023
Unofficial Medium Python Flask API and SDK

PyMedium - Unofficial Medium API PyMedium is an unofficial Medium API written in python flask. It provides developers to access to user, post list and

Engine Bai 157 Nov 11, 2022