Skip to content

Commit b926817

Browse files
Update documentation style
1 parent 606c626 commit b926817

File tree

9 files changed

+69
-36
lines changed

9 files changed

+69
-36
lines changed

.github/workflows/_codecov.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ on:
2525
required: true
2626
SPOT_SECRET_KEY:
2727
required: true
28+
XSTOCKS_API_KEY:
29+
required: true
30+
XSTOCKS_SECRET_KEY:
31+
required: true
2832
FUTURES_API_KEY:
2933
required: true
3034
FUTURES_SECRET_KEY:
@@ -81,6 +85,8 @@ jobs:
8185
env:
8286
SPOT_API_KEY: ${{ secrets.SPOT_API_KEY }}
8387
SPOT_SECRET_KEY: ${{ secrets.SPOT_SECRET_KEY }}
88+
XSTOCKS_API_KEY: ${{ secrets.XSTOCKS_API_KEY }}
89+
XSTOCKS_SECRET_KEY: ${{ secrets.XSTOCKS_SECRET_KEY }}
8490
FUTURES_API_KEY: ${{ secrets.FUTURES_API_KEY }}
8591
FUTURES_SECRET_KEY: ${{ secrets.FUTURES_SECRET_KEY }}
8692
FUTURES_SANDBOX_KEY: ${{ secrets.FUTURES_SANDBOX_KEY }}

.github/workflows/_test_spot_private.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ on:
2727
required: true
2828
SPOT_SECRET_KEY:
2929
required: true
30+
XSTOCKS_API_KEY:
31+
required: true
32+
XSTOCKS_SECRET_KEY:
33+
required: true
3034

3135
permissions:
3236
contents: read
@@ -94,6 +98,8 @@ jobs:
9498
env:
9599
SPOT_API_KEY: ${{ secrets.SPOT_API_KEY }}
96100
SPOT_SECRET_KEY: ${{ secrets.SPOT_SECRET_KEY }}
101+
XSTOCKS_API_KEY: ${{ secrets.XSTOCKS_API_KEY }}
102+
XSTOCKS_SECRET_KEY: ${{ secrets.XSTOCKS_SECRET_KEY }}
97103
run: pytest -vv -m "spot and spot_auth and not spot_websocket" tests
98104

99105
- name: Testing Spot websocket client

.github/workflows/cicd.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
# for Spot:
1818
# * SPOT_API_KEY
1919
# * SPOT_SECRET_KEY
20+
# for xStocks (Kraken UAT):
21+
# * XSTOCKS_API_KEY
22+
# * XSTOCKS_SECRET_KEY
2023
# ... see the README for information about how to generate
2124
# Spot API keys. Please also make sure to enable the
2225
# following API permissions:

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ UV ?= uv
1010
PYTHON := python
1111
PYTEST := $(UV) run pytest
1212
PYTEST_OPTS := -vv --junit-xml=pytest.xml
13-
PYTEST_COV_OPTS := $(PYTEST_OPTS) --cov=kraken --cov-report=xml:coverage.xml --cov-report=term
13+
PYTEST_COV_OPTS := $(PYTEST_OPTS) --cov=kraken --cov-report=xml:coverage.xml --cov-report=term-missing
1414
TEST_DIR := tests
1515

1616
## ======= M A K E F I L E - T A R G E T S =====================================

doc/01_introduction.rst

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ and documented.
5555
:class:`kraken.spot.SpotWSClient`.
5656

5757

58-
Disclaimer
59-
----------
58+
⚠️ Disclaimer
59+
-------------
6060

6161
There is no guarantee that this software will work flawlessly at this or later
6262
times. Of course, no responsibility is taken for possible profits or losses.
@@ -66,8 +66,8 @@ investment. By using this software you release the author(s) from any liability
6666
regarding the use of this software.
6767

6868

69-
Features
70-
--------
69+
🚀 Features
70+
-----------
7171

7272
General:
7373

@@ -92,8 +92,8 @@ Projects using this SDK:
9292
- https://github.com/btschwertfeger/kraken-rebalance-bot
9393
- https://github.com/btschwertfeger/python-kraken-sdk/network/dependents
9494

95-
Important Notice
96-
-----------------
95+
📌 Important Notice
96+
-------------------
9797

9898
**ONLY tagged releases are available at PyPI**. The content of the master branch
9999
may not match with the content of the latest release. - Please have a look at
@@ -105,8 +105,9 @@ on new releases.
105105

106106
.. _section-troubleshooting:
107107

108-
Troubleshooting
109-
---------------
108+
💡 Troubleshooting
109+
------------------
110+
110111
- Check if you downloaded and installed the **latest version** of the
111112
python-kraken-sdk.
112113
- Check the **permissions of your API keys** and the required permissions on the
@@ -123,8 +124,8 @@ Troubleshooting
123124
- The xStocks feature is not available globally. Please checkout Kraken's
124125
documentation to get to know the availability zones.
125126

