Browse Source

Merge branch 'main' into bugfix/fix-countries-in-symbol-profile-overrides

pull/936/head
Thomas Kaul 3 years ago
committed by GitHub
parent
commit
b74eb123e5
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      CHANGELOG.md
  2. 11
      apps/api/src/services/data-provider/data-enhancer/trackinsight/trackinsight.service.ts
  3. 4
      package.json

4
CHANGELOG.md

@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Unreleased
### Changed
- Skipped data enhancer (_Trackinsight_) if data is inaccurate
### Fixed
- Fixed an issue with countries in the symbol profile overrides

11
apps/api/src/services/data-provider/data-enhancer/trackinsight/trackinsight.service.ts

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

4
package.json

@ -77,7 +77,6 @@
"@simplewebauthn/server": "4.1.0",
"@simplewebauthn/typescript-types": "4.0.0",
"@stripe/stripe-js": "1.22.0",
"@types/papaparse": "5.2.6",
"alphavantage": "2.2.0",
"angular-material-css-vars": "3.0.0",
"bent": "7.3.12",
@ -117,7 +116,6 @@
"rxjs": "7.4.0",
"stripe": "8.199.0",
"svgmap": "2.6.0",
"tslib": "2.0.0",
"twitter-api-v2": "1.10.3",
"uuid": "8.3.2",
"yahoo-finance2": "2.3.2",
@ -156,6 +154,7 @@
"@types/jest": "27.4.1",
"@types/lodash": "4.14.174",
"@types/node": "14.14.33",
"@types/papaparse": "5.2.6",
"@types/passport-google-oauth20": "2.0.11",
"@typescript-eslint/eslint-plugin": "5.4.0",
"@typescript-eslint/parser": "5.4.0",
@ -175,6 +174,7 @@
"prettier": "2.5.1",
"replace-in-file": "6.2.0",
"rimraf": "3.0.2",
"tslib": "2.0.0",
"ts-jest": "27.1.4",
"ts-node": "9.1.1",
"typescript": "4.6.4"

Loading…
Cancel
Save