UNPKG

456 BJavaScriptView Raw
1const Yahoo = require('../data/Yahoo');
2
3/**
4 * Incomplete
5 */
6class Backtest {
7
8 constructor(symbol, algorithm) {
9 this.symbol = symbol;
10 this.algorithm = algorithm;
11 }
12
13 /**
14 * Runs a backtest on the given algorithm.
15 * @param minute
16 * @returns {Promise<Object>}
17 */
18 run(minute) {
19 return Yahoo.getQuotes(this.symbol, "1y", minute ? "1min" : "1d", false).then(quoteArray => {
20
21 let profit = 0;
22 let loss = 0;
23
24 let trades = 0;
25
26
27 })
28 }
29
30}
\No newline at end of file