bitvavo-api-upgraded 2.2.0__tar.gz → 2.3.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-2.2.0 → bitvavo_api_upgraded-2.3.0}/PKG-INFO +2 -1
- {bitvavo_api_upgraded-2.2.0 → bitvavo_api_upgraded-2.3.0}/pyproject.toml +3 -2
- {bitvavo_api_upgraded-2.2.0 → bitvavo_api_upgraded-2.3.0}/src/bitvavo_api_upgraded/bitvavo.py +398 -103
- {bitvavo_api_upgraded-2.2.0 → bitvavo_api_upgraded-2.3.0}/README.md +0 -0
- {bitvavo_api_upgraded-2.2.0 → bitvavo_api_upgraded-2.3.0}/src/bitvavo_api_upgraded/__init__.py +0 -0
- {bitvavo_api_upgraded-2.2.0 → bitvavo_api_upgraded-2.3.0}/src/bitvavo_api_upgraded/dataframe_utils.py +0 -0
- {bitvavo_api_upgraded-2.2.0 → bitvavo_api_upgraded-2.3.0}/src/bitvavo_api_upgraded/helper_funcs.py +0 -0
- {bitvavo_api_upgraded-2.2.0 → bitvavo_api_upgraded-2.3.0}/src/bitvavo_api_upgraded/py.typed +0 -0
- {bitvavo_api_upgraded-2.2.0 → bitvavo_api_upgraded-2.3.0}/src/bitvavo_api_upgraded/settings.py +0 -0
- {bitvavo_api_upgraded-2.2.0 → bitvavo_api_upgraded-2.3.0}/src/bitvavo_api_upgraded/type_aliases.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: bitvavo-api-upgraded
|
3
|
-
Version: 2.
|
3
|
+
Version: 2.3.0
|
4
4
|
Summary: A unit-tested fork of the Bitvavo API
|
5
5
|
Author: Bitvavo BV (original code), NostraDavid
|
6
6
|
Author-email: NostraDavid <55331731+NostraDavid@users.noreply.github.com>
|
@@ -21,6 +21,7 @@ Classifier: Programming Language :: Python :: 3.12
|
|
21
21
|
Classifier: Programming Language :: Python :: 3.13
|
22
22
|
Classifier: Programming Language :: Python
|
23
23
|
Classifier: Typing :: Typed
|
24
|
+
Requires-Dist: deprecated>=1.2.18
|
24
25
|
Requires-Dist: pydantic-settings==2.*,>=2.6
|
25
26
|
Requires-Dist: requests==2.*,>=2.26
|
26
27
|
Requires-Dist: structlog>=21.5,==25.*
|
@@ -6,7 +6,7 @@ build-backend = "uv_build"
|
|
6
6
|
# https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html
|
7
7
|
[project]
|
8
8
|
name = "bitvavo-api-upgraded"
|
9
|
-
version = "2.
|
9
|
+
version = "2.3.0"
|
10
10
|
description = "A unit-tested fork of the Bitvavo API"
|
11
11
|
readme = "README.md"
|
12
12
|
requires-python = ">=3.9"
|
@@ -37,6 +37,7 @@ classifiers = [
|
|
37
37
|
"Typing :: Typed",
|
38
38
|
]
|
39
39
|
dependencies = [
|
40
|
+
"deprecated>=1.2.18", # for deprecating functions
|
40
41
|
"pydantic-settings==2.*, >=2.6", # to handle settings
|
41
42
|
"requests==2.*, >=2.26", # to make http requests
|
42
43
|
"structlog==25.*, >=21.5", # for logging
|
@@ -104,7 +105,7 @@ dev-dependencies = [
|
|
104
105
|
]
|
105
106
|
|
106
107
|
[tool.bumpversion]
|
107
|
-
current_version = "2.
|
108
|
+
current_version = "2.3.0"
|
108
109
|
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
|
109
110
|
serialize = ["{major}.{minor}.{patch}"]
|
110
111
|
search = "{current_version}"
|
{bitvavo_api_upgraded-2.2.0 → bitvavo_api_upgraded-2.3.0}/src/bitvavo_api_upgraded/bitvavo.py
RENAMED
@@ -11,6 +11,7 @@ from threading import Thread
|
|
11
11
|
from typing import Any, Callable
|
12
12
|
|
13
13
|
import websocket as ws_lib
|
14
|
+
from deprecated import deprecated
|
14
15
|
from requests import delete, get, post, put
|
15
16
|
from structlog.stdlib import get_logger
|
16
17
|
from websocket import WebSocketApp # missing stubs for WebSocketApp
|
@@ -25,7 +26,12 @@ configure_loggers()
|
|
25
26
|
logger = get_logger(__name__)
|
26
27
|
|
27
28
|
|
29
|
+
@deprecated(version="2.2.0", reason="Use create_signature instead")
|
28
30
|
def createSignature(timestamp: ms, method: str, url: str, body: anydict | None, api_secret: str) -> str:
|
31
|
+
return create_signature(timestamp, method, url, body, api_secret)
|
32
|
+
|
33
|
+
|
34
|
+
def create_signature(timestamp: ms, method: str, url: str, body: anydict | None, api_secret: str) -> str:
|
29
35
|
string = f"{timestamp}{method}/v2{url}"
|
30
36
|
if body is not None and len(body.keys()) > 0:
|
31
37
|
string += json.dumps(body, separators=(",", ":"))
|
@@ -33,7 +39,12 @@ def createSignature(timestamp: ms, method: str, url: str, body: anydict | None,
|
|
33
39
|
return signature
|
34
40
|
|
35
41
|
|
42
|
+
@deprecated(version="2.2.0", reason="Use create_postfix instead")
|
36
43
|
def createPostfix(options: anydict | None) -> str:
|
44
|
+
return create_postfix(options)
|
45
|
+
|
46
|
+
|
47
|
+
def create_postfix(options: anydict | None) -> str:
|
37
48
|
"""Generate a URL postfix, based on the `options` dict.
|
38
49
|
|
39
50
|
---
|
@@ -67,18 +78,37 @@ def _epoch_millis(dt: dt.datetime) -> int:
|
|
67
78
|
return int(dt.timestamp() * 1000)
|
68
79
|
|
69
80
|
|
81
|
+
@deprecated(version="2.2.0", reason="Use asks_compare instead")
|
70
82
|
def asksCompare(a: float, b: float) -> bool:
|
83
|
+
return asks_compare(a, b)
|
84
|
+
|
85
|
+
|
86
|
+
def asks_compare(a: float, b: float) -> bool:
|
71
87
|
return a < b
|
72
88
|
|
73
89
|
|
90
|
+
@deprecated(version="2.2.0", reason="Use bids_compare instead")
|
74
91
|
def bidsCompare(a: float, b: float) -> bool:
|
92
|
+
return bids_compare(a, b)
|
93
|
+
|
94
|
+
|
95
|
+
def bids_compare(a: float, b: float) -> bool:
|
75
96
|
return a > b
|
76
97
|
|
77
98
|
|
99
|
+
@deprecated(version="2.2.0", reason="Use sort_and_insert instead")
|
78
100
|
def sortAndInsert(
|
79
101
|
asks_or_bids: list[list[str]],
|
80
102
|
update: list[list[str]],
|
81
103
|
compareFunc: Callable[[float, float], bool],
|
104
|
+
) -> list[list[str]] | errordict:
|
105
|
+
return sort_and_insert(asks_or_bids, update, compareFunc)
|
106
|
+
|
107
|
+
|
108
|
+
def sort_and_insert(
|
109
|
+
asks_or_bids: list[list[str]],
|
110
|
+
update: list[list[str]],
|
111
|
+
compareFunc: Callable[[float, float], bool],
|
82
112
|
) -> list[list[str]] | errordict:
|
83
113
|
for updateEntry in update:
|
84
114
|
entrySet: bool = False
|
@@ -101,7 +131,12 @@ def sortAndInsert(
|
|
101
131
|
return asks_or_bids
|
102
132
|
|
103
133
|
|
134
|
+
@deprecated(version="2.2.0", reason="Use process_local_book instead")
|
104
135
|
def processLocalBook(ws: Bitvavo.WebSocketAppFacade, message: anydict) -> None:
|
136
|
+
return process_local_book(ws, message)
|
137
|
+
|
138
|
+
|
139
|
+
def process_local_book(ws: Bitvavo.WebSocketAppFacade, message: anydict) -> None:
|
105
140
|
market: str = ""
|
106
141
|
if "action" in message:
|
107
142
|
if message["action"] == "getBook":
|
@@ -115,10 +150,10 @@ def processLocalBook(ws: Bitvavo.WebSocketAppFacade, message: anydict) -> None:
|
|
115
150
|
|
116
151
|
if message["nonce"] != ws.localBook[market]["nonce"] + 1:
|
117
152
|
# I think I've fixed this, by looking at the other Bitvavo repos (search for 'nonce' or '!=' 😆)
|
118
|
-
ws.
|
153
|
+
ws.subscription_book(market, ws.callbacks[market])
|
119
154
|
return
|
120
|
-
ws.localBook[market]["bids"] =
|
121
|
-
ws.localBook[market]["asks"] =
|
155
|
+
ws.localBook[market]["bids"] = sort_and_insert(ws.localBook[market]["bids"], message["bids"], bids_compare)
|
156
|
+
ws.localBook[market]["asks"] = sort_and_insert(ws.localBook[market]["asks"], message["asks"], asks_compare)
|
122
157
|
ws.localBook[market]["nonce"] = message["nonce"]
|
123
158
|
|
124
159
|
if market != "":
|
@@ -423,7 +458,11 @@ class Bitvavo:
|
|
423
458
|
)
|
424
459
|
time.sleep(napTime + 1) # +1 to add a tiny bit of buffer time
|
425
460
|
|
461
|
+
@deprecated(version="2.2.0", reason="Use calc_lag instead")
|
426
462
|
def calcLag(self) -> ms:
|
463
|
+
return self.calc_lag()
|
464
|
+
|
465
|
+
def calc_lag(self) -> ms:
|
427
466
|
"""
|
428
467
|
Calculate the time difference between the client and server; use this value with BITVAVO_API_UPGRADED_LAG,
|
429
468
|
when you make an api call, to precent 304 errors.
|
@@ -445,8 +484,12 @@ class Bitvavo:
|
|
445
484
|
|
446
485
|
return ms(sum(lag_list) / len(lag_list))
|
447
486
|
|
487
|
+
@deprecated(version="2.2.0", reason="Use get_remaining_limit instead")
|
448
488
|
def getRemainingLimit(self) -> int:
|
449
|
-
|
489
|
+
return self.get_remaining_limit()
|
490
|
+
|
491
|
+
def get_remaining_limit(self) -> int:
|
492
|
+
"""Get the remaining rate limit
|
450
493
|
|
451
494
|
---
|
452
495
|
Returns:
|
@@ -456,7 +499,11 @@ class Bitvavo:
|
|
456
499
|
"""
|
457
500
|
return self.rateLimitRemaining
|
458
501
|
|
502
|
+
@deprecated(version="2.2.0", reason="Use get_remaining_limit instead")
|
459
503
|
def updateRateLimit(self, response: anydict | errordict) -> None:
|
504
|
+
return self.update_rate_limit(response)
|
505
|
+
|
506
|
+
def update_rate_limit(self, response: anydict | errordict) -> None:
|
460
507
|
"""
|
461
508
|
Update the rate limited
|
462
509
|
|
@@ -488,10 +535,18 @@ class Bitvavo:
|
|
488
535
|
logger.info("napping-until-ban-lifted")
|
489
536
|
time.sleep(timeToWait + 1) # plus one second to ENSURE we're able to run again.
|
490
537
|
|
538
|
+
@deprecated(version="2.2.0", reason="Use public_request instead")
|
491
539
|
def publicRequest(
|
492
540
|
self,
|
493
541
|
url: str,
|
494
542
|
rateLimitingWeight: int = 1,
|
543
|
+
) -> list[anydict] | list[list[str]] | intdict | strdict | anydict | errordict:
|
544
|
+
return self.public_request(url, rateLimitingWeight)
|
545
|
+
|
546
|
+
def public_request(
|
547
|
+
self,
|
548
|
+
url: str,
|
549
|
+
rateLimitingWeight: int = 1,
|
495
550
|
) -> list[anydict] | list[list[str]] | intdict | strdict | anydict | errordict:
|
496
551
|
"""Execute a request to the public part of the API; no API key and/or SECRET necessary.
|
497
552
|
Will return the reponse as one of three types.
|
@@ -541,7 +596,7 @@ class Bitvavo:
|
|
541
596
|
|
542
597
|
if api_key:
|
543
598
|
now = time_ms() + bitvavo_upgraded_settings.LAG
|
544
|
-
sig =
|
599
|
+
sig = create_signature(now, "GET", url.replace(self.base, ""), None, api_secret)
|
545
600
|
headers = {
|
546
601
|
"bitvavo-access-key": api_key,
|
547
602
|
"bitvavo-access-signature": sig,
|
@@ -559,10 +614,11 @@ class Bitvavo:
|
|
559
614
|
self._update_rate_limit_for_key(key_index, dict(r.headers))
|
560
615
|
|
561
616
|
# Also update legacy rate limit tracking
|
562
|
-
self.
|
617
|
+
self.update_rate_limit(r.json() if "error" in r.json() else dict(r.headers))
|
563
618
|
|
564
619
|
return r.json() # type:ignore[no-any-return]
|
565
620
|
|
621
|
+
@deprecated(version="2.2.0", reason="Use private_request instead")
|
566
622
|
def privateRequest(
|
567
623
|
self,
|
568
624
|
endpoint: str,
|
@@ -570,6 +626,16 @@ class Bitvavo:
|
|
570
626
|
body: anydict | None = None,
|
571
627
|
method: str = "GET",
|
572
628
|
rateLimitingWeight: int = 1,
|
629
|
+
) -> list[anydict] | list[list[str]] | intdict | strdict | anydict | errordict:
|
630
|
+
return self.private_request(endpoint, postfix, body, method, rateLimitingWeight)
|
631
|
+
|
632
|
+
def private_request(
|
633
|
+
self,
|
634
|
+
endpoint: str,
|
635
|
+
postfix: str,
|
636
|
+
body: anydict | None = None,
|
637
|
+
method: str = "GET",
|
638
|
+
rateLimitingWeight: int = 1,
|
573
639
|
) -> list[anydict] | list[list[str]] | intdict | strdict | anydict | errordict:
|
574
640
|
"""Execute a request to the private part of the API. API key and SECRET are required.
|
575
641
|
Will return the reponse as one of three types.
|
@@ -616,7 +682,7 @@ class Bitvavo:
|
|
616
682
|
self._current_api_secret = api_secret
|
617
683
|
|
618
684
|
now = time_ms() + bitvavo_upgraded_settings.LAG
|
619
|
-
sig =
|
685
|
+
sig = create_signature(now, method, (endpoint + postfix), body, api_secret)
|
620
686
|
url = self.base + endpoint + postfix
|
621
687
|
headers = {
|
622
688
|
"bitvavo-access-key": api_key,
|
@@ -651,7 +717,7 @@ class Bitvavo:
|
|
651
717
|
self._update_rate_limit_for_key(key_index, dict(r.headers))
|
652
718
|
|
653
719
|
# Also update legacy rate limit tracking
|
654
|
-
self.
|
720
|
+
self.update_rate_limit(r.json() if "error" in r.json() else dict(r.headers))
|
655
721
|
|
656
722
|
return r.json()
|
657
723
|
|
@@ -685,7 +751,7 @@ class Bitvavo:
|
|
685
751
|
{"time": 1539180275424 }
|
686
752
|
```
|
687
753
|
"""
|
688
|
-
return self.
|
754
|
+
return self.public_request(f"{self.base}/time") # type: ignore[return-value]
|
689
755
|
|
690
756
|
def markets(
|
691
757
|
self,
|
@@ -763,8 +829,8 @@ class Bitvavo:
|
|
763
829
|
# The specific DataFrame type depends on the selected format.
|
764
830
|
```
|
765
831
|
"""
|
766
|
-
postfix =
|
767
|
-
result = self.
|
832
|
+
postfix = create_postfix(options)
|
833
|
+
result = self.public_request(f"{self.base}/markets{postfix}") # type: ignore[return-value]
|
768
834
|
return convert_to_dataframe(result, output_format)
|
769
835
|
|
770
836
|
def assets(
|
@@ -841,8 +907,8 @@ class Bitvavo:
|
|
841
907
|
# The specific DataFrame type depends on the selected format.
|
842
908
|
```
|
843
909
|
"""
|
844
|
-
postfix =
|
845
|
-
result = self.
|
910
|
+
postfix = create_postfix(options)
|
911
|
+
result = self.public_request(f"{self.base}/assets{postfix}") # type: ignore[return-value]
|
846
912
|
return convert_to_dataframe(result, output_format)
|
847
913
|
|
848
914
|
def book(self, market: str, options: intdict | None = None) -> dict[str, str | int | list[str]] | errordict:
|
@@ -887,14 +953,23 @@ class Bitvavo:
|
|
887
953
|
assert result == 714.48 # EUR can be gained from this bid if it's sold (minus the fee)
|
888
954
|
```
|
889
955
|
"""
|
890
|
-
postfix =
|
891
|
-
return self.
|
956
|
+
postfix = create_postfix(options)
|
957
|
+
return self.public_request(f"{self.base}/{market}/book{postfix}") # type: ignore[return-value]
|
892
958
|
|
959
|
+
@deprecated(version="2.2.0", reason="Use public_trades instead")
|
893
960
|
def publicTrades(
|
894
961
|
self,
|
895
962
|
market: str,
|
896
963
|
options: strintdict | None = None,
|
897
964
|
output_format: OutputFormat = OutputFormat.DICT,
|
965
|
+
) -> list[anydict] | errordict | Any:
|
966
|
+
return self.public_trades(market, options, output_format)
|
967
|
+
|
968
|
+
def public_trades(
|
969
|
+
self,
|
970
|
+
market: str,
|
971
|
+
options: strintdict | None = None,
|
972
|
+
output_format: OutputFormat = OutputFormat.DICT,
|
898
973
|
) -> list[anydict] | errordict | Any:
|
899
974
|
"""Publically available trades
|
900
975
|
|
@@ -963,8 +1038,8 @@ class Bitvavo:
|
|
963
1038
|
# Returns the above data as a DataFrame in the requested format (pandas, polars, etc.)
|
964
1039
|
```
|
965
1040
|
"""
|
966
|
-
postfix =
|
967
|
-
result = self.
|
1041
|
+
postfix = create_postfix(options)
|
1042
|
+
result = self.public_request(f"{self.base}/{market}/trades{postfix}", 5) # type: ignore[return-value]
|
968
1043
|
return convert_to_dataframe(result, output_format)
|
969
1044
|
|
970
1045
|
def candles(
|
@@ -1053,14 +1128,22 @@ class Bitvavo:
|
|
1053
1128
|
options["start"] = _epoch_millis(start)
|
1054
1129
|
if end is not None:
|
1055
1130
|
options["end"] = _epoch_millis(end)
|
1056
|
-
postfix =
|
1057
|
-
result = self.
|
1131
|
+
postfix = create_postfix(options)
|
1132
|
+
result = self.public_request(f"{self.base}/{market}/candles{postfix}") # type: ignore[return-value]
|
1058
1133
|
return convert_candles_to_dataframe(result, output_format)
|
1059
1134
|
|
1135
|
+
@deprecated(version="2.2.0", reason="Use ticker_price instead")
|
1060
1136
|
def tickerPrice(
|
1061
1137
|
self,
|
1062
1138
|
options: strdict | None = None,
|
1063
1139
|
output_format: OutputFormat = OutputFormat.DICT,
|
1140
|
+
) -> list[strdict] | strdict | Any:
|
1141
|
+
return self.ticker_price(options, output_format)
|
1142
|
+
|
1143
|
+
def ticker_price(
|
1144
|
+
self,
|
1145
|
+
options: strdict | None = None,
|
1146
|
+
output_format: OutputFormat = OutputFormat.DICT,
|
1064
1147
|
) -> list[strdict] | strdict | Any:
|
1065
1148
|
"""Get the current price for each market
|
1066
1149
|
|
@@ -1127,14 +1210,22 @@ class Bitvavo:
|
|
1127
1210
|
# Returns a DataFrame with columns: market, price
|
1128
1211
|
```
|
1129
1212
|
"""
|
1130
|
-
postfix =
|
1131
|
-
result = self.
|
1213
|
+
postfix = create_postfix(options)
|
1214
|
+
result = self.public_request(f"{self.base}/ticker/price{postfix}") # type: ignore[return-value]
|
1132
1215
|
return convert_to_dataframe(result, output_format)
|
1133
1216
|
|
1217
|
+
@deprecated(version="2.2.0", reason="Use ticker_book instead")
|
1134
1218
|
def tickerBook(
|
1135
1219
|
self,
|
1136
1220
|
options: strdict | None = None,
|
1137
1221
|
output_format: OutputFormat = OutputFormat.DICT,
|
1222
|
+
) -> list[strdict] | strdict | Any:
|
1223
|
+
return self.ticker_book(options, output_format)
|
1224
|
+
|
1225
|
+
def ticker_book(
|
1226
|
+
self,
|
1227
|
+
options: strdict | None = None,
|
1228
|
+
output_format: OutputFormat = OutputFormat.DICT,
|
1138
1229
|
) -> list[strdict] | strdict | Any:
|
1139
1230
|
"""Get current bid/ask, bidsize/asksize per market
|
1140
1231
|
|
@@ -1194,8 +1285,8 @@ class Bitvavo:
|
|
1194
1285
|
# Returns a DataFrame with columns: market, bid, ask, bidSize, askSize
|
1195
1286
|
```
|
1196
1287
|
"""
|
1197
|
-
postfix =
|
1198
|
-
result = self.
|
1288
|
+
postfix = create_postfix(options)
|
1289
|
+
result = self.public_request(f"{self.base}/ticker/book{postfix}") # type: ignore[return-value]
|
1199
1290
|
return convert_to_dataframe(result, output_format)
|
1200
1291
|
|
1201
1292
|
def ticker24h(
|
@@ -1283,15 +1374,24 @@ class Bitvavo:
|
|
1283
1374
|
rateLimitingWeight = 25
|
1284
1375
|
if "market" in options:
|
1285
1376
|
rateLimitingWeight = 1
|
1286
|
-
postfix =
|
1287
|
-
result = self.
|
1377
|
+
postfix = create_postfix(options)
|
1378
|
+
result = self.public_request(f"{self.base}/ticker/24h{postfix}", rateLimitingWeight) # type: ignore[return-value]
|
1288
1379
|
return convert_to_dataframe(result, output_format)
|
1289
1380
|
|
1381
|
+
@deprecated(version="2.2.0", reason="Use report_trades instead")
|
1290
1382
|
def reportTrades(
|
1291
1383
|
self,
|
1292
1384
|
market: str,
|
1293
1385
|
options: strintdict | None = None,
|
1294
1386
|
output_format: OutputFormat = OutputFormat.DICT,
|
1387
|
+
) -> list[anydict] | errordict | Any:
|
1388
|
+
return self.report_trades(market, options, output_format)
|
1389
|
+
|
1390
|
+
def report_trades(
|
1391
|
+
self,
|
1392
|
+
market: str,
|
1393
|
+
options: strintdict | None = None,
|
1394
|
+
output_format: OutputFormat = OutputFormat.DICT,
|
1295
1395
|
) -> list[anydict] | errordict | Any:
|
1296
1396
|
"""Get MiCA-compliant trades report for a specific market
|
1297
1397
|
|
@@ -1350,11 +1450,15 @@ class Bitvavo:
|
|
1350
1450
|
]
|
1351
1451
|
```
|
1352
1452
|
"""
|
1353
|
-
postfix =
|
1354
|
-
result = self.
|
1453
|
+
postfix = create_postfix(options)
|
1454
|
+
result = self.public_request(f"{self.base}/report/{market}/trades{postfix}", 5) # type: ignore[return-value]
|
1355
1455
|
return convert_to_dataframe(result, output_format)
|
1356
1456
|
|
1457
|
+
@deprecated(version="2.2.0", reason="Use report_book instead")
|
1357
1458
|
def reportBook(self, market: str, options: intdict | None = None) -> dict[str, str | int | list[str]] | errordict:
|
1459
|
+
return self.report_book(market, options)
|
1460
|
+
|
1461
|
+
def report_book(self, market: str, options: intdict | None = None) -> dict[str, str | int | list[str]] | errordict:
|
1358
1462
|
"""Get MiCA-compliant order book report for a specific market
|
1359
1463
|
|
1360
1464
|
Returns the list of all bids and asks for the specified market, sorted by price.
|
@@ -1391,10 +1495,14 @@ class Bitvavo:
|
|
1391
1495
|
}
|
1392
1496
|
```
|
1393
1497
|
"""
|
1394
|
-
postfix =
|
1395
|
-
return self.
|
1498
|
+
postfix = create_postfix(options)
|
1499
|
+
return self.public_request(f"{self.base}/report/{market}/book{postfix}") # type: ignore[return-value]
|
1396
1500
|
|
1501
|
+
@deprecated(version="2.2.0", reason="Use place_order instead")
|
1397
1502
|
def placeOrder(self, market: str, side: str, orderType: str, operatorId: int, body: anydict) -> anydict:
|
1503
|
+
return self.place_order(market, side, orderType, operatorId, body)
|
1504
|
+
|
1505
|
+
def place_order(self, market: str, side: str, orderType: str, operatorId: int, body: anydict) -> anydict:
|
1398
1506
|
"""Place a new order on the exchange
|
1399
1507
|
|
1400
1508
|
---
|
@@ -1523,9 +1631,13 @@ class Bitvavo:
|
|
1523
1631
|
body["side"] = side
|
1524
1632
|
body["orderType"] = orderType
|
1525
1633
|
body["operatorId"] = operatorId
|
1526
|
-
return self.
|
1634
|
+
return self.private_request("/order", "", body, "POST") # type: ignore[return-value]
|
1527
1635
|
|
1636
|
+
@deprecated(version="2.2.0", reason="Use update_order instead")
|
1528
1637
|
def updateOrder(self, market: str, orderId: str, operatorId: int, body: anydict) -> anydict:
|
1638
|
+
return self.update_order(market, orderId, operatorId, body)
|
1639
|
+
|
1640
|
+
def update_order(self, market: str, orderId: str, operatorId: int, body: anydict) -> anydict:
|
1529
1641
|
"""Update an existing order for a specific market. Make sure that at least one of the optional parameters is set, otherwise nothing will be updated.
|
1530
1642
|
|
1531
1643
|
---
|
@@ -1609,14 +1721,24 @@ class Bitvavo:
|
|
1609
1721
|
body["market"] = market
|
1610
1722
|
body["orderId"] = orderId
|
1611
1723
|
body["operatorId"] = operatorId
|
1612
|
-
return self.
|
1724
|
+
return self.private_request("/order", "", body, "PUT") # type: ignore[return-value]
|
1613
1725
|
|
1726
|
+
@deprecated(version="2.2.0", reason="Use cancel_order instead")
|
1614
1727
|
def cancelOrder(
|
1615
1728
|
self,
|
1616
1729
|
market: str,
|
1617
1730
|
operatorId: int,
|
1618
1731
|
orderId: str | None = None,
|
1619
1732
|
clientOrderId: str | None = None,
|
1733
|
+
) -> strdict:
|
1734
|
+
return self.cancel_order(market, operatorId, orderId, clientOrderId)
|
1735
|
+
|
1736
|
+
def cancel_order(
|
1737
|
+
self,
|
1738
|
+
market: str,
|
1739
|
+
operatorId: int,
|
1740
|
+
orderId: str | None = None,
|
1741
|
+
clientOrderId: str | None = None,
|
1620
1742
|
) -> strdict:
|
1621
1743
|
"""Cancel an existing order for a specific market
|
1622
1744
|
|
@@ -1657,10 +1779,14 @@ class Bitvavo:
|
|
1657
1779
|
elif orderId is not None:
|
1658
1780
|
params["orderId"] = orderId
|
1659
1781
|
|
1660
|
-
postfix =
|
1661
|
-
return self.
|
1782
|
+
postfix = create_postfix(params)
|
1783
|
+
return self.private_request("/order", postfix, {}, "DELETE") # type: ignore[return-value]
|
1662
1784
|
|
1785
|
+
@deprecated(version="2.2.0", reason="Use get_order instead")
|
1663
1786
|
def getOrder(self, market: str, orderId: str) -> list[anydict] | errordict:
|
1787
|
+
return self.get_order(market, orderId)
|
1788
|
+
|
1789
|
+
def get_order(self, market: str, orderId: str) -> list[anydict] | errordict:
|
1664
1790
|
"""Get an existing order for a specific market
|
1665
1791
|
|
1666
1792
|
---
|
@@ -1722,10 +1848,14 @@ class Bitvavo:
|
|
1722
1848
|
}
|
1723
1849
|
```
|
1724
1850
|
"""
|
1725
|
-
postfix =
|
1726
|
-
return self.
|
1851
|
+
postfix = create_postfix({"market": market, "orderId": orderId})
|
1852
|
+
return self.private_request("/order", postfix, {}, "GET") # type: ignore[return-value]
|
1727
1853
|
|
1854
|
+
@deprecated(version="2.2.0", reason="Use get_orders instead")
|
1728
1855
|
def getOrders(self, market: str, options: anydict | None = None) -> list[anydict] | errordict:
|
1856
|
+
return self.get_orders(market, options)
|
1857
|
+
|
1858
|
+
def get_orders(self, market: str, options: anydict | None = None) -> list[anydict] | errordict:
|
1729
1859
|
"""Get multiple existing orders for a specific market
|
1730
1860
|
|
1731
1861
|
---
|
@@ -1798,10 +1928,14 @@ class Bitvavo:
|
|
1798
1928
|
""" # noqa: E501
|
1799
1929
|
options = _default(options, {})
|
1800
1930
|
options["market"] = market
|
1801
|
-
postfix =
|
1802
|
-
return self.
|
1931
|
+
postfix = create_postfix(options)
|
1932
|
+
return self.private_request("/orders", postfix, {}, "GET", 5) # type: ignore[return-value]
|
1803
1933
|
|
1934
|
+
@deprecated(version="2.2.0", reason="Use cancel_orders instead")
|
1804
1935
|
def cancelOrders(self, options: anydict | None = None) -> list[strdict] | errordict:
|
1936
|
+
return self.cancel_orders(options)
|
1937
|
+
|
1938
|
+
def cancel_orders(self, options: anydict | None = None) -> list[strdict] | errordict:
|
1805
1939
|
"""Cancel all existing orders for a specific market (or account)
|
1806
1940
|
|
1807
1941
|
---
|
@@ -1826,10 +1960,14 @@ class Bitvavo:
|
|
1826
1960
|
]
|
1827
1961
|
```
|
1828
1962
|
"""
|
1829
|
-
postfix =
|
1830
|
-
return self.
|
1963
|
+
postfix = create_postfix(options)
|
1964
|
+
return self.private_request("/orders", postfix, {}, "DELETE") # type: ignore[return-value]
|
1831
1965
|
|
1966
|
+
@deprecated(version="2.2.0", reason="Use orders_open instead")
|
1832
1967
|
def ordersOpen(self, options: anydict | None = None) -> list[anydict] | errordict:
|
1968
|
+
return self.orders_open(options)
|
1969
|
+
|
1970
|
+
def orders_open(self, options: anydict | None = None) -> list[anydict] | errordict:
|
1833
1971
|
"""Get all open orders, either for all markets, or a single market
|
1834
1972
|
|
1835
1973
|
---
|
@@ -1898,8 +2036,8 @@ class Bitvavo:
|
|
1898
2036
|
rateLimitingWeight = 25
|
1899
2037
|
if "market" in options:
|
1900
2038
|
rateLimitingWeight = 1
|
1901
|
-
postfix =
|
1902
|
-
return self.
|
2039
|
+
postfix = create_postfix(options)
|
2040
|
+
return self.private_request("/ordersOpen", postfix, {}, "GET", rateLimitingWeight) # type: ignore[return-value]
|
1903
2041
|
|
1904
2042
|
def trades(
|
1905
2043
|
self,
|
@@ -1962,8 +2100,8 @@ class Bitvavo:
|
|
1962
2100
|
""" # noqa: E501
|
1963
2101
|
options = _default(options, {})
|
1964
2102
|
options["market"] = market
|
1965
|
-
postfix =
|
1966
|
-
result = self.
|
2103
|
+
postfix = create_postfix(options)
|
2104
|
+
result = self.private_request("/trades", postfix, {}, "GET", 5) # type: ignore[return-value]
|
1967
2105
|
return convert_to_dataframe(result, output_format)
|
1968
2106
|
|
1969
2107
|
def account(self) -> dict[str, strdict]:
|
@@ -1987,7 +2125,7 @@ class Bitvavo:
|
|
1987
2125
|
}
|
1988
2126
|
```
|
1989
2127
|
"""
|
1990
|
-
return self.
|
2128
|
+
return self.private_request("/account", "", {}, "GET") # type: ignore[return-value]
|
1991
2129
|
|
1992
2130
|
def fees(self, market: str | None = None, quote: str | None = None) -> list[strdict] | errordict:
|
1993
2131
|
"""Get market fees for a specific market or quote currency
|
@@ -2024,8 +2162,8 @@ class Bitvavo:
|
|
2024
2162
|
options["market"] = market
|
2025
2163
|
if quote is not None:
|
2026
2164
|
options["quote"] = quote
|
2027
|
-
postfix =
|
2028
|
-
return self.
|
2165
|
+
postfix = create_postfix(options)
|
2166
|
+
return self.private_request("/account/fees", postfix, {}, "GET") # type: ignore[return-value]
|
2029
2167
|
|
2030
2168
|
def balance(
|
2031
2169
|
self,
|
@@ -2081,11 +2219,15 @@ class Bitvavo:
|
|
2081
2219
|
# with columns: symbol, available, inOrder
|
2082
2220
|
```
|
2083
2221
|
"""
|
2084
|
-
postfix =
|
2085
|
-
result = self.
|
2222
|
+
postfix = create_postfix(options)
|
2223
|
+
result = self.private_request("/balance", postfix, {}, "GET", 5) # type: ignore[return-value]
|
2086
2224
|
return convert_to_dataframe(result, output_format)
|
2087
2225
|
|
2226
|
+
@deprecated(version="2.2.0", reason="Use account_history instead")
|
2088
2227
|
def accountHistory(self, options: strintdict | None = None) -> anydict | errordict:
|
2228
|
+
return self.account_history(options)
|
2229
|
+
|
2230
|
+
def account_history(self, options: strintdict | None = None) -> anydict | errordict:
|
2089
2231
|
"""Get all past transactions for your account
|
2090
2232
|
|
2091
2233
|
---
|
@@ -2129,10 +2271,14 @@ class Bitvavo:
|
|
2129
2271
|
}
|
2130
2272
|
```
|
2131
2273
|
"""
|
2132
|
-
postfix =
|
2133
|
-
return self.
|
2274
|
+
postfix = create_postfix(options)
|
2275
|
+
return self.private_request("/account/history", postfix, {}, "GET") # type: ignore[return-value]
|
2134
2276
|
|
2277
|
+
@deprecated(version="2.2.0", reason="Use deposit_assets instead")
|
2135
2278
|
def depositAssets(self, symbol: str) -> strdict:
|
2279
|
+
return self.deposit_assets(symbol)
|
2280
|
+
|
2281
|
+
def deposit_assets(self, symbol: str) -> strdict:
|
2136
2282
|
"""Get the deposit address (with paymentId for some assets) or bank account information to increase your balance
|
2137
2283
|
|
2138
2284
|
---
|
@@ -2164,10 +2310,14 @@ class Bitvavo:
|
|
2164
2310
|
}
|
2165
2311
|
```
|
2166
2312
|
"""
|
2167
|
-
postfix =
|
2168
|
-
return self.
|
2313
|
+
postfix = create_postfix({"symbol": symbol})
|
2314
|
+
return self.private_request("/deposit", postfix, {}, "GET") # type: ignore[return-value]
|
2169
2315
|
|
2316
|
+
@deprecated(version="2.2.0", reason="Use deposit_history instead")
|
2170
2317
|
def depositHistory(self, options: anydict | None = None) -> list[anydict] | errordict:
|
2318
|
+
return self.deposit_history(options)
|
2319
|
+
|
2320
|
+
def deposit_history(self, options: anydict | None = None) -> list[anydict] | errordict:
|
2171
2321
|
"""Get the deposit history of the account
|
2172
2322
|
|
2173
2323
|
Even when you want something from a single `symbol`, you'll still receive a list with multiple deposits.
|
@@ -2215,10 +2365,14 @@ class Bitvavo:
|
|
2215
2365
|
]
|
2216
2366
|
```
|
2217
2367
|
""" # noqa: E501
|
2218
|
-
postfix =
|
2219
|
-
return self.
|
2368
|
+
postfix = create_postfix(options)
|
2369
|
+
return self.private_request("/depositHistory", postfix, {}, "GET", 5) # type: ignore[return-value]
|
2220
2370
|
|
2371
|
+
@deprecated(version="2.2.0", reason="Use withdraw_assets instead")
|
2221
2372
|
def withdrawAssets(self, symbol: str, amount: str, address: str, body: anydict) -> anydict:
|
2373
|
+
return self.withdraw_assets(symbol, amount, address, body)
|
2374
|
+
|
2375
|
+
def withdraw_assets(self, symbol: str, amount: str, address: str, body: anydict) -> anydict:
|
2222
2376
|
"""Withdraw a coin/token to an external crypto address or bank account.
|
2223
2377
|
|
2224
2378
|
---
|
@@ -2253,12 +2407,20 @@ class Bitvavo:
|
|
2253
2407
|
body["symbol"] = symbol
|
2254
2408
|
body["amount"] = amount
|
2255
2409
|
body["address"] = address
|
2256
|
-
return self.
|
2410
|
+
return self.private_request("/withdrawal", "", body, "POST") # type: ignore[return-value]
|
2257
2411
|
|
2412
|
+
@deprecated(version="2.2.0", reason="Use withdrawal_history instead")
|
2258
2413
|
def withdrawalHistory(
|
2259
2414
|
self,
|
2260
2415
|
options: anydict | None = None,
|
2261
2416
|
output_format: OutputFormat = OutputFormat.DICT,
|
2417
|
+
) -> list[anydict] | errordict | Any:
|
2418
|
+
return self.withdrawal_history(options, output_format)
|
2419
|
+
|
2420
|
+
def withdrawal_history(
|
2421
|
+
self,
|
2422
|
+
options: anydict | None = None,
|
2423
|
+
output_format: OutputFormat = OutputFormat.DICT,
|
2262
2424
|
) -> list[anydict] | errordict | Any:
|
2263
2425
|
"""Get the withdrawal history
|
2264
2426
|
|
@@ -2312,8 +2474,8 @@ class Bitvavo:
|
|
2312
2474
|
]
|
2313
2475
|
```
|
2314
2476
|
""" # noqa: E501
|
2315
|
-
postfix =
|
2316
|
-
result = self.
|
2477
|
+
postfix = create_postfix(options)
|
2478
|
+
result = self.private_request("/withdrawalHistory", postfix, {}, "GET", 5) # type: ignore[return-value]
|
2317
2479
|
return convert_to_dataframe(result, output_format)
|
2318
2480
|
|
2319
2481
|
# API Key Management Helper Methods
|
@@ -2428,7 +2590,11 @@ class Bitvavo:
|
|
2428
2590
|
"rate_limit_reset_at": int(self.rateLimitResetAt),
|
2429
2591
|
}
|
2430
2592
|
|
2593
|
+
@deprecated(version="2.2.0", reason="Use new_websocket instead")
|
2431
2594
|
def newWebsocket(self) -> Bitvavo.WebSocketAppFacade:
|
2595
|
+
return self.new_websocket()
|
2596
|
+
|
2597
|
+
def new_websocket(self) -> Bitvavo.WebSocketAppFacade:
|
2432
2598
|
return Bitvavo.WebSocketAppFacade(self.APIKEY, self.APISECRET, self.ACCESSWINDOW, self.wsUrl, self)
|
2433
2599
|
|
2434
2600
|
class WebSocketAppFacade:
|
@@ -2477,18 +2643,30 @@ class Bitvavo:
|
|
2477
2643
|
self.keepBookCopy = False
|
2478
2644
|
self.localBook: anydict = {}
|
2479
2645
|
|
2646
|
+
@deprecated(version="2.2.0", reason="Use close_socket instead")
|
2480
2647
|
def closeSocket(self) -> None:
|
2648
|
+
return self.close_socket()
|
2649
|
+
|
2650
|
+
def close_socket(self) -> None:
|
2481
2651
|
self.ws.close()
|
2482
2652
|
self.keepAlive = False
|
2483
2653
|
self.receiveThread.join()
|
2484
2654
|
|
2485
|
-
|
2655
|
+
@deprecated(version="2.2.0", reason="Use wait_for_socket instead")
|
2656
|
+
def waitForSocket(self, ws: WebSocketApp, message: str, private: bool) -> None: # noqa: FBT001
|
2657
|
+
return self.wait_for_socket(ws, message, private)
|
2658
|
+
|
2659
|
+
def wait_for_socket(self, ws: WebSocketApp, message: str, private: bool) -> None: # noqa: ARG002, FBT001
|
2486
2660
|
while self.keepAlive:
|
2487
2661
|
if (not private and self.open) or (private and self.authenticated and self.open):
|
2488
2662
|
return
|
2489
2663
|
time.sleep(0.1)
|
2490
2664
|
|
2665
|
+
@deprecated(version="2.2.0", reason="Use do_send instead")
|
2491
2666
|
def doSend(self, ws: WebSocketApp, message: str, private: bool = False) -> None: # noqa: FBT001, FBT002
|
2667
|
+
return self.do_send(ws, message, private)
|
2668
|
+
|
2669
|
+
def do_send(self, ws: WebSocketApp, message: str, private: bool = False) -> None: # noqa: FBT001, FBT002
|
2492
2670
|
# TODO(NostraDavid): add nap-time to the websocket, or do it here; I don't know yet.
|
2493
2671
|
if private and self.APIKEY == "":
|
2494
2672
|
logger.error(
|
@@ -2496,7 +2674,7 @@ class Bitvavo:
|
|
2496
2674
|
tip="set the API key to be able to make private API calls",
|
2497
2675
|
)
|
2498
2676
|
return
|
2499
|
-
self.
|
2677
|
+
self.wait_for_socket(ws, message, private)
|
2500
2678
|
ws.send(message)
|
2501
2679
|
if self.bitvavo.debugging:
|
2502
2680
|
logger.debug("message-sent", message=message)
|
@@ -2509,7 +2687,7 @@ class Bitvavo:
|
|
2509
2687
|
|
2510
2688
|
if "error" in msg_dict:
|
2511
2689
|
if msg_dict["errorCode"] == 105: # noqa: PLR2004
|
2512
|
-
self.bitvavo.
|
2690
|
+
self.bitvavo.update_rate_limit(msg_dict)
|
2513
2691
|
if "error" in callbacks:
|
2514
2692
|
callbacks["error"](msg_dict)
|
2515
2693
|
else:
|
@@ -2609,47 +2787,51 @@ class Bitvavo:
|
|
2609
2787
|
if self.bitvavo.debugging:
|
2610
2788
|
logger.debug("websocket-closed")
|
2611
2789
|
|
2612
|
-
|
2790
|
+
@deprecated(version="2.2.0", reason="Use check_reconnect instead")
|
2791
|
+
def checkReconnect(self) -> None:
|
2792
|
+
return self.check_reconnect()
|
2793
|
+
|
2794
|
+
def check_reconnect(self) -> None: # noqa: C901, PLR0912 (too-complex)
|
2613
2795
|
if "subscriptionTicker" in self.callbacks:
|
2614
2796
|
for market in self.callbacks["subscriptionTicker"]:
|
2615
|
-
self.
|
2797
|
+
self.subscription_ticker(market, self.callbacks["subscriptionTicker"][market])
|
2616
2798
|
if "subscriptionTicker24h" in self.callbacks:
|
2617
2799
|
for market in self.callbacks["subscriptionTicker24h"]:
|
2618
|
-
self.
|
2800
|
+
self.subscription_ticker(market, self.callbacks["subscriptionTicker24h"][market])
|
2619
2801
|
if "subscriptionAccount" in self.callbacks:
|
2620
2802
|
for market in self.callbacks["subscriptionAccount"]:
|
2621
|
-
self.
|
2803
|
+
self.subscription_account(market, self.callbacks["subscriptionAccount"][market])
|
2622
2804
|
if "subscriptionCandles" in self.callbacks:
|
2623
2805
|
for market in self.callbacks["subscriptionCandles"]:
|
2624
2806
|
for interval in self.callbacks["subscriptionCandles"][market]:
|
2625
|
-
self.
|
2807
|
+
self.subscription_candles(
|
2626
2808
|
market,
|
2627
2809
|
interval,
|
2628
2810
|
self.callbacks["subscriptionCandles"][market][interval],
|
2629
2811
|
)
|
2630
2812
|
if "subscriptionTrades" in self.callbacks:
|
2631
2813
|
for market in self.callbacks["subscriptionTrades"]:
|
2632
|
-
self.
|
2814
|
+
self.subscription_trades(market, self.callbacks["subscriptionTrades"][market])
|
2633
2815
|
if "subscriptionBookUpdate" in self.callbacks:
|
2634
2816
|
for market in self.callbacks["subscriptionBookUpdate"]:
|
2635
|
-
self.
|
2817
|
+
self.subscription_book_update(market, self.callbacks["subscriptionBookUpdate"][market])
|
2636
2818
|
if "subscriptionBookUser" in self.callbacks:
|
2637
2819
|
for market in self.callbacks["subscriptionBookUser"]:
|
2638
|
-
self.
|
2820
|
+
self.subscription_book(market, self.callbacks["subscriptionBookUser"][market])
|
2639
2821
|
|
2640
2822
|
def on_open(self, ws: Any) -> None: # noqa: ARG002
|
2641
2823
|
now = time_ms() + bitvavo_upgraded_settings.LAG
|
2642
2824
|
self.open = True
|
2643
2825
|
self.reconnectTimer = 0.5
|
2644
2826
|
if self.APIKEY != "":
|
2645
|
-
self.
|
2827
|
+
self.do_send(
|
2646
2828
|
self.ws,
|
2647
2829
|
json.dumps(
|
2648
2830
|
{
|
2649
2831
|
"window": str(self.ACCESSWINDOW),
|
2650
2832
|
"action": "authenticate",
|
2651
2833
|
"key": self.APIKEY,
|
2652
|
-
"signature":
|
2834
|
+
"signature": create_signature(now, "GET", "/websocket", {}, self.APISECRET),
|
2653
2835
|
"timestamp": now,
|
2654
2836
|
},
|
2655
2837
|
),
|
@@ -2657,10 +2839,14 @@ class Bitvavo:
|
|
2657
2839
|
if self.reconnect:
|
2658
2840
|
if self.bitvavo.debugging:
|
2659
2841
|
logger.debug("reconnecting")
|
2660
|
-
thread = Thread(target=self.
|
2842
|
+
thread = Thread(target=self.check_reconnect)
|
2661
2843
|
thread.start()
|
2662
2844
|
|
2845
|
+
@deprecated(version="2.2.0", reason="Use set_error_callback instead")
|
2663
2846
|
def setErrorCallback(self, callback: Callable[[Any], None]) -> None:
|
2847
|
+
return self.set_error_callback(callback)
|
2848
|
+
|
2849
|
+
def set_error_callback(self, callback: Callable[[Any], None]) -> None:
|
2664
2850
|
self.callbacks["error"] = callback
|
2665
2851
|
|
2666
2852
|
def time(self, callback: Callable[[Any], None]) -> None:
|
@@ -2688,7 +2874,7 @@ class Bitvavo:
|
|
2688
2874
|
```
|
2689
2875
|
"""
|
2690
2876
|
self.callbacks["time"] = callback
|
2691
|
-
self.
|
2877
|
+
self.do_send(self.ws, json.dumps({"action": "getTime"}))
|
2692
2878
|
|
2693
2879
|
def markets(self, options: anydict, callback: Callable[[Any], None]) -> None:
|
2694
2880
|
"""Get all available markets with some meta-information, unless options is given a `market` key.
|
@@ -2742,7 +2928,7 @@ class Bitvavo:
|
|
2742
2928
|
"""
|
2743
2929
|
self.callbacks["markets"] = callback
|
2744
2930
|
options["action"] = "getMarkets"
|
2745
|
-
self.
|
2931
|
+
self.do_send(self.ws, json.dumps(options))
|
2746
2932
|
|
2747
2933
|
def assets(self, options: anydict, callback: Callable[[Any], None]) -> None:
|
2748
2934
|
"""Get all available assets, unless `options` is given a `symbol` key.
|
@@ -2793,7 +2979,7 @@ class Bitvavo:
|
|
2793
2979
|
"""
|
2794
2980
|
self.callbacks["assets"] = callback
|
2795
2981
|
options["action"] = "getAssets"
|
2796
|
-
self.
|
2982
|
+
self.do_send(self.ws, json.dumps(options))
|
2797
2983
|
|
2798
2984
|
def book(self, market: str, options: anydict, callback: Callable[[Any], None]) -> None:
|
2799
2985
|
"""Get a book (with two lists: asks and bids, as they're called)
|
@@ -2840,7 +3026,7 @@ class Bitvavo:
|
|
2840
3026
|
self.callbacks["book"] = callback
|
2841
3027
|
options["market"] = market
|
2842
3028
|
options["action"] = "getBook"
|
2843
|
-
self.
|
3029
|
+
self.do_send(self.ws, json.dumps(options))
|
2844
3030
|
|
2845
3031
|
def publicTrades(self, market: str, options: anydict, callback: Callable[[Any], None]) -> None:
|
2846
3032
|
"""Publically available trades
|
@@ -2892,7 +3078,7 @@ class Bitvavo:
|
|
2892
3078
|
self.callbacks["publicTrades"] = callback
|
2893
3079
|
options["market"] = market
|
2894
3080
|
options["action"] = "getTrades"
|
2895
|
-
self.
|
3081
|
+
self.do_send(self.ws, json.dumps(options))
|
2896
3082
|
|
2897
3083
|
def candles(
|
2898
3084
|
self,
|
@@ -2951,9 +3137,13 @@ class Bitvavo:
|
|
2951
3137
|
options["market"] = market
|
2952
3138
|
options["interval"] = interval
|
2953
3139
|
options["action"] = "getCandles"
|
2954
|
-
self.
|
3140
|
+
self.do_send(self.ws, json.dumps(options))
|
2955
3141
|
|
3142
|
+
@deprecated(version="2.2.0", reason="Use ticker_price instead")
|
2956
3143
|
def tickerPrice(self, options: anydict, callback: Callable[[Any], None]) -> None:
|
3144
|
+
return self.ticker_price(options, callback)
|
3145
|
+
|
3146
|
+
def ticker_price(self, options: anydict, callback: Callable[[Any], None]) -> None:
|
2957
3147
|
"""Get the current price for each market
|
2958
3148
|
|
2959
3149
|
---
|
@@ -3001,9 +3191,13 @@ class Bitvavo:
|
|
3001
3191
|
"""
|
3002
3192
|
self.callbacks["tickerPrice"] = callback
|
3003
3193
|
options["action"] = "getTickerPrice"
|
3004
|
-
self.
|
3194
|
+
self.do_send(self.ws, json.dumps(options))
|
3005
3195
|
|
3196
|
+
@deprecated(version="2.2.0", reason="Use ticker_book instead")
|
3006
3197
|
def tickerBook(self, options: anydict, callback: Callable[[Any], None]) -> None:
|
3198
|
+
return self.ticker_book(options, callback)
|
3199
|
+
|
3200
|
+
def ticker_book(self, options: anydict, callback: Callable[[Any], None]) -> None:
|
3007
3201
|
"""Get current bid/ask, bidsize/asksize per market
|
3008
3202
|
|
3009
3203
|
---
|
@@ -3044,7 +3238,7 @@ class Bitvavo:
|
|
3044
3238
|
""" # noqa: E501
|
3045
3239
|
self.callbacks["tickerBook"] = callback
|
3046
3240
|
options["action"] = "getTickerBook"
|
3047
|
-
self.
|
3241
|
+
self.do_send(self.ws, json.dumps(options))
|
3048
3242
|
|
3049
3243
|
def ticker24h(self, options: anydict, callback: Callable[[Any], None]) -> None:
|
3050
3244
|
"""Get current bid/ask, bidsize/asksize per market
|
@@ -3111,8 +3305,9 @@ class Bitvavo:
|
|
3111
3305
|
"""
|
3112
3306
|
self.callbacks["ticker24h"] = callback
|
3113
3307
|
options["action"] = "getTicker24h"
|
3114
|
-
self.
|
3308
|
+
self.do_send(self.ws, json.dumps(options))
|
3115
3309
|
|
3310
|
+
@deprecated(version="2.2.0", reason="Use place_order instead")
|
3116
3311
|
def placeOrder(
|
3117
3312
|
self,
|
3118
3313
|
market: str,
|
@@ -3121,6 +3316,17 @@ class Bitvavo:
|
|
3121
3316
|
operatorId: int,
|
3122
3317
|
body: anydict,
|
3123
3318
|
callback: Callable[[Any], None],
|
3319
|
+
) -> None:
|
3320
|
+
return self.place_order(market, side, orderType, operatorId, body, callback)
|
3321
|
+
|
3322
|
+
def place_order(
|
3323
|
+
self,
|
3324
|
+
market: str,
|
3325
|
+
side: str,
|
3326
|
+
orderType: str,
|
3327
|
+
operatorId: int,
|
3328
|
+
body: anydict,
|
3329
|
+
callback: Callable[[Any], None],
|
3124
3330
|
) -> None:
|
3125
3331
|
"""Place a new order on the exchange
|
3126
3332
|
|
@@ -3253,8 +3459,9 @@ class Bitvavo:
|
|
3253
3459
|
body["orderType"] = orderType
|
3254
3460
|
body["operatorId"] = operatorId
|
3255
3461
|
body["action"] = "privateCreateOrder"
|
3256
|
-
self.
|
3462
|
+
self.do_send(self.ws, json.dumps(body), True)
|
3257
3463
|
|
3464
|
+
@deprecated(version="2.2.0", reason="Use update_order instead")
|
3258
3465
|
def updateOrder(
|
3259
3466
|
self,
|
3260
3467
|
market: str,
|
@@ -3262,6 +3469,16 @@ class Bitvavo:
|
|
3262
3469
|
operatorId: int,
|
3263
3470
|
body: anydict,
|
3264
3471
|
callback: Callable[[Any], None],
|
3472
|
+
) -> None:
|
3473
|
+
return self.update_order(market, orderId, operatorId, body, callback)
|
3474
|
+
|
3475
|
+
def update_order(
|
3476
|
+
self,
|
3477
|
+
market: str,
|
3478
|
+
orderId: str,
|
3479
|
+
operatorId: int,
|
3480
|
+
body: anydict,
|
3481
|
+
callback: Callable[[Any], None],
|
3265
3482
|
) -> None:
|
3266
3483
|
"""
|
3267
3484
|
Update an existing order for a specific market. Make sure that at least one of the optional parameters
|
@@ -3351,8 +3568,9 @@ class Bitvavo:
|
|
3351
3568
|
body["orderId"] = orderId
|
3352
3569
|
body["operatorId"] = operatorId
|
3353
3570
|
body["action"] = "privateUpdateOrder"
|
3354
|
-
self.
|
3571
|
+
self.do_send(self.ws, json.dumps(body), True)
|
3355
3572
|
|
3573
|
+
@deprecated(version="2.2.0", reason="Use cancel_order instead")
|
3356
3574
|
def cancelOrder(
|
3357
3575
|
self,
|
3358
3576
|
market: str,
|
@@ -3360,6 +3578,16 @@ class Bitvavo:
|
|
3360
3578
|
callback: Callable[[Any], None],
|
3361
3579
|
orderId: str | None = None,
|
3362
3580
|
clientOrderId: str | None = None,
|
3581
|
+
) -> None:
|
3582
|
+
return self.cancel_order(market, operatorId, callback, orderId, clientOrderId)
|
3583
|
+
|
3584
|
+
def cancel_order(
|
3585
|
+
self,
|
3586
|
+
market: str,
|
3587
|
+
operatorId: int,
|
3588
|
+
callback: Callable[[Any], None],
|
3589
|
+
orderId: str | None = None,
|
3590
|
+
clientOrderId: str | None = None,
|
3363
3591
|
) -> None:
|
3364
3592
|
"""Cancel an existing order for a specific market
|
3365
3593
|
|
@@ -3403,9 +3631,13 @@ class Bitvavo:
|
|
3403
3631
|
elif orderId is not None:
|
3404
3632
|
options["orderId"] = orderId
|
3405
3633
|
|
3406
|
-
self.
|
3634
|
+
self.do_send(self.ws, json.dumps(options), True)
|
3407
3635
|
|
3636
|
+
@deprecated(version="2.2.0", reason="Use get_order instead")
|
3408
3637
|
def getOrder(self, market: str, orderId: str, callback: Callable[[Any], None]) -> None:
|
3638
|
+
return self.get_order(market, orderId, callback)
|
3639
|
+
|
3640
|
+
def get_order(self, market: str, orderId: str, callback: Callable[[Any], None]) -> None:
|
3409
3641
|
"""Get an existing order for a specific market
|
3410
3642
|
|
3411
3643
|
---
|
@@ -3474,9 +3706,13 @@ class Bitvavo:
|
|
3474
3706
|
"market": market,
|
3475
3707
|
"orderId": orderId,
|
3476
3708
|
}
|
3477
|
-
self.
|
3709
|
+
self.do_send(self.ws, json.dumps(options), True)
|
3478
3710
|
|
3711
|
+
@deprecated(version="2.2.0", reason="Use get_orders instead")
|
3479
3712
|
def getOrders(self, market: str, options: anydict, callback: Callable[[Any], None]) -> None:
|
3713
|
+
return self.get_orders(market, options, callback)
|
3714
|
+
|
3715
|
+
def get_orders(self, market: str, options: anydict, callback: Callable[[Any], None]) -> None:
|
3480
3716
|
"""Get multiple existing orders for a specific market
|
3481
3717
|
|
3482
3718
|
---
|
@@ -3554,9 +3790,13 @@ class Bitvavo:
|
|
3554
3790
|
self.callbacks["getOrders"] = callback
|
3555
3791
|
options["action"] = "privateGetOrders"
|
3556
3792
|
options["market"] = market
|
3557
|
-
self.
|
3793
|
+
self.do_send(self.ws, json.dumps(options), True)
|
3558
3794
|
|
3795
|
+
@deprecated(version="2.2.0", reason="Use cancel_orders instead")
|
3559
3796
|
def cancelOrders(self, options: anydict, callback: Callable[[Any], None]) -> None:
|
3797
|
+
return self.cancel_orders(options, callback)
|
3798
|
+
|
3799
|
+
def cancel_orders(self, options: anydict, callback: Callable[[Any], None]) -> None:
|
3560
3800
|
"""Cancel all existing orders for a specific market (or account)
|
3561
3801
|
|
3562
3802
|
---
|
@@ -3584,9 +3824,13 @@ class Bitvavo:
|
|
3584
3824
|
"""
|
3585
3825
|
self.callbacks["cancelOrders"] = callback
|
3586
3826
|
options["action"] = "privateCancelOrders"
|
3587
|
-
self.
|
3827
|
+
self.do_send(self.ws, json.dumps(options), True)
|
3588
3828
|
|
3829
|
+
@deprecated(version="2.2.0", reason="Use orders_open instead")
|
3589
3830
|
def ordersOpen(self, options: anydict, callback: Callable[[Any], None]) -> None:
|
3831
|
+
return self.orders_open(options, callback)
|
3832
|
+
|
3833
|
+
def orders_open(self, options: anydict, callback: Callable[[Any], None]) -> None:
|
3590
3834
|
"""Get all open orders, either for all markets, or a single market
|
3591
3835
|
|
3592
3836
|
---
|
@@ -3654,7 +3898,7 @@ class Bitvavo:
|
|
3654
3898
|
"""
|
3655
3899
|
self.callbacks["ordersOpen"] = callback
|
3656
3900
|
options["action"] = "privateGetOrdersOpen"
|
3657
|
-
self.
|
3901
|
+
self.do_send(self.ws, json.dumps(options), True)
|
3658
3902
|
|
3659
3903
|
def trades(self, market: str, options: anydict, callback: Callable[[Any], None]) -> None:
|
3660
3904
|
"""Get all historic trades from this account
|
@@ -3703,7 +3947,7 @@ class Bitvavo:
|
|
3703
3947
|
self.callbacks["trades"] = callback
|
3704
3948
|
options["action"] = "privateGetTrades"
|
3705
3949
|
options["market"] = market
|
3706
|
-
self.
|
3950
|
+
self.do_send(self.ws, json.dumps(options), True)
|
3707
3951
|
|
3708
3952
|
def account(self, callback: Callable[[Any], None]) -> None:
|
3709
3953
|
"""Get all fees for this account
|
@@ -3733,7 +3977,7 @@ class Bitvavo:
|
|
3733
3977
|
```
|
3734
3978
|
"""
|
3735
3979
|
self.callbacks["account"] = callback
|
3736
|
-
self.
|
3980
|
+
self.do_send(self.ws, json.dumps({"action": "privateGetAccount"}), True)
|
3737
3981
|
|
3738
3982
|
def balance(self, options: anydict, callback: Callable[[Any], None]) -> None:
|
3739
3983
|
"""Get the balance for this account
|
@@ -3766,9 +4010,13 @@ class Bitvavo:
|
|
3766
4010
|
"""
|
3767
4011
|
options["action"] = "privateGetBalance"
|
3768
4012
|
self.callbacks["balance"] = callback
|
3769
|
-
self.
|
4013
|
+
self.do_send(self.ws, json.dumps(options), True)
|
3770
4014
|
|
4015
|
+
@deprecated(version="2.2.0", reason="Use deposit_assets instead")
|
3771
4016
|
def depositAssets(self, symbol: str, callback: Callable[[Any], None]) -> None:
|
4017
|
+
return self.deposit_assets(symbol, callback)
|
4018
|
+
|
4019
|
+
def deposit_assets(self, symbol: str, callback: Callable[[Any], None]) -> None:
|
3772
4020
|
"""
|
3773
4021
|
Get the deposit address (with paymentId for some assets) or bank account information to increase your
|
3774
4022
|
balance.
|
@@ -3804,13 +4052,17 @@ class Bitvavo:
|
|
3804
4052
|
```
|
3805
4053
|
"""
|
3806
4054
|
self.callbacks["depositAssets"] = callback
|
3807
|
-
self.
|
4055
|
+
self.do_send(
|
3808
4056
|
self.ws,
|
3809
4057
|
json.dumps({"action": "privateDepositAssets", "symbol": symbol}),
|
3810
4058
|
True,
|
3811
4059
|
)
|
3812
4060
|
|
4061
|
+
@deprecated(version="2.2.0", reason="Use deposit_history instead")
|
3813
4062
|
def depositHistory(self, options: anydict, callback: Callable[[Any], None]) -> None:
|
4063
|
+
return self.deposit_history(options, callback)
|
4064
|
+
|
4065
|
+
def deposit_history(self, options: anydict, callback: Callable[[Any], None]) -> None:
|
3814
4066
|
"""Get the deposit history of the account
|
3815
4067
|
|
3816
4068
|
Even when you want something from a single `symbol`, you'll still receive a list with multiple deposits.
|
@@ -3862,8 +4114,9 @@ class Bitvavo:
|
|
3862
4114
|
"""
|
3863
4115
|
self.callbacks["depositHistory"] = callback
|
3864
4116
|
options["action"] = "privateGetDepositHistory"
|
3865
|
-
self.
|
4117
|
+
self.do_send(self.ws, json.dumps(options), True)
|
3866
4118
|
|
4119
|
+
@deprecated(version="2.2.0", reason="Use withdraw_assets instead")
|
3867
4120
|
def withdrawAssets(
|
3868
4121
|
self,
|
3869
4122
|
symbol: str,
|
@@ -3871,6 +4124,16 @@ class Bitvavo:
|
|
3871
4124
|
address: str,
|
3872
4125
|
body: anydict,
|
3873
4126
|
callback: Callable[[Any], None],
|
4127
|
+
) -> None:
|
4128
|
+
return self.withdraw_assets(symbol, amount, address, body, callback)
|
4129
|
+
|
4130
|
+
def withdraw_assets(
|
4131
|
+
self,
|
4132
|
+
symbol: str,
|
4133
|
+
amount: str,
|
4134
|
+
address: str,
|
4135
|
+
body: anydict,
|
4136
|
+
callback: Callable[[Any], None],
|
3874
4137
|
) -> None:
|
3875
4138
|
"""Withdraw a coin/token to an external crypto address or bank account.
|
3876
4139
|
|
@@ -3915,9 +4178,13 @@ class Bitvavo:
|
|
3915
4178
|
body["symbol"] = symbol
|
3916
4179
|
body["amount"] = amount
|
3917
4180
|
body["address"] = address
|
3918
|
-
self.
|
4181
|
+
self.do_send(self.ws, json.dumps(body), True)
|
3919
4182
|
|
4183
|
+
@deprecated(version="2.2.0", reason="Use withdrawal_history instead")
|
3920
4184
|
def withdrawalHistory(self, options: anydict, callback: Callable[[Any], None]) -> None:
|
4185
|
+
return self.withdrawal_history(options, callback)
|
4186
|
+
|
4187
|
+
def withdrawal_history(self, options: anydict, callback: Callable[[Any], None]) -> None:
|
3921
4188
|
"""Get the withdrawal history
|
3922
4189
|
|
3923
4190
|
---
|
@@ -3958,9 +4225,13 @@ class Bitvavo:
|
|
3958
4225
|
"""
|
3959
4226
|
self.callbacks["withdrawalHistory"] = callback
|
3960
4227
|
options["action"] = "privateGetWithdrawalHistory"
|
3961
|
-
self.
|
4228
|
+
self.do_send(self.ws, json.dumps(options), True)
|
3962
4229
|
|
4230
|
+
@deprecated(version="2.2.0", reason="Use subscription_ticker instead")
|
3963
4231
|
def subscriptionTicker(self, market: str, callback: Callable[[Any], None]) -> None:
|
4232
|
+
return self.subscription_ticker(market, callback)
|
4233
|
+
|
4234
|
+
def subscription_ticker(self, market: str, callback: Callable[[Any], None]) -> None:
|
3964
4235
|
# TODO(NostraDavid): one possible improvement here is to turn `market` into a list of markets, so we can sub
|
3965
4236
|
# to all of them at once. Same goes for other `subscription*()`
|
3966
4237
|
"""
|
@@ -4002,7 +4273,7 @@ class Bitvavo:
|
|
4002
4273
|
if "subscriptionTicker" not in self.callbacks:
|
4003
4274
|
self.callbacks["subscriptionTicker"] = {}
|
4004
4275
|
self.callbacks["subscriptionTicker"][market] = callback
|
4005
|
-
self.
|
4276
|
+
self.do_send(
|
4006
4277
|
self.ws,
|
4007
4278
|
json.dumps(
|
4008
4279
|
{
|
@@ -4012,7 +4283,11 @@ class Bitvavo:
|
|
4012
4283
|
),
|
4013
4284
|
)
|
4014
4285
|
|
4286
|
+
@deprecated(version="2.2.0", reason="Use subscription_ticker24h instead")
|
4015
4287
|
def subscriptionTicker24h(self, market: str, callback: Callable[[Any], None]) -> None:
|
4288
|
+
return self.subscription_ticker24h(market, callback)
|
4289
|
+
|
4290
|
+
def subscription_ticker24h(self, market: str, callback: Callable[[Any], None]) -> None:
|
4016
4291
|
"""
|
4017
4292
|
Subscribe to the ticker-24-hour channel, which means `callback` gets passed the new object every second, if
|
4018
4293
|
values have changed.
|
@@ -4059,7 +4334,7 @@ class Bitvavo:
|
|
4059
4334
|
if "subscriptionTicker24h" not in self.callbacks:
|
4060
4335
|
self.callbacks["subscriptionTicker24h"] = {}
|
4061
4336
|
self.callbacks["subscriptionTicker24h"][market] = callback
|
4062
|
-
self.
|
4337
|
+
self.do_send(
|
4063
4338
|
self.ws,
|
4064
4339
|
json.dumps(
|
4065
4340
|
{
|
@@ -4069,7 +4344,11 @@ class Bitvavo:
|
|
4069
4344
|
),
|
4070
4345
|
)
|
4071
4346
|
|
4347
|
+
@deprecated(version="2.2.0", reason="Use subscription_account instead")
|
4072
4348
|
def subscriptionAccount(self, market: str, callback: Callable[[Any], None]) -> None:
|
4349
|
+
return self.subscription_account(market, callback)
|
4350
|
+
|
4351
|
+
def subscription_account(self, market: str, callback: Callable[[Any], None]) -> None:
|
4073
4352
|
"""
|
4074
4353
|
Subscribes to the account channel, which sends an update whenever an event happens which is related to
|
4075
4354
|
the account. These are 'order' events (create, update, cancel) or 'fill' events (a trade occurred).
|
@@ -4136,7 +4415,7 @@ class Bitvavo:
|
|
4136
4415
|
if "subscriptionAccount" not in self.callbacks:
|
4137
4416
|
self.callbacks["subscriptionAccount"] = {}
|
4138
4417
|
self.callbacks["subscriptionAccount"][market] = callback
|
4139
|
-
self.
|
4418
|
+
self.do_send(
|
4140
4419
|
self.ws,
|
4141
4420
|
json.dumps(
|
4142
4421
|
{
|
@@ -4147,7 +4426,11 @@ class Bitvavo:
|
|
4147
4426
|
True,
|
4148
4427
|
)
|
4149
4428
|
|
4429
|
+
@deprecated(version="2.2.0", reason="Use subscription_candles instead")
|
4150
4430
|
def subscriptionCandles(self, market: str, interval: str, callback: Callable[[Any], None]) -> None:
|
4431
|
+
return self.subscription_candles(market, interval, callback)
|
4432
|
+
|
4433
|
+
def subscription_candles(self, market: str, interval: str, callback: Callable[[Any], None]) -> None:
|
4151
4434
|
"""Subscribes to candles and returns a candle each time a new one is formed, depending on the interval
|
4152
4435
|
|
4153
4436
|
---
|
@@ -4195,7 +4478,7 @@ class Bitvavo:
|
|
4195
4478
|
if market not in self.callbacks["subscriptionCandles"]:
|
4196
4479
|
self.callbacks["subscriptionCandles"][market] = {}
|
4197
4480
|
self.callbacks["subscriptionCandles"][market][interval] = callback
|
4198
|
-
self.
|
4481
|
+
self.do_send(
|
4199
4482
|
self.ws,
|
4200
4483
|
json.dumps(
|
4201
4484
|
{
|
@@ -4211,7 +4494,11 @@ class Bitvavo:
|
|
4211
4494
|
),
|
4212
4495
|
)
|
4213
4496
|
|
4497
|
+
@deprecated(version="2.2.0", reason="Use subscription_trades instead")
|
4214
4498
|
def subscriptionTrades(self, market: str, callback: Callable[[Any], None]) -> None:
|
4499
|
+
return self.subscription_trades(market, callback)
|
4500
|
+
|
4501
|
+
def subscription_trades(self, market: str, callback: Callable[[Any], None]) -> None:
|
4215
4502
|
"""Subscribes to trades, which sends an object whenever a trade has occurred.
|
4216
4503
|
|
4217
4504
|
---
|
@@ -4248,7 +4535,7 @@ class Bitvavo:
|
|
4248
4535
|
if "subscriptionTrades" not in self.callbacks:
|
4249
4536
|
self.callbacks["subscriptionTrades"] = {}
|
4250
4537
|
self.callbacks["subscriptionTrades"][market] = callback
|
4251
|
-
self.
|
4538
|
+
self.do_send(
|
4252
4539
|
self.ws,
|
4253
4540
|
json.dumps(
|
4254
4541
|
{
|
@@ -4258,7 +4545,11 @@ class Bitvavo:
|
|
4258
4545
|
),
|
4259
4546
|
)
|
4260
4547
|
|
4548
|
+
@deprecated(version="2.2.0", reason="Use subscription_book_update instead")
|
4261
4549
|
def subscriptionBookUpdate(self, market: str, callback: Callable[[Any], None]) -> None:
|
4550
|
+
return self.subscription_book_update(market, callback)
|
4551
|
+
|
4552
|
+
def subscription_book_update(self, market: str, callback: Callable[[Any], None]) -> None:
|
4262
4553
|
"""Subscribes to the book and returns a delta on every change to the book.
|
4263
4554
|
|
4264
4555
|
---
|
@@ -4315,7 +4606,7 @@ class Bitvavo:
|
|
4315
4606
|
if "subscriptionBookUpdate" not in self.callbacks:
|
4316
4607
|
self.callbacks["subscriptionBookUpdate"] = {}
|
4317
4608
|
self.callbacks["subscriptionBookUpdate"][market] = callback
|
4318
|
-
self.
|
4609
|
+
self.do_send(
|
4319
4610
|
self.ws,
|
4320
4611
|
json.dumps(
|
4321
4612
|
{
|
@@ -4325,7 +4616,11 @@ class Bitvavo:
|
|
4325
4616
|
),
|
4326
4617
|
)
|
4327
4618
|
|
4619
|
+
@deprecated(version="2.2.0", reason="Use subscription_book instead")
|
4328
4620
|
def subscriptionBook(self, market: str, callback: Callable[[Any], None]) -> None:
|
4621
|
+
return self.subscription_book(market, callback)
|
4622
|
+
|
4623
|
+
def subscription_book(self, market: str, callback: Callable[[Any], None]) -> None:
|
4329
4624
|
"""Subscribes to the book and returns a delta on every change to the book.
|
4330
4625
|
|
4331
4626
|
---
|
@@ -4385,8 +4680,8 @@ class Bitvavo:
|
|
4385
4680
|
self.callbacks["subscriptionBookUser"][market] = callback
|
4386
4681
|
if "subscriptionBook" not in self.callbacks:
|
4387
4682
|
self.callbacks["subscriptionBook"] = {}
|
4388
|
-
self.callbacks["subscriptionBook"][market] =
|
4389
|
-
self.
|
4683
|
+
self.callbacks["subscriptionBook"][market] = process_local_book
|
4684
|
+
self.do_send(
|
4390
4685
|
self.ws,
|
4391
4686
|
json.dumps(
|
4392
4687
|
{
|
@@ -4397,4 +4692,4 @@ class Bitvavo:
|
|
4397
4692
|
)
|
4398
4693
|
|
4399
4694
|
self.localBook[market] = {}
|
4400
|
-
self.
|
4695
|
+
self.do_send(self.ws, json.dumps({"action": "getBook", "market": market}))
|
File without changes
|
{bitvavo_api_upgraded-2.2.0 → bitvavo_api_upgraded-2.3.0}/src/bitvavo_api_upgraded/__init__.py
RENAMED
File without changes
|
File without changes
|
{bitvavo_api_upgraded-2.2.0 → bitvavo_api_upgraded-2.3.0}/src/bitvavo_api_upgraded/helper_funcs.py
RENAMED
File without changes
|
File without changes
|
{bitvavo_api_upgraded-2.2.0 → bitvavo_api_upgraded-2.3.0}/src/bitvavo_api_upgraded/settings.py
RENAMED
File without changes
|
{bitvavo_api_upgraded-2.2.0 → bitvavo_api_upgraded-2.3.0}/src/bitvavo_api_upgraded/type_aliases.py
RENAMED
File without changes
|