|
|
@ -15,6 +15,7 @@ import { DataService } from '@ghostfolio/client/services/data.service';
|
|
|
|
import { DATE_FORMAT, parseDate } from '@ghostfolio/common/helper';
|
|
|
|
import { DATE_FORMAT, parseDate } from '@ghostfolio/common/helper';
|
|
|
|
import {
|
|
|
|
import {
|
|
|
|
AdminMarketDataDetails,
|
|
|
|
AdminMarketDataDetails,
|
|
|
|
|
|
|
|
Currency,
|
|
|
|
UniqueAsset
|
|
|
|
UniqueAsset
|
|
|
|
} from '@ghostfolio/common/interfaces';
|
|
|
|
} from '@ghostfolio/common/interfaces';
|
|
|
|
import { translate } from '@ghostfolio/ui/i18n';
|
|
|
|
import { translate } from '@ghostfolio/ui/i18n';
|
|
|
@ -51,6 +52,7 @@ export class AssetProfileDialog implements OnDestroy, OnInit {
|
|
|
|
assetClass: new FormControl<AssetClass>(undefined),
|
|
|
|
assetClass: new FormControl<AssetClass>(undefined),
|
|
|
|
assetSubClass: new FormControl<AssetSubClass>(undefined),
|
|
|
|
assetSubClass: new FormControl<AssetSubClass>(undefined),
|
|
|
|
comment: '',
|
|
|
|
comment: '',
|
|
|
|
|
|
|
|
currency: '',
|
|
|
|
historicalData: this.formBuilder.group({
|
|
|
|
historicalData: this.formBuilder.group({
|
|
|
|
csvString: ''
|
|
|
|
csvString: ''
|
|
|
|
}),
|
|
|
|
}),
|
|
|
@ -63,6 +65,7 @@ export class AssetProfileDialog implements OnDestroy, OnInit {
|
|
|
|
public countries: {
|
|
|
|
public countries: {
|
|
|
|
[code: string]: { name: string; value: number };
|
|
|
|
[code: string]: { name: string; value: number };
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
public currencies: Currency[] = [];
|
|
|
|
public isBenchmark = false;
|
|
|
|
public isBenchmark = false;
|
|
|
|
public marketDataDetails: MarketData[] = [];
|
|
|
|
public marketDataDetails: MarketData[] = [];
|
|
|
|
public sectors: {
|
|
|
|
public sectors: {
|
|
|
@ -86,7 +89,13 @@ export class AssetProfileDialog implements OnDestroy, OnInit {
|
|
|
|
) {}
|
|
|
|
) {}
|
|
|
|
|
|
|
|
|
|
|
|
public ngOnInit(): void {
|
|
|
|
public ngOnInit(): void {
|
|
|
|
this.benchmarks = this.dataService.fetchInfo().benchmarks;
|
|
|
|
const { benchmarks, currencies } = this.dataService.fetchInfo();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.benchmarks = benchmarks;
|
|
|
|
|
|
|
|
this.currencies = currencies.map((currency) => ({
|
|
|
|
|
|
|
|
label: currency,
|
|
|
|
|
|
|
|
value: currency
|
|
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
this.initialize();
|
|
|
|
this.initialize();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -132,6 +141,7 @@ export class AssetProfileDialog implements OnDestroy, OnInit {
|
|
|
|
assetClass: this.assetProfile.assetClass ?? null,
|
|
|
|
assetClass: this.assetProfile.assetClass ?? null,
|
|
|
|
assetSubClass: this.assetProfile.assetSubClass ?? null,
|
|
|
|
assetSubClass: this.assetProfile.assetSubClass ?? null,
|
|
|
|
comment: this.assetProfile?.comment ?? '',
|
|
|
|
comment: this.assetProfile?.comment ?? '',
|
|
|
|
|
|
|
|
currency: this.assetProfile?.currency,
|
|
|
|
historicalData: {
|
|
|
|
historicalData: {
|
|
|
|
csvString: AssetProfileDialog.HISTORICAL_DATA_TEMPLATE
|
|
|
|
csvString: AssetProfileDialog.HISTORICAL_DATA_TEMPLATE
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -245,12 +255,15 @@ export class AssetProfileDialog implements OnDestroy, OnInit {
|
|
|
|
} catch {}
|
|
|
|
} catch {}
|
|
|
|
|
|
|
|
|
|
|
|
const assetProfileData: UpdateAssetProfileDto = {
|
|
|
|
const assetProfileData: UpdateAssetProfileDto = {
|
|
|
|
|
|
|
|
scraperConfiguration,
|
|
|
|
|
|
|
|
symbolMapping,
|
|
|
|
assetClass: this.assetProfileForm.controls['assetClass'].value,
|
|
|
|
assetClass: this.assetProfileForm.controls['assetClass'].value,
|
|
|
|
assetSubClass: this.assetProfileForm.controls['assetSubClass'].value,
|
|
|
|
assetSubClass: this.assetProfileForm.controls['assetSubClass'].value,
|
|
|
|
comment: this.assetProfileForm.controls['comment'].value ?? null,
|
|
|
|
comment: this.assetProfileForm.controls['comment'].value ?? null,
|
|
|
|
name: this.assetProfileForm.controls['name'].value,
|
|
|
|
currency: (<Currency>(
|
|
|
|
scraperConfiguration,
|
|
|
|
(<unknown>this.assetProfileForm.controls['currency'].value)
|
|
|
|
symbolMapping
|
|
|
|
))?.value,
|
|
|
|
|
|
|
|
name: this.assetProfileForm.controls['name'].value
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
this.adminService
|
|
|
|
this.adminService
|
|
|
|