Browse Source

Refactoring

pull/4634/head
Thomas Kaul 4 months ago
parent
commit
55d31c2e29
  1. 12
      apps/api/src/app/endpoints/watchlist/watchlist.service.ts

12
apps/api/src/app/endpoints/watchlist/watchlist.service.ts

@ -112,6 +112,10 @@ export class WatchlistService {
const watchlist = await Promise.all( const watchlist = await Promise.all(
user.watchlist.map(async ({ dataSource, symbol }) => { user.watchlist.map(async ({ dataSource, symbol }) => {
const assetProfile = assetProfiles.find((profile) => {
return profile.dataSource === dataSource && profile.symbol === symbol;
});
const allTimeHigh = await this.marketDataService.getMax({ const allTimeHigh = await this.marketDataService.getMax({
dataSource, dataSource,
symbol symbol
@ -123,10 +127,6 @@ export class WatchlistService {
quotes[symbol]?.marketPrice quotes[symbol]?.marketPrice
); );
const assetProfile = assetProfiles.find((profile) => {
return profile.dataSource === dataSource && profile.symbol === symbol;
});
return { return {
dataSource, dataSource,
symbol, symbol,
@ -135,8 +135,8 @@ export class WatchlistService {
name: assetProfile?.name, name: assetProfile?.name,
performances: { performances: {
allTimeHigh: { allTimeHigh: {
date: allTimeHigh?.date, performancePercent,
performancePercent date: allTimeHigh?.date
} }
} }
}; };

Loading…
Cancel
Save