[#20] Bugfix
This commit is contained in:
parent
69a548a200
commit
e002eeec44
@ -111,7 +111,7 @@ export default class AggregatedDataPoint {
|
||||
}
|
||||
this.hasValues = true;
|
||||
this.minPrice = Math.min(this.minPrice, bid.price);
|
||||
this.maxPrice = Math.max(this.maxPrice = bid.price);
|
||||
this.maxPrice = Math.max(this.maxPrice, bid.price);
|
||||
this.endPrice = bid.price;
|
||||
this.#priceValues.push(parseFloat(bid.price));
|
||||
if(this.bestBid == null || this.bestBid.price < bid.price){
|
||||
@ -143,9 +143,12 @@ export default class AggregatedDataPoint {
|
||||
*/
|
||||
end(endTime){
|
||||
this.endTime = endTime;
|
||||
let priceSum = 0;
|
||||
this.#priceValues.forEach(p => priceSum += p);
|
||||
this.avgPrice = priceSum / this.#priceValues.length;
|
||||
if(this.#priceValues.length > 0){
|
||||
let priceSum = 0;
|
||||
this.#priceValues.forEach(p => priceSum += p);
|
||||
this.avgPrice = priceSum / this.#priceValues.length;
|
||||
}
|
||||
console.log(this.minPrice, this.maxPrice, this.avgPrice, this.minPrice <= this.avgPrice, this.avgPrice <= this.maxPrice);
|
||||
this.#priceValues = [];
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user