Feature/add dialog for benchmarks in markets overview (#3493)
* Add benchmarks dialog in markets overview * Update changelog
This commit is contained in:
@@ -11,6 +11,7 @@ import {
|
||||
import { hasPermission, permissions } from '@ghostfolio/common/permissions';
|
||||
|
||||
import { ChangeDetectorRef, Component, OnDestroy, OnInit } from '@angular/core';
|
||||
import { DeviceDetectorService } from 'ngx-device-detector';
|
||||
import { Subject } from 'rxjs';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
|
||||
@@ -21,6 +22,7 @@ import { takeUntil } from 'rxjs/operators';
|
||||
})
|
||||
export class HomeMarketComponent implements OnDestroy, OnInit {
|
||||
public benchmarks: Benchmark[];
|
||||
public deviceType: string;
|
||||
public fearAndGreedIndex: number;
|
||||
public fearLabel = $localize`Fear`;
|
||||
public greedLabel = $localize`Greed`;
|
||||
@@ -36,8 +38,10 @@ export class HomeMarketComponent implements OnDestroy, OnInit {
|
||||
public constructor(
|
||||
private changeDetectorRef: ChangeDetectorRef,
|
||||
private dataService: DataService,
|
||||
private deviceService: DeviceDetectorService,
|
||||
private userService: UserService
|
||||
) {
|
||||
this.deviceType = this.deviceService.getDeviceInfo().deviceType;
|
||||
this.info = this.dataService.fetchInfo();
|
||||
this.isLoading = true;
|
||||
|
||||
|
@@ -32,6 +32,7 @@
|
||||
<div class="col-xs-12 col-md-8 offset-md-2">
|
||||
<gf-benchmark
|
||||
[benchmarks]="benchmarks"
|
||||
[deviceType]="deviceType"
|
||||
[locale]="user?.settings?.locale || undefined"
|
||||
[user]="user"
|
||||
/>
|
||||
|
@@ -285,7 +285,7 @@ export class AnalysisPageComponent implements OnDestroy, OnInit {
|
||||
this.isLoadingBenchmarkComparator = true;
|
||||
|
||||
this.dataService
|
||||
.fetchBenchmarkBySymbol({
|
||||
.fetchBenchmarkForUser({
|
||||
dataSource,
|
||||
symbol,
|
||||
range: this.user?.settings?.dateRange,
|
||||
|
@@ -19,6 +19,7 @@ import {
|
||||
Access,
|
||||
AccountBalancesResponse,
|
||||
Accounts,
|
||||
AdminMarketDataDetails,
|
||||
BenchmarkMarketDataDetails,
|
||||
BenchmarkResponse,
|
||||
Export,
|
||||
@@ -284,7 +285,21 @@ export class DataService {
|
||||
return this.http.get<Access[]>('/api/v1/access');
|
||||
}
|
||||
|
||||
public fetchBenchmarkBySymbol({
|
||||
public fetchAsset({
|
||||
dataSource,
|
||||
symbol
|
||||
}: UniqueAsset): Observable<AdminMarketDataDetails> {
|
||||
return this.http.get<any>(`/api/v1/asset/${dataSource}/${symbol}`).pipe(
|
||||
map((data) => {
|
||||
for (const item of data.marketData) {
|
||||
item.date = parseISO(item.date);
|
||||
}
|
||||
return data;
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
public fetchBenchmarkForUser({
|
||||
dataSource,
|
||||
range,
|
||||
startDate,
|
||||
|
Reference in New Issue
Block a user