Skip to main content

No project description provided

Project description

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))

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

dexguru-sdk-0.2.8.tar.gz (12.0 kB view details)

Uploaded Source

Built Distribution

dexguru_sdk-0.2.8-py3-none-any.whl (14.1 kB view details)

Uploaded Python 3

File details

Details for the file dexguru-sdk-0.2.8.tar.gz.

File metadata

  • Download URL: dexguru-sdk-0.2.8.tar.gz
  • Upload date:
  • Size: 12.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for dexguru-sdk-0.2.8.tar.gz
Algorithm Hash digest
SHA256 07d6f98768412134f6839039eef537561c4956bc772c7f0e9cf2decf2c852291
MD5 ccc04eb8a4be2c5075b4984380c3d5c5
BLAKE2b-256 82b8cc3660925900ac4ae7673adcdb25b15beb4d2747b7f0aa015918fb63a4d4

See more details on using hashes here.

File details

Details for the file dexguru_sdk-0.2.8-py3-none-any.whl.

File metadata

  • Download URL: dexguru_sdk-0.2.8-py3-none-any.whl
  • Upload date:
  • Size: 14.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for dexguru_sdk-0.2.8-py3-none-any.whl
Algorithm Hash digest
SHA256 3e4f812d4aef4e1c7d3ad8be78fb554d7bf31f23ce2e6db38a19d29ef2d32659
MD5 5cce659f073cc39063859ec7b812d03f
BLAKE2b-256 6cc1e9cf3cb780121a5af8b7bf5aa16fb26defd627605f7fba5ef5070f96e7b5

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