bitvavo-api-upgraded 2.2.0__tar.gz → 3.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {bitvavo_api_upgraded-2.2.0 → bitvavo_api_upgraded-3.0.0}/PKG-INFO +1 -1
- {bitvavo_api_upgraded-2.2.0 → bitvavo_api_upgraded-3.0.0}/pyproject.toml +2 -2
- {bitvavo_api_upgraded-2.2.0 → bitvavo_api_upgraded-3.0.0}/src/bitvavo_api_upgraded/bitvavo.py +155 -155
- {bitvavo_api_upgraded-2.2.0 → bitvavo_api_upgraded-3.0.0}/README.md +0 -0
- {bitvavo_api_upgraded-2.2.0 → bitvavo_api_upgraded-3.0.0}/src/bitvavo_api_upgraded/__init__.py +0 -0
- {bitvavo_api_upgraded-2.2.0 → bitvavo_api_upgraded-3.0.0}/src/bitvavo_api_upgraded/dataframe_utils.py +0 -0
- {bitvavo_api_upgraded-2.2.0 → bitvavo_api_upgraded-3.0.0}/src/bitvavo_api_upgraded/helper_funcs.py +0 -0
- {bitvavo_api_upgraded-2.2.0 → bitvavo_api_upgraded-3.0.0}/src/bitvavo_api_upgraded/py.typed +0 -0
- {bitvavo_api_upgraded-2.2.0 → bitvavo_api_upgraded-3.0.0}/src/bitvavo_api_upgraded/settings.py +0 -0
- {bitvavo_api_upgraded-2.2.0 → bitvavo_api_upgraded-3.0.0}/src/bitvavo_api_upgraded/type_aliases.py +0 -0
@@ -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 = "
|
9
|
+
version = "3.0.0"
|
10
10
|
description = "A unit-tested fork of the Bitvavo API"
|
11
11
|
readme = "README.md"
|
12
12
|
requires-python = ">=3.9"
|
@@ -104,7 +104,7 @@ dev-dependencies = [
|
|
104
104
|
]
|
105
105
|
|
106
106
|
[tool.bumpversion]
|
107
|
-
current_version = "
|
107
|
+
current_version = "3.0.0"
|
108
108
|
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
|
109
109
|
serialize = ["{major}.{minor}.{patch}"]
|
110
110
|
search = "{current_version}"
|
{bitvavo_api_upgraded-2.2.0 → bitvavo_api_upgraded-3.0.0}/src/bitvavo_api_upgraded/bitvavo.py
RENAMED
@@ -25,7 +25,7 @@ configure_loggers()
|
|
25
25
|
logger = get_logger(__name__)
|
26
26
|
|
27
27
|
|
28
|
-
def
|
28
|
+
def create_signature(timestamp: ms, method: str, url: str, body: anydict | None, api_secret: str) -> str:
|
29
29
|
string = f"{timestamp}{method}/v2{url}"
|
30
30
|
if body is not None and len(body.keys()) > 0:
|
31
31
|
string += json.dumps(body, separators=(",", ":"))
|
@@ -33,7 +33,7 @@ def createSignature(timestamp: ms, method: str, url: str, body: anydict | None,
|
|
33
33
|
return signature
|
34
34
|
|
35
35
|
|
36
|
-
def
|
36
|
+
def create_postfix(options: anydict | None) -> str:
|
37
37
|
"""Generate a URL postfix, based on the `options` dict.
|
38
38
|
|
39
39
|
---
|
@@ -67,15 +67,15 @@ def _epoch_millis(dt: dt.datetime) -> int:
|
|
67
67
|
return int(dt.timestamp() * 1000)
|
68
68
|
|
69
69
|
|
70
|
-
def
|
70
|
+
def asks_compare(a: float, b: float) -> bool:
|
71
71
|
return a < b
|
72
72
|
|
73
73
|
|
74
|
-
def
|
74
|
+
def bids_compare(a: float, b: float) -> bool:
|
75
75
|
return a > b
|
76
76
|
|
77
77
|
|
78
|
-
def
|
78
|
+
def sort_and_insert(
|
79
79
|
asks_or_bids: list[list[str]],
|
80
80
|
update: list[list[str]],
|
81
81
|
compareFunc: Callable[[float, float], bool],
|
@@ -101,7 +101,7 @@ def sortAndInsert(
|
|
101
101
|
return asks_or_bids
|
102
102
|
|
103
103
|
|
104
|
-
def
|
104
|
+
def process_local_book(ws: Bitvavo.WebSocketAppFacade, message: anydict) -> None:
|
105
105
|
market: str = ""
|
106
106
|
if "action" in message:
|
107
107
|
if message["action"] == "getBook":
|
@@ -115,10 +115,10 @@ def processLocalBook(ws: Bitvavo.WebSocketAppFacade, message: anydict) -> None:
|
|
115
115
|
|
116
116
|
if message["nonce"] != ws.localBook[market]["nonce"] + 1:
|
117
117
|
# I think I've fixed this, by looking at the other Bitvavo repos (search for 'nonce' or '!=' 😆)
|
118
|
-
ws.
|
118
|
+
ws.subscription_book(market, ws.callbacks[market])
|
119
119
|
return
|
120
|
-
ws.localBook[market]["bids"] =
|
121
|
-
ws.localBook[market]["asks"] =
|
120
|
+
ws.localBook[market]["bids"] = sort_and_insert(ws.localBook[market]["bids"], message["bids"], bids_compare)
|
121
|
+
ws.localBook[market]["asks"] = sort_and_insert(ws.localBook[market]["asks"], message["asks"], asks_compare)
|
122
122
|
ws.localBook[market]["nonce"] = message["nonce"]
|
123
123
|
|
124
124
|
if market != "":
|
@@ -423,7 +423,7 @@ class Bitvavo:
|
|
423
423
|
)
|
424
424
|
time.sleep(napTime + 1) # +1 to add a tiny bit of buffer time
|
425
425
|
|
426
|
-
def
|
426
|
+
def calc_lag(self) -> ms:
|
427
427
|
"""
|
428
428
|
Calculate the time difference between the client and server; use this value with BITVAVO_API_UPGRADED_LAG,
|
429
429
|
when you make an api call, to precent 304 errors.
|
@@ -445,8 +445,8 @@ class Bitvavo:
|
|
445
445
|
|
446
446
|
return ms(sum(lag_list) / len(lag_list))
|
447
447
|
|
448
|
-
def
|
449
|
-
"""Get the
|
448
|
+
def get_remaining_limit(self) -> int:
|
449
|
+
"""Get the remaining rate limit
|
450
450
|
|
451
451
|
---
|
452
452
|
Returns:
|
@@ -456,7 +456,7 @@ class Bitvavo:
|
|
456
456
|
"""
|
457
457
|
return self.rateLimitRemaining
|
458
458
|
|
459
|
-
def
|
459
|
+
def update_rate_limit(self, response: anydict | errordict) -> None:
|
460
460
|
"""
|
461
461
|
Update the rate limited
|
462
462
|
|
@@ -488,7 +488,7 @@ class Bitvavo:
|
|
488
488
|
logger.info("napping-until-ban-lifted")
|
489
489
|
time.sleep(timeToWait + 1) # plus one second to ENSURE we're able to run again.
|
490
490
|
|
491
|
-
def
|
491
|
+
def public_request(
|
492
492
|
self,
|
493
493
|
url: str,
|
494
494
|
rateLimitingWeight: int = 1,
|
@@ -541,7 +541,7 @@ class Bitvavo:
|
|
541
541
|
|
542
542
|
if api_key:
|
543
543
|
now = time_ms() + bitvavo_upgraded_settings.LAG
|
544
|
-
sig =
|
544
|
+
sig = create_signature(now, "GET", url.replace(self.base, ""), None, api_secret)
|
545
545
|
headers = {
|
546
546
|
"bitvavo-access-key": api_key,
|
547
547
|
"bitvavo-access-signature": sig,
|
@@ -559,11 +559,11 @@ class Bitvavo:
|
|
559
559
|
self._update_rate_limit_for_key(key_index, dict(r.headers))
|
560
560
|
|
561
561
|
# Also update legacy rate limit tracking
|
562
|
-
self.
|
562
|
+
self.update_rate_limit(r.json() if "error" in r.json() else dict(r.headers))
|
563
563
|
|
564
564
|
return r.json() # type:ignore[no-any-return]
|
565
565
|
|
566
|
-
def
|
566
|
+
def private_request(
|
567
567
|
self,
|
568
568
|
endpoint: str,
|
569
569
|
postfix: str,
|
@@ -616,7 +616,7 @@ class Bitvavo:
|
|
616
616
|
self._current_api_secret = api_secret
|
617
617
|
|
618
618
|
now = time_ms() + bitvavo_upgraded_settings.LAG
|
619
|
-
sig =
|
619
|
+
sig = create_signature(now, method, (endpoint + postfix), body, api_secret)
|
620
620
|
url = self.base + endpoint + postfix
|
621
621
|
headers = {
|
622
622
|
"bitvavo-access-key": api_key,
|
@@ -651,7 +651,7 @@ class Bitvavo:
|
|
651
651
|
self._update_rate_limit_for_key(key_index, dict(r.headers))
|
652
652
|
|
653
653
|
# Also update legacy rate limit tracking
|
654
|
-
self.
|
654
|
+
self.update_rate_limit(r.json() if "error" in r.json() else dict(r.headers))
|
655
655
|
|
656
656
|
return r.json()
|
657
657
|
|
@@ -685,7 +685,7 @@ class Bitvavo:
|
|
685
685
|
{"time": 1539180275424 }
|
686
686
|
```
|
687
687
|
"""
|
688
|
-
return self.
|
688
|
+
return self.public_request(f"{self.base}/time") # type: ignore[return-value]
|
689
689
|
|
690
690
|
def markets(
|
691
691
|
self,
|
@@ -763,8 +763,8 @@ class Bitvavo:
|
|
763
763
|
# The specific DataFrame type depends on the selected format.
|
764
764
|
```
|
765
765
|
"""
|
766
|
-
postfix =
|
767
|
-
result = self.
|
766
|
+
postfix = create_postfix(options)
|
767
|
+
result = self.public_request(f"{self.base}/markets{postfix}") # type: ignore[return-value]
|
768
768
|
return convert_to_dataframe(result, output_format)
|
769
769
|
|
770
770
|
def assets(
|
@@ -841,8 +841,8 @@ class Bitvavo:
|
|
841
841
|
# The specific DataFrame type depends on the selected format.
|
842
842
|
```
|
843
843
|
"""
|
844
|
-
postfix =
|
845
|
-
result = self.
|
844
|
+
postfix = create_postfix(options)
|
845
|
+
result = self.public_request(f"{self.base}/assets{postfix}") # type: ignore[return-value]
|
846
846
|
return convert_to_dataframe(result, output_format)
|
847
847
|
|
848
848
|
def book(self, market: str, options: intdict | None = None) -> dict[str, str | int | list[str]] | errordict:
|
@@ -887,10 +887,10 @@ class Bitvavo:
|
|
887
887
|
assert result == 714.48 # EUR can be gained from this bid if it's sold (minus the fee)
|
888
888
|
```
|
889
889
|
"""
|
890
|
-
postfix =
|
891
|
-
return self.
|
890
|
+
postfix = create_postfix(options)
|
891
|
+
return self.public_request(f"{self.base}/{market}/book{postfix}") # type: ignore[return-value]
|
892
892
|
|
893
|
-
def
|
893
|
+
def public_trades(
|
894
894
|
self,
|
895
895
|
market: str,
|
896
896
|
options: strintdict | None = None,
|
@@ -963,8 +963,8 @@ class Bitvavo:
|
|
963
963
|
# Returns the above data as a DataFrame in the requested format (pandas, polars, etc.)
|
964
964
|
```
|
965
965
|
"""
|
966
|
-
postfix =
|
967
|
-
result = self.
|
966
|
+
postfix = create_postfix(options)
|
967
|
+
result = self.public_request(f"{self.base}/{market}/trades{postfix}", 5) # type: ignore[return-value]
|
968
968
|
return convert_to_dataframe(result, output_format)
|
969
969
|
|
970
970
|
def candles(
|
@@ -1053,11 +1053,11 @@ class Bitvavo:
|
|
1053
1053
|
options["start"] = _epoch_millis(start)
|
1054
1054
|
if end is not None:
|
1055
1055
|
options["end"] = _epoch_millis(end)
|
1056
|
-
postfix =
|
1057
|
-
result = self.
|
1056
|
+
postfix = create_postfix(options)
|
1057
|
+
result = self.public_request(f"{self.base}/{market}/candles{postfix}") # type: ignore[return-value]
|
1058
1058
|
return convert_candles_to_dataframe(result, output_format)
|
1059
1059
|
|
1060
|
-
def
|
1060
|
+
def ticker_price(
|
1061
1061
|
self,
|
1062
1062
|
options: strdict | None = None,
|
1063
1063
|
output_format: OutputFormat = OutputFormat.DICT,
|
@@ -1127,11 +1127,11 @@ class Bitvavo:
|
|
1127
1127
|
# Returns a DataFrame with columns: market, price
|
1128
1128
|
```
|
1129
1129
|
"""
|
1130
|
-
postfix =
|
1131
|
-
result = self.
|
1130
|
+
postfix = create_postfix(options)
|
1131
|
+
result = self.public_request(f"{self.base}/ticker/price{postfix}") # type: ignore[return-value]
|
1132
1132
|
return convert_to_dataframe(result, output_format)
|
1133
1133
|
|
1134
|
-
def
|
1134
|
+
def ticker_book(
|
1135
1135
|
self,
|
1136
1136
|
options: strdict | None = None,
|
1137
1137
|
output_format: OutputFormat = OutputFormat.DICT,
|
@@ -1194,8 +1194,8 @@ class Bitvavo:
|
|
1194
1194
|
# Returns a DataFrame with columns: market, bid, ask, bidSize, askSize
|
1195
1195
|
```
|
1196
1196
|
"""
|
1197
|
-
postfix =
|
1198
|
-
result = self.
|
1197
|
+
postfix = create_postfix(options)
|
1198
|
+
result = self.public_request(f"{self.base}/ticker/book{postfix}") # type: ignore[return-value]
|
1199
1199
|
return convert_to_dataframe(result, output_format)
|
1200
1200
|
|
1201
1201
|
def ticker24h(
|
@@ -1283,11 +1283,11 @@ class Bitvavo:
|
|
1283
1283
|
rateLimitingWeight = 25
|
1284
1284
|
if "market" in options:
|
1285
1285
|
rateLimitingWeight = 1
|
1286
|
-
postfix =
|
1287
|
-
result = self.
|
1286
|
+
postfix = create_postfix(options)
|
1287
|
+
result = self.public_request(f"{self.base}/ticker/24h{postfix}", rateLimitingWeight) # type: ignore[return-value]
|
1288
1288
|
return convert_to_dataframe(result, output_format)
|
1289
1289
|
|
1290
|
-
def
|
1290
|
+
def report_trades(
|
1291
1291
|
self,
|
1292
1292
|
market: str,
|
1293
1293
|
options: strintdict | None = None,
|
@@ -1350,11 +1350,11 @@ class Bitvavo:
|
|
1350
1350
|
]
|
1351
1351
|
```
|
1352
1352
|
"""
|
1353
|
-
postfix =
|
1354
|
-
result = self.
|
1353
|
+
postfix = create_postfix(options)
|
1354
|
+
result = self.public_request(f"{self.base}/report/{market}/trades{postfix}", 5) # type: ignore[return-value]
|
1355
1355
|
return convert_to_dataframe(result, output_format)
|
1356
1356
|
|
1357
|
-
def
|
1357
|
+
def report_book(self, market: str, options: intdict | None = None) -> dict[str, str | int | list[str]] | errordict:
|
1358
1358
|
"""Get MiCA-compliant order book report for a specific market
|
1359
1359
|
|
1360
1360
|
Returns the list of all bids and asks for the specified market, sorted by price.
|
@@ -1391,10 +1391,10 @@ class Bitvavo:
|
|
1391
1391
|
}
|
1392
1392
|
```
|
1393
1393
|
"""
|
1394
|
-
postfix =
|
1395
|
-
return self.
|
1394
|
+
postfix = create_postfix(options)
|
1395
|
+
return self.public_request(f"{self.base}/report/{market}/book{postfix}") # type: ignore[return-value]
|
1396
1396
|
|
1397
|
-
def
|
1397
|
+
def place_order(self, market: str, side: str, orderType: str, operatorId: int, body: anydict) -> anydict:
|
1398
1398
|
"""Place a new order on the exchange
|
1399
1399
|
|
1400
1400
|
---
|
@@ -1523,9 +1523,9 @@ class Bitvavo:
|
|
1523
1523
|
body["side"] = side
|
1524
1524
|
body["orderType"] = orderType
|
1525
1525
|
body["operatorId"] = operatorId
|
1526
|
-
return self.
|
1526
|
+
return self.private_request("/order", "", body, "POST") # type: ignore[return-value]
|
1527
1527
|
|
1528
|
-
def
|
1528
|
+
def update_order(self, market: str, orderId: str, operatorId: int, body: anydict) -> anydict:
|
1529
1529
|
"""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
1530
|
|
1531
1531
|
---
|
@@ -1609,9 +1609,9 @@ class Bitvavo:
|
|
1609
1609
|
body["market"] = market
|
1610
1610
|
body["orderId"] = orderId
|
1611
1611
|
body["operatorId"] = operatorId
|
1612
|
-
return self.
|
1612
|
+
return self.private_request("/order", "", body, "PUT") # type: ignore[return-value]
|
1613
1613
|
|
1614
|
-
def
|
1614
|
+
def cancel_order(
|
1615
1615
|
self,
|
1616
1616
|
market: str,
|
1617
1617
|
operatorId: int,
|
@@ -1657,10 +1657,10 @@ class Bitvavo:
|
|
1657
1657
|
elif orderId is not None:
|
1658
1658
|
params["orderId"] = orderId
|
1659
1659
|
|
1660
|
-
postfix =
|
1661
|
-
return self.
|
1660
|
+
postfix = create_postfix(params)
|
1661
|
+
return self.private_request("/order", postfix, {}, "DELETE") # type: ignore[return-value]
|
1662
1662
|
|
1663
|
-
def
|
1663
|
+
def get_order(self, market: str, orderId: str) -> list[anydict] | errordict:
|
1664
1664
|
"""Get an existing order for a specific market
|
1665
1665
|
|
1666
1666
|
---
|
@@ -1722,10 +1722,10 @@ class Bitvavo:
|
|
1722
1722
|
}
|
1723
1723
|
```
|
1724
1724
|
"""
|
1725
|
-
postfix =
|
1726
|
-
return self.
|
1725
|
+
postfix = create_postfix({"market": market, "orderId": orderId})
|
1726
|
+
return self.private_request("/order", postfix, {}, "GET") # type: ignore[return-value]
|
1727
1727
|
|
1728
|
-
def
|
1728
|
+
def get_orders(self, market: str, options: anydict | None = None) -> list[anydict] | errordict:
|
1729
1729
|
"""Get multiple existing orders for a specific market
|
1730
1730
|
|
1731
1731
|
---
|
@@ -1798,10 +1798,10 @@ class Bitvavo:
|
|
1798
1798
|
""" # noqa: E501
|
1799
1799
|
options = _default(options, {})
|
1800
1800
|
options["market"] = market
|
1801
|
-
postfix =
|
1802
|
-
return self.
|
1801
|
+
postfix = create_postfix(options)
|
1802
|
+
return self.private_request("/orders", postfix, {}, "GET", 5) # type: ignore[return-value]
|
1803
1803
|
|
1804
|
-
def
|
1804
|
+
def cancel_orders(self, options: anydict | None = None) -> list[strdict] | errordict:
|
1805
1805
|
"""Cancel all existing orders for a specific market (or account)
|
1806
1806
|
|
1807
1807
|
---
|
@@ -1826,10 +1826,10 @@ class Bitvavo:
|
|
1826
1826
|
]
|
1827
1827
|
```
|
1828
1828
|
"""
|
1829
|
-
postfix =
|
1830
|
-
return self.
|
1829
|
+
postfix = create_postfix(options)
|
1830
|
+
return self.private_request("/orders", postfix, {}, "DELETE") # type: ignore[return-value]
|
1831
1831
|
|
1832
|
-
def
|
1832
|
+
def orders_open(self, options: anydict | None = None) -> list[anydict] | errordict:
|
1833
1833
|
"""Get all open orders, either for all markets, or a single market
|
1834
1834
|
|
1835
1835
|
---
|
@@ -1898,8 +1898,8 @@ class Bitvavo:
|
|
1898
1898
|
rateLimitingWeight = 25
|
1899
1899
|
if "market" in options:
|
1900
1900
|
rateLimitingWeight = 1
|
1901
|
-
postfix =
|
1902
|
-
return self.
|
1901
|
+
postfix = create_postfix(options)
|
1902
|
+
return self.private_request("/ordersOpen", postfix, {}, "GET", rateLimitingWeight) # type: ignore[return-value]
|
1903
1903
|
|
1904
1904
|
def trades(
|
1905
1905
|
self,
|
@@ -1962,8 +1962,8 @@ class Bitvavo:
|
|
1962
1962
|
""" # noqa: E501
|
1963
1963
|
options = _default(options, {})
|
1964
1964
|
options["market"] = market
|
1965
|
-
postfix =
|
1966
|
-
result = self.
|
1965
|
+
postfix = create_postfix(options)
|
1966
|
+
result = self.private_request("/trades", postfix, {}, "GET", 5) # type: ignore[return-value]
|
1967
1967
|
return convert_to_dataframe(result, output_format)
|
1968
1968
|
|
1969
1969
|
def account(self) -> dict[str, strdict]:
|
@@ -1987,7 +1987,7 @@ class Bitvavo:
|
|
1987
1987
|
}
|
1988
1988
|
```
|
1989
1989
|
"""
|
1990
|
-
return self.
|
1990
|
+
return self.private_request("/account", "", {}, "GET") # type: ignore[return-value]
|
1991
1991
|
|
1992
1992
|
def fees(self, market: str | None = None, quote: str | None = None) -> list[strdict] | errordict:
|
1993
1993
|
"""Get market fees for a specific market or quote currency
|
@@ -2024,8 +2024,8 @@ class Bitvavo:
|
|
2024
2024
|
options["market"] = market
|
2025
2025
|
if quote is not None:
|
2026
2026
|
options["quote"] = quote
|
2027
|
-
postfix =
|
2028
|
-
return self.
|
2027
|
+
postfix = create_postfix(options)
|
2028
|
+
return self.private_request("/account/fees", postfix, {}, "GET") # type: ignore[return-value]
|
2029
2029
|
|
2030
2030
|
def balance(
|
2031
2031
|
self,
|
@@ -2081,11 +2081,11 @@ class Bitvavo:
|
|
2081
2081
|
# with columns: symbol, available, inOrder
|
2082
2082
|
```
|
2083
2083
|
"""
|
2084
|
-
postfix =
|
2085
|
-
result = self.
|
2084
|
+
postfix = create_postfix(options)
|
2085
|
+
result = self.private_request("/balance", postfix, {}, "GET", 5) # type: ignore[return-value]
|
2086
2086
|
return convert_to_dataframe(result, output_format)
|
2087
2087
|
|
2088
|
-
def
|
2088
|
+
def account_history(self, options: strintdict | None = None) -> anydict | errordict:
|
2089
2089
|
"""Get all past transactions for your account
|
2090
2090
|
|
2091
2091
|
---
|
@@ -2129,10 +2129,10 @@ class Bitvavo:
|
|
2129
2129
|
}
|
2130
2130
|
```
|
2131
2131
|
"""
|
2132
|
-
postfix =
|
2133
|
-
return self.
|
2132
|
+
postfix = create_postfix(options)
|
2133
|
+
return self.private_request("/account/history", postfix, {}, "GET") # type: ignore[return-value]
|
2134
2134
|
|
2135
|
-
def
|
2135
|
+
def deposit_assets(self, symbol: str) -> strdict:
|
2136
2136
|
"""Get the deposit address (with paymentId for some assets) or bank account information to increase your balance
|
2137
2137
|
|
2138
2138
|
---
|
@@ -2164,10 +2164,10 @@ class Bitvavo:
|
|
2164
2164
|
}
|
2165
2165
|
```
|
2166
2166
|
"""
|
2167
|
-
postfix =
|
2168
|
-
return self.
|
2167
|
+
postfix = create_postfix({"symbol": symbol})
|
2168
|
+
return self.private_request("/deposit", postfix, {}, "GET") # type: ignore[return-value]
|
2169
2169
|
|
2170
|
-
def
|
2170
|
+
def deposit_history(self, options: anydict | None = None) -> list[anydict] | errordict:
|
2171
2171
|
"""Get the deposit history of the account
|
2172
2172
|
|
2173
2173
|
Even when you want something from a single `symbol`, you'll still receive a list with multiple deposits.
|
@@ -2215,10 +2215,10 @@ class Bitvavo:
|
|
2215
2215
|
]
|
2216
2216
|
```
|
2217
2217
|
""" # noqa: E501
|
2218
|
-
postfix =
|
2219
|
-
return self.
|
2218
|
+
postfix = create_postfix(options)
|
2219
|
+
return self.private_request("/depositHistory", postfix, {}, "GET", 5) # type: ignore[return-value]
|
2220
2220
|
|
2221
|
-
def
|
2221
|
+
def withdraw_assets(self, symbol: str, amount: str, address: str, body: anydict) -> anydict:
|
2222
2222
|
"""Withdraw a coin/token to an external crypto address or bank account.
|
2223
2223
|
|
2224
2224
|
---
|
@@ -2253,9 +2253,9 @@ class Bitvavo:
|
|
2253
2253
|
body["symbol"] = symbol
|
2254
2254
|
body["amount"] = amount
|
2255
2255
|
body["address"] = address
|
2256
|
-
return self.
|
2256
|
+
return self.private_request("/withdrawal", "", body, "POST") # type: ignore[return-value]
|
2257
2257
|
|
2258
|
-
def
|
2258
|
+
def withdrawal_history(
|
2259
2259
|
self,
|
2260
2260
|
options: anydict | None = None,
|
2261
2261
|
output_format: OutputFormat = OutputFormat.DICT,
|
@@ -2312,8 +2312,8 @@ class Bitvavo:
|
|
2312
2312
|
]
|
2313
2313
|
```
|
2314
2314
|
""" # noqa: E501
|
2315
|
-
postfix =
|
2316
|
-
result = self.
|
2315
|
+
postfix = create_postfix(options)
|
2316
|
+
result = self.private_request("/withdrawalHistory", postfix, {}, "GET", 5) # type: ignore[return-value]
|
2317
2317
|
return convert_to_dataframe(result, output_format)
|
2318
2318
|
|
2319
2319
|
# API Key Management Helper Methods
|
@@ -2428,7 +2428,7 @@ class Bitvavo:
|
|
2428
2428
|
"rate_limit_reset_at": int(self.rateLimitResetAt),
|
2429
2429
|
}
|
2430
2430
|
|
2431
|
-
def
|
2431
|
+
def new_websocket(self) -> Bitvavo.WebSocketAppFacade:
|
2432
2432
|
return Bitvavo.WebSocketAppFacade(self.APIKEY, self.APISECRET, self.ACCESSWINDOW, self.wsUrl, self)
|
2433
2433
|
|
2434
2434
|
class WebSocketAppFacade:
|
@@ -2477,18 +2477,18 @@ class Bitvavo:
|
|
2477
2477
|
self.keepBookCopy = False
|
2478
2478
|
self.localBook: anydict = {}
|
2479
2479
|
|
2480
|
-
def
|
2480
|
+
def close_socket(self) -> None:
|
2481
2481
|
self.ws.close()
|
2482
2482
|
self.keepAlive = False
|
2483
2483
|
self.receiveThread.join()
|
2484
2484
|
|
2485
|
-
def
|
2485
|
+
def wait_for_socket(self, ws: WebSocketApp, message: str, private: bool) -> None: # noqa: ARG002, FBT001
|
2486
2486
|
while self.keepAlive:
|
2487
2487
|
if (not private and self.open) or (private and self.authenticated and self.open):
|
2488
2488
|
return
|
2489
2489
|
time.sleep(0.1)
|
2490
2490
|
|
2491
|
-
def
|
2491
|
+
def do_send(self, ws: WebSocketApp, message: str, private: bool = False) -> None: # noqa: FBT001, FBT002
|
2492
2492
|
# TODO(NostraDavid): add nap-time to the websocket, or do it here; I don't know yet.
|
2493
2493
|
if private and self.APIKEY == "":
|
2494
2494
|
logger.error(
|
@@ -2496,7 +2496,7 @@ class Bitvavo:
|
|
2496
2496
|
tip="set the API key to be able to make private API calls",
|
2497
2497
|
)
|
2498
2498
|
return
|
2499
|
-
self.
|
2499
|
+
self.wait_for_socket(ws, message, private)
|
2500
2500
|
ws.send(message)
|
2501
2501
|
if self.bitvavo.debugging:
|
2502
2502
|
logger.debug("message-sent", message=message)
|
@@ -2509,7 +2509,7 @@ class Bitvavo:
|
|
2509
2509
|
|
2510
2510
|
if "error" in msg_dict:
|
2511
2511
|
if msg_dict["errorCode"] == 105: # noqa: PLR2004
|
2512
|
-
self.bitvavo.
|
2512
|
+
self.bitvavo.update_rate_limit(msg_dict)
|
2513
2513
|
if "error" in callbacks:
|
2514
2514
|
callbacks["error"](msg_dict)
|
2515
2515
|
else:
|
@@ -2609,47 +2609,47 @@ class Bitvavo:
|
|
2609
2609
|
if self.bitvavo.debugging:
|
2610
2610
|
logger.debug("websocket-closed")
|
2611
2611
|
|
2612
|
-
def
|
2612
|
+
def check_reconnect(self) -> None: # noqa: C901, PLR0912 (too-complex)
|
2613
2613
|
if "subscriptionTicker" in self.callbacks:
|
2614
2614
|
for market in self.callbacks["subscriptionTicker"]:
|
2615
|
-
self.
|
2615
|
+
self.subscription_ticker(market, self.callbacks["subscriptionTicker"][market])
|
2616
2616
|
if "subscriptionTicker24h" in self.callbacks:
|
2617
2617
|
for market in self.callbacks["subscriptionTicker24h"]:
|
2618
|
-
self.
|
2618
|
+
self.subscription_ticker(market, self.callbacks["subscriptionTicker24h"][market])
|
2619
2619
|
if "subscriptionAccount" in self.callbacks:
|
2620
2620
|
for market in self.callbacks["subscriptionAccount"]:
|
2621
|
-
self.
|
2621
|
+
self.subscription_account(market, self.callbacks["subscriptionAccount"][market])
|
2622
2622
|
if "subscriptionCandles" in self.callbacks:
|
2623
2623
|
for market in self.callbacks["subscriptionCandles"]:
|
2624
2624
|
for interval in self.callbacks["subscriptionCandles"][market]:
|
2625
|
-
self.
|
2625
|
+
self.subscription_candles(
|
2626
2626
|
market,
|
2627
2627
|
interval,
|
2628
2628
|
self.callbacks["subscriptionCandles"][market][interval],
|
2629
2629
|
)
|
2630
2630
|
if "subscriptionTrades" in self.callbacks:
|
2631
2631
|
for market in self.callbacks["subscriptionTrades"]:
|
2632
|
-
self.
|
2632
|
+
self.subscription_trades(market, self.callbacks["subscriptionTrades"][market])
|
2633
2633
|
if "subscriptionBookUpdate" in self.callbacks:
|
2634
2634
|
for market in self.callbacks["subscriptionBookUpdate"]:
|
2635
|
-
self.
|
2635
|
+
self.subscription_book_update(market, self.callbacks["subscriptionBookUpdate"][market])
|
2636
2636
|
if "subscriptionBookUser" in self.callbacks:
|
2637
2637
|
for market in self.callbacks["subscriptionBookUser"]:
|
2638
|
-
self.
|
2638
|
+
self.subscription_book(market, self.callbacks["subscriptionBookUser"][market])
|
2639
2639
|
|
2640
2640
|
def on_open(self, ws: Any) -> None: # noqa: ARG002
|
2641
2641
|
now = time_ms() + bitvavo_upgraded_settings.LAG
|
2642
2642
|
self.open = True
|
2643
2643
|
self.reconnectTimer = 0.5
|
2644
2644
|
if self.APIKEY != "":
|
2645
|
-
self.
|
2645
|
+
self.do_send(
|
2646
2646
|
self.ws,
|
2647
2647
|
json.dumps(
|
2648
2648
|
{
|
2649
2649
|
"window": str(self.ACCESSWINDOW),
|
2650
2650
|
"action": "authenticate",
|
2651
2651
|
"key": self.APIKEY,
|
2652
|
-
"signature":
|
2652
|
+
"signature": create_signature(now, "GET", "/websocket", {}, self.APISECRET),
|
2653
2653
|
"timestamp": now,
|
2654
2654
|
},
|
2655
2655
|
),
|
@@ -2657,10 +2657,10 @@ class Bitvavo:
|
|
2657
2657
|
if self.reconnect:
|
2658
2658
|
if self.bitvavo.debugging:
|
2659
2659
|
logger.debug("reconnecting")
|
2660
|
-
thread = Thread(target=self.
|
2660
|
+
thread = Thread(target=self.check_reconnect)
|
2661
2661
|
thread.start()
|
2662
2662
|
|
2663
|
-
def
|
2663
|
+
def set_error_callback(self, callback: Callable[[Any], None]) -> None:
|
2664
2664
|
self.callbacks["error"] = callback
|
2665
2665
|
|
2666
2666
|
def time(self, callback: Callable[[Any], None]) -> None:
|
@@ -2688,7 +2688,7 @@ class Bitvavo:
|
|
2688
2688
|
```
|
2689
2689
|
"""
|
2690
2690
|
self.callbacks["time"] = callback
|
2691
|
-
self.
|
2691
|
+
self.do_send(self.ws, json.dumps({"action": "getTime"}))
|
2692
2692
|
|
2693
2693
|
def markets(self, options: anydict, callback: Callable[[Any], None]) -> None:
|
2694
2694
|
"""Get all available markets with some meta-information, unless options is given a `market` key.
|
@@ -2742,7 +2742,7 @@ class Bitvavo:
|
|
2742
2742
|
"""
|
2743
2743
|
self.callbacks["markets"] = callback
|
2744
2744
|
options["action"] = "getMarkets"
|
2745
|
-
self.
|
2745
|
+
self.do_send(self.ws, json.dumps(options))
|
2746
2746
|
|
2747
2747
|
def assets(self, options: anydict, callback: Callable[[Any], None]) -> None:
|
2748
2748
|
"""Get all available assets, unless `options` is given a `symbol` key.
|
@@ -2793,7 +2793,7 @@ class Bitvavo:
|
|
2793
2793
|
"""
|
2794
2794
|
self.callbacks["assets"] = callback
|
2795
2795
|
options["action"] = "getAssets"
|
2796
|
-
self.
|
2796
|
+
self.do_send(self.ws, json.dumps(options))
|
2797
2797
|
|
2798
2798
|
def book(self, market: str, options: anydict, callback: Callable[[Any], None]) -> None:
|
2799
2799
|
"""Get a book (with two lists: asks and bids, as they're called)
|
@@ -2840,7 +2840,7 @@ class Bitvavo:
|
|
2840
2840
|
self.callbacks["book"] = callback
|
2841
2841
|
options["market"] = market
|
2842
2842
|
options["action"] = "getBook"
|
2843
|
-
self.
|
2843
|
+
self.do_send(self.ws, json.dumps(options))
|
2844
2844
|
|
2845
2845
|
def publicTrades(self, market: str, options: anydict, callback: Callable[[Any], None]) -> None:
|
2846
2846
|
"""Publically available trades
|
@@ -2892,7 +2892,7 @@ class Bitvavo:
|
|
2892
2892
|
self.callbacks["publicTrades"] = callback
|
2893
2893
|
options["market"] = market
|
2894
2894
|
options["action"] = "getTrades"
|
2895
|
-
self.
|
2895
|
+
self.do_send(self.ws, json.dumps(options))
|
2896
2896
|
|
2897
2897
|
def candles(
|
2898
2898
|
self,
|
@@ -2951,9 +2951,9 @@ class Bitvavo:
|
|
2951
2951
|
options["market"] = market
|
2952
2952
|
options["interval"] = interval
|
2953
2953
|
options["action"] = "getCandles"
|
2954
|
-
self.
|
2954
|
+
self.do_send(self.ws, json.dumps(options))
|
2955
2955
|
|
2956
|
-
def
|
2956
|
+
def ticker_price(self, options: anydict, callback: Callable[[Any], None]) -> None:
|
2957
2957
|
"""Get the current price for each market
|
2958
2958
|
|
2959
2959
|
---
|
@@ -3001,9 +3001,9 @@ class Bitvavo:
|
|
3001
3001
|
"""
|
3002
3002
|
self.callbacks["tickerPrice"] = callback
|
3003
3003
|
options["action"] = "getTickerPrice"
|
3004
|
-
self.
|
3004
|
+
self.do_send(self.ws, json.dumps(options))
|
3005
3005
|
|
3006
|
-
def
|
3006
|
+
def ticker_book(self, options: anydict, callback: Callable[[Any], None]) -> None:
|
3007
3007
|
"""Get current bid/ask, bidsize/asksize per market
|
3008
3008
|
|
3009
3009
|
---
|
@@ -3044,7 +3044,7 @@ class Bitvavo:
|
|
3044
3044
|
""" # noqa: E501
|
3045
3045
|
self.callbacks["tickerBook"] = callback
|
3046
3046
|
options["action"] = "getTickerBook"
|
3047
|
-
self.
|
3047
|
+
self.do_send(self.ws, json.dumps(options))
|
3048
3048
|
|
3049
3049
|
def ticker24h(self, options: anydict, callback: Callable[[Any], None]) -> None:
|
3050
3050
|
"""Get current bid/ask, bidsize/asksize per market
|
@@ -3111,9 +3111,9 @@ class Bitvavo:
|
|
3111
3111
|
"""
|
3112
3112
|
self.callbacks["ticker24h"] = callback
|
3113
3113
|
options["action"] = "getTicker24h"
|
3114
|
-
self.
|
3114
|
+
self.do_send(self.ws, json.dumps(options))
|
3115
3115
|
|
3116
|
-
def
|
3116
|
+
def place_order(
|
3117
3117
|
self,
|
3118
3118
|
market: str,
|
3119
3119
|
side: str,
|
@@ -3253,9 +3253,9 @@ class Bitvavo:
|
|
3253
3253
|
body["orderType"] = orderType
|
3254
3254
|
body["operatorId"] = operatorId
|
3255
3255
|
body["action"] = "privateCreateOrder"
|
3256
|
-
self.
|
3256
|
+
self.do_send(self.ws, json.dumps(body), True)
|
3257
3257
|
|
3258
|
-
def
|
3258
|
+
def update_order(
|
3259
3259
|
self,
|
3260
3260
|
market: str,
|
3261
3261
|
orderId: str,
|
@@ -3351,9 +3351,9 @@ class Bitvavo:
|
|
3351
3351
|
body["orderId"] = orderId
|
3352
3352
|
body["operatorId"] = operatorId
|
3353
3353
|
body["action"] = "privateUpdateOrder"
|
3354
|
-
self.
|
3354
|
+
self.do_send(self.ws, json.dumps(body), True)
|
3355
3355
|
|
3356
|
-
def
|
3356
|
+
def cancel_order(
|
3357
3357
|
self,
|
3358
3358
|
market: str,
|
3359
3359
|
operatorId: int,
|
@@ -3403,9 +3403,9 @@ class Bitvavo:
|
|
3403
3403
|
elif orderId is not None:
|
3404
3404
|
options["orderId"] = orderId
|
3405
3405
|
|
3406
|
-
self.
|
3406
|
+
self.do_send(self.ws, json.dumps(options), True)
|
3407
3407
|
|
3408
|
-
def
|
3408
|
+
def get_order(self, market: str, orderId: str, callback: Callable[[Any], None]) -> None:
|
3409
3409
|
"""Get an existing order for a specific market
|
3410
3410
|
|
3411
3411
|
---
|
@@ -3474,9 +3474,9 @@ class Bitvavo:
|
|
3474
3474
|
"market": market,
|
3475
3475
|
"orderId": orderId,
|
3476
3476
|
}
|
3477
|
-
self.
|
3477
|
+
self.do_send(self.ws, json.dumps(options), True)
|
3478
3478
|
|
3479
|
-
def
|
3479
|
+
def get_orders(self, market: str, options: anydict, callback: Callable[[Any], None]) -> None:
|
3480
3480
|
"""Get multiple existing orders for a specific market
|
3481
3481
|
|
3482
3482
|
---
|
@@ -3554,9 +3554,9 @@ class Bitvavo:
|
|
3554
3554
|
self.callbacks["getOrders"] = callback
|
3555
3555
|
options["action"] = "privateGetOrders"
|
3556
3556
|
options["market"] = market
|
3557
|
-
self.
|
3557
|
+
self.do_send(self.ws, json.dumps(options), True)
|
3558
3558
|
|
3559
|
-
def
|
3559
|
+
def cancel_orders(self, options: anydict, callback: Callable[[Any], None]) -> None:
|
3560
3560
|
"""Cancel all existing orders for a specific market (or account)
|
3561
3561
|
|
3562
3562
|
---
|
@@ -3584,9 +3584,9 @@ class Bitvavo:
|
|
3584
3584
|
"""
|
3585
3585
|
self.callbacks["cancelOrders"] = callback
|
3586
3586
|
options["action"] = "privateCancelOrders"
|
3587
|
-
self.
|
3587
|
+
self.do_send(self.ws, json.dumps(options), True)
|
3588
3588
|
|
3589
|
-
def
|
3589
|
+
def orders_open(self, options: anydict, callback: Callable[[Any], None]) -> None:
|
3590
3590
|
"""Get all open orders, either for all markets, or a single market
|
3591
3591
|
|
3592
3592
|
---
|
@@ -3654,7 +3654,7 @@ class Bitvavo:
|
|
3654
3654
|
"""
|
3655
3655
|
self.callbacks["ordersOpen"] = callback
|
3656
3656
|
options["action"] = "privateGetOrdersOpen"
|
3657
|
-
self.
|
3657
|
+
self.do_send(self.ws, json.dumps(options), True)
|
3658
3658
|
|
3659
3659
|
def trades(self, market: str, options: anydict, callback: Callable[[Any], None]) -> None:
|
3660
3660
|
"""Get all historic trades from this account
|
@@ -3703,7 +3703,7 @@ class Bitvavo:
|
|
3703
3703
|
self.callbacks["trades"] = callback
|
3704
3704
|
options["action"] = "privateGetTrades"
|
3705
3705
|
options["market"] = market
|
3706
|
-
self.
|
3706
|
+
self.do_send(self.ws, json.dumps(options), True)
|
3707
3707
|
|
3708
3708
|
def account(self, callback: Callable[[Any], None]) -> None:
|
3709
3709
|
"""Get all fees for this account
|
@@ -3733,7 +3733,7 @@ class Bitvavo:
|
|
3733
3733
|
```
|
3734
3734
|
"""
|
3735
3735
|
self.callbacks["account"] = callback
|
3736
|
-
self.
|
3736
|
+
self.do_send(self.ws, json.dumps({"action": "privateGetAccount"}), True)
|
3737
3737
|
|
3738
3738
|
def balance(self, options: anydict, callback: Callable[[Any], None]) -> None:
|
3739
3739
|
"""Get the balance for this account
|
@@ -3766,9 +3766,9 @@ class Bitvavo:
|
|
3766
3766
|
"""
|
3767
3767
|
options["action"] = "privateGetBalance"
|
3768
3768
|
self.callbacks["balance"] = callback
|
3769
|
-
self.
|
3769
|
+
self.do_send(self.ws, json.dumps(options), True)
|
3770
3770
|
|
3771
|
-
def
|
3771
|
+
def deposit_assets(self, symbol: str, callback: Callable[[Any], None]) -> None:
|
3772
3772
|
"""
|
3773
3773
|
Get the deposit address (with paymentId for some assets) or bank account information to increase your
|
3774
3774
|
balance.
|
@@ -3804,13 +3804,13 @@ class Bitvavo:
|
|
3804
3804
|
```
|
3805
3805
|
"""
|
3806
3806
|
self.callbacks["depositAssets"] = callback
|
3807
|
-
self.
|
3807
|
+
self.do_send(
|
3808
3808
|
self.ws,
|
3809
3809
|
json.dumps({"action": "privateDepositAssets", "symbol": symbol}),
|
3810
3810
|
True,
|
3811
3811
|
)
|
3812
3812
|
|
3813
|
-
def
|
3813
|
+
def deposit_history(self, options: anydict, callback: Callable[[Any], None]) -> None:
|
3814
3814
|
"""Get the deposit history of the account
|
3815
3815
|
|
3816
3816
|
Even when you want something from a single `symbol`, you'll still receive a list with multiple deposits.
|
@@ -3862,9 +3862,9 @@ class Bitvavo:
|
|
3862
3862
|
"""
|
3863
3863
|
self.callbacks["depositHistory"] = callback
|
3864
3864
|
options["action"] = "privateGetDepositHistory"
|
3865
|
-
self.
|
3865
|
+
self.do_send(self.ws, json.dumps(options), True)
|
3866
3866
|
|
3867
|
-
def
|
3867
|
+
def withdraw_assets(
|
3868
3868
|
self,
|
3869
3869
|
symbol: str,
|
3870
3870
|
amount: str,
|
@@ -3915,9 +3915,9 @@ class Bitvavo:
|
|
3915
3915
|
body["symbol"] = symbol
|
3916
3916
|
body["amount"] = amount
|
3917
3917
|
body["address"] = address
|
3918
|
-
self.
|
3918
|
+
self.do_send(self.ws, json.dumps(body), True)
|
3919
3919
|
|
3920
|
-
def
|
3920
|
+
def withdrawal_history(self, options: anydict, callback: Callable[[Any], None]) -> None:
|
3921
3921
|
"""Get the withdrawal history
|
3922
3922
|
|
3923
3923
|
---
|
@@ -3958,9 +3958,9 @@ class Bitvavo:
|
|
3958
3958
|
"""
|
3959
3959
|
self.callbacks["withdrawalHistory"] = callback
|
3960
3960
|
options["action"] = "privateGetWithdrawalHistory"
|
3961
|
-
self.
|
3961
|
+
self.do_send(self.ws, json.dumps(options), True)
|
3962
3962
|
|
3963
|
-
def
|
3963
|
+
def subscription_ticker(self, market: str, callback: Callable[[Any], None]) -> None:
|
3964
3964
|
# TODO(NostraDavid): one possible improvement here is to turn `market` into a list of markets, so we can sub
|
3965
3965
|
# to all of them at once. Same goes for other `subscription*()`
|
3966
3966
|
"""
|
@@ -4002,7 +4002,7 @@ class Bitvavo:
|
|
4002
4002
|
if "subscriptionTicker" not in self.callbacks:
|
4003
4003
|
self.callbacks["subscriptionTicker"] = {}
|
4004
4004
|
self.callbacks["subscriptionTicker"][market] = callback
|
4005
|
-
self.
|
4005
|
+
self.do_send(
|
4006
4006
|
self.ws,
|
4007
4007
|
json.dumps(
|
4008
4008
|
{
|
@@ -4012,7 +4012,7 @@ class Bitvavo:
|
|
4012
4012
|
),
|
4013
4013
|
)
|
4014
4014
|
|
4015
|
-
def
|
4015
|
+
def subscription_ticker24h(self, market: str, callback: Callable[[Any], None]) -> None:
|
4016
4016
|
"""
|
4017
4017
|
Subscribe to the ticker-24-hour channel, which means `callback` gets passed the new object every second, if
|
4018
4018
|
values have changed.
|
@@ -4059,7 +4059,7 @@ class Bitvavo:
|
|
4059
4059
|
if "subscriptionTicker24h" not in self.callbacks:
|
4060
4060
|
self.callbacks["subscriptionTicker24h"] = {}
|
4061
4061
|
self.callbacks["subscriptionTicker24h"][market] = callback
|
4062
|
-
self.
|
4062
|
+
self.do_send(
|
4063
4063
|
self.ws,
|
4064
4064
|
json.dumps(
|
4065
4065
|
{
|
@@ -4069,7 +4069,7 @@ class Bitvavo:
|
|
4069
4069
|
),
|
4070
4070
|
)
|
4071
4071
|
|
4072
|
-
def
|
4072
|
+
def subscription_account(self, market: str, callback: Callable[[Any], None]) -> None:
|
4073
4073
|
"""
|
4074
4074
|
Subscribes to the account channel, which sends an update whenever an event happens which is related to
|
4075
4075
|
the account. These are 'order' events (create, update, cancel) or 'fill' events (a trade occurred).
|
@@ -4136,7 +4136,7 @@ class Bitvavo:
|
|
4136
4136
|
if "subscriptionAccount" not in self.callbacks:
|
4137
4137
|
self.callbacks["subscriptionAccount"] = {}
|
4138
4138
|
self.callbacks["subscriptionAccount"][market] = callback
|
4139
|
-
self.
|
4139
|
+
self.do_send(
|
4140
4140
|
self.ws,
|
4141
4141
|
json.dumps(
|
4142
4142
|
{
|
@@ -4147,7 +4147,7 @@ class Bitvavo:
|
|
4147
4147
|
True,
|
4148
4148
|
)
|
4149
4149
|
|
4150
|
-
def
|
4150
|
+
def subscription_candles(self, market: str, interval: str, callback: Callable[[Any], None]) -> None:
|
4151
4151
|
"""Subscribes to candles and returns a candle each time a new one is formed, depending on the interval
|
4152
4152
|
|
4153
4153
|
---
|
@@ -4195,7 +4195,7 @@ class Bitvavo:
|
|
4195
4195
|
if market not in self.callbacks["subscriptionCandles"]:
|
4196
4196
|
self.callbacks["subscriptionCandles"][market] = {}
|
4197
4197
|
self.callbacks["subscriptionCandles"][market][interval] = callback
|
4198
|
-
self.
|
4198
|
+
self.do_send(
|
4199
4199
|
self.ws,
|
4200
4200
|
json.dumps(
|
4201
4201
|
{
|
@@ -4211,7 +4211,7 @@ class Bitvavo:
|
|
4211
4211
|
),
|
4212
4212
|
)
|
4213
4213
|
|
4214
|
-
def
|
4214
|
+
def subscription_trades(self, market: str, callback: Callable[[Any], None]) -> None:
|
4215
4215
|
"""Subscribes to trades, which sends an object whenever a trade has occurred.
|
4216
4216
|
|
4217
4217
|
---
|
@@ -4248,7 +4248,7 @@ class Bitvavo:
|
|
4248
4248
|
if "subscriptionTrades" not in self.callbacks:
|
4249
4249
|
self.callbacks["subscriptionTrades"] = {}
|
4250
4250
|
self.callbacks["subscriptionTrades"][market] = callback
|
4251
|
-
self.
|
4251
|
+
self.do_send(
|
4252
4252
|
self.ws,
|
4253
4253
|
json.dumps(
|
4254
4254
|
{
|
@@ -4258,7 +4258,7 @@ class Bitvavo:
|
|
4258
4258
|
),
|
4259
4259
|
)
|
4260
4260
|
|
4261
|
-
def
|
4261
|
+
def subscription_book_update(self, market: str, callback: Callable[[Any], None]) -> None:
|
4262
4262
|
"""Subscribes to the book and returns a delta on every change to the book.
|
4263
4263
|
|
4264
4264
|
---
|
@@ -4315,7 +4315,7 @@ class Bitvavo:
|
|
4315
4315
|
if "subscriptionBookUpdate" not in self.callbacks:
|
4316
4316
|
self.callbacks["subscriptionBookUpdate"] = {}
|
4317
4317
|
self.callbacks["subscriptionBookUpdate"][market] = callback
|
4318
|
-
self.
|
4318
|
+
self.do_send(
|
4319
4319
|
self.ws,
|
4320
4320
|
json.dumps(
|
4321
4321
|
{
|
@@ -4325,7 +4325,7 @@ class Bitvavo:
|
|
4325
4325
|
),
|
4326
4326
|
)
|
4327
4327
|
|
4328
|
-
def
|
4328
|
+
def subscription_book(self, market: str, callback: Callable[[Any], None]) -> None:
|
4329
4329
|
"""Subscribes to the book and returns a delta on every change to the book.
|
4330
4330
|
|
4331
4331
|
---
|
@@ -4385,8 +4385,8 @@ class Bitvavo:
|
|
4385
4385
|
self.callbacks["subscriptionBookUser"][market] = callback
|
4386
4386
|
if "subscriptionBook" not in self.callbacks:
|
4387
4387
|
self.callbacks["subscriptionBook"] = {}
|
4388
|
-
self.callbacks["subscriptionBook"][market] =
|
4389
|
-
self.
|
4388
|
+
self.callbacks["subscriptionBook"][market] = process_local_book
|
4389
|
+
self.do_send(
|
4390
4390
|
self.ws,
|
4391
4391
|
json.dumps(
|
4392
4392
|
{
|
@@ -4397,4 +4397,4 @@ class Bitvavo:
|
|
4397
4397
|
)
|
4398
4398
|
|
4399
4399
|
self.localBook[market] = {}
|
4400
|
-
self.
|
4400
|
+
self.do_send(self.ws, json.dumps({"action": "getBook", "market": market}))
|
File without changes
|
{bitvavo_api_upgraded-2.2.0 → bitvavo_api_upgraded-3.0.0}/src/bitvavo_api_upgraded/__init__.py
RENAMED
File without changes
|
File without changes
|
{bitvavo_api_upgraded-2.2.0 → bitvavo_api_upgraded-3.0.0}/src/bitvavo_api_upgraded/helper_funcs.py
RENAMED
File without changes
|
File without changes
|
{bitvavo_api_upgraded-2.2.0 → bitvavo_api_upgraded-3.0.0}/src/bitvavo_api_upgraded/settings.py
RENAMED
File without changes
|
{bitvavo_api_upgraded-2.2.0 → bitvavo_api_upgraded-3.0.0}/src/bitvavo_api_upgraded/type_aliases.py
RENAMED
File without changes
|