-
Notifications
You must be signed in to change notification settings - Fork 14
/
index.js
42 lines (33 loc) · 1.13 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
const program = require('commander');
const gekkoConfig = require('../config');
const backtestManager = require('./managers/backtestmanager');
const server = require('./frontend/server');
const tradingManager = require('./managers/tradingmanager');
const {logError} = require('./components/logger');
program
.version('0.1.0')
.option('-u, --ui', 'Launch the frontend UI (coming soon)')
.option('-r, --run', 'Run the GA tests and then start trading')
.option('-b, --backtest', 'Backtest the whole bot on auto pilot')
.option('-day, --days <n>', 'Number of days to run the backtest on', parseInt)
.parse(process.argv);
// Check node version
if (parseFloat(process.versions.node) < 8.9) {
return logError('Please update your node version.');
}
if (!gekkoConfig) {
return logError('You need to finish setting up Gekko correctly. You haven\'t even added the config.js file.');
}
if (program.ui) {
server();
}
if (program.run) {
tradingManager();
keepRunning();
} else if (program.backtest) {
const days = program.days || 3;
backtestManager(days);
}
function keepRunning() {
setInterval(() => {}, 3600000);
};