@barchart/portfolio-client-js 1.2.25 → 1.2.28
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 +214 -82
- package/lib/gateway/PortfolioGateway.js +60 -6
- 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
|
|
|
@@ -803,21 +839,23 @@ module.exports = function () {
|
|
|
803
839
|
* @param {String=} position
|
|
804
840
|
* @param {Day=} startDay
|
|
805
841
|
* @param {Day=} endDay
|
|
842
|
+
* @oaram {Boolean=} descending
|
|
806
843
|
* @returns {Promise.<Object[]>}
|
|
807
844
|
*/
|
|
808
845
|
|
|
809
846
|
}, {
|
|
810
847
|
key: 'readTransactionsFormatted',
|
|
811
|
-
value: function readTransactionsFormatted(portfolio, position, startDay, endDay) {
|
|
812
|
-
var
|
|
848
|
+
value: function readTransactionsFormatted(portfolio, position, startDay, endDay, descending) {
|
|
849
|
+
var _this19 = this;
|
|
813
850
|
|
|
814
851
|
return Promise.resolve().then(function () {
|
|
815
|
-
checkStart.call(
|
|
852
|
+
checkStart.call(_this19);
|
|
816
853
|
|
|
817
854
|
assert.argumentIsRequired(portfolio, 'portfolio', String);
|
|
818
855
|
assert.argumentIsOptional(position, 'position', String);
|
|
819
856
|
assert.argumentIsOptional(startDay, 'startDay', Day, 'Day');
|
|
820
857
|
assert.argumentIsOptional(endDay, 'endDay', Day, 'Day');
|
|
858
|
+
assert.argumentIsOptional(descending, 'descending', Boolean);
|
|
821
859
|
|
|
822
860
|
var payload = {};
|
|
823
861
|
|
|
@@ -832,16 +870,18 @@ module.exports = function () {
|
|
|
832
870
|
payload.end = endDay;
|
|
833
871
|
}
|
|
834
872
|
|
|
835
|
-
|
|
873
|
+
payload.descending = is.boolean(descending) && descending;
|
|
874
|
+
|
|
875
|
+
return Gateway.invoke(_this19._readTransactionsReportEndpoint, payload);
|
|
836
876
|
});
|
|
837
877
|
}
|
|
838
878
|
}, {
|
|
839
879
|
key: 'readTransactionsFormattedPage',
|
|
840
880
|
value: function readTransactionsFormattedPage(portfolio, position, sequence, count, descending) {
|
|
841
|
-
var
|
|
881
|
+
var _this20 = this;
|
|
842
882
|
|
|
843
883
|
return Promise.resolve().then(function () {
|
|
844
|
-
checkStart.call(
|
|
884
|
+
checkStart.call(_this20);
|
|
845
885
|
|
|
846
886
|
assert.argumentIsRequired(portfolio, 'portfolio', String);
|
|
847
887
|
assert.argumentIsRequired(position, 'position', String);
|
|
@@ -866,7 +906,7 @@ module.exports = function () {
|
|
|
866
906
|
|
|
867
907
|
payload.descending = is.boolean(descending) && descending;
|
|
868
908
|
|
|
869
|
-
return Gateway.invoke(
|
|
909
|
+
return Gateway.invoke(_this20._readTransactionsReportEndpoint, payload);
|
|
870
910
|
});
|
|
871
911
|
}
|
|
872
912
|
|
|
@@ -1039,6 +1079,14 @@ module.exports = function () {
|
|
|
1039
1079
|
}
|
|
1040
1080
|
});
|
|
1041
1081
|
|
|
1082
|
+
var responseInterceptorForPositionSummaryDefinitionDeserialization = ResponseInterceptor.fromDelegate(function (response, ignored) {
|
|
1083
|
+
try {
|
|
1084
|
+
return JSON.parse(response.data, PositionSummaryDefinitionSchema.COMPLETE.schema.getReviver());
|
|
1085
|
+
} catch (e) {
|
|
1086
|
+
console.log('Error deserializing position summary definition', e);
|
|
1087
|
+
}
|
|
1088
|
+
});
|
|
1089
|
+
|
|
1042
1090
|
var responseInterceptorForTransactionDeserialization = ResponseInterceptor.fromDelegate(function (response, ignored) {
|
|
1043
1091
|
try {
|
|
1044
1092
|
return JSON.parse(response.data, TransactionSchema.CLIENT.schema.getReviver());
|
|
@@ -1106,7 +1154,7 @@ module.exports = function () {
|
|
|
1106
1154
|
return PortfolioGateway;
|
|
1107
1155
|
}();
|
|
1108
1156
|
|
|
1109
|
-
},{"./../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){
|
|
1110
1158
|
'use strict';
|
|
1111
1159
|
|
|
1112
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; }; }();
|
|
@@ -1457,7 +1505,7 @@ module.exports = function () {
|
|
|
1457
1505
|
return {
|
|
1458
1506
|
JwtGateway: JwtGateway,
|
|
1459
1507
|
PortfolioGateway: PortfolioGateway,
|
|
1460
|
-
version: '1.2.
|
|
1508
|
+
version: '1.2.28'
|
|
1461
1509
|
};
|
|
1462
1510
|
}();
|
|
1463
1511
|
|
|
@@ -2213,7 +2261,7 @@ module.exports = function () {
|
|
|
2213
2261
|
return Gateway;
|
|
2214
2262
|
}();
|
|
2215
2263
|
|
|
2216
|
-
},{"./../../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){
|
|
2217
2265
|
'use strict';
|
|
2218
2266
|
|
|
2219
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; }; }();
|
|
@@ -6281,7 +6329,7 @@ module.exports = function () {
|
|
|
6281
6329
|
return Decimal;
|
|
6282
6330
|
}();
|
|
6283
6331
|
|
|
6284
|
-
},{"./Enum":32,"./assert":37,"./is":40,"big.js":
|
|
6332
|
+
},{"./Enum":32,"./assert":37,"./is":40,"big.js":88}],31:[function(require,module,exports){
|
|
6285
6333
|
'use strict';
|
|
6286
6334
|
|
|
6287
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; }; }();
|
|
@@ -6840,7 +6888,7 @@ module.exports = function () {
|
|
|
6840
6888
|
return Timestamp;
|
|
6841
6889
|
}();
|
|
6842
6890
|
|
|
6843
|
-
},{"./assert":37,"./is":40,"moment-timezone":
|
|
6891
|
+
},{"./assert":37,"./is":40,"moment-timezone":93}],35:[function(require,module,exports){
|
|
6844
6892
|
'use strict';
|
|
6845
6893
|
|
|
6846
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; }; }();
|
|
@@ -8397,7 +8445,7 @@ module.exports = function () {
|
|
|
8397
8445
|
};
|
|
8398
8446
|
}();
|
|
8399
8447
|
|
|
8400
|
-
},{"./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){
|
|
8401
8449
|
'use strict';
|
|
8402
8450
|
|
|
8403
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; }; }();
|
|
@@ -8873,7 +8921,7 @@ module.exports = function () {
|
|
|
8873
8921
|
return DataType;
|
|
8874
8922
|
}();
|
|
8875
8923
|
|
|
8876
|
-
},{"./../../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){
|
|
8877
8925
|
'use strict';
|
|
8878
8926
|
|
|
8879
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; }; }();
|
|
@@ -10065,7 +10113,7 @@ module.exports = (() => {
|
|
|
10065
10113
|
return InstrumentType;
|
|
10066
10114
|
})();
|
|
10067
10115
|
|
|
10068
|
-
},{"@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){
|
|
10069
10117
|
const assert = require('@barchart/common-js/lang/assert'),
|
|
10070
10118
|
Decimal = require('@barchart/common-js/lang/Decimal'),
|
|
10071
10119
|
Enum = require('@barchart/common-js/lang/Enum');
|
|
@@ -10284,6 +10332,19 @@ module.exports = (() => {
|
|
|
10284
10332
|
return this._rangeCalculator(getFilteredTransactions(transactions));
|
|
10285
10333
|
}
|
|
10286
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
|
+
|
|
10287
10348
|
/**
|
|
10288
10349
|
* Returns the start date for a frame, a given number of periods ago.
|
|
10289
10350
|
*
|
|
@@ -10356,6 +10417,16 @@ module.exports = (() => {
|
|
|
10356
10417
|
* @property {Day} end
|
|
10357
10418
|
*/
|
|
10358
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
|
+
|
|
10359
10430
|
function getRange(start, end) {
|
|
10360
10431
|
return {
|
|
10361
10432
|
start: start,
|
|
@@ -11222,6 +11293,7 @@ module.exports = (() => {
|
|
|
11222
11293
|
.withField('legacy.portfolio', DataType.STRING, true)
|
|
11223
11294
|
.withField('legacy.position', DataType.STRING, true)
|
|
11224
11295
|
.withField('system.version', DataType.NUMBER, true)
|
|
11296
|
+
.withField('system.locked', DataType.BOOLEAN, true)
|
|
11225
11297
|
.withField('root', DataType.STRING, true)
|
|
11226
11298
|
.schema
|
|
11227
11299
|
);
|
|
@@ -11251,6 +11323,7 @@ module.exports = (() => {
|
|
|
11251
11323
|
.withField('snapshot.basis', DataType.DECIMAL)
|
|
11252
11324
|
.withField('snapshot.income', DataType.DECIMAL)
|
|
11253
11325
|
.withField('snapshot.value', DataType.DECIMAL)
|
|
11326
|
+
.withField('system.locked', DataType.BOOLEAN, true)
|
|
11254
11327
|
.withField('previous', DataType.NUMBER, true)
|
|
11255
11328
|
.schema
|
|
11256
11329
|
);
|
|
@@ -11272,8 +11345,67 @@ module.exports = (() => {
|
|
|
11272
11345
|
})();
|
|
11273
11346
|
|
|
11274
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){
|
|
11275
|
-
const
|
|
11276
|
-
|
|
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'),
|
|
11277
11409
|
Enum = require('@barchart/common-js/lang/Enum'),
|
|
11278
11410
|
Schema = require('@barchart/common-js/serialization/json/Schema'),
|
|
11279
11411
|
SchemaBuilder = require('@barchart/common-js/serialization/json/builders/SchemaBuilder');
|
|
@@ -11389,7 +11521,7 @@ module.exports = (() => {
|
|
|
11389
11521
|
return PositionSummarySchema;
|
|
11390
11522
|
})();
|
|
11391
11523
|
|
|
11392
|
-
},{"./../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){
|
|
11393
11525
|
const is = require('@barchart/common-js/lang/is'),
|
|
11394
11526
|
Currency = require('@barchart/common-js/lang/Currency'),
|
|
11395
11527
|
DataType = require('@barchart/common-js/serialization/json/DataType'),
|
|
@@ -11745,7 +11877,7 @@ module.exports = (() => {
|
|
|
11745
11877
|
return TransactionSchema;
|
|
11746
11878
|
})();
|
|
11747
11879
|
|
|
11748
|
-
},{"./../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){
|
|
11749
11881
|
'use strict';
|
|
11750
11882
|
|
|
11751
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; }; }();
|
|
@@ -12143,7 +12275,7 @@ module.exports = function () {
|
|
|
12143
12275
|
return JwtGateway;
|
|
12144
12276
|
}();
|
|
12145
12277
|
|
|
12146
|
-
},{"./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){
|
|
12147
12279
|
'use strict';
|
|
12148
12280
|
|
|
12149
12281
|
module.exports = function () {
|
|
@@ -12154,9 +12286,9 @@ module.exports = function () {
|
|
|
12154
12286
|
};
|
|
12155
12287
|
}();
|
|
12156
12288
|
|
|
12157
|
-
},{}],
|
|
12289
|
+
},{}],63:[function(require,module,exports){
|
|
12158
12290
|
module.exports = require('./lib/axios');
|
|
12159
|
-
},{"./lib/axios":
|
|
12291
|
+
},{"./lib/axios":65}],64:[function(require,module,exports){
|
|
12160
12292
|
(function (process){
|
|
12161
12293
|
'use strict';
|
|
12162
12294
|
|
|
@@ -12340,7 +12472,7 @@ module.exports = function xhrAdapter(config) {
|
|
|
12340
12472
|
};
|
|
12341
12473
|
|
|
12342
12474
|
}).call(this,require('_process'))
|
|
12343
|
-
},{"../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){
|
|
12344
12476
|
'use strict';
|
|
12345
12477
|
|
|
12346
12478
|
var utils = require('./utils');
|
|
@@ -12394,7 +12526,7 @@ module.exports = axios;
|
|
|
12394
12526
|
// Allow use of default import syntax in TypeScript
|
|
12395
12527
|
module.exports.default = axios;
|
|
12396
12528
|
|
|
12397
|
-
},{"./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){
|
|
12398
12530
|
'use strict';
|
|
12399
12531
|
|
|
12400
12532
|
/**
|
|
@@ -12415,7 +12547,7 @@ Cancel.prototype.__CANCEL__ = true;
|
|
|
12415
12547
|
|
|
12416
12548
|
module.exports = Cancel;
|
|
12417
12549
|
|
|
12418
|
-
},{}],
|
|
12550
|
+
},{}],67:[function(require,module,exports){
|
|
12419
12551
|
'use strict';
|
|
12420
12552
|
|
|
12421
12553
|
var Cancel = require('./Cancel');
|
|
@@ -12474,14 +12606,14 @@ CancelToken.source = function source() {
|
|
|
12474
12606
|
|
|
12475
12607
|
module.exports = CancelToken;
|
|
12476
12608
|
|
|
12477
|
-
},{"./Cancel":
|
|
12609
|
+
},{"./Cancel":66}],68:[function(require,module,exports){
|
|
12478
12610
|
'use strict';
|
|
12479
12611
|
|
|
12480
12612
|
module.exports = function isCancel(value) {
|
|
12481
12613
|
return !!(value && value.__CANCEL__);
|
|
12482
12614
|
};
|
|
12483
12615
|
|
|
12484
|
-
},{}],
|
|
12616
|
+
},{}],69:[function(require,module,exports){
|
|
12485
12617
|
'use strict';
|
|
12486
12618
|
|
|
12487
12619
|
var defaults = require('./../defaults');
|
|
@@ -12562,7 +12694,7 @@ utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
|
12562
12694
|
|
|
12563
12695
|
module.exports = Axios;
|
|
12564
12696
|
|
|
12565
|
-
},{"./../defaults":
|
|
12697
|
+
},{"./../defaults":76,"./../utils":87,"./InterceptorManager":70,"./dispatchRequest":72}],70:[function(require,module,exports){
|
|
12566
12698
|
'use strict';
|
|
12567
12699
|
|
|
12568
12700
|
var utils = require('./../utils');
|
|
@@ -12616,7 +12748,7 @@ InterceptorManager.prototype.forEach = function forEach(fn) {
|
|
|
12616
12748
|
|
|
12617
12749
|
module.exports = InterceptorManager;
|
|
12618
12750
|
|
|
12619
|
-
},{"./../utils":
|
|
12751
|
+
},{"./../utils":87}],71:[function(require,module,exports){
|
|
12620
12752
|
'use strict';
|
|
12621
12753
|
|
|
12622
12754
|
var enhanceError = require('./enhanceError');
|
|
@@ -12636,7 +12768,7 @@ module.exports = function createError(message, config, code, request, response)
|
|
|
12636
12768
|
return enhanceError(error, config, code, request, response);
|
|
12637
12769
|
};
|
|
12638
12770
|
|
|
12639
|
-
},{"./enhanceError":
|
|
12771
|
+
},{"./enhanceError":73}],72:[function(require,module,exports){
|
|
12640
12772
|
'use strict';
|
|
12641
12773
|
|
|
12642
12774
|
var utils = require('./../utils');
|
|
@@ -12724,7 +12856,7 @@ module.exports = function dispatchRequest(config) {
|
|
|
12724
12856
|
});
|
|
12725
12857
|
};
|
|
12726
12858
|
|
|
12727
|
-
},{"../cancel/isCancel":
|
|
12859
|
+
},{"../cancel/isCancel":68,"../defaults":76,"./../helpers/combineURLs":80,"./../helpers/isAbsoluteURL":82,"./../utils":87,"./transformData":75}],73:[function(require,module,exports){
|
|
12728
12860
|
'use strict';
|
|
12729
12861
|
|
|
12730
12862
|
/**
|
|
@@ -12747,7 +12879,7 @@ module.exports = function enhanceError(error, config, code, request, response) {
|
|
|
12747
12879
|
return error;
|
|
12748
12880
|
};
|
|
12749
12881
|
|
|
12750
|
-
},{}],
|
|
12882
|
+
},{}],74:[function(require,module,exports){
|
|
12751
12883
|
'use strict';
|
|
12752
12884
|
|
|
12753
12885
|
var createError = require('./createError');
|
|
@@ -12775,7 +12907,7 @@ module.exports = function settle(resolve, reject, response) {
|
|
|
12775
12907
|
}
|
|
12776
12908
|
};
|
|
12777
12909
|
|
|
12778
|
-
},{"./createError":
|
|
12910
|
+
},{"./createError":71}],75:[function(require,module,exports){
|
|
12779
12911
|
'use strict';
|
|
12780
12912
|
|
|
12781
12913
|
var utils = require('./../utils');
|
|
@@ -12797,7 +12929,7 @@ module.exports = function transformData(data, headers, fns) {
|
|
|
12797
12929
|
return data;
|
|
12798
12930
|
};
|
|
12799
12931
|
|
|
12800
|
-
},{"./../utils":
|
|
12932
|
+
},{"./../utils":87}],76:[function(require,module,exports){
|
|
12801
12933
|
(function (process){
|
|
12802
12934
|
'use strict';
|
|
12803
12935
|
|
|
@@ -12893,7 +13025,7 @@ utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
|
12893
13025
|
module.exports = defaults;
|
|
12894
13026
|
|
|
12895
13027
|
}).call(this,require('_process'))
|
|
12896
|
-
},{"./adapters/http":
|
|
13028
|
+
},{"./adapters/http":64,"./adapters/xhr":64,"./helpers/normalizeHeaderName":84,"./utils":87,"_process":89}],77:[function(require,module,exports){
|
|
12897
13029
|
'use strict';
|
|
12898
13030
|
|
|
12899
13031
|
module.exports = function bind(fn, thisArg) {
|
|
@@ -12906,7 +13038,7 @@ module.exports = function bind(fn, thisArg) {
|
|
|
12906
13038
|
};
|
|
12907
13039
|
};
|
|
12908
13040
|
|
|
12909
|
-
},{}],
|
|
13041
|
+
},{}],78:[function(require,module,exports){
|
|
12910
13042
|
'use strict';
|
|
12911
13043
|
|
|
12912
13044
|
// btoa polyfill for IE<10 courtesy https://github.com/davidchambers/Base64.js
|
|
@@ -12944,7 +13076,7 @@ function btoa(input) {
|
|
|
12944
13076
|
|
|
12945
13077
|
module.exports = btoa;
|
|
12946
13078
|
|
|
12947
|
-
},{}],
|
|
13079
|
+
},{}],79:[function(require,module,exports){
|
|
12948
13080
|
'use strict';
|
|
12949
13081
|
|
|
12950
13082
|
var utils = require('./../utils');
|
|
@@ -13014,7 +13146,7 @@ module.exports = function buildURL(url, params, paramsSerializer) {
|
|
|
13014
13146
|
return url;
|
|
13015
13147
|
};
|
|
13016
13148
|
|
|
13017
|
-
},{"./../utils":
|
|
13149
|
+
},{"./../utils":87}],80:[function(require,module,exports){
|
|
13018
13150
|
'use strict';
|
|
13019
13151
|
|
|
13020
13152
|
/**
|
|
@@ -13030,7 +13162,7 @@ module.exports = function combineURLs(baseURL, relativeURL) {
|
|
|
13030
13162
|
: baseURL;
|
|
13031
13163
|
};
|
|
13032
13164
|
|
|
13033
|
-
},{}],
|
|
13165
|
+
},{}],81:[function(require,module,exports){
|
|
13034
13166
|
'use strict';
|
|
13035
13167
|
|
|
13036
13168
|
var utils = require('./../utils');
|
|
@@ -13085,7 +13217,7 @@ module.exports = (
|
|
|
13085
13217
|
})()
|
|
13086
13218
|
);
|
|
13087
13219
|
|
|
13088
|
-
},{"./../utils":
|
|
13220
|
+
},{"./../utils":87}],82:[function(require,module,exports){
|
|
13089
13221
|
'use strict';
|
|
13090
13222
|
|
|
13091
13223
|
/**
|
|
@@ -13101,7 +13233,7 @@ module.exports = function isAbsoluteURL(url) {
|
|
|
13101
13233
|
return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
|
|
13102
13234
|
};
|
|
13103
13235
|
|
|
13104
|
-
},{}],
|
|
13236
|
+
},{}],83:[function(require,module,exports){
|
|
13105
13237
|
'use strict';
|
|
13106
13238
|
|
|
13107
13239
|
var utils = require('./../utils');
|
|
@@ -13171,7 +13303,7 @@ module.exports = (
|
|
|
13171
13303
|
})()
|
|
13172
13304
|
);
|
|
13173
13305
|
|
|
13174
|
-
},{"./../utils":
|
|
13306
|
+
},{"./../utils":87}],84:[function(require,module,exports){
|
|
13175
13307
|
'use strict';
|
|
13176
13308
|
|
|
13177
13309
|
var utils = require('../utils');
|
|
@@ -13185,7 +13317,7 @@ module.exports = function normalizeHeaderName(headers, normalizedName) {
|
|
|
13185
13317
|
});
|
|
13186
13318
|
};
|
|
13187
13319
|
|
|
13188
|
-
},{"../utils":
|
|
13320
|
+
},{"../utils":87}],85:[function(require,module,exports){
|
|
13189
13321
|
'use strict';
|
|
13190
13322
|
|
|
13191
13323
|
var utils = require('./../utils');
|
|
@@ -13240,7 +13372,7 @@ module.exports = function parseHeaders(headers) {
|
|
|
13240
13372
|
return parsed;
|
|
13241
13373
|
};
|
|
13242
13374
|
|
|
13243
|
-
},{"./../utils":
|
|
13375
|
+
},{"./../utils":87}],86:[function(require,module,exports){
|
|
13244
13376
|
'use strict';
|
|
13245
13377
|
|
|
13246
13378
|
/**
|
|
@@ -13269,7 +13401,7 @@ module.exports = function spread(callback) {
|
|
|
13269
13401
|
};
|
|
13270
13402
|
};
|
|
13271
13403
|
|
|
13272
|
-
},{}],
|
|
13404
|
+
},{}],87:[function(require,module,exports){
|
|
13273
13405
|
'use strict';
|
|
13274
13406
|
|
|
13275
13407
|
var bind = require('./helpers/bind');
|
|
@@ -13574,7 +13706,7 @@ module.exports = {
|
|
|
13574
13706
|
trim: trim
|
|
13575
13707
|
};
|
|
13576
13708
|
|
|
13577
|
-
},{"./helpers/bind":
|
|
13709
|
+
},{"./helpers/bind":77,"is-buffer":90}],88:[function(require,module,exports){
|
|
13578
13710
|
/*
|
|
13579
13711
|
* big.js v5.0.3
|
|
13580
13712
|
* A small, fast, easy-to-use library for arbitrary-precision decimal arithmetic.
|
|
@@ -14515,7 +14647,7 @@ module.exports = {
|
|
|
14515
14647
|
}
|
|
14516
14648
|
})(this);
|
|
14517
14649
|
|
|
14518
|
-
},{}],
|
|
14650
|
+
},{}],89:[function(require,module,exports){
|
|
14519
14651
|
// shim for using process in browser
|
|
14520
14652
|
var process = module.exports = {};
|
|
14521
14653
|
|
|
@@ -14701,7 +14833,7 @@ process.chdir = function (dir) {
|
|
|
14701
14833
|
};
|
|
14702
14834
|
process.umask = function() { return 0; };
|
|
14703
14835
|
|
|
14704
|
-
},{}],
|
|
14836
|
+
},{}],90:[function(require,module,exports){
|
|
14705
14837
|
/*!
|
|
14706
14838
|
* Determine if an object is a Buffer
|
|
14707
14839
|
*
|
|
@@ -14724,7 +14856,7 @@ function isSlowBuffer (obj) {
|
|
|
14724
14856
|
return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
|
|
14725
14857
|
}
|
|
14726
14858
|
|
|
14727
|
-
},{}],
|
|
14859
|
+
},{}],91:[function(require,module,exports){
|
|
14728
14860
|
//! moment-timezone.js
|
|
14729
14861
|
//! version : 0.5.11
|
|
14730
14862
|
//! Copyright (c) JS Foundation and other contributors
|
|
@@ -15926,7 +16058,7 @@ function isSlowBuffer (obj) {
|
|
|
15926
16058
|
return moment;
|
|
15927
16059
|
}));
|
|
15928
16060
|
|
|
15929
|
-
},{"moment":
|
|
16061
|
+
},{"moment":95}],92:[function(require,module,exports){
|
|
15930
16062
|
module.exports={
|
|
15931
16063
|
"version": "2016j",
|
|
15932
16064
|
"zones": [
|
|
@@ -16526,11 +16658,11 @@ module.exports={
|
|
|
16526
16658
|
"Pacific/Pohnpei|Pacific/Ponape"
|
|
16527
16659
|
]
|
|
16528
16660
|
}
|
|
16529
|
-
},{}],
|
|
16661
|
+
},{}],93:[function(require,module,exports){
|
|
16530
16662
|
var moment = module.exports = require("./moment-timezone");
|
|
16531
16663
|
moment.tz.load(require('./data/packed/latest.json'));
|
|
16532
16664
|
|
|
16533
|
-
},{"./data/packed/latest.json":
|
|
16665
|
+
},{"./data/packed/latest.json":92,"./moment-timezone":94}],94:[function(require,module,exports){
|
|
16534
16666
|
//! moment-timezone.js
|
|
16535
16667
|
//! version : 0.5.11
|
|
16536
16668
|
//! Copyright (c) JS Foundation and other contributors
|
|
@@ -17133,7 +17265,7 @@ moment.tz.load(require('./data/packed/latest.json'));
|
|
|
17133
17265
|
return moment;
|
|
17134
17266
|
}));
|
|
17135
17267
|
|
|
17136
|
-
},{"moment":
|
|
17268
|
+
},{"moment":95}],95:[function(require,module,exports){
|
|
17137
17269
|
//! moment.js
|
|
17138
17270
|
|
|
17139
17271
|
;(function (global, factory) {
|
|
@@ -21641,7 +21773,7 @@ moment.tz.load(require('./data/packed/latest.json'));
|
|
|
21641
21773
|
|
|
21642
21774
|
})));
|
|
21643
21775
|
|
|
21644
|
-
},{}],
|
|
21776
|
+
},{}],96:[function(require,module,exports){
|
|
21645
21777
|
var v1 = require('./v1');
|
|
21646
21778
|
var v4 = require('./v4');
|
|
21647
21779
|
|
|
@@ -21651,7 +21783,7 @@ uuid.v4 = v4;
|
|
|
21651
21783
|
|
|
21652
21784
|
module.exports = uuid;
|
|
21653
21785
|
|
|
21654
|
-
},{"./v1":
|
|
21786
|
+
},{"./v1":99,"./v4":100}],97:[function(require,module,exports){
|
|
21655
21787
|
/**
|
|
21656
21788
|
* Convert array of 16 byte values to UUID string format of the form:
|
|
21657
21789
|
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
|
@@ -21676,7 +21808,7 @@ function bytesToUuid(buf, offset) {
|
|
|
21676
21808
|
|
|
21677
21809
|
module.exports = bytesToUuid;
|
|
21678
21810
|
|
|
21679
|
-
},{}],
|
|
21811
|
+
},{}],98:[function(require,module,exports){
|
|
21680
21812
|
(function (global){
|
|
21681
21813
|
// Unique ID creation requires a high quality random # generator. In the
|
|
21682
21814
|
// browser this is a little complicated due to unknown quality of Math.random()
|
|
@@ -21713,7 +21845,7 @@ if (!rng) {
|
|
|
21713
21845
|
module.exports = rng;
|
|
21714
21846
|
|
|
21715
21847
|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
|
21716
|
-
},{}],
|
|
21848
|
+
},{}],99:[function(require,module,exports){
|
|
21717
21849
|
var rng = require('./lib/rng');
|
|
21718
21850
|
var bytesToUuid = require('./lib/bytesToUuid');
|
|
21719
21851
|
|
|
@@ -21815,7 +21947,7 @@ function v1(options, buf, offset) {
|
|
|
21815
21947
|
|
|
21816
21948
|
module.exports = v1;
|
|
21817
21949
|
|
|
21818
|
-
},{"./lib/bytesToUuid":
|
|
21950
|
+
},{"./lib/bytesToUuid":97,"./lib/rng":98}],100:[function(require,module,exports){
|
|
21819
21951
|
var rng = require('./lib/rng');
|
|
21820
21952
|
var bytesToUuid = require('./lib/bytesToUuid');
|
|
21821
21953
|
|
|
@@ -21846,5 +21978,5 @@ function v4(options, buf, offset) {
|
|
|
21846
21978
|
|
|
21847
21979
|
module.exports = v4;
|
|
21848
21980
|
|
|
21849
|
-
},{"./lib/bytesToUuid":
|
|
21981
|
+
},{"./lib/bytesToUuid":97,"./lib/rng":98}]},{},[1,5])(5)
|
|
21850
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
|
*
|
|
@@ -786,9 +828,10 @@ module.exports = (() => {
|
|
|
786
828
|
* @param {String=} position
|
|
787
829
|
* @param {Day=} startDay
|
|
788
830
|
* @param {Day=} endDay
|
|
831
|
+
* @oaram {Boolean=} descending
|
|
789
832
|
* @returns {Promise.<Object[]>}
|
|
790
833
|
*/
|
|
791
|
-
readTransactionsFormatted(portfolio, position, startDay, endDay) {
|
|
834
|
+
readTransactionsFormatted(portfolio, position, startDay, endDay, descending) {
|
|
792
835
|
return Promise.resolve()
|
|
793
836
|
.then(() => {
|
|
794
837
|
checkStart.call(this);
|
|
@@ -797,6 +840,7 @@ module.exports = (() => {
|
|
|
797
840
|
assert.argumentIsOptional(position, 'position', String);
|
|
798
841
|
assert.argumentIsOptional(startDay, 'startDay', Day, 'Day');
|
|
799
842
|
assert.argumentIsOptional(endDay, 'endDay', Day, 'Day');
|
|
843
|
+
assert.argumentIsOptional(descending, 'descending', Boolean);
|
|
800
844
|
|
|
801
845
|
const payload = { };
|
|
802
846
|
|
|
@@ -811,6 +855,8 @@ module.exports = (() => {
|
|
|
811
855
|
payload.end = endDay;
|
|
812
856
|
}
|
|
813
857
|
|
|
858
|
+
payload.descending = is.boolean(descending) && descending;
|
|
859
|
+
|
|
814
860
|
return Gateway.invoke(this._readTransactionsReportEndpoint, payload);
|
|
815
861
|
});
|
|
816
862
|
}
|
|
@@ -1001,6 +1047,14 @@ module.exports = (() => {
|
|
|
1001
1047
|
}
|
|
1002
1048
|
});
|
|
1003
1049
|
|
|
1050
|
+
const responseInterceptorForPositionSummaryDefinitionDeserialization = ResponseInterceptor.fromDelegate((response, ignored) => {
|
|
1051
|
+
try {
|
|
1052
|
+
return JSON.parse(response.data, PositionSummaryDefinitionSchema.COMPLETE.schema.getReviver());
|
|
1053
|
+
} catch (e) {
|
|
1054
|
+
console.log('Error deserializing position summary definition', e);
|
|
1055
|
+
}
|
|
1056
|
+
});
|
|
1057
|
+
|
|
1004
1058
|
const responseInterceptorForTransactionDeserialization = ResponseInterceptor.fromDelegate((response, ignored) => {
|
|
1005
1059
|
try {
|
|
1006
1060
|
return JSON.parse(response.data, TransactionSchema.CLIENT.schema.getReviver());
|
package/lib/index.js
CHANGED