Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍
TypeScript angularetffinancefintechghostfoliohacktoberfestinvestingnestjsosspersonal-financeportfolioprismasoftwarestocktrackertradingtypescriptwealth-managementweb
Feature/allow data gathering by date range (#5762)
s-vamshia65523fd043a
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 48d622193b..66b47fc1a7 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).+## Unreleased++### Added++- Added support for data gathering by date range in the asset profile details dialog of the admin control panel+## 2.209.0 - 2025-10-18### Addeddiff --git a/apps/api/src/app/admin/admin.controller.ts b/apps/api/src/app/admin/admin.controller.tsindex 66f8483b40..d7c4c5d3d5 100644--- a/apps/api/src/app/admin/admin.controller.ts+++ b/apps/api/src/app/admin/admin.controller.ts@@ -169,7 +169,7 @@ export class AdminController {let date: Date;if (dateRange) {- const { startDate } = getIntervalFromDateRange(dateRange, new Date());+ const { startDate } = getIntervalFromDateRange(dateRange);date = startDate;}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.tsindex 3fd9e506f4..a56f6dec59 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@@ -18,6 +18,7 @@ import {ScraperConfiguration,User} from '@ghostfolio/common/interfaces';+import { DateRange } from '@ghostfolio/common/types';import { GfCurrencySelectorComponent } from '@ghostfolio/ui/currency-selector';import { GfEntityLogoComponent } from '@ghostfolio/ui/entity-logo';import { GfHistoricalMarketDataEditorComponent } from '@ghostfolio/ui/historical-market-data-editor';@@ -190,6 +191,32 @@ export class GfAssetProfileDialogComponent implements OnDestroy, OnInit {};public currencies: string[] = [];+ public dateRangeOptions = [+ {+ label: $localize`Current week` + ' (' + $localize`WTD` + ')',+ value: 'wtd'+ },+ {+ label: $localize`Current month` + ' (' + $localize`MTD` + ')',+ value: 'mtd'+ },+ {+ label: $localize`Current year` + ' (' + $localize`YTD` + ')',+ value: 'ytd'+ },+ {+ label: '1 ' + $localize`year` + ' (' + $localize`1Y` + ')',+ value: '1y'+ },+ {+ label: '5 ' + $localize`years` + ' (' + $localize`5Y` + ')',+ value: '5y'+ },+ {+ label: $localize`Max`,+ value: 'max'+ }+ ];public historicalDataItems: LineChartItem[];public isBenchmark = false;public isDataGatheringEnabled: boolean;@@ -405,9 +432,15 @@ export class GfAssetProfileDialogComponent implements OnDestroy, OnInit {.subscribe();}- public onGatherSymbol({ dataSource, symbol }: AssetProfileIdentifier) {+ public onGatherSymbol({+ dataSource,+ range,+ symbol+ }: {+ range?: DateRange;+ } & AssetProfileIdentifier) {this.adminService- .gatherSymbol({ dataSource, symbol })+ .gatherSymbol({ dataSource, range, symbol }).pipe(takeUntil(this.unsubscribeSubject)).subscribe();}diff --git a/apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.html b/apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.htmlindex 301287cf52..b2c063684c 100644--- a/apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.html+++ b/apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.html@@ -26,12 +26,30 @@[disabled]="assetProfileForm.dirty || !assetProfileForm.controls.isActive.value"+ [matMenuTriggerFor]="gatherHistoricalMarketDataMenu"(click)="onGatherSymbol({ dataSource: data.dataSource, symbol: data.symbol })"><ng-container i18n>Gather Historical Market Data</ng-container></button>+ <mat-menu #gatherHistoricalMarketDataMenu="matMenu">+ @for (dateRange of dateRangeOptions; track dateRange.value) {+ <button+ mat-menu-item+ type="button"+ (click)="+ onGatherSymbol({+ dataSource: data.dataSource,+ range: dateRange.value,+ symbol: data.symbol+ })+ "+ >+ {{ dateRange.label }}+ </button>+ }+ </mat-menu><buttonmat-menu-itemtype="button"diff --git a/apps/client/src/app/services/admin.service.ts b/apps/client/src/app/services/admin.service.tsindex 6705352918..6a90bc4df5 100644--- a/apps/client/src/app/services/admin.service.ts+++ b/apps/client/src/app/services/admin.service.ts@@ -17,6 +17,7 @@ import {EnhancedSymbolProfile,Filter} from '@ghostfolio/common/interfaces';+import { DateRange } from '@ghostfolio/common/types';import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';import { Injectable } from '@angular/core';@@ -178,9 +179,22 @@ export class AdminService {);}- public gatherSymbol({ dataSource, symbol }: AssetProfileIdentifier) {+ public gatherSymbol({+ dataSource,+ range,+ symbol+ }: {+ range?: DateRange;+ } & AssetProfileIdentifier) {+ let params = new HttpParams();++ if (range) {+ params = params.append('range', range);+ }+const url = `/api/v1/admin/gather/${dataSource}/${symbol}`;- return this.http.post<MarketData | void>(url, {});++ return this.http.post<MarketData | void>(url, undefined, { params });}public fetchSymbolForDate({