From a8d124846116b0d261eddaca9e9a7b0756666720 Mon Sep 17 00:00:00 2001
From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com>
Date: Sat, 1 Mar 2025 13:14:39 +0100
Subject: [PATCH] Feature/improve symbol lookup in Trackinsight service (#4377)

* Improve symbol lookup for EXCHANGE:SYMBOL pattern

* Update changelog
---
 CHANGELOG.md                                                | 6 ++++++
 .../data-enhancer/trackinsight/trackinsight.service.ts      | 5 ++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0dca2be52..a0610a839 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
 and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
 
+## Unreleased
+
+### Changed
+
+- Improved the symbol lookup in the _Trackinsight_ data enhancer for asset profile data
+
 ## 2.142.0 - 2025-02-28
 
 ### Added
diff --git a/apps/api/src/services/data-provider/data-enhancer/trackinsight/trackinsight.service.ts b/apps/api/src/services/data-provider/data-enhancer/trackinsight/trackinsight.service.ts
index 32b494085..8b885c013 100644
--- a/apps/api/src/services/data-provider/data-enhancer/trackinsight/trackinsight.service.ts
+++ b/apps/api/src/services/data-provider/data-enhancer/trackinsight/trackinsight.service.ts
@@ -192,7 +192,10 @@ export class TrackinsightDataEnhancerService implements DataEnhancerInterface {
       .then((jsonRes) => {
         if (
           jsonRes['results']?.['count'] === 1 ||
-          jsonRes['results']?.['docs']?.[0]?.['ticker'] === symbol
+          // Allow exact match
+          jsonRes['results']?.['docs']?.[0]?.['ticker'] === symbol ||
+          // Allow EXCHANGE:SYMBOL
+          jsonRes['results']?.['docs']?.[0]?.['ticker']?.endsWith(`:${symbol}`)
         ) {
           return jsonRes['results']['docs'][0]['ticker'];
         }