mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-23 03:25:15 +00:00
Fix bins odd beavior if only one trade is present
This commit is contained in:
parent
91c352f090
commit
97dd99f4a1
|
@ -8,11 +8,13 @@ export function binData(data: number[], bins: number) {
|
|||
Math.round((minimum + i * binSize) * 1000) / 1000,
|
||||
0,
|
||||
]);
|
||||
|
||||
// console.log(baseBins);
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
const index = Math.min(Math.floor((data[i] - minimum) / binSize), bins - 1);
|
||||
// console.log(data[i], index)
|
||||
baseBins[index][1]++;
|
||||
if (!isNaN(index)) {
|
||||
baseBins[index][1]++;
|
||||
}
|
||||
}
|
||||
|
||||
return baseBins;
|
||||
|
|
Loading…
Reference in New Issue
Block a user