Skip to main content

Official Python SDK for Bloxchaser DEX Data API

Project description

Bloxchaser Python SDK

Official Python SDK for Bloxchaser - Multi-chain DEX swap data API.

Installation

pip install bloxchaser

Quick Start

import asyncio
from bloxchaser import Bloxchaser

async def main():
    async with Bloxchaser("bc_live_your_key") as client:
        # Get recent Solana swaps
        swaps = await client.swaps.get(chain="solana", limit=100)
        print(f"Found {swaps.count} swaps")

        # Get OHLCV for BONK
        ohlcv = await client.swaps.ohlcv(
            "DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263",
            interval="4h"
        )
        for candle in ohlcv.candles[:5]:
            print(f"{candle.datetime}: {candle.close}")

asyncio.run(main())

Sync Usage

from bloxchaser import BloxchaserSync

with BloxchaserSync("bc_live_your_key") as client:
    swaps = client.swaps.get(chain="base", dex="aerodrome")
    print(f"Found {swaps.count} Base swaps")

Features

  • Async-first with sync wrappers
  • Full type hints with Pydantic models
  • Automatic retry with exponential backoff
  • Rate limit handling with smart throttling
  • Multi-chain support: Solana, Base, Arbitrum, BNB

API Reference

Swaps

# Get recent swaps
swaps = await client.swaps.get(
    chain="solana",      # solana, base, arbitrum, bnb
    dex="raydium",       # optional DEX filter
    limit=100,
    offset=0
)

# Swaps by token
swaps = await client.swaps.by_token("So111...", chain="solana")

# Swaps by pool
swaps = await client.swaps.by_pool("7Xawh...", chain="solana")

# Chain statistics
stats = await client.swaps.stats(chain="solana")

# All chains summary
summary = await client.swaps.chains()

# OHLCV candles (Solana)
ohlcv = await client.swaps.ohlcv(
    "DezXAZ...",
    quote="sol",         # sol, usdc, usdt
    interval="4h",       # 1m, 5m, 15m, 1h, 4h, 1d
    limit=100
)

Tokens (Solana)

# List tokens
tokens = await client.tokens.list(limit=100)

# Get token info
token = await client.tokens.get("DezXAZ...")

# Get current price
price = await client.tokens.price("DezXAZ...")

# Price history
history = await client.tokens.price_history("DezXAZ...", limit=60)

Quotes

# Get swap quote
quote = await client.quotes.get(
    pool="7Xawh...",
    amount=1_000_000_000,  # 1 SOL in lamports
    input_token="So111...",
    chain="solana"
)
print(f"Output: {quote.output_amount}, Impact: {quote.price_impact}")

Health & Usage

# Check API health
health = await client.health()
print(f"Status: {health.status}, Version: {health.version}")

# Get your usage stats
usage = await client.usage()
print(f"Requests today: {usage.requests_today}/{usage.monthly_quota}")

Error Handling

from bloxchaser import (
    Bloxchaser,
    AuthenticationError,
    RateLimitError,
    APIError,
)

try:
    async with Bloxchaser("invalid_key") as client:
        await client.swaps.get()
except AuthenticationError:
    print("Invalid API key")
except RateLimitError as e:
    print(f"Rate limited. Retry after {e.retry_after}s")
except APIError as e:
    print(f"API error: [{e.code}] {e.message}")

Get an API Key

  1. Visit bloxchaser.com/signup
  2. Enter your email
  3. Save your API key (shown only once!)

Links

License

MIT

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

bloxchaser-0.1.0.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bloxchaser-0.1.0-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

File details

Details for the file bloxchaser-0.1.0.tar.gz.

File metadata

  • Download URL: bloxchaser-0.1.0.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for bloxchaser-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0694368e8ec9d0fdd91777325e7533037271795f4455d9ecea98b841f83b1842
MD5 826c901de29cc9f4814510d7a4a291a7
BLAKE2b-256 18999f9668cb8c0a71acee87204ba368312dc7c8c3322bf3a1c300c01a030fab

See more details on using hashes here.

File details

Details for the file bloxchaser-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: bloxchaser-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for bloxchaser-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 34663d522b7e7887fb58948415507691642861e50b3d2c38048711edea19f141
MD5 c6cc9ede5ca6ee61226a855ea104ffc9
BLAKE2b-256 362b4362766eb7c1fdb89c3fb19dffcd26e979e4eaa2d3b53beaef3deb73f4a4

See more details on using hashes here.

Supported by

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