Browse Source

Feature/rename data source from rakuten to rapid api (#1350)

* Rename Rakuten to Rapid API

* Update changelog
pull/1353/head
Thomas Kaul 2 years ago
committed by GitHub
parent
commit
538c8947cd
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      CHANGELOG.md
  2. 2
      apps/api/src/services/configuration.service.ts
  3. 2
      apps/api/src/services/data-gathering.service.ts
  4. 10
      apps/api/src/services/data-provider/data-provider.module.ts
  5. 1
      apps/api/src/services/data-provider/rakuten-rapid-api/interfaces/interfaces.ts
  6. 1
      apps/api/src/services/data-provider/rapid-api/interfaces/interfaces.ts
  7. 14
      apps/api/src/services/data-provider/rapid-api/rapid-api.service.ts
  8. 2
      apps/api/src/services/interfaces/environment.interface.ts
  9. 2
      libs/common/src/lib/config.ts
  10. 1
      prisma/schema.prisma

5
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

2
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 }),

2
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 }) => {

10
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
]
}

1
apps/api/src/services/data-provider/rakuten-rapid-api/interfaces/interfaces.ts

@ -1 +0,0 @@
export interface IRakutenRapidApiResponse {}

1
apps/api/src/services/data-provider/rapid-api/interfaces/interfaces.ts

@ -0,0 +1 @@
export interface IRapidApiResponse {}

14
apps/api/src/services/data-provider/rakuten-rapid-api/rakuten-rapid-api.service.ts → 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;
}

2
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;

2
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';

1
prisma/schema.prisma

@ -207,6 +207,7 @@ enum DataSource {
GOOGLE_SHEETS
MANUAL
RAKUTEN
RAPID_API
YAHOO
}

Loading…
Cancel
Save