Skip to content

Commit abb4a98

Browse files
committed
new: subdivision activity description
1 parent a2aa626 commit abb4a98

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,11 @@ foreach ($accounts as $account) {
135135
if ($act->type === 'DIY_BUY') {
136136
$act->amountSign = 'negative';
137137
}
138-
echo " - [" . date("Y-m-d H:i:s", strtotime($act->occurredAt)) . "] [$act->canonicalId] $act->description = " . ($act->amountSign === 'positive' ? "+" : "-") . "$act->amount $act->currency\n";
138+
echo " - [" . date("Y-m-d H:i:s", strtotime($act->occurredAt)) . "] [$act->canonicalId] $act->description";
139+
if ($act->currency) {
140+
echo " = " . ($act->amountSign === 'positive' ? "+" : "-") . "$act->amount $act->currency";
141+
}
142+
echo "\n";
139143
if ($act->description === "$act->type: $act->subType") {
140144
// This is an "unknown" transaction, for which description is generic; please open an issue on https://github.com/gboudreau/ws-api-php/issues and include the following:
141145
echo " Unknown activity: " . json_encode($act) . "\n";

src/WealthsimpleAPI.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,8 @@ private function _activityAddDescription(&$act) {
197197
} else {
198198
$act->description = "$verb: $action " . ((float) $act->assetQuantity) . " x $security @ " . ($act->amount / $act->assetQuantity);
199199
}
200+
} elseif ($act->type === 'CORPORATE_ACTION' && $act->subType === 'SUBDIVISION') {
201+
$act->description = "Subdivision: Received $act->amount shares of $act->assetSymbol";
200202
} elseif (($act->type === 'DEPOSIT' || $act->type === 'WITHDRAWAL') && ($act->subType === 'E_TRANSFER' || $act->subType === 'E_TRANSFER_FUNDING')) {
201203
$direction = $act->type === 'WITHDRAWAL' ? 'to' : 'from';
202204
$act->description = ucfirst(strtolower($act->type)) . ": Interac e-transfer $direction $act->eTransferName $act->eTransferEmail";

0 commit comments

Comments
 (0)