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
aiohttpfor 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
Metadata
Release files for telegram-wallet-p2p 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| telegram_wallet_p2p-1.0.0.tar.gz | 11.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| telegram_wallet_p2p-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.9 kB
Release files / telegram_wallet_p2p-1.0.0.tar.gz
| Download URL | telegram_wallet_p2p-1.0.0.tar.gz |
|---|---|
| Size | 11.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c9e4bd31b59dd80f4f6c2a4638d26d14e1cf359c35353c75ebe79562a5995041
|
|
BLAKE2b-256 checksum How to use checksums |
f4faf9a389ddf8f5a03c0adc344eb0f31f7bf828ce2e4123910eab6d285daeda
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Release files / telegram_wallet_p2p-1.0.0-py3-none-any.whl
| Download URL | telegram_wallet_p2p-1.0.0-py3-none-any.whl |
|---|---|
| Size | 9.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d42d7d622f074fc4d351f13c44baa40384ab6fdff1621b84836a5497880048ea
|
|
BLAKE2b-256 checksum How to use checksums |
11c48539ae6765e2f766d6310b36b532d2ffb65bd5e7210e34135917d00a1883
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|