Browse Source

Bugfix/fix filtering by asset class in get holdings endpoint (#6151)

* Fix filtering by asset class

* Update changelog
pull/6149/head
Thomas Kaul 5 days ago
committed by GitHub
parent
commit
feb25c9266
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 4
      CHANGELOG.md
  2. 21
      apps/api/src/app/order/order.service.ts

4
CHANGELOG.md

@ -13,6 +13,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Moved the data service to `@ghostfolio/ui/services`
- Refactored the dividend import
### Fixed
- Fixed the filtering by asset class in the endpoint `GET api/v1/portfolio/holdings`
## 2.228.0 - 2026-01-03
### Added

21
apps/api/src/app/order/order.service.ts

@ -329,19 +329,39 @@ export class OrderService {
* performance tracking based on exchange rate fluctuations.
*
* @param cashDetails - The cash balance details.
* @param filters - Optional filters to apply.
* @param userCurrency - The base currency of the user.
* @param userId - The ID of the user.
* @returns A response containing the list of synthetic cash activities.
*/
public async getCashOrders({
cashDetails,
filters = [],
userCurrency,
userId
}: {
cashDetails: CashDetails;
filters?: Filter[];
userCurrency: string;
userId: string;
}): Promise<ActivitiesResponse> {
const filtersByAssetClass = filters.filter(({ type }) => {
return type === 'ASSET_CLASS';
});
if (
filtersByAssetClass.length > 0 &&
!filtersByAssetClass.find(({ id }) => {
return id === AssetClass.LIQUIDITY;
})
) {
// If asset class filters are present and none of them is liquidity, return an empty response
return {
activities: [],
count: 0
};
}
const activities: Activity[] = [];
for (const account of cashDetails.accounts) {
@ -755,6 +775,7 @@ export class OrderService {
const cashOrders = await this.getCashOrders({
cashDetails,
filters,
userCurrency,
userId
});

Loading…
Cancel
Save