Skip to content

Commit

Permalink
Fix kraken.spot.Market.get_recent_trades parameter 'since' (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
btschwertfeger committed Mar 12, 2024
1 parent 6c18179 commit db24300
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ Note: Authenticated Futures websocket clients can also un-/subscribe from/to pub

# 🆕 Contributions

... are welcome! - Please have a look at [CONTRIBUTION.md](./CONTRIBUTING.md).
are welcome! - Please have a look at [CONTRIBUTION.md](./CONTRIBUTING.md).

---

Expand All @@ -422,7 +422,7 @@ Note: Authenticated Futures websocket clients can also un-/subscribe from/to pub

<a name="notes"></a>

# 📝 Notes:
# 📝 Notes

- Coding standards are not always followed to make arguments and function names as similar as possible to those in the Kraken API documentations.

Expand Down
11 changes: 9 additions & 2 deletions kraken/spot/market.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,10 @@ def get_order_book(self: "Market", pair: str, count: Optional[int] = 100) -> dic
)

def get_recent_trades(
self: "Market", pair: str, since: Optional[Union[str, int]] = None
self: "Market",
pair: str,
since: Optional[Union[str, int]] = None,
count: Optional[int] = None,
) -> dict:
"""
Get the latest trades for a specific trading pair (up to 1000).
Expand All @@ -340,6 +343,8 @@ def get_recent_trades(
:type pair: str
:param since: Filter trades since given timestamp (default: ``None``)
:type since: str | int, optional
:param count: The max number of results
:type count: int, optional
:return: The last public trades (up to 1000 results)
:rtype: dict
Expand All @@ -361,7 +366,9 @@ def get_recent_trades(
"""
params: dict = {"pair": pair}
if defined(since):
params["since"] = None
params["since"] = since
if defined(count):
params["count"] = count
return self._request( # type: ignore[return-value]
method="GET", uri="/public/Trades", params=params, auth=False
)
Expand Down

0 comments on commit db24300

Please sign in to comment.