Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍
TypeScript angularetffinancefintechghostfoliohacktoberfestinvestingnestjsosspersonal-financeportfolioprismasoftwarestocktrackertradingtypescriptwealth-managementweb
Feature/add benchmarks preset to admin control panel (#3513)
Thomas Kaulee086638f30d
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex fc7e4378f2..1332fd6e0d 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0## Unreleased+### Added++- Added a benchmarks preset to the historical market data table of the admin control panel+### Fixed- Changed the mechanism of the `INTRADAY` data gathering to persist data only if the market state is `OPEN`diff --git a/apps/api/src/app/admin/admin.module.ts b/apps/api/src/app/admin/admin.module.tsindex de9aecf3b7..f8cf8e8ac3 100644--- a/apps/api/src/app/admin/admin.module.ts+++ b/apps/api/src/app/admin/admin.module.ts@@ -1,3 +1,4 @@+import { BenchmarkModule } from '@ghostfolio/api/app/benchmark/benchmark.module';import { OrderModule } from '@ghostfolio/api/app/order/order.module';import { SubscriptionModule } from '@ghostfolio/api/app/subscription/subscription.module';import { TransformDataSourceInRequestModule } from '@ghostfolio/api/interceptors/transform-data-source-in-request/transform-data-source-in-request.module';@@ -20,6 +21,7 @@ import { QueueModule } from './queue/queue.module';@Module({imports: [ApiModule,+ BenchmarkModule,ConfigurationModule,DataGatheringModule,DataProviderModule,diff --git a/apps/api/src/app/admin/admin.service.ts b/apps/api/src/app/admin/admin.service.tsindex 21f0253ee5..3d81435abd 100644--- a/apps/api/src/app/admin/admin.service.ts+++ b/apps/api/src/app/admin/admin.service.ts@@ -1,3 +1,4 @@+import { BenchmarkService } from '@ghostfolio/api/app/benchmark/benchmark.service';import { OrderService } from '@ghostfolio/api/app/order/order.service';import { SubscriptionService } from '@ghostfolio/api/app/subscription/subscription.service';import { environment } from '@ghostfolio/api/environments/environment';@@ -41,6 +42,7 @@ import { groupBy } from 'lodash';@Injectable()export class AdminService {public constructor(+ private readonly benchmarkService: BenchmarkService,private readonly configurationService: ConfigurationService,private readonly dataProviderService: DataProviderService,private readonly exchangeRateDataService: ExchangeRateDataService,@@ -151,7 +153,16 @@ export class AdminService {[{ symbol: 'asc' }];const where: Prisma.SymbolProfileWhereInput = {};- if (presetId === 'CURRENCIES') {+ if (presetId === 'BENCHMARKS') {+ const benchmarkAssetProfiles =+ await this.benchmarkService.getBenchmarkAssetProfiles();++ where.id = {+ in: benchmarkAssetProfiles.map(({ id }) => {+ return id;+ })+ };+ } else if (presetId === 'CURRENCIES') {return this.getMarketDataForCurrencies();} else if (presetId === 'ETF_WITHOUT_COUNTRIES' ||diff --git a/apps/client/src/app/components/admin-market-data/admin-market-data.component.ts b/apps/client/src/app/components/admin-market-data/admin-market-data.component.tsindex 61f11c9bd2..6051c94dc6 100644--- a/apps/client/src/app/components/admin-market-data/admin-market-data.component.ts+++ b/apps/client/src/app/components/admin-market-data/admin-market-data.component.ts@@ -68,6 +68,11 @@ export class AdminMarketDataComponent};}).concat([+ {+ id: 'BENCHMARKS',+ label: $localize`Benchmarks`,+ type: <Filter['type']>'PRESET_ID'+ },{id: 'CURRENCIES',label: $localize`Currencies`,diff --git a/libs/common/src/lib/types/market-data-preset.type.ts b/libs/common/src/lib/types/market-data-preset.type.tsindex 497c4cf3c2..0dbf914fa5 100644--- a/libs/common/src/lib/types/market-data-preset.type.ts+++ b/libs/common/src/lib/types/market-data-preset.type.ts@@ -1,4 +1,5 @@export type MarketDataPreset =+ | 'BENCHMARKS'| 'CURRENCIES'| 'ETF_WITHOUT_COUNTRIES'| 'ETF_WITHOUT_SECTORS';