diff --git a/CHANGELOG.md b/CHANGELOG.md index 124d03113..2e68c9344 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Deprecated `activities` in the endpoint `GET api/v1/portfolio/holding/:dataSource/:symbol` +### Fixed + +- Fixed the filtering by asset class in the endpoint `GET api/v1/portfolio/holdings` + ## 2.228.0 - 2026-01-03 ### Added diff --git a/apps/api/src/app/order/order.service.ts b/apps/api/src/app/order/order.service.ts index 57fe5d3b6..623ddecb7 100644 --- a/apps/api/src/app/order/order.service.ts +++ b/apps/api/src/app/order/order.service.ts @@ -335,14 +335,16 @@ export class OrderService { */ public async getCashOrders({ cashDetails, + filters = [], userCurrency, userId }: { cashDetails: CashDetails; + filters?: Filter[]; userCurrency: string; userId: string; }): Promise { - const activities: Activity[] = []; + let activities: Activity[] = []; for (const account of cashDetails.accounts) { const { balances } = await this.accountBalanceService.getAccountBalances({ @@ -422,6 +424,18 @@ export class OrderService { } } + activities = activities.filter(({ SymbolProfile }) => { + for (const { id, type } of filters) { + if (type === 'ASSET_CLASS') { + if (id !== SymbolProfile.assetClass) { + return false; + } + } + } + + return true; + }); + return { activities, count: activities.length @@ -755,6 +769,7 @@ export class OrderService { const cashOrders = await this.getCashOrders({ cashDetails, + filters, userCurrency, userId });