@barchart/portfolio-client-js 1.2.26 → 1.2.27
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 +209 -81
- package/lib/gateway/PortfolioGateway.js +55 -5
- package/lib/index.js +1 -1
- package/package.json +1 -1
package/example/example.js
CHANGED
|
@@ -26,7 +26,7 @@ module.exports = function () {
|
|
|
26
26
|
window.Barchart.ValuationType = ValuationType;
|
|
27
27
|
}();
|
|
28
28
|
|
|
29
|
-
},{"@barchart/common-js/lang/Currency":28,"@barchart/common-js/lang/Day":29,"@barchart/common-js/lang/Decimal":30,"@barchart/common-js/lang/Timezones":35,"@barchart/portfolio-api-common/lib/data/TransactionType":54,"@barchart/portfolio-api-common/lib/data/ValuationType":55,"@barchart/tgam-jwt-js/lib/JwtGateway":
|
|
29
|
+
},{"@barchart/common-js/lang/Currency":28,"@barchart/common-js/lang/Day":29,"@barchart/common-js/lang/Decimal":30,"@barchart/common-js/lang/Timezones":35,"@barchart/portfolio-api-common/lib/data/TransactionType":54,"@barchart/portfolio-api-common/lib/data/ValuationType":55,"@barchart/tgam-jwt-js/lib/JwtGateway":61}],2:[function(require,module,exports){
|
|
30
30
|
'use strict';
|
|
31
31
|
|
|
32
32
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
@@ -138,6 +138,7 @@ var TransactionType = require('@barchart/portfolio-api-common/lib/data/Transacti
|
|
|
138
138
|
|
|
139
139
|
var PortfolioSchema = require('@barchart/portfolio-api-common/lib/serialization/PortfolioSchema'),
|
|
140
140
|
PositionSummarySchema = require('@barchart/portfolio-api-common/lib/serialization/PositionSummarySchema'),
|
|
141
|
+
PositionSummaryDefinitionSchema = require('@barchart/portfolio-api-common/lib/serialization/PositionSummaryDefinitionSchema'),
|
|
141
142
|
PositionSchema = require('@barchart/portfolio-api-common/lib/serialization/PositionSchema'),
|
|
142
143
|
TransactionSchema = require('@barchart/portfolio-api-common/lib/serialization/TransactionSchema');
|
|
143
144
|
|
|
@@ -234,6 +235,16 @@ module.exports = function () {
|
|
|
234
235
|
});
|
|
235
236
|
}).withRequestInterceptor(requestInterceptorToUse).withRequestInterceptor(RequestInterceptor.PLAIN_TEXT_RESPONSE).withResponseInterceptor(responseInterceptorForPositionSummaryDeserialization).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
|
|
236
237
|
|
|
238
|
+
_this._readPositionSummaryDefinitionEndpoint = EndpointBuilder.for('read-position-summary-definitions', 'read position summary definitions').withVerb(VerbType.GET).withProtocol(protocolType).withHost(host).withPort(port).withPathBuilder(function (pb) {
|
|
239
|
+
pb.withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('summaries', 'summaries').withLiteralParameter('ranges', 'ranges');
|
|
240
|
+
}).withQueryBuilder(function (qb) {
|
|
241
|
+
qb.withVariableParameter('frames', 'frames', 'frames', true, function (frames) {
|
|
242
|
+
return frames.map(function (f) {
|
|
243
|
+
return f.code;
|
|
244
|
+
}).join();
|
|
245
|
+
});
|
|
246
|
+
}).withRequestInterceptor(requestInterceptorToUse).withRequestInterceptor(RequestInterceptor.PLAIN_TEXT_RESPONSE).withResponseInterceptor(responseInterceptorForPositionSummaryDefinitionDeserialization).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
|
|
247
|
+
|
|
237
248
|
_this._readTransactionsEndpoint = EndpointBuilder.for('read-transactions', 'read transactions').withVerb(VerbType.GET).withProtocol(protocolType).withHost(host).withPort(port).withPathBuilder(function (pb) {
|
|
238
249
|
pb.withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('positions', 'positions').withVariableParameter('position', 'position', 'position', false).withLiteralParameter('transactions', 'transactions');
|
|
239
250
|
}).withQueryBuilder(function (qb) {
|
|
@@ -344,7 +355,7 @@ module.exports = function () {
|
|
|
344
355
|
}
|
|
345
356
|
|
|
346
357
|
/**
|
|
347
|
-
* Creates a portfolio
|
|
358
|
+
* Creates a portfolio.
|
|
348
359
|
*
|
|
349
360
|
* @public
|
|
350
361
|
* @param {Object} portfolio
|
|
@@ -388,7 +399,7 @@ module.exports = function () {
|
|
|
388
399
|
}
|
|
389
400
|
|
|
390
401
|
/**
|
|
391
|
-
* Updates a portfolio
|
|
402
|
+
* Updates a portfolio.
|
|
392
403
|
*
|
|
393
404
|
* @public
|
|
394
405
|
* @param {Object} portfolio
|
|
@@ -410,7 +421,7 @@ module.exports = function () {
|
|
|
410
421
|
}
|
|
411
422
|
|
|
412
423
|
/**
|
|
413
|
-
* Deletes a portfolio
|
|
424
|
+
* Deletes a portfolio.
|
|
414
425
|
*
|
|
415
426
|
* @public
|
|
416
427
|
* @param {String} portfolio - ID of the portfolio to update
|
|
@@ -458,7 +469,7 @@ module.exports = function () {
|
|
|
458
469
|
}
|
|
459
470
|
|
|
460
471
|
/**
|
|
461
|
-
* Updates a position
|
|
472
|
+
* Updates a position.
|
|
462
473
|
*
|
|
463
474
|
* @public
|
|
464
475
|
* @param {Object} position
|
|
@@ -599,6 +610,31 @@ module.exports = function () {
|
|
|
599
610
|
});
|
|
600
611
|
}
|
|
601
612
|
|
|
613
|
+
/**
|
|
614
|
+
* Returns all position summary definitions for a portfolio.
|
|
615
|
+
*
|
|
616
|
+
* @public
|
|
617
|
+
* @param {String} portfolio
|
|
618
|
+
* @param {Array.<PositionSummaryFrame>} frames
|
|
619
|
+
*/
|
|
620
|
+
|
|
621
|
+
}, {
|
|
622
|
+
key: 'readPositionSummaryDefinitions',
|
|
623
|
+
value: function readPositionSummaryDefinitions(portfolio, frames) {
|
|
624
|
+
var _this12 = this;
|
|
625
|
+
|
|
626
|
+
return Promise.resolve().then(function () {
|
|
627
|
+
assert.argumentIsRequired(portfolio, 'portfolio', String);
|
|
628
|
+
|
|
629
|
+
var query = {};
|
|
630
|
+
|
|
631
|
+
query.portfolio = portfolio;
|
|
632
|
+
query.frames = frames;
|
|
633
|
+
|
|
634
|
+
return Gateway.invoke(_this12._readPositionSummaryDefinitionEndpoint, query);
|
|
635
|
+
});
|
|
636
|
+
}
|
|
637
|
+
|
|
602
638
|
/**
|
|
603
639
|
* Deletes a position.
|
|
604
640
|
*
|
|
@@ -611,15 +647,15 @@ module.exports = function () {
|
|
|
611
647
|
}, {
|
|
612
648
|
key: 'deletePosition',
|
|
613
649
|
value: function deletePosition(portfolio, position) {
|
|
614
|
-
var
|
|
650
|
+
var _this13 = this;
|
|
615
651
|
|
|
616
652
|
return Promise.resolve().then(function () {
|
|
617
|
-
checkStart.call(
|
|
653
|
+
checkStart.call(_this13);
|
|
618
654
|
|
|
619
655
|
assert.argumentIsRequired(portfolio, 'portfolio', String);
|
|
620
656
|
assert.argumentIsRequired(position, 'position', String);
|
|
621
657
|
|
|
622
|
-
return Gateway.invoke(
|
|
658
|
+
return Gateway.invoke(_this13._deletePositionEndpoint, { portfolio: portfolio, position: position });
|
|
623
659
|
});
|
|
624
660
|
}
|
|
625
661
|
|
|
@@ -634,10 +670,10 @@ module.exports = function () {
|
|
|
634
670
|
}, {
|
|
635
671
|
key: 'createTransaction',
|
|
636
672
|
value: function createTransaction(transaction) {
|
|
637
|
-
var
|
|
673
|
+
var _this14 = this;
|
|
638
674
|
|
|
639
675
|
return Promise.resolve().then(function () {
|
|
640
|
-
checkStart.call(
|
|
676
|
+
checkStart.call(_this14);
|
|
641
677
|
|
|
642
678
|
assert.argumentIsRequired(transaction, 'transaction', Object);
|
|
643
679
|
assert.argumentIsRequired(transaction.portfolio, 'transaction.portfolio', String);
|
|
@@ -649,7 +685,7 @@ module.exports = function () {
|
|
|
649
685
|
|
|
650
686
|
var schema = getTransactionSchema(transaction);
|
|
651
687
|
|
|
652
|
-
return Gateway.invoke(
|
|
688
|
+
return Gateway.invoke(_this14._createTransactionEndpoint, schema.schema.format(transaction));
|
|
653
689
|
});
|
|
654
690
|
}
|
|
655
691
|
|
|
@@ -664,10 +700,10 @@ module.exports = function () {
|
|
|
664
700
|
}, {
|
|
665
701
|
key: 'batchTransactions',
|
|
666
702
|
value: function batchTransactions(portfolio, transactions) {
|
|
667
|
-
var
|
|
703
|
+
var _this15 = this;
|
|
668
704
|
|
|
669
705
|
return Promise.resolve().then(function () {
|
|
670
|
-
checkStart.call(
|
|
706
|
+
checkStart.call(_this15);
|
|
671
707
|
|
|
672
708
|
assert.argumentIsRequired(portfolio, 'portfolio', Object);
|
|
673
709
|
assert.argumentIsArray(transactions, 'transactions', Object);
|
|
@@ -692,7 +728,7 @@ module.exports = function () {
|
|
|
692
728
|
batchData.transactionItems.push(JSON.stringify(schema.schema.format(transaction)));
|
|
693
729
|
});
|
|
694
730
|
|
|
695
|
-
return Gateway.invoke(
|
|
731
|
+
return Gateway.invoke(_this15._batchTransactionEndpoint, batchData);
|
|
696
732
|
});
|
|
697
733
|
}
|
|
698
734
|
|
|
@@ -707,10 +743,10 @@ module.exports = function () {
|
|
|
707
743
|
}, {
|
|
708
744
|
key: 'editTransaction',
|
|
709
745
|
value: function editTransaction(transaction) {
|
|
710
|
-
var
|
|
746
|
+
var _this16 = this;
|
|
711
747
|
|
|
712
748
|
return Promise.resolve().then(function () {
|
|
713
|
-
checkStart.call(
|
|
749
|
+
checkStart.call(_this16);
|
|
714
750
|
|
|
715
751
|
assert.argumentIsRequired(transaction, 'transaction', Object);
|
|
716
752
|
assert.argumentIsRequired(transaction.portfolio, 'transaction.portfolio', String);
|
|
@@ -719,7 +755,7 @@ module.exports = function () {
|
|
|
719
755
|
|
|
720
756
|
var schema = getTransactionSchema(transaction);
|
|
721
757
|
|
|
722
|
-
return Gateway.invoke(
|
|
758
|
+
return Gateway.invoke(_this16._editTransactionEndpoint, schema.schema.format(transaction));
|
|
723
759
|
});
|
|
724
760
|
}
|
|
725
761
|
|
|
@@ -739,10 +775,10 @@ module.exports = function () {
|
|
|
739
775
|
}, {
|
|
740
776
|
key: 'deleteTransaction',
|
|
741
777
|
value: function deleteTransaction(portfolio, position, sequence, force, echoStart, echoEnd) {
|
|
742
|
-
var
|
|
778
|
+
var _this17 = this;
|
|
743
779
|
|
|
744
780
|
return Promise.resolve().then(function () {
|
|
745
|
-
checkStart.call(
|
|
781
|
+
checkStart.call(_this17);
|
|
746
782
|
|
|
747
783
|
assert.argumentIsRequired(portfolio, 'portfolio', String);
|
|
748
784
|
assert.argumentIsRequired(position, 'position', String);
|
|
@@ -766,7 +802,7 @@ module.exports = function () {
|
|
|
766
802
|
payload.echoEnd = echoEnd;
|
|
767
803
|
}
|
|
768
804
|
|
|
769
|
-
return Gateway.invoke(
|
|
805
|
+
return Gateway.invoke(_this17._deleteTransactionEndpoint, payload);
|
|
770
806
|
});
|
|
771
807
|
}
|
|
772
808
|
|
|
@@ -782,15 +818,15 @@ module.exports = function () {
|
|
|
782
818
|
}, {
|
|
783
819
|
key: 'readTransactions',
|
|
784
820
|
value: function readTransactions(portfolio, position) {
|
|
785
|
-
var
|
|
821
|
+
var _this18 = this;
|
|
786
822
|
|
|
787
823
|
return Promise.resolve().then(function () {
|
|
788
|
-
checkStart.call(
|
|
824
|
+
checkStart.call(_this18);
|
|
789
825
|
|
|
790
826
|
assert.argumentIsRequired(portfolio, 'portfolio', String);
|
|
791
827
|
assert.argumentIsOptional(position, 'position', String);
|
|
792
828
|
|
|
793
|
-
return Gateway.invoke(
|
|
829
|
+
return Gateway.invoke(_this18._readTransactionsEndpoint, { portfolio: portfolio, position: position || '*' });
|
|
794
830
|
});
|
|
795
831
|
}
|
|
796
832
|
|
|
@@ -810,10 +846,10 @@ module.exports = function () {
|
|
|
810
846
|
}, {
|
|
811
847
|
key: 'readTransactionsFormatted',
|
|
812
848
|
value: function readTransactionsFormatted(portfolio, position, startDay, endDay, descending) {
|
|
813
|
-
var
|
|
849
|
+
var _this19 = this;
|
|
814
850
|
|
|
815
851
|
return Promise.resolve().then(function () {
|
|
816
|
-
checkStart.call(
|
|
852
|
+
checkStart.call(_this19);
|
|
817
853
|
|
|
818
854
|
assert.argumentIsRequired(portfolio, 'portfolio', String);
|
|
819
855
|
assert.argumentIsOptional(position, 'position', String);
|
|
@@ -836,16 +872,16 @@ module.exports = function () {
|
|
|
836
872
|
|
|
837
873
|
payload.descending = is.boolean(descending) && descending;
|
|
838
874
|
|
|
839
|
-
return Gateway.invoke(
|
|
875
|
+
return Gateway.invoke(_this19._readTransactionsReportEndpoint, payload);
|
|
840
876
|
});
|
|
841
877
|
}
|
|
842
878
|
}, {
|
|
843
879
|
key: 'readTransactionsFormattedPage',
|
|
844
880
|
value: function readTransactionsFormattedPage(portfolio, position, sequence, count, descending) {
|
|
845
|
-
var
|
|
881
|
+
var _this20 = this;
|
|
846
882
|
|
|
847
883
|
return Promise.resolve().then(function () {
|
|
848
|
-
checkStart.call(
|
|
884
|
+
checkStart.call(_this20);
|
|
849
885
|
|
|
850
886
|
assert.argumentIsRequired(portfolio, 'portfolio', String);
|
|
851
887
|
assert.argumentIsRequired(position, 'position', String);
|
|
@@ -870,7 +906,7 @@ module.exports = function () {
|
|
|
870
906
|
|
|
871
907
|
payload.descending = is.boolean(descending) && descending;
|
|
872
908
|
|
|
873
|
-
return Gateway.invoke(
|
|
909
|
+
return Gateway.invoke(_this20._readTransactionsReportEndpoint, payload);
|
|
874
910
|
});
|
|
875
911
|
}
|
|
876
912
|
|
|
@@ -1043,6 +1079,14 @@ module.exports = function () {
|
|
|
1043
1079
|
}
|
|
1044
1080
|
});
|
|
1045
1081
|
|
|
1082
|
+
var responseInterceptorForPositionSummaryDefinitionDeserialization = ResponseInterceptor.fromDelegate(function (response, ignored) {
|
|
1083
|
+
try {
|
|
1084
|
+
return JSON.parse(response.data, PositionSummaryDefinitionSchema.CLIENT.schema.getReviver());
|
|
1085
|
+
} catch (e) {
|
|
1086
|
+
console.log('Error deserializing position summary definition', e);
|
|
1087
|
+
}
|
|
1088
|
+
});
|
|
1089
|
+
|
|
1046
1090
|
var responseInterceptorForTransactionDeserialization = ResponseInterceptor.fromDelegate(function (response, ignored) {
|
|
1047
1091
|
try {
|
|
1048
1092
|
return JSON.parse(response.data, TransactionSchema.CLIENT.schema.getReviver());
|
|
@@ -1110,7 +1154,7 @@ module.exports = function () {
|
|
|
1110
1154
|
return PortfolioGateway;
|
|
1111
1155
|
}();
|
|
1112
1156
|
|
|
1113
|
-
},{"./../common/Configuration":2,"@barchart/common-js/api/failures/FailureReason":6,"@barchart/common-js/api/http/Gateway":9,"@barchart/common-js/api/http/builders/EndpointBuilder":10,"@barchart/common-js/api/http/definitions/ProtocolType":15,"@barchart/common-js/api/http/definitions/VerbType":16,"@barchart/common-js/api/http/interceptors/ErrorInterceptor":20,"@barchart/common-js/api/http/interceptors/RequestInterceptor":21,"@barchart/common-js/api/http/interceptors/ResponseInterceptor":22,"@barchart/common-js/lang/Day":29,"@barchart/common-js/lang/Disposable":31,"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/assert":37,"@barchart/common-js/lang/is":40,"@barchart/common-js/lang/promise":42,"@barchart/portfolio-api-common/lib/data/PositionSummaryFrame":53,"@barchart/portfolio-api-common/lib/data/TransactionType":54,"@barchart/portfolio-api-common/lib/serialization/PortfolioSchema":56,"@barchart/portfolio-api-common/lib/serialization/PositionSchema":57,"@barchart/portfolio-api-common/lib/serialization/
|
|
1157
|
+
},{"./../common/Configuration":2,"@barchart/common-js/api/failures/FailureReason":6,"@barchart/common-js/api/http/Gateway":9,"@barchart/common-js/api/http/builders/EndpointBuilder":10,"@barchart/common-js/api/http/definitions/ProtocolType":15,"@barchart/common-js/api/http/definitions/VerbType":16,"@barchart/common-js/api/http/interceptors/ErrorInterceptor":20,"@barchart/common-js/api/http/interceptors/RequestInterceptor":21,"@barchart/common-js/api/http/interceptors/ResponseInterceptor":22,"@barchart/common-js/lang/Day":29,"@barchart/common-js/lang/Disposable":31,"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/assert":37,"@barchart/common-js/lang/is":40,"@barchart/common-js/lang/promise":42,"@barchart/portfolio-api-common/lib/data/PositionSummaryFrame":53,"@barchart/portfolio-api-common/lib/data/TransactionType":54,"@barchart/portfolio-api-common/lib/serialization/PortfolioSchema":56,"@barchart/portfolio-api-common/lib/serialization/PositionSchema":57,"@barchart/portfolio-api-common/lib/serialization/PositionSummaryDefinitionSchema":58,"@barchart/portfolio-api-common/lib/serialization/PositionSummarySchema":59,"@barchart/portfolio-api-common/lib/serialization/TransactionSchema":60}],4:[function(require,module,exports){
|
|
1114
1158
|
'use strict';
|
|
1115
1159
|
|
|
1116
1160
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
@@ -1461,7 +1505,7 @@ module.exports = function () {
|
|
|
1461
1505
|
return {
|
|
1462
1506
|
JwtGateway: JwtGateway,
|
|
1463
1507
|
PortfolioGateway: PortfolioGateway,
|
|
1464
|
-
version: '1.2.
|
|
1508
|
+
version: '1.2.27'
|
|
1465
1509
|
};
|
|
1466
1510
|
}();
|
|
1467
1511
|
|
|
@@ -2217,7 +2261,7 @@ module.exports = function () {
|
|
|
2217
2261
|
return Gateway;
|
|
2218
2262
|
}();
|
|
2219
2263
|
|
|
2220
|
-
},{"./../../lang/array":36,"./../../lang/assert":37,"./../../lang/attributes":38,"./../../lang/promise":42,"./../failures/FailureReason":6,"./../failures/FailureType":8,"./definitions/Endpoint":12,"./definitions/VerbType":16,"axios":
|
|
2264
|
+
},{"./../../lang/array":36,"./../../lang/assert":37,"./../../lang/attributes":38,"./../../lang/promise":42,"./../failures/FailureReason":6,"./../failures/FailureType":8,"./definitions/Endpoint":12,"./definitions/VerbType":16,"axios":63}],10:[function(require,module,exports){
|
|
2221
2265
|
'use strict';
|
|
2222
2266
|
|
|
2223
2267
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
@@ -6285,7 +6329,7 @@ module.exports = function () {
|
|
|
6285
6329
|
return Decimal;
|
|
6286
6330
|
}();
|
|
6287
6331
|
|
|
6288
|
-
},{"./Enum":32,"./assert":37,"./is":40,"big.js":
|
|
6332
|
+
},{"./Enum":32,"./assert":37,"./is":40,"big.js":88}],31:[function(require,module,exports){
|
|
6289
6333
|
'use strict';
|
|
6290
6334
|
|
|
6291
6335
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
@@ -6844,7 +6888,7 @@ module.exports = function () {
|
|
|
6844
6888
|
return Timestamp;
|
|
6845
6889
|
}();
|
|
6846
6890
|
|
|
6847
|
-
},{"./assert":37,"./is":40,"moment-timezone":
|
|
6891
|
+
},{"./assert":37,"./is":40,"moment-timezone":93}],35:[function(require,module,exports){
|
|
6848
6892
|
'use strict';
|
|
6849
6893
|
|
|
6850
6894
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
@@ -8401,7 +8445,7 @@ module.exports = function () {
|
|
|
8401
8445
|
};
|
|
8402
8446
|
}();
|
|
8403
8447
|
|
|
8404
|
-
},{"./assert":37,"moment-timezone/builds/moment-timezone-with-data-2010-2020":
|
|
8448
|
+
},{"./assert":37,"moment-timezone/builds/moment-timezone-with-data-2010-2020":91}],44:[function(require,module,exports){
|
|
8405
8449
|
'use strict';
|
|
8406
8450
|
|
|
8407
8451
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
@@ -8877,7 +8921,7 @@ module.exports = function () {
|
|
|
8877
8921
|
return DataType;
|
|
8878
8922
|
}();
|
|
8879
8923
|
|
|
8880
|
-
},{"./../../lang/AdHoc":27,"./../../lang/Day":29,"./../../lang/Decimal":30,"./../../lang/Enum":32,"./../../lang/Timestamp":34,"./../../lang/assert":37,"./../../lang/is":40,"moment":
|
|
8924
|
+
},{"./../../lang/AdHoc":27,"./../../lang/Day":29,"./../../lang/Decimal":30,"./../../lang/Enum":32,"./../../lang/Timestamp":34,"./../../lang/assert":37,"./../../lang/is":40,"moment":95}],46:[function(require,module,exports){
|
|
8881
8925
|
'use strict';
|
|
8882
8926
|
|
|
8883
8927
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
@@ -10069,7 +10113,7 @@ module.exports = (() => {
|
|
|
10069
10113
|
return InstrumentType;
|
|
10070
10114
|
})();
|
|
10071
10115
|
|
|
10072
|
-
},{"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/assert":37,"uuid":
|
|
10116
|
+
},{"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/assert":37,"uuid":96}],52:[function(require,module,exports){
|
|
10073
10117
|
const assert = require('@barchart/common-js/lang/assert'),
|
|
10074
10118
|
Decimal = require('@barchart/common-js/lang/Decimal'),
|
|
10075
10119
|
Enum = require('@barchart/common-js/lang/Enum');
|
|
@@ -10288,6 +10332,19 @@ module.exports = (() => {
|
|
|
10288
10332
|
return this._rangeCalculator(getFilteredTransactions(transactions));
|
|
10289
10333
|
}
|
|
10290
10334
|
|
|
10335
|
+
/**
|
|
10336
|
+
* Returns the range which contains a given date and all subsequent ranges.
|
|
10337
|
+
*
|
|
10338
|
+
* @public
|
|
10339
|
+
* @param {Day} date
|
|
10340
|
+
* @return {Array.<PositionSummaryRange>}
|
|
10341
|
+
*/
|
|
10342
|
+
getRangesFromDate(date) {
|
|
10343
|
+
const transaction = { date: date, snapshot: { open: Decimal.ONE } };
|
|
10344
|
+
|
|
10345
|
+
return this.getRanges([ transaction ]);
|
|
10346
|
+
}
|
|
10347
|
+
|
|
10291
10348
|
/**
|
|
10292
10349
|
* Returns the start date for a frame, a given number of periods ago.
|
|
10293
10350
|
*
|
|
@@ -10360,6 +10417,16 @@ module.exports = (() => {
|
|
|
10360
10417
|
* @property {Day} end
|
|
10361
10418
|
*/
|
|
10362
10419
|
|
|
10420
|
+
/**
|
|
10421
|
+
* The start and and date for a {@link PositionSummaryFrame} along with the frame type.
|
|
10422
|
+
*
|
|
10423
|
+
* @typedef PositionSummaryDefinition
|
|
10424
|
+
* @type {Object}
|
|
10425
|
+
* @property {Day} start
|
|
10426
|
+
* @property {Day} end
|
|
10427
|
+
* @property {PositionSummaryFrame} frame
|
|
10428
|
+
*/
|
|
10429
|
+
|
|
10363
10430
|
function getRange(start, end) {
|
|
10364
10431
|
return {
|
|
10365
10432
|
start: start,
|
|
@@ -11226,6 +11293,7 @@ module.exports = (() => {
|
|
|
11226
11293
|
.withField('legacy.portfolio', DataType.STRING, true)
|
|
11227
11294
|
.withField('legacy.position', DataType.STRING, true)
|
|
11228
11295
|
.withField('system.version', DataType.NUMBER, true)
|
|
11296
|
+
.withField('system.locked', DataType.BOOLEAN, true)
|
|
11229
11297
|
.withField('root', DataType.STRING, true)
|
|
11230
11298
|
.schema
|
|
11231
11299
|
);
|
|
@@ -11255,6 +11323,7 @@ module.exports = (() => {
|
|
|
11255
11323
|
.withField('snapshot.basis', DataType.DECIMAL)
|
|
11256
11324
|
.withField('snapshot.income', DataType.DECIMAL)
|
|
11257
11325
|
.withField('snapshot.value', DataType.DECIMAL)
|
|
11326
|
+
.withField('system.locked', DataType.BOOLEAN, true)
|
|
11258
11327
|
.withField('previous', DataType.NUMBER, true)
|
|
11259
11328
|
.schema
|
|
11260
11329
|
);
|
|
@@ -11276,8 +11345,67 @@ module.exports = (() => {
|
|
|
11276
11345
|
})();
|
|
11277
11346
|
|
|
11278
11347
|
},{"./../data/InstrumentType":51,"./../data/PositionDirection":52,"./../data/ValuationType":55,"@barchart/common-js/lang/Currency":28,"@barchart/common-js/lang/Enum":32,"@barchart/common-js/serialization/json/DataType":45,"@barchart/common-js/serialization/json/Schema":47,"@barchart/common-js/serialization/json/builders/SchemaBuilder":49}],58:[function(require,module,exports){
|
|
11279
|
-
const
|
|
11280
|
-
|
|
11348
|
+
const DataType = require('@barchart/common-js/serialization/json/DataType'),
|
|
11349
|
+
Enum = require('@barchart/common-js/lang/Enum'),
|
|
11350
|
+
Schema = require('@barchart/common-js/serialization/json/Schema'),
|
|
11351
|
+
SchemaBuilder = require('@barchart/common-js/serialization/json/builders/SchemaBuilder');
|
|
11352
|
+
|
|
11353
|
+
const PositionSummaryFrame = require('./../data/PositionSummaryFrame');
|
|
11354
|
+
|
|
11355
|
+
module.exports = (() => {
|
|
11356
|
+
'use strict';
|
|
11357
|
+
|
|
11358
|
+
/**
|
|
11359
|
+
* The schemas which can be used to represent position summary objects.
|
|
11360
|
+
*
|
|
11361
|
+
* @public
|
|
11362
|
+
* @extends {Enum}
|
|
11363
|
+
*/
|
|
11364
|
+
class PositionSummaryDefinitionSchema extends Enum {
|
|
11365
|
+
constructor(schema) {
|
|
11366
|
+
super(schema.name, schema.name);
|
|
11367
|
+
|
|
11368
|
+
this._schema = schema;
|
|
11369
|
+
}
|
|
11370
|
+
|
|
11371
|
+
/**
|
|
11372
|
+
* The actual {@link Schema}.
|
|
11373
|
+
*
|
|
11374
|
+
* @public
|
|
11375
|
+
* @returns {Schema}
|
|
11376
|
+
*/
|
|
11377
|
+
get schema() {
|
|
11378
|
+
return this._schema;
|
|
11379
|
+
}
|
|
11380
|
+
|
|
11381
|
+
/**
|
|
11382
|
+
* The complete position summary definition schema.
|
|
11383
|
+
*
|
|
11384
|
+
* @static
|
|
11385
|
+
* @public
|
|
11386
|
+
* @returns {PositionSummaryDefinitionSchema}
|
|
11387
|
+
*/
|
|
11388
|
+
static get COMPLETE() {
|
|
11389
|
+
return complete;
|
|
11390
|
+
}
|
|
11391
|
+
|
|
11392
|
+
toString() {
|
|
11393
|
+
return '[PositionSummaryDefinitionSchema]';
|
|
11394
|
+
}
|
|
11395
|
+
}
|
|
11396
|
+
|
|
11397
|
+
const complete = new PositionSummaryDefinitionSchema(SchemaBuilder.withName('complete')
|
|
11398
|
+
.withField('start', DataType.DAY)
|
|
11399
|
+
.withField('end', DataType.DAY)
|
|
11400
|
+
.withField('frame', DataType.forEnum(PositionSummaryFrame, 'PositionSummaryFrame'))
|
|
11401
|
+
.schema
|
|
11402
|
+
);
|
|
11403
|
+
|
|
11404
|
+
return PositionSummaryDefinitionSchema;
|
|
11405
|
+
})();
|
|
11406
|
+
|
|
11407
|
+
},{"./../data/PositionSummaryFrame":53,"@barchart/common-js/lang/Enum":32,"@barchart/common-js/serialization/json/DataType":45,"@barchart/common-js/serialization/json/Schema":47,"@barchart/common-js/serialization/json/builders/SchemaBuilder":49}],59:[function(require,module,exports){
|
|
11408
|
+
const DataType = require('@barchart/common-js/serialization/json/DataType'),
|
|
11281
11409
|
Enum = require('@barchart/common-js/lang/Enum'),
|
|
11282
11410
|
Schema = require('@barchart/common-js/serialization/json/Schema'),
|
|
11283
11411
|
SchemaBuilder = require('@barchart/common-js/serialization/json/builders/SchemaBuilder');
|
|
@@ -11393,7 +11521,7 @@ module.exports = (() => {
|
|
|
11393
11521
|
return PositionSummarySchema;
|
|
11394
11522
|
})();
|
|
11395
11523
|
|
|
11396
|
-
},{"./../data/PositionDirection":52,"./../data/PositionSummaryFrame":53,"@barchart/common-js/lang/
|
|
11524
|
+
},{"./../data/PositionDirection":52,"./../data/PositionSummaryFrame":53,"@barchart/common-js/lang/Enum":32,"@barchart/common-js/serialization/json/DataType":45,"@barchart/common-js/serialization/json/Schema":47,"@barchart/common-js/serialization/json/builders/SchemaBuilder":49}],60:[function(require,module,exports){
|
|
11397
11525
|
const is = require('@barchart/common-js/lang/is'),
|
|
11398
11526
|
Currency = require('@barchart/common-js/lang/Currency'),
|
|
11399
11527
|
DataType = require('@barchart/common-js/serialization/json/DataType'),
|
|
@@ -11749,7 +11877,7 @@ module.exports = (() => {
|
|
|
11749
11877
|
return TransactionSchema;
|
|
11750
11878
|
})();
|
|
11751
11879
|
|
|
11752
|
-
},{"./../data/InstrumentType":51,"./../data/PositionDirection":52,"./../data/TransactionType":54,"@barchart/common-js/lang/Currency":28,"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/is":40,"@barchart/common-js/serialization/json/DataType":45,"@barchart/common-js/serialization/json/Schema":47,"@barchart/common-js/serialization/json/builders/SchemaBuilder":49}],
|
|
11880
|
+
},{"./../data/InstrumentType":51,"./../data/PositionDirection":52,"./../data/TransactionType":54,"@barchart/common-js/lang/Currency":28,"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/is":40,"@barchart/common-js/serialization/json/DataType":45,"@barchart/common-js/serialization/json/Schema":47,"@barchart/common-js/serialization/json/builders/SchemaBuilder":49}],61:[function(require,module,exports){
|
|
11753
11881
|
'use strict';
|
|
11754
11882
|
|
|
11755
11883
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
@@ -12147,7 +12275,7 @@ module.exports = function () {
|
|
|
12147
12275
|
return JwtGateway;
|
|
12148
12276
|
}();
|
|
12149
12277
|
|
|
12150
|
-
},{"./index":
|
|
12278
|
+
},{"./index":62,"@barchart/common-js/api/failures/FailureReason":6,"@barchart/common-js/api/failures/FailureType":8,"@barchart/common-js/api/http/Gateway":9,"@barchart/common-js/api/http/builders/EndpointBuilder":10,"@barchart/common-js/api/http/definitions/Endpoint":12,"@barchart/common-js/api/http/definitions/ProtocolType":15,"@barchart/common-js/api/http/definitions/VerbType":16,"@barchart/common-js/api/http/interceptors/RequestInterceptor":21,"@barchart/common-js/api/http/interceptors/ResponseInterceptor":22,"@barchart/common-js/lang/Disposable":31,"@barchart/common-js/lang/assert":37,"@barchart/common-js/timing/Scheduler":50}],62:[function(require,module,exports){
|
|
12151
12279
|
'use strict';
|
|
12152
12280
|
|
|
12153
12281
|
module.exports = function () {
|
|
@@ -12158,9 +12286,9 @@ module.exports = function () {
|
|
|
12158
12286
|
};
|
|
12159
12287
|
}();
|
|
12160
12288
|
|
|
12161
|
-
},{}],
|
|
12289
|
+
},{}],63:[function(require,module,exports){
|
|
12162
12290
|
module.exports = require('./lib/axios');
|
|
12163
|
-
},{"./lib/axios":
|
|
12291
|
+
},{"./lib/axios":65}],64:[function(require,module,exports){
|
|
12164
12292
|
(function (process){
|
|
12165
12293
|
'use strict';
|
|
12166
12294
|
|
|
@@ -12344,7 +12472,7 @@ module.exports = function xhrAdapter(config) {
|
|
|
12344
12472
|
};
|
|
12345
12473
|
|
|
12346
12474
|
}).call(this,require('_process'))
|
|
12347
|
-
},{"../core/createError":
|
|
12475
|
+
},{"../core/createError":71,"./../core/settle":74,"./../helpers/btoa":78,"./../helpers/buildURL":79,"./../helpers/cookies":81,"./../helpers/isURLSameOrigin":83,"./../helpers/parseHeaders":85,"./../utils":87,"_process":89}],65:[function(require,module,exports){
|
|
12348
12476
|
'use strict';
|
|
12349
12477
|
|
|
12350
12478
|
var utils = require('./utils');
|
|
@@ -12398,7 +12526,7 @@ module.exports = axios;
|
|
|
12398
12526
|
// Allow use of default import syntax in TypeScript
|
|
12399
12527
|
module.exports.default = axios;
|
|
12400
12528
|
|
|
12401
|
-
},{"./cancel/Cancel":
|
|
12529
|
+
},{"./cancel/Cancel":66,"./cancel/CancelToken":67,"./cancel/isCancel":68,"./core/Axios":69,"./defaults":76,"./helpers/bind":77,"./helpers/spread":86,"./utils":87}],66:[function(require,module,exports){
|
|
12402
12530
|
'use strict';
|
|
12403
12531
|
|
|
12404
12532
|
/**
|
|
@@ -12419,7 +12547,7 @@ Cancel.prototype.__CANCEL__ = true;
|
|
|
12419
12547
|
|
|
12420
12548
|
module.exports = Cancel;
|
|
12421
12549
|
|
|
12422
|
-
},{}],
|
|
12550
|
+
},{}],67:[function(require,module,exports){
|
|
12423
12551
|
'use strict';
|
|
12424
12552
|
|
|
12425
12553
|
var Cancel = require('./Cancel');
|
|
@@ -12478,14 +12606,14 @@ CancelToken.source = function source() {
|
|
|
12478
12606
|
|
|
12479
12607
|
module.exports = CancelToken;
|
|
12480
12608
|
|
|
12481
|
-
},{"./Cancel":
|
|
12609
|
+
},{"./Cancel":66}],68:[function(require,module,exports){
|
|
12482
12610
|
'use strict';
|
|
12483
12611
|
|
|
12484
12612
|
module.exports = function isCancel(value) {
|
|
12485
12613
|
return !!(value && value.__CANCEL__);
|
|
12486
12614
|
};
|
|
12487
12615
|
|
|
12488
|
-
},{}],
|
|
12616
|
+
},{}],69:[function(require,module,exports){
|
|
12489
12617
|
'use strict';
|
|
12490
12618
|
|
|
12491
12619
|
var defaults = require('./../defaults');
|
|
@@ -12566,7 +12694,7 @@ utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
|
12566
12694
|
|
|
12567
12695
|
module.exports = Axios;
|
|
12568
12696
|
|
|
12569
|
-
},{"./../defaults":
|
|
12697
|
+
},{"./../defaults":76,"./../utils":87,"./InterceptorManager":70,"./dispatchRequest":72}],70:[function(require,module,exports){
|
|
12570
12698
|
'use strict';
|
|
12571
12699
|
|
|
12572
12700
|
var utils = require('./../utils');
|
|
@@ -12620,7 +12748,7 @@ InterceptorManager.prototype.forEach = function forEach(fn) {
|
|
|
12620
12748
|
|
|
12621
12749
|
module.exports = InterceptorManager;
|
|
12622
12750
|
|
|
12623
|
-
},{"./../utils":
|
|
12751
|
+
},{"./../utils":87}],71:[function(require,module,exports){
|
|
12624
12752
|
'use strict';
|
|
12625
12753
|
|
|
12626
12754
|
var enhanceError = require('./enhanceError');
|
|
@@ -12640,7 +12768,7 @@ module.exports = function createError(message, config, code, request, response)
|
|
|
12640
12768
|
return enhanceError(error, config, code, request, response);
|
|
12641
12769
|
};
|
|
12642
12770
|
|
|
12643
|
-
},{"./enhanceError":
|
|
12771
|
+
},{"./enhanceError":73}],72:[function(require,module,exports){
|
|
12644
12772
|
'use strict';
|
|
12645
12773
|
|
|
12646
12774
|
var utils = require('./../utils');
|
|
@@ -12728,7 +12856,7 @@ module.exports = function dispatchRequest(config) {
|
|
|
12728
12856
|
});
|
|
12729
12857
|
};
|
|
12730
12858
|
|
|
12731
|
-
},{"../cancel/isCancel":
|
|
12859
|
+
},{"../cancel/isCancel":68,"../defaults":76,"./../helpers/combineURLs":80,"./../helpers/isAbsoluteURL":82,"./../utils":87,"./transformData":75}],73:[function(require,module,exports){
|
|
12732
12860
|
'use strict';
|
|
12733
12861
|
|
|
12734
12862
|
/**
|
|
@@ -12751,7 +12879,7 @@ module.exports = function enhanceError(error, config, code, request, response) {
|
|
|
12751
12879
|
return error;
|
|
12752
12880
|
};
|
|
12753
12881
|
|
|
12754
|
-
},{}],
|
|
12882
|
+
},{}],74:[function(require,module,exports){
|
|
12755
12883
|
'use strict';
|
|
12756
12884
|
|
|
12757
12885
|
var createError = require('./createError');
|
|
@@ -12779,7 +12907,7 @@ module.exports = function settle(resolve, reject, response) {
|
|
|
12779
12907
|
}
|
|
12780
12908
|
};
|
|
12781
12909
|
|
|
12782
|
-
},{"./createError":
|
|
12910
|
+
},{"./createError":71}],75:[function(require,module,exports){
|
|
12783
12911
|
'use strict';
|
|
12784
12912
|
|
|
12785
12913
|
var utils = require('./../utils');
|
|
@@ -12801,7 +12929,7 @@ module.exports = function transformData(data, headers, fns) {
|
|
|
12801
12929
|
return data;
|
|
12802
12930
|
};
|
|
12803
12931
|
|
|
12804
|
-
},{"./../utils":
|
|
12932
|
+
},{"./../utils":87}],76:[function(require,module,exports){
|
|
12805
12933
|
(function (process){
|
|
12806
12934
|
'use strict';
|
|
12807
12935
|
|
|
@@ -12897,7 +13025,7 @@ utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
|
12897
13025
|
module.exports = defaults;
|
|
12898
13026
|
|
|
12899
13027
|
}).call(this,require('_process'))
|
|
12900
|
-
},{"./adapters/http":
|
|
13028
|
+
},{"./adapters/http":64,"./adapters/xhr":64,"./helpers/normalizeHeaderName":84,"./utils":87,"_process":89}],77:[function(require,module,exports){
|
|
12901
13029
|
'use strict';
|
|
12902
13030
|
|
|
12903
13031
|
module.exports = function bind(fn, thisArg) {
|
|
@@ -12910,7 +13038,7 @@ module.exports = function bind(fn, thisArg) {
|
|
|
12910
13038
|
};
|
|
12911
13039
|
};
|
|
12912
13040
|
|
|
12913
|
-
},{}],
|
|
13041
|
+
},{}],78:[function(require,module,exports){
|
|
12914
13042
|
'use strict';
|
|
12915
13043
|
|
|
12916
13044
|
// btoa polyfill for IE<10 courtesy https://github.com/davidchambers/Base64.js
|
|
@@ -12948,7 +13076,7 @@ function btoa(input) {
|
|
|
12948
13076
|
|
|
12949
13077
|
module.exports = btoa;
|
|
12950
13078
|
|
|
12951
|
-
},{}],
|
|
13079
|
+
},{}],79:[function(require,module,exports){
|
|
12952
13080
|
'use strict';
|
|
12953
13081
|
|
|
12954
13082
|
var utils = require('./../utils');
|
|
@@ -13018,7 +13146,7 @@ module.exports = function buildURL(url, params, paramsSerializer) {
|
|
|
13018
13146
|
return url;
|
|
13019
13147
|
};
|
|
13020
13148
|
|
|
13021
|
-
},{"./../utils":
|
|
13149
|
+
},{"./../utils":87}],80:[function(require,module,exports){
|
|
13022
13150
|
'use strict';
|
|
13023
13151
|
|
|
13024
13152
|
/**
|
|
@@ -13034,7 +13162,7 @@ module.exports = function combineURLs(baseURL, relativeURL) {
|
|
|
13034
13162
|
: baseURL;
|
|
13035
13163
|
};
|
|
13036
13164
|
|
|
13037
|
-
},{}],
|
|
13165
|
+
},{}],81:[function(require,module,exports){
|
|
13038
13166
|
'use strict';
|
|
13039
13167
|
|
|
13040
13168
|
var utils = require('./../utils');
|
|
@@ -13089,7 +13217,7 @@ module.exports = (
|
|
|
13089
13217
|
})()
|
|
13090
13218
|
);
|
|
13091
13219
|
|
|
13092
|
-
},{"./../utils":
|
|
13220
|
+
},{"./../utils":87}],82:[function(require,module,exports){
|
|
13093
13221
|
'use strict';
|
|
13094
13222
|
|
|
13095
13223
|
/**
|
|
@@ -13105,7 +13233,7 @@ module.exports = function isAbsoluteURL(url) {
|
|
|
13105
13233
|
return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
|
|
13106
13234
|
};
|
|
13107
13235
|
|
|
13108
|
-
},{}],
|
|
13236
|
+
},{}],83:[function(require,module,exports){
|
|
13109
13237
|
'use strict';
|
|
13110
13238
|
|
|
13111
13239
|
var utils = require('./../utils');
|
|
@@ -13175,7 +13303,7 @@ module.exports = (
|
|
|
13175
13303
|
})()
|
|
13176
13304
|
);
|
|
13177
13305
|
|
|
13178
|
-
},{"./../utils":
|
|
13306
|
+
},{"./../utils":87}],84:[function(require,module,exports){
|
|
13179
13307
|
'use strict';
|
|
13180
13308
|
|
|
13181
13309
|
var utils = require('../utils');
|
|
@@ -13189,7 +13317,7 @@ module.exports = function normalizeHeaderName(headers, normalizedName) {
|
|
|
13189
13317
|
});
|
|
13190
13318
|
};
|
|
13191
13319
|
|
|
13192
|
-
},{"../utils":
|
|
13320
|
+
},{"../utils":87}],85:[function(require,module,exports){
|
|
13193
13321
|
'use strict';
|
|
13194
13322
|
|
|
13195
13323
|
var utils = require('./../utils');
|
|
@@ -13244,7 +13372,7 @@ module.exports = function parseHeaders(headers) {
|
|
|
13244
13372
|
return parsed;
|
|
13245
13373
|
};
|
|
13246
13374
|
|
|
13247
|
-
},{"./../utils":
|
|
13375
|
+
},{"./../utils":87}],86:[function(require,module,exports){
|
|
13248
13376
|
'use strict';
|
|
13249
13377
|
|
|
13250
13378
|
/**
|
|
@@ -13273,7 +13401,7 @@ module.exports = function spread(callback) {
|
|
|
13273
13401
|
};
|
|
13274
13402
|
};
|
|
13275
13403
|
|
|
13276
|
-
},{}],
|
|
13404
|
+
},{}],87:[function(require,module,exports){
|
|
13277
13405
|
'use strict';
|
|
13278
13406
|
|
|
13279
13407
|
var bind = require('./helpers/bind');
|
|
@@ -13578,7 +13706,7 @@ module.exports = {
|
|
|
13578
13706
|
trim: trim
|
|
13579
13707
|
};
|
|
13580
13708
|
|
|
13581
|
-
},{"./helpers/bind":
|
|
13709
|
+
},{"./helpers/bind":77,"is-buffer":90}],88:[function(require,module,exports){
|
|
13582
13710
|
/*
|
|
13583
13711
|
* big.js v5.0.3
|
|
13584
13712
|
* A small, fast, easy-to-use library for arbitrary-precision decimal arithmetic.
|
|
@@ -14519,7 +14647,7 @@ module.exports = {
|
|
|
14519
14647
|
}
|
|
14520
14648
|
})(this);
|
|
14521
14649
|
|
|
14522
|
-
},{}],
|
|
14650
|
+
},{}],89:[function(require,module,exports){
|
|
14523
14651
|
// shim for using process in browser
|
|
14524
14652
|
var process = module.exports = {};
|
|
14525
14653
|
|
|
@@ -14705,7 +14833,7 @@ process.chdir = function (dir) {
|
|
|
14705
14833
|
};
|
|
14706
14834
|
process.umask = function() { return 0; };
|
|
14707
14835
|
|
|
14708
|
-
},{}],
|
|
14836
|
+
},{}],90:[function(require,module,exports){
|
|
14709
14837
|
/*!
|
|
14710
14838
|
* Determine if an object is a Buffer
|
|
14711
14839
|
*
|
|
@@ -14728,7 +14856,7 @@ function isSlowBuffer (obj) {
|
|
|
14728
14856
|
return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
|
|
14729
14857
|
}
|
|
14730
14858
|
|
|
14731
|
-
},{}],
|
|
14859
|
+
},{}],91:[function(require,module,exports){
|
|
14732
14860
|
//! moment-timezone.js
|
|
14733
14861
|
//! version : 0.5.11
|
|
14734
14862
|
//! Copyright (c) JS Foundation and other contributors
|
|
@@ -15930,7 +16058,7 @@ function isSlowBuffer (obj) {
|
|
|
15930
16058
|
return moment;
|
|
15931
16059
|
}));
|
|
15932
16060
|
|
|
15933
|
-
},{"moment":
|
|
16061
|
+
},{"moment":95}],92:[function(require,module,exports){
|
|
15934
16062
|
module.exports={
|
|
15935
16063
|
"version": "2016j",
|
|
15936
16064
|
"zones": [
|
|
@@ -16530,11 +16658,11 @@ module.exports={
|
|
|
16530
16658
|
"Pacific/Pohnpei|Pacific/Ponape"
|
|
16531
16659
|
]
|
|
16532
16660
|
}
|
|
16533
|
-
},{}],
|
|
16661
|
+
},{}],93:[function(require,module,exports){
|
|
16534
16662
|
var moment = module.exports = require("./moment-timezone");
|
|
16535
16663
|
moment.tz.load(require('./data/packed/latest.json'));
|
|
16536
16664
|
|
|
16537
|
-
},{"./data/packed/latest.json":
|
|
16665
|
+
},{"./data/packed/latest.json":92,"./moment-timezone":94}],94:[function(require,module,exports){
|
|
16538
16666
|
//! moment-timezone.js
|
|
16539
16667
|
//! version : 0.5.11
|
|
16540
16668
|
//! Copyright (c) JS Foundation and other contributors
|
|
@@ -17137,7 +17265,7 @@ moment.tz.load(require('./data/packed/latest.json'));
|
|
|
17137
17265
|
return moment;
|
|
17138
17266
|
}));
|
|
17139
17267
|
|
|
17140
|
-
},{"moment":
|
|
17268
|
+
},{"moment":95}],95:[function(require,module,exports){
|
|
17141
17269
|
//! moment.js
|
|
17142
17270
|
|
|
17143
17271
|
;(function (global, factory) {
|
|
@@ -21645,7 +21773,7 @@ moment.tz.load(require('./data/packed/latest.json'));
|
|
|
21645
21773
|
|
|
21646
21774
|
})));
|
|
21647
21775
|
|
|
21648
|
-
},{}],
|
|
21776
|
+
},{}],96:[function(require,module,exports){
|
|
21649
21777
|
var v1 = require('./v1');
|
|
21650
21778
|
var v4 = require('./v4');
|
|
21651
21779
|
|
|
@@ -21655,7 +21783,7 @@ uuid.v4 = v4;
|
|
|
21655
21783
|
|
|
21656
21784
|
module.exports = uuid;
|
|
21657
21785
|
|
|
21658
|
-
},{"./v1":
|
|
21786
|
+
},{"./v1":99,"./v4":100}],97:[function(require,module,exports){
|
|
21659
21787
|
/**
|
|
21660
21788
|
* Convert array of 16 byte values to UUID string format of the form:
|
|
21661
21789
|
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
|
@@ -21680,7 +21808,7 @@ function bytesToUuid(buf, offset) {
|
|
|
21680
21808
|
|
|
21681
21809
|
module.exports = bytesToUuid;
|
|
21682
21810
|
|
|
21683
|
-
},{}],
|
|
21811
|
+
},{}],98:[function(require,module,exports){
|
|
21684
21812
|
(function (global){
|
|
21685
21813
|
// Unique ID creation requires a high quality random # generator. In the
|
|
21686
21814
|
// browser this is a little complicated due to unknown quality of Math.random()
|
|
@@ -21717,7 +21845,7 @@ if (!rng) {
|
|
|
21717
21845
|
module.exports = rng;
|
|
21718
21846
|
|
|
21719
21847
|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
|
21720
|
-
},{}],
|
|
21848
|
+
},{}],99:[function(require,module,exports){
|
|
21721
21849
|
var rng = require('./lib/rng');
|
|
21722
21850
|
var bytesToUuid = require('./lib/bytesToUuid');
|
|
21723
21851
|
|
|
@@ -21819,7 +21947,7 @@ function v1(options, buf, offset) {
|
|
|
21819
21947
|
|
|
21820
21948
|
module.exports = v1;
|
|
21821
21949
|
|
|
21822
|
-
},{"./lib/bytesToUuid":
|
|
21950
|
+
},{"./lib/bytesToUuid":97,"./lib/rng":98}],100:[function(require,module,exports){
|
|
21823
21951
|
var rng = require('./lib/rng');
|
|
21824
21952
|
var bytesToUuid = require('./lib/bytesToUuid');
|
|
21825
21953
|
|
|
@@ -21850,5 +21978,5 @@ function v4(options, buf, offset) {
|
|
|
21850
21978
|
|
|
21851
21979
|
module.exports = v4;
|
|
21852
21980
|
|
|
21853
|
-
},{"./lib/bytesToUuid":
|
|
21981
|
+
},{"./lib/bytesToUuid":97,"./lib/rng":98}]},{},[1,5])(5)
|
|
21854
21982
|
});
|
|
@@ -9,6 +9,7 @@ const TransactionType = require('@barchart/portfolio-api-common/lib/data/Transac
|
|
|
9
9
|
|
|
10
10
|
const PortfolioSchema = require('@barchart/portfolio-api-common/lib/serialization/PortfolioSchema'),
|
|
11
11
|
PositionSummarySchema = require('@barchart/portfolio-api-common/lib/serialization/PositionSummarySchema'),
|
|
12
|
+
PositionSummaryDefinitionSchema = require('@barchart/portfolio-api-common/lib/serialization/PositionSummaryDefinitionSchema'),
|
|
12
13
|
PositionSchema = require('@barchart/portfolio-api-common/lib/serialization/PositionSchema'),
|
|
13
14
|
TransactionSchema = require('@barchart/portfolio-api-common/lib/serialization/TransactionSchema');
|
|
14
15
|
|
|
@@ -196,6 +197,26 @@ module.exports = (() => {
|
|
|
196
197
|
.withErrorInterceptor(ErrorInterceptor.GENERAL)
|
|
197
198
|
.endpoint;
|
|
198
199
|
|
|
200
|
+
this._readPositionSummaryDefinitionEndpoint = EndpointBuilder.for('read-position-summary-definitions', 'read position summary definitions')
|
|
201
|
+
.withVerb(VerbType.GET)
|
|
202
|
+
.withProtocol(protocolType)
|
|
203
|
+
.withHost(host)
|
|
204
|
+
.withPort(port)
|
|
205
|
+
.withPathBuilder((pb) => {
|
|
206
|
+
pb.withLiteralParameter('portfolios', 'portfolios')
|
|
207
|
+
.withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
|
|
208
|
+
.withLiteralParameter('summaries', 'summaries')
|
|
209
|
+
.withLiteralParameter('ranges', 'ranges');
|
|
210
|
+
})
|
|
211
|
+
.withQueryBuilder((qb) => {
|
|
212
|
+
qb.withVariableParameter('frames', 'frames', 'frames', true, frames => frames.map(f => f.code).join());
|
|
213
|
+
})
|
|
214
|
+
.withRequestInterceptor(requestInterceptorToUse)
|
|
215
|
+
.withRequestInterceptor(RequestInterceptor.PLAIN_TEXT_RESPONSE)
|
|
216
|
+
.withResponseInterceptor(responseInterceptorForPositionSummaryDefinitionDeserialization)
|
|
217
|
+
.withErrorInterceptor(ErrorInterceptor.GENERAL)
|
|
218
|
+
.endpoint;
|
|
219
|
+
|
|
199
220
|
this._readTransactionsEndpoint = EndpointBuilder.for('read-transactions', 'read transactions')
|
|
200
221
|
.withVerb(VerbType.GET)
|
|
201
222
|
.withProtocol(protocolType)
|
|
@@ -320,7 +341,7 @@ module.exports = (() => {
|
|
|
320
341
|
.withVariableParameter('page', 'page', 'page', true)
|
|
321
342
|
.withVariableParameter('sequence', 'sequence', 'sequence', true)
|
|
322
343
|
.withVariableParameter('count', 'count', 'count', true)
|
|
323
|
-
.withVariableParameter('descending', 'descending', 'descending', true)
|
|
344
|
+
.withVariableParameter('descending', 'descending', 'descending', true);
|
|
324
345
|
})
|
|
325
346
|
.withRequestInterceptor(requestInterceptorToUse)
|
|
326
347
|
.withResponseInterceptor(ResponseInterceptor.DATA)
|
|
@@ -384,7 +405,7 @@ module.exports = (() => {
|
|
|
384
405
|
}
|
|
385
406
|
|
|
386
407
|
/**
|
|
387
|
-
* Creates a portfolio
|
|
408
|
+
* Creates a portfolio.
|
|
388
409
|
*
|
|
389
410
|
* @public
|
|
390
411
|
* @param {Object} portfolio
|
|
@@ -421,7 +442,7 @@ module.exports = (() => {
|
|
|
421
442
|
}
|
|
422
443
|
|
|
423
444
|
/**
|
|
424
|
-
* Updates a portfolio
|
|
445
|
+
* Updates a portfolio.
|
|
425
446
|
*
|
|
426
447
|
* @public
|
|
427
448
|
* @param {Object} portfolio
|
|
@@ -439,7 +460,7 @@ module.exports = (() => {
|
|
|
439
460
|
}
|
|
440
461
|
|
|
441
462
|
/**
|
|
442
|
-
* Deletes a portfolio
|
|
463
|
+
* Deletes a portfolio.
|
|
443
464
|
*
|
|
444
465
|
* @public
|
|
445
466
|
* @param {String} portfolio - ID of the portfolio to update
|
|
@@ -479,7 +500,7 @@ module.exports = (() => {
|
|
|
479
500
|
}
|
|
480
501
|
|
|
481
502
|
/**
|
|
482
|
-
* Updates a position
|
|
503
|
+
* Updates a position.
|
|
483
504
|
*
|
|
484
505
|
* @public
|
|
485
506
|
* @param {Object} position
|
|
@@ -606,6 +627,27 @@ module.exports = (() => {
|
|
|
606
627
|
});
|
|
607
628
|
}
|
|
608
629
|
|
|
630
|
+
/**
|
|
631
|
+
* Returns all position summary definitions for a portfolio.
|
|
632
|
+
*
|
|
633
|
+
* @public
|
|
634
|
+
* @param {String} portfolio
|
|
635
|
+
* @param {Array.<PositionSummaryFrame>} frames
|
|
636
|
+
*/
|
|
637
|
+
readPositionSummaryDefinitions(portfolio, frames) {
|
|
638
|
+
return Promise.resolve()
|
|
639
|
+
.then(() => {
|
|
640
|
+
assert.argumentIsRequired(portfolio, 'portfolio', String);
|
|
641
|
+
|
|
642
|
+
const query = { };
|
|
643
|
+
|
|
644
|
+
query.portfolio = portfolio;
|
|
645
|
+
query.frames = frames;
|
|
646
|
+
|
|
647
|
+
return Gateway.invoke(this._readPositionSummaryDefinitionEndpoint, query);
|
|
648
|
+
});
|
|
649
|
+
}
|
|
650
|
+
|
|
609
651
|
/**
|
|
610
652
|
* Deletes a position.
|
|
611
653
|
*
|
|
@@ -1005,6 +1047,14 @@ module.exports = (() => {
|
|
|
1005
1047
|
}
|
|
1006
1048
|
});
|
|
1007
1049
|
|
|
1050
|
+
const responseInterceptorForPositionSummaryDefinitionDeserialization = ResponseInterceptor.fromDelegate((response, ignored) => {
|
|
1051
|
+
try {
|
|
1052
|
+
return JSON.parse(response.data, PositionSummaryDefinitionSchema.CLIENT.schema.getReviver());
|
|
1053
|
+
} catch (e) {
|
|
1054
|
+
console.log('Error deserializing position summary definition', e);
|
|
1055
|
+
}
|
|
1056
|
+
});
|
|
1057
|
+
|
|
1008
1058
|
const responseInterceptorForTransactionDeserialization = ResponseInterceptor.fromDelegate((response, ignored) => {
|
|
1009
1059
|
try {
|
|
1010
1060
|
return JSON.parse(response.data, TransactionSchema.CLIENT.schema.getReviver());
|
package/lib/index.js
CHANGED