mirror of https://github.com/ghostfolio/ghostfolio
Browse Source
Rename types of portfolio calculator to HoldingPerformance, PortfolioCalculatorHolding and PortfolioSnapshotHoldingpull/7914/head
committed by
GitHub
14 changed files with 93 additions and 135 deletions
@ -1,29 +1,28 @@ |
|||||
import { PortfolioCalculator } from '@ghostfolio/api/app/portfolio/calculator/portfolio-calculator'; |
import { PortfolioCalculator } from '@ghostfolio/api/app/portfolio/calculator/portfolio-calculator'; |
||||
import { |
import { HoldingPerformance } from '@ghostfolio/api/app/portfolio/interfaces/holding-performance.interface'; |
||||
AssetProfileIdentifier, |
import { PortfolioCalculatorHolding } from '@ghostfolio/api/app/portfolio/interfaces/portfolio-calculator-holding.interface'; |
||||
SymbolMetrics |
import { AssetProfileIdentifier } from '@ghostfolio/common/interfaces'; |
||||
} from '@ghostfolio/common/interfaces'; |
|
||||
import { PortfolioSnapshot } from '@ghostfolio/common/models'; |
import { PortfolioSnapshot } from '@ghostfolio/common/models'; |
||||
import { PerformanceCalculationType } from '@ghostfolio/common/types/performance-calculation-type.type'; |
import { PerformanceCalculationType } from '@ghostfolio/common/types/performance-calculation-type.type'; |
||||
|
|
||||
export class MwrPortfolioCalculator extends PortfolioCalculator { |
export class MwrPortfolioCalculator extends PortfolioCalculator { |
||||
protected calculateOverallPerformance(): PortfolioSnapshot { |
protected calculateOverallPerformance([]: PortfolioCalculatorHolding[]): PortfolioSnapshot { |
||||
throw new Error('Method not implemented.'); |
throw new Error('Method not implemented.'); |
||||
} |
} |
||||
|
|
||||
protected getPerformanceCalculationType() { |
protected getHoldingPerformance({}: { |
||||
return PerformanceCalculationType.MWR; |
chartDateMap: { [date: string]: boolean }; |
||||
} |
|
||||
|
|
||||
protected getSymbolMetrics({}: { |
|
||||
end: Date; |
end: Date; |
||||
exchangeRates: { [dateString: string]: number }; |
exchangeRates: { [dateString: string]: number }; |
||||
marketSymbolMap: { |
marketSymbolMap: { |
||||
[date: string]: { [assetProfileIdentifier: string]: Big }; |
[date: string]: { [assetProfileIdentifier: string]: Big }; |
||||
}; |
}; |
||||
start: Date; |
start: Date; |
||||
step?: number; |
} & AssetProfileIdentifier): HoldingPerformance { |
||||
} & AssetProfileIdentifier): SymbolMetrics { |
|
||||
throw new Error('Method not implemented.'); |
throw new Error('Method not implemented.'); |
||||
} |
} |
||||
|
|
||||
|
protected getPerformanceCalculationType() { |
||||
|
return PerformanceCalculationType.MWR; |
||||
|
} |
||||
} |
} |
||||
|
|||||
@ -1,29 +1,28 @@ |
|||||
import { PortfolioCalculator } from '@ghostfolio/api/app/portfolio/calculator/portfolio-calculator'; |
import { PortfolioCalculator } from '@ghostfolio/api/app/portfolio/calculator/portfolio-calculator'; |
||||
import { |
import { HoldingPerformance } from '@ghostfolio/api/app/portfolio/interfaces/holding-performance.interface'; |
||||
AssetProfileIdentifier, |
import { PortfolioCalculatorHolding } from '@ghostfolio/api/app/portfolio/interfaces/portfolio-calculator-holding.interface'; |
||||
SymbolMetrics |
import { AssetProfileIdentifier } from '@ghostfolio/common/interfaces'; |
||||
} from '@ghostfolio/common/interfaces'; |
|
||||
import { PortfolioSnapshot } from '@ghostfolio/common/models'; |
import { PortfolioSnapshot } from '@ghostfolio/common/models'; |
||||
import { PerformanceCalculationType } from '@ghostfolio/common/types/performance-calculation-type.type'; |
import { PerformanceCalculationType } from '@ghostfolio/common/types/performance-calculation-type.type'; |
||||
|
|
||||
export class RoiPortfolioCalculator extends PortfolioCalculator { |
export class RoiPortfolioCalculator extends PortfolioCalculator { |
||||
protected calculateOverallPerformance(): PortfolioSnapshot { |
protected calculateOverallPerformance([]: PortfolioCalculatorHolding[]): PortfolioSnapshot { |
||||
throw new Error('Method not implemented.'); |
throw new Error('Method not implemented.'); |
||||
} |
} |
||||
|
|
||||
protected getPerformanceCalculationType() { |
protected getHoldingPerformance({}: { |
||||
return PerformanceCalculationType.ROI; |
chartDateMap: { [date: string]: boolean }; |
||||
} |
|
||||
|
|
||||
protected getSymbolMetrics({}: { |
|
||||
end: Date; |
end: Date; |
||||
exchangeRates: { [dateString: string]: number }; |
exchangeRates: { [dateString: string]: number }; |
||||
marketSymbolMap: { |
marketSymbolMap: { |
||||
[date: string]: { [assetProfileIdentifier: string]: Big }; |
[date: string]: { [assetProfileIdentifier: string]: Big }; |
||||
}; |
}; |
||||
start: Date; |
start: Date; |
||||
step?: number; |
} & AssetProfileIdentifier): HoldingPerformance { |
||||
} & AssetProfileIdentifier): SymbolMetrics { |
|
||||
throw new Error('Method not implemented.'); |
throw new Error('Method not implemented.'); |
||||
} |
} |
||||
|
|
||||
|
protected getPerformanceCalculationType() { |
||||
|
return PerformanceCalculationType.ROI; |
||||
|
} |
||||
} |
} |
||||
|
|||||
@ -1,29 +1,28 @@ |
|||||
import { PortfolioCalculator } from '@ghostfolio/api/app/portfolio/calculator/portfolio-calculator'; |
import { PortfolioCalculator } from '@ghostfolio/api/app/portfolio/calculator/portfolio-calculator'; |
||||
import { |
import { HoldingPerformance } from '@ghostfolio/api/app/portfolio/interfaces/holding-performance.interface'; |
||||
AssetProfileIdentifier, |
import { PortfolioCalculatorHolding } from '@ghostfolio/api/app/portfolio/interfaces/portfolio-calculator-holding.interface'; |
||||
SymbolMetrics |
import { AssetProfileIdentifier } from '@ghostfolio/common/interfaces'; |
||||
} from '@ghostfolio/common/interfaces'; |
|
||||
import { PortfolioSnapshot } from '@ghostfolio/common/models'; |
import { PortfolioSnapshot } from '@ghostfolio/common/models'; |
||||
import { PerformanceCalculationType } from '@ghostfolio/common/types/performance-calculation-type.type'; |
import { PerformanceCalculationType } from '@ghostfolio/common/types/performance-calculation-type.type'; |
||||
|
|
||||
export class TwrPortfolioCalculator extends PortfolioCalculator { |
export class TwrPortfolioCalculator extends PortfolioCalculator { |
||||
protected calculateOverallPerformance(): PortfolioSnapshot { |
protected calculateOverallPerformance([]: PortfolioCalculatorHolding[]): PortfolioSnapshot { |
||||
throw new Error('Method not implemented.'); |
throw new Error('Method not implemented.'); |
||||
} |
} |
||||
|
|
||||
protected getPerformanceCalculationType() { |
protected getHoldingPerformance({}: { |
||||
return PerformanceCalculationType.TWR; |
chartDateMap: { [date: string]: boolean }; |
||||
} |
|
||||
|
|
||||
protected getSymbolMetrics({}: { |
|
||||
end: Date; |
end: Date; |
||||
exchangeRates: { [dateString: string]: number }; |
exchangeRates: { [dateString: string]: number }; |
||||
marketSymbolMap: { |
marketSymbolMap: { |
||||
[date: string]: { [assetProfileIdentifier: string]: Big }; |
[date: string]: { [assetProfileIdentifier: string]: Big }; |
||||
}; |
}; |
||||
start: Date; |
start: Date; |
||||
step?: number; |
} & AssetProfileIdentifier): HoldingPerformance { |
||||
} & AssetProfileIdentifier): SymbolMetrics { |
|
||||
throw new Error('Method not implemented.'); |
throw new Error('Method not implemented.'); |
||||
} |
} |
||||
|
|
||||
|
protected getPerformanceCalculationType() { |
||||
|
return PerformanceCalculationType.TWR; |
||||
|
} |
||||
} |
} |
||||
|
|||||
@ -0,0 +1,6 @@ |
|||||
|
import { PortfolioSnapshotHolding } from '@ghostfolio/common/models'; |
||||
|
|
||||
|
export interface PortfolioCalculatorHolding extends PortfolioSnapshotHolding { |
||||
|
includeInHoldings: boolean; |
||||
|
includeInPerformance: boolean; |
||||
|
} |
||||
@ -1,6 +0,0 @@ |
|||||
import { TimelinePosition } from '@ghostfolio/common/models'; |
|
||||
|
|
||||
export interface PortfolioCalculatorPosition extends TimelinePosition { |
|
||||
includeInHoldings: boolean; |
|
||||
includeInPerformance: boolean; |
|
||||
} |
|
||||
@ -1,4 +1,4 @@ |
|||||
import { PortfolioSnapshot } from './portfolio-snapshot'; |
import { PortfolioSnapshot } from './portfolio-snapshot'; |
||||
import { TimelinePosition } from './timeline-position'; |
import { PortfolioSnapshotHolding } from './portfolio-snapshot-holding'; |
||||
|
|
||||
export { PortfolioSnapshot, TimelinePosition }; |
export { PortfolioSnapshot, PortfolioSnapshotHolding }; |
||||
|
|||||
Loading…
Reference in new issue