Browse Source
fix position diagram for sold items (#261 )
* fix position diagram for sold items
* Add missing data to position from the past
* Update changelog
Co-authored-by: Valentin Zickner <github@zickner.ch>
Co-authored-by: Thomas <4159106+dtslvr@users.noreply.github.com>
pull/263/head
Valentin Zickner
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
15 additions and
8 deletions
CHANGELOG.md
apps/api/src/app/portfolio/portfolio.service.ts
apps/client/src/app/components/position/position-detail-dialog/position-detail-dialog.html
@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- Fixed an issue with the currency conversion of the market price in the position detail dialog
- Fixed the chart and missing data of positions from the past in the position detail dialog
## 1.33.0 - 05.08.2021
@ -391,6 +391,7 @@ export class PortfolioService {
} ;
} else {
const currentData = await this . dataProviderService . get ( [ aSymbol ] ) ;
const marketPrice = currentData [ aSymbol ] ? . marketPrice ;
let historicalData = await this . dataProviderService . getHistorical (
[ aSymbol ] ,
@ -408,28 +409,33 @@ export class PortfolioService {
}
const historicalDataArray : HistoricalDataItem [ ] = [ ] ;
let maxPrice = marketPrice ;
let minPrice = marketPrice ;
for ( const [ date , { marketPrice } ] of Object . entries (
historicalData [ aSymbol ]
) . reverse ( ) ) {
) ) {
historicalDataArray . push ( {
date ,
value : marketPrice
} ) ;
maxPrice = Math . max ( marketPrice ? ? 0 , maxPrice ) ;
minPrice = Math . min ( marketPrice ? ? Number . MAX_SAFE_INTEGER , minPrice ) ;
}
return {
averagePrice : undefined ,
marketPrice ,
maxPrice ,
minPrice ,
averagePrice : 0 ,
currency : currentData [ aSymbol ] ? . currency ,
firstBuyDate : undefined ,
grossPerformance : undefined ,
grossPerformancePercent : undefined ,
historicalData : historicalDataArray ,
investment : undefined ,
marketPrice : currentData [ aSymbol ] ? . marketPrice ,
maxPrice : undefined ,
minPrice : undefined ,
quantity : undefined ,
investment : 0 ,
quantity : 0 ,
symbol : aSymbol ,
transactionCount : undefined
} ;
@ -1,7 +1,7 @@
< gf-dialog-header
mat-dialog-title
[deviceType]="data.deviceType"
[title]="data.title"
[title]="data.title ?? data.symbol "
(closeButtonClicked)="onClose()"
>< / gf-dialog-header >