|
@ -32,7 +32,7 @@ export class TrackinsightDataEnhancerService implements DataEnhancerInterface { |
|
|
return response; |
|
|
return response; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const holdings = await getJSON( |
|
|
const result = await getJSON( |
|
|
`${TrackinsightDataEnhancerService.baseUrl}/${symbol}.json` |
|
|
`${TrackinsightDataEnhancerService.baseUrl}/${symbol}.json` |
|
|
).catch(() => { |
|
|
).catch(() => { |
|
|
return getJSON( |
|
|
return getJSON( |
|
@ -42,12 +42,17 @@ export class TrackinsightDataEnhancerService implements DataEnhancerInterface { |
|
|
); |
|
|
); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
if (result.weight < 0.95) { |
|
|
|
|
|
// Skip if data is inaccurate
|
|
|
|
|
|
return response; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if ( |
|
|
if ( |
|
|
!response.countries || |
|
|
!response.countries || |
|
|
(response.countries as unknown as Country[]).length === 0 |
|
|
(response.countries as unknown as Country[]).length === 0 |
|
|
) { |
|
|
) { |
|
|
response.countries = []; |
|
|
response.countries = []; |
|
|
for (const [name, value] of Object.entries<any>(holdings.countries)) { |
|
|
for (const [name, value] of Object.entries<any>(result.countries)) { |
|
|
let countryCode: string; |
|
|
let countryCode: string; |
|
|
|
|
|
|
|
|
for (const [key, country] of Object.entries<any>( |
|
|
for (const [key, country] of Object.entries<any>( |
|
@ -75,7 +80,7 @@ export class TrackinsightDataEnhancerService implements DataEnhancerInterface { |
|
|
(response.sectors as unknown as Sector[]).length === 0 |
|
|
(response.sectors as unknown as Sector[]).length === 0 |
|
|
) { |
|
|
) { |
|
|
response.sectors = []; |
|
|
response.sectors = []; |
|
|
for (const [name, value] of Object.entries<any>(holdings.sectors)) { |
|
|
for (const [name, value] of Object.entries<any>(result.sectors)) { |
|
|
response.sectors.push({ |
|
|
response.sectors.push({ |
|
|
name: TrackinsightDataEnhancerService.sectorsMapping[name] ?? name, |
|
|
name: TrackinsightDataEnhancerService.sectorsMapping[name] ?? name, |
|
|
weight: value.weight |
|
|
weight: value.weight |
|
|