bitvavo-api-upgraded 1.17.1__tar.gz → 2.0.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-1.17.1 → bitvavo_api_upgraded-2.0.0}/PKG-INFO +276 -51
- {bitvavo_api_upgraded-1.17.1 → bitvavo_api_upgraded-2.0.0}/README.md +265 -40
- {bitvavo_api_upgraded-1.17.1 → bitvavo_api_upgraded-2.0.0}/pyproject.toml +19 -17
- {bitvavo_api_upgraded-1.17.1 → bitvavo_api_upgraded-2.0.0}/src/bitvavo_api_upgraded/bitvavo.py +242 -14
- bitvavo_api_upgraded-1.17.1/.github/README.md +0 -3
- bitvavo_api_upgraded-1.17.1/.github/workflows/release.yml +0 -30
- bitvavo_api_upgraded-1.17.1/.gitignore +0 -28
- bitvavo_api_upgraded-1.17.1/.pre-commit-config.yaml +0 -32
- bitvavo_api_upgraded-1.17.1/.python-version +0 -5
- bitvavo_api_upgraded-1.17.1/.vscode/settings.json +0 -2
- bitvavo_api_upgraded-1.17.1/CHANGELOG.md +0 -488
- bitvavo_api_upgraded-1.17.1/LICENSE.txt +0 -15
- bitvavo_api_upgraded-1.17.1/README.pypi.md +0 -60
- bitvavo_api_upgraded-1.17.1/docs/assets/bitvavo-mark-square-blue.svg +0 -5
- bitvavo_api_upgraded-1.17.1/docs/rest.md +0 -72
- bitvavo_api_upgraded-1.17.1/scripts/bootstrap.sh +0 -17
- bitvavo_api_upgraded-1.17.1/tests/__init__.py +0 -0
- bitvavo_api_upgraded-1.17.1/tests/conftest.py +0 -65
- bitvavo_api_upgraded-1.17.1/tests/test_bitvavo.py +0 -1678
- bitvavo_api_upgraded-1.17.1/tests/test_helper_funcs.py +0 -27
- bitvavo_api_upgraded-1.17.1/tests/test_settings.py +0 -36
- bitvavo_api_upgraded-1.17.1/tox.ini +0 -23
- bitvavo_api_upgraded-1.17.1/uv.lock +0 -1294
- {bitvavo_api_upgraded-1.17.1 → bitvavo_api_upgraded-2.0.0}/src/bitvavo_api_upgraded/__init__.py +0 -0
- {bitvavo_api_upgraded-1.17.1 → bitvavo_api_upgraded-2.0.0}/src/bitvavo_api_upgraded/helper_funcs.py +0 -0
- {bitvavo_api_upgraded-1.17.1 → bitvavo_api_upgraded-2.0.0}/src/bitvavo_api_upgraded/py.typed +0 -0
- {bitvavo_api_upgraded-1.17.1 → bitvavo_api_upgraded-2.0.0}/src/bitvavo_api_upgraded/settings.py +0 -0
- {bitvavo_api_upgraded-1.17.1 → bitvavo_api_upgraded-2.0.0}/src/bitvavo_api_upgraded/type_aliases.py +0 -0
@@ -1,15 +1,10 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.3
|
2
2
|
Name: bitvavo-api-upgraded
|
3
|
-
Version:
|
3
|
+
Version: 2.0.0
|
4
4
|
Summary: A unit-tested fork of the Bitvavo API
|
5
|
-
|
6
|
-
Project-URL: repository, https://github.com/Thaumatorium/bitvavo-api-upgraded
|
7
|
-
Project-URL: changelog, https://github.com/Thaumatorium/bitvavo-api-upgraded/blob/master/CHANGELOG.md
|
8
|
-
Author: Bitvavo BV (original code)
|
5
|
+
Author: Bitvavo BV (original code), NostraDavid
|
9
6
|
Author-email: NostraDavid <55331731+NostraDavid@users.noreply.github.com>
|
10
|
-
Maintainer-email: NostraDavid <55331731+NostraDavid@users.noreply.github.com>
|
11
7
|
License: ISC License
|
12
|
-
License-File: LICENSE.txt
|
13
8
|
Classifier: Development Status :: 5 - Production/Stable
|
14
9
|
Classifier: Environment :: Console
|
15
10
|
Classifier: Framework :: Pytest
|
@@ -20,93 +15,323 @@ Classifier: License :: OSI Approved :: ISC License (ISCL)
|
|
20
15
|
Classifier: Operating System :: MacOS :: MacOS X
|
21
16
|
Classifier: Operating System :: Microsoft :: Windows
|
22
17
|
Classifier: Operating System :: POSIX
|
23
|
-
Classifier: Programming Language :: Python
|
24
18
|
Classifier: Programming Language :: Python :: 3.9
|
25
19
|
Classifier: Programming Language :: Python :: 3.10
|
26
20
|
Classifier: Programming Language :: Python :: 3.11
|
27
21
|
Classifier: Programming Language :: Python :: 3.12
|
28
22
|
Classifier: Programming Language :: Python :: 3.13
|
23
|
+
Classifier: Programming Language :: Python
|
29
24
|
Classifier: Typing :: Typed
|
30
|
-
Requires-Python: >=3.9
|
31
25
|
Requires-Dist: pydantic-settings==2.*,>=2.6
|
32
26
|
Requires-Dist: requests==2.*,>=2.26
|
33
|
-
Requires-Dist: structlog
|
27
|
+
Requires-Dist: structlog>=21.5,==25.*
|
34
28
|
Requires-Dist: websocket-client==1.*,>=1.2
|
29
|
+
Maintainer: NostraDavid
|
30
|
+
Maintainer-email: NostraDavid <55331731+NostraDavid@users.noreply.github.com>
|
31
|
+
Requires-Python: >=3.9
|
32
|
+
Project-URL: changelog, https://github.com/Thaumatorium/bitvavo-api-upgraded/blob/master/CHANGELOG.md
|
33
|
+
Project-URL: homepage, https://github.com/Thaumatorium/bitvavo-api-upgraded
|
34
|
+
Project-URL: repository, https://github.com/Thaumatorium/bitvavo-api-upgraded
|
35
35
|
Description-Content-Type: text/markdown
|
36
36
|
|
37
37
|
# Bitvavo API (upgraded)
|
38
38
|
|
39
|
-
|
39
|
+
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.
|
40
|
+
|
41
|
+
## Quick Start
|
42
|
+
|
43
|
+
```bash
|
44
|
+
pip install bitvavo_api_upgraded
|
45
|
+
```
|
46
|
+
|
47
|
+
Scroll down for detailed usage examples and configuration instructions.
|
48
|
+
|
49
|
+
## What Makes This "Upgraded"?
|
50
|
+
|
51
|
+
This wrapper improves upon the official Bitvavo SDK with:
|
52
|
+
|
53
|
+
- 🎯 **Complete type annotations** for all functions and classes
|
54
|
+
- 🧪 **Comprehensive test suite** (found and fixed multiple bugs in the original)
|
55
|
+
- 📋 **Detailed changelog** tracking all changes and improvements
|
56
|
+
- 🔄 **Up-to-date API compliance** including MiCA regulatory requirements
|
57
|
+
- 📚 **Enhanced documentation** with examples and clear usage patterns
|
58
|
+
- 🐍 **Modern Python support** (3.9+, dropped EOL versions)
|
59
|
+
- ⚡ **Better error handling** and rate limiting
|
60
|
+
- 🔧 **Developer-friendly tooling** (ruff, mypy, pre-commit hooks)
|
61
|
+
|
62
|
+
## Features
|
40
63
|
|
41
|
-
|
64
|
+
### Full API Coverage
|
42
65
|
|
43
|
-
|
66
|
+
- ✅ All REST endpoints (public and private)
|
67
|
+
- ✅ WebSocket support with reconnection logic
|
68
|
+
- ✅ Rate limiting with automatic throttling
|
69
|
+
- ✅ MiCA compliance reporting endpoints
|
44
70
|
|
45
|
-
|
46
|
-
- unit tests (I already found three bugs that I fixed, because the original code
|
47
|
-
wasn't tested, at all)
|
48
|
-
- a changelog, so you can track of the changes that I make
|
49
|
-
- compatible with Python 3.7 and newer ([3.6 isn't supported as of
|
50
|
-
2021-12-23](https://endoflife.date/python))
|
71
|
+
### Developer Experience
|
51
72
|
|
52
|
-
|
73
|
+
- ✅ Type hints for better IDE support
|
74
|
+
- ✅ Comprehensive error handling
|
75
|
+
- ✅ Detailed logging with `structlog`
|
76
|
+
- ✅ Configuration via `.env` files
|
77
|
+
- ✅ Extensive test coverage
|
78
|
+
|
79
|
+
### Production Ready
|
80
|
+
|
81
|
+
- ✅ Automatic rate limit management
|
82
|
+
- ✅ Connection retry logic
|
83
|
+
- ✅ Proper error responses
|
84
|
+
- ✅ Memory efficient WebSocket handling
|
85
|
+
|
86
|
+
## Configuration
|
87
|
+
|
88
|
+
Create a `.env` file in your project root:
|
89
|
+
|
90
|
+
```env
|
91
|
+
BITVAVO_APIKEY=your-api-key-here
|
92
|
+
BITVAVO_APISECRET=your-api-secret-here
|
93
|
+
```
|
94
|
+
|
95
|
+
Then use the settings:
|
96
|
+
|
97
|
+
```python
|
98
|
+
from bitvavo_api_upgraded import Bitvavo, BitvavoSettings
|
99
|
+
|
100
|
+
# Option 1: Manual configuration
|
101
|
+
bitvavo = Bitvavo({
|
102
|
+
'APIKEY': 'your-key',
|
103
|
+
'APISECRET': 'your-secret'
|
104
|
+
})
|
105
|
+
|
106
|
+
# Option 2: Auto-load from .env
|
107
|
+
settings = BitvavoSettings()
|
108
|
+
bitvavo = Bitvavo(settings.model_dump())
|
109
|
+
```
|
110
|
+
|
111
|
+
## WebSocket Usage
|
112
|
+
|
113
|
+
```python
|
114
|
+
from bitvavo_api_upgraded import Bitvavo
|
115
|
+
|
116
|
+
def handle_ticker(data):
|
117
|
+
print(f"Ticker update: {data}")
|
118
|
+
|
119
|
+
def handle_error(error):
|
120
|
+
print(f"Error: {error}")
|
121
|
+
|
122
|
+
# Initialize WebSocket
|
123
|
+
bitvavo = Bitvavo({'APIKEY': 'key', 'APISECRET': 'secret'})
|
124
|
+
ws = bitvavo.newWebsocket()
|
125
|
+
ws.setErrorCallback(handle_error)
|
126
|
+
|
127
|
+
# Subscribe to ticker updates
|
128
|
+
ws.subscriptionTicker("BTC-EUR", handle_ticker)
|
129
|
+
|
130
|
+
# Keep connection alive
|
131
|
+
try:
|
132
|
+
while True:
|
133
|
+
time.sleep(1)
|
134
|
+
except KeyboardInterrupt:
|
135
|
+
ws.closeSocket()
|
136
|
+
```
|
137
|
+
|
138
|
+
## API Examples
|
139
|
+
|
140
|
+
### Public Endpoints (No Authentication)
|
141
|
+
|
142
|
+
```python
|
143
|
+
# Get server time
|
144
|
+
time_resp = bitvavo.time()
|
145
|
+
|
146
|
+
# Get all markets
|
147
|
+
markets = bitvavo.markets({})
|
148
|
+
|
149
|
+
# Get specific market
|
150
|
+
btc_market = bitvavo.markets({'market': 'BTC-EUR'})
|
151
|
+
|
152
|
+
# Get order book
|
153
|
+
book = bitvavo.book('BTC-EUR', {})
|
154
|
+
|
155
|
+
# Get recent trades
|
156
|
+
trades = bitvavo.publicTrades('BTC-EUR', {})
|
157
|
+
|
158
|
+
# Get 24h ticker
|
159
|
+
ticker = bitvavo.ticker24h({'market': 'BTC-EUR'})
|
160
|
+
```
|
161
|
+
|
162
|
+
### Private Endpoints (Authentication Required)
|
163
|
+
|
164
|
+
```python
|
165
|
+
# Get account info
|
166
|
+
account = bitvavo.account()
|
167
|
+
|
168
|
+
# Get balance
|
169
|
+
balance = bitvavo.balance({})
|
170
|
+
|
171
|
+
# Place order (requires operatorId for MiCA compliance)
|
172
|
+
order = bitvavo.placeOrder(
|
173
|
+
market="BTC-EUR",
|
174
|
+
side="buy",
|
175
|
+
orderType="limit",
|
176
|
+
body={"amount": "0.01", "price": "45000"},
|
177
|
+
operatorId=12345
|
178
|
+
)
|
179
|
+
|
180
|
+
# Get order history
|
181
|
+
orders = bitvavo.getOrders('BTC-EUR', {})
|
182
|
+
|
183
|
+
# Cancel order
|
184
|
+
cancel_result = bitvavo.cancelOrder(
|
185
|
+
market="BTC-EUR",
|
186
|
+
orderId="order-id-here",
|
187
|
+
operatorId=12345
|
188
|
+
)
|
189
|
+
```
|
190
|
+
|
191
|
+
### MiCA Compliance Features
|
192
|
+
|
193
|
+
```python
|
194
|
+
# Generate trade report
|
195
|
+
trade_report = bitvavo.reportTrades(
|
196
|
+
market="BTC-EUR",
|
197
|
+
options={
|
198
|
+
"startDate": "2025-01-01T00:00:00.000Z",
|
199
|
+
"endDate": "2025-01-31T23:59:59.999Z"
|
200
|
+
}
|
201
|
+
)
|
202
|
+
|
203
|
+
# Generate order book report
|
204
|
+
book_report = bitvavo.reportBook(
|
205
|
+
market="BTC-EUR",
|
206
|
+
options={
|
207
|
+
"startDate": "2025-01-01T00:00:00.000Z",
|
208
|
+
"endDate": "2025-01-31T23:59:59.999Z"
|
209
|
+
}
|
210
|
+
)
|
211
|
+
|
212
|
+
# Get account history
|
213
|
+
history = bitvavo.accountHistory(options={})
|
214
|
+
```
|
215
|
+
|
216
|
+
## Error Handling
|
217
|
+
|
218
|
+
```python
|
219
|
+
from bitvavo_api_upgraded import Bitvavo
|
220
|
+
|
221
|
+
bitvavo = Bitvavo({'APIKEY': 'key', 'APISECRET': 'secret'})
|
222
|
+
|
223
|
+
response = bitvavo.placeOrder(
|
224
|
+
market="BTC-EUR",
|
225
|
+
side="buy",
|
226
|
+
orderType="limit",
|
227
|
+
body={"amount": "0.01", "price": "45000"},
|
228
|
+
operatorId=12345
|
229
|
+
)
|
230
|
+
|
231
|
+
# Check for errors
|
232
|
+
if isinstance(response, dict) and 'errorCode' in response:
|
233
|
+
print(f"Error {response['errorCode']}: {response['error']}")
|
234
|
+
else:
|
235
|
+
print(f"Order placed successfully: {response['orderId']}")
|
236
|
+
```
|
237
|
+
|
238
|
+
## Rate Limiting
|
239
|
+
|
240
|
+
```python
|
241
|
+
# Check remaining rate limit
|
242
|
+
remaining = bitvavo.getRemainingLimit()
|
243
|
+
print(f"Remaining API calls: {remaining}")
|
244
|
+
|
245
|
+
# The library automatically handles rate limiting
|
246
|
+
# But you can check limits before making calls
|
247
|
+
if remaining > 10:
|
248
|
+
# Safe to make API calls
|
249
|
+
response = bitvavo.balance({})
|
250
|
+
```
|
251
|
+
|
252
|
+
## Development & Contributing
|
53
253
|
|
54
254
|
```shell
|
55
255
|
echo "install development requirements"
|
56
256
|
uv sync
|
57
257
|
echo "run tox, a program that creates separate environments for different python versions, for testing purposes (among other things)"
|
58
258
|
uv run tox
|
59
|
-
|
60
|
-
|
61
|
-
### Semantic Versioning (SemVer)
|
259
|
+
## Development & Contributing
|
62
260
|
|
63
|
-
|
261
|
+
### Setup Development Environment
|
64
262
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
1. PATCH version when you make backwards compatible bug fixes.
|
263
|
+
```shell
|
264
|
+
# Install uv (modern Python package manager)
|
265
|
+
curl -LsSf https://astral.sh/uv/install.sh | sh
|
69
266
|
|
70
|
-
|
267
|
+
# Clone and setup
|
268
|
+
git clone https://github.com/Thaumatorium/bitvavo-api-upgraded.git
|
269
|
+
cd bitvavo-api-upgraded
|
71
270
|
|
72
|
-
|
73
|
-
|
271
|
+
# Install dependencies
|
272
|
+
uv sync
|
74
273
|
|
75
|
-
|
76
|
-
|
274
|
+
# Run tests across Python versions
|
275
|
+
uv run tox
|
77
276
|
|
78
|
-
|
277
|
+
# Run tests for current Python version
|
278
|
+
uv run pytest
|
79
279
|
|
80
|
-
|
280
|
+
# Type checking
|
281
|
+
uv run mypy src/
|
81
282
|
|
82
|
-
|
283
|
+
# Linting and formatting
|
284
|
+
uv run ruff check
|
285
|
+
uv run ruff format
|
286
|
+
```
|
83
287
|
|
84
|
-
|
288
|
+
### Project Structure
|
85
289
|
|
86
|
-
|
290
|
+
```text
|
291
|
+
src/bitvavo_api_upgraded/ # Source code
|
292
|
+
├── __init__.py # Main exports
|
293
|
+
├── bitvavo.py # Core API class
|
294
|
+
├── settings.py # Pydantic settings
|
295
|
+
├── helper_funcs.py # Utility functions
|
296
|
+
└── type_aliases.py # Type definitions
|
87
297
|
|
88
|
-
|
298
|
+
tests/ # Comprehensive test suite
|
299
|
+
docs/ # Documentation
|
89
300
|
```
|
90
301
|
|
91
|
-
|
302
|
+
### Semantic Versioning
|
303
|
+
|
304
|
+
This project follows [semantic versioning](https://semver.org/):
|
92
305
|
|
93
|
-
|
94
|
-
|
95
|
-
|
306
|
+
1. **MAJOR** version for incompatible API changes
|
307
|
+
2. **MINOR** version for backwards-compatible functionality additions
|
308
|
+
3. **PATCH** version for backwards-compatible bug fixes
|
96
309
|
|
97
|
-
##
|
310
|
+
## Type Annotations
|
98
311
|
|
99
|
-
|
100
|
-
typed: [Don't forget `py.typed` for your typed Python package
|
101
|
-
](https://blog.whtsky.me/tech/2021/dont-forget-py.typed-for-your-typed-python-package/)
|
312
|
+
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/)
|
102
313
|
|
103
|
-
##
|
314
|
+
## Migration from Official SDK
|
104
315
|
|
105
|
-
|
316
|
+
### Key Differences
|
317
|
+
|
318
|
+
- Import: `from bitvavo_api_upgraded import Bitvavo` (instead of `from python_bitvavo_api.bitvavo import Bitvavo`)
|
319
|
+
- **Breaking Change**: Trading operations require `operatorId` parameter
|
320
|
+
- Enhanced error handling and type safety
|
321
|
+
- Better configuration management with `.env` support
|
322
|
+
|
323
|
+
### Migration Steps
|
324
|
+
|
325
|
+
1. Update import statements
|
326
|
+
2. Add `operatorId` to trading method calls
|
327
|
+
3. Optional: Migrate to `.env` configuration
|
328
|
+
4. Enjoy improved type hints and error handling!
|
106
329
|
|
107
330
|
---
|
108
331
|
|
109
|
-
|
332
|
+
## Original Bitvavo SDK Documentation
|
333
|
+
|
334
|
+
The following is preserved from the original Bitvavo SDK for reference.
|
110
335
|
|
111
336
|
Crypto starts with Bitvavo. You use Bitvavo SDK for Python to buy, sell, and
|
112
337
|
store over 200 digital assets on Bitvavo from inside your app.
|