Skip to content

Commit 43134ee

Browse files
committed
Handle no monthly txns gracefully
Requested monthly statement with args where the monthly statement isnt available yet. Naturally, the list of transactions will be empty or uninitialized. Noticed that this corner case wasnt handled, this provides a return value for when no transactions are available.
1 parent e80f243 commit 43134ee

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

ws_api/wealthsimple_api.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,8 @@ def get_statement_transactions(self, account_id: str, period: str) -> list[Any]:
805805
data = statement.get('data') if 'data' in statement else {}
806806
transactions = data.get('currentTransactions') if 'currentTransactions' in data else []
807807

808-
808+
if not transactions:
809+
return []
809810
if not isinstance(transactions, list):
810811
raise WSApiException(f"Unexpected response format: {self.get_statement_transactions.__name__}", transactions)
811812

0 commit comments

Comments
 (0)