Fix position chart for missing historical data (#284)
* Fix position chart for missing historical data * Update changelog
This commit is contained in:
@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
|
|||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## Unreleased
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Fixed the position detail chart if there are missing historical data around the first buy date
|
||||||
|
|
||||||
## 1.36.0 - 09.08.2021
|
## 1.36.0 - 09.08.2021
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
@ -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;
|
||||||
|
Reference in New Issue
Block a user