Browse Source
Feature/add createdAt to snapshot and public portfolio endpoint response (#4350)
* Add createdAt to snapshot and public portfolio endpoint response
* Update changelog
---------
Co-authored-by: Verbindolai <nikolaiwieczorek@web.de>
Co-authored-by: Thomas Kaul <4159106+dtslvr@users.noreply.github.com>
pull/4373/head
csehatt741
3 weeks ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with
14 additions and
2 deletions
-
CHANGELOG.md
-
apps/api/src/app/endpoints/public/public.controller.ts
-
apps/api/src/app/portfolio/calculator/portfolio-calculator.ts
-
apps/api/src/app/portfolio/calculator/twr/portfolio-calculator.ts
-
apps/api/src/app/portfolio/portfolio.controller.ts
-
apps/api/src/app/portfolio/portfolio.service.ts
-
apps/client/src/app/pages/portfolio/allocations/allocations-page.component.ts
-
libs/common/src/lib/interfaces/portfolio-details.interface.ts
-
libs/common/src/lib/interfaces/responses/public-portfolio-response.interface.ts
-
libs/common/src/lib/models/portfolio-snapshot.ts
|
|
@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 |
|
|
|
### Added |
|
|
|
|
|
|
|
- Extended the export functionality by the platforms |
|
|
|
- Extended the portfolio snapshot in the portfolio calculator by the `createdAt` timestamp |
|
|
|
- Extended the _Trackinsight_ data enhancer for asset profile data by `cusip` |
|
|
|
- Added _Storybook_ to the build process |
|
|
|
|
|
|
|
|
|
@ -57,7 +57,7 @@ export class PublicController { |
|
|
|
} |
|
|
|
|
|
|
|
const [ |
|
|
|
{ holdings, markets }, |
|
|
|
{ createdAt, holdings, markets }, |
|
|
|
{ performance: performance1d }, |
|
|
|
{ performance: performanceMax }, |
|
|
|
{ performance: performanceYtd } |
|
|
@ -81,6 +81,7 @@ export class PublicController { |
|
|
|
}); |
|
|
|
|
|
|
|
const publicPortfolioResponse: PublicPortfolioResponse = { |
|
|
|
createdAt, |
|
|
|
hasDetails, |
|
|
|
markets, |
|
|
|
alias: access.alias, |
|
|
|
|
|
@ -176,6 +176,7 @@ export abstract class PortfolioCalculator { |
|
|
|
if (!transactionPoints.length) { |
|
|
|
return { |
|
|
|
activitiesCount: 0, |
|
|
|
createdAt: new Date(), |
|
|
|
currentValueInBaseCurrency: new Big(0), |
|
|
|
errors: [], |
|
|
|
hasErrors: false, |
|
|
|
|
|
@ -104,6 +104,7 @@ export class TWRPortfolioCalculator extends PortfolioCalculator { |
|
|
|
activitiesCount: this.activities.filter(({ type }) => { |
|
|
|
return ['BUY', 'SELL'].includes(type); |
|
|
|
}).length, |
|
|
|
createdAt: new Date(), |
|
|
|
errors: [], |
|
|
|
historicalData: [], |
|
|
|
totalLiabilitiesWithCurrencyEffect: new Big(0), |
|
|
|
|
|
@ -105,6 +105,7 @@ export class PortfolioController { |
|
|
|
|
|
|
|
const { |
|
|
|
accounts, |
|
|
|
createdAt, |
|
|
|
hasErrors, |
|
|
|
holdings, |
|
|
|
markets, |
|
|
@ -233,6 +234,7 @@ export class PortfolioController { |
|
|
|
|
|
|
|
return { |
|
|
|
accounts, |
|
|
|
createdAt, |
|
|
|
hasError, |
|
|
|
holdings, |
|
|
|
platforms, |
|
|
|
|
|
@ -376,7 +376,7 @@ export class PortfolioService { |
|
|
|
currency: userCurrency |
|
|
|
}); |
|
|
|
|
|
|
|
const { currentValueInBaseCurrency, hasErrors, positions } = |
|
|
|
const { createdAt, currentValueInBaseCurrency, hasErrors, positions } = |
|
|
|
await portfolioCalculator.getSnapshot(); |
|
|
|
|
|
|
|
const cashDetails = await this.accountService.getCashDetails({ |
|
|
@ -617,6 +617,7 @@ export class PortfolioService { |
|
|
|
|
|
|
|
return { |
|
|
|
accounts, |
|
|
|
createdAt, |
|
|
|
hasErrors, |
|
|
|
holdings, |
|
|
|
markets, |
|
|
|
|
|
@ -260,6 +260,7 @@ export class AllocationsPageComponent implements OnDestroy, OnInit { |
|
|
|
this.platforms = {}; |
|
|
|
this.portfolioDetails = { |
|
|
|
accounts: {}, |
|
|
|
createdAt: undefined, |
|
|
|
holdings: {}, |
|
|
|
platforms: {}, |
|
|
|
summary: undefined |
|
|
|
|
|
@ -14,6 +14,7 @@ export interface PortfolioDetails { |
|
|
|
valueInPercentage?: number; |
|
|
|
}; |
|
|
|
}; |
|
|
|
createdAt: Date; |
|
|
|
holdings: { [symbol: string]: PortfolioPosition }; |
|
|
|
markets?: { |
|
|
|
[key in Market]: { |
|
|
|
|
|
@ -32,6 +32,7 @@ export interface PublicPortfolioResponse extends PublicPortfolioResponseV1 { |
|
|
|
} |
|
|
|
|
|
|
|
interface PublicPortfolioResponseV1 { |
|
|
|
createdAt: Date; |
|
|
|
performance: { |
|
|
|
'1d': { |
|
|
|
relativeChange: number; |
|
|
|
|
|
@ -11,6 +11,8 @@ import { Transform, Type } from 'class-transformer'; |
|
|
|
export class PortfolioSnapshot { |
|
|
|
activitiesCount: number; |
|
|
|
|
|
|
|
createdAt: Date; |
|
|
|
|
|
|
|
@Transform(transformToBig, { toClassOnly: true }) |
|
|
|
@Type(() => Big) |
|
|
|
currentValueInBaseCurrency: Big; |
|
|
|