Skip to content

Commit

Permalink
fix(account-composer): currencies merging error (No-Trade-No-Life#684)
Browse files Browse the repository at this point in the history
  • Loading branch information
zccz14 authored Jul 10, 2024
1 parent 464c078 commit deea3d5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
9 changes: 8 additions & 1 deletion apps/account-composer/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,14 @@ defer(() => readDataRecords(terminal, { type: 'account_composition_relation' }))
const mapCurrencyToCurrentInfo: Record<string, IAccountMoney> = {};
accountInfos.forEach((x) => {
x.currencies?.forEach((c) => {
const y = (mapCurrencyToCurrentInfo[c.currency] ??= { ...c });
const y = (mapCurrencyToCurrentInfo[c.currency] ??= {
currency: c.currency,
equity: 0,
balance: 0,
profit: 0,
used: 0,
free: 0,
});
y.equity += c.equity;
y.balance += c.balance;
y.profit += c.profit;
Expand Down
10 changes: 10 additions & 0 deletions common/changes/@yuants/app-account-composer/2024-07-10-09-11.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@yuants/app-account-composer",
"comment": "fix currencies merging error",
"type": "patch"
}
],
"packageName": "@yuants/app-account-composer"
}

0 comments on commit deea3d5

Please sign in to comment.