bitvavo-api-upgraded 1.15.8__py3-none-any.whl → 1.16.0__py3-none-any.whl
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/bitvavo.py +207 -166
- bitvavo_api_upgraded/helper_funcs.py +10 -4
- bitvavo_api_upgraded/py.typed +0 -0
- bitvavo_api_upgraded/settings.py +8 -4
- bitvavo_api_upgraded/type_aliases.py +8 -7
- bitvavo_api_upgraded-1.16.0.dist-info/METADATA +2429 -0
- bitvavo_api_upgraded-1.16.0.dist-info/RECORD +10 -0
- {bitvavo_api_upgraded-1.15.8.dist-info → bitvavo_api_upgraded-1.16.0.dist-info}/WHEEL +1 -2
- bitvavo_api_upgraded-1.15.8.dist-info/METADATA +0 -77
- bitvavo_api_upgraded-1.15.8.dist-info/RECORD +0 -10
- bitvavo_api_upgraded-1.15.8.dist-info/top_level.txt +0 -1
- {bitvavo_api_upgraded-1.15.8.dist-info → bitvavo_api_upgraded-1.16.0.dist-info/licenses}/LICENSE.txt +0 -0
@@ -0,0 +1,2429 @@
|
|
1
|
+
Metadata-Version: 2.3
|
2
|
+
Name: bitvavo-api-upgraded
|
3
|
+
Version: 1.16.0
|
4
|
+
Summary: A unit-tested fork of the Bitvavo API
|
5
|
+
Project-URL: homepage, https://github.com/Thaumatorium/bitvavo-api-upgraded
|
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)
|
9
|
+
Author-email: NostraDavid <55331731+NostraDavid@users.noreply.github.com>
|
10
|
+
Maintainer-email: NostraDavid <55331731+NostraDavid@users.noreply.github.com>
|
11
|
+
License: ISC License
|
12
|
+
Classifier: Development Status :: 5 - Production/Stable
|
13
|
+
Classifier: Environment :: Console
|
14
|
+
Classifier: Framework :: Pytest
|
15
|
+
Classifier: Framework :: tox
|
16
|
+
Classifier: Intended Audience :: Developers
|
17
|
+
Classifier: Intended Audience :: Financial and Insurance Industry
|
18
|
+
Classifier: License :: OSI Approved :: ISC License (ISCL)
|
19
|
+
Classifier: Operating System :: MacOS :: MacOS X
|
20
|
+
Classifier: Operating System :: Microsoft :: Windows
|
21
|
+
Classifier: Operating System :: POSIX
|
22
|
+
Classifier: Programming Language :: Python
|
23
|
+
Classifier: Programming Language :: Python :: 3.9
|
24
|
+
Classifier: Programming Language :: Python :: 3.10
|
25
|
+
Classifier: Programming Language :: Python :: 3.11
|
26
|
+
Classifier: Programming Language :: Python :: 3.12
|
27
|
+
Classifier: Programming Language :: Python :: 3.13
|
28
|
+
Classifier: Typing :: Typed
|
29
|
+
Requires-Python: >=3.9
|
30
|
+
Requires-Dist: python-decouple==3.*,>=3.5
|
31
|
+
Requires-Dist: requests==2.*,>=2.26
|
32
|
+
Requires-Dist: structlog==24.*,>=21.5
|
33
|
+
Requires-Dist: websocket-client==1.*,>=1.2
|
34
|
+
Description-Content-Type: text/markdown
|
35
|
+
|
36
|
+
# Bitvavo API (upgraded)
|
37
|
+
|
38
|
+
## Userguide
|
39
|
+
|
40
|
+
`pip install bitvavo_api_upgraded`
|
41
|
+
|
42
|
+
Works the same as the official API lib, but I have:
|
43
|
+
|
44
|
+
- typing for _all_ functions and classes
|
45
|
+
- unit tests (I already found three bugs that I fixed, because the original code
|
46
|
+
wasn't tested, at all)
|
47
|
+
- a changelog, so you can track of the changes that I make
|
48
|
+
- compatible with Python 3.7 and newer ([3.6 isn't supported as of
|
49
|
+
2021-12-23](https://endoflife.date/python))
|
50
|
+
|
51
|
+
## Devguide
|
52
|
+
|
53
|
+
```shell
|
54
|
+
echo "install development requirements"
|
55
|
+
pip install -r requirements/dev.txt
|
56
|
+
echo "install lib as editable code (changes are directly propogated)"
|
57
|
+
pip install -e .
|
58
|
+
echo "run tox, a program that creates separate environments for different python versions, for testing purposes (among other things)"
|
59
|
+
tox
|
60
|
+
```
|
61
|
+
|
62
|
+
### Semantic Versioning (SemVer)
|
63
|
+
|
64
|
+
I'm using semantic versioning, which means that changes mean this:
|
65
|
+
|
66
|
+
1. MAJOR version when you make incompatible API changes,
|
67
|
+
1. MINOR version when you add functionality in a backwards compatible manner,
|
68
|
+
and
|
69
|
+
1. PATCH version when you make backwards compatible bug fixes.
|
70
|
+
|
71
|
+
### Versioning
|
72
|
+
|
73
|
+
Copy the following block to CHANGELOG.md and add all information since last
|
74
|
+
version bump
|
75
|
+
|
76
|
+
```markdown
|
77
|
+
## $UNRELEASED
|
78
|
+
|
79
|
+
### Added
|
80
|
+
|
81
|
+
...
|
82
|
+
|
83
|
+
### Changed
|
84
|
+
|
85
|
+
...
|
86
|
+
|
87
|
+
### Removed
|
88
|
+
|
89
|
+
...
|
90
|
+
```
|
91
|
+
|
92
|
+
Commit those changes.
|
93
|
+
|
94
|
+
After that, run `bump-my-version bump (major|minor|patch)` to automatically
|
95
|
+
replace `$UNRELEASED` with the new version number, and also automatically tag
|
96
|
+
and commit (with tag) to release a new version via the Github workflow.
|
97
|
+
|
98
|
+
## py.typed
|
99
|
+
|
100
|
+
Perhaps a curious file, but it simply exists to let `mypy` know that the code is
|
101
|
+
typed: [Don't forget `py.typed` for your typed Python package
|
102
|
+
](https://blog.whtsky.me/tech/2021/dont-forget-py.typed-for-your-typed-python-package/)
|
103
|
+
|
104
|
+
## Last note
|
105
|
+
|
106
|
+
_below this line is the old README.md_
|
107
|
+
|
108
|
+
---
|
109
|
+
|
110
|
+
<p align="center">
|
111
|
+
<br>
|
112
|
+
<a href="https://bitvavo.com"><img src="https://bitvavo.com/assets/static/ext/logo-shape.svg" width="100" title="Bitvavo Logo"></a>
|
113
|
+
</p>
|
114
|
+
|
115
|
+
# Python Bitvavo Api
|
116
|
+
|
117
|
+
This is the python wrapper for the Bitvavo API. This project can be used to
|
118
|
+
build your own projects which interact with the Bitvavo platform. Every function
|
119
|
+
available on the API can be called through a REST request or over websockets.
|
120
|
+
For info on the specifics of every parameter consult the [Bitvavo API
|
121
|
+
documentation](https://docs.bitvavo.com/)
|
122
|
+
|
123
|
+
- Getting started
|
124
|
+
[REST](https://github.com/bitvavo/python-bitvavo-api#getting-started)
|
125
|
+
[Websocket](https://github.com/bitvavo/python-bitvavo-api#getting-started-1)
|
126
|
+
- General
|
127
|
+
- Time [REST](https://github.com/bitvavo/python-bitvavo-api#get-time)
|
128
|
+
[Websocket](https://github.com/bitvavo/python-bitvavo-api#get-time-1)
|
129
|
+
- Markets [REST](https://github.com/bitvavo/python-bitvavo-api#get-markets)
|
130
|
+
[Websocket](https://github.com/bitvavo/python-bitvavo-api#get-markets-1)
|
131
|
+
- Assets [REST](https://github.com/bitvavo/python-bitvavo-api#get-assets)
|
132
|
+
[Websocket](https://github.com/bitvavo/python-bitvavo-api#get-assets-1)
|
133
|
+
- Market Data
|
134
|
+
- Book
|
135
|
+
[REST](https://github.com/bitvavo/python-bitvavo-api#get-book-per-market)
|
136
|
+
[Websocket](https://github.com/bitvavo/python-bitvavo-api#get-book-per-market-1)
|
137
|
+
- Public Trades
|
138
|
+
[REST](https://github.com/bitvavo/python-bitvavo-api#get-trades-per-market)
|
139
|
+
[Websocket](https://github.com/bitvavo/python-bitvavo-api#get-trades-per-market-1)
|
140
|
+
- Candles
|
141
|
+
[REST](https://github.com/bitvavo/python-bitvavo-api#get-candles-per-market)
|
142
|
+
[Websocket](https://github.com/bitvavo/python-bitvavo-api#get-candles-per-market-1)
|
143
|
+
- Price Ticker
|
144
|
+
[REST](https://github.com/bitvavo/python-bitvavo-api#get-price-ticker)
|
145
|
+
[Websocket](https://github.com/bitvavo/python-bitvavo-api#get-price-ticker-1)
|
146
|
+
- Book Ticker
|
147
|
+
[REST](https://github.com/bitvavo/python-bitvavo-api#get-book-ticker)
|
148
|
+
[Websocket](https://github.com/bitvavo/python-bitvavo-api#get-book-ticker-1)
|
149
|
+
- 24 Hour Ticker
|
150
|
+
[REST](https://github.com/bitvavo/python-bitvavo-api#get-24-hour-ticker)
|
151
|
+
[Websocket](https://github.com/bitvavo/python-bitvavo-api#get-24-hour-ticker-1)
|
152
|
+
- Private
|
153
|
+
- Place Order
|
154
|
+
[REST](https://github.com/bitvavo/python-bitvavo-api#place-order)
|
155
|
+
[Websocket](https://github.com/bitvavo/python-bitvavo-api#place-order-1)
|
156
|
+
- Update Order
|
157
|
+
[REST](https://github.com/bitvavo/python-bitvavo-api#update-order)
|
158
|
+
[Websocket](https://github.com/bitvavo/python-bitvavo-api#update-order-1)
|
159
|
+
- Get Order [REST](https://github.com/bitvavo/python-bitvavo-api#get-order)
|
160
|
+
[Websocket](https://github.com/bitvavo/python-bitvavo-api#get-order-1)
|
161
|
+
- Cancel Order
|
162
|
+
[REST](https://github.com/bitvavo/python-bitvavo-api#cancel-order)
|
163
|
+
[Websocket](https://github.com/bitvavo/python-bitvavo-api#cancel-order-1)
|
164
|
+
- Get Orders [REST](https://github.com/bitvavo/python-bitvavo-api#get-orders)
|
165
|
+
[Websocket](https://github.com/bitvavo/python-bitvavo-api#get-orders-1)
|
166
|
+
- Cancel Orders
|
167
|
+
[REST](https://github.com/bitvavo/python-bitvavo-api#cancel-orders)
|
168
|
+
[Websocket](https://github.com/bitvavo/python-bitvavo-api#cancel-orders-1)
|
169
|
+
- Orders Open
|
170
|
+
[REST](https://github.com/bitvavo/python-bitvavo-api#get-orders-open)
|
171
|
+
[Websocket](https://github.com/bitvavo/python-bitvavo-api#get-orders-open-1)
|
172
|
+
- Trades [REST](https://github.com/bitvavo/python-bitvavo-api#get-trades)
|
173
|
+
[Websocket](https://github.com/bitvavo/python-bitvavo-api#get-trades-1)
|
174
|
+
- Account [REST](https://github.com/bitvavo/python-bitvavo-api#get-account)
|
175
|
+
[Websocket](https://github.com/bitvavo/python-bitvavo-api#get-account-1)
|
176
|
+
- Balance [REST](https://github.com/bitvavo/python-bitvavo-api#get-balance)
|
177
|
+
[Websocket](https://github.com/bitvavo/python-bitvavo-api#get-balance-1)
|
178
|
+
- Deposit Assets
|
179
|
+
[REST](https://github.com/bitvavo/python-bitvavo-api#deposit-assets)
|
180
|
+
[Websocket](https://github.com/bitvavo/python-bitvavo-api#deposit-assets-1)
|
181
|
+
- Withdraw Assets
|
182
|
+
[REST](https://github.com/bitvavo/python-bitvavo-api#withdraw-assets)
|
183
|
+
[Websocket](https://github.com/bitvavo/python-bitvavo-api#withdraw-assets-1)
|
184
|
+
- Deposit History
|
185
|
+
[REST](https://github.com/bitvavo/python-bitvavo-api#get-deposit-history)
|
186
|
+
[Websocket](https://github.com/bitvavo/python-bitvavo-api#get-deposit-history-1)
|
187
|
+
- Withdrawal History
|
188
|
+
[REST](https://github.com/bitvavo/python-bitvavo-api#get-withdrawal-history)
|
189
|
+
[Websocket](https://github.com/bitvavo/python-bitvavo-api#get-withdrawal-history-1)
|
190
|
+
- [Subscriptions](https://github.com/bitvavo/python-bitvavo-api#subscriptions)
|
191
|
+
- [Ticker
|
192
|
+
Subscription](https://github.com/bitvavo/python-bitvavo-api#ticker-subscription)
|
193
|
+
- [Ticker 24 Hour
|
194
|
+
Subscription](https://github.com/bitvavo/python-bitvavo-api#ticker-24-hour-subscription)
|
195
|
+
- [Account
|
196
|
+
Subscription](https://github.com/bitvavo/python-bitvavo-api#account-subscription)
|
197
|
+
- [Candles
|
198
|
+
Subscription](https://github.com/bitvavo/python-bitvavo-api#candles-subscription)
|
199
|
+
- [Trades
|
200
|
+
Subscription](https://github.com/bitvavo/python-bitvavo-api#trades-subscription)
|
201
|
+
- [Book
|
202
|
+
Subscription](https://github.com/bitvavo/python-bitvavo-api#book-subscription)
|
203
|
+
- [Book subscription with local
|
204
|
+
copy](https://github.com/bitvavo/python-bitvavo-api#book-subscription-with-local-copy)
|
205
|
+
|
206
|
+
## Installation
|
207
|
+
|
208
|
+
```
|
209
|
+
pip install python-bitvavo-api
|
210
|
+
```
|
211
|
+
|
212
|
+
## Rate Limiting
|
213
|
+
|
214
|
+
Bitvavo uses a weight based rate limiting system, with an allowed limit of 1000
|
215
|
+
per IP or API key each minute. Please inspect each endpoint in the [Bitvavo API
|
216
|
+
documentation](https://docs.bitvavo.com/) to see the weight. Failure to respect
|
217
|
+
the rate limit will result in an IP or API key ban. Since the remaining limit is
|
218
|
+
returned in the header on each REST request, the remaining limit is tracked
|
219
|
+
locally and can be requested through:
|
220
|
+
|
221
|
+
```
|
222
|
+
limit = bitvavo.getRemainingLimit()
|
223
|
+
```
|
224
|
+
|
225
|
+
The websocket functions however do not return a remaining limit, therefore the
|
226
|
+
limit is only updated locally once a ban has been issued.
|
227
|
+
|
228
|
+
## REST requests
|
229
|
+
|
230
|
+
The general convention used in all functions (both REST and websockets), is that
|
231
|
+
all optional parameters are passed as an dictionary, while required parameters
|
232
|
+
are passed as separate values. Only when [placing
|
233
|
+
orders](https://github.com/bitvavo/python-bitvavo-api#place-order) some of the
|
234
|
+
optional parameters are required, since a limit order requires more information
|
235
|
+
than a market order. The returned responses are all converted to a dictionary as
|
236
|
+
well, such that `response['<key>'] = '<value>'`.
|
237
|
+
|
238
|
+
### Getting started
|
239
|
+
|
240
|
+
The API key and secret are required for private calls and optional for public
|
241
|
+
calls. The access window and debugging parameter are optional for all calls. The
|
242
|
+
access window is used to determine whether the request arrived within time, the
|
243
|
+
value is specified in milliseconds. You can use the
|
244
|
+
[time](https://github.com/bitvavo/python-bitvavo-api#get-time) function to
|
245
|
+
synchronize your time to our server time if errors arise. REST url and WS url
|
246
|
+
can be used to set a different endpoint (for testing purposes). Debugging should
|
247
|
+
be set to true when you want to log additional information and full responses.
|
248
|
+
Any parameter can be omitted, private functions will return an error when the
|
249
|
+
api key and secret have not been set.
|
250
|
+
|
251
|
+
```python
|
252
|
+
from bitvavo_api_upgraded.bitvavo import Bitvavo
|
253
|
+
|
254
|
+
bitvavo = Bitvavo(
|
255
|
+
{
|
256
|
+
"APIKEY": "<APIKEY>",
|
257
|
+
"APISECRET": "<APISECRET>",
|
258
|
+
"RESTURL": "https://api.bitvavo.com/v2",
|
259
|
+
"WSURL": "wss://ws.bitvavo.com/v2/",
|
260
|
+
"ACCESSWINDOW": 10000,
|
261
|
+
"DEBUGGING": False,
|
262
|
+
}
|
263
|
+
)
|
264
|
+
```
|
265
|
+
|
266
|
+
### General
|
267
|
+
|
268
|
+
#### Get time
|
269
|
+
|
270
|
+
```python
|
271
|
+
response = bitvavo.time()
|
272
|
+
print(response)
|
273
|
+
```
|
274
|
+
|
275
|
+
<details>
|
276
|
+
<summary>View Response</summary>
|
277
|
+
|
278
|
+
```python
|
279
|
+
{"time": 1543397021396}
|
280
|
+
```
|
281
|
+
|
282
|
+
</details>
|
283
|
+
|
284
|
+
#### Get markets
|
285
|
+
|
286
|
+
```python
|
287
|
+
# options: market
|
288
|
+
response = bitvavo.markets({})
|
289
|
+
print(response)
|
290
|
+
```
|
291
|
+
|
292
|
+
<details>
|
293
|
+
<summary>View Response</summary>
|
294
|
+
|
295
|
+
```python
|
296
|
+
{
|
297
|
+
"market": "ADA-BTC",
|
298
|
+
"status": "trading",
|
299
|
+
"base": "ADA",
|
300
|
+
"quote": "BTC",
|
301
|
+
"pricePrecision": 5,
|
302
|
+
"minOrderInBaseAsset": "100",
|
303
|
+
"minOrderInQuoteAsset": "0.001",
|
304
|
+
"orderTypes": ["market", "limit"],
|
305
|
+
}
|
306
|
+
{
|
307
|
+
"market": "ADA-EUR",
|
308
|
+
"status": "trading",
|
309
|
+
"base": "ADA",
|
310
|
+
"quote": "EUR",
|
311
|
+
"pricePrecision": 5,
|
312
|
+
"minOrderInBaseAsset": "100",
|
313
|
+
"minOrderInQuoteAsset": "10",
|
314
|
+
"orderTypes": ["market", "limit"],
|
315
|
+
}
|
316
|
+
{
|
317
|
+
"market": "AE-BTC",
|
318
|
+
"status": "trading",
|
319
|
+
"base": "AE",
|
320
|
+
"quote": "BTC",
|
321
|
+
"pricePrecision": 5,
|
322
|
+
"minOrderInBaseAsset": "10",
|
323
|
+
"minOrderInQuoteAsset": "0.001",
|
324
|
+
"orderTypes": ["market", "limit"],
|
325
|
+
}
|
326
|
+
{
|
327
|
+
"market": "AE-EUR",
|
328
|
+
"status": "trading",
|
329
|
+
"base": "AE",
|
330
|
+
"quote": "EUR",
|
331
|
+
"pricePrecision": 5,
|
332
|
+
"minOrderInBaseAsset": "10",
|
333
|
+
"minOrderInQuoteAsset": "10",
|
334
|
+
"orderTypes": ["market", "limit"],
|
335
|
+
}
|
336
|
+
...
|
337
|
+
```
|
338
|
+
|
339
|
+
</details>
|
340
|
+
|
341
|
+
#### Get assets
|
342
|
+
|
343
|
+
```python
|
344
|
+
# options: symbol
|
345
|
+
response = bitvavo.assets({})
|
346
|
+
print(response)
|
347
|
+
```
|
348
|
+
|
349
|
+
<details>
|
350
|
+
<summary>View Response</summary>
|
351
|
+
|
352
|
+
```python
|
353
|
+
[
|
354
|
+
{
|
355
|
+
"symbol": "ADA",
|
356
|
+
"name": "Cardano",
|
357
|
+
"decimals": 6,
|
358
|
+
"depositFee": "0",
|
359
|
+
"depositConfirmations": 20,
|
360
|
+
"depositStatus": "OK",
|
361
|
+
"withdrawalFee": "0.2",
|
362
|
+
"withdrawalMinAmount": "0.2",
|
363
|
+
"withdrawalStatus": "OK",
|
364
|
+
"networks": ["Mainnet"],
|
365
|
+
"message": "",
|
366
|
+
},
|
367
|
+
{
|
368
|
+
"symbol": "AE",
|
369
|
+
"name": "Aeternity",
|
370
|
+
"decimals": 8,
|
371
|
+
"depositFee": "0",
|
372
|
+
"depositConfirmations": 30,
|
373
|
+
"depositStatus": "OK",
|
374
|
+
"withdrawalFee": "2",
|
375
|
+
"withdrawalMinAmount": "2",
|
376
|
+
"withdrawalStatus": "OK",
|
377
|
+
"networks": ["Mainnet"],
|
378
|
+
"message": "",
|
379
|
+
},
|
380
|
+
{
|
381
|
+
"symbol": "AION",
|
382
|
+
"name": "Aion",
|
383
|
+
"decimals": 8,
|
384
|
+
"depositFee": "0",
|
385
|
+
"depositConfirmations": 0,
|
386
|
+
"depositStatus": "",
|
387
|
+
"withdrawalFee": "3",
|
388
|
+
"withdrawalMinAmount": "3",
|
389
|
+
"withdrawalStatus": "",
|
390
|
+
"networks": ["Mainnet"],
|
391
|
+
"message": "",
|
392
|
+
},
|
393
|
+
{
|
394
|
+
"symbol": "ANT",
|
395
|
+
"name": "Aragon",
|
396
|
+
"decimals": 8,
|
397
|
+
"depositFee": "0",
|
398
|
+
"depositConfirmations": 30,
|
399
|
+
"depositStatus": "OK",
|
400
|
+
"withdrawalFee": "2",
|
401
|
+
"withdrawalMinAmount": "2",
|
402
|
+
"withdrawalStatus": "OK",
|
403
|
+
"networks": ["Mainnet"],
|
404
|
+
"message": "",
|
405
|
+
},
|
406
|
+
...,
|
407
|
+
]
|
408
|
+
```
|
409
|
+
|
410
|
+
</details>
|
411
|
+
|
412
|
+
### Market Data
|
413
|
+
|
414
|
+
#### Get book per market
|
415
|
+
|
416
|
+
```python
|
417
|
+
# options: depth
|
418
|
+
response = bitvavo.book("BTC-EUR", {})
|
419
|
+
print(response)
|
420
|
+
```
|
421
|
+
|
422
|
+
<details>
|
423
|
+
<summary>View Response</summary>
|
424
|
+
|
425
|
+
```python
|
426
|
+
{
|
427
|
+
"market": "BTC-EUR",
|
428
|
+
"nonce": 26393,
|
429
|
+
"bids": [
|
430
|
+
["3008.8", "1.47148675"],
|
431
|
+
["3008.3", "1.10515032"],
|
432
|
+
["3007.7", "1.38627613"],
|
433
|
+
["3007.2", "0.72343843"],
|
434
|
+
["3006.7", "0.96668815"],
|
435
|
+
["3006.2", "3.50846635"],
|
436
|
+
...,
|
437
|
+
],
|
438
|
+
"asks": [
|
439
|
+
["3009.2", "2.74009412"],
|
440
|
+
["3011.3", "3.03788636"],
|
441
|
+
["3013.1", "3.91270989"],
|
442
|
+
["3015.1", "4.33891895"],
|
443
|
+
["3016", "1.34888815"],
|
444
|
+
["3016.5", "1.95726644"],
|
445
|
+
...,
|
446
|
+
],
|
447
|
+
}
|
448
|
+
```
|
449
|
+
|
450
|
+
</details>
|
451
|
+
|
452
|
+
#### Get trades per market
|
453
|
+
|
454
|
+
```python
|
455
|
+
# options: limit, start, end, tradeIdFrom, tradeIdTo
|
456
|
+
response = bitvavo.publicTrades("BTC-EUR", {})
|
457
|
+
print(response)
|
458
|
+
```
|
459
|
+
|
460
|
+
<details>
|
461
|
+
<summary>View Response</summary>
|
462
|
+
|
463
|
+
```python
|
464
|
+
[
|
465
|
+
{
|
466
|
+
"id": "041689b3-cbb6-49ec-9964-2fb2d353dd1b",
|
467
|
+
"timestamp": 1565672192018,
|
468
|
+
"amount": "0.12735922",
|
469
|
+
"price": "10147",
|
470
|
+
"side": "sell"
|
471
|
+
},
|
472
|
+
{
|
473
|
+
"id": "fb1712f2-e183-457c-b9e5-ff0d31fccd1f",
|
474
|
+
"timestamp": 1565672192014,
|
475
|
+
"amount": "0.08703703",
|
476
|
+
"price": "10149",
|
477
|
+
"side": "sell"
|
478
|
+
},
|
479
|
+
{
|
480
|
+
"id": "b8cf5e20-65ca-4f45-a94c-44b7cb3952a5",
|
481
|
+
"timestamp": 1565672192009,
|
482
|
+
"amount": "0.0979994",
|
483
|
+
"price": "10151",
|
484
|
+
"side": "sell"
|
485
|
+
},
|
486
|
+
{
|
487
|
+
"id": "d10cc7ec-a735-4d5c-8169-c3099f8b5003",
|
488
|
+
"timestamp": 1565672144747,
|
489
|
+
"amount": "0.01975188",
|
490
|
+
"price": "10151",
|
491
|
+
"side": "sell"
|
492
|
+
}
|
493
|
+
...
|
494
|
+
]
|
495
|
+
```
|
496
|
+
|
497
|
+
</details>
|
498
|
+
|
499
|
+
#### Get candles per market
|
500
|
+
|
501
|
+
```python
|
502
|
+
# options: limit, start, end
|
503
|
+
response = bitvavo.candles("BTC-EUR", "1h", {})
|
504
|
+
print(response)
|
505
|
+
```
|
506
|
+
|
507
|
+
<details>
|
508
|
+
<summary>View Response</summary>
|
509
|
+
|
510
|
+
```python
|
511
|
+
[
|
512
|
+
[1548669600000, "3012.9", "3015.8", "3000", "3012.9", "8"],
|
513
|
+
[1548669600000, "3012.9", "3015.8", "3000", "3012.9", "8"],
|
514
|
+
[1548669600000, "3012.9", "3015.8", "3000", "3012.9", "8"],
|
515
|
+
[1548417600000, "3124", "3125.1", "3124", "3124", "0.1"],
|
516
|
+
[1548237600000, "3143", "3143.3", "3141.1", "3143", "60.67250851"],
|
517
|
+
...,
|
518
|
+
]
|
519
|
+
```
|
520
|
+
|
521
|
+
</details>
|
522
|
+
|
523
|
+
#### Get price ticker
|
524
|
+
|
525
|
+
```python
|
526
|
+
# options: market
|
527
|
+
response = bitvavo.tickerPrice({})
|
528
|
+
print(response)
|
529
|
+
```
|
530
|
+
|
531
|
+
<details>
|
532
|
+
<summary>View Response</summary>
|
533
|
+
|
534
|
+
```python
|
535
|
+
[
|
536
|
+
{"market": "EOS-EUR", "price": "2.0142"},
|
537
|
+
{"market": "XRP-EUR", "price": "0.27848"},
|
538
|
+
{"market": "ETH-EUR", "price": "99.877"},
|
539
|
+
{"market": "IOST-EUR", "price": "0.005941"},
|
540
|
+
{"market": "BCH-EUR", "price": "106.57"},
|
541
|
+
{"market": "BTC-EUR", "price": "3008.9"},
|
542
|
+
{"market": "STORM-EUR", "price": "0.0025672"},
|
543
|
+
{"market": "EOS-BTC", "price": "0.00066289"},
|
544
|
+
...,
|
545
|
+
]
|
546
|
+
```
|
547
|
+
|
548
|
+
</details>
|
549
|
+
|
550
|
+
#### Get book ticker
|
551
|
+
|
552
|
+
```python
|
553
|
+
# options: market
|
554
|
+
response = bitvavo.tickerBook({})
|
555
|
+
print(response)
|
556
|
+
```
|
557
|
+
|
558
|
+
<details>
|
559
|
+
<summary>View Response</summary>
|
560
|
+
|
561
|
+
```python
|
562
|
+
[
|
563
|
+
{
|
564
|
+
"market": "ZIL-BTC",
|
565
|
+
"bid": "0.00000082",
|
566
|
+
"ask": "0.00000083",
|
567
|
+
"bidSize": "13822.00651664",
|
568
|
+
"askSize": "5743.88893286",
|
569
|
+
},
|
570
|
+
{
|
571
|
+
"market": "ZIL-EUR",
|
572
|
+
"bid": "0.0082973",
|
573
|
+
"ask": "0.0084058",
|
574
|
+
"bidSize": "19586.15862762",
|
575
|
+
"askSize": "19048.86640562",
|
576
|
+
},
|
577
|
+
{
|
578
|
+
"market": "ZRX-BTC",
|
579
|
+
"bid": "0.00001625",
|
580
|
+
"ask": "0.00001629",
|
581
|
+
"bidSize": "823.87743487",
|
582
|
+
"askSize": "868.23901671",
|
583
|
+
},
|
584
|
+
{
|
585
|
+
"market": "ZRX-EUR",
|
586
|
+
"bid": "0.16443",
|
587
|
+
"ask": "0.16498",
|
588
|
+
"bidSize": "898.35016343",
|
589
|
+
"askSize": "419.16696625",
|
590
|
+
},
|
591
|
+
...,
|
592
|
+
]
|
593
|
+
```
|
594
|
+
|
595
|
+
</details>
|
596
|
+
|
597
|
+
#### Get 24 hour ticker
|
598
|
+
|
599
|
+
```python
|
600
|
+
# options: market
|
601
|
+
response = bitvavo.ticker24h({})
|
602
|
+
print(response)
|
603
|
+
```
|
604
|
+
|
605
|
+
<details>
|
606
|
+
<summary>View Response</summary>
|
607
|
+
|
608
|
+
```python
|
609
|
+
[
|
610
|
+
{
|
611
|
+
"market": "XVG-EUR",
|
612
|
+
"open": "0.0045692",
|
613
|
+
"high": "0.0045853",
|
614
|
+
"low": "0.0043599",
|
615
|
+
"last": "0.0044047",
|
616
|
+
"volume": "594786.9689017",
|
617
|
+
"volumeQuote": "2648.07",
|
618
|
+
"bid": "0.0043493",
|
619
|
+
"bidSize": "1561220.43836043",
|
620
|
+
"ask": "0.004453",
|
621
|
+
"askSize": "1457312.74672114",
|
622
|
+
"timestamp": 1565684835077,
|
623
|
+
},
|
624
|
+
{
|
625
|
+
"market": "ZIL-EUR",
|
626
|
+
"open": "0.0081178",
|
627
|
+
"high": "0.0084196",
|
628
|
+
"low": "0.0077389",
|
629
|
+
"last": "0.0084071",
|
630
|
+
"volume": "950455.78568402",
|
631
|
+
"volumeQuote": "7687.71",
|
632
|
+
"bid": "0.008294",
|
633
|
+
"bidSize": "19593.90088084",
|
634
|
+
"ask": "0.0084",
|
635
|
+
"askSize": "19048.86640562",
|
636
|
+
"timestamp": 1565684834952,
|
637
|
+
},
|
638
|
+
{
|
639
|
+
"market": "ZRX-EUR",
|
640
|
+
"open": "0.1731",
|
641
|
+
"high": "0.1731",
|
642
|
+
"low": "0.16426",
|
643
|
+
"last": "0.16477",
|
644
|
+
"volume": "22486.29651877",
|
645
|
+
"volumeQuote": "3727.45",
|
646
|
+
"bid": "0.16436",
|
647
|
+
"bidSize": "898.75082725",
|
648
|
+
"ask": "0.16476",
|
649
|
+
"askSize": "419.31541176",
|
650
|
+
"timestamp": 1565684835335,
|
651
|
+
},
|
652
|
+
...,
|
653
|
+
]
|
654
|
+
```
|
655
|
+
|
656
|
+
</details>
|
657
|
+
|
658
|
+
### Private
|
659
|
+
|
660
|
+
#### Place order
|
661
|
+
|
662
|
+
When placing an order, make sure that the correct optional parameters are set.
|
663
|
+
For a limit order it is required to set both the amount and price. A market
|
664
|
+
order is valid if either amount or amountQuote is set.
|
665
|
+
|
666
|
+
```python
|
667
|
+
# optional parameters: limit:(amount, price, postOnly), market:(amount, amountQuote, disableMarketProtection),
|
668
|
+
# stopLoss/takeProfit:(amount, amountQuote, disableMarketProtection, triggerType, triggerReference, triggerAmount)
|
669
|
+
# stopLossLimit/takeProfitLimit:(amount, price, postOnly, triggerType, triggerReference, triggerAmount)
|
670
|
+
# all orderTypes: timeInForce, selfTradePrevention, responseRequired
|
671
|
+
response = bitvavo.placeOrder(
|
672
|
+
"BTC-EUR", "buy", "limit", {"amount": "1", "price": "3000"}
|
673
|
+
)
|
674
|
+
print(response)
|
675
|
+
```
|
676
|
+
|
677
|
+
<details>
|
678
|
+
<summary>View Response</summary>
|
679
|
+
|
680
|
+
```python
|
681
|
+
{
|
682
|
+
"orderId": "5444f908-67c4-4c5d-a138-7e834b94360e",
|
683
|
+
"market": "BTC-EUR",
|
684
|
+
"created": 1548671550610,
|
685
|
+
"updated": 1548671550610,
|
686
|
+
"status": "new",
|
687
|
+
"side": "buy",
|
688
|
+
"orderType": "limit",
|
689
|
+
"amount": "1",
|
690
|
+
"amountRemaining": "1",
|
691
|
+
"price": "3000",
|
692
|
+
"onHold": "3007.5",
|
693
|
+
"onHoldCurrency": "EUR",
|
694
|
+
"filledAmount": "0",
|
695
|
+
"filledAmountQuote": "0",
|
696
|
+
"feePaid": "0",
|
697
|
+
"feeCurrency": "EUR",
|
698
|
+
"fills": [],
|
699
|
+
"selfTradePrevention": "decrementAndCancel",
|
700
|
+
"visible": true,
|
701
|
+
"timeInForce": "GTC",
|
702
|
+
"postOnly": false,
|
703
|
+
}
|
704
|
+
```
|
705
|
+
|
706
|
+
</details>
|
707
|
+
|
708
|
+
#### Update order
|
709
|
+
|
710
|
+
When updating an order make sure that at least one of the optional parameters
|
711
|
+
has been set. Otherwise nothing can be updated.
|
712
|
+
|
713
|
+
```python
|
714
|
+
# Optional parameters: limit:(amount, amountRemaining, price, timeInForce, selfTradePrevention, postOnly)
|
715
|
+
# untriggered stopLoss/takeProfit:(amount, amountQuote, disableMarketProtection, triggerType, triggerReference, triggerAmount)
|
716
|
+
# stopLossLimit/takeProfitLimit: (amount, price, postOnly, triggerType, triggerReference, triggerAmount)
|
717
|
+
response = bitvavo.updateOrder(
|
718
|
+
"BTC-EUR", "5444f908-67c4-4c5d-a138-7e834b94360e", {"amount": "1.1"}
|
719
|
+
)
|
720
|
+
print(response)
|
721
|
+
```
|
722
|
+
|
723
|
+
<details>
|
724
|
+
<summary>View Response</summary>
|
725
|
+
|
726
|
+
```python
|
727
|
+
{
|
728
|
+
"orderId": "5444f908-67c4-4c5d-a138-7e834b94360e",
|
729
|
+
"market": "BTC-EUR",
|
730
|
+
"created": 1548671550610,
|
731
|
+
"updated": 1548671831685,
|
732
|
+
"status": "new",
|
733
|
+
"side": "buy",
|
734
|
+
"orderType": "limit",
|
735
|
+
"amount": "1.1",
|
736
|
+
"amountRemaining": "1.1",
|
737
|
+
"price": "3000",
|
738
|
+
"onHold": "3308.25",
|
739
|
+
"onHoldCurrency": "EUR",
|
740
|
+
"filledAmount": "0",
|
741
|
+
"filledAmountQuote": "0",
|
742
|
+
"feePaid": "0",
|
743
|
+
"feeCurrency": "EUR",
|
744
|
+
"fills": [],
|
745
|
+
"selfTradePrevention": "decrementAndCancel",
|
746
|
+
"visible": true,
|
747
|
+
"timeInForce": "GTC",
|
748
|
+
"postOnly": false,
|
749
|
+
}
|
750
|
+
```
|
751
|
+
|
752
|
+
</details>
|
753
|
+
|
754
|
+
#### Get order
|
755
|
+
|
756
|
+
```python
|
757
|
+
response = bitvavo.getOrder("BTC-EUR", "5444f908-67c4-4c5d-a138-7e834b94360e")
|
758
|
+
print(response)
|
759
|
+
```
|
760
|
+
|
761
|
+
<details>
|
762
|
+
<summary>View Response</summary>
|
763
|
+
|
764
|
+
```python
|
765
|
+
{
|
766
|
+
"orderId": "5444f908-67c4-4c5d-a138-7e834b94360e",
|
767
|
+
"market": "BTC-EUR",
|
768
|
+
"created": 1548671550610,
|
769
|
+
"updated": 1548671550610,
|
770
|
+
"status": "new",
|
771
|
+
"side": "buy",
|
772
|
+
"orderType": "limit",
|
773
|
+
"amount": "1",
|
774
|
+
"amountRemaining": "1",
|
775
|
+
"price": "3000",
|
776
|
+
"onHold": "3007.5",
|
777
|
+
"onHoldCurrency": "EUR",
|
778
|
+
"filledAmount": "0",
|
779
|
+
"filledAmountQuote": "0",
|
780
|
+
"feePaid": "0",
|
781
|
+
"feeCurrency": "EUR",
|
782
|
+
"fills": [],
|
783
|
+
"selfTradePrevention": "decrementAndCancel",
|
784
|
+
"visible": true,
|
785
|
+
"timeInForce": "GTC",
|
786
|
+
"postOnly": false,
|
787
|
+
}
|
788
|
+
```
|
789
|
+
|
790
|
+
</details>
|
791
|
+
|
792
|
+
#### Cancel order
|
793
|
+
|
794
|
+
```python
|
795
|
+
response = bitvavo.cancelOrder("BTC-EUR", "5986db7b-8d6e-4577-8003-22f363fb3626")
|
796
|
+
print(response)
|
797
|
+
```
|
798
|
+
|
799
|
+
<details>
|
800
|
+
<summary>View Response</summary>
|
801
|
+
|
802
|
+
```python
|
803
|
+
{"orderId": "5986db7b-8d6e-4577-8003-22f363fb3626"}
|
804
|
+
```
|
805
|
+
|
806
|
+
</details>
|
807
|
+
|
808
|
+
#### Get orders
|
809
|
+
|
810
|
+
Returns the same as get order, but can be used to return multiple orders at
|
811
|
+
once.
|
812
|
+
|
813
|
+
```python
|
814
|
+
# options: limit, start, end, orderIdFrom, orderIdTo
|
815
|
+
response = bitvavo.getOrders("BTC-EUR", {})
|
816
|
+
print(response)
|
817
|
+
```
|
818
|
+
|
819
|
+
<details>
|
820
|
+
<summary>View Response</summary>
|
821
|
+
|
822
|
+
```python
|
823
|
+
[
|
824
|
+
{
|
825
|
+
"orderId": "bad72641-7755-464c-8dcb-7c1d59b142ab",
|
826
|
+
"market": "BTC-EUR",
|
827
|
+
"created": 1548670024870,
|
828
|
+
"updated": 1548670024870,
|
829
|
+
"status": "partiallyFilled",
|
830
|
+
"side": "buy",
|
831
|
+
"orderType": "limit",
|
832
|
+
"amount": "1",
|
833
|
+
"amountRemaining": "0.5",
|
834
|
+
"price": "3000",
|
835
|
+
"onHold": "1504.5",
|
836
|
+
"onHoldCurrency": "EUR",
|
837
|
+
"filledAmount": "0.5",
|
838
|
+
"filledAmountQuote": "1500",
|
839
|
+
"feePaid": "3",
|
840
|
+
"feeCurrency": "EUR",
|
841
|
+
"fills": [
|
842
|
+
{
|
843
|
+
"id": "108c3633-0276-4480-a902-17a01829deae",
|
844
|
+
"timestamp": 1548671992530,
|
845
|
+
"amount": "0.5",
|
846
|
+
"price": "3000",
|
847
|
+
"taker": false,
|
848
|
+
"fee": "3",
|
849
|
+
"feeCurrency": "EUR",
|
850
|
+
"settled": true,
|
851
|
+
}
|
852
|
+
],
|
853
|
+
"selfTradePrevention": "decrementAndCancel",
|
854
|
+
"visible": true,
|
855
|
+
"timeInForce": "GTC",
|
856
|
+
"postOnly": false,
|
857
|
+
},
|
858
|
+
{
|
859
|
+
"orderId": "da1d8330-d6b7-4753-800a-01ad510a679b",
|
860
|
+
"market": "BTC-EUR",
|
861
|
+
"created": 1548666570234,
|
862
|
+
"updated": 1548666570234,
|
863
|
+
"status": "filled",
|
864
|
+
"side": "sell",
|
865
|
+
"orderType": "limit",
|
866
|
+
"amount": "0.1",
|
867
|
+
"amountRemaining": "0",
|
868
|
+
"price": "4000",
|
869
|
+
"onHold": "0",
|
870
|
+
"onHoldCurrency": "BTC",
|
871
|
+
"filledAmount": "0.1",
|
872
|
+
"filledAmountQuote": "400",
|
873
|
+
"feePaid": "0.8",
|
874
|
+
"feeCurrency": "EUR",
|
875
|
+
"fills": [
|
876
|
+
{
|
877
|
+
"id": "79e4bf2f-4fac-4895-9bb2-a5c9c6e2ff3f",
|
878
|
+
"timestamp": 1548666712071,
|
879
|
+
"amount": "0.1",
|
880
|
+
"price": "4000",
|
881
|
+
"taker": false,
|
882
|
+
"fee": "0.8",
|
883
|
+
"feeCurrency": "EUR",
|
884
|
+
"settled": true,
|
885
|
+
}
|
886
|
+
],
|
887
|
+
"selfTradePrevention": "decrementAndCancel",
|
888
|
+
"visible": true,
|
889
|
+
"timeInForce": "GTC",
|
890
|
+
"postOnly": false,
|
891
|
+
},
|
892
|
+
...,
|
893
|
+
]
|
894
|
+
```
|
895
|
+
|
896
|
+
</details>
|
897
|
+
|
898
|
+
#### Cancel orders
|
899
|
+
|
900
|
+
Cancels all orders in a market. If no market is specified, all orders of an
|
901
|
+
account will be canceled.
|
902
|
+
|
903
|
+
```python
|
904
|
+
# options: market
|
905
|
+
response = bitvavo.cancelOrders({})
|
906
|
+
print(response)
|
907
|
+
```
|
908
|
+
|
909
|
+
<details>
|
910
|
+
<summary>View Response</summary>
|
911
|
+
|
912
|
+
```python
|
913
|
+
[
|
914
|
+
{
|
915
|
+
"orderId": "4f9a809b-859f-4d8d-97b3-037113cdf2d0"
|
916
|
+
},
|
917
|
+
{
|
918
|
+
"orderId": "95313ae5-ad65-4430-a0fb-63591bbc337c".
|
919
|
+
},
|
920
|
+
{
|
921
|
+
"orderId": "2465c3ab-5ae2-4d4d-bec7-345f51b3494d"
|
922
|
+
},
|
923
|
+
...
|
924
|
+
]
|
925
|
+
```
|
926
|
+
|
927
|
+
</details>
|
928
|
+
|
929
|
+
#### Get orders open
|
930
|
+
|
931
|
+
Returns all orders which are not filled or canceled.
|
932
|
+
|
933
|
+
```python
|
934
|
+
# options: market
|
935
|
+
response = bitvavo.ordersOpen({})
|
936
|
+
print(response)
|
937
|
+
```
|
938
|
+
|
939
|
+
<details>
|
940
|
+
<summary>View Response</summary>
|
941
|
+
|
942
|
+
```python
|
943
|
+
[
|
944
|
+
{
|
945
|
+
"orderId": "bad72641-7755-464c-8dcb-7c1d59b142ab",
|
946
|
+
"market": "BTC-EUR",
|
947
|
+
"created": 1548670024870,
|
948
|
+
"updated": 1548670024870,
|
949
|
+
"status": "partiallyFilled",
|
950
|
+
"side": "buy",
|
951
|
+
"orderType": "limit",
|
952
|
+
"amount": "1",
|
953
|
+
"amountRemaining": "0.5",
|
954
|
+
"price": "3000",
|
955
|
+
"onHold": "1504.5",
|
956
|
+
"onHoldCurrency": "EUR",
|
957
|
+
"filledAmount": "0.5",
|
958
|
+
"filledAmountQuote": "1500",
|
959
|
+
"feePaid": "3",
|
960
|
+
"feeCurrency": "EUR",
|
961
|
+
"fills": [
|
962
|
+
{
|
963
|
+
"id": "108c3633-0276-4480-a902-17a01829deae",
|
964
|
+
"timestamp": 1548671992530,
|
965
|
+
"amount": "0.5",
|
966
|
+
"price": "3000",
|
967
|
+
"taker": false,
|
968
|
+
"fee": "3",
|
969
|
+
"feeCurrency": "EUR",
|
970
|
+
"settled": true,
|
971
|
+
}
|
972
|
+
],
|
973
|
+
"selfTradePrevention": "decrementAndCancel",
|
974
|
+
"visible": true,
|
975
|
+
"timeInForce": "GTC",
|
976
|
+
"postOnly": false,
|
977
|
+
},
|
978
|
+
{
|
979
|
+
"orderId": "7586d610-2732-4ee6-8516-bed18cfc853b",
|
980
|
+
"market": "BTC-EUR",
|
981
|
+
"created": 1548670088749,
|
982
|
+
"updated": 1548670088749,
|
983
|
+
"status": "new",
|
984
|
+
"side": "buy",
|
985
|
+
"orderType": "limit",
|
986
|
+
"amount": "1",
|
987
|
+
"amountRemaining": "1",
|
988
|
+
"price": "3000",
|
989
|
+
"onHold": "3007.5",
|
990
|
+
"onHoldCurrency": "EUR",
|
991
|
+
"filledAmount": "0",
|
992
|
+
"filledAmountQuote": "0",
|
993
|
+
"feePaid": "0",
|
994
|
+
"feeCurrency": "EUR",
|
995
|
+
"fills": [],
|
996
|
+
"selfTradePrevention": "decrementAndCancel",
|
997
|
+
"visible": true,
|
998
|
+
"timeInForce": "GTC",
|
999
|
+
"postOnly": false,
|
1000
|
+
},
|
1001
|
+
...,
|
1002
|
+
]
|
1003
|
+
```
|
1004
|
+
|
1005
|
+
</details>
|
1006
|
+
|
1007
|
+
#### Get trades
|
1008
|
+
|
1009
|
+
Returns all trades within a market for this account.
|
1010
|
+
|
1011
|
+
```python
|
1012
|
+
# options: limit, start, end, tradeIdFrom, tradeIdTo
|
1013
|
+
response = bitvavo.trades("BTC-EUR", {})
|
1014
|
+
print(response)
|
1015
|
+
```
|
1016
|
+
|
1017
|
+
<details>
|
1018
|
+
<summary>View Response</summary>
|
1019
|
+
|
1020
|
+
```python
|
1021
|
+
[
|
1022
|
+
{
|
1023
|
+
"id": "108c3633-0276-4480-a902-17a01829deae",
|
1024
|
+
"timestamp": 1548671992530,
|
1025
|
+
"market": "BTC-EUR",
|
1026
|
+
"side": "buy",
|
1027
|
+
"amount": "0.5",
|
1028
|
+
"price": "3000",
|
1029
|
+
"taker": false,
|
1030
|
+
"fee": "3",
|
1031
|
+
"feeCurrency": "EUR",
|
1032
|
+
"settled": true,
|
1033
|
+
},
|
1034
|
+
{
|
1035
|
+
"id": "79e4bf2f-4fac-4895-9bb2-a5c9c6e2ff3f",
|
1036
|
+
"timestamp": 1548666712071,
|
1037
|
+
"market": "BTC-EUR",
|
1038
|
+
"side": "sell",
|
1039
|
+
"amount": "0.1",
|
1040
|
+
"price": "4000",
|
1041
|
+
"taker": false,
|
1042
|
+
"fee": "0.8",
|
1043
|
+
"feeCurrency": "EUR",
|
1044
|
+
"settled": true,
|
1045
|
+
},
|
1046
|
+
{
|
1047
|
+
"id": "102486d3-5b72-4fa2-89cf-84c934edb7ae",
|
1048
|
+
"timestamp": 1548666561486,
|
1049
|
+
"market": "BTC-EUR",
|
1050
|
+
"side": "sell",
|
1051
|
+
"amount": "0.1",
|
1052
|
+
"price": "4000",
|
1053
|
+
"taker": true,
|
1054
|
+
"fee": "1",
|
1055
|
+
"feeCurrency": "EUR",
|
1056
|
+
"settled": true,
|
1057
|
+
},
|
1058
|
+
...,
|
1059
|
+
]
|
1060
|
+
```
|
1061
|
+
|
1062
|
+
</details>
|
1063
|
+
|
1064
|
+
#### Get account
|
1065
|
+
|
1066
|
+
Returns the fee tier for this account.
|
1067
|
+
|
1068
|
+
```python
|
1069
|
+
response = bitvavo.account()
|
1070
|
+
print(response)
|
1071
|
+
```
|
1072
|
+
|
1073
|
+
<details>
|
1074
|
+
<summary>View Response</summary>
|
1075
|
+
|
1076
|
+
```python
|
1077
|
+
{"fees": {"taker": "0.0025", "maker": "0.0015", "volume": "100.00"}}
|
1078
|
+
```
|
1079
|
+
|
1080
|
+
</details>
|
1081
|
+
|
1082
|
+
#### Get balance
|
1083
|
+
|
1084
|
+
Returns the balance for this account.
|
1085
|
+
|
1086
|
+
```python
|
1087
|
+
# options: symbol
|
1088
|
+
response = bitvavo.balance({})
|
1089
|
+
print(response)
|
1090
|
+
```
|
1091
|
+
|
1092
|
+
<details>
|
1093
|
+
<summary>View Response</summary>
|
1094
|
+
|
1095
|
+
```python
|
1096
|
+
[
|
1097
|
+
{"symbol": "EUR", "available": "2599.95", "inOrder": "2022.65"},
|
1098
|
+
{"symbol": "BTC", "available": "1.65437", "inOrder": "0.079398"},
|
1099
|
+
{"symbol": "ADA", "available": "4.8", "inOrder": "0"},
|
1100
|
+
{"symbol": "BCH", "available": "0.00952811", "inOrder": "0"},
|
1101
|
+
{"symbol": "BSV", "available": "0.00952811", "inOrder": "0"},
|
1102
|
+
...,
|
1103
|
+
]
|
1104
|
+
```
|
1105
|
+
|
1106
|
+
</details>
|
1107
|
+
|
1108
|
+
#### Deposit assets
|
1109
|
+
|
1110
|
+
Returns the address which can be used to deposit funds.
|
1111
|
+
|
1112
|
+
```python
|
1113
|
+
response = bitvavo.depositAssets("BTC")
|
1114
|
+
print(response)
|
1115
|
+
```
|
1116
|
+
|
1117
|
+
<details>
|
1118
|
+
<summary>View Response</summary>
|
1119
|
+
|
1120
|
+
```python
|
1121
|
+
{"address": "BitcoinAddress"}
|
1122
|
+
```
|
1123
|
+
|
1124
|
+
</details>
|
1125
|
+
|
1126
|
+
#### Withdraw assets
|
1127
|
+
|
1128
|
+
Can be used to withdraw funds from Bitvavo.
|
1129
|
+
|
1130
|
+
```python
|
1131
|
+
# optional parameters: paymentId, internal, addWithdrawalFee
|
1132
|
+
response = bitvavo.withdrawAssets("BTC", "1", "BitcoinAddress", {})
|
1133
|
+
print(response)
|
1134
|
+
```
|
1135
|
+
|
1136
|
+
<details>
|
1137
|
+
<summary>View Response</summary>
|
1138
|
+
|
1139
|
+
```python
|
1140
|
+
{"success": True, "symbol": "BTC", "amount": "1"}
|
1141
|
+
```
|
1142
|
+
|
1143
|
+
</details>
|
1144
|
+
|
1145
|
+
#### Get deposit history
|
1146
|
+
|
1147
|
+
Returns the deposit history of your account.
|
1148
|
+
|
1149
|
+
```python
|
1150
|
+
# options: symbol, limit, start, end
|
1151
|
+
response = bitvavo.depositHistory({})
|
1152
|
+
print(response)
|
1153
|
+
```
|
1154
|
+
|
1155
|
+
<details>
|
1156
|
+
<summary>View Response</summary>
|
1157
|
+
|
1158
|
+
```python
|
1159
|
+
[
|
1160
|
+
{
|
1161
|
+
"timestamp": 1521550025000,
|
1162
|
+
"symbol": "EUR",
|
1163
|
+
"amount": "1",
|
1164
|
+
"fee": "0",
|
1165
|
+
"status": "completed",
|
1166
|
+
"address": "NL12RABO324234234",
|
1167
|
+
},
|
1168
|
+
{
|
1169
|
+
"timestamp": 1511873910000,
|
1170
|
+
"symbol": "BTC",
|
1171
|
+
"amount": "0.099",
|
1172
|
+
"fee": "0",
|
1173
|
+
"status": "completed",
|
1174
|
+
"txId": "0c6497e608212a516b8218674cb0ca04f65b67a00fe8bddaa1ecb03e9b029255",
|
1175
|
+
},
|
1176
|
+
...,
|
1177
|
+
]
|
1178
|
+
```
|
1179
|
+
|
1180
|
+
</details>
|
1181
|
+
|
1182
|
+
#### Get withdrawal history
|
1183
|
+
|
1184
|
+
Returns the withdrawal history of an account.
|
1185
|
+
|
1186
|
+
```python
|
1187
|
+
# options: symbol, limit, start, end
|
1188
|
+
response = bitvavo.withdrawalHistory({})
|
1189
|
+
print(response)
|
1190
|
+
```
|
1191
|
+
|
1192
|
+
<details>
|
1193
|
+
<summary>View Response</summary>
|
1194
|
+
|
1195
|
+
```python
|
1196
|
+
[
|
1197
|
+
{
|
1198
|
+
"timestamp": 1548425559000,
|
1199
|
+
"symbol": "BTC",
|
1200
|
+
"amount": "0.09994",
|
1201
|
+
"fee": "0.00006",
|
1202
|
+
"status": "awaiting_processing",
|
1203
|
+
"address": "1CqtG5z55x7bYD5GxsAXPx59DEyujs4bjm",
|
1204
|
+
},
|
1205
|
+
{
|
1206
|
+
"timestamp": 1548409721000,
|
1207
|
+
"symbol": "EUR",
|
1208
|
+
"amount": "50",
|
1209
|
+
"fee": "0",
|
1210
|
+
"status": "completed",
|
1211
|
+
"address": "NL123BIM",
|
1212
|
+
},
|
1213
|
+
{
|
1214
|
+
"timestamp": 1537803091000,
|
1215
|
+
"symbol": "BTC",
|
1216
|
+
"amount": "0.01939",
|
1217
|
+
"fee": "0.00002",
|
1218
|
+
"status": "completed",
|
1219
|
+
"txId": "da2299c86fce67eb899aeaafbe1f81cf663a3850cf9f3337c92b2d87945532db",
|
1220
|
+
"address": "3QpyxeA7yWWsSURXEmuBBzHpxjqn7Rbyme",
|
1221
|
+
},
|
1222
|
+
...,
|
1223
|
+
]
|
1224
|
+
```
|
1225
|
+
|
1226
|
+
</details>
|
1227
|
+
|
1228
|
+
## Websockets
|
1229
|
+
|
1230
|
+
All requests which can be done through REST requests can also be performed over
|
1231
|
+
websockets. Bitvavo also provides six
|
1232
|
+
[subscriptions](https://github.com/bitvavo/python-bitvavo-api#subscriptions). If
|
1233
|
+
subscribed to these, updates specific for that type/market are pushed
|
1234
|
+
immediately.
|
1235
|
+
|
1236
|
+
### Getting started
|
1237
|
+
|
1238
|
+
The websocket object should be intialised through the `newWebsocket()` function.
|
1239
|
+
After which a callback for the errors should be set. After this any desired
|
1240
|
+
function can be called. Finally the main thread should be kept alive for as long
|
1241
|
+
as you want the socket to stay open. This can be achieved through a simple
|
1242
|
+
`while()` loop, where the remaining limit is checked. This is in case a ban has
|
1243
|
+
been issued, otherwise the websocket object will keep trying to reconnect, while
|
1244
|
+
our servers keep closing the connection.
|
1245
|
+
|
1246
|
+
```python
|
1247
|
+
def errorCallback(error):
|
1248
|
+
print("Handle error here", error)
|
1249
|
+
|
1250
|
+
|
1251
|
+
def ownCallback(response):
|
1252
|
+
print("Handle function response here", response)
|
1253
|
+
|
1254
|
+
|
1255
|
+
websocket = bitvavo.newWebsocket()
|
1256
|
+
websocket.setErrorCallback(errorCallback)
|
1257
|
+
|
1258
|
+
# Call functions here, like:
|
1259
|
+
# websocket.time(ownCallback)
|
1260
|
+
|
1261
|
+
limit = bitvavo.getRemainingLimit()
|
1262
|
+
try:
|
1263
|
+
while limit > 0:
|
1264
|
+
time.sleep(0.5)
|
1265
|
+
limit = bitvavo.getRemainingLimit()
|
1266
|
+
except KeyboardInterrupt:
|
1267
|
+
websocket.closeSocket()
|
1268
|
+
```
|
1269
|
+
|
1270
|
+
The api key and secret are copied from the bitvavo object. Therefore if you want
|
1271
|
+
to use the private portion of the websockets API, you should set both the key
|
1272
|
+
and secret as specified in [REST
|
1273
|
+
requests](https://github.com/bitvavo/python-bitvavo-api#rest-requests).
|
1274
|
+
|
1275
|
+
### Public
|
1276
|
+
|
1277
|
+
#### Get time
|
1278
|
+
|
1279
|
+
```python
|
1280
|
+
websocket.time(ownCallback)
|
1281
|
+
```
|
1282
|
+
|
1283
|
+
<details>
|
1284
|
+
<summary>View Response</summary>
|
1285
|
+
|
1286
|
+
```python
|
1287
|
+
{"time": 1543397021396}
|
1288
|
+
```
|
1289
|
+
|
1290
|
+
</details>
|
1291
|
+
|
1292
|
+
#### Get markets
|
1293
|
+
|
1294
|
+
```python
|
1295
|
+
# options: market
|
1296
|
+
websocket.markets({}, ownCallback)
|
1297
|
+
```
|
1298
|
+
|
1299
|
+
<details>
|
1300
|
+
<summary>View Response</summary>
|
1301
|
+
|
1302
|
+
```python
|
1303
|
+
{
|
1304
|
+
"market": "ADA-BTC",
|
1305
|
+
"status": "trading",
|
1306
|
+
"base": "ADA",
|
1307
|
+
"quote": "BTC",
|
1308
|
+
"pricePrecision": 5,
|
1309
|
+
"minOrderInBaseAsset": "100",
|
1310
|
+
"minOrderInQuoteAsset": "0.001",
|
1311
|
+
"orderTypes": ["market", "limit"],
|
1312
|
+
}
|
1313
|
+
{
|
1314
|
+
"market": "ADA-EUR",
|
1315
|
+
"status": "trading",
|
1316
|
+
"base": "ADA",
|
1317
|
+
"quote": "EUR",
|
1318
|
+
"pricePrecision": 5,
|
1319
|
+
"minOrderInBaseAsset": "100",
|
1320
|
+
"minOrderInQuoteAsset": "10",
|
1321
|
+
"orderTypes": ["market", "limit"],
|
1322
|
+
}
|
1323
|
+
{
|
1324
|
+
"market": "AE-BTC",
|
1325
|
+
"status": "trading",
|
1326
|
+
"base": "AE",
|
1327
|
+
"quote": "BTC",
|
1328
|
+
"pricePrecision": 5,
|
1329
|
+
"minOrderInBaseAsset": "10",
|
1330
|
+
"minOrderInQuoteAsset": "0.001",
|
1331
|
+
"orderTypes": ["market", "limit"],
|
1332
|
+
}
|
1333
|
+
{
|
1334
|
+
"market": "AE-EUR",
|
1335
|
+
"status": "trading",
|
1336
|
+
"base": "AE",
|
1337
|
+
"quote": "EUR",
|
1338
|
+
"pricePrecision": 5,
|
1339
|
+
"minOrderInBaseAsset": "10",
|
1340
|
+
"minOrderInQuoteAsset": "10",
|
1341
|
+
"orderTypes": ["market", "limit"],
|
1342
|
+
}
|
1343
|
+
...
|
1344
|
+
```
|
1345
|
+
|
1346
|
+
</details>
|
1347
|
+
|
1348
|
+
#### Get assets
|
1349
|
+
|
1350
|
+
```python
|
1351
|
+
# options: symbol
|
1352
|
+
websocket.assets({}, ownCallback)
|
1353
|
+
```
|
1354
|
+
|
1355
|
+
<details>
|
1356
|
+
<summary>View Response</summary>
|
1357
|
+
|
1358
|
+
```python
|
1359
|
+
[
|
1360
|
+
{
|
1361
|
+
"symbol": "ADA",
|
1362
|
+
"name": "Cardano",
|
1363
|
+
"decimals": 6,
|
1364
|
+
"depositFee": "0",
|
1365
|
+
"depositConfirmations": 20,
|
1366
|
+
"depositStatus": "OK",
|
1367
|
+
"withdrawalFee": "0.2",
|
1368
|
+
"withdrawalMinAmount": "0.2",
|
1369
|
+
"withdrawalStatus": "OK",
|
1370
|
+
"networks": ["Mainnet"],
|
1371
|
+
"message": "",
|
1372
|
+
},
|
1373
|
+
{
|
1374
|
+
"symbol": "AE",
|
1375
|
+
"name": "Aeternity",
|
1376
|
+
"decimals": 8,
|
1377
|
+
"depositFee": "0",
|
1378
|
+
"depositConfirmations": 30,
|
1379
|
+
"depositStatus": "OK",
|
1380
|
+
"withdrawalFee": "2",
|
1381
|
+
"withdrawalMinAmount": "2",
|
1382
|
+
"withdrawalStatus": "OK",
|
1383
|
+
"networks": ["Mainnet"],
|
1384
|
+
"message": "",
|
1385
|
+
},
|
1386
|
+
{
|
1387
|
+
"symbol": "AION",
|
1388
|
+
"name": "Aion",
|
1389
|
+
"decimals": 8,
|
1390
|
+
"depositFee": "0",
|
1391
|
+
"depositConfirmations": 0,
|
1392
|
+
"depositStatus": "",
|
1393
|
+
"withdrawalFee": "3",
|
1394
|
+
"withdrawalMinAmount": "3",
|
1395
|
+
"withdrawalStatus": "",
|
1396
|
+
"networks": ["Mainnet"],
|
1397
|
+
"message": "",
|
1398
|
+
},
|
1399
|
+
{
|
1400
|
+
"symbol": "ANT",
|
1401
|
+
"name": "Aragon",
|
1402
|
+
"decimals": 8,
|
1403
|
+
"depositFee": "0",
|
1404
|
+
"depositConfirmations": 30,
|
1405
|
+
"depositStatus": "OK",
|
1406
|
+
"withdrawalFee": "2",
|
1407
|
+
"withdrawalMinAmount": "2",
|
1408
|
+
"withdrawalStatus": "OK",
|
1409
|
+
"networks": ["Mainnet"],
|
1410
|
+
"message": "",
|
1411
|
+
},
|
1412
|
+
...,
|
1413
|
+
]
|
1414
|
+
```
|
1415
|
+
|
1416
|
+
</details>
|
1417
|
+
|
1418
|
+
#### Get book per market
|
1419
|
+
|
1420
|
+
```python
|
1421
|
+
# options: depth
|
1422
|
+
websocket.book("BTC-EUR", {}, ownCallback)
|
1423
|
+
```
|
1424
|
+
|
1425
|
+
<details>
|
1426
|
+
<summary>View Response</summary>
|
1427
|
+
|
1428
|
+
```python
|
1429
|
+
{
|
1430
|
+
"market": "BTC-EUR",
|
1431
|
+
"nonce": 26393,
|
1432
|
+
"bids": [
|
1433
|
+
["3008.8", "1.47148675"],
|
1434
|
+
["3008.3", "1.10515032"],
|
1435
|
+
["3007.7", "1.38627613"],
|
1436
|
+
["3007.2", "0.72343843"],
|
1437
|
+
["3006.7", "0.96668815"],
|
1438
|
+
["3006.2", "3.50846635"],
|
1439
|
+
...,
|
1440
|
+
],
|
1441
|
+
"asks": [
|
1442
|
+
["3009.2", "2.74009412"],
|
1443
|
+
["3011.3", "3.03788636"],
|
1444
|
+
["3013.1", "3.91270989"],
|
1445
|
+
["3015.1", "4.33891895"],
|
1446
|
+
["3016", "1.34888815"],
|
1447
|
+
["3016.5", "1.95726644"],
|
1448
|
+
...,
|
1449
|
+
],
|
1450
|
+
}
|
1451
|
+
```
|
1452
|
+
|
1453
|
+
</details>
|
1454
|
+
|
1455
|
+
#### Get trades per market
|
1456
|
+
|
1457
|
+
```python
|
1458
|
+
# options: limit, start, end, tradeIdFrom, tradeIdTo
|
1459
|
+
websocket.publicTrades("BTC-EUR", {}, ownCallback)
|
1460
|
+
```
|
1461
|
+
|
1462
|
+
<details>
|
1463
|
+
<summary>View Response</summary>
|
1464
|
+
|
1465
|
+
```python
|
1466
|
+
[
|
1467
|
+
{
|
1468
|
+
"id": "041689b3-cbb6-49ec-9964-2fb2d353dd1b",
|
1469
|
+
"timestamp": 1565672192018,
|
1470
|
+
"amount": "0.12735922",
|
1471
|
+
"price": "10147",
|
1472
|
+
"side": "sell"
|
1473
|
+
},
|
1474
|
+
{
|
1475
|
+
"id": "fb1712f2-e183-457c-b9e5-ff0d31fccd1f",
|
1476
|
+
"timestamp": 1565672192014,
|
1477
|
+
"amount": "0.08703703",
|
1478
|
+
"price": "10149",
|
1479
|
+
"side": "sell"
|
1480
|
+
},
|
1481
|
+
{
|
1482
|
+
"id": "b8cf5e20-65ca-4f45-a94c-44b7cb3952a5",
|
1483
|
+
"timestamp": 1565672192009,
|
1484
|
+
"amount": "0.0979994",
|
1485
|
+
"price": "10151",
|
1486
|
+
"side": "sell"
|
1487
|
+
},
|
1488
|
+
{
|
1489
|
+
"id": "d10cc7ec-a735-4d5c-8169-c3099f8b5003",
|
1490
|
+
"timestamp": 1565672144747,
|
1491
|
+
"amount": "0.01975188",
|
1492
|
+
"price": "10151",
|
1493
|
+
"side": "sell"
|
1494
|
+
}
|
1495
|
+
...
|
1496
|
+
]
|
1497
|
+
```
|
1498
|
+
|
1499
|
+
</details>
|
1500
|
+
|
1501
|
+
#### Get candles per market
|
1502
|
+
|
1503
|
+
```python
|
1504
|
+
# options: limit
|
1505
|
+
websocket.candles("BTC-EUR", "1h", {}, ownCallback)
|
1506
|
+
```
|
1507
|
+
|
1508
|
+
<details>
|
1509
|
+
<summary>View Response</summary>
|
1510
|
+
|
1511
|
+
```python
|
1512
|
+
[
|
1513
|
+
[1548669600000, "3012.9", "3015.8", "3000", "3012.9", "8"],
|
1514
|
+
[1548669600000, "3012.9", "3015.8", "3000", "3012.9", "8"],
|
1515
|
+
[1548669600000, "3012.9", "3015.8", "3000", "3012.9", "8"],
|
1516
|
+
[1548417600000, "3124", "3125.1", "3124", "3124", "0.1"],
|
1517
|
+
[1548237600000, "3143", "3143.3", "3141.1", "3143", "60.67250851"],
|
1518
|
+
...,
|
1519
|
+
]
|
1520
|
+
```
|
1521
|
+
|
1522
|
+
</details>
|
1523
|
+
|
1524
|
+
#### Get price ticker
|
1525
|
+
|
1526
|
+
```python
|
1527
|
+
# options: market
|
1528
|
+
websocket.tickerPrice({}, ownCallback)
|
1529
|
+
```
|
1530
|
+
|
1531
|
+
<details>
|
1532
|
+
<summary>View Response</summary>
|
1533
|
+
|
1534
|
+
```python
|
1535
|
+
[
|
1536
|
+
{"market": "EOS-EUR", "price": "2.0142"},
|
1537
|
+
{"market": "XRP-EUR", "price": "0.27848"},
|
1538
|
+
{"market": "ETH-EUR", "price": "99.877"},
|
1539
|
+
{"market": "IOST-EUR", "price": "0.005941"},
|
1540
|
+
{"market": "BCH-EUR", "price": "106.57"},
|
1541
|
+
{"market": "BTC-EUR", "price": "3008.9"},
|
1542
|
+
{"market": "STORM-EUR", "price": "0.0025672"},
|
1543
|
+
{"market": "EOS-BTC", "price": "0.00066289"},
|
1544
|
+
...,
|
1545
|
+
]
|
1546
|
+
```
|
1547
|
+
|
1548
|
+
</details>
|
1549
|
+
|
1550
|
+
#### Get book ticker
|
1551
|
+
|
1552
|
+
```python
|
1553
|
+
# options: market
|
1554
|
+
websocket.tickerBook({}, ownCallback)
|
1555
|
+
```
|
1556
|
+
|
1557
|
+
<details>
|
1558
|
+
<summary>View Response</summary>
|
1559
|
+
|
1560
|
+
```python
|
1561
|
+
[
|
1562
|
+
{
|
1563
|
+
"market": "ZIL-BTC",
|
1564
|
+
"bid": "0.00000082",
|
1565
|
+
"ask": "0.00000083",
|
1566
|
+
"bidSize": "13822.00651664",
|
1567
|
+
"askSize": "5743.88893286",
|
1568
|
+
},
|
1569
|
+
{
|
1570
|
+
"market": "ZIL-EUR",
|
1571
|
+
"bid": "0.0082973",
|
1572
|
+
"ask": "0.0084058",
|
1573
|
+
"bidSize": "19586.15862762",
|
1574
|
+
"askSize": "19048.86640562",
|
1575
|
+
},
|
1576
|
+
{
|
1577
|
+
"market": "ZRX-BTC",
|
1578
|
+
"bid": "0.00001625",
|
1579
|
+
"ask": "0.00001629",
|
1580
|
+
"bidSize": "823.87743487",
|
1581
|
+
"askSize": "868.23901671",
|
1582
|
+
},
|
1583
|
+
{
|
1584
|
+
"market": "ZRX-EUR",
|
1585
|
+
"bid": "0.16443",
|
1586
|
+
"ask": "0.16498",
|
1587
|
+
"bidSize": "898.35016343",
|
1588
|
+
"askSize": "419.16696625",
|
1589
|
+
},
|
1590
|
+
...,
|
1591
|
+
]
|
1592
|
+
```
|
1593
|
+
|
1594
|
+
</details>
|
1595
|
+
|
1596
|
+
#### Get 24 hour ticker
|
1597
|
+
|
1598
|
+
```python
|
1599
|
+
# options: market
|
1600
|
+
websocket.ticker24h({}, timeCallback)
|
1601
|
+
```
|
1602
|
+
|
1603
|
+
<details>
|
1604
|
+
<summary>View Response</summary>
|
1605
|
+
|
1606
|
+
```python
|
1607
|
+
[
|
1608
|
+
{
|
1609
|
+
"market": "XVG-EUR",
|
1610
|
+
"open": "0.0045692",
|
1611
|
+
"high": "0.0045853",
|
1612
|
+
"low": "0.0043599",
|
1613
|
+
"last": "0.0044047",
|
1614
|
+
"volume": "594786.9689017",
|
1615
|
+
"volumeQuote": "2648.07",
|
1616
|
+
"bid": "0.0043493",
|
1617
|
+
"bidSize": "1561220.43836043",
|
1618
|
+
"ask": "0.004453",
|
1619
|
+
"askSize": "1457312.74672114",
|
1620
|
+
"timestamp": 1565684835077,
|
1621
|
+
},
|
1622
|
+
{
|
1623
|
+
"market": "ZIL-EUR",
|
1624
|
+
"open": "0.0081178",
|
1625
|
+
"high": "0.0084196",
|
1626
|
+
"low": "0.0077389",
|
1627
|
+
"last": "0.0084071",
|
1628
|
+
"volume": "950455.78568402",
|
1629
|
+
"volumeQuote": "7687.71",
|
1630
|
+
"bid": "0.008294",
|
1631
|
+
"bidSize": "19593.90088084",
|
1632
|
+
"ask": "0.0084",
|
1633
|
+
"askSize": "19048.86640562",
|
1634
|
+
"timestamp": 1565684834952,
|
1635
|
+
},
|
1636
|
+
{
|
1637
|
+
"market": "ZRX-EUR",
|
1638
|
+
"open": "0.1731",
|
1639
|
+
"high": "0.1731",
|
1640
|
+
"low": "0.16426",
|
1641
|
+
"last": "0.16477",
|
1642
|
+
"volume": "22486.29651877",
|
1643
|
+
"volumeQuote": "3727.45",
|
1644
|
+
"bid": "0.16436",
|
1645
|
+
"bidSize": "898.75082725",
|
1646
|
+
"ask": "0.16476",
|
1647
|
+
"askSize": "419.31541176",
|
1648
|
+
"timestamp": 1565684835335,
|
1649
|
+
},
|
1650
|
+
...,
|
1651
|
+
]
|
1652
|
+
```
|
1653
|
+
|
1654
|
+
</details>
|
1655
|
+
|
1656
|
+
### Private
|
1657
|
+
|
1658
|
+
#### Place order
|
1659
|
+
|
1660
|
+
When placing an order, make sure that the correct optional parameters are set.
|
1661
|
+
For a limit order it is required to set both the amount and price. A market
|
1662
|
+
order is valid if either amount or amountQuote has been set.
|
1663
|
+
|
1664
|
+
```python
|
1665
|
+
# optional parameters: limit:(amount, price, postOnly), market:(amount, amountQuote, disableMarketProtection),
|
1666
|
+
# stopLoss/takeProfit:(amount, amountQuote, disableMarketProtection, triggerType, triggerReference, triggerAmount)
|
1667
|
+
# stopLossLimit/takeProfitLimit:(amount, price, postOnly, triggerType, triggerReference, triggerAmount)
|
1668
|
+
# all orderTypes: timeInForce, selfTradePrevention, responseRequired
|
1669
|
+
websocket.placeOrder(
|
1670
|
+
"BTC-EUR", "buy", "limit", {"amount": "1", "price": "3000"}, ownCallback
|
1671
|
+
)
|
1672
|
+
```
|
1673
|
+
|
1674
|
+
<details>
|
1675
|
+
<summary>View Response</summary>
|
1676
|
+
|
1677
|
+
```python
|
1678
|
+
{
|
1679
|
+
"orderId": "5444f908-67c4-4c5d-a138-7e834b94360e",
|
1680
|
+
"market": "BTC-EUR",
|
1681
|
+
"created": 1548671550610,
|
1682
|
+
"updated": 1548671550610,
|
1683
|
+
"status": "new",
|
1684
|
+
"side": "buy",
|
1685
|
+
"orderType": "limit",
|
1686
|
+
"amount": "1",
|
1687
|
+
"amountRemaining": "1",
|
1688
|
+
"price": "3000",
|
1689
|
+
"onHold": "3007.5",
|
1690
|
+
"onHoldCurrency": "EUR",
|
1691
|
+
"filledAmount": "0",
|
1692
|
+
"filledAmountQuote": "0",
|
1693
|
+
"feePaid": "0",
|
1694
|
+
"feeCurrency": "EUR",
|
1695
|
+
"fills": [],
|
1696
|
+
"selfTradePrevention": "decrementAndCancel",
|
1697
|
+
"visible": true,
|
1698
|
+
"timeInForce": "GTC",
|
1699
|
+
"postOnly": false,
|
1700
|
+
}
|
1701
|
+
```
|
1702
|
+
|
1703
|
+
</details>
|
1704
|
+
|
1705
|
+
#### Update order
|
1706
|
+
|
1707
|
+
When updating an order make sure that at least one of the optional parameters
|
1708
|
+
has been set. Otherwise nothing can be updated.
|
1709
|
+
|
1710
|
+
```python
|
1711
|
+
# Optional parameters: limit:(amount, amountRemaining, price, timeInForce, selfTradePrevention, postOnly)
|
1712
|
+
# untriggered stopLoss/takeProfit:(amount, amountQuote, disableMarketProtection, triggerType, triggerReference, triggerAmount)
|
1713
|
+
# stopLossLimit/takeProfitLimit: (amount, price, postOnly, triggerType, triggerReference, triggerAmount)
|
1714
|
+
websocket.updateOrder(
|
1715
|
+
"BTC-EUR", "5444f908-67c4-4c5d-a138-7e834b94360e", {"amount": "1.1"}, ownCallback
|
1716
|
+
)
|
1717
|
+
```
|
1718
|
+
|
1719
|
+
<details>
|
1720
|
+
<summary>View Response</summary>
|
1721
|
+
|
1722
|
+
```python
|
1723
|
+
{
|
1724
|
+
"orderId": "5444f908-67c4-4c5d-a138-7e834b94360e",
|
1725
|
+
"market": "BTC-EUR",
|
1726
|
+
"created": 1548671550610,
|
1727
|
+
"updated": 1548671831685,
|
1728
|
+
"status": "new",
|
1729
|
+
"side": "buy",
|
1730
|
+
"orderType": "limit",
|
1731
|
+
"amount": "1.1",
|
1732
|
+
"amountRemaining": "1.1",
|
1733
|
+
"price": "3000",
|
1734
|
+
"onHold": "3308.25",
|
1735
|
+
"onHoldCurrency": "EUR",
|
1736
|
+
"filledAmount": "0",
|
1737
|
+
"filledAmountQuote": "0",
|
1738
|
+
"feePaid": "0",
|
1739
|
+
"feeCurrency": "EUR",
|
1740
|
+
"fills": [],
|
1741
|
+
"selfTradePrevention": "decrementAndCancel",
|
1742
|
+
"visible": true,
|
1743
|
+
"timeInForce": "GTC",
|
1744
|
+
"postOnly": false,
|
1745
|
+
}
|
1746
|
+
```
|
1747
|
+
|
1748
|
+
</details>
|
1749
|
+
|
1750
|
+
#### Get order
|
1751
|
+
|
1752
|
+
```python
|
1753
|
+
websocket.getOrder("BTC-EUR", "5444f908-67c4-4c5d-a138-7e834b94360e", ownCallback)
|
1754
|
+
```
|
1755
|
+
|
1756
|
+
<details>
|
1757
|
+
<summary>View Response</summary>
|
1758
|
+
|
1759
|
+
```python
|
1760
|
+
{
|
1761
|
+
"orderId": "5444f908-67c4-4c5d-a138-7e834b94360e",
|
1762
|
+
"market": "BTC-EUR",
|
1763
|
+
"created": 1548671550610,
|
1764
|
+
"updated": 1548671550610,
|
1765
|
+
"status": "new",
|
1766
|
+
"side": "buy",
|
1767
|
+
"orderType": "limit",
|
1768
|
+
"amount": "1",
|
1769
|
+
"amountRemaining": "1",
|
1770
|
+
"price": "3000",
|
1771
|
+
"onHold": "3007.5",
|
1772
|
+
"onHoldCurrency": "EUR",
|
1773
|
+
"filledAmount": "0",
|
1774
|
+
"filledAmountQuote": "0",
|
1775
|
+
"feePaid": "0",
|
1776
|
+
"feeCurrency": "EUR",
|
1777
|
+
"fills": [],
|
1778
|
+
"selfTradePrevention": "decrementAndCancel",
|
1779
|
+
"visible": true,
|
1780
|
+
"timeInForce": "GTC",
|
1781
|
+
"postOnly": false,
|
1782
|
+
}
|
1783
|
+
```
|
1784
|
+
|
1785
|
+
</details>
|
1786
|
+
|
1787
|
+
#### Cancel order
|
1788
|
+
|
1789
|
+
```python
|
1790
|
+
websocket.cancelOrder("BTC-EUR", "5986db7b-8d6e-4577-8003-22f363fb3626", ownCallback)
|
1791
|
+
```
|
1792
|
+
|
1793
|
+
<details>
|
1794
|
+
<summary>View Response</summary>
|
1795
|
+
|
1796
|
+
```python
|
1797
|
+
{"orderId": "5986db7b-8d6e-4577-8003-22f363fb3626"}
|
1798
|
+
```
|
1799
|
+
|
1800
|
+
</details>
|
1801
|
+
|
1802
|
+
#### Get orders
|
1803
|
+
|
1804
|
+
Returns the same as get order, but can be used to return multiple orders at
|
1805
|
+
once.
|
1806
|
+
|
1807
|
+
```python
|
1808
|
+
# options: limit, start, end, orderIdFrom, orderIdTo
|
1809
|
+
websocket.getOrders("BTC-EUR", {}, ownCallback)
|
1810
|
+
```
|
1811
|
+
|
1812
|
+
<details>
|
1813
|
+
<summary>View Response</summary>
|
1814
|
+
|
1815
|
+
```python
|
1816
|
+
[
|
1817
|
+
{
|
1818
|
+
"orderId": "bad72641-7755-464c-8dcb-7c1d59b142ab",
|
1819
|
+
"market": "BTC-EUR",
|
1820
|
+
"created": 1548670024870,
|
1821
|
+
"updated": 1548670024870,
|
1822
|
+
"status": "partiallyFilled",
|
1823
|
+
"side": "buy",
|
1824
|
+
"orderType": "limit",
|
1825
|
+
"amount": "1",
|
1826
|
+
"amountRemaining": "0.5",
|
1827
|
+
"price": "3000",
|
1828
|
+
"onHold": "1504.5",
|
1829
|
+
"onHoldCurrency": "EUR",
|
1830
|
+
"filledAmount": "0.5",
|
1831
|
+
"filledAmountQuote": "1500",
|
1832
|
+
"feePaid": "3",
|
1833
|
+
"feeCurrency": "EUR",
|
1834
|
+
"fills": [
|
1835
|
+
{
|
1836
|
+
"id": "108c3633-0276-4480-a902-17a01829deae",
|
1837
|
+
"timestamp": 1548671992530,
|
1838
|
+
"amount": "0.5",
|
1839
|
+
"price": "3000",
|
1840
|
+
"taker": false,
|
1841
|
+
"fee": "3",
|
1842
|
+
"feeCurrency": "EUR",
|
1843
|
+
"settled": true,
|
1844
|
+
}
|
1845
|
+
],
|
1846
|
+
"selfTradePrevention": "decrementAndCancel",
|
1847
|
+
"visible": true,
|
1848
|
+
"timeInForce": "GTC",
|
1849
|
+
"postOnly": false,
|
1850
|
+
},
|
1851
|
+
{
|
1852
|
+
"orderId": "da1d8330-d6b7-4753-800a-01ad510a679b",
|
1853
|
+
"market": "BTC-EUR",
|
1854
|
+
"created": 1548666570234,
|
1855
|
+
"updated": 1548666570234,
|
1856
|
+
"status": "filled",
|
1857
|
+
"side": "sell",
|
1858
|
+
"orderType": "limit",
|
1859
|
+
"amount": "0.1",
|
1860
|
+
"amountRemaining": "0",
|
1861
|
+
"price": "4000",
|
1862
|
+
"onHold": "0",
|
1863
|
+
"onHoldCurrency": "BTC",
|
1864
|
+
"filledAmount": "0.1",
|
1865
|
+
"filledAmountQuote": "400",
|
1866
|
+
"feePaid": "0.8",
|
1867
|
+
"feeCurrency": "EUR",
|
1868
|
+
"fills": [
|
1869
|
+
{
|
1870
|
+
"id": "79e4bf2f-4fac-4895-9bb2-a5c9c6e2ff3f",
|
1871
|
+
"timestamp": 1548666712071,
|
1872
|
+
"amount": "0.1",
|
1873
|
+
"price": "4000",
|
1874
|
+
"taker": false,
|
1875
|
+
"fee": "0.8",
|
1876
|
+
"feeCurrency": "EUR",
|
1877
|
+
"settled": true,
|
1878
|
+
}
|
1879
|
+
],
|
1880
|
+
"selfTradePrevention": "decrementAndCancel",
|
1881
|
+
"visible": true,
|
1882
|
+
"timeInForce": "GTC",
|
1883
|
+
"postOnly": false,
|
1884
|
+
},
|
1885
|
+
...,
|
1886
|
+
]
|
1887
|
+
```
|
1888
|
+
|
1889
|
+
</details>
|
1890
|
+
|
1891
|
+
#### Cancel orders
|
1892
|
+
|
1893
|
+
Cancels all orders in a market. If no market is specified, all orders of an
|
1894
|
+
account will be canceled.
|
1895
|
+
|
1896
|
+
```python
|
1897
|
+
# options: market
|
1898
|
+
websocket.cancelOrders({}, ownCallback)
|
1899
|
+
```
|
1900
|
+
|
1901
|
+
<details>
|
1902
|
+
<summary>View Response</summary>
|
1903
|
+
|
1904
|
+
```python
|
1905
|
+
[
|
1906
|
+
{
|
1907
|
+
"orderId": "4f9a809b-859f-4d8d-97b3-037113cdf2d0"
|
1908
|
+
},
|
1909
|
+
{
|
1910
|
+
"orderId": "95313ae5-ad65-4430-a0fb-63591bbc337c".
|
1911
|
+
},
|
1912
|
+
{
|
1913
|
+
"orderId": "2465c3ab-5ae2-4d4d-bec7-345f51b3494d"
|
1914
|
+
},
|
1915
|
+
...
|
1916
|
+
]
|
1917
|
+
```
|
1918
|
+
|
1919
|
+
</details>
|
1920
|
+
|
1921
|
+
#### Get orders open
|
1922
|
+
|
1923
|
+
Returns all orders which are not filled or canceled.
|
1924
|
+
|
1925
|
+
```python
|
1926
|
+
# options: market
|
1927
|
+
websocket.ordersOpen({}, ownCallback)
|
1928
|
+
```
|
1929
|
+
|
1930
|
+
<details>
|
1931
|
+
<summary>View Response</summary>
|
1932
|
+
|
1933
|
+
```python
|
1934
|
+
[
|
1935
|
+
{
|
1936
|
+
"orderId": "bad72641-7755-464c-8dcb-7c1d59b142ab",
|
1937
|
+
"market": "BTC-EUR",
|
1938
|
+
"created": 1548670024870,
|
1939
|
+
"updated": 1548670024870,
|
1940
|
+
"status": "partiallyFilled",
|
1941
|
+
"side": "buy",
|
1942
|
+
"orderType": "limit",
|
1943
|
+
"amount": "1",
|
1944
|
+
"amountRemaining": "0.5",
|
1945
|
+
"price": "3000",
|
1946
|
+
"onHold": "1504.5",
|
1947
|
+
"onHoldCurrency": "EUR",
|
1948
|
+
"filledAmount": "0.5",
|
1949
|
+
"filledAmountQuote": "1500",
|
1950
|
+
"feePaid": "3",
|
1951
|
+
"feeCurrency": "EUR",
|
1952
|
+
"fills": [
|
1953
|
+
{
|
1954
|
+
"id": "108c3633-0276-4480-a902-17a01829deae",
|
1955
|
+
"timestamp": 1548671992530,
|
1956
|
+
"amount": "0.5",
|
1957
|
+
"price": "3000",
|
1958
|
+
"taker": false,
|
1959
|
+
"fee": "3",
|
1960
|
+
"feeCurrency": "EUR",
|
1961
|
+
"settled": true,
|
1962
|
+
}
|
1963
|
+
],
|
1964
|
+
"selfTradePrevention": "decrementAndCancel",
|
1965
|
+
"visible": true,
|
1966
|
+
"timeInForce": "GTC",
|
1967
|
+
"postOnly": false,
|
1968
|
+
},
|
1969
|
+
{
|
1970
|
+
"orderId": "7586d610-2732-4ee6-8516-bed18cfc853b",
|
1971
|
+
"market": "BTC-EUR",
|
1972
|
+
"created": 1548670088749,
|
1973
|
+
"updated": 1548670088749,
|
1974
|
+
"status": "new",
|
1975
|
+
"side": "buy",
|
1976
|
+
"orderType": "limit",
|
1977
|
+
"amount": "1",
|
1978
|
+
"amountRemaining": "1",
|
1979
|
+
"price": "3000",
|
1980
|
+
"onHold": "3007.5",
|
1981
|
+
"onHoldCurrency": "EUR",
|
1982
|
+
"filledAmount": "0",
|
1983
|
+
"filledAmountQuote": "0",
|
1984
|
+
"feePaid": "0",
|
1985
|
+
"feeCurrency": "EUR",
|
1986
|
+
"fills": [],
|
1987
|
+
"selfTradePrevention": "decrementAndCancel",
|
1988
|
+
"visible": true,
|
1989
|
+
"timeInForce": "GTC",
|
1990
|
+
"postOnly": false,
|
1991
|
+
},
|
1992
|
+
...,
|
1993
|
+
]
|
1994
|
+
```
|
1995
|
+
|
1996
|
+
</details>
|
1997
|
+
|
1998
|
+
#### Get trades
|
1999
|
+
|
2000
|
+
Returns all trades within a market for this account.
|
2001
|
+
|
2002
|
+
```python
|
2003
|
+
# options: limit, start, end, tradeIdFrom, tradeIdTo
|
2004
|
+
websocket.trades("BTC-EUR", {}, ownCallback)
|
2005
|
+
```
|
2006
|
+
|
2007
|
+
<details>
|
2008
|
+
<summary>View Response</summary>
|
2009
|
+
|
2010
|
+
```python
|
2011
|
+
[
|
2012
|
+
{
|
2013
|
+
"id": "108c3633-0276-4480-a902-17a01829deae",
|
2014
|
+
"timestamp": 1548671992530,
|
2015
|
+
"market": "BTC-EUR",
|
2016
|
+
"side": "buy",
|
2017
|
+
"amount": "0.5",
|
2018
|
+
"price": "3000",
|
2019
|
+
"taker": false,
|
2020
|
+
"fee": "3",
|
2021
|
+
"feeCurrency": "EUR",
|
2022
|
+
"settled": true,
|
2023
|
+
},
|
2024
|
+
{
|
2025
|
+
"id": "79e4bf2f-4fac-4895-9bb2-a5c9c6e2ff3f",
|
2026
|
+
"timestamp": 1548666712071,
|
2027
|
+
"market": "BTC-EUR",
|
2028
|
+
"side": "sell",
|
2029
|
+
"amount": "0.1",
|
2030
|
+
"price": "4000",
|
2031
|
+
"taker": false,
|
2032
|
+
"fee": "0.8",
|
2033
|
+
"feeCurrency": "EUR",
|
2034
|
+
"settled": true,
|
2035
|
+
},
|
2036
|
+
{
|
2037
|
+
"id": "102486d3-5b72-4fa2-89cf-84c934edb7ae",
|
2038
|
+
"timestamp": 1548666561486,
|
2039
|
+
"market": "BTC-EUR",
|
2040
|
+
"side": "sell",
|
2041
|
+
"amount": "0.1",
|
2042
|
+
"price": "4000",
|
2043
|
+
"taker": true,
|
2044
|
+
"fee": "1",
|
2045
|
+
"feeCurrency": "EUR",
|
2046
|
+
"settled": true,
|
2047
|
+
},
|
2048
|
+
...,
|
2049
|
+
]
|
2050
|
+
```
|
2051
|
+
|
2052
|
+
</details>
|
2053
|
+
|
2054
|
+
#### Get account
|
2055
|
+
|
2056
|
+
Returns the fee tier for this account.
|
2057
|
+
|
2058
|
+
```python
|
2059
|
+
websocket.account(ownCallback)
|
2060
|
+
```
|
2061
|
+
|
2062
|
+
<details>
|
2063
|
+
<summary>View Response</summary>
|
2064
|
+
|
2065
|
+
```python
|
2066
|
+
{"fees": {"taker": "0.0025", "maker": "0.0015", "volume": "100.00"}}
|
2067
|
+
```
|
2068
|
+
|
2069
|
+
</details>
|
2070
|
+
|
2071
|
+
#### Get balance
|
2072
|
+
|
2073
|
+
Returns the balance for this account.
|
2074
|
+
|
2075
|
+
```python
|
2076
|
+
# options: symbol
|
2077
|
+
websocket.balance({}, ownCallback)
|
2078
|
+
```
|
2079
|
+
|
2080
|
+
<details>
|
2081
|
+
<summary>View Response</summary>
|
2082
|
+
|
2083
|
+
```python
|
2084
|
+
[
|
2085
|
+
{"symbol": "EUR", "available": "2599.95", "inOrder": "2022.65"},
|
2086
|
+
{"symbol": "BTC", "available": "1.65437", "inOrder": "0.079398"},
|
2087
|
+
{"symbol": "ADA", "available": "4.8", "inOrder": "0"},
|
2088
|
+
{"symbol": "BCH", "available": "0.00952811", "inOrder": "0"},
|
2089
|
+
{"symbol": "BSV", "available": "0.00952811", "inOrder": "0"},
|
2090
|
+
...,
|
2091
|
+
]
|
2092
|
+
```
|
2093
|
+
|
2094
|
+
</details>
|
2095
|
+
|
2096
|
+
#### Deposit assets
|
2097
|
+
|
2098
|
+
Returns the address which can be used to deposit funds.
|
2099
|
+
|
2100
|
+
```python
|
2101
|
+
websocket.depositAssets("BTC", ownCallback)
|
2102
|
+
```
|
2103
|
+
|
2104
|
+
<details>
|
2105
|
+
<summary>View Response</summary>
|
2106
|
+
|
2107
|
+
```python
|
2108
|
+
{"address": "BitcoinAddress"}
|
2109
|
+
```
|
2110
|
+
|
2111
|
+
</details>
|
2112
|
+
|
2113
|
+
#### Withdraw assets
|
2114
|
+
|
2115
|
+
Can be used to withdraw funds from Bitvavo.
|
2116
|
+
|
2117
|
+
```python
|
2118
|
+
# optional parameters: paymentId, internal, addWithdrawalFee
|
2119
|
+
websocket.withdrawAssets("BTC", "1", "BitcoinAddress", {}, ownCallback)
|
2120
|
+
```
|
2121
|
+
|
2122
|
+
<details>
|
2123
|
+
<summary>View Response</summary>
|
2124
|
+
|
2125
|
+
```python
|
2126
|
+
{"success": True, "symbol": "BTC", "amount": "1"}
|
2127
|
+
```
|
2128
|
+
|
2129
|
+
</details>
|
2130
|
+
|
2131
|
+
#### Get deposit history
|
2132
|
+
|
2133
|
+
Returns the deposit history of your account.
|
2134
|
+
|
2135
|
+
```python
|
2136
|
+
# options: symbol, limit, start, end
|
2137
|
+
websocket.depositHistory({}, ownCallback)
|
2138
|
+
```
|
2139
|
+
|
2140
|
+
<details>
|
2141
|
+
<summary>View Response</summary>
|
2142
|
+
|
2143
|
+
```python
|
2144
|
+
[
|
2145
|
+
{
|
2146
|
+
"timestamp": 1521550025000,
|
2147
|
+
"symbol": "EUR",
|
2148
|
+
"amount": "1",
|
2149
|
+
"fee": "0",
|
2150
|
+
"status": "completed",
|
2151
|
+
"address": "NL12RABO324234234",
|
2152
|
+
},
|
2153
|
+
{
|
2154
|
+
"timestamp": 1511873910000,
|
2155
|
+
"symbol": "BTC",
|
2156
|
+
"amount": "0.099",
|
2157
|
+
"fee": "0",
|
2158
|
+
"status": "completed",
|
2159
|
+
"txId": "0c6497e608212a516b8218674cb0ca04f65b67a00fe8bddaa1ecb03e9b029255",
|
2160
|
+
},
|
2161
|
+
...,
|
2162
|
+
]
|
2163
|
+
```
|
2164
|
+
|
2165
|
+
</details>
|
2166
|
+
|
2167
|
+
#### Get withdrawal history
|
2168
|
+
|
2169
|
+
Returns the withdrawal history of an account.
|
2170
|
+
|
2171
|
+
```python
|
2172
|
+
# options: symbol, limit, start, end
|
2173
|
+
websocket.withdrawalHistory({}, ownCallback)
|
2174
|
+
```
|
2175
|
+
|
2176
|
+
<details>
|
2177
|
+
<summary>View Response</summary>
|
2178
|
+
|
2179
|
+
```python
|
2180
|
+
[
|
2181
|
+
{
|
2182
|
+
"timestamp": 1548425559000,
|
2183
|
+
"symbol": "BTC",
|
2184
|
+
"amount": "0.09994",
|
2185
|
+
"fee": "0.00006",
|
2186
|
+
"status": "awaiting_processing",
|
2187
|
+
"address": "1CqtG5z55x7bYD5GxsAXPx59DEyujs4bjm",
|
2188
|
+
},
|
2189
|
+
{
|
2190
|
+
"timestamp": 1548409721000,
|
2191
|
+
"symbol": "EUR",
|
2192
|
+
"amount": "50",
|
2193
|
+
"fee": "0",
|
2194
|
+
"status": "completed",
|
2195
|
+
"address": "NL123BIM",
|
2196
|
+
},
|
2197
|
+
{
|
2198
|
+
"timestamp": 1537803091000,
|
2199
|
+
"symbol": "BTC",
|
2200
|
+
"amount": "0.01939",
|
2201
|
+
"fee": "0.00002",
|
2202
|
+
"status": "completed",
|
2203
|
+
"txId": "da2299c86fce67eb899aeaafbe1f81cf663a3850cf9f3337c92b2d87945532db",
|
2204
|
+
"address": "3QpyxeA7yWWsSURXEmuBBzHpxjqn7Rbyme",
|
2205
|
+
},
|
2206
|
+
...,
|
2207
|
+
]
|
2208
|
+
```
|
2209
|
+
|
2210
|
+
</details>
|
2211
|
+
|
2212
|
+
### Subscriptions
|
2213
|
+
|
2214
|
+
#### Ticker subscription
|
2215
|
+
|
2216
|
+
Sends an update every time the best bid, best ask or last price changed.
|
2217
|
+
|
2218
|
+
```python
|
2219
|
+
websocket.subscriptionTicker("BTC-EUR", ownCallback)
|
2220
|
+
```
|
2221
|
+
|
2222
|
+
<details>
|
2223
|
+
<summary>View Response</summary>
|
2224
|
+
|
2225
|
+
```python
|
2226
|
+
{
|
2227
|
+
"event": "ticker",
|
2228
|
+
"market": "BTC-EUR",
|
2229
|
+
"bestBid": "9286.9",
|
2230
|
+
"bestBidSize": "0.10705272",
|
2231
|
+
"bestAsk": "9287.6",
|
2232
|
+
"bestAskSize": "0.10990704",
|
2233
|
+
"lastPrice": "9335",
|
2234
|
+
}
|
2235
|
+
```
|
2236
|
+
|
2237
|
+
</details>
|
2238
|
+
|
2239
|
+
#### Ticker 24 hour subscription
|
2240
|
+
|
2241
|
+
Updated ticker24h objects are sent on this channel once per second. A ticker24h
|
2242
|
+
object is considered updated if one of the values besides timestamp has changed.
|
2243
|
+
|
2244
|
+
```python
|
2245
|
+
websocket.subscriptionTicker24h("BTC-EUR", ownCallback)
|
2246
|
+
```
|
2247
|
+
|
2248
|
+
<details>
|
2249
|
+
<summary>View Response</summary>
|
2250
|
+
|
2251
|
+
```python
|
2252
|
+
{
|
2253
|
+
"market": "BTC-EUR",
|
2254
|
+
"open": "10140",
|
2255
|
+
"high": "10216",
|
2256
|
+
"low": "10062",
|
2257
|
+
"last": "10119",
|
2258
|
+
"volume": "37.59541492",
|
2259
|
+
"volumeQuote": "381752.87",
|
2260
|
+
"bid": "10118",
|
2261
|
+
"bidSize": "0.07267404",
|
2262
|
+
"ask": "10119",
|
2263
|
+
"askSize": "0.09386124",
|
2264
|
+
"timestamp": 1565685285795,
|
2265
|
+
}
|
2266
|
+
```
|
2267
|
+
|
2268
|
+
</details>
|
2269
|
+
|
2270
|
+
#### Account subscription
|
2271
|
+
|
2272
|
+
Sends an update whenever an event happens which is related to the account. These
|
2273
|
+
are ‘order’ events (create, update, cancel) or ‘fill’ events (a trade occurred).
|
2274
|
+
|
2275
|
+
```python
|
2276
|
+
websocket.subscriptionAccount("BTC-EUR", ownCallback)
|
2277
|
+
```
|
2278
|
+
|
2279
|
+
<details>
|
2280
|
+
<summary>View Response</summary>
|
2281
|
+
|
2282
|
+
```python
|
2283
|
+
Fill:
|
2284
|
+
{
|
2285
|
+
"event": "fill",
|
2286
|
+
"timestamp": 1548674189411,
|
2287
|
+
"market": "BTC-EUR",
|
2288
|
+
"orderId": "78fef2d4-6278-4f4b-ade9-1a1c438680e5",
|
2289
|
+
"fillId": "90d49d30-9d90-427d-ab4d-35d18c3356cb",
|
2290
|
+
"side": "buy",
|
2291
|
+
"amount": "0.03322362",
|
2292
|
+
"price": "3002.4",
|
2293
|
+
"taker": true,
|
2294
|
+
"fee": "0.249403312",
|
2295
|
+
"feeCurrency": "EUR"
|
2296
|
+
}
|
2297
|
+
|
2298
|
+
Order:
|
2299
|
+
{
|
2300
|
+
"event": "order",
|
2301
|
+
"orderId": "78fef2d4-6278-4f4b-ade9-1a1c438680e5",
|
2302
|
+
"market": "BTC-EUR",
|
2303
|
+
"created": 1548674189406,
|
2304
|
+
"updated": 1548674189406,
|
2305
|
+
"status": "filled",
|
2306
|
+
"side": "buy",
|
2307
|
+
"orderType": "market",
|
2308
|
+
"amountQuote": "100",
|
2309
|
+
"amountQuoteRemaining": "0.249403312",
|
2310
|
+
"onHold": "0",
|
2311
|
+
"onHoldCurrency": "EUR",
|
2312
|
+
"selfTradePrevention": "decrementAndCancel",
|
2313
|
+
"visible": false,
|
2314
|
+
"disableMarketProtection": false
|
2315
|
+
}
|
2316
|
+
```
|
2317
|
+
|
2318
|
+
</details>
|
2319
|
+
|
2320
|
+
#### Candles subscription
|
2321
|
+
|
2322
|
+
Sends an updated candle after each trade for the specified interval and market.
|
2323
|
+
|
2324
|
+
```python
|
2325
|
+
websocket.subscriptionCandles("BTC-EUR", "1h", ownCallback)
|
2326
|
+
```
|
2327
|
+
|
2328
|
+
<details>
|
2329
|
+
<summary>View Response</summary>
|
2330
|
+
|
2331
|
+
```python
|
2332
|
+
{
|
2333
|
+
"event": "candle",
|
2334
|
+
"market": "BTC-EUR",
|
2335
|
+
"interval": "1h",
|
2336
|
+
"candle": [[1548676800000, "2999.3", "2999.3", "2990.5", "2999.3", "11.15058838"]],
|
2337
|
+
}
|
2338
|
+
```
|
2339
|
+
|
2340
|
+
</details>
|
2341
|
+
|
2342
|
+
#### Trades subscription
|
2343
|
+
|
2344
|
+
Sends an update whenever a trade has happened on this market. For your own
|
2345
|
+
trades, please subscribe to account.
|
2346
|
+
|
2347
|
+
```python
|
2348
|
+
websocket.subscriptionTrades("BTC-EUR", ownCallback)
|
2349
|
+
```
|
2350
|
+
|
2351
|
+
<details>
|
2352
|
+
<summary>View Response</summary>
|
2353
|
+
|
2354
|
+
```python
|
2355
|
+
{
|
2356
|
+
"event": "trade",
|
2357
|
+
"timestamp": 1548677539543,
|
2358
|
+
"market": "BTC-EUR",
|
2359
|
+
"id": "d91bf798-e704-4f09-95f7-3444f8109346",
|
2360
|
+
"amount": "0.88114879",
|
2361
|
+
"price": "2992.2",
|
2362
|
+
"side": "buy",
|
2363
|
+
}
|
2364
|
+
```
|
2365
|
+
|
2366
|
+
</details>
|
2367
|
+
|
2368
|
+
#### Book subscription
|
2369
|
+
|
2370
|
+
Sends an update whenever the order book for this specific market has changed. A
|
2371
|
+
list of tuples (\[price, amount\]) are returned, where amount ‘0’ means that
|
2372
|
+
there are no more orders at this price. If you wish to maintain your own copy of
|
2373
|
+
the order book, consider using the next function.
|
2374
|
+
|
2375
|
+
```python
|
2376
|
+
websocket.subscriptionBookUpdate("BTC-EUR", ownCallback)
|
2377
|
+
```
|
2378
|
+
|
2379
|
+
<details>
|
2380
|
+
<summary>View Response</summary>
|
2381
|
+
|
2382
|
+
```python
|
2383
|
+
{
|
2384
|
+
"event": "book",
|
2385
|
+
"market": "BTC-EUR",
|
2386
|
+
"nonce": 14870,
|
2387
|
+
"bids": [["2994.3", "0"], ["2994.2", "0.00334147"]],
|
2388
|
+
"asks": [],
|
2389
|
+
}
|
2390
|
+
```
|
2391
|
+
|
2392
|
+
</details>
|
2393
|
+
|
2394
|
+
#### Book subscription with local copy
|
2395
|
+
|
2396
|
+
This is a combination of get book per market and the book subscription which
|
2397
|
+
maintains a local copy. On every update to the order book, the entire order book
|
2398
|
+
is returned to the callback, while the book subscription will only return
|
2399
|
+
updates to the book.
|
2400
|
+
|
2401
|
+
```python
|
2402
|
+
websocket.subscriptionBook("BTC-EUR", ownCallback)
|
2403
|
+
```
|
2404
|
+
|
2405
|
+
<details>
|
2406
|
+
<summary>View Response</summary>
|
2407
|
+
|
2408
|
+
```python
|
2409
|
+
{
|
2410
|
+
"bids": [
|
2411
|
+
["2996.7", "0.36620062"],
|
2412
|
+
["2994.8", "0.04231826"],
|
2413
|
+
["2994.2", "0.16617026"],
|
2414
|
+
["2993.7", "0.23002489"],
|
2415
|
+
...,
|
2416
|
+
],
|
2417
|
+
"asks": [
|
2418
|
+
["2998.6", "8.64251588"],
|
2419
|
+
["3001.2", "5.91405558"],
|
2420
|
+
["3002.4", "3.5765691"],
|
2421
|
+
["3003.9", "3.842524"],
|
2422
|
+
...,
|
2423
|
+
],
|
2424
|
+
"nonce": 21919,
|
2425
|
+
"market": "BTC-EUR",
|
2426
|
+
}
|
2427
|
+
```
|
2428
|
+
|
2429
|
+
</details>
|