Skip to content

Commit f699cbb

Browse files
committed
Subdivision: Fill currency type information
This lets the base activity inherit the currency type belonging to the security.
1 parent 23962d7 commit f699cbb

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

ws_api/wealthsimple_api.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,13 @@ def _activity_add_description(self, act):
564564
received_shares: float = float(act['amount'])
565565
act['description'] = f"Subdivision: Received {received_shares} new shares of {act['assetSymbol']}"
566566

567+
if act["currency"] is None:
568+
security = self.get_security_market_data(act["securityId"])
569+
if security and isinstance(security, dict):
570+
fundamentals = security.get("fundamentals")
571+
if fundamentals and isinstance(fundamentals, dict):
572+
act["currency"] = fundamentals.get("currency")
573+
567574
elif act['type'] in ['DEPOSIT', 'WITHDRAWAL'] and act['subType'] in ['E_TRANSFER', 'E_TRANSFER_FUNDING']:
568575
direction = 'from' if act['type'] == 'DEPOSIT' else 'to'
569576
act['description'] = (

0 commit comments

Comments
 (0)