diff --git a/apps/api/src/services/data-provider/alpha-vantage/alpha-vantage.service.ts b/apps/api/src/services/data-provider/alpha-vantage/alpha-vantage.service.ts index ab8923035..08dc48e57 100644 --- a/apps/api/src/services/data-provider/alpha-vantage/alpha-vantage.service.ts +++ b/apps/api/src/services/data-provider/alpha-vantage/alpha-vantage.service.ts @@ -37,12 +37,14 @@ export class AlphaVantageService implements DataProviderInterface { return !!this.configurationService.get('API_KEY_ALPHA_VANTAGE'); } - public async getAssetProfile( - aSymbol: string - ): Promise> { + public async getAssetProfile({ + symbol + }: { + symbol: string; + }): Promise> { return { - dataSource: this.getName(), - symbol: aSymbol + symbol, + dataSource: this.getName() }; } diff --git a/apps/api/src/services/data-provider/coingecko/coingecko.service.ts b/apps/api/src/services/data-provider/coingecko/coingecko.service.ts index b05ffc02b..d17ba4b7e 100644 --- a/apps/api/src/services/data-provider/coingecko/coingecko.service.ts +++ b/apps/api/src/services/data-provider/coingecko/coingecko.service.ts @@ -52,15 +52,17 @@ export class CoinGeckoService implements DataProviderInterface { return true; } - public async getAssetProfile( - aSymbol: string - ): Promise> { + public async getAssetProfile({ + symbol + }: { + symbol: string; + }): Promise> { const response: Partial = { + symbol, assetClass: AssetClass.CASH, assetSubClass: AssetSubClass.CRYPTOCURRENCY, currency: DEFAULT_CURRENCY, - dataSource: this.getName(), - symbol: aSymbol + dataSource: this.getName() }; try { @@ -70,7 +72,7 @@ export class CoinGeckoService implements DataProviderInterface { abortController.abort(); }, this.configurationService.get('REQUEST_TIMEOUT')); - const { name } = await got(`${this.apiUrl}/coins/${aSymbol}`, { + const { name } = await got(`${this.apiUrl}/coins/${symbol}`, { headers: this.headers, // @ts-ignore signal: abortController.signal @@ -81,7 +83,7 @@ export class CoinGeckoService implements DataProviderInterface { let message = error; if (error?.code === 'ABORT_ERR') { - message = `RequestError: The operation to get the asset profile for ${aSymbol} was aborted because the request to the data provider took more than ${this.configurationService.get( + message = `RequestError: The operation to get the asset profile for ${symbol} was aborted because the request to the data provider took more than ${this.configurationService.get( 'REQUEST_TIMEOUT' )}ms`; } diff --git a/apps/api/src/services/data-provider/data-provider.service.ts b/apps/api/src/services/data-provider/data-provider.service.ts index 127af3f0d..1b52ca374 100644 --- a/apps/api/src/services/data-provider/data-provider.service.ts +++ b/apps/api/src/services/data-provider/data-provider.service.ts @@ -92,7 +92,9 @@ export class DataProviderService { for (const symbol of symbols) { const promise = Promise.resolve( - this.getDataProvider(DataSource[dataSource]).getAssetProfile(symbol) + this.getDataProvider(DataSource[dataSource]).getAssetProfile({ + symbol + }) ); promises.push( diff --git a/apps/api/src/services/data-provider/eod-historical-data/eod-historical-data.service.ts b/apps/api/src/services/data-provider/eod-historical-data/eod-historical-data.service.ts index 798973be6..af67d62e9 100644 --- a/apps/api/src/services/data-provider/eod-historical-data/eod-historical-data.service.ts +++ b/apps/api/src/services/data-provider/eod-historical-data/eod-historical-data.service.ts @@ -46,19 +46,21 @@ export class EodHistoricalDataService implements DataProviderInterface { return true; } - public async getAssetProfile( - aSymbol: string - ): Promise> { - const [searchResult] = await this.getSearchResult(aSymbol); + public async getAssetProfile({ + symbol + }: { + symbol: string; + }): Promise> { + const [searchResult] = await this.getSearchResult(symbol); return { + symbol, assetClass: searchResult?.assetClass, assetSubClass: searchResult?.assetSubClass, currency: this.convertCurrency(searchResult?.currency), dataSource: this.getName(), isin: searchResult?.isin, - name: searchResult?.name, - symbol: aSymbol + name: searchResult?.name }; } diff --git a/apps/api/src/services/data-provider/financial-modeling-prep/financial-modeling-prep.service.ts b/apps/api/src/services/data-provider/financial-modeling-prep/financial-modeling-prep.service.ts index dcc2d3ae0..2faaf8db8 100644 --- a/apps/api/src/services/data-provider/financial-modeling-prep/financial-modeling-prep.service.ts +++ b/apps/api/src/services/data-provider/financial-modeling-prep/financial-modeling-prep.service.ts @@ -37,12 +37,14 @@ export class FinancialModelingPrepService implements DataProviderInterface { return true; } - public async getAssetProfile( - aSymbol: string - ): Promise> { + public async getAssetProfile({ + symbol + }: { + symbol: string; + }): Promise> { return { - dataSource: this.getName(), - symbol: aSymbol + symbol, + dataSource: this.getName() }; } diff --git a/apps/api/src/services/data-provider/google-sheets/google-sheets.service.ts b/apps/api/src/services/data-provider/google-sheets/google-sheets.service.ts index 9029e38f0..68e8bf732 100644 --- a/apps/api/src/services/data-provider/google-sheets/google-sheets.service.ts +++ b/apps/api/src/services/data-provider/google-sheets/google-sheets.service.ts @@ -33,12 +33,14 @@ export class GoogleSheetsService implements DataProviderInterface { return true; } - public async getAssetProfile( - aSymbol: string - ): Promise> { + public async getAssetProfile({ + symbol + }: { + symbol: string; + }): Promise> { return { - dataSource: this.getName(), - symbol: aSymbol + symbol, + dataSource: this.getName() }; } diff --git a/apps/api/src/services/data-provider/interfaces/data-provider.interface.ts b/apps/api/src/services/data-provider/interfaces/data-provider.interface.ts index 07fca64bd..3b3644473 100644 --- a/apps/api/src/services/data-provider/interfaces/data-provider.interface.ts +++ b/apps/api/src/services/data-provider/interfaces/data-provider.interface.ts @@ -11,7 +11,11 @@ import { DataSource, SymbolProfile } from '@prisma/client'; export interface DataProviderInterface { canHandle(symbol: string): boolean; - getAssetProfile(aSymbol: string): Promise>; + getAssetProfile({ + symbol + }: { + symbol: string; + }): Promise>; getDataProviderInfo(): DataProviderInfo; diff --git a/apps/api/src/services/data-provider/manual/manual.service.ts b/apps/api/src/services/data-provider/manual/manual.service.ts index 2ac293384..bc76645eb 100644 --- a/apps/api/src/services/data-provider/manual/manual.service.ts +++ b/apps/api/src/services/data-provider/manual/manual.service.ts @@ -43,16 +43,18 @@ export class ManualService implements DataProviderInterface { return true; } - public async getAssetProfile( - aSymbol: string - ): Promise> { + public async getAssetProfile({ + symbol + }: { + symbol: string; + }): Promise> { const assetProfile: Partial = { - dataSource: this.getName(), - symbol: aSymbol + symbol, + dataSource: this.getName() }; const [symbolProfile] = await this.symbolProfileService.getSymbolProfiles([ - { dataSource: this.getName(), symbol: aSymbol } + { symbol, dataSource: this.getName() } ]); if (symbolProfile) { diff --git a/apps/api/src/services/data-provider/rapid-api/rapid-api.service.ts b/apps/api/src/services/data-provider/rapid-api/rapid-api.service.ts index fd34abb92..e55fbd4e2 100644 --- a/apps/api/src/services/data-provider/rapid-api/rapid-api.service.ts +++ b/apps/api/src/services/data-provider/rapid-api/rapid-api.service.ts @@ -30,12 +30,14 @@ export class RapidApiService implements DataProviderInterface { return !!this.configurationService.get('API_KEY_RAPID_API'); } - public async getAssetProfile( - aSymbol: string - ): Promise> { + public async getAssetProfile({ + symbol + }: { + symbol: string; + }): Promise> { return { - dataSource: this.getName(), - symbol: aSymbol + symbol, + dataSource: this.getName() }; } diff --git a/apps/api/src/services/data-provider/yahoo-finance/yahoo-finance.service.ts b/apps/api/src/services/data-provider/yahoo-finance/yahoo-finance.service.ts index 645ec133e..b6148d431 100644 --- a/apps/api/src/services/data-provider/yahoo-finance/yahoo-finance.service.ts +++ b/apps/api/src/services/data-provider/yahoo-finance/yahoo-finance.service.ts @@ -33,11 +33,13 @@ export class YahooFinanceService implements DataProviderInterface { return true; } - public async getAssetProfile( - aSymbol: string - ): Promise> { - const { assetClass, assetSubClass, currency, name, symbol } = - await this.yahooFinanceDataEnhancerService.getAssetProfile(aSymbol); + public async getAssetProfile({ + symbol + }: { + symbol: string; + }): Promise> { + const { assetClass, assetSubClass, currency, name } = + await this.yahooFinanceDataEnhancerService.getAssetProfile(symbol); return { assetClass,