|
|
|
@ -41,7 +41,7 @@ import { AccountWithValue, DateRange, GroupBy } from '@ghostfolio/common/types';
|
|
|
|
|
import { translate } from '@ghostfolio/ui/i18n';
|
|
|
|
|
import { DataSource, Order as OrderModel } from '@prisma/client';
|
|
|
|
|
import { format, parseISO } from 'date-fns';
|
|
|
|
|
import { cloneDeep, groupBy } from 'lodash';
|
|
|
|
|
import { cloneDeep, groupBy, isNumber } from 'lodash';
|
|
|
|
|
import { Observable } from 'rxjs';
|
|
|
|
|
import { map } from 'rxjs/operators';
|
|
|
|
|
|
|
|
|
@ -299,6 +299,12 @@ export class DataService {
|
|
|
|
|
].dateOfFirstActivity
|
|
|
|
|
? parseISO(response.holdings[symbol].dateOfFirstActivity)
|
|
|
|
|
: undefined;
|
|
|
|
|
|
|
|
|
|
response.holdings[symbol].value = isNumber(
|
|
|
|
|
response.holdings[symbol].value
|
|
|
|
|
)
|
|
|
|
|
? response.holdings[symbol].value
|
|
|
|
|
: response.holdings[symbol].valueInPercentage;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -333,9 +339,23 @@ export class DataService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public fetchPortfolioPublic(aId: string) {
|
|
|
|
|
return this.http.get<PortfolioPublicDetails>(
|
|
|
|
|
`/api/v1/portfolio/public/${aId}`
|
|
|
|
|
);
|
|
|
|
|
return this.http
|
|
|
|
|
.get<PortfolioPublicDetails>(`/api/v1/portfolio/public/${aId}`)
|
|
|
|
|
.pipe(
|
|
|
|
|
map((response) => {
|
|
|
|
|
if (response.holdings) {
|
|
|
|
|
for (const symbol of Object.keys(response.holdings)) {
|
|
|
|
|
response.holdings[symbol].value = isNumber(
|
|
|
|
|
response.holdings[symbol].value
|
|
|
|
|
)
|
|
|
|
|
? response.holdings[symbol].value
|
|
|
|
|
: response.holdings[symbol].valueInPercentage;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return response;
|
|
|
|
|
})
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public fetchPortfolioReport() {
|
|
|
|
|