From 9bce57894ebf98afe16751f164ffe9a4c75b4282 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Fri, 7 Apr 2023 16:35:37 +0200 Subject: [PATCH] Feature/increase historical market data gathering to 10 years (#1830) * Increase historical market data gathering of currency pairs to 10+ years * Update changelog --- CHANGELOG.md | 1 + apps/api/src/app/admin/admin.service.ts | 8 ++++++-- apps/api/src/services/data-gathering.service.ts | 4 ++-- .../asset-profile-dialog.component.ts | 3 ++- .../lib/interfaces/admin-market-data-details.interface.ts | 2 +- 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e45ed2fe..ee8f99f57 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Improved the activities import for `csv` files exported by _Interactive Brokers_ +- Increased the historical market data gathering of currency pairs to 10+ years - Improved the content of the Frequently Asked Questions (FAQ) page - Improved the content of the pricing page - Changed the `auth` endpoint of the login with _Security Token_ from `GET` to `POST` diff --git a/apps/api/src/app/admin/admin.service.ts b/apps/api/src/app/admin/admin.service.ts index f2fe18fc9..5b5eea63f 100644 --- a/apps/api/src/app/admin/admin.service.ts +++ b/apps/api/src/app/admin/admin.service.ts @@ -100,6 +100,7 @@ export class AdminService { dataSource, marketDataItemCount, symbol, + assetClass: 'CASH', countriesCount: 0, sectorsCount: 0 }; @@ -186,8 +187,11 @@ export class AdminService { ]); return { - assetProfile, - marketData + marketData, + assetProfile: assetProfile ?? { + symbol, + currency: '-' + } }; } diff --git a/apps/api/src/services/data-gathering.service.ts b/apps/api/src/services/data-gathering.service.ts index aef198e5b..62209846c 100644 --- a/apps/api/src/services/data-gathering.service.ts +++ b/apps/api/src/services/data-gathering.service.ts @@ -11,7 +11,7 @@ import { InjectQueue } from '@nestjs/bull'; import { Inject, Injectable, Logger } from '@nestjs/common'; import { DataSource } from '@prisma/client'; import { JobOptions, Queue } from 'bull'; -import { format, subDays } from 'date-fns'; +import { format, min, subDays, subYears } from 'date-fns'; import { DataProviderService } from './data-provider/data-provider.service'; import { DataEnhancerInterface } from './data-provider/interfaces/data-enhancer.interface'; @@ -236,7 +236,7 @@ export class DataGatheringService { return { dataSource, symbol, - date: startDate + date: min([startDate, subYears(new Date(), 10)]) }; }); diff --git a/apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.component.ts b/apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.component.ts index 1fef72010..d97e909cb 100644 --- a/apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.component.ts +++ b/apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.component.ts @@ -14,6 +14,7 @@ import { import { UpdateAssetProfileDto } from '@ghostfolio/api/app/admin/update-asset-profile.dto'; import { AdminService } from '@ghostfolio/client/services/admin.service'; import { + AdminMarketDataDetails, EnhancedSymbolProfile, UniqueAsset } from '@ghostfolio/common/interfaces'; @@ -33,7 +34,7 @@ import { AssetProfileDialogParams } from './interfaces/interfaces'; }) export class AssetProfileDialog implements OnDestroy, OnInit { public assetClass: string; - public assetProfile: EnhancedSymbolProfile; + public assetProfile: AdminMarketDataDetails['assetProfile']; public assetProfileForm = this.formBuilder.group({ comment: '', symbolMapping: '' diff --git a/libs/common/src/lib/interfaces/admin-market-data-details.interface.ts b/libs/common/src/lib/interfaces/admin-market-data-details.interface.ts index 71e0cdafb..441643f81 100644 --- a/libs/common/src/lib/interfaces/admin-market-data-details.interface.ts +++ b/libs/common/src/lib/interfaces/admin-market-data-details.interface.ts @@ -3,6 +3,6 @@ import { MarketData } from '@prisma/client'; import { EnhancedSymbolProfile } from './enhanced-symbol-profile.interface'; export interface AdminMarketDataDetails { - assetProfile: EnhancedSymbolProfile; + assetProfile: Partial; marketData: MarketData[]; }