Update to latest stromjs

This commit is contained in:
Lewis Diamond 2021-02-06 15:08:49 -05:00
parent 37ebd9f824
commit 125d41d0d4
8 changed files with 380 additions and 384 deletions

View File

@ -1,20 +1,19 @@
{
"name": "portfolio-blancer",
"version": "1.0.0",
"main": "index.js",
"main": "src/index.js",
"author": "Lewis Diamond",
"license": "MIT",
"dependencies": {
"strom": "ssh://git@git.lewis.id:ldiamond/strom.git",
"uuid": "^8.2.0"
"stromjs": "0.5.2",
"uuid": "^8.3.2"
},
"devDependencies": {
"ava": "^3.9.0",
"prettier": "^2.0.5"
"ava": "^3.15.0",
"prettier": "^2.2.1"
},
"scripts": {
"test": "ava",
"test:debug": "node inspect node_modules/ava/profile.js"
},
"main": "src/index.js"
}
}

View File

@ -1,4 +1,4 @@
const strom = require("strom").strom();
const strom = require("stromjs");
const { allInUSD } = require("./pure/balancer");
const REBALANCE = "rebalance";
const PRICING = "pricing";

View File

@ -1,4 +1,4 @@
const strom = require("strom").strom();
const strom = require("stromjs");
const account = require("../stores/account");
const pricing = require("../stores/pricing");
const { balance, portfolioDiff, allInUSD } = require("../pure/balancer");

View File

@ -1,7 +1,6 @@
const test = require("ava");
const strom = require("strom");
const { map, fromArray, collect, collected } = strom.strom();
const uuidv4 = require("uuid/v4");
const { map, fromArray, collect, collected } = require("stromjs");
const { v4: uuidv4 } = require("uuid");
const PricingStore = require("../stores/pricing");
const Balancer = require("./balancer");
@ -55,7 +54,7 @@ test("Accounts are read, pricing is obtained and a balanced account is derived",
} = t.context;
const account = accounts[accountId];
const result = await strom.collected(
const result = await collected(
fromArray([{ accountId }]).pipe(balancer).pipe(collect()),
);
t.deepEqual(result, [
@ -100,7 +99,7 @@ test("No order will be sent without pricing data on all relevant titles", async
} = t.context;
pricingStore.set("AAPL", 0);
const result = await strom.collected(
const result = await collected(
fromArray([{ accountId }]).pipe(balancer).pipe(collect()),
);

View File

@ -1,4 +1,4 @@
const strom = require("strom").strom();
const strom = require("stromjs");
const pricing = require("../stores/pricing");
module.exports = function ({

View File

@ -1,5 +1,5 @@
//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
const _id = 1;
@ -16,9 +16,9 @@ const _accounts = {
targets: {
AAPL: 0.22,
GOOG: 0.38,
GFN: 0.25,
GFN: 0.15,
ACAD: 0.15,
USD: 0,
USD: 0.1,
},
},
};

View File

@ -1,5 +1,5 @@
const test = require("ava");
const uuidv4 = require("uuid/v4");
const { v4: uuidv4 } = require("uuid");
const accountBackend = require("./memory");
test.beforeEach(t => {

728
yarn.lock

File diff suppressed because it is too large Load Diff