Skip to content

Conversation

@404alex
Copy link
Contributor

@404alex 404alex commented Aug 11, 2025

First of all, thank you for the amazing work!

Found a little kinda extreme case here.. when having an upcoming recurring buy transaction, the assesQuantity might be None.

Traceback (most recent call last):
  File "/chronos/scripts/ws-sync/ws-sync.py", line 329, in <module>
    WSApiTest().main()
  File "/chronos/scripts/ws-sync/ws-sync.py", line 241, in main
    acts = ws.get_activities(account['id'])
  File "/chronos/scripts/ws-sync/.venv/lib/python3.9/site-packages/ws_api/wealthsimple_api.py", line 435, in get_activities
    self._activity_add_description(act)
  File "/chronos/scripts/ws-sync/.venv/lib/python3.9/site-packages/ws_api/wealthsimple_api.py", line 461, in _activity_add_description
    f"{verb}: {action} {float(act['assetQuantity'])} x "
TypeError: float() argument must be a string or a number, not 'NoneType'

Example transaction:

{
  '__typename': 'ActivityFeedItem', 
  'accountId': 'xxxx-[redacted]', 
  'aftOriginatorName': None, 
  'aftTransactionCategory': None, 
  'aftTransactionType': None, 
  'amount': '300.0', 
  'amountSign': 'positive', 
  'assetQuantity': None, 
  'assetSymbol': 'PSA', 
  'billPayCompanyName': None, 
  'billPayPayeeNickname': None, 
  'canonicalId': 'recurring_investment_policy-[redacted]r', 
  'chequeNumber': None, 
  'contractType': None, 
  'counterAssetSymbol': None, 
  'counterPartyCurrency': None, 
  'counterPartyCurrencyAmount': None, 
  'counterPartyName': None, 
  'currency': 'CAD', 
  'description': 'DIY_BUY: RECURRING_ORDER_UPCOMING', 
  'eTransferEmail': None, 
  'eTransferName': None, 
  'expiryDate': None, 
  'externalCanonicalId': 'recurring_investment_policy-U[redacted]r', 
  'fees': None, 
  'frequency': 'BIWEEKLY', 
  'fxRate': None, 
  'identityId': None, 
  'institutionName': None, 
  'interestRate': None, 
  'occurredAt': '2025-08-11T11:00:00.000000+00:00', 
  'opposingAccountId': None, 
  'p2pHandle': None, 
  'p2pMessage': None, 
  'primaryBlocker': None, 
  'provisionalCreditAmount': None, 
  'redactedExternalAccountNumber': None, 
  'reference': None, 
  'rewardProgram': None, 
  'securityId': 'sec-s-71db[redacted]c2876', 
  'spendMerchant': None, 
  'status': None, 
  'strikePrice': None, 
  'subType': 'RECURRING_ORDER_UPCOMING', 
  'type': 'DIY_BUY'
}

Therefore, added a check before generating the description field..

@gboudreau gboudreau merged commit 62a27c2 into gboudreau:main Aug 12, 2025
@gboudreau
Copy link
Owner

Included in 0.16.0. Cheers !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants