|
@ -7,7 +7,7 @@ import got from 'got'; |
|
|
|
|
|
|
|
|
@Injectable() |
|
|
@Injectable() |
|
|
export class TrackinsightDataEnhancerService implements DataEnhancerInterface { |
|
|
export class TrackinsightDataEnhancerService implements DataEnhancerInterface { |
|
|
private static baseUrl = 'https://data.trackinsight.com'; |
|
|
private static baseUrl = 'https://www.trackinsight.com/data-api'; |
|
|
private static countries = require('countries-list/dist/countries.json'); |
|
|
private static countries = require('countries-list/dist/countries.json'); |
|
|
private static countriesMapping = { |
|
|
private static countriesMapping = { |
|
|
'Russian Federation': 'Russia' |
|
|
'Russian Federation': 'Russia' |
|
@ -33,14 +33,22 @@ export class TrackinsightDataEnhancerService implements DataEnhancerInterface { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const profile = await got( |
|
|
const profile = await got( |
|
|
`${TrackinsightDataEnhancerService.baseUrl}/data-api/funds/${symbol}.json` |
|
|
`${TrackinsightDataEnhancerService.baseUrl}/funds/${symbol}.json` |
|
|
|
|
|
) |
|
|
|
|
|
.json<any>() |
|
|
|
|
|
.catch(() => { |
|
|
|
|
|
return got( |
|
|
|
|
|
`${TrackinsightDataEnhancerService.baseUrl}/funds/${ |
|
|
|
|
|
symbol.split('.')?.[0] |
|
|
|
|
|
}.json` |
|
|
) |
|
|
) |
|
|
.json<any>() |
|
|
.json<any>() |
|
|
.catch(() => { |
|
|
.catch(() => { |
|
|
return {}; |
|
|
return {}; |
|
|
}); |
|
|
}); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
const isin = profile.isin?.split(';')?.[0]; |
|
|
const isin = profile?.isin?.split(';')?.[0]; |
|
|
|
|
|
|
|
|
if (isin) { |
|
|
if (isin) { |
|
|
response.isin = isin; |
|
|
response.isin = isin; |
|
@ -55,7 +63,11 @@ export class TrackinsightDataEnhancerService implements DataEnhancerInterface { |
|
|
`${TrackinsightDataEnhancerService.baseUrl}/holdings/${ |
|
|
`${TrackinsightDataEnhancerService.baseUrl}/holdings/${ |
|
|
symbol.split('.')?.[0] |
|
|
symbol.split('.')?.[0] |
|
|
}.json` |
|
|
}.json` |
|
|
); |
|
|
) |
|
|
|
|
|
.json<any>() |
|
|
|
|
|
.catch(() => { |
|
|
|
|
|
return {}; |
|
|
|
|
|
}); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
if (holdings?.weight < 0.95) { |
|
|
if (holdings?.weight < 0.95) { |
|
|