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