Update to latest stromjs
This commit is contained in:
parent
37ebd9f824
commit
125d41d0d4
13
package.json
13
package.json
@ -1,20 +1,19 @@
|
|||||||
{
|
{
|
||||||
"name": "portfolio-blancer",
|
"name": "portfolio-blancer",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"main": "index.js",
|
"main": "src/index.js",
|
||||||
"author": "Lewis Diamond",
|
"author": "Lewis Diamond",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"strom": "ssh://git@git.lewis.id:ldiamond/strom.git",
|
"stromjs": "0.5.2",
|
||||||
"uuid": "^8.2.0"
|
"uuid": "^8.3.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"ava": "^3.9.0",
|
"ava": "^3.15.0",
|
||||||
"prettier": "^2.0.5"
|
"prettier": "^2.2.1"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "ava",
|
"test": "ava",
|
||||||
"test:debug": "node inspect node_modules/ava/profile.js"
|
"test:debug": "node inspect node_modules/ava/profile.js"
|
||||||
},
|
}
|
||||||
"main": "src/index.js"
|
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
const strom = require("strom").strom();
|
const strom = require("stromjs");
|
||||||
const { allInUSD } = require("./pure/balancer");
|
const { allInUSD } = require("./pure/balancer");
|
||||||
const REBALANCE = "rebalance";
|
const REBALANCE = "rebalance";
|
||||||
const PRICING = "pricing";
|
const PRICING = "pricing";
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
const strom = require("strom").strom();
|
const strom = require("stromjs");
|
||||||
const account = require("../stores/account");
|
const account = require("../stores/account");
|
||||||
const pricing = require("../stores/pricing");
|
const pricing = require("../stores/pricing");
|
||||||
const { balance, portfolioDiff, allInUSD } = require("../pure/balancer");
|
const { balance, portfolioDiff, allInUSD } = require("../pure/balancer");
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
const test = require("ava");
|
const test = require("ava");
|
||||||
const strom = require("strom");
|
const { map, fromArray, collect, collected } = require("stromjs");
|
||||||
const { map, fromArray, collect, collected } = strom.strom();
|
const { v4: uuidv4 } = require("uuid");
|
||||||
const uuidv4 = require("uuid/v4");
|
|
||||||
const PricingStore = require("../stores/pricing");
|
const PricingStore = require("../stores/pricing");
|
||||||
const Balancer = require("./balancer");
|
const Balancer = require("./balancer");
|
||||||
|
|
||||||
@ -55,7 +54,7 @@ test("Accounts are read, pricing is obtained and a balanced account is derived",
|
|||||||
} = t.context;
|
} = t.context;
|
||||||
|
|
||||||
const account = accounts[accountId];
|
const account = accounts[accountId];
|
||||||
const result = await strom.collected(
|
const result = await collected(
|
||||||
fromArray([{ accountId }]).pipe(balancer).pipe(collect()),
|
fromArray([{ accountId }]).pipe(balancer).pipe(collect()),
|
||||||
);
|
);
|
||||||
t.deepEqual(result, [
|
t.deepEqual(result, [
|
||||||
@ -100,7 +99,7 @@ test("No order will be sent without pricing data on all relevant titles", async
|
|||||||
} = t.context;
|
} = t.context;
|
||||||
|
|
||||||
pricingStore.set("AAPL", 0);
|
pricingStore.set("AAPL", 0);
|
||||||
const result = await strom.collected(
|
const result = await collected(
|
||||||
fromArray([{ accountId }]).pipe(balancer).pipe(collect()),
|
fromArray([{ accountId }]).pipe(balancer).pipe(collect()),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
const strom = require("strom").strom();
|
const strom = require("stromjs");
|
||||||
const pricing = require("../stores/pricing");
|
const pricing = require("../stores/pricing");
|
||||||
|
|
||||||
module.exports = function ({
|
module.exports = function ({
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//This module exists only for simplicity allowing the application to be run without hosting a database.
|
//This module exists only for simplicity allowing the application to be run without hosting a database.
|
||||||
const uuidv4 = require("uuid/v4");
|
const { v4: uuidv4 } = require("uuid");
|
||||||
|
|
||||||
//Default accounts as provided in the requirements
|
//Default accounts as provided in the requirements
|
||||||
const _id = 1;
|
const _id = 1;
|
||||||
@ -16,9 +16,9 @@ const _accounts = {
|
|||||||
targets: {
|
targets: {
|
||||||
AAPL: 0.22,
|
AAPL: 0.22,
|
||||||
GOOG: 0.38,
|
GOOG: 0.38,
|
||||||
GFN: 0.25,
|
GFN: 0.15,
|
||||||
ACAD: 0.15,
|
ACAD: 0.15,
|
||||||
USD: 0,
|
USD: 0.1,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const test = require("ava");
|
const test = require("ava");
|
||||||
const uuidv4 = require("uuid/v4");
|
const { v4: uuidv4 } = require("uuid");
|
||||||
const accountBackend = require("./memory");
|
const accountBackend = require("./memory");
|
||||||
|
|
||||||
test.beforeEach(t => {
|
test.beforeEach(t => {
|
||||||
|
Loading…
Reference in New Issue
Block a user