Skip to content

Commit

Permalink
Resolve "Mark kraken.spot.Staking as deprecated and add `kraken.spo…
Browse files Browse the repository at this point in the history
…t.Earn`" (#199)
  • Loading branch information
btschwertfeger authored Mar 9, 2024
1 parent 87f0396 commit c1e6f78
Show file tree
Hide file tree
Showing 18 changed files with 645 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ pytest.xml
*.pot

# Sphinx documentation
docs/_build/
doc/_build/

# PyBuilder
target/
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![Typing](https://img.shields.io/badge/typing-mypy-informational)](https://mypy-lang.org/)
[![CodeQL](https://github.com/btschwertfeger/python-kraken-sdk/actions/workflows/codeql.yaml/badge.svg?branch=master)](https://github.com/btschwertfeger/python-kraken-sdk/actions/workflows/codeql.yaml)
[![CI/CD](https://github.com/btschwertfeger/python-kraken-sdk/actions/workflows/cicd.yaml/badge.svg?branch=master)](https://github.com/btschwertfeger/python-kraken-sdk/actions/workflows/cicd.yaml)
[![codecov](https://codecov.io/gh/btschwertfeger/python-kraken-sdk/branch/master/badge.svg)](https://app.codecov.io/gh/btschwertfeger/python-kraken-sdk)

Expand Down
5 changes: 5 additions & 0 deletions doc/src/spot/rest.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ Spot REST
:show-inheritance:
:inherited-members:

.. autoclass:: kraken.spot.Earn
:members:
:show-inheritance:
:inherited-members:

.. autoclass:: kraken.spot.Staking
:members:
:show-inheritance:
Expand Down
1 change: 0 additions & 1 deletion kraken/base_api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,6 @@ def _request( # noqa: PLR0913 # pylint: disable=too-many-arguments
if isinstance(extra_params, str)
else extra_params
)

query_params: str = (
urlencode(params, doseq=True)
if METHOD in {"GET", "DELETE"} and params
Expand Down
48 changes: 48 additions & 0 deletions kraken/exceptions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,46 @@ class KrakenTemporaryLockoutError(Exception):
"""The account was temporary locked out."""


@docstring_message
class KrakenEarnMinimumAllocationError(Exception):
"""(De)allocation operation amount less than minimum"""


@docstring_message
class KrakenEarnAllocationInProgressError(Exception):
"""Another allocation is already in progress"""


@docstring_message
class KrakenEarnTemporaryUnavailableError(Exception):
"""The Earn service is temporary unavailable, try again in a few minutes"""


@docstring_message
class KrakenEarnTierVerificationError(Exception):
"""The user's tier is not high enough"""


@docstring_message
class KrakenEarnStrategyNotFoundError(Exception):
"""Strategy not found"""


@docstring_message
class KrakenEarnInsufficientFundsError(Exception):
"""Insufficient funds to complete the transaction"""


@docstring_message
class KrakenEarnAllocationExceededError(Exception):
"""The allocation exceeds user limit for the strategy"""


@docstring_message
class KrakenEarnDeallocationExceededError(Exception):
"""The deallocation exceeds user limit for the strategy"""


@docstring_message
class KrakenMaxFeeExceededError(Exception):
"""The fee was higher than the defined maximum."""
Expand Down Expand Up @@ -330,6 +370,14 @@ class MaxReconnectError(Exception):
# "WDatabase:No change": ,
# Futures Trading Errors
#
"EEarnings:Below min:(De)allocation operation amount less than minimum": KrakenEarnMinimumAllocationError,
"EEarnings:Busy:Another (de)allocation for the same strategy is in progress": KrakenEarnAllocationInProgressError,
"EEarnings:Busy": KrakenEarnTemporaryUnavailableError,
"EEarnings:Permission denied:The user's tier is not high enough": KrakenEarnTierVerificationError,
"EGeneral:Invalid arguments:Invalid strategy ID": KrakenEarnStrategyNotFoundError,
"EEarnings:Insufficient funds:Insufficient funds to complete the (de)allocation request": KrakenEarnInsufficientFundsError,
"EEarnings:Above max:The allocation exceeds user limit for the strategy": KrakenEarnAllocationExceededError,
"EEarnings:Above max:The allocation exceeds the total strategy limit": KrakenEarnDeallocationExceededError,
"authenticationError": KrakenAuthenticationError,
"insufficientAvailableFunds": KrakenInsufficientAvailableFundsError,
"requiredArgumentMissing": KrakenRequiredArgumentMissingError,
Expand Down
4 changes: 3 additions & 1 deletion kraken/spot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
# GitHub: https://github.com/btschwertfeger
# pylint: disable=unused-import,cyclic-import

"""Module that provides the Spot REST clients and utility functions."""
"""Module that provides the Spot REST clients."""

from kraken.spot.earn import Earn
from kraken.spot.funding import Funding
from kraken.spot.market import Market
from kraken.spot.orderbook_v1 import OrderbookClientV1
Expand All @@ -17,6 +18,7 @@
from kraken.spot.websocket_v2 import KrakenSpotWSClientV2

__all__ = [
"Earn",
"Funding",
"KrakenSpotWSClientV1",
"KrakenSpotWSClientV2",
Expand Down
Loading

0 comments on commit c1e6f78

Please sign in to comment.