Browse Source

Add url to symbol profile

pull/722/head
Thomas 3 years ago
parent
commit
2692c362fc
  1. 17
      apps/api/src/services/data-gathering.service.ts
  2. 9
      apps/api/src/services/data-provider/yahoo-finance/yahoo-finance.service.ts
  3. 1
      prisma/schema.prisma

17
apps/api/src/services/data-gathering.service.ts

@ -220,9 +220,11 @@ export class DataGatheringService {
Logger.log('Profile data gathering has been started.'); Logger.log('Profile data gathering has been started.');
console.time('data-gathering-profile'); console.time('data-gathering-profile');
let dataGatheringItems = aDataGatheringItems.filter((dataGatheringItem) => { let dataGatheringItems = aDataGatheringItems?.filter(
return dataGatheringItem.dataSource !== 'MANUAL'; (dataGatheringItem) => {
}); return dataGatheringItem.dataSource !== 'MANUAL';
}
);
if (!dataGatheringItems) { if (!dataGatheringItems) {
dataGatheringItems = await this.getSymbolsProfileData(); dataGatheringItems = await this.getSymbolsProfileData();
@ -260,7 +262,8 @@ export class DataGatheringService {
currency, currency,
dataSource, dataSource,
name, name,
sectors sectors,
url
} = assetProfiles[symbol]; } = assetProfiles[symbol];
try { try {
@ -273,7 +276,8 @@ export class DataGatheringService {
dataSource, dataSource,
name, name,
sectors, sectors,
symbol symbol,
url
}, },
update: { update: {
assetClass, assetClass,
@ -281,7 +285,8 @@ export class DataGatheringService {
countries, countries,
currency, currency,
name, name,
sectors sectors,
url
}, },
where: { where: {
dataSource_symbol: { dataSource_symbol: {

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

@ -119,11 +119,10 @@ export class YahooFinanceService implements DataProviderInterface {
} }
} }
// TODO: Add url if available const url = assetProfile.summaryProfile?.website;
/*const url = assetProfile.summaryProfile?.website; if (url) {
if (url) { response.url = url;
response.url = url; }
}*/
} catch {} } catch {}
return response; return response;

1
prisma/schema.prisma

@ -129,6 +129,7 @@ model SymbolProfile {
sectors Json? sectors Json?
symbol String symbol String
symbolMapping Json? symbolMapping Json?
url String?
@@unique([dataSource, symbol]) @@unique([dataSource, symbol])
} }

Loading…
Cancel
Save