@barchart/portfolio-client-js 1.2.8 → 1.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/example/example.js +10 -9
- package/lib/gateway/PortfolioGateway.js +9 -11
- package/lib/index.js +1 -1
- package/package.json +1 -1
package/example/example.js
CHANGED
|
@@ -616,7 +616,13 @@ module.exports = function () {
|
|
|
616
616
|
assert.argumentIsRequired(portfolio, 'portfolio', Object);
|
|
617
617
|
assert.argumentIsArray(transactions, 'transactions', Object);
|
|
618
618
|
|
|
619
|
-
var batchData =
|
|
619
|
+
var batchData = {};
|
|
620
|
+
|
|
621
|
+
batchData.portfolio = portfolio;
|
|
622
|
+
batchData.transactionTypes = [];
|
|
623
|
+
batchData.transactionItems = [];
|
|
624
|
+
|
|
625
|
+
transactions.forEach(function (transaction) {
|
|
620
626
|
transaction.portfolio = portfolio.portfolio;
|
|
621
627
|
|
|
622
628
|
if (!transaction.position) {
|
|
@@ -626,13 +632,8 @@ module.exports = function () {
|
|
|
626
632
|
var code = getTransactionTypeCode(transaction);
|
|
627
633
|
var schema = getTransactionSchema(transaction);
|
|
628
634
|
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
return data;
|
|
633
|
-
}, {
|
|
634
|
-
types: [],
|
|
635
|
-
transactions: []
|
|
635
|
+
batchData.transactionTypes.push(code);
|
|
636
|
+
batchData.transactionItems.push(JSON.stringify(schema.schema.format(transaction)));
|
|
636
637
|
});
|
|
637
638
|
|
|
638
639
|
return Gateway.invoke(_this13._batchTransactionEndpoint, batchData);
|
|
@@ -1321,7 +1322,7 @@ module.exports = function () {
|
|
|
1321
1322
|
return {
|
|
1322
1323
|
JwtGateway: JwtGateway,
|
|
1323
1324
|
PortfolioGateway: PortfolioGateway,
|
|
1324
|
-
version: '1.2.
|
|
1325
|
+
version: '1.2.9'
|
|
1325
1326
|
};
|
|
1326
1327
|
}();
|
|
1327
1328
|
|
|
@@ -262,11 +262,11 @@ module.exports = (() => {
|
|
|
262
262
|
.withPort(port)
|
|
263
263
|
.withPathBuilder((pb) => {
|
|
264
264
|
pb.withLiteralParameter('portfolios', 'portfolios')
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
265
|
+
.withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
|
|
266
|
+
.withLiteralParameter('positions', 'positions')
|
|
267
|
+
.withVariableParameter('position', 'position', 'position', false)
|
|
268
|
+
.withLiteralParameter('transactions', 'transactions')
|
|
269
|
+
.withVariableParameter('sequence', 'sequence', 'sequence', false);
|
|
270
270
|
})
|
|
271
271
|
.withQueryBuilder((qb) => {
|
|
272
272
|
qb.withVariableParameter('type', 'type', 'type', false, t => getTransactionTypeCode(t));
|
|
@@ -624,7 +624,7 @@ module.exports = (() => {
|
|
|
624
624
|
batchData.transactionTypes = [ ];
|
|
625
625
|
batchData.transactionItems = [ ];
|
|
626
626
|
|
|
627
|
-
|
|
627
|
+
transactions.forEach((transaction) => {
|
|
628
628
|
transaction.portfolio = portfolio.portfolio;
|
|
629
629
|
|
|
630
630
|
if (!transaction.position) {
|
|
@@ -634,11 +634,9 @@ module.exports = (() => {
|
|
|
634
634
|
const code = getTransactionTypeCode(transaction);
|
|
635
635
|
const schema = getTransactionSchema(transaction);
|
|
636
636
|
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
return data;
|
|
641
|
-
}, batchData);
|
|
637
|
+
batchData.transactionTypes.push(code);
|
|
638
|
+
batchData.transactionItems.push(JSON.stringify(schema.schema.format(transaction)));
|
|
639
|
+
});
|
|
642
640
|
|
|
643
641
|
return Gateway.invoke(this._batchTransactionEndpoint, batchData);
|
|
644
642
|
});
|
package/lib/index.js
CHANGED