126-
References
127-
----------
127+
📜 References
128+
-------------
128129

129130
- https://python-kraken-sdk.readthedocs.io/en/stable
130131
- https://docs.kraken.com/api/

doc/conf.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,25 @@ def setup(app: Any) -> None: # noqa: ARG001,ANN401
8282
# -- Options for HTML output -------------------------------------------------
8383
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
8484

85-
html_theme = "sphinx_rtd_theme"
86-
# html_static_path = ["_static"]
85+
html_theme = "furo" # "sphinx_book_theme" # "sphinx_rtd_theme"
86+
# html_static_path = ["_static"] # for images
8787
html_context = {
8888
"display_github": True,
8989
"github_user": "btschwertfeger",
9090
"github_repo": "python-kraken-sdk",
9191
"github_version": "master/doc/",
9292
}
93+
html_theme_options = {
94+
# "sidebar_hide_name": True,
95+
"light_css_variables": {
96+
"color-brand-primary": "#336790",
97+
"color-brand-content": "#336790",
98+
},
99+
"dark_css_variables": {
100+
"color-brand-primary": "#E5B62F",
101+
"color-brand-content": "#E5B62F",
102+
},
103+
"source_repository": "https://github.com/btschwertfeger/python-kraken-sdk/",
104+
"source_branch": "master",
105+
"source_directory": "doc/",
106+
}

doc/requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1+
# sphinx-rtd-theme
12
aiohttp
23
asyncio>=3.4
34
click~=8.1
45
cloup~=3.0
6+
furo
57
ipython
68
nbsphinx
79
orjson
810
requests~=2.32
911
setuptools_scm
1012
sphinx<8.2.0 # doesn't work with nbsphinx
1113
sphinx-click
12-
sphinx-rtd-theme
1314
websockets>=14.1

examples/xstocks_examples.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def list_all_xstocks() -> None:
4040
CLIENT.request(
4141
"GET",
4242
"/0/public/AssetPairs",
43-
params={"aclass_base": "tokenized_asset"},
43+
params={"aclass_base": "tokenized_asset"}, # <- important!
4444
auth=False,
4545
),
4646
)
@@ -59,7 +59,7 @@ def create_xstock_order() -> None:
5959
"pair": "AAPLxUSD",
6060
"price": "100.0",
6161
"validate": True,
62-
"asset_class": "tokenized_asset",
62+
"asset_class": "tokenized_asset", # <- important
6363
},
6464
),
6565
)

tests/spot/test_xstocks_basic.py

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
import pytest
1313

14+
from kraken.exceptions import KrakenPermissionDeniedError
1415
from kraken.spot import Market, SpotClient, Trade
1516

1617

@@ -63,29 +64,30 @@ def test_create_order_trade_client(
6364
self: Self,
6465
xstocks_trade_client: Trade,
6566
) -> None:
66-
"""
67-
Checks if the response of the ``create_order`` is of type dict which
68-
mean that the request was successful.
69-
"""
70-
result = xstocks_trade_client.create_order(
71-
**self.SAVE_ORDER,
72-
side="buy",
73-
extra_params={"asset_class": "tokenized_asset"},
74-
)
75-
assert "AAPLxUSD" in result.get("descr", {}).get("order", "")
67+
"""Checks if the endpoint is basically available."""
68+
with pytest.raises(
69+
KrakenPermissionDeniedError,
70+
match=r".*API key doesn't have permission to make this request.*",
71+
):
72+
xstocks_trade_client.create_order(
73+
**self.SAVE_ORDER,
74+
side="buy",
75+
extra_params={"asset_class": "tokenized_asset"},
76+
)
7677

7778
@pytest.mark.spot_auth
7879
def test_create_order_spot_client(
7980
self: Self,
8081
xstocks_client: SpotClient,
8182
) -> None:
82-
"""
83-
Checks if the response of the ``create_order`` is of type dict which
84-
mean that the request was successful.
85-
"""
86-
result = xstocks_client.request(
87-
"POST",
88-
"/0/private/AddOrder",
89-
params={"type": "buy", "asset_class": "tokenized_asset"} | self.SAVE_ORDER,
90-
)
91-
assert "AAPLxUSD" in result.get("descr", {}).get("order", "")
83+
"""Checks if the endpoint is basically available."""
84+
with pytest.raises(
85+
KrakenPermissionDeniedError,
86+
match=r".*API key doesn't have permission to make this request.*",
87+
):
88+
xstocks_client.request(
89+
"POST",
90+
"/0/private/AddOrder",
91+
params={"type": "buy", "asset_class": "tokenized_asset"}
92+
| self.SAVE_ORDER,
93+
)

0 commit comments

Comments
 (0)