Skip to content
Permalink
Browse files

Fix portfolio tests after alignment.

  • Loading branch information...
albertosantini committed Jun 27, 2018
1 parent 6bbfb18 commit b3ed28b8a9f419ee293ea4de2621058844ab85e0
Showing with 6 additions and 6 deletions.
  1. +3 −3 examples/portfolio.js
  2. +3 −3 test/portfolio-test.js
@@ -18,9 +18,9 @@ finance.portfolio.getOptimalPortfolio(params, (err, res) => {
for (let i = 0; i < params.prods.length; i += 1) {
util.log(`Optimal weight for ${params.prods[i]} is ${res.optim.solution[i]}`);
}
assert.strictEqual(0.48948, +res.optim.solution[0].toFixed(5));
assert.strictEqual(0.02308, +res.optim.solution[1].toFixed(5));
assert.strictEqual(0.48744, +res.optim.solution[2].toFixed(5));
assert.strictEqual(0.47201, +res.optim.solution[0].toFixed(5));
assert.strictEqual(0.02359, +res.optim.solution[1].toFixed(5));
assert.strictEqual(0.50439, +res.optim.solution[2].toFixed(5));
} else {
util.log(err);
}
@@ -15,9 +15,9 @@ test("Portfolio tests", t => {
highs: [-1, -1, -1]
}, (err, res) => {
t.notOk(err, "check error for getting optimal portfolio");
t.equal(res.optim.solution[0].toFixed(5), "0.48948", "get optimal IBM weight");
t.equal(res.optim.solution[1].toFixed(5), "0.02308", "get optimal GOOGL weight");
t.equal(res.optim.solution[2].toFixed(5), "0.48744", "get optimal MSFT weight");
t.equal(res.optim.solution[0].toFixed(5), "0.47201", "get optimal IBM weight");
t.equal(res.optim.solution[1].toFixed(5), "0.02359", "get optimal GOOGL weight");
t.equal(res.optim.solution[2].toFixed(5), "0.50439", "get optimal MSFT weight");
});

finance.portfolio.getOptimalPortfolio({

0 comments on commit b3ed28b

Please sign in to comment.
You can’t perform that action at this time.