Skip to content

Commit 0255437

Browse files
Tucskyadeacetis
authored andcommitted
fix alert ranges check
1 parent 169b932 commit 0255437

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

src/services/alert.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ class AlertService extends EventEmitter {
628628
for (let i = 0; i < this.alerts[market][rangePrice].length; i++) {
629629
const alert = this.alerts[market][rangePrice][i]
630630

631-
if (now - alert.timestamp < config.influxTimeframe) {
631+
if (now - alert.timestamp < config.backupInterval) {
632632
continue
633633
}
634634

src/services/connections.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ module.exports.updateIndexes = async function (ranges, callback) {
423423
if (
424424
!connections[market] ||
425425
!connections[market].apiId ||
426-
!connections[market].close
426+
(!connections[market].close && !ranges[market])
427427
) {
428428
continue
429429
}
@@ -434,16 +434,13 @@ module.exports.updateIndexes = async function (ranges, callback) {
434434
debugIndexes[index.id].push(
435435
`${market}:rg:${ranges[market].low}-${ranges[market].high}`
436436
)
437-
connections[market].low = ranges[market].low
438-
connections[market].high = ranges[market].high
437+
connections[market].close = ranges[market].close
439438
} else {
440439
high += connections[market].close
441440
low += connections[market].close
442441
debugIndexes[index.id].push(
443442
`${market}:co:${connections[market].close}-${connections[market].close}`
444443
)
445-
connections[market].low = connections[market].close
446-
connections[market].high = connections[market].close
447444
}
448445
close += connections[market].close
449446

src/storage/influx.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,11 +399,13 @@ class InfluxStorage {
399399
if (!ranges[market]) {
400400
ranges[market] = {
401401
low: trade.price,
402-
high: trade.price
402+
high: trade.price,
403+
close: trade.price
403404
}
404405
} else {
405406
ranges[market].low = Math.min(ranges[market].low, trade.price)
406407
ranges[market].high = Math.max(ranges[market].high, trade.price)
408+
ranges[market].close = trade.price
407409
}
408410
}
409411

0 commit comments

Comments
 (0)