Browse Source

Clean up code

pull/428/head
Thomas 4 years ago
parent
commit
cfd3cd60a2
  1. 8
      apps/api/src/app/portfolio/portfolio-calculator.ts
  2. 4
      apps/api/src/app/portfolio/portfolio.controller.ts
  3. 2
      apps/client/src/app/components/portfolio-performance/portfolio-performance.component.html
  4. 4
      apps/client/src/app/pages/home/home-page.component.ts

8
apps/api/src/app/portfolio/portfolio-calculator.ts

@ -1,3 +1,4 @@
import { TimelineInfoInterface } from '@ghostfolio/api/app/portfolio/interfaces/timeline-info.interface';
import { OrderType } from '@ghostfolio/api/models/order-type';
import { IDataGatheringItem } from '@ghostfolio/api/services/interfaces/interfaces';
import { DATE_FORMAT, parseDate, resetHours } from '@ghostfolio/common/helper';
@ -29,7 +30,6 @@ import {
} from './interfaces/timeline-specification.interface';
import { TransactionPointSymbol } from './interfaces/transaction-point-symbol.interface';
import { TransactionPoint } from './interfaces/transaction-point.interface';
import { TimelineInfoInterface } from '@ghostfolio/api/app/portfolio/interfaces/timeline-info.interface';
export class PortfolioCalculator {
private transactionPoints: TransactionPoint[];
@ -369,9 +369,9 @@ export class PortfolioCalculator {
): Promise<TimelineInfoInterface> {
if (timelineSpecification.length === 0) {
return {
timelinePeriods: [],
maxNetPerformance: new Big(0),
minNetPerformance: new Big(0)
minNetPerformance: new Big(0),
timelinePeriods: []
};
}
@ -642,8 +642,8 @@ export class PortfolioCalculator {
const result = {
grossPerformance,
netPerformance,
investment,
netPerformance,
value,
date: currentDateAsString
};

4
apps/api/src/app/portfolio/portfolio.controller.ts

@ -131,9 +131,9 @@ export class PortfolioController {
}
return <any>res.json({
chart: chartData,
isAllTimeHigh: historicalDataContainer.isAllTimeHigh,
isAllTimeLow: historicalDataContainer.isAllTimeLow,
chart: chartData
isAllTimeLow: historicalDataContainer.isAllTimeLow
});
}

2
apps/client/src/app/components/portfolio-performance/portfolio-performance.component.html

@ -1,6 +1,6 @@
<div class="container p-0">
<div
class="row no-gutters"
class="no-gutters row"
[ngClass]="{
'text-danger': isAllTimeLow,
'text-success': isAllTimeHigh

4
apps/client/src/app/pages/home/home-page.component.ts

@ -55,12 +55,12 @@ export class HomePageComponent implements OnDestroy, OnInit {
];
public deviceType: string;
public fearAndGreedIndex: number;
public isAllTimeHigh: boolean;
public isAllTimeLow: boolean;
public hasImpersonationId: boolean;
public hasPermissionToAccessFearAndGreedIndex: boolean;
public hasPermissionToCreateOrder: boolean;
public historicalDataItems: LineChartItem[];
public isAllTimeHigh: boolean;
public isAllTimeLow: boolean;
public isLoadingPerformance = true;
public isLoadingSummary = true;
public performance: PortfolioPerformance;

Loading…
Cancel
Save