diff --git a/CHANGELOG.md b/CHANGELOG.md index f19c08324..55d33d581 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,11 +15,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Simplified the settings management in the admin control panel +- Renamed the data source type `RAKUTEN` to `RAPID_API` ### Fixed - Fixed some links in the blog posts +### Todo + +- Rename the environment variable from `RAKUTEN_RAPID_API_KEY` to `RAPID_API_API_KEY` + ## 1.203.0 - 08.10.2022 ### Added diff --git a/apps/api/src/services/configuration.service.ts b/apps/api/src/services/configuration.service.ts index 48133743e..9cddec1f0 100644 --- a/apps/api/src/services/configuration.service.ts +++ b/apps/api/src/services/configuration.service.ts @@ -38,7 +38,7 @@ export class ConfigurationService { MAX_ACTIVITIES_TO_IMPORT: num({ default: Number.MAX_SAFE_INTEGER }), MAX_ITEM_IN_CACHE: num({ default: 9999 }), PORT: port({ default: 3333 }), - RAKUTEN_RAPID_API_KEY: str({ default: '' }), + RAPID_API_API_KEY: str({ default: '' }), REDIS_HOST: host({ default: 'localhost' }), REDIS_PASSWORD: str({ default: '' }), REDIS_PORT: port({ default: 6379 }), diff --git a/apps/api/src/services/data-gathering.service.ts b/apps/api/src/services/data-gathering.service.ts index 15d363999..e977c9c07 100644 --- a/apps/api/src/services/data-gathering.service.ts +++ b/apps/api/src/services/data-gathering.service.ts @@ -280,7 +280,7 @@ export class DataGatheringService { return ( dataSource !== DataSource.GHOSTFOLIO && dataSource !== DataSource.MANUAL && - dataSource !== DataSource.RAKUTEN + dataSource !== DataSource.RAPID_API ); }) .map(({ dataSource, symbol }) => { diff --git a/apps/api/src/services/data-provider/data-provider.module.ts b/apps/api/src/services/data-provider/data-provider.module.ts index dcdb7acbd..3fa56e06c 100644 --- a/apps/api/src/services/data-provider/data-provider.module.ts +++ b/apps/api/src/services/data-provider/data-provider.module.ts @@ -5,7 +5,7 @@ import { EodHistoricalDataService } from '@ghostfolio/api/services/data-provider import { GhostfolioScraperApiService } from '@ghostfolio/api/services/data-provider/ghostfolio-scraper-api/ghostfolio-scraper-api.service'; import { GoogleSheetsService } from '@ghostfolio/api/services/data-provider/google-sheets/google-sheets.service'; import { ManualService } from '@ghostfolio/api/services/data-provider/manual/manual.service'; -import { RakutenRapidApiService } from '@ghostfolio/api/services/data-provider/rakuten-rapid-api/rakuten-rapid-api.service'; +import { RapidApiService } from '@ghostfolio/api/services/data-provider/rapid-api/rapid-api.service'; import { YahooFinanceService } from '@ghostfolio/api/services/data-provider/yahoo-finance/yahoo-finance.service'; import { PrismaModule } from '@ghostfolio/api/services/prisma.module'; import { SymbolProfileModule } from '@ghostfolio/api/services/symbol-profile.module'; @@ -27,7 +27,7 @@ import { DataProviderService } from './data-provider.service'; GhostfolioScraperApiService, GoogleSheetsService, ManualService, - RakutenRapidApiService, + RapidApiService, YahooFinanceService, { inject: [ @@ -36,7 +36,7 @@ import { DataProviderService } from './data-provider.service'; GhostfolioScraperApiService, GoogleSheetsService, ManualService, - RakutenRapidApiService, + RapidApiService, YahooFinanceService ], provide: 'DataProviderInterfaces', @@ -46,7 +46,7 @@ import { DataProviderService } from './data-provider.service'; ghostfolioScraperApiService, googleSheetsService, manualService, - rakutenRapidApiService, + rapidApiService, yahooFinanceService ) => [ alphaVantageService, @@ -54,7 +54,7 @@ import { DataProviderService } from './data-provider.service'; ghostfolioScraperApiService, googleSheetsService, manualService, - rakutenRapidApiService, + rapidApiService, yahooFinanceService ] } diff --git a/apps/api/src/services/data-provider/rakuten-rapid-api/interfaces/interfaces.ts b/apps/api/src/services/data-provider/rakuten-rapid-api/interfaces/interfaces.ts deleted file mode 100644 index 8f4508997..000000000 --- a/apps/api/src/services/data-provider/rakuten-rapid-api/interfaces/interfaces.ts +++ /dev/null @@ -1 +0,0 @@ -export interface IRakutenRapidApiResponse {} diff --git a/apps/api/src/services/data-provider/rapid-api/interfaces/interfaces.ts b/apps/api/src/services/data-provider/rapid-api/interfaces/interfaces.ts new file mode 100644 index 000000000..995fdb9d3 --- /dev/null +++ b/apps/api/src/services/data-provider/rapid-api/interfaces/interfaces.ts @@ -0,0 +1 @@ +export interface IRapidApiResponse {} diff --git a/apps/api/src/services/data-provider/rakuten-rapid-api/rakuten-rapid-api.service.ts b/apps/api/src/services/data-provider/rapid-api/rapid-api.service.ts similarity index 92% rename from apps/api/src/services/data-provider/rakuten-rapid-api/rakuten-rapid-api.service.ts rename to apps/api/src/services/data-provider/rapid-api/rapid-api.service.ts index 7d92ae354..5aace3d24 100644 --- a/apps/api/src/services/data-provider/rakuten-rapid-api/rakuten-rapid-api.service.ts +++ b/apps/api/src/services/data-provider/rapid-api/rapid-api.service.ts @@ -15,14 +15,14 @@ import bent from 'bent'; import { format, subMonths, subWeeks, subYears } from 'date-fns'; @Injectable() -export class RakutenRapidApiService implements DataProviderInterface { +export class RapidApiService implements DataProviderInterface { public constructor( private readonly configurationService: ConfigurationService, private readonly prismaService: PrismaService ) {} public canHandle(symbol: string) { - return !!this.configurationService.get('RAKUTEN_RAPID_API_KEY'); + return !!this.configurationService.get('RAPID_API_API_KEY'); } public async getAssetProfile( @@ -103,7 +103,7 @@ export class RakutenRapidApiService implements DataProviderInterface { } public getName(): DataSource { - return DataSource.RAKUTEN; + return DataSource.RAPID_API; } public async getQuotes( @@ -129,7 +129,7 @@ export class RakutenRapidApiService implements DataProviderInterface { }; } } catch (error) { - Logger.error(error, 'RakutenRapidApiService'); + Logger.error(error, 'RapidApiService'); } return {}; @@ -155,16 +155,14 @@ export class RakutenRapidApiService implements DataProviderInterface { { useQueryString: true, 'x-rapidapi-host': 'fear-and-greed-index.p.rapidapi.com', - 'x-rapidapi-key': this.configurationService.get( - 'RAKUTEN_RAPID_API_KEY' - ) + 'x-rapidapi-key': this.configurationService.get('RAPID_API_API_KEY') } ); const { fgi } = await get(); return fgi; } catch (error) { - Logger.error(error, 'RakutenRapidApiService'); + Logger.error(error, 'RapidApiService'); return undefined; } diff --git a/apps/api/src/services/interfaces/environment.interface.ts b/apps/api/src/services/interfaces/environment.interface.ts index 00db1e2b6..5ac20b55e 100644 --- a/apps/api/src/services/interfaces/environment.interface.ts +++ b/apps/api/src/services/interfaces/environment.interface.ts @@ -26,7 +26,7 @@ export interface Environment extends CleanedEnvAccessors { MAX_ACTIVITIES_TO_IMPORT: number; MAX_ITEM_IN_CACHE: number; PORT: number; - RAKUTEN_RAPID_API_KEY: string; + RAPID_API_API_KEY: string; REDIS_HOST: string; REDIS_PASSWORD: string; REDIS_PORT: number; diff --git a/libs/common/src/lib/config.ts b/libs/common/src/lib/config.ts index 6c61e3b04..ffd67667b 100644 --- a/libs/common/src/lib/config.ts +++ b/libs/common/src/lib/config.ts @@ -6,7 +6,7 @@ export const DEMO_USER_ID = '9b112b4d-3b7d-4bad-9bdd-3b0f7b4dac2f'; export const ghostfolioScraperApiSymbolPrefix = '_GF_'; export const ghostfolioCashSymbol = `${ghostfolioScraperApiSymbolPrefix}CASH`; -export const ghostfolioFearAndGreedIndexDataSource = DataSource.RAKUTEN; +export const ghostfolioFearAndGreedIndexDataSource = DataSource.RAPID_API; export const ghostfolioFearAndGreedIndexSymbol = `${ghostfolioScraperApiSymbolPrefix}FEAR_AND_GREED_INDEX`; export const locale = 'en-US'; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 11bef3e47..062d59b06 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -207,6 +207,7 @@ enum DataSource { GOOGLE_SHEETS MANUAL RAKUTEN + RAPID_API YAHOO }