bitvavo-api-upgraded 1.17.0__tar.gz → 1.17.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {bitvavo_api_upgraded-1.17.0 → bitvavo_api_upgraded-1.17.1}/.gitignore +1 -0
- bitvavo_api_upgraded-1.17.1/.python-version +5 -0
- bitvavo_api_upgraded-1.17.1/.vscode/settings.json +2 -0
- {bitvavo_api_upgraded-1.17.0 → bitvavo_api_upgraded-1.17.1}/CHANGELOG.md +44 -0
- {bitvavo_api_upgraded-1.17.0 → bitvavo_api_upgraded-1.17.1}/PKG-INFO +4 -3
- {bitvavo_api_upgraded-1.17.0 → bitvavo_api_upgraded-1.17.1}/README.pypi.md +4 -0
- {bitvavo_api_upgraded-1.17.0 → bitvavo_api_upgraded-1.17.1}/pyproject.toml +50 -52
- bitvavo_api_upgraded-1.17.1/src/bitvavo_api_upgraded/__init__.py +8 -0
- {bitvavo_api_upgraded-1.17.0 → bitvavo_api_upgraded-1.17.1}/src/bitvavo_api_upgraded/bitvavo.py +6 -6
- bitvavo_api_upgraded-1.17.1/src/bitvavo_api_upgraded/settings.py +70 -0
- {bitvavo_api_upgraded-1.17.0 → bitvavo_api_upgraded-1.17.1}/tests/conftest.py +7 -32
- {bitvavo_api_upgraded-1.17.0 → bitvavo_api_upgraded-1.17.1}/tests/test_bitvavo.py +71 -53
- bitvavo_api_upgraded-1.17.1/tests/test_settings.py +36 -0
- {bitvavo_api_upgraded-1.17.0 → bitvavo_api_upgraded-1.17.1}/tox.ini +6 -2
- {bitvavo_api_upgraded-1.17.0 → bitvavo_api_upgraded-1.17.1}/uv.lock +309 -281
- bitvavo_api_upgraded-1.17.0/.python-version +0 -5
- bitvavo_api_upgraded-1.17.0/src/bitvavo_api_upgraded/__init__.py +0 -3
- bitvavo_api_upgraded-1.17.0/src/bitvavo_api_upgraded/settings.py +0 -47
- {bitvavo_api_upgraded-1.17.0 → bitvavo_api_upgraded-1.17.1}/.github/README.md +0 -0
- {bitvavo_api_upgraded-1.17.0 → bitvavo_api_upgraded-1.17.1}/.github/workflows/release.yml +0 -0
- {bitvavo_api_upgraded-1.17.0 → bitvavo_api_upgraded-1.17.1}/.pre-commit-config.yaml +0 -0
- {bitvavo_api_upgraded-1.17.0 → bitvavo_api_upgraded-1.17.1}/LICENSE.txt +0 -0
- {bitvavo_api_upgraded-1.17.0 → bitvavo_api_upgraded-1.17.1}/README.md +0 -0
- {bitvavo_api_upgraded-1.17.0 → bitvavo_api_upgraded-1.17.1}/docs/assets/bitvavo-mark-square-blue.svg +0 -0
- {bitvavo_api_upgraded-1.17.0 → bitvavo_api_upgraded-1.17.1}/docs/rest.md +0 -0
- {bitvavo_api_upgraded-1.17.0 → bitvavo_api_upgraded-1.17.1}/scripts/bootstrap.sh +0 -0
- {bitvavo_api_upgraded-1.17.0 → bitvavo_api_upgraded-1.17.1}/src/bitvavo_api_upgraded/helper_funcs.py +0 -0
- {bitvavo_api_upgraded-1.17.0 → bitvavo_api_upgraded-1.17.1}/src/bitvavo_api_upgraded/py.typed +0 -0
- {bitvavo_api_upgraded-1.17.0 → bitvavo_api_upgraded-1.17.1}/src/bitvavo_api_upgraded/type_aliases.py +0 -0
- {bitvavo_api_upgraded-1.17.0 → bitvavo_api_upgraded-1.17.1}/tests/__init__.py +0 -0
- {bitvavo_api_upgraded-1.17.0 → bitvavo_api_upgraded-1.17.1}/tests/test_helper_funcs.py +0 -0
@@ -1,5 +1,49 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
v1.17.1 - 2024-12-24
|
4
|
+
|
5
|
+
Turns out the settings weren't working as expected, so I switched
|
6
|
+
`python-decouple` out from `pydantic-settings`, which (once setup) works a lot
|
7
|
+
smoother. Keywords being "once setup", because holy smokes is it a paint to do
|
8
|
+
the initial setup - figure out how the hell you need to validate values before
|
9
|
+
or after, etc.
|
10
|
+
|
11
|
+
Just don't forget to create a local `.env` with `BITVAVO_APIKEY` and
|
12
|
+
`BITVAVO_APISECRET` keys.
|
13
|
+
|
14
|
+
### Added
|
15
|
+
|
16
|
+
- `pydantic-settings`: a powerful and modern way of loading your settings.
|
17
|
+
- we're using `.env` here, but it can be setup for `.json` or `.yaml` -
|
18
|
+
whatever you fancy.
|
19
|
+
- because of `pydantic-settings` you can now also do
|
20
|
+
`Bitvavo(bitvavo_settings.model_dump())`, and import bitvavo_settings from
|
21
|
+
`settings.py`
|
22
|
+
- add pydantic plugin for mypy, so mypy stops complaining about pydantic.
|
23
|
+
- vscode settings to disable `pytest-cov` during debugging. If you do not
|
24
|
+
disable `pytest-cov` during debugging, it still silently break your debugging
|
25
|
+
system...
|
26
|
+
- you can now import BitvavoApiUpgradedSettings and BitvavoSettings directly
|
27
|
+
from `bitvavo_api_upgraded`
|
28
|
+
|
29
|
+
### Changed
|
30
|
+
|
31
|
+
- `python-decouple` replaced by `pydantic-settings` - see Added and Removed
|
32
|
+
- `pytest-cov` relegated to enable coverage via vscode - friendship with
|
33
|
+
`pytest-cov` ended. `coverage.py` is my best friend.
|
34
|
+
- reason for this is because `pytest-cov` fucked with the ability to debug
|
35
|
+
within vscode.
|
36
|
+
- bump minor Python versions
|
37
|
+
|
38
|
+
### Removed
|
39
|
+
|
40
|
+
- `python-decouple` - this lacked type hinting since forever, not to mention it
|
41
|
+
didn't throw errors if missing...
|
42
|
+
|
43
|
+
### Fixed
|
44
|
+
|
45
|
+
- a bunch of tests that have VERY flaky output from the API >:(
|
46
|
+
|
3
47
|
## v1.17.0 - 2024-11-24
|
4
48
|
|
5
49
|
Integrate all changes from Bitvavo's `v1.1.1` to `v1.4.2` lib versions,
|
@@ -1,6 +1,6 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.4
|
2
2
|
Name: bitvavo-api-upgraded
|
3
|
-
Version: 1.17.
|
3
|
+
Version: 1.17.1
|
4
4
|
Summary: A unit-tested fork of the Bitvavo API
|
5
5
|
Project-URL: homepage, https://github.com/Thaumatorium/bitvavo-api-upgraded
|
6
6
|
Project-URL: repository, https://github.com/Thaumatorium/bitvavo-api-upgraded
|
@@ -9,6 +9,7 @@ Author: Bitvavo BV (original code)
|
|
9
9
|
Author-email: NostraDavid <55331731+NostraDavid@users.noreply.github.com>
|
10
10
|
Maintainer-email: NostraDavid <55331731+NostraDavid@users.noreply.github.com>
|
11
11
|
License: ISC License
|
12
|
+
License-File: LICENSE.txt
|
12
13
|
Classifier: Development Status :: 5 - Production/Stable
|
13
14
|
Classifier: Environment :: Console
|
14
15
|
Classifier: Framework :: Pytest
|
@@ -27,7 +28,7 @@ Classifier: Programming Language :: Python :: 3.12
|
|
27
28
|
Classifier: Programming Language :: Python :: 3.13
|
28
29
|
Classifier: Typing :: Typed
|
29
30
|
Requires-Python: >=3.9
|
30
|
-
Requires-Dist:
|
31
|
+
Requires-Dist: pydantic-settings==2.*,>=2.6
|
31
32
|
Requires-Dist: requests==2.*,>=2.26
|
32
33
|
Requires-Dist: structlog==24.*,>=21.5
|
33
34
|
Requires-Dist: websocket-client==1.*,>=1.2
|
@@ -41,6 +41,10 @@ some handy settings there.
|
|
41
41
|
Here is an example list of the settings for this lib:
|
42
42
|
|
43
43
|
```ini
|
44
|
+
# needed for the private part of the API
|
45
|
+
BITVAVO_APIKEY=
|
46
|
+
BITVAVO_APISECRET=
|
47
|
+
|
44
48
|
BITVAVO_API_UPGRADED_LOG_LEVEL=INFO # Set the lib's log level
|
45
49
|
BITVAVO_API_UPGRADED_LOG_EXTERNAL_LEVEL=WARNING # Set the libs that are used by *this* lib's log level
|
46
50
|
BITVAVO_API_UPGRADED_LAG=50 # the time difference between the server and your local time (you'll have to calculate this yourself - tip: use the bitvavo.time() functionality in a separate script)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html
|
2
2
|
[project]
|
3
3
|
name = "bitvavo-api-upgraded"
|
4
|
-
version = "1.17.
|
4
|
+
version = "1.17.1"
|
5
5
|
description = "A unit-tested fork of the Bitvavo API"
|
6
6
|
readme = "README.md"
|
7
7
|
requires-python = ">=3.9"
|
@@ -33,10 +33,10 @@ classifiers = [
|
|
33
33
|
"Typing :: Typed",
|
34
34
|
]
|
35
35
|
dependencies = [
|
36
|
-
"
|
37
|
-
"requests==2.*, >=2.26",
|
38
|
-
"structlog==24.*, >=21.5",
|
39
|
-
"websocket-client==1.*, >=1.2",
|
36
|
+
"pydantic-settings==2.*, >=2.6", # to handle settings
|
37
|
+
"requests==2.*, >=2.26", # to make http requests
|
38
|
+
"structlog==24.*, >=21.5", # for logging
|
39
|
+
"websocket-client==1.*, >=1.2", # something something websocket
|
40
40
|
]
|
41
41
|
|
42
42
|
[project.urls]
|
@@ -44,18 +44,16 @@ homepage = "https://github.com/Thaumatorium/bitvavo-api-upgraded"
|
|
44
44
|
repository = "https://github.com/Thaumatorium/bitvavo-api-upgraded"
|
45
45
|
changelog = "https://github.com/Thaumatorium/bitvavo-api-upgraded/blob/master/CHANGELOG.md"
|
46
46
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
[dependency-groups]
|
52
|
-
dev = [
|
47
|
+
# https://docs.astral.sh/uv/
|
48
|
+
[tool.uv]
|
49
|
+
dev-dependencies = [
|
53
50
|
"bump-my-version>=0.28.1", # for version management of the lib
|
54
51
|
"mdformat>=0.7.11", # for formatting markdown (.md) documents
|
55
52
|
"mkdocs>=1.2.3", # for markdown documentation
|
56
53
|
"mypy>=1.13", # amazing linter
|
57
54
|
"pre-commit>=2.15.0", # for running hooks before committing code
|
58
|
-
"
|
55
|
+
"coverage[toml]>=7.6.9", # for checking coverage; use this in tox vs pytest-cov, since pytest-cov does NOT play well with vscode
|
56
|
+
"pytest-cov>=1", # though this was the initial choice over coverage.py, turns out it fucks with vscode debugging, so now it only exists so we can still run tests with coverage within vscode
|
59
57
|
"pytest-integration>=0.2.2", # for @mark additions
|
60
58
|
"pytest-mock>=3.6.1", # for the `mocker` MockerFixture fixture
|
61
59
|
"pytest>=6.2.4", # you can run `pytest` to run the unit tests; will also be run by `tox` :)
|
@@ -65,8 +63,12 @@ dev = [
|
|
65
63
|
"types-requests>=2.26.2", # typing for mypy
|
66
64
|
]
|
67
65
|
|
66
|
+
[build-system]
|
67
|
+
requires = ["hatchling"]
|
68
|
+
build-backend = "hatchling.build"
|
69
|
+
|
68
70
|
[tool.bumpversion]
|
69
|
-
current_version = "1.17.
|
71
|
+
current_version = "1.17.1"
|
70
72
|
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
|
71
73
|
serialize = ["{major}.{minor}.{patch}"]
|
72
74
|
search = "{current_version}"
|
@@ -96,7 +98,31 @@ filename = "CHANGELOG.md"
|
|
96
98
|
search = "$UNRELEASED"
|
97
99
|
replace = "v{new_version} - {now:%Y-%m-%d}"
|
98
100
|
|
99
|
-
|
101
|
+
[tool.coverage.run]
|
102
|
+
branch = true
|
103
|
+
source = ["src"]
|
104
|
+
parallel = true
|
105
|
+
relative_files = true
|
106
|
+
|
107
|
+
[tool.coverage.paths]
|
108
|
+
source = ["src/bitvavo_api_upgraded"]
|
109
|
+
omit = [
|
110
|
+
"*/tests/*", # Omit test files
|
111
|
+
"*/__init__.py", # Optionally omit __init__ files
|
112
|
+
]
|
113
|
+
[tool.coverage.report]
|
114
|
+
fail_under = 50
|
115
|
+
precision = 0
|
116
|
+
show_missing = true
|
117
|
+
skip_covered = true
|
118
|
+
skip_empty = true
|
119
|
+
sort = "Cover"
|
120
|
+
exclude_lines = [
|
121
|
+
"pragma: no cover", # Common usage for excluding lines from coverage
|
122
|
+
"if __name__ == .__main__.:", # Skip lines commonly used in scripts
|
123
|
+
]
|
124
|
+
|
125
|
+
# https://mypy.readthedocs.io/en/stable/config_file.html
|
100
126
|
[tool.mypy]
|
101
127
|
# created for mypy 1.13
|
102
128
|
|
@@ -188,7 +214,7 @@ skip_version_check = false
|
|
188
214
|
skip_cache_mtime_checks = false
|
189
215
|
|
190
216
|
# Advanced options
|
191
|
-
plugins = []
|
217
|
+
plugins = ["pydantic.mypy"]
|
192
218
|
pdb = false
|
193
219
|
show_traceback = false
|
194
220
|
raise_exceptions = false
|
@@ -228,31 +254,6 @@ verbosity = 0
|
|
228
254
|
# ]
|
229
255
|
# ignore_missing_imports = true
|
230
256
|
|
231
|
-
# PROGRAM SETTINGS
|
232
|
-
[tool.coverage.run]
|
233
|
-
branch = true
|
234
|
-
source = ["bitvavo_api_upgraded"]
|
235
|
-
parallel = true
|
236
|
-
relative_files = true
|
237
|
-
|
238
|
-
[tool.coverage.paths]
|
239
|
-
source = [
|
240
|
-
"src/bitvavo_api_upgraded",
|
241
|
-
".tox/py3*/lib/python3.*/site-packages/bitvavo_api_upgraded",
|
242
|
-
]
|
243
|
-
|
244
|
-
[tool.coverage.report]
|
245
|
-
fail_under = 50
|
246
|
-
precision = 0
|
247
|
-
show_missing = true
|
248
|
-
skip_covered = true
|
249
|
-
skip_empty = true
|
250
|
-
sort = "Cover"
|
251
|
-
exclude_lines = [
|
252
|
-
"pragma: no cover", # Common usage for excluding lines from coverage
|
253
|
-
"if __name__ == .__main__.:", # Skip lines commonly used in scripts
|
254
|
-
]
|
255
|
-
|
256
257
|
[tool.black]
|
257
258
|
line-length = 120
|
258
259
|
include = "(src|tests)/.*.py"
|
@@ -263,19 +264,16 @@ profile = "black"
|
|
263
264
|
src_paths = ["src", "tests"]
|
264
265
|
|
265
266
|
[tool.pytest.ini_options]
|
266
|
-
|
267
|
-
|
268
|
-
--
|
269
|
-
--
|
270
|
-
--
|
271
|
-
--
|
272
|
-
|
273
|
-
|
274
|
-
--show-capture=all
|
275
|
-
"""
|
276
|
-
# addopts = "--durations-min=1 --stepwise --verbosity=2 --no-header --show-capture=all"
|
277
|
-
# addopts = "--durations=10 --durations-min=1 --stepwise --verbosity=1 --no-header"
|
267
|
+
minversion = "8.0"
|
268
|
+
addopts = [
|
269
|
+
"--durations-min=1",
|
270
|
+
"--verbosity=2",
|
271
|
+
"--no-header",
|
272
|
+
"--show-capture=all",
|
273
|
+
]
|
274
|
+
|
278
275
|
testpaths = ["tests"]
|
276
|
+
pythonpath = ["src"]
|
279
277
|
markers = ["no_cover: some pytest-integration default mark that's not known?."]
|
280
278
|
python_classes = "Test*"
|
281
279
|
python_files = "test_*.py"
|
{bitvavo_api_upgraded-1.17.0 → bitvavo_api_upgraded-1.17.1}/src/bitvavo_api_upgraded/bitvavo.py
RENAMED
@@ -14,7 +14,7 @@ from structlog.stdlib import get_logger
|
|
14
14
|
from websocket import WebSocketApp # missing stubs for WebSocketApp
|
15
15
|
|
16
16
|
from bitvavo_api_upgraded.helper_funcs import configure_loggers, time_ms, time_to_wait
|
17
|
-
from bitvavo_api_upgraded.settings import
|
17
|
+
from bitvavo_api_upgraded.settings import bitvavo_upgraded_settings
|
18
18
|
from bitvavo_api_upgraded.type_aliases import anydict, errordict, intdict, ms, s_f, strdict, strintdict
|
19
19
|
|
20
20
|
configure_loggers()
|
@@ -332,7 +332,7 @@ class Bitvavo:
|
|
332
332
|
list[list[str]]
|
333
333
|
```
|
334
334
|
"""
|
335
|
-
if (self.rateLimitRemaining - rateLimitingWeight) <=
|
335
|
+
if (self.rateLimitRemaining - rateLimitingWeight) <= bitvavo_upgraded_settings.RATE_LIMITING_BUFFER:
|
336
336
|
self.sleep_until_can_continue()
|
337
337
|
if self.debugging:
|
338
338
|
logger.debug(
|
@@ -344,7 +344,7 @@ class Bitvavo:
|
|
344
344
|
},
|
345
345
|
)
|
346
346
|
if self.APIKEY != "":
|
347
|
-
now = time_ms() +
|
347
|
+
now = time_ms() + bitvavo_upgraded_settings.LAG
|
348
348
|
sig = createSignature(now, "GET", url.replace(self.base, ""), None, self.APISECRET)
|
349
349
|
headers = {
|
350
350
|
"bitvavo-access-key": self.APIKEY,
|
@@ -391,10 +391,10 @@ class Bitvavo:
|
|
391
391
|
list[list[str]]
|
392
392
|
```
|
393
393
|
"""
|
394
|
-
if (self.rateLimitRemaining - rateLimitingWeight) <=
|
394
|
+
if (self.rateLimitRemaining - rateLimitingWeight) <= bitvavo_upgraded_settings.RATE_LIMITING_BUFFER:
|
395
395
|
self.sleep_until_can_continue()
|
396
396
|
# if this method breaks: add `= {}` after `body: dict`
|
397
|
-
now = time_ms() +
|
397
|
+
now = time_ms() + bitvavo_upgraded_settings.LAG
|
398
398
|
sig = createSignature(now, method, (endpoint + postfix), body, self.APISECRET)
|
399
399
|
url = self.base + endpoint + postfix
|
400
400
|
headers = {
|
@@ -1832,7 +1832,7 @@ class Bitvavo:
|
|
1832
1832
|
self.subscriptionBook(market, self.callbacks["subscriptionBookUser"][market])
|
1833
1833
|
|
1834
1834
|
def on_open(self, ws: Any) -> None: # noqa: ARG002
|
1835
|
-
now = time_ms() +
|
1835
|
+
now = time_ms() + bitvavo_upgraded_settings.LAG
|
1836
1836
|
self.open = True
|
1837
1837
|
self.reconnectTimer = 0.5
|
1838
1838
|
if self.APIKEY != "":
|
@@ -0,0 +1,70 @@
|
|
1
|
+
import logging
|
2
|
+
from pathlib import Path
|
3
|
+
|
4
|
+
from pydantic import Field, field_validator, model_validator
|
5
|
+
from pydantic_settings import BaseSettings, SettingsConfigDict
|
6
|
+
|
7
|
+
from bitvavo_api_upgraded.type_aliases import ms
|
8
|
+
|
9
|
+
|
10
|
+
class BitvavoApiUpgradedSettings(BaseSettings):
|
11
|
+
"""
|
12
|
+
These settings provide extra functionality. Originally I wanted to combine
|
13
|
+
then, but I figured that would be a bad idea.
|
14
|
+
"""
|
15
|
+
|
16
|
+
LOG_LEVEL: str = Field("INFO")
|
17
|
+
LOG_EXTERNAL_LEVEL: str = Field("WARNING")
|
18
|
+
LAG: ms = Field(ms(50))
|
19
|
+
RATE_LIMITING_BUFFER: int = Field(25)
|
20
|
+
|
21
|
+
# Configuration for Pydantic Settings
|
22
|
+
model_config = SettingsConfigDict(
|
23
|
+
env_file=Path.cwd() / ".env",
|
24
|
+
env_file_encoding="utf-8",
|
25
|
+
env_prefix="BITVAVO_API_UPGRADED_",
|
26
|
+
extra="ignore",
|
27
|
+
)
|
28
|
+
|
29
|
+
@classmethod
|
30
|
+
@field_validator("LOG_LEVEL", "LOG_EXTERNAL_LEVEL", mode="before")
|
31
|
+
def validate_log_level(cls, v: str) -> str:
|
32
|
+
if v not in logging._nameToLevel: # noqa: SLF001
|
33
|
+
msg = f"Invalid log level: {v}"
|
34
|
+
raise ValueError(msg)
|
35
|
+
return v
|
36
|
+
|
37
|
+
|
38
|
+
class BitvavoSettings(BaseSettings):
|
39
|
+
"""
|
40
|
+
These are the base settings from the original library.
|
41
|
+
"""
|
42
|
+
|
43
|
+
ACCESSWINDOW: int = Field(10_000)
|
44
|
+
API_RATING_LIMIT_PER_MINUTE: int = Field(default=1000)
|
45
|
+
API_RATING_LIMIT_PER_SECOND: int = Field(default=1000)
|
46
|
+
APIKEY: str = Field(default="BITVAVO_APIKEY is missing")
|
47
|
+
APISECRET: str = Field(default="BITVAVO_APISECRET is missing")
|
48
|
+
DEBUGGING: bool = Field(default=False)
|
49
|
+
RESTURL: str = Field(default="https://api.bitvavo.com/v2")
|
50
|
+
WSURL: str = Field(default="wss://ws.bitvavo.com/v2/")
|
51
|
+
|
52
|
+
# Configuration for Pydantic Settings
|
53
|
+
model_config = SettingsConfigDict(
|
54
|
+
env_file=Path.cwd() / ".env",
|
55
|
+
env_file_encoding="utf-8",
|
56
|
+
env_prefix="BITVAVO_",
|
57
|
+
extra="ignore",
|
58
|
+
)
|
59
|
+
|
60
|
+
@model_validator(mode="after")
|
61
|
+
def set_api_rating_limit_per_second(self) -> "BitvavoSettings":
|
62
|
+
self.API_RATING_LIMIT_PER_SECOND = self.API_RATING_LIMIT_PER_SECOND // 60
|
63
|
+
return self
|
64
|
+
|
65
|
+
|
66
|
+
# Initialize the settings
|
67
|
+
bitvavo_upgraded_settings = BitvavoApiUpgradedSettings()
|
68
|
+
BITVAVO_API_UPGRADED = bitvavo_upgraded_settings
|
69
|
+
bitvavo_settings = BitvavoSettings()
|
70
|
+
BITVAVO = bitvavo_settings
|
@@ -8,24 +8,14 @@ from typing import Any
|
|
8
8
|
import pytest
|
9
9
|
|
10
10
|
from bitvavo_api_upgraded.bitvavo import Bitvavo
|
11
|
-
from bitvavo_api_upgraded.settings import
|
11
|
+
from bitvavo_api_upgraded.settings import bitvavo_settings
|
12
12
|
|
13
13
|
logger = logging.getLogger("conftest")
|
14
14
|
|
15
15
|
|
16
16
|
@pytest.fixture(scope="session")
|
17
17
|
def bitvavo() -> Bitvavo:
|
18
|
-
return Bitvavo(
|
19
|
-
{
|
20
|
-
# create a file called .env and put the keys there
|
21
|
-
"APIKEY": BITVAVO.APIKEY,
|
22
|
-
"APISECRET": BITVAVO.APISECRET,
|
23
|
-
"RESTURL": BITVAVO.RESTURL,
|
24
|
-
"WSURL": BITVAVO.WSURL,
|
25
|
-
"ACCESSWINDOW": BITVAVO.ACCESSWINDOW,
|
26
|
-
"DEBUGGING": BITVAVO.DEBUGGING,
|
27
|
-
},
|
28
|
-
)
|
18
|
+
return Bitvavo(bitvavo_settings.model_dump())
|
29
19
|
|
30
20
|
|
31
21
|
@pytest.fixture(scope="session")
|
@@ -34,17 +24,7 @@ def websocket(bitvavo: Bitvavo) -> Bitvavo.WebSocketAppFacade:
|
|
34
24
|
msg = f"Error callback: {error}"
|
35
25
|
logger.error(msg)
|
36
26
|
|
37
|
-
bitvavo = Bitvavo(
|
38
|
-
{
|
39
|
-
# create a file called .env and put the keys there
|
40
|
-
"APIKEY": BITVAVO.APIKEY,
|
41
|
-
"APISECRET": BITVAVO.APISECRET,
|
42
|
-
"RESTURL": BITVAVO.RESTURL,
|
43
|
-
"WSURL": BITVAVO.WSURL,
|
44
|
-
"ACCESSWINDOW": BITVAVO.ACCESSWINDOW,
|
45
|
-
"DEBUGGING": BITVAVO.DEBUGGING,
|
46
|
-
},
|
47
|
-
)
|
27
|
+
bitvavo = Bitvavo(bitvavo_settings.model_dump())
|
48
28
|
|
49
29
|
websocket: Bitvavo.WebSocketAppFacade = bitvavo.newWebsocket()
|
50
30
|
websocket.setErrorCallback(errorCallback)
|
@@ -58,18 +38,13 @@ def wrap_public_request(monkeypatch: pytest.MonkeyPatch, bitvavo: Bitvavo) -> No
|
|
58
38
|
bit and is now generating output that doesn't conform to my tests, but since
|
59
39
|
I presume that this output does not matter - typically it contains markets
|
60
40
|
that are not in use anymore - I can remove them.
|
41
|
+
|
42
|
+
2024-12-24: I kinda fixed the tests, so this may not be necessary anymore.
|
43
|
+
Maybe.
|
61
44
|
"""
|
62
45
|
# Market exceptions to remove, as of 2024-11-11
|
63
46
|
market_exceptions = [
|
64
|
-
"BABYDOGE-EUR",
|
65
|
-
"PEAQ-EUR",
|
66
|
-
"UXLINK-EUR",
|
67
|
-
"KLAY-EUR",
|
68
|
-
"ORN-EUR",
|
69
|
-
"DEGEN-EUR",
|
70
|
-
"EUROC-USDC",
|
71
|
-
"PNUT-EUR",
|
72
|
-
"SYS-EUR",
|
47
|
+
"BABYDOGE-EUR", # left as example
|
73
48
|
]
|
74
49
|
original_public_request = bitvavo.publicRequest
|
75
50
|
|