Skip to content

Commit 7e5bd0d

Browse files
committed
fix pagination bug
1 parent 7e24c7a commit 7e5bd0d

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

docs/orders.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,10 @@ Notional orders are slightly different from normal orders. Since the market will
146146
)
147147
resp = account.place_order(session, order, dry_run=False)
148148
149-
Cryptocurrency orders
150-
---------------------
149+
Cryptocurrency market orders
150+
----------------------------
151151

152-
Cryptocurrency orders should use the special ``IOC`` TIF:
152+
Cryptocurrency market orders should use the special ``IOC`` TIF:
153153

154154
.. code-block:: python
155155

tastytrade/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
API_VERSION = "20251026"
55
CERT_URL = "https://api.cert.tastyworks.com"
66
VAST_URL = "https://vast.tastyworks.com"
7-
VERSION = "11.0.0"
7+
VERSION = "11.0.1"
88

99
__version__ = VERSION
1010
version_str: str = f"tastyware/tastytrade:v{VERSION}"

tastytrade/utils.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,9 +344,11 @@ def paginate(
344344
json = response.json()
345345
res.extend([model(**i) for i in json["data"]["items"]])
346346
# handle pagination
347+
pagination = json.get("pagination")
347348
if (
348-
json["pagination"]["page-offset"] >= json["pagination"]["total-pages"] - 1
349+
not pagination
349350
or not paginate
351+
or pagination["page-offset"] >= pagination["total-pages"] - 1
350352
):
351353
break
352354
params["page-offset"] += 1
@@ -382,9 +384,11 @@ async def a_paginate(
382384
json = response.json()
383385
res.extend([model(**i) for i in json["data"]["items"]])
384386
# handle pagination
387+
pagination = json.get("pagination")
385388
if (
386-
json["pagination"]["page-offset"] >= json["pagination"]["total-pages"] - 1
389+
not pagination
387390
or not paginate
391+
or pagination["page-offset"] >= pagination["total-pages"] - 1
388392
):
389393
break
390394
params["page-offset"] += 1

0 commit comments

Comments
 (0)