Browse Source

Feature/add data provider info to asset profile details dialog (#3434)

* Add data provider info to asset profile details dialog

* Update changelog
pull/3445/head^2
Thomas Kaul 8 months ago
committed by GitHub
parent
commit
c009f8c12f
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 4
      CHANGELOG.md
  2. 6
      apps/api/src/app/admin/admin.service.ts
  3. 4
      apps/api/src/services/data-provider/alpha-vantage/alpha-vantage.service.ts
  4. 12
      apps/api/src/services/data-provider/data-provider.service.ts
  5. 4
      apps/api/src/services/data-provider/eod-historical-data/eod-historical-data.service.ts
  6. 4
      apps/api/src/services/data-provider/google-sheets/google-sheets.service.ts
  7. 4
      apps/api/src/services/data-provider/rapid-api/rapid-api.service.ts
  8. 4
      apps/api/src/services/data-provider/yahoo-finance/yahoo-finance.service.ts
  9. 10
      apps/api/src/services/symbol-profile/symbol-profile.service.ts
  10. 11
      apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.html
  11. 2
      libs/common/src/lib/interfaces/enhanced-symbol-profile.interface.ts

4
CHANGELOG.md

@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Unreleased
### Added
- Added the data provider information to the asset profile details dialog of the admin control
### Fixed
- Fixed an issue with the initial annual interest rate in the _FIRE_ calculator

6
apps/api/src/app/admin/admin.service.ts

@ -313,6 +313,12 @@ export class AdminService {
})
]);
if (assetProfile) {
assetProfile.dataProviderInfo = this.dataProviderService
.getDataProvider(assetProfile.dataSource)
.getDataProviderInfo();
}
return {
marketData,
assetProfile: assetProfile ?? {

4
apps/api/src/services/data-provider/alpha-vantage/alpha-vantage.service.ts

@ -50,7 +50,9 @@ export class AlphaVantageService implements DataProviderInterface {
public getDataProviderInfo(): DataProviderInfo {
return {
isPremium: false
isPremium: false,
name: 'Alpha Vantage',
url: 'https://www.alphavantage.co'
};
}

12
apps/api/src/services/data-provider/data-provider.service.ts

@ -598,10 +598,14 @@ export class DataProviderService {
return name1?.toLowerCase().localeCompare(name2?.toLowerCase());
})
.map((lookupItem) => {
if (
!this.configurationService.get('ENABLE_FEATURE_SUBSCRIPTION') ||
user.subscription.type === 'Premium'
) {
if (this.configurationService.get('ENABLE_FEATURE_SUBSCRIPTION')) {
if (user.subscription.type === 'Premium') {
lookupItem.dataProviderInfo.isPremium = false;
}
lookupItem.dataProviderInfo.name = undefined;
lookupItem.dataProviderInfo.url = undefined;
} else {
lookupItem.dataProviderInfo.isPremium = false;
}

4
apps/api/src/services/data-provider/eod-historical-data/eod-historical-data.service.ts

@ -66,7 +66,9 @@ export class EodHistoricalDataService implements DataProviderInterface {
public getDataProviderInfo(): DataProviderInfo {
return {
isPremium: true
isPremium: true,
name: 'EOD Historical Data',
url: 'https://eodhd.com'
};
}

4
apps/api/src/services/data-provider/google-sheets/google-sheets.service.ts

@ -46,7 +46,9 @@ export class GoogleSheetsService implements DataProviderInterface {
public getDataProviderInfo(): DataProviderInfo {
return {
isPremium: false
isPremium: false,
name: 'Google Sheets',
url: 'https://docs.google.com/spreadsheets'
};
}

4
apps/api/src/services/data-provider/rapid-api/rapid-api.service.ts

@ -43,7 +43,9 @@ export class RapidApiService implements DataProviderInterface {
public getDataProviderInfo(): DataProviderInfo {
return {
isPremium: false
isPremium: false,
name: 'Rapid API',
url: 'https://rapidapi.com'
};
}

4
apps/api/src/services/data-provider/yahoo-finance/yahoo-finance.service.ts

@ -43,7 +43,9 @@ export class YahooFinanceService implements DataProviderInterface {
public getDataProviderInfo(): DataProviderInfo {
return {
isPremium: false
isPremium: false,
name: 'Yahoo Finance',
url: 'https://finance.yahoo.com'
};
}

10
apps/api/src/services/symbol-profile/symbol-profile.service.ts

@ -61,7 +61,9 @@ export class SymbolProfileService {
})
}
})
.then((symbolProfiles) => this.getSymbols(symbolProfiles));
.then((symbolProfiles) => {
return this.enhanceSymbolProfiles(symbolProfiles);
});
}
public async getSymbolProfilesByIds(
@ -83,7 +85,9 @@ export class SymbolProfileService {
}
}
})
.then((symbolProfiles) => this.getSymbols(symbolProfiles));
.then((symbolProfiles) => {
return this.enhanceSymbolProfiles(symbolProfiles);
});
}
public updateSymbolProfile({
@ -119,7 +123,7 @@ export class SymbolProfileService {
});
}
private getSymbols(
private enhanceSymbolProfiles(
symbolProfiles: (SymbolProfile & {
_count: { Order: number };
Order?: {

11
apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.html

@ -115,11 +115,22 @@
>Symbol</gf-value
>
</div>
<div class="col-6 mb-3">
<gf-value
i18n
size="medium"
[value]="
assetProfile?.dataProviderInfo?.name ?? assetProfile?.dataSource
"
>Data Source</gf-value
>
</div>
<div class="col-6 mb-3">
<gf-value i18n size="medium" [value]="assetProfile?.currency"
>Currency</gf-value
>
</div>
<div class="col-6 mb-3"></div>
<div class="col-6 mb-3">
<gf-value
i18n

2
libs/common/src/lib/interfaces/enhanced-symbol-profile.interface.ts

@ -1,6 +1,7 @@
import { AssetClass, AssetSubClass, DataSource } from '@prisma/client';
import { Country } from './country.interface';
import { DataProviderInfo } from './data-provider-info.interface';
import { ScraperConfiguration } from './scraper-configuration.interface';
import { Sector } from './sector.interface';
@ -12,6 +13,7 @@ export interface EnhancedSymbolProfile {
countries: Country[];
createdAt: Date;
currency?: string;
dataProviderInfo?: DataProviderInfo;
dataSource: DataSource;
dateOfFirstActivity?: Date;
id: string;

Loading…
Cancel
Save