bitvavo-api-upgraded 3.0.0__tar.gz → 4.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {bitvavo_api_upgraded-3.0.0 → bitvavo_api_upgraded-4.1.0}/PKG-INFO +406 -85
- {bitvavo_api_upgraded-3.0.0 → bitvavo_api_upgraded-4.1.0}/README.md +394 -79
- {bitvavo_api_upgraded-3.0.0 → bitvavo_api_upgraded-4.1.0}/pyproject.toml +15 -13
- {bitvavo_api_upgraded-3.0.0 → bitvavo_api_upgraded-4.1.0}/src/bitvavo_api_upgraded/bitvavo.py +124 -109
- {bitvavo_api_upgraded-3.0.0 → bitvavo_api_upgraded-4.1.0}/src/bitvavo_api_upgraded/dataframe_utils.py +3 -1
- {bitvavo_api_upgraded-3.0.0 → bitvavo_api_upgraded-4.1.0}/src/bitvavo_api_upgraded/settings.py +1 -1
- {bitvavo_api_upgraded-3.0.0 → bitvavo_api_upgraded-4.1.0}/src/bitvavo_api_upgraded/type_aliases.py +2 -2
- {bitvavo_api_upgraded-3.0.0 → bitvavo_api_upgraded-4.1.0}/src/bitvavo_api_upgraded/__init__.py +0 -0
- {bitvavo_api_upgraded-3.0.0 → bitvavo_api_upgraded-4.1.0}/src/bitvavo_api_upgraded/helper_funcs.py +0 -0
- {bitvavo_api_upgraded-3.0.0 → bitvavo_api_upgraded-4.1.0}/src/bitvavo_api_upgraded/py.typed +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: bitvavo-api-upgraded
|
3
|
-
Version:
|
3
|
+
Version: 4.1.0
|
4
4
|
Summary: A unit-tested fork of the Bitvavo API
|
5
5
|
Author: Bitvavo BV (original code), NostraDavid
|
6
6
|
Author-email: NostraDavid <55331731+NostraDavid@users.noreply.github.com>
|
@@ -21,10 +21,12 @@ Classifier: Programming Language :: Python :: 3.12
|
|
21
21
|
Classifier: Programming Language :: Python :: 3.13
|
22
22
|
Classifier: Programming Language :: Python
|
23
23
|
Classifier: Typing :: Typed
|
24
|
-
Requires-Dist:
|
25
|
-
Requires-Dist:
|
26
|
-
Requires-Dist:
|
27
|
-
Requires-Dist:
|
24
|
+
Requires-Dist: httpx>=0.28.1
|
25
|
+
Requires-Dist: pydantic-settings>=2.6
|
26
|
+
Requires-Dist: requests>=2.26
|
27
|
+
Requires-Dist: returns>=0.23.0
|
28
|
+
Requires-Dist: structlog>=21.5
|
29
|
+
Requires-Dist: websocket-client>=1.2
|
28
30
|
Requires-Dist: cudf-cu12>=24.0.0 ; extra == 'cudf'
|
29
31
|
Requires-Dist: narwhals>=2.0.0 ; extra == 'cudf'
|
30
32
|
Requires-Dist: narwhals[dask]>=2.0.0 ; extra == 'dask'
|
@@ -33,13 +35,16 @@ Requires-Dist: narwhals[ibis]>=2.0.0 ; extra == 'ibis'
|
|
33
35
|
Requires-Dist: narwhals[modin]>=2.0.0 ; extra == 'modin'
|
34
36
|
Requires-Dist: narwhals[pandas]>=2.0.0 ; extra == 'pandas'
|
35
37
|
Requires-Dist: narwhals[polars]>=2.0.0 ; extra == 'polars'
|
38
|
+
Requires-Dist: cudf-polars-cu12>=24.0.0 ; extra == 'polars-gpu'
|
39
|
+
Requires-Dist: polars ; extra == 'polars-gpu'
|
40
|
+
Requires-Dist: narwhals>=2.0.0 ; extra == 'polars-gpu'
|
36
41
|
Requires-Dist: narwhals[pyarrow]>=2.0.0 ; extra == 'pyarrow'
|
37
42
|
Requires-Dist: narwhals[pyspark]>=2.0.0 ; extra == 'pyspark'
|
38
43
|
Requires-Dist: narwhals[pyspark-connect]>=2.0.0 ; extra == 'pyspark-connect'
|
39
44
|
Requires-Dist: narwhals[sqlframe]>=2.0.0 ; extra == 'sqlframe'
|
40
45
|
Maintainer: NostraDavid
|
41
46
|
Maintainer-email: NostraDavid <55331731+NostraDavid@users.noreply.github.com>
|
42
|
-
Requires-Python: >=3.
|
47
|
+
Requires-Python: >=3.10
|
43
48
|
Project-URL: changelog, https://github.com/Thaumatorium/bitvavo-api-upgraded/blob/master/CHANGELOG.md
|
44
49
|
Project-URL: homepage, https://github.com/Thaumatorium/bitvavo-api-upgraded
|
45
50
|
Project-URL: repository, https://github.com/Thaumatorium/bitvavo-api-upgraded
|
@@ -50,6 +55,7 @@ Provides-Extra: ibis
|
|
50
55
|
Provides-Extra: modin
|
51
56
|
Provides-Extra: pandas
|
52
57
|
Provides-Extra: polars
|
58
|
+
Provides-Extra: polars-gpu
|
53
59
|
Provides-Extra: pyarrow
|
54
60
|
Provides-Extra: pyspark
|
55
61
|
Provides-Extra: pyspark-connect
|
@@ -58,7 +64,7 @@ Description-Content-Type: text/markdown
|
|
58
64
|
|
59
65
|
# Bitvavo API (upgraded)
|
60
66
|
|
61
|
-
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 type hints, unit tests, and improved developer experience.
|
67
|
+
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 type hints, unit tests, modern architecture, and improved developer experience.
|
62
68
|
|
63
69
|
## Quick Start
|
64
70
|
|
@@ -66,6 +72,23 @@ A **typed, tested, and enhanced** Python wrapper for the Bitvavo cryptocurrency
|
|
66
72
|
pip install bitvavo_api_upgraded
|
67
73
|
```
|
68
74
|
|
75
|
+
### Basic Usage
|
76
|
+
|
77
|
+
```python
|
78
|
+
# Option 1: Original Bitvavo interface (legacy)
|
79
|
+
from bitvavo_api_upgraded import Bitvavo
|
80
|
+
|
81
|
+
bitvavo = Bitvavo({'APIKEY': 'your-key', 'APISECRET': 'your-secret'})
|
82
|
+
balance = bitvavo.balance({})
|
83
|
+
|
84
|
+
# Option 2: New modular BitvavoClient interface (recommended)
|
85
|
+
from bitvavo_client import BitvavoClient, BitvavoSettings
|
86
|
+
|
87
|
+
client = BitvavoClient()
|
88
|
+
result = client.public.time() # No authentication needed
|
89
|
+
result = client.private.balance() # Authentication required
|
90
|
+
```
|
91
|
+
|
69
92
|
### Optional Dataframe Support
|
70
93
|
|
71
94
|
This package supports multiple dataframe libraries via [Narwhals](https://narwhals-dev.github.io/narwhals/), providing a unified interface across:
|
@@ -112,66 +135,127 @@ Scroll down for detailed usage examples and configuration instructions.
|
|
112
135
|
|
113
136
|
This wrapper improves upon the official Bitvavo SDK with:
|
114
137
|
|
115
|
-
|
116
|
-
|
117
|
-
-
|
118
|
-
-
|
119
|
-
-
|
120
|
-
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
-
|
138
|
+
### Modern Architecture
|
139
|
+
|
140
|
+
- **Modular design**: Clean separation between public/private APIs, transport, and authentication
|
141
|
+
- **Two interfaces**: Legacy `Bitvavo` class for backward compatibility + new `BitvavoClient` for modern development
|
142
|
+
- **Dependency injection**: Testable, maintainable, and extensible codebase
|
143
|
+
- **Type safety**: Comprehensive type annotations with generics and precise return types
|
144
|
+
|
145
|
+
### Quality & Reliability
|
146
|
+
|
147
|
+
- **Comprehensive test suite** (found and fixed multiple bugs in the original)
|
148
|
+
- **100% type coverage** with mypy strict mode
|
149
|
+
- **Enhanced error handling** with detailed validation messages
|
150
|
+
- **Rate limiting** with automatic throttling and multi-key support
|
151
|
+
|
152
|
+
### Data Format Flexibility
|
153
|
+
|
154
|
+
- **Unified dataframe support** via Narwhals (pandas, polars, cuDF, modin, PyArrow, Dask, DuckDB, Ibis, PySpark, SQLFrame)
|
155
|
+
- **Pydantic models** for validated, structured data
|
156
|
+
- **Raw dictionary access** for backward compatibility
|
157
|
+
- **Result types** for functional error handling
|
158
|
+
|
159
|
+
### Enhanced Performance
|
160
|
+
|
161
|
+
- **Multi-key support** for better rate limiting and load distribution
|
162
|
+
- **Keyless access** for public endpoints (doesn't count against your API limits)
|
163
|
+
- **Connection pooling** and retry logic
|
164
|
+
- **Async-ready architecture** (async support coming in future release)
|
165
|
+
|
166
|
+
### Developer Experience
|
167
|
+
|
168
|
+
- **Modern Python support** (3.9+, dropped EOL versions)
|
169
|
+
- **Configuration via environment variables** or Pydantic settings
|
170
|
+
- **Detailed changelog** tracking all changes and improvements
|
171
|
+
- **Enhanced documentation** with examples and clear usage patterns
|
172
|
+
- **Developer-friendly tooling** (ruff, mypy, pre-commit hooks)
|
125
173
|
|
126
174
|
## Features
|
127
175
|
|
128
176
|
### Full API Coverage
|
129
177
|
|
130
|
-
-
|
131
|
-
-
|
132
|
-
-
|
133
|
-
-
|
134
|
-
-
|
135
|
-
-
|
136
|
-
-
|
178
|
+
- All REST endpoints (public and private)
|
179
|
+
- Multiple API key support with automatic load balancing
|
180
|
+
- Keyless access for public endpoints without authentication
|
181
|
+
- Comprehensive dataframe support via Narwhals (pandas, polars, cuDF, modin, PyArrow, Dask, DuckDB, Ibis, PySpark, and more)
|
182
|
+
- WebSocket support with reconnection logic
|
183
|
+
- Rate limiting with automatic throttling
|
184
|
+
- MiCA compliance reporting endpoints
|
137
185
|
|
138
186
|
### Developer Experience
|
139
187
|
|
140
|
-
-
|
141
|
-
-
|
142
|
-
-
|
143
|
-
-
|
144
|
-
-
|
188
|
+
- Type hints for better IDE support
|
189
|
+
- Comprehensive error handling
|
190
|
+
- Detailed logging with `structlog`
|
191
|
+
- Configuration via `.env` files
|
192
|
+
- Extensive test coverage
|
145
193
|
|
146
194
|
### Production Ready
|
147
195
|
|
148
|
-
-
|
149
|
-
-
|
150
|
-
-
|
151
|
-
-
|
152
|
-
-
|
196
|
+
- Automatic rate limit management
|
197
|
+
- Multi-key failover support
|
198
|
+
- Connection retry logic
|
199
|
+
- Proper error responses
|
200
|
+
- Memory efficient WebSocket handling
|
153
201
|
|
154
202
|
## Configuration
|
155
203
|
|
204
|
+
### Environment Variables
|
205
|
+
|
156
206
|
Create a `.env` file in your project root:
|
157
207
|
|
158
208
|
```env
|
159
|
-
#
|
160
|
-
|
161
|
-
|
209
|
+
# API authentication
|
210
|
+
BITVAVO_API_KEY=your-api-key-here
|
211
|
+
BITVAVO_API_SECRET=your-api-secret-here
|
212
|
+
|
213
|
+
# Multi-key support (JSON array as string)
|
214
|
+
# BITVAVO_API_KEYS='[{"key": "key1", "secret": "secret1"}, {"key": "key2", "secret": "secret2"}]'
|
215
|
+
|
216
|
+
# Client behavior
|
217
|
+
BITVAVO_PREFER_KEYLESS=true # Use keyless for public endpoints
|
218
|
+
BITVAVO_DEFAULT_RATE_LIMIT=1000 # Rate limit per key
|
219
|
+
BITVAVO_RATE_LIMIT_BUFFER=50 # Buffer to avoid hitting limits
|
220
|
+
BITVAVO_DEBUGGING=false # Enable debug logging
|
221
|
+
|
222
|
+
# API endpoints (usually not needed to change)
|
223
|
+
BITVAVO_REST_URL=https://api.bitvavo.com/v2
|
224
|
+
BITVAVO_WS_URL=wss://ws.bitvavo.com/v2/
|
225
|
+
```
|
226
|
+
|
227
|
+
### Usage Examples
|
228
|
+
|
229
|
+
#### New BitvavoClient (Recommended)
|
230
|
+
|
231
|
+
```python
|
232
|
+
from bitvavo_client import BitvavoClient, BitvavoSettings
|
233
|
+
|
234
|
+
# Option 1: Auto-load from .env file
|
235
|
+
client = BitvavoClient()
|
236
|
+
|
237
|
+
# Option 2: Custom settings
|
238
|
+
settings = BitvavoSettings(
|
239
|
+
api_key="your-key",
|
240
|
+
api_secret="your-secret",
|
241
|
+
prefer_keyless=True,
|
242
|
+
debugging=True
|
243
|
+
)
|
244
|
+
client = BitvavoClient(settings)
|
162
245
|
|
163
|
-
#
|
164
|
-
|
246
|
+
# Option 3: Manual settings override
|
247
|
+
client = BitvavoClient(BitvavoSettings(default_rate_limit=750))
|
165
248
|
|
166
|
-
#
|
167
|
-
|
249
|
+
# Access public endpoints (no auth needed)
|
250
|
+
time_result = client.public.time()
|
251
|
+
markets_result = client.public.markets()
|
168
252
|
|
169
|
-
#
|
170
|
-
|
171
|
-
|
253
|
+
# Access private endpoints (auth required)
|
254
|
+
balance_result = client.private.balance()
|
255
|
+
account_result = client.private.account()
|
172
256
|
```
|
173
257
|
|
174
|
-
|
258
|
+
#### Legacy Bitvavo Class (Backward Compatibility)
|
175
259
|
|
176
260
|
```python
|
177
261
|
from bitvavo_api_upgraded import Bitvavo, BitvavoSettings
|
@@ -198,6 +282,68 @@ bitvavo = Bitvavo({
|
|
198
282
|
bitvavo = Bitvavo({'PREFER_KEYLESS': True})
|
199
283
|
```
|
200
284
|
|
285
|
+
## Data Format Flexibility
|
286
|
+
|
287
|
+
The new BitvavoClient supports multiple output formats to match your workflow:
|
288
|
+
|
289
|
+
### Model Preferences
|
290
|
+
|
291
|
+
```python
|
292
|
+
from bitvavo_client import BitvavoClient
|
293
|
+
from bitvavo_client.core.model_preferences import ModelPreference
|
294
|
+
|
295
|
+
# Option 1: Raw dictionaries (default, backward compatible)
|
296
|
+
client = BitvavoClient(preferred_model=ModelPreference.RAW)
|
297
|
+
result = client.public.time() # Returns: {"time": 1609459200000}
|
298
|
+
|
299
|
+
# Option 2: Validated Pydantic models
|
300
|
+
client = BitvavoClient(preferred_model=ModelPreference.PYDANTIC)
|
301
|
+
result = client.public.time() # Returns: ServerTime(time=1609459200000)
|
302
|
+
|
303
|
+
# Option 3: DataFrame format (pandas, polars, etc.)
|
304
|
+
client = BitvavoClient(preferred_model=ModelPreference.DATAFRAME)
|
305
|
+
result = client.public.markets() # Returns: polars.DataFrame with market data
|
306
|
+
```
|
307
|
+
|
308
|
+
### Per-Request Format Override
|
309
|
+
|
310
|
+
```python
|
311
|
+
# Set a default preference but override per request
|
312
|
+
client = BitvavoClient(preferred_model=ModelPreference.RAW)
|
313
|
+
|
314
|
+
# Get raw dict (uses default)
|
315
|
+
raw_data = client.public.markets()
|
316
|
+
|
317
|
+
# Override to get DataFrame for this request
|
318
|
+
import polars as pl
|
319
|
+
df_data = client.public.markets(model=pl.DataFrame)
|
320
|
+
|
321
|
+
# Override to get Pydantic model
|
322
|
+
from bitvavo_client.core.public_models import Markets
|
323
|
+
validated_data = client.public.markets(model=Markets)
|
324
|
+
```
|
325
|
+
|
326
|
+
### Result Types for Error Handling
|
327
|
+
|
328
|
+
```python
|
329
|
+
from returns.result import Success, Failure
|
330
|
+
|
331
|
+
# Use result types for functional error handling
|
332
|
+
result = client.public.time()
|
333
|
+
|
334
|
+
if isinstance(result, Success):
|
335
|
+
print(f"Server time: {result.unwrap()}")
|
336
|
+
elif isinstance(result, Failure):
|
337
|
+
print(f"Error: {result.failure()}")
|
338
|
+
|
339
|
+
# Or use match-case (Python 3.10+)
|
340
|
+
match result:
|
341
|
+
case Success(value):
|
342
|
+
print(f"Success: {value}")
|
343
|
+
case Failure(error):
|
344
|
+
print(f"Error: {error}")
|
345
|
+
```
|
346
|
+
|
201
347
|
## WebSocket Usage
|
202
348
|
|
203
349
|
```python
|
@@ -287,9 +433,44 @@ balance = bitvavo.balance({})
|
|
287
433
|
|
288
434
|
## API Examples
|
289
435
|
|
290
|
-
### Public Endpoints (No Authentication)
|
436
|
+
### Public Endpoints (No Authentication Required)
|
437
|
+
|
438
|
+
#### New BitvavoClient Interface
|
291
439
|
|
292
440
|
```python
|
441
|
+
from bitvavo_client import BitvavoClient
|
442
|
+
|
443
|
+
client = BitvavoClient()
|
444
|
+
|
445
|
+
# Get server time
|
446
|
+
time_result = client.public.time()
|
447
|
+
|
448
|
+
# Get all markets
|
449
|
+
markets_result = client.public.markets()
|
450
|
+
|
451
|
+
# Get specific market
|
452
|
+
btc_market = client.public.markets(market='BTC-EUR')
|
453
|
+
|
454
|
+
# Get order book
|
455
|
+
book_result = client.public.book('BTC-EUR')
|
456
|
+
|
457
|
+
# Get recent trades
|
458
|
+
trades_result = client.public.trades('BTC-EUR')
|
459
|
+
|
460
|
+
# Get 24h ticker
|
461
|
+
ticker_result = client.public.ticker_24h(market='BTC-EUR')
|
462
|
+
|
463
|
+
# Get candlestick data
|
464
|
+
candles_result = client.public.candles('BTC-EUR', '1h')
|
465
|
+
```
|
466
|
+
|
467
|
+
#### Legacy Bitvavo Interface
|
468
|
+
|
469
|
+
```python
|
470
|
+
from bitvavo_api_upgraded import Bitvavo
|
471
|
+
|
472
|
+
bitvavo = Bitvavo({'PREFER_KEYLESS': True}) # For public endpoints
|
473
|
+
|
293
474
|
# Get server time
|
294
475
|
time_resp = bitvavo.time()
|
295
476
|
|
@@ -311,7 +492,50 @@ ticker = bitvavo.ticker24h({'market': 'BTC-EUR'})
|
|
311
492
|
|
312
493
|
### Private Endpoints (Authentication Required)
|
313
494
|
|
495
|
+
#### New BitvavoClient Interface
|
496
|
+
|
497
|
+
```python
|
498
|
+
from bitvavo_client import BitvavoClient, BitvavoSettings
|
499
|
+
|
500
|
+
# Configure with API credentials
|
501
|
+
settings = BitvavoSettings(api_key="your-key", api_secret="your-secret")
|
502
|
+
client = BitvavoClient(settings)
|
503
|
+
|
504
|
+
# Get account info
|
505
|
+
account_result = client.private.account()
|
506
|
+
|
507
|
+
# Get balance
|
508
|
+
balance_result = client.private.balance()
|
509
|
+
|
510
|
+
# Place order
|
511
|
+
order_result = client.private.place_order(
|
512
|
+
market="BTC-EUR",
|
513
|
+
side="buy",
|
514
|
+
order_type="limit",
|
515
|
+
amount="0.01",
|
516
|
+
price="45000"
|
517
|
+
)
|
518
|
+
|
519
|
+
# Get order history
|
520
|
+
orders_result = client.private.orders('BTC-EUR')
|
521
|
+
|
522
|
+
# Cancel order
|
523
|
+
cancel_result = client.private.cancel_order(
|
524
|
+
market="BTC-EUR",
|
525
|
+
order_id="order-id-here"
|
526
|
+
)
|
527
|
+
|
528
|
+
# Get trades
|
529
|
+
trades_result = client.private.trades('BTC-EUR')
|
530
|
+
```
|
531
|
+
|
532
|
+
#### Legacy Bitvavo Interface
|
533
|
+
|
314
534
|
```python
|
535
|
+
from bitvavo_api_upgraded import Bitvavo
|
536
|
+
|
537
|
+
bitvavo = Bitvavo({'APIKEY': 'your-key', 'APISECRET': 'your-secret'})
|
538
|
+
|
315
539
|
# Get account info
|
316
540
|
account = bitvavo.account()
|
317
541
|
|
@@ -523,15 +747,49 @@ uv run ruff format
|
|
523
747
|
### Project Structure
|
524
748
|
|
525
749
|
```text
|
526
|
-
src/
|
527
|
-
├──
|
528
|
-
├──
|
529
|
-
├──
|
530
|
-
├──
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
750
|
+
src/
|
751
|
+
├── bitvavo_api_upgraded/ # Legacy interface (backward compatibility)
|
752
|
+
│ ├── __init__.py # Main exports
|
753
|
+
│ ├── bitvavo.py # Original monolithic API class
|
754
|
+
│ ├── settings.py # Pydantic settings
|
755
|
+
│ ├── helper_funcs.py # Utility functions
|
756
|
+
│ └── type_aliases.py # Type definitions
|
757
|
+
└── bitvavo_client/ # Modern modular interface
|
758
|
+
├── __init__.py # New client exports
|
759
|
+
├── facade.py # Main BitvavoClient class
|
760
|
+
├── core/ # Core functionality
|
761
|
+
│ ├── settings.py # Settings management
|
762
|
+
│ ├── models.py # Pydantic data models
|
763
|
+
│ ├── validation_helpers.py # Enhanced error handling
|
764
|
+
│ └── types.py # Type definitions
|
765
|
+
├── endpoints/ # API endpoint handlers
|
766
|
+
│ ├── public.py # Public API endpoints
|
767
|
+
│ ├── private.py # Private API endpoints
|
768
|
+
│ └── common.py # Shared endpoint utilities
|
769
|
+
├── transport/ # HTTP transport layer
|
770
|
+
│ └── http.py # HTTP client with connection pooling
|
771
|
+
├── auth/ # Authentication & authorization
|
772
|
+
│ ├── signing.py # Request signing
|
773
|
+
│ └── rate_limit.py # Rate limiting management
|
774
|
+
├── adapters/ # External integrations
|
775
|
+
│ └── returns_adapter.py # Result type adapters
|
776
|
+
├── schemas/ # DataFrame schemas
|
777
|
+
│ ├── public_schemas.py # Public endpoint schemas
|
778
|
+
│ └── private_schemas.py # Private endpoint schemas
|
779
|
+
└── df/ # DataFrame conversion
|
780
|
+
└── convert.py # Narwhals-based converters
|
781
|
+
|
782
|
+
tests/ # Comprehensive test suite
|
783
|
+
├── bitvavo_api_upgraded/ # Legacy interface tests
|
784
|
+
└── bitvavo_client/ # Modern interface tests
|
785
|
+
├── core/ # Core functionality tests
|
786
|
+
├── endpoints/ # Endpoint tests
|
787
|
+
├── transport/ # Transport layer tests
|
788
|
+
├── auth/ # Authentication tests
|
789
|
+
├── adapters/ # Adapter tests
|
790
|
+
└── df/ # DataFrame tests
|
791
|
+
|
792
|
+
docs/ # Documentation
|
535
793
|
```
|
536
794
|
|
537
795
|
### Semantic Versioning
|
@@ -546,47 +804,110 @@ This project follows [semantic versioning](https://semver.org/):
|
|
546
804
|
|
547
805
|
This package includes a `py.typed` file to enable type checking. Reference: [Don't forget py.typed for your typed Python package](https://blog.whtsky.me/tech/2021/dont-forget-py.typed-for-your-typed-python-package/)
|
548
806
|
|
549
|
-
## Migration
|
807
|
+
## Migration & Architecture Options
|
808
|
+
|
809
|
+
This package provides **two interfaces** to suit different use cases:
|
810
|
+
|
811
|
+
### 1. Legacy Bitvavo Class (Backward Compatibility)
|
812
|
+
|
813
|
+
For existing users migrating from the official SDK:
|
550
814
|
|
551
|
-
|
815
|
+
```python
|
816
|
+
from bitvavo_api_upgraded import Bitvavo
|
552
817
|
|
553
|
-
-
|
554
|
-
|
555
|
-
|
818
|
+
# Drop-in replacement for python_bitvavo_api.bitvavo
|
819
|
+
bitvavo = Bitvavo({'APIKEY': 'key', 'APISECRET': 'secret'})
|
820
|
+
balance = bitvavo.balance({})
|
821
|
+
```
|
822
|
+
|
823
|
+
### 2. New BitvavoClient (Modern Architecture)
|
824
|
+
|
825
|
+
For new projects or those wanting better architecture:
|
826
|
+
|
827
|
+
```python
|
828
|
+
from bitvavo_client import BitvavoClient, BitvavoSettings
|
829
|
+
|
830
|
+
# Modern, typed, modular interface
|
831
|
+
client = BitvavoClient()
|
832
|
+
result = client.public.time()
|
833
|
+
result = client.private.balance()
|
834
|
+
```
|
835
|
+
|
836
|
+
### Migration from Official SDK
|
837
|
+
|
838
|
+
#### Key Changes
|
839
|
+
|
840
|
+
- **Import**: `from bitvavo_api_upgraded import Bitvavo` (instead of `from python_bitvavo_api.bitvavo import Bitvavo`)
|
841
|
+
- **Breaking**: Trading operations require `operatorId` parameter
|
842
|
+
- **Enhanced**: Better error handling and type safety
|
843
|
+
- **New**: Modern `BitvavoClient` interface available
|
844
|
+
- **New**: Multiple API key support for rate limiting
|
556
845
|
- **New**: Keyless access for public endpoints
|
557
846
|
- **New**: Comprehensive dataframe support
|
558
|
-
-
|
559
|
-
- Better configuration management with `.env` support
|
847
|
+
- **New**: Configuration via `.env` files
|
560
848
|
|
561
|
-
|
849
|
+
#### Migration Steps
|
562
850
|
|
563
|
-
1. Update import statements
|
564
|
-
2. Add `operatorId` to trading method calls
|
565
|
-
3. Optional: Migrate to `.env` configuration
|
566
|
-
4. Optional: Configure multiple API keys for better rate limits
|
567
|
-
5. Optional: Enable keyless mode for public endpoint efficiency
|
568
|
-
6. Enjoy improved type hints and error handling!
|
851
|
+
1. **Update import statements**
|
569
852
|
|
570
|
-
|
853
|
+
```python
|
854
|
+
# Old
|
855
|
+
from python_bitvavo_api.bitvavo import Bitvavo
|
571
856
|
|
572
|
-
|
573
|
-
|
574
|
-
bitvavo = Bitvavo({'APIKEY': 'key', 'APISECRET': 'secret'})
|
857
|
+
# New (legacy interface)
|
858
|
+
from bitvavo_api_upgraded import Bitvavo
|
575
859
|
|
576
|
-
# New
|
577
|
-
|
578
|
-
|
579
|
-
{'key': 'key1', 'secret': 'secret1'},
|
580
|
-
{'key': 'key2', 'secret': 'secret2'}
|
581
|
-
]
|
582
|
-
})
|
860
|
+
# New (modern interface)
|
861
|
+
from bitvavo_client import BitvavoClient
|
862
|
+
```
|
583
863
|
|
584
|
-
|
585
|
-
bitvavo = Bitvavo({'PREFER_KEYLESS': True})
|
864
|
+
2. **Add operatorId to trading operations**
|
586
865
|
|
587
|
-
|
588
|
-
|
589
|
-
|
866
|
+
```python
|
867
|
+
# Add operatorId parameter to placeOrder, cancelOrder, etc.
|
868
|
+
order = bitvavo.placeOrder("BTC-EUR", "buy", "limit", {...}, operatorId=12345)
|
869
|
+
```
|
870
|
+
|
871
|
+
3. **Optional: Migrate to modern interface**
|
872
|
+
|
873
|
+
```python
|
874
|
+
# Legacy style
|
875
|
+
bitvavo = Bitvavo({'APIKEY': 'key', 'APISECRET': 'secret'})
|
876
|
+
|
877
|
+
# Modern style
|
878
|
+
client = BitvavoClient(BitvavoSettings(api_key='key', api_secret='secret'))
|
879
|
+
```
|
880
|
+
|
881
|
+
4. **Optional: Use new features**
|
882
|
+
|
883
|
+
```python
|
884
|
+
# Multi-key support
|
885
|
+
bitvavo = Bitvavo({'APIKEYS': [{'key': 'k1', 'secret': 's1'}, {'key': 'k2', 'secret': 's2'}]})
|
886
|
+
|
887
|
+
# Keyless for public endpoints
|
888
|
+
bitvavo = Bitvavo({'PREFER_KEYLESS': True})
|
889
|
+
|
890
|
+
# DataFrame support
|
891
|
+
markets_df = bitvavo.markets({}, output_format='pandas')
|
892
|
+
```
|
893
|
+
|
894
|
+
### Choosing an Interface
|
895
|
+
|
896
|
+
| Feature | Legacy `Bitvavo` | Modern `BitvavoClient` |
|
897
|
+
| -------------------------- | ---------------------- | -------------------------- |
|
898
|
+
| **Backward compatibility** | ✅ Drop-in replacement | ❌ New interface |
|
899
|
+
| **Type safety** | ✅ Typed responses | ✅ Full generics support |
|
900
|
+
| **Error handling** | ✅ Enhanced errors | ✅ Result types + enhanced |
|
901
|
+
| **Modular design** | ❌ Monolithic | ✅ Separated concerns |
|
902
|
+
| **Testing** | ✅ Testable | ✅ Highly testable |
|
903
|
+
| **DataFrame support** | ✅ Via output_format | ✅ Via model preferences |
|
904
|
+
| **Result types** | ❌ Exceptions only | ✅ Success/Failure pattern |
|
905
|
+
| **WebSocket support** | ✅ Full support | 🚧 Coming soon |
|
906
|
+
|
907
|
+
**Recommendation**:
|
908
|
+
|
909
|
+
- Use **Legacy `Bitvavo`** for quick migrations and WebSocket usage
|
910
|
+
- Use **Modern `BitvavoClient`** for new projects requiring clean architecture
|
590
911
|
|
591
912
|
---
|
592
913
|
|