Example #1
0
looper.prototype.start = function() {
	this.intro();
	
	var scope			= this;
	this.dataset		= [];
	this.backtest		= this.args().backtest;
	this.genomeFile		= 'genomes-'+this.backtest+'.json';
	this.recordFile		= 'record-'+this.backtest+'.json';
	
	fstool.file.readJson(scope.recordFile, function(record) {
		if (record) {
			scope.dataset	= record;
		}
		scope.run();
	});
}
Example #2
0
	fstool.file.readJson(scope.genomeFile, function(genomes) {
		var genome = genomes.genomes[0];
		scope.dataset.push({
			d:			new Date(),
			generation:	genome.generation,
			gainPct:	parseFloat(genome.stats.gainPct),
			pctWin:		parseFloat(genome.stats.pctWin),
			winRatio:	parseFloat(genome.stats.winRatio),
			positions:	parseFloat(genome.stats.positions),
			avgWin:		parseFloat(genome.stats.avgWin),
			avgLoss:	parseFloat(genome.stats.avgLoss)
		});
		
		fstool.file.writeJson(scope.recordFile, scope.dataset, function(genomes) {
			callback(genome);
		}, true);
	});
Example #3
0
hedgejs.prototype.debug = function(name, data) {
	console.log("Output",path.normalize(__dirname+'/data/debug.'+name+'.json'));
	fstool.file.writeJson(path.normalize(__dirname+'/data/debug.'+name+'.json'), data, function() {});
}
Example #4
0
var debug = function(input) {
	console.log(JSON.stringify(input, null, 4));
	fstool.file.writeJson("output.json", input, function() {});
}