diff --git a/apps/api/src/app/portfolio/portfolio.service.ts b/apps/api/src/app/portfolio/portfolio.service.ts index faabee79b..ae20967ae 100644 --- a/apps/api/src/app/portfolio/portfolio.service.ts +++ b/apps/api/src/app/portfolio/portfolio.service.ts @@ -277,6 +277,15 @@ export class PortfolioService { }); } + accounts = [...accounts].sort((a, b) => { + const nameA = (a.name || '').trim().toLowerCase(); + const nameB = (b.name || '').trim().toLowerCase(); + return nameA.localeCompare(nameB, undefined, { + numeric: true, + sensitivity: 'base' + }); + }); + let totalBalanceInBaseCurrency = new Big(0); let totalDividendInBaseCurrency = new Big(0); let totalInterestInBaseCurrency = new Big(0);