-
Notifications
You must be signed in to change notification settings - Fork 215
/
backfind.ts
39 lines (34 loc) · 1.63 KB
/
backfind.ts
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
// node --use_strict --max-old-space-size=3096 backfind.js
// parameters: --debug (debug, otherwise use config value)
// --config: the name of the backfind config file under /config/backfind/ to run find the optimal parameters
// Genetic Algorithm (Evolution) config
// --config: // TODO
// --evolution: run the genetic algorithm to find optimal strategy parameters
require('source-map-support').install();
import * as utils from "@ekliptor/apputils";
const nconf = utils.nconf
const logger = require('./src/utils/Logger')
const argv = require('minimist')(process.argv.slice(2))
if (argv.debug === true)
nconf.set('debug', true)
import {controller as Controller} from './src/Controller';
import * as http from "http";
import {AbstractBackfinder} from "./src/Backfinder/AbstractBackfinder";
// add a server because Controller requires it
let dummyServer = http.createServer( (request, response) => {});
dummyServer.setTimeout(nconf.get("httpTimeoutSec") * 1000, null);
dummyServer.listen(nconf.get('port'), () => {})
Controller.start(dummyServer, false).then(() => {
setTimeout(() => { // ensure we are connected
Controller.loadServerConfig(() => {
let options: any = {}
//if (argv.walk)
//options.walk = true;
let finder = AbstractBackfinder.getInstance(argv.config, argv.evolution == true ? "Evolution" : "CartesianProduct", options);
finder.run();
})
}, 500)
})
// TODO after we have optimized our strategy paremters with the method above:
// feed as many indicators as possible into a neural network as input. train for the output
// if the NEXT candle went up or down