Browse Source
Task/deprecate firstBuyDate in portfolio calculator (#6239)
* Deprecate firstBuyDate in favor of dateOfFirstActivity
* Update changelog
pull/6240/head
Thomas Kaul
2 days ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
17 changed files with
23 additions and
0 deletions
-
CHANGELOG.md
-
apps/api/src/app/portfolio/calculator/portfolio-calculator.ts
-
apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-baln-buy-and-buy.spec.ts
-
apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-baln-buy-and-sell-in-two-activities.spec.ts
-
apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-baln-buy-and-sell.spec.ts
-
apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-baln-buy.spec.ts
-
apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-btceur.spec.ts
-
apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-btcusd-buy-and-sell-partially.spec.ts
-
apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-btcusd.spec.ts
-
apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-cash.spec.ts
-
apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-googl-buy.spec.ts
-
apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-msft-buy-with-dividend.spec.ts
-
apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-novn-buy-and-sell-partially.spec.ts
-
apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-novn-buy-and-sell.spec.ts
-
apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-valuable.spec.ts
-
apps/api/src/app/portfolio/interfaces/transaction-point-symbol.interface.ts
-
libs/common/src/lib/models/timeline-position.ts
|
|
|
@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 |
|
|
|
|
|
|
|
### Changed |
|
|
|
|
|
|
|
- Deprecated `firstBuyDate` in favor of `dateOfFirstActivity` in the portfolio calculator |
|
|
|
- Deprecated `transactionCount` in favor of `activitiesCount` in the portfolio calculator and service |
|
|
|
- Removed the deprecated `firstBuyDate` from the endpoint `GET api/v1/portfolio/holding/:dataSource/:symbol` |
|
|
|
- Upgraded `prettier` from version `3.7.4` to `3.8.0` |
|
|
|
|
|
|
|
@ -411,6 +411,7 @@ export abstract class PortfolioCalculator { |
|
|
|
averagePrice: item.averagePrice, |
|
|
|
currency: item.currency, |
|
|
|
dataSource: item.dataSource, |
|
|
|
dateOfFirstActivity: item.dateOfFirstActivity, |
|
|
|
dividend: totalDividend, |
|
|
|
dividendInBaseCurrency: totalDividendInBaseCurrency, |
|
|
|
fee: item.fee, |
|
|
|
@ -998,6 +999,7 @@ export abstract class PortfolioCalculator { |
|
|
|
averagePrice: newQuantity.eq(0) |
|
|
|
? new Big(0) |
|
|
|
: investment.div(newQuantity).abs(), |
|
|
|
dateOfFirstActivity: oldAccumulatedSymbol.dateOfFirstActivity, |
|
|
|
dividend: new Big(0), |
|
|
|
fee: oldAccumulatedSymbol.fee.plus(fee), |
|
|
|
feeInBaseCurrency: |
|
|
|
@ -1020,6 +1022,7 @@ export abstract class PortfolioCalculator { |
|
|
|
tags, |
|
|
|
activitiesCount: 1, |
|
|
|
averagePrice: unitPrice, |
|
|
|
dateOfFirstActivity: date, |
|
|
|
dividend: new Big(0), |
|
|
|
firstBuyDate: date, |
|
|
|
includeInHoldings: INVESTMENT_ACTIVITY_TYPES.includes(type), |
|
|
|
|
|
|
|
@ -143,6 +143,7 @@ describe('PortfolioCalculator', () => { |
|
|
|
averagePrice: new Big('139.75'), |
|
|
|
currency: 'CHF', |
|
|
|
dataSource: 'YAHOO', |
|
|
|
dateOfFirstActivity: '2021-11-22', |
|
|
|
dividend: new Big('0'), |
|
|
|
dividendInBaseCurrency: new Big('0'), |
|
|
|
fee: new Big('3.2'), |
|
|
|
|
|
|
|
@ -159,6 +159,7 @@ describe('PortfolioCalculator', () => { |
|
|
|
averagePrice: new Big('0'), |
|
|
|
currency: 'CHF', |
|
|
|
dataSource: 'YAHOO', |
|
|
|
dateOfFirstActivity: '2021-11-22', |
|
|
|
dividend: new Big('0'), |
|
|
|
dividendInBaseCurrency: new Big('0'), |
|
|
|
fee: new Big('3.2'), |
|
|
|
|
|
|
|
@ -143,6 +143,7 @@ describe('PortfolioCalculator', () => { |
|
|
|
averagePrice: new Big('0'), |
|
|
|
currency: 'CHF', |
|
|
|
dataSource: 'YAHOO', |
|
|
|
dateOfFirstActivity: '2021-11-22', |
|
|
|
dividend: new Big('0'), |
|
|
|
dividendInBaseCurrency: new Big('0'), |
|
|
|
fee: new Big('3.2'), |
|
|
|
|
|
|
|
@ -133,6 +133,7 @@ describe('PortfolioCalculator', () => { |
|
|
|
averagePrice: new Big('136.6'), |
|
|
|
currency: 'CHF', |
|
|
|
dataSource: 'YAHOO', |
|
|
|
dateOfFirstActivity: '2021-11-30', |
|
|
|
dividend: new Big('0'), |
|
|
|
dividendInBaseCurrency: new Big('0'), |
|
|
|
fee: new Big('1.55'), |
|
|
|
|
|
|
|
@ -194,6 +194,7 @@ describe('PortfolioCalculator', () => { |
|
|
|
averagePrice: new Big('44558.42'), |
|
|
|
currency: 'USD', |
|
|
|
dataSource: 'YAHOO', |
|
|
|
dateOfFirstActivity: '2021-12-12', |
|
|
|
dividend: new Big('0'), |
|
|
|
dividendInBaseCurrency: new Big('0'), |
|
|
|
fee: new Big('4.46'), |
|
|
|
|
|
|
|
@ -157,6 +157,7 @@ describe('PortfolioCalculator', () => { |
|
|
|
averagePrice: new Big('320.43'), |
|
|
|
currency: 'USD', |
|
|
|
dataSource: 'YAHOO', |
|
|
|
dateOfFirstActivity: '2015-01-01', |
|
|
|
dividend: new Big('0'), |
|
|
|
dividendInBaseCurrency: new Big('0'), |
|
|
|
fee: new Big('0'), |
|
|
|
|
|
|
|
@ -194,6 +194,7 @@ describe('PortfolioCalculator', () => { |
|
|
|
averagePrice: new Big('44558.42'), |
|
|
|
currency: 'USD', |
|
|
|
dataSource: 'YAHOO', |
|
|
|
dateOfFirstActivity: '2021-12-12', |
|
|
|
dividend: new Big('0'), |
|
|
|
dividendInBaseCurrency: new Big('0'), |
|
|
|
fee: new Big('4.46'), |
|
|
|
|
|
|
|
@ -234,6 +234,7 @@ describe('PortfolioCalculator', () => { |
|
|
|
averagePrice: new Big(1), |
|
|
|
currency: 'USD', |
|
|
|
dataSource: DataSource.YAHOO, |
|
|
|
dateOfFirstActivity: '2023-12-31', |
|
|
|
dividend: new Big(0), |
|
|
|
dividendInBaseCurrency: new Big(0), |
|
|
|
fee: new Big(0), |
|
|
|
|
|
|
|
@ -139,6 +139,7 @@ describe('PortfolioCalculator', () => { |
|
|
|
averagePrice: new Big('89.12'), |
|
|
|
currency: 'USD', |
|
|
|
dataSource: 'YAHOO', |
|
|
|
dateOfFirstActivity: '2023-01-03', |
|
|
|
dividend: new Big('0'), |
|
|
|
dividendInBaseCurrency: new Big('0'), |
|
|
|
fee: new Big('1'), |
|
|
|
|
|
|
|
@ -135,6 +135,7 @@ describe('PortfolioCalculator', () => { |
|
|
|
averagePrice: new Big('298.58'), |
|
|
|
currency: 'USD', |
|
|
|
dataSource: 'YAHOO', |
|
|
|
dateOfFirstActivity: '2021-09-16', |
|
|
|
dividend: new Big('0.62'), |
|
|
|
dividendInBaseCurrency: new Big('0.62'), |
|
|
|
fee: new Big('19'), |
|
|
|
|
|
|
|
@ -139,6 +139,7 @@ describe('PortfolioCalculator', () => { |
|
|
|
averagePrice: new Big('75.80'), |
|
|
|
currency: 'CHF', |
|
|
|
dataSource: 'YAHOO', |
|
|
|
dateOfFirstActivity: '2022-03-07', |
|
|
|
dividend: new Big('0'), |
|
|
|
dividendInBaseCurrency: new Big('0'), |
|
|
|
fee: new Big('4.25'), |
|
|
|
|
|
|
|
@ -192,6 +192,7 @@ describe('PortfolioCalculator', () => { |
|
|
|
averagePrice: new Big('0'), |
|
|
|
currency: 'CHF', |
|
|
|
dataSource: 'YAHOO', |
|
|
|
dateOfFirstActivity: '2022-03-07', |
|
|
|
dividend: new Big('0'), |
|
|
|
dividendInBaseCurrency: new Big('0'), |
|
|
|
fee: new Big('0'), |
|
|
|
|
|
|
|
@ -120,6 +120,7 @@ describe('PortfolioCalculator', () => { |
|
|
|
averagePrice: new Big('500000'), |
|
|
|
currency: 'USD', |
|
|
|
dataSource: 'MANUAL', |
|
|
|
dateOfFirstActivity: '2022-01-01', |
|
|
|
dividend: new Big('0'), |
|
|
|
dividendInBaseCurrency: new Big('0'), |
|
|
|
fee: new Big('0'), |
|
|
|
|
|
|
|
@ -7,10 +7,14 @@ export interface TransactionPointSymbol { |
|
|
|
averagePrice: Big; |
|
|
|
currency: string; |
|
|
|
dataSource: DataSource; |
|
|
|
dateOfFirstActivity: string; |
|
|
|
dividend: Big; |
|
|
|
fee: Big; |
|
|
|
feeInBaseCurrency: Big; |
|
|
|
|
|
|
|
/** @deprecated use dateOfFirstActivity instead */ |
|
|
|
firstBuyDate: string; |
|
|
|
|
|
|
|
includeInHoldings: boolean; |
|
|
|
investment: Big; |
|
|
|
quantity: Big; |
|
|
|
|
|
|
|
@ -17,6 +17,7 @@ export class TimelinePosition { |
|
|
|
|
|
|
|
currency: string; |
|
|
|
dataSource: DataSource; |
|
|
|
dateOfFirstActivity: string; |
|
|
|
|
|
|
|
@Transform(transformToBig, { toClassOnly: true }) |
|
|
|
@Type(() => Big) |
|
|
|
@ -34,6 +35,7 @@ export class TimelinePosition { |
|
|
|
@Type(() => Big) |
|
|
|
feeInBaseCurrency: Big; |
|
|
|
|
|
|
|
/** @deprecated use dateOfFirstActivity instead */ |
|
|
|
firstBuyDate: string; |
|
|
|
|
|
|
|
@Transform(transformToBig, { toClassOnly: true }) |
|
|
|
|