Skip to main content

Unofficial Python SDK for the Telegram Wallet P2P API

Project description

Telegram Wallet P2P SDK — Python

⚠️ Unofficial SDK — This project is not affiliated with, endorsed by, or related to Telegram or Wallet.

A fully typed, async-first Python SDK for the Telegram Wallet P2P API.

Features

  • 🔄 Async-first — Built on aiohttp for non-blocking I/O
  • 🛡️ Fully typed — Pydantic models with complete type coverage
  • 🔁 Auto-retry — Exponential backoff on rate limits and server errors
  • 📊 Analytics — Built-in utilities for price analysis and filtering
  • 🔑 Safe auth — API key passed via constructor, never logged

Installation

pip install telegram-wallet-p2p

Quick Start

import asyncio
import os
from telegram_wallet_p2p import WalletP2PClient, TradeSide

async def main():
    async with WalletP2PClient(api_key=os.environ["WALLET_P2P_API_KEY"]) as client:
        response = await client.get_online_items(
            crypto_currency="USDT",
            fiat_currency="RUB",
            side=TradeSide.SELL,
        )
        for item in response.data:
            print(f"{item.nickname}: {item.price} {item.fiat_currency}")

asyncio.run(main())

Analytics

from telegram_wallet_p2p.analytics import best_price, price_spread, market_summary

# Find the best sell price
best = best_price(response.data, TradeSide.SELL)

# Get price statistics
spread = price_spread(response.data)
# => {"min": "95.00", "max": "102.50", "avg": "98.75", "median": "98.50", ...}

# Full market summary
summary = market_summary(response.data)

API Reference

WalletP2PClient(api_key, *, base_url, timeout, max_retries, retry_base_delay)

Parameter Type Default Description
api_key str required Your Wallet P2P API key
base_url str https://p2p.walletbot.me API base URL
timeout int 30 Request timeout in seconds
max_retries int 3 Retry attempts on 429/5xx
retry_base_delay float 1.0 Base delay for exponential backoff

client.get_online_items(crypto_currency, fiat_currency, side, *, page, page_size)

Fetches active P2P ads. Returns GetOnlineItemsResponse.

Error Handling

from telegram_wallet_p2p.exceptions import (
    BadRequestError,       # 400 — unsupported currency
    AuthenticationError,   # 401 — invalid API key
    AccessDeniedError,     # 403 — access denied
    RateLimitError,        # 429 — rate limit exceeded
    ServerError,           # 5xx — server error
)

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

telegram_wallet_p2p-1.0.0.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

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

telegram_wallet_p2p-1.0.0-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file telegram_wallet_p2p-1.0.0.tar.gz.

File metadata

  • Download URL: telegram_wallet_p2p-1.0.0.tar.gz
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for telegram_wallet_p2p-1.0.0.tar.gz
Algorithm Hash digest
SHA256 c9e4bd31b59dd80f4f6c2a4638d26d14e1cf359c35353c75ebe79562a5995041
MD5 0c42478ad499774d421f04025b6b518d
BLAKE2b-256 f4faf9a389ddf8f5a03c0adc344eb0f31f7bf828ce2e4123910eab6d285daeda

See more details on using hashes here.

File details

Details for the file telegram_wallet_p2p-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for telegram_wallet_p2p-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d42d7d622f074fc4d351f13c44baa40384ab6fdff1621b84836a5497880048ea
MD5 6b372c366372f75daacc82c45fd62f95
BLAKE2b-256 11c48539ae6765e2f766d6310b36b532d2ffb65bd5e7210e34135917d00a1883

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