A typed, tested, and enhanced Python wrapper for the Bitvavo cryptocurrency exchange API. This is an "upgraded" fork of the official Bitvavo SDK with comprehensive improvements and modern architecture.
- Two interfaces: Legacy
Bitvavoclass for backward compatibility + newBitvavoClientfor modern development - Modular design: Clean separation between public/private APIs, transport, and authentication
- Type safety: Complete type annotations with generics and precise return types
- Comprehensive test suite (found and fixed multiple bugs in the original)
- Enhanced error handling with detailed validation messages
- Rate limiting with automatic throttling and multi-key support
- Up-to-date API compliance including MiCA regulatory requirements
- Multiple output formats: Raw dictionaries, validated Pydantic models, or DataFrames
- Unified dataframe support via Narwhals (pandas, polars, cuDF, modin, PyArrow, Dask, DuckDB, Ibis, PySpark)
- Result types for functional error handling
- Modern Python support (3.9+, dropped EOL versions)
- Configuration via environment variables or Pydantic settings
- Enhanced documentation with comprehensive examples
- Developer-friendly tooling (ruff, mypy, pre-commit hooks)
pip install bitvavo_api_upgradedModern, modular interface with clean architecture:
from bitvavo_client import BitvavoClient, BitvavoSettings
# Auto-load from .env file
settings = BitvavoSettings()
client = BitvavoClient(**settings.model_dump())
# Access public endpoints (no auth needed)
time_result = client.public.time()
markets_result = client.public.markets()
# Access private endpoints (auth required)
balance_result = client.private.balance()
orders_result = client.private.orders('BTC-EUR')Drop-in replacement for the official SDK:
from bitvavo_api_upgraded import Bitvavo
bitvavo = Bitvavo({'APIKEY': 'your-key', 'APISECRET': 'your-secret'})
balance = bitvavo.balance({})MiCA Compliance Update: All trading operations now require an operatorId parameter:
# Before (v1.17.x and earlier)
bitvavo.placeOrder(market="BTC-EUR", side="buy", orderType="limit", body={...})
# After (v2.0.0+)
bitvavo.placeOrder(market="BTC-EUR", side="buy", orderType="limit", body={...}, operatorId=12345)New MiCA reporting endpoints:
reportTrades()- Generate trade reports for regulatory compliancereportBook()- Generate order book reportsaccountHistory()- Detailed account transaction history## Compatibility Promise
Version 1.* maintains compatibility with the original API, with these improvements:
- Fixed:
Bitvavo.candles()- renamedsymbol→marketparameter (was a bug) - Fixed:
Bitvavo.book()- samesymbol→marketfix - Removed: Internal
rateLimitThreadclass (cleaner implementation)
Create a .env file in your project root:
# API authentication
BITVAVO_API_KEY=your-api-key-here
BITVAVO_API_SECRET=your-api-secret-here
# Client behavior
BITVAVO_DEFAULT_RATE_LIMIT=1000 # Rate limit per key
BITVAVO_DEBUGGING=false # Enable debug logging
# Legacy format (still supported)
BITVAVO_APIKEY=your-api-key-here
BITVAVO_APISECRET=your-api-secret-herefrom bitvavo_client import BitvavoClient, BitvavoSettings
# Auto-load from .env
client = BitvavoClient()
# Custom settings
settings = BitvavoSettings(
api_key="your-key",
api_secret="your-secret",
)
client = BitvavoClient(settings)from bitvavo_api_upgraded import Bitvavo, BitvavoSettings
# Auto-load from .env file
settings = BitvavoSettings()
bitvavo = Bitvavo(settings.model_dump())
# Or manual configuration with multiple keys
bitvavo = Bitvavo({
'APIKEYS': [
{'key': 'your-key-1', 'secret': 'your-secret-1'},
{'key': 'your-key-2', 'secret': 'your-secret-2'}
]
})
# Or keyless for public endpoints only
bitvavo = Bitvavo({})Distribute API calls across multiple keys for better rate limit management:
from bitvavo_api_upgraded import Bitvavo
# Multiple keys automatically balance load
bitvavo = Bitvavo({
'APIKEYS': [
{'key': 'key1', 'secret': 'secret1'},
{'key': 'key2', 'secret': 'secret2'},
{'key': 'key3', 'secret': 'secret3'}
]
})
# API automatically switches between keys when rate limits are reached
balance = bitvavo.balance({}) # Uses least-used key
orders = bitvavo.getOrders('BTC-EUR', {}) # May use different keyAccess public endpoints without authentication:
from bitvavo_api_upgraded import Bitvavo
# No API keys needed for public data
bitvavo = Bitvavo({})
# These work without authentication
markets = bitvavo.markets({})
ticker = bitvavo.ticker24h({'market': 'BTC-EUR'})
trades = bitvavo.publicTrades('BTC-EUR', {})
book = bitvavo.book('BTC-EUR', {})Real-time data streaming with automatic reconnection:
def handle_ticker(data):
print(f"BTC-EUR: {data['price']}")
ws = bitvavo.newWebsocket()
ws.subscriptionTicker("BTC-EUR", handle_ticker)- Rate Limiting: Automatic throttling with
getRemainingLimit() - Error Handling: Comprehensive error responses with proper typing
- Lag Compensation: Client-server time difference calculation
- Ban Management: Automatic detection and recovery from temporary bans
- Type Safety: Full type hints for better IDE support and fewer runtime errors
- Install:
pip install bitvavo_api_upgraded - Update imports:
from bitvavo_api_upgraded import Bitvavo - Add operatorId: Include in all trading operations (placeOrder, updateOrder, cancelOrder)
- Enjoy: Better error handling, type hints, and reliability!
For new projects or when refactoring:
# Old
from python_bitvavo_api.bitvavo import Bitvavo
bitvavo = Bitvavo({'APIKEY': 'key', 'APISECRET': 'secret'})
# New
from bitvavo_client import BitvavoClient, BitvavoSettings
client = BitvavoClient(BitvavoSettings(api_key='key', api_secret='secret'))MiCA Compliance: All trading operations now require an operatorId parameter:
# Before (v1.17.x and earlier)
bitvavo.placeOrder(market="BTC-EUR", side="buy", orderType="limit", body={...})
# After (v2.0.0+)
bitvavo.placeOrder(market="BTC-EUR", side="buy", orderType="limit", body={...}, operatorId=12345)- Official Bitvavo API Documentation
- Trading Rules & Terminology (helpful for understanding crypto trading concepts)
- GitHub Repository (source code, issues, contributions)
- PyPI Package (installation and version history)
- Changelog (detailed version history)
This package is not affiliated with Bitvavo. It's an independent enhancement of their Python SDK.