From 0ea588315af4c2407f4a2448a15e835f638408f2 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Fri, 23 May 2025 13:23:42 +0100 Subject: [PATCH] Feature/improve symbol lookup results by removing currency from name of cryptocurrencies (#4702) * Improve symbol lookup results by removing currency from name of cryptocurrencies * Update changelog --- CHANGELOG.md | 1 + .../data-provider/data-provider.service.ts | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b9d87f02..4715c9540 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Improved the symbol lookup results by removing the currency from the name of cryptocurrencies (experimental) - Harmonized the data providers management style of the admin control panel - Extended the data providers management of the admin control panel by the asset profile count - Restricted the permissions of the demo user diff --git a/apps/api/src/services/data-provider/data-provider.service.ts b/apps/api/src/services/data-provider/data-provider.service.ts index 3d8f2e553..8b578a54e 100644 --- a/apps/api/src/services/data-provider/data-provider.service.ts +++ b/apps/api/src/services/data-provider/data-provider.service.ts @@ -663,9 +663,6 @@ export class DataProviderService { // Only allow symbols with supported currency return currency ? true : false; }) - .sort(({ name: name1 }, { name: name2 }) => { - return name1?.toLowerCase().localeCompare(name2?.toLowerCase()); - }) .map((lookupItem) => { if (this.configurationService.get('ENABLE_FEATURE_SUBSCRIPTION')) { if (user.subscription.type === 'Premium') { @@ -679,7 +676,21 @@ export class DataProviderService { lookupItem.dataProviderInfo.isPremium = false; } + if ( + lookupItem.assetSubClass === 'CRYPTOCURRENCY' && + user?.Settings?.settings.isExperimentalFeatures + ) { + // Remove DEFAULT_CURRENCY at the end of cryptocurrency names + lookupItem.name = lookupItem.name.replace( + new RegExp(` ${DEFAULT_CURRENCY}$`), + '' + ); + } + return lookupItem; + }) + .sort(({ name: name1 }, { name: name2 }) => { + return name1?.toLowerCase().localeCompare(name2?.toLowerCase()); }); return {