-
Notifications
You must be signed in to change notification settings - Fork 19
/
pyproject.toml
382 lines (344 loc) · 9.75 KB
/
pyproject.toml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
# -*- coding: utf-8 -*-
# Copyright (C) 2023 Benjamin Thomas Schwertfeger
# GitHub: https://github.com/btschwertfeger
#
[build-system]
requires = ["setuptools>=65.5.1", "setuptools_scm[toml]>=6.2", "wheel"]
build-backend = "setuptools.build_meta"
[project]
name = "python-kraken-sdk"
dynamic = ["version"]
authors = [
{ name = "Benjamin Thomas Schwertfeger", email = "contact@b-schwertfeger.de" },
]
maintainers = [
{ name = "Benjamin Thomas Schwertfeger", email = "contact@b-schwertfeger.de" },
]
description = "Command-line tool and collection of REST and websocket clients to interact with the Kraken cryptocurrency exchange."
readme = "README.md"
license = { file = "LICENSE" }
requires-python = ">=3.11"
dependencies = [
"asyncio>=3.4",
"requests",
"websockets>=14.1",
"click",
"cloup",
"orjson",
"aiohttp",
]
keywords = ["crypto", "trading", "kraken", "exchange", "api"]
classifiers = [
"License :: OSI Approved :: Apache Software License",
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Topic :: Office/Business :: Financial",
"Topic :: Office/Business :: Financial :: Investment",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Internet :: WWW/HTTP",
"Topic :: Utilities",
"Programming Language :: Python",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Framework :: AsyncIO",
"Natural Language :: English",
"Operating System :: MacOS",
"Operating System :: Unix",
]
[project.scripts]
kraken = "kraken.cli:cli"
[project.urls]
"Homepage" = "https://github.com/btschwertfeger/python-kraken-sdk"
"Bug Tracker" = "https://github.com/btschwertfeger/python-kraken-sdk/issues"
"Documentation" = "https://python-kraken-sdk.readthedocs.io/en/stable/"
[project.optional-dependencies]
dev = [
"debugpy",
# building
"build",
# documentation
"sphinx",
"sphinx-click",
"sphinx-rtd-theme",
"nbsphinx",
"ipython", # to visualize notebooks in doc
# formatting
"black",
# typing
"mypy",
"types-requests",
# linting
"ruff",
]
test = [
"pytest",
"pytest-cov",
"pytest-mock",
"pytest-asyncio",
"pytest-timeout",
"proxy.py",
]
examples = ["matplotlib", "pandas", "numpy"]
jupyter = ["ipykernel"] # python3 -m ipykernel install --user --name=kraken
[tool.setuptools]
include-package-data = false
[tool.setuptools.packages.find]
include = ["kraken*"]
# excluded anyway because of 'include'
exclude = ["docs*", "tests*", "examples*", "venv", ".env"]
[tool.setuptools_scm]
write_to = "kraken/_version.py"
version_scheme = "guess-next-dev"
local_scheme = "no-local-version"
# ========= T E S T I N G ======================================================
#
[tool.pytest]
junit_family = "xunit2"
testpaths = ["tests"]
[tool.pytest.ini_options]
# filterwarnings = [
# "ignore:The Kraken websocket API v1 is marked as deprecated*:DeprecationWarning",
# ]
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "function"
timeout = 60 # seconds
cache_dir = ".cache/pytest"
markers = [
"wip: Used to run a specific test by hand.",
"flaky: Flaky tests",
"spot: … Spot endpoint.",
"spot_auth: … authenticated Spot endpoint.",
"spot_earn: … Spot Earn endpoint.",
"spot_trade: … Spot Trade endpoint.",
"spot_user: … Spot User endpoint.",
"spot_market: … Spot Market endpoint.",
"spot_funding: … Spot Funding endpoint.",
"spot_websocket: … Spot Websocket client + Spot Orderbook client.",
"spot_orderbook: … Spot Orderbook client.",
"futures: … Futures endpoint.",
"futures_auth: … authenticated Futures endpoint.",
"futures_market: … Futures Market endpoint.",
"futures_user: … Futures User endpoint.",
"futures_trade: … Futures Trade endpoint.",
"futures_funding: … Futures Funding endpoint.",
"futures_websocket: … Futures Websocket endpoint.",
"nft: … NFT endpoint.",
"nft_auth: … authenticated NFT endpoint.",
"nft_market: … NFT Market endpoint.",
"nft_trade: … NFT Trade endpoint.",
]
[tool.coverage.run]
source = ["kraken"]
omit = ["*tests*"]
[tool.coverage.report]
exclude_lines = ["coverage: disable", "if TYPE_CHECKING:"]
skip_empty = true
[tool.codespell]
skip = "CHANGELOG.md,examples/market_client_example.ipynb,doc/examples/market_client_example.ipynb"
check-filenames = true
# ========= T Y P I N G ========================================================
#
[tool.mypy]
python_version = "3.11"
# junit_xml = "mypy.xml"
files = ["kraken/**/*.py"]
exclude = ["tests/**/*.py"]
cache_dir = ".cache/mypy"
sqlite_cache = true
cache_fine_grained = true
# Disallow dynamic typing
disallow_any_unimported = false
disallow_any_expr = false
disallow_any_decorated = false
disallow_any_explicit = false
disallow_any_generics = false
disallow_subclassing_any = false
# Untyped definitions and calls
check_untyped_defs = true
disallow_untyped_calls = true
disallow_untyped_defs = true
disallow_incomplete_defs = true
disallow_untyped_decorators = false
# None and Optional handling
implicit_optional = true
strict_optional = false
# Configuring warnings
warn_redundant_casts = true
warn_unused_ignores = true
warn_unused_configs = true
warn_no_return = true
warn_return_any = true
warn_unreachable = true
# Suppressing errors
ignore_errors = false
# Configuring error messages
show_error_context = true
show_column_numbers = true
hide_error_codes = false
pretty = true
color_output = true
show_absolute_path = true
ignore_missing_imports = true
# Miscellaneous strictness flags
allow_untyped_globals = false
allow_redefinition = false
local_partial_types = false
# disable_error_code = xxx,xxx
implicit_reexport = true
strict_concatenate = false
strict_equality = true
strict = true
# ========= L I N T I N G ======================================================
#
[tool.ruff]
# https://beta.ruff.rs/docs/rules/
# https://beta.ruff.rs/docs/settings/
# src = ["kraken"]
cache-dir = ".cache/ruff"
respect-gitignore = true
exclude = []
line-length = 130
[tool.ruff.lint]
select = [
"A", # flake8-builtins
"AIR", # Airflow
"ANN", # flake8-annotations
"ARG", # flake8-unused-arguments
"ASYNC", # flake8-async
"ASYNC1", # flake8-trio
"B", # flake8-bugbear
"BLE", # flake8-blind-except
"C", # pylint convention
"C4", # flake8-comprehensions
"COM", # flake8-commas
"CPY", # flake8-copyright
"E", # pylint error
"F", # pyflakes
"FA", # flake8-future-annotations
"FBT", # flake8-boolean-trap
"FLY", # flynt
"FURB", # refurb
"G", # flake8-logging-format
"I", # isort
"ICN", # flake8-import-conventions
"INT", # flake8-gettext
"ISC", # flake8-implicit-string-concat
"LOG", # flake8-logging
"N", # PEP8 naming
"PERF", # Perflint
"PGH", # pygrep-hooks
"PIE", # flake8-pie
"PL", # PyLint
"PT", # flake8-pytest-style
"PTH", # flake8-use-pathlib
"PYI", # flake8-pyi
"Q", # flake8-quotes
"R", # pylint refactor
"RET", # flake8-return
"RSE", # flake8-raise
"RUF", # Ruff-specific rules
"S", # flake8-bandit
"SIM", # flake8-simplify
"SLF", # flake8-self
"SLOT", # flake8-slots
"T20", # flake8-print
"TCH", # flake8-type-checking
"TID", # flake8-tidy-imports
# "W", # pylint warning
# "D", # pydocstyle | sphinx format not supported
# "ERA", # eradicate - commented-out code
# "FIX", # flake8-fixme
# "TD", # flake8-todos
# "TRY", # tryceratops # specify exception messages in class; not important
]
fixable = ["ALL"]
ignore = [
"ASYNC110", # use of asyncio.sleep instead of asyncio.Event # FIXME
"B019", # use of lru_cache or cache
"PLR2004", # magic value in comparison
"E203", # Whitespace before ':' # false positive on list slices
"PLR6301", # Method `…` could be a function or static method # false positive for no-self-use
"RUF022", # `__all__` is not sorted
]
task-tags = ["todo", "TODO", "fixme", "FIXME"]
[tool.ruff.lint.per-file-ignores]
"examples/*.py" = [
"ASYNC230", # use open in async functions
"ASYNC251", # time.sleep in async function
"BLE001", # blind exception
"S101", # assert use
"S110", # try-catch-pass without logging
"T201", # print
]
"examples/*.ipynb" = [
"CPY001", # copyright
]
"tests/*.py" = [
"ASYNC230", # use open in async functions
"ASYNC251", # time.sleep in async function
"E501", # line to long
"F841", # unused variable
"N802", # PEP8 naming
"S101", # assert use
"S106", # hardcoded password
"S110", # try-except-pass without logging
"S311", # pseudo-random-generator
"SLF001", # private member access
"TID252", # ban relative imports
]
[tool.ruff.lint.flake8-copyright]
author = "Benjamin Thomas Schwertfeger"
notice-rgx = "(?i)Copyright \\(C\\) \\d{4}"
min-file-size = 1024
[tool.ruff.lint.flake8-quotes]
docstring-quotes = "double"
[tool.ruff.lint.flake8-tidy-imports]
ban-relative-imports = "all"
[tool.ruff.lint.flake8-bandit]
check-typed-exception = true
[tool.ruff.lint.flake8-annotations]
allow-star-arg-any = true
[tool.ruff.lint.flake8-type-checking]
strict = true
[tool.ruff.lint.pep8-naming]
ignore-names = [
"i",
"j",
"k",
"_",
"fromAccount",
"toAccount",
"fromUser",
"toUser",
"sourceWallet",
"lastTime",
"lastFillTime",
"to",
"maxLeverage",
"pnlPreference",
"cliOrdId",
"cliOrdIds",
"orderId",
"orderIds",
"stopPrice",
"limitPrice",
"orderType",
"reduceOnly",
"triggerSignal",
"EXCEPTION_ASSIGNMENT",
"trailingStopDeviationUnit",
"trailingStopMaxDeviation",
"subaccountUid",
"ConnectSpotWebsocket",
"METHOD",
"TIMEOUT",
"URL",
"HEADERS",
"processBefore",
]
[tool.ruff.lint.pylint]
max-args = 8
max-branches = 15
max-returns = 6
max-statements = 50
allow-magic-value-types = ["int"]