Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var max_time = bot.end || tb(min_time).resize('7d').add(12).toMilliseconds()
get('console').info(('[sim] start = ' + get_timestamp(min_time) + ', end = ' + get_timestamp(max_time)).cyan)
var brain = get('bot.brain')
var start = brain.run_state.currency
var first_tick, last_tick
if (bot.throttle) {
var monitor = require('os-monitor')
var pausing = false
var pause_msg = ''
monitor.start({
critical1: bot.throttle,
immediate: true,
delay: 5000
})
monitor.on('monitor', function (event) {
if (pausing && event.loadavg && event.loadavg[0] < bot.throttle) {
get('console').info(('[resuming] load = ' + n(event.loadavg[0]).format('0.000')).yellow)
pausing = false
}
else if (event.loadavg && event.loadavg[0] >= bot.throttle) {
pause_msg = ('[paused] load = ' + n(event.loadavg[0]).format('0.000')).yellow
pausing = true
}
})
}
function getNext () {
if (bot.throttle && pausing) return setTimeout(getNext, 5000)
var params = {
query: {
time: {
module.exports = function container (get, set, clear) {
var bot = get('bot')
var get_timestamp = get('utils.get_timestamp')
var min_time = bot.start || tb('7d').subtract(12).toMilliseconds()
var max_time = bot.end || tb(min_time).resize('7d').add(12).toMilliseconds()
get('console').info(('[sim] start = ' + get_timestamp(min_time) + ', end = ' + get_timestamp(max_time)).cyan)
var brain = get('bot.brain')
var start = brain.run_state.currency
var first_tick, last_tick
if (bot.throttle) {
var monitor = require('os-monitor')
var pausing = false
var pause_msg = ''
monitor.start({
critical1: bot.throttle,
immediate: true,
delay: 5000
})
monitor.on('monitor', function (event) {
if (pausing && event.loadavg && event.loadavg[0] < bot.throttle) {
get('console').info(('[resuming] load = ' + n(event.loadavg[0]).format('0.000')).yellow)
pausing = false
}
else if (event.loadavg && event.loadavg[0] >= bot.throttle) {
pause_msg = ('[paused] load = ' + n(event.loadavg[0]).format('0.000')).yellow
pausing = true
}
})
}