diff --git a/CHANGELOG.md b/CHANGELOG.md
index 48d622193..66b47fc1a 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
### Added
diff --git a/apps/api/src/app/admin/admin.controller.ts b/apps/api/src/app/admin/admin.controller.ts
index 66f8483b4..d7c4c5d3d 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.ts
index 3fd9e506f..a56f6dec5 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.html
index 301287cf5..b2c063684 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 })
"
>
Gather Historical Market Data
+
+ @for (dateRange of dateRangeOptions; track dateRange.value) {
+
+ }
+