Browse Source

Fix position chart for missing historical data

pull/284/head
Thomas 4 years ago
parent
commit
7f09a8fd82
  1. 1
      CHANGELOG.md
  2. 13
      apps/api/src/app/portfolio/portfolio.service.ts

1
CHANGELOG.md

@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed ### Fixed
- Fixed hidden cryptocurrency holdings - Fixed hidden cryptocurrency holdings
- Fixed the position detail chart if there are missing historical data around the first buy date
## 1.35.0 - 08.08.2021 ## 1.35.0 - 08.08.2021

13
apps/api/src/app/portfolio/portfolio.service.ts

@ -362,8 +362,17 @@ export class PortfolioService {
); );
const historicalDataArray: HistoricalDataItem[] = []; const historicalDataArray: HistoricalDataItem[] = [];
let maxPrice = marketPrice; let maxPrice = orders[0].unitPrice;
let minPrice = marketPrice; let minPrice = orders[0].unitPrice;
if (!historicalData[aSymbol][firstBuyDate]) {
// Add historical entry for buy date, if no historical data available
historicalDataArray.push({
averagePrice: orders[0].unitPrice,
date: firstBuyDate,
value: orders[0].unitPrice
});
}
if (historicalData[aSymbol]) { if (historicalData[aSymbol]) {
let j = -1; let j = -1;

Loading…
Cancel
Save