Feature/introduce asset sub class (#312)
* Introduce asset sub class * Update changelog
This commit is contained in:
parent
98dac4052a
commit
72c065a59d
@ -10,6 +10,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Added the subscription type to the users table of the admin control panel
|
- Added the subscription type to the users table of the admin control panel
|
||||||
|
- Introduced the sub classification of assets
|
||||||
|
|
||||||
|
### Todo
|
||||||
|
|
||||||
|
- Apply data migration (`yarn database:push`)
|
||||||
|
|
||||||
## 1.41.0 - 21.08.2021
|
## 1.41.0 - 21.08.2021
|
||||||
|
|
||||||
|
@ -218,6 +218,7 @@ export class PortfolioService {
|
|||||||
allocationCurrent: value.div(totalValue).toNumber(),
|
allocationCurrent: value.div(totalValue).toNumber(),
|
||||||
allocationInvestment: item.investment.div(totalInvestment).toNumber(),
|
allocationInvestment: item.investment.div(totalInvestment).toNumber(),
|
||||||
assetClass: symbolProfile.assetClass,
|
assetClass: symbolProfile.assetClass,
|
||||||
|
assetSubClass: symbolProfile.assetSubClass,
|
||||||
countries: symbolProfile.countries,
|
countries: symbolProfile.countries,
|
||||||
currency: item.currency,
|
currency: item.currency,
|
||||||
exchange: dataProviderResponse.exchange,
|
exchange: dataProviderResponse.exchange,
|
||||||
|
@ -38,7 +38,7 @@ export class DataGatheringService {
|
|||||||
|
|
||||||
if (isDataGatheringNeeded) {
|
if (isDataGatheringNeeded) {
|
||||||
console.log('7d data gathering has been started.');
|
console.log('7d data gathering has been started.');
|
||||||
console.time('7d-data-gathering');
|
console.time('data-gathering-7d');
|
||||||
|
|
||||||
await this.prismaService.property.create({
|
await this.prismaService.property.create({
|
||||||
data: {
|
data: {
|
||||||
@ -71,7 +71,7 @@ export class DataGatheringService {
|
|||||||
});
|
});
|
||||||
|
|
||||||
console.log('7d data gathering has been completed.');
|
console.log('7d data gathering has been completed.');
|
||||||
console.timeEnd('7d-data-gathering');
|
console.timeEnd('data-gathering-7d');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ export class DataGatheringService {
|
|||||||
|
|
||||||
if (!isDataGatheringLocked) {
|
if (!isDataGatheringLocked) {
|
||||||
console.log('Max data gathering has been started.');
|
console.log('Max data gathering has been started.');
|
||||||
console.time('max-data-gathering');
|
console.time('data-gathering-max');
|
||||||
|
|
||||||
await this.prismaService.property.create({
|
await this.prismaService.property.create({
|
||||||
data: {
|
data: {
|
||||||
@ -115,13 +115,13 @@ export class DataGatheringService {
|
|||||||
});
|
});
|
||||||
|
|
||||||
console.log('Max data gathering has been completed.');
|
console.log('Max data gathering has been completed.');
|
||||||
console.timeEnd('max-data-gathering');
|
console.timeEnd('data-gathering-max');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async gatherProfileData(aSymbols?: string[]) {
|
public async gatherProfileData(aSymbols?: string[]) {
|
||||||
console.log('Profile data gathering has been started.');
|
console.log('Profile data gathering has been started.');
|
||||||
console.time('profile-data-gathering');
|
console.time('data-gathering-profile');
|
||||||
|
|
||||||
let symbols = aSymbols;
|
let symbols = aSymbols;
|
||||||
|
|
||||||
@ -136,12 +136,13 @@ export class DataGatheringService {
|
|||||||
|
|
||||||
for (const [
|
for (const [
|
||||||
symbol,
|
symbol,
|
||||||
{ assetClass, currency, dataSource, name }
|
{ assetClass, assetSubClass, currency, dataSource, name }
|
||||||
] of Object.entries(currentData)) {
|
] of Object.entries(currentData)) {
|
||||||
try {
|
try {
|
||||||
await this.prismaService.symbolProfile.upsert({
|
await this.prismaService.symbolProfile.upsert({
|
||||||
create: {
|
create: {
|
||||||
assetClass,
|
assetClass,
|
||||||
|
assetSubClass,
|
||||||
currency,
|
currency,
|
||||||
dataSource,
|
dataSource,
|
||||||
name,
|
name,
|
||||||
@ -149,6 +150,7 @@ export class DataGatheringService {
|
|||||||
},
|
},
|
||||||
update: {
|
update: {
|
||||||
assetClass,
|
assetClass,
|
||||||
|
assetSubClass,
|
||||||
currency,
|
currency,
|
||||||
name
|
name
|
||||||
},
|
},
|
||||||
@ -165,7 +167,7 @@ export class DataGatheringService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
console.log('Profile data gathering has been completed.');
|
console.log('Profile data gathering has been completed.');
|
||||||
console.timeEnd('profile-data-gathering');
|
console.timeEnd('data-gathering-profile');
|
||||||
}
|
}
|
||||||
|
|
||||||
public async gatherSymbols(aSymbolsWithStartDate: IDataGatheringItem[]) {
|
public async gatherSymbols(aSymbolsWithStartDate: IDataGatheringItem[]) {
|
||||||
|
@ -8,7 +8,12 @@ import {
|
|||||||
} from '@ghostfolio/common/helper';
|
} from '@ghostfolio/common/helper';
|
||||||
import { Granularity } from '@ghostfolio/common/types';
|
import { Granularity } from '@ghostfolio/common/types';
|
||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
import { AssetClass, Currency, DataSource } from '@prisma/client';
|
import {
|
||||||
|
AssetClass,
|
||||||
|
AssetSubClass,
|
||||||
|
Currency,
|
||||||
|
DataSource
|
||||||
|
} from '@prisma/client';
|
||||||
import * as bent from 'bent';
|
import * as bent from 'bent';
|
||||||
import Big from 'big.js';
|
import Big from 'big.js';
|
||||||
import { format } from 'date-fns';
|
import { format } from 'date-fns';
|
||||||
@ -22,6 +27,7 @@ import {
|
|||||||
} from '../../interfaces/interfaces';
|
} from '../../interfaces/interfaces';
|
||||||
import {
|
import {
|
||||||
IYahooFinanceHistoricalResponse,
|
IYahooFinanceHistoricalResponse,
|
||||||
|
IYahooFinancePrice,
|
||||||
IYahooFinanceQuoteResponse
|
IYahooFinanceQuoteResponse
|
||||||
} from './interfaces/interfaces';
|
} from './interfaces/interfaces';
|
||||||
|
|
||||||
@ -60,8 +66,11 @@ export class YahooFinanceService implements DataProviderInterface {
|
|||||||
// Convert symbols back
|
// Convert symbols back
|
||||||
const symbol = convertFromYahooSymbol(yahooSymbol);
|
const symbol = convertFromYahooSymbol(yahooSymbol);
|
||||||
|
|
||||||
|
const { assetClass, assetSubClass } = this.parseAssetClass(value.price);
|
||||||
|
|
||||||
response[symbol] = {
|
response[symbol] = {
|
||||||
assetClass: this.parseAssetClass(value.price?.quoteType),
|
assetClass,
|
||||||
|
assetSubClass,
|
||||||
currency: parseCurrency(value.price?.currency),
|
currency: parseCurrency(value.price?.currency),
|
||||||
dataSource: DataSource.YAHOO,
|
dataSource: DataSource.YAHOO,
|
||||||
exchange: this.parseExchange(value.price?.exchangeName),
|
exchange: this.parseExchange(value.price?.exchangeName),
|
||||||
@ -229,20 +238,29 @@ export class YahooFinanceService implements DataProviderInterface {
|
|||||||
return aSymbol;
|
return aSymbol;
|
||||||
}
|
}
|
||||||
|
|
||||||
private parseAssetClass(aString: string): AssetClass {
|
private parseAssetClass(aPrice: IYahooFinancePrice): {
|
||||||
|
assetClass: AssetClass;
|
||||||
|
assetSubClass: AssetSubClass;
|
||||||
|
} {
|
||||||
let assetClass: AssetClass;
|
let assetClass: AssetClass;
|
||||||
|
let assetSubClass: AssetSubClass;
|
||||||
|
|
||||||
switch (aString?.toLowerCase()) {
|
switch (aPrice?.quoteType?.toLowerCase()) {
|
||||||
case 'cryptocurrency':
|
case 'cryptocurrency':
|
||||||
assetClass = AssetClass.CASH;
|
assetClass = AssetClass.CASH;
|
||||||
|
assetSubClass = AssetSubClass.CRYPTOCURRENCY;
|
||||||
break;
|
break;
|
||||||
case 'equity':
|
case 'equity':
|
||||||
|
assetClass = AssetClass.EQUITY;
|
||||||
|
assetSubClass = AssetSubClass.STOCK;
|
||||||
|
break;
|
||||||
case 'etf':
|
case 'etf':
|
||||||
assetClass = AssetClass.EQUITY;
|
assetClass = AssetClass.EQUITY;
|
||||||
|
assetSubClass = AssetSubClass.ETF;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return assetClass;
|
return { assetClass, assetSubClass };
|
||||||
}
|
}
|
||||||
|
|
||||||
private parseExchange(aString: string): string {
|
private parseExchange(aString: string): string {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import {
|
import {
|
||||||
Account,
|
Account,
|
||||||
AssetClass,
|
AssetClass,
|
||||||
|
AssetSubClass,
|
||||||
Currency,
|
Currency,
|
||||||
DataSource,
|
DataSource,
|
||||||
SymbolProfile
|
SymbolProfile
|
||||||
@ -35,6 +36,7 @@ export interface IDataProviderHistoricalResponse {
|
|||||||
|
|
||||||
export interface IDataProviderResponse {
|
export interface IDataProviderResponse {
|
||||||
assetClass?: AssetClass;
|
assetClass?: AssetClass;
|
||||||
|
assetSubClass?: AssetSubClass;
|
||||||
currency: Currency;
|
currency: Currency;
|
||||||
dataSource: DataSource;
|
dataSource: DataSource;
|
||||||
exchange?: string;
|
exchange?: string;
|
||||||
|
@ -1,9 +1,15 @@
|
|||||||
import { Country } from '@ghostfolio/common/interfaces/country.interface';
|
import { Country } from '@ghostfolio/common/interfaces/country.interface';
|
||||||
import { Sector } from '@ghostfolio/common/interfaces/sector.interface';
|
import { Sector } from '@ghostfolio/common/interfaces/sector.interface';
|
||||||
import { AssetClass, Currency, DataSource } from '@prisma/client';
|
import {
|
||||||
|
AssetClass,
|
||||||
|
AssetSubClass,
|
||||||
|
Currency,
|
||||||
|
DataSource
|
||||||
|
} from '@prisma/client';
|
||||||
|
|
||||||
export interface EnhancedSymbolProfile {
|
export interface EnhancedSymbolProfile {
|
||||||
assetClass: AssetClass;
|
assetClass: AssetClass;
|
||||||
|
assetSubClass: AssetSubClass;
|
||||||
createdAt: Date;
|
createdAt: Date;
|
||||||
currency: Currency | null;
|
currency: Currency | null;
|
||||||
dataSource: DataSource;
|
dataSource: DataSource;
|
||||||
|
@ -16,6 +16,7 @@ import { LinearScale } from 'chart.js';
|
|||||||
import { ArcElement } from 'chart.js';
|
import { ArcElement } from 'chart.js';
|
||||||
import { DoughnutController } from 'chart.js';
|
import { DoughnutController } from 'chart.js';
|
||||||
import { Chart } from 'chart.js';
|
import { Chart } from 'chart.js';
|
||||||
|
import * as Color from 'color';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'gf-portfolio-proportion-chart',
|
selector: 'gf-portfolio-proportion-chart',
|
||||||
@ -28,7 +29,7 @@ export class PortfolioProportionChartComponent
|
|||||||
{
|
{
|
||||||
@Input() baseCurrency: Currency;
|
@Input() baseCurrency: Currency;
|
||||||
@Input() isInPercent: boolean;
|
@Input() isInPercent: boolean;
|
||||||
@Input() key: string;
|
@Input() keys: string[];
|
||||||
@Input() locale: string;
|
@Input() locale: string;
|
||||||
@Input() maxItems?: number;
|
@Input() maxItems?: number;
|
||||||
@Input() positions: {
|
@Input() positions: {
|
||||||
@ -65,24 +66,54 @@ export class PortfolioProportionChartComponent
|
|||||||
private initialize() {
|
private initialize() {
|
||||||
this.isLoading = true;
|
this.isLoading = true;
|
||||||
const chartData: {
|
const chartData: {
|
||||||
[symbol: string]: { color?: string; value: number };
|
[symbol: string]: {
|
||||||
|
color?: string;
|
||||||
|
subCategory: { [symbol: string]: { value: number } };
|
||||||
|
value: number;
|
||||||
|
};
|
||||||
} = {};
|
} = {};
|
||||||
|
|
||||||
Object.keys(this.positions).forEach((symbol) => {
|
Object.keys(this.positions).forEach((symbol) => {
|
||||||
if (this.positions[symbol][this.key]) {
|
if (this.positions[symbol][this.keys[0]]) {
|
||||||
if (chartData[this.positions[symbol][this.key]]) {
|
if (chartData[this.positions[symbol][this.keys[0]]]) {
|
||||||
chartData[this.positions[symbol][this.key]].value +=
|
chartData[this.positions[symbol][this.keys[0]]].value +=
|
||||||
this.positions[symbol].value;
|
this.positions[symbol].value;
|
||||||
|
|
||||||
|
if (
|
||||||
|
chartData[this.positions[symbol][this.keys[0]]].subCategory[
|
||||||
|
this.positions[symbol][this.keys[1]]
|
||||||
|
]
|
||||||
|
) {
|
||||||
|
chartData[this.positions[symbol][this.keys[0]]].subCategory[
|
||||||
|
this.positions[symbol][this.keys[1]]
|
||||||
|
].value += this.positions[symbol].value;
|
||||||
|
} else {
|
||||||
|
chartData[this.positions[symbol][this.keys[0]]].subCategory[
|
||||||
|
this.positions[symbol][this.keys[1]] ?? UNKNOWN_KEY
|
||||||
|
] = { value: this.positions[symbol].value };
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
chartData[this.positions[symbol][this.key]] = {
|
chartData[this.positions[symbol][this.keys[0]]] = {
|
||||||
|
subCategory: {},
|
||||||
value: this.positions[symbol].value
|
value: this.positions[symbol].value
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (this.positions[symbol][this.keys[1]]) {
|
||||||
|
chartData[this.positions[symbol][this.keys[0]]].subCategory = {
|
||||||
|
[this.positions[symbol][this.keys[1]]]: {
|
||||||
|
value: this.positions[symbol].value
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (chartData[UNKNOWN_KEY]) {
|
if (chartData[UNKNOWN_KEY]) {
|
||||||
chartData[UNKNOWN_KEY].value += this.positions[symbol].value;
|
chartData[UNKNOWN_KEY].value += this.positions[symbol].value;
|
||||||
} else {
|
} else {
|
||||||
chartData[UNKNOWN_KEY] = {
|
chartData[UNKNOWN_KEY] = {
|
||||||
|
subCategory: this.keys[1]
|
||||||
|
? { [this.keys[1]]: { value: 0 } }
|
||||||
|
: undefined,
|
||||||
value: this.positions[symbol].value
|
value: this.positions[symbol].value
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -107,13 +138,17 @@ export class PortfolioProportionChartComponent
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (!unknownItem) {
|
if (!unknownItem) {
|
||||||
const index = chartDataSorted.push([UNKNOWN_KEY, { value: 0 }]);
|
const index = chartDataSorted.push([
|
||||||
|
UNKNOWN_KEY,
|
||||||
|
{ subCategory: {}, value: 0 }
|
||||||
|
]);
|
||||||
unknownItem = chartDataSorted[index];
|
unknownItem = chartDataSorted[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
rest.forEach((restItem) => {
|
rest.forEach((restItem) => {
|
||||||
if (unknownItem?.[1]) {
|
if (unknownItem?.[1]) {
|
||||||
unknownItem[1] = {
|
unknownItem[1] = {
|
||||||
|
subCategory: {},
|
||||||
value: unknownItem[1].value + restItem[1].value
|
value: unknownItem[1].value + restItem[1].value
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -141,21 +176,53 @@ export class PortfolioProportionChartComponent
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const backgroundColorSubCategory: string[] = [];
|
||||||
|
const dataSubCategory: number[] = [];
|
||||||
|
const labelSubCategory: string[] = [];
|
||||||
|
|
||||||
|
chartDataSorted.forEach(([, item]) => {
|
||||||
|
let lightnessRatio = 0.2;
|
||||||
|
|
||||||
|
Object.keys(item.subCategory).forEach((subCategory) => {
|
||||||
|
backgroundColorSubCategory.push(
|
||||||
|
Color(item.color).lighten(lightnessRatio).hex()
|
||||||
|
);
|
||||||
|
dataSubCategory.push(item.subCategory[subCategory].value);
|
||||||
|
labelSubCategory.push(subCategory);
|
||||||
|
|
||||||
|
lightnessRatio += 0.1;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
const datasets = [
|
||||||
|
{
|
||||||
|
backgroundColor: chartDataSorted.map(([, item]) => {
|
||||||
|
return item.color;
|
||||||
|
}),
|
||||||
|
borderWidth: 0,
|
||||||
|
data: chartDataSorted.map(([, item]) => {
|
||||||
|
return item.value;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
let labels = chartDataSorted.map(([label]) => {
|
||||||
|
return label;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (this.keys[1]) {
|
||||||
|
datasets.unshift({
|
||||||
|
backgroundColor: backgroundColorSubCategory,
|
||||||
|
borderWidth: 0,
|
||||||
|
data: dataSubCategory
|
||||||
|
});
|
||||||
|
|
||||||
|
labels = labelSubCategory.concat(labels);
|
||||||
|
}
|
||||||
|
|
||||||
const data = {
|
const data = {
|
||||||
datasets: [
|
datasets,
|
||||||
{
|
labels
|
||||||
backgroundColor: chartDataSorted.map(([, item]) => {
|
|
||||||
return item.color;
|
|
||||||
}),
|
|
||||||
borderWidth: 0,
|
|
||||||
data: chartDataSorted.map(([, item]) => {
|
|
||||||
return item.value;
|
|
||||||
})
|
|
||||||
}
|
|
||||||
],
|
|
||||||
labels: chartDataSorted.map(([label]) => {
|
|
||||||
return label;
|
|
||||||
})
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (this.chartCanvas) {
|
if (this.chartCanvas) {
|
||||||
@ -166,13 +233,16 @@ export class PortfolioProportionChartComponent
|
|||||||
this.chart = new Chart(this.chartCanvas.nativeElement, {
|
this.chart = new Chart(this.chartCanvas.nativeElement, {
|
||||||
data,
|
data,
|
||||||
options: {
|
options: {
|
||||||
|
cutout: '70%',
|
||||||
plugins: {
|
plugins: {
|
||||||
legend: { display: false },
|
legend: { display: false },
|
||||||
tooltip: {
|
tooltip: {
|
||||||
callbacks: {
|
callbacks: {
|
||||||
label: (context) => {
|
label: (context) => {
|
||||||
const label =
|
const labelIndex =
|
||||||
context.label === UNKNOWN_KEY ? 'Other' : context.label;
|
(data.datasets[context.datasetIndex - 1]?.data?.length ??
|
||||||
|
0) + context.dataIndex;
|
||||||
|
const label = context.chart.data.labels[labelIndex];
|
||||||
|
|
||||||
if (this.isInPercent) {
|
if (this.isInPercent) {
|
||||||
const value = 100 * <number>context.raw;
|
const value = 100 * <number>context.raw;
|
||||||
|
@ -3,7 +3,7 @@ import { ToggleOption } from '@ghostfolio/client/components/toggle/interfaces/to
|
|||||||
import { DataService } from '@ghostfolio/client/services/data.service';
|
import { DataService } from '@ghostfolio/client/services/data.service';
|
||||||
import { ImpersonationStorageService } from '@ghostfolio/client/services/impersonation-storage.service';
|
import { ImpersonationStorageService } from '@ghostfolio/client/services/impersonation-storage.service';
|
||||||
import { UserService } from '@ghostfolio/client/services/user/user.service';
|
import { UserService } from '@ghostfolio/client/services/user/user.service';
|
||||||
import { UNKNOWN_KEY, ghostfolioCashSymbol } from '@ghostfolio/common/config';
|
import { UNKNOWN_KEY } from '@ghostfolio/common/config';
|
||||||
import {
|
import {
|
||||||
PortfolioDetails,
|
PortfolioDetails,
|
||||||
PortfolioPosition,
|
PortfolioPosition,
|
||||||
@ -129,6 +129,7 @@ export class AllocationsPageComponent implements OnDestroy, OnInit {
|
|||||||
)) {
|
)) {
|
||||||
this.positions[symbol] = {
|
this.positions[symbol] = {
|
||||||
assetClass: position.assetClass,
|
assetClass: position.assetClass,
|
||||||
|
assetSubClass: position.assetSubClass,
|
||||||
currency: position.currency,
|
currency: position.currency,
|
||||||
exchange: position.exchange,
|
exchange: position.exchange,
|
||||||
value:
|
value:
|
||||||
|
@ -18,9 +18,9 @@
|
|||||||
</mat-card-header>
|
</mat-card-header>
|
||||||
<mat-card-content>
|
<mat-card-content>
|
||||||
<gf-portfolio-proportion-chart
|
<gf-portfolio-proportion-chart
|
||||||
key="name"
|
|
||||||
[baseCurrency]="user?.settings?.baseCurrency"
|
[baseCurrency]="user?.settings?.baseCurrency"
|
||||||
[isInPercent]="hasImpersonationId"
|
[isInPercent]="hasImpersonationId"
|
||||||
|
[keys]="['name']"
|
||||||
[locale]="user?.settings?.locale"
|
[locale]="user?.settings?.locale"
|
||||||
[positions]="accounts"
|
[positions]="accounts"
|
||||||
></gf-portfolio-proportion-chart>
|
></gf-portfolio-proportion-chart>
|
||||||
@ -40,9 +40,9 @@
|
|||||||
</mat-card-header>
|
</mat-card-header>
|
||||||
<mat-card-content>
|
<mat-card-content>
|
||||||
<gf-portfolio-proportion-chart
|
<gf-portfolio-proportion-chart
|
||||||
key="assetClass"
|
|
||||||
[baseCurrency]="user?.settings?.baseCurrency"
|
[baseCurrency]="user?.settings?.baseCurrency"
|
||||||
[isInPercent]="true"
|
[isInPercent]="true"
|
||||||
|
[keys]="['assetClass', 'assetSubClass']"
|
||||||
[locale]="user?.settings?.locale"
|
[locale]="user?.settings?.locale"
|
||||||
[positions]="positions"
|
[positions]="positions"
|
||||||
></gf-portfolio-proportion-chart>
|
></gf-portfolio-proportion-chart>
|
||||||
@ -62,9 +62,9 @@
|
|||||||
</mat-card-header>
|
</mat-card-header>
|
||||||
<mat-card-content>
|
<mat-card-content>
|
||||||
<gf-portfolio-proportion-chart
|
<gf-portfolio-proportion-chart
|
||||||
key="currency"
|
|
||||||
[baseCurrency]="user?.settings?.baseCurrency"
|
[baseCurrency]="user?.settings?.baseCurrency"
|
||||||
[isInPercent]="true"
|
[isInPercent]="true"
|
||||||
|
[keys]="['currency']"
|
||||||
[locale]="user?.settings?.locale"
|
[locale]="user?.settings?.locale"
|
||||||
[positions]="positions"
|
[positions]="positions"
|
||||||
></gf-portfolio-proportion-chart>
|
></gf-portfolio-proportion-chart>
|
||||||
@ -84,9 +84,9 @@
|
|||||||
</mat-card-header>
|
</mat-card-header>
|
||||||
<mat-card-content>
|
<mat-card-content>
|
||||||
<gf-portfolio-proportion-chart
|
<gf-portfolio-proportion-chart
|
||||||
key="name"
|
|
||||||
[baseCurrency]="user?.settings?.baseCurrency"
|
[baseCurrency]="user?.settings?.baseCurrency"
|
||||||
[isInPercent]="false"
|
[isInPercent]="false"
|
||||||
|
[keys]="['name']"
|
||||||
[locale]="user?.settings?.locale"
|
[locale]="user?.settings?.locale"
|
||||||
[maxItems]="10"
|
[maxItems]="10"
|
||||||
[positions]="sectors"
|
[positions]="sectors"
|
||||||
@ -107,9 +107,9 @@
|
|||||||
</mat-card-header>
|
</mat-card-header>
|
||||||
<mat-card-content>
|
<mat-card-content>
|
||||||
<gf-portfolio-proportion-chart
|
<gf-portfolio-proportion-chart
|
||||||
key="name"
|
|
||||||
[baseCurrency]="user?.settings?.baseCurrency"
|
[baseCurrency]="user?.settings?.baseCurrency"
|
||||||
[isInPercent]="false"
|
[isInPercent]="false"
|
||||||
|
[keys]="['name']"
|
||||||
[locale]="user?.settings?.locale"
|
[locale]="user?.settings?.locale"
|
||||||
[positions]="continents"
|
[positions]="continents"
|
||||||
></gf-portfolio-proportion-chart>
|
></gf-portfolio-proportion-chart>
|
||||||
@ -129,7 +129,7 @@
|
|||||||
</mat-card-header>
|
</mat-card-header>
|
||||||
<mat-card-content>
|
<mat-card-content>
|
||||||
<gf-portfolio-proportion-chart
|
<gf-portfolio-proportion-chart
|
||||||
key="name"
|
[keys]="['name']"
|
||||||
[baseCurrency]="user?.settings?.baseCurrency"
|
[baseCurrency]="user?.settings?.baseCurrency"
|
||||||
[isInPercent]="false"
|
[isInPercent]="false"
|
||||||
[locale]="user?.settings?.locale"
|
[locale]="user?.settings?.locale"
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { MarketState } from '@ghostfolio/api/services/interfaces/interfaces';
|
import { MarketState } from '@ghostfolio/api/services/interfaces/interfaces';
|
||||||
import { AssetClass, Currency } from '@prisma/client';
|
import { AssetClass, AssetSubClass, Currency } from '@prisma/client';
|
||||||
|
|
||||||
import { Country } from './country.interface';
|
import { Country } from './country.interface';
|
||||||
import { Sector } from './sector.interface';
|
import { Sector } from './sector.interface';
|
||||||
@ -8,6 +8,7 @@ export interface PortfolioPosition {
|
|||||||
allocationCurrent: number;
|
allocationCurrent: number;
|
||||||
allocationInvestment: number;
|
allocationInvestment: number;
|
||||||
assetClass?: AssetClass;
|
assetClass?: AssetClass;
|
||||||
|
assetSubClass?: AssetSubClass;
|
||||||
countries: Country[];
|
countries: Country[];
|
||||||
currency: Currency;
|
currency: Currency;
|
||||||
exchange?: string;
|
exchange?: string;
|
||||||
|
@ -82,6 +82,7 @@
|
|||||||
"cheerio": "1.0.0-rc.6",
|
"cheerio": "1.0.0-rc.6",
|
||||||
"class-transformer": "0.3.2",
|
"class-transformer": "0.3.2",
|
||||||
"class-validator": "0.13.1",
|
"class-validator": "0.13.1",
|
||||||
|
"color": "4.0.1",
|
||||||
"countries-list": "2.6.1",
|
"countries-list": "2.6.1",
|
||||||
"countup.js": "2.0.7",
|
"countup.js": "2.0.7",
|
||||||
"cryptocurrencies": "7.0.0",
|
"cryptocurrencies": "7.0.0",
|
||||||
@ -126,6 +127,7 @@
|
|||||||
"@nrwl/workspace": "12.5.4",
|
"@nrwl/workspace": "12.5.4",
|
||||||
"@types/big.js": "6.1.1",
|
"@types/big.js": "6.1.1",
|
||||||
"@types/cache-manager": "3.4.0",
|
"@types/cache-manager": "3.4.0",
|
||||||
|
"@types/color": "3.0.2",
|
||||||
"@types/jest": "26.0.20",
|
"@types/jest": "26.0.20",
|
||||||
"@types/lodash": "4.14.168",
|
"@types/lodash": "4.14.168",
|
||||||
"@types/node": "14.14.33",
|
"@types/node": "14.14.33",
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
-- CreateEnum
|
||||||
|
CREATE TYPE "AssetSubClass" AS ENUM ('CRYPTOCURRENCY', 'ETF', 'STOCK');
|
||||||
|
|
||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE "SymbolProfile" ADD COLUMN "assetSubClass" "AssetSubClass";
|
@ -117,17 +117,18 @@ model Settings {
|
|||||||
}
|
}
|
||||||
|
|
||||||
model SymbolProfile {
|
model SymbolProfile {
|
||||||
assetClass AssetClass?
|
assetClass AssetClass?
|
||||||
countries Json?
|
assetSubClass AssetSubClass?
|
||||||
createdAt DateTime @default(now())
|
countries Json?
|
||||||
currency Currency?
|
createdAt DateTime @default(now())
|
||||||
dataSource DataSource
|
currency Currency?
|
||||||
id String @id @default(uuid())
|
dataSource DataSource
|
||||||
name String?
|
id String @id @default(uuid())
|
||||||
Order Order[]
|
name String?
|
||||||
updatedAt DateTime @updatedAt
|
Order Order[]
|
||||||
sectors Json?
|
updatedAt DateTime @updatedAt
|
||||||
symbol String
|
sectors Json?
|
||||||
|
symbol String
|
||||||
|
|
||||||
@@unique([dataSource, symbol])
|
@@unique([dataSource, symbol])
|
||||||
}
|
}
|
||||||
@ -174,6 +175,12 @@ enum AssetClass {
|
|||||||
EQUITY
|
EQUITY
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum AssetSubClass {
|
||||||
|
CRYPTOCURRENCY
|
||||||
|
ETF
|
||||||
|
STOCK
|
||||||
|
}
|
||||||
|
|
||||||
enum Currency {
|
enum Currency {
|
||||||
CHF
|
CHF
|
||||||
EUR
|
EUR
|
||||||
|
49
yarn.lock
49
yarn.lock
@ -2567,6 +2567,25 @@
|
|||||||
resolved "https://registry.yarnpkg.com/@types/cache-manager/-/cache-manager-3.4.0.tgz#414136ea3807a8cd071b8f20370c5df5dbffd382"
|
resolved "https://registry.yarnpkg.com/@types/cache-manager/-/cache-manager-3.4.0.tgz#414136ea3807a8cd071b8f20370c5df5dbffd382"
|
||||||
integrity sha512-XVbn2HS+O+Mk2SKRCjr01/8oD5p2Tv1fxxdBqJ0+Cl+UBNiz0WVY5rusHpMGx+qF6Vc2pnRwPVwSKbGaDApCpw==
|
integrity sha512-XVbn2HS+O+Mk2SKRCjr01/8oD5p2Tv1fxxdBqJ0+Cl+UBNiz0WVY5rusHpMGx+qF6Vc2pnRwPVwSKbGaDApCpw==
|
||||||
|
|
||||||
|
"@types/color-convert@*":
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/color-convert/-/color-convert-2.0.0.tgz#8f5ee6b9e863dcbee5703f5a517ffb13d3ea4e22"
|
||||||
|
integrity sha512-m7GG7IKKGuJUXvkZ1qqG3ChccdIM/qBBo913z+Xft0nKCX4hAU/IxKwZBU4cpRZ7GS5kV4vOblUkILtSShCPXQ==
|
||||||
|
dependencies:
|
||||||
|
"@types/color-name" "*"
|
||||||
|
|
||||||
|
"@types/color-name@*":
|
||||||
|
version "1.1.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/color-name/-/color-name-1.1.1.tgz#1c1261bbeaa10a8055bbc5d8ab84b7b2afc846a0"
|
||||||
|
integrity sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==
|
||||||
|
|
||||||
|
"@types/color@3.0.2":
|
||||||
|
version "3.0.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/color/-/color-3.0.2.tgz#3779043e782f562aa9157b5fc6bd07e14fd8e7f3"
|
||||||
|
integrity sha512-INiJl6sfNn8iyC5paxVzqiVUEj2boIlFki02uRTAkKwAj++7aAF+ZfEv/XrIeBa0XI/fTZuDHW8rEEcEVnON+Q==
|
||||||
|
dependencies:
|
||||||
|
"@types/color-convert" "*"
|
||||||
|
|
||||||
"@types/connect@*":
|
"@types/connect@*":
|
||||||
version "3.4.34"
|
version "3.4.34"
|
||||||
resolved "https://registry.yarnpkg.com/@types/connect/-/connect-3.4.34.tgz#170a40223a6d666006d93ca128af2beb1d9b1901"
|
resolved "https://registry.yarnpkg.com/@types/connect/-/connect-3.4.34.tgz#170a40223a6d666006d93ca128af2beb1d9b1901"
|
||||||
@ -4804,11 +4823,27 @@ color-name@1.1.3:
|
|||||||
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25"
|
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25"
|
||||||
integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=
|
integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=
|
||||||
|
|
||||||
color-name@~1.1.4:
|
color-name@^1.0.0, color-name@~1.1.4:
|
||||||
version "1.1.4"
|
version "1.1.4"
|
||||||
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2"
|
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2"
|
||||||
integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==
|
integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==
|
||||||
|
|
||||||
|
color-string@^1.6.0:
|
||||||
|
version "1.6.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/color-string/-/color-string-1.6.0.tgz#c3915f61fe267672cb7e1e064c9d692219f6c312"
|
||||||
|
integrity sha512-c/hGS+kRWJutUBEngKKmk4iH3sD59MBkoxVapS/0wgpCz2u7XsNloxknyvBhzwEs1IbV36D9PwqLPJ2DTu3vMA==
|
||||||
|
dependencies:
|
||||||
|
color-name "^1.0.0"
|
||||||
|
simple-swizzle "^0.2.2"
|
||||||
|
|
||||||
|
color@4.0.1:
|
||||||
|
version "4.0.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/color/-/color-4.0.1.tgz#21df44cd10245a91b1ccf5ba031609b0e10e7d67"
|
||||||
|
integrity sha512-rpZjOKN5O7naJxkH2Rx1sZzzBgaiWECc6BYXjeCE6kF0kcASJYbUq02u7JqIHwCb/j3NhV+QhRL2683aICeGZA==
|
||||||
|
dependencies:
|
||||||
|
color-convert "^2.0.1"
|
||||||
|
color-string "^1.6.0"
|
||||||
|
|
||||||
colord@^2.0.1:
|
colord@^2.0.1:
|
||||||
version "2.0.1"
|
version "2.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/colord/-/colord-2.0.1.tgz#1e7fb1f9fa1cf74f42c58cb9c20320bab8435aa0"
|
resolved "https://registry.yarnpkg.com/colord/-/colord-2.0.1.tgz#1e7fb1f9fa1cf74f42c58cb9c20320bab8435aa0"
|
||||||
@ -7780,6 +7815,11 @@ is-arrayish@^0.2.1:
|
|||||||
resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d"
|
resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d"
|
||||||
integrity sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=
|
integrity sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=
|
||||||
|
|
||||||
|
is-arrayish@^0.3.1:
|
||||||
|
version "0.3.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.3.2.tgz#4574a2ae56f7ab206896fb431eaeed066fdf8f03"
|
||||||
|
integrity sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==
|
||||||
|
|
||||||
is-bigint@^1.0.1:
|
is-bigint@^1.0.1:
|
||||||
version "1.0.2"
|
version "1.0.2"
|
||||||
resolved "https://registry.yarnpkg.com/is-bigint/-/is-bigint-1.0.2.tgz#ffb381442503235ad245ea89e45b3dbff040ee5a"
|
resolved "https://registry.yarnpkg.com/is-bigint/-/is-bigint-1.0.2.tgz#ffb381442503235ad245ea89e45b3dbff040ee5a"
|
||||||
@ -12349,6 +12389,13 @@ signal-exit@^3.0.0, signal-exit@^3.0.2, signal-exit@^3.0.3:
|
|||||||
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.3.tgz#a1410c2edd8f077b08b4e253c8eacfcaf057461c"
|
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.3.tgz#a1410c2edd8f077b08b4e253c8eacfcaf057461c"
|
||||||
integrity sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==
|
integrity sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==
|
||||||
|
|
||||||
|
simple-swizzle@^0.2.2:
|
||||||
|
version "0.2.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/simple-swizzle/-/simple-swizzle-0.2.2.tgz#a4da6b635ffcccca33f70d17cb92592de95e557a"
|
||||||
|
integrity sha1-pNprY1/8zMoz9w0Xy5JZLeleVXo=
|
||||||
|
dependencies:
|
||||||
|
is-arrayish "^0.3.1"
|
||||||
|
|
||||||
sisteransi@^1.0.5:
|
sisteransi@^1.0.5:
|
||||||
version "1.0.5"
|
version "1.0.5"
|
||||||
resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.5.tgz#134d681297756437cc05ca01370d3a7a571075ed"
|
resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.5.tgz#134d681297756437cc05ca01370d3a7a571075ed"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user