@barchart/portfolio-api-common 1.0.57 → 1.0.61

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.
@@ -7,7 +7,6 @@ const array = require('@barchart/common-js/lang/array'),
7
7
  Tree = require('@barchart/common-js/collections/Tree');
8
8
 
9
9
  const PositionGroup = require('./PositionGroup'),
10
- PositionGroupDefinition = require('./PositionGroupDefinition'),
11
10
  PositionItem = require('./PositionItem');
12
11
 
13
12
  module.exports = (() => {
@@ -77,7 +76,8 @@ module.exports = (() => {
77
76
  const currentDefinition = definitions[0];
78
77
  const additionalDefinitions = array.dropLeft(definitions);
79
78
 
80
- const populatedGroups = array.batchBy(items, currentDefinition.keySelector).map((items) => {
79
+ const populatedObjects = array.groupBy(items, currentDefinition.keySelector);
80
+ const populatedGroups = Object.keys(populatedObjects).map(key => populatedObjects[key]).map((items) => {
81
81
  const first = items[0];
82
82
 
83
83
  return new PositionGroup(items, currentDefinition.currencySelector(first), currentDefinition.descriptionSelector(first), currentDefinition.single && items.length === 1);
@@ -46,7 +46,7 @@ module.exports = (() => {
46
46
  this._dataFormat.current = null;
47
47
  }
48
48
 
49
- calculateVariablePriceData(this, item);
49
+ calculatePriceData(this, item);
50
50
  });
51
51
  });
52
52
 
@@ -85,21 +85,17 @@ module.exports = (() => {
85
85
  function calculateStaticData(group) {
86
86
  const items = group._items;
87
87
 
88
- const raw = group._dataRaw;
89
- const formatted = group._dataFormat;
90
-
91
88
  let updates;
92
89
 
93
90
  if (group.single) {
94
91
  const item = items[0];
95
92
 
93
+ updates = { };
94
+
96
95
  updates.basis = item.basis;
97
96
  } else {
98
97
  updates = items.reduce(function(updates, item) {
99
- const position = item.position;
100
- const snapshot = item.position.snapshot;
101
-
102
- updates.value = updates.basis.add(snapshot.basis);
98
+ updates.basis = updates.basis.add(item.data.basis);
103
99
 
104
100
  return updates;
105
101
  }, {
@@ -107,12 +103,39 @@ module.exports = (() => {
107
103
  });
108
104
  }
109
105
 
106
+ const raw = group._dataRaw;
107
+ const formatted = group._dataFormat;
108
+
110
109
  raw.basis = updates.basis;
111
110
  formatted.basis = format(updates.basis, Currency.USD);
112
111
  }
113
112
 
114
- function calculateVariablePriceData(group, item) {
113
+ function calculatePriceData(group) {
114
+ const items = group._items;
115
+
116
+ let updates;
117
+
118
+ if (group.single) {
119
+ updates = { };
120
+
121
+ let item = items[0];
122
+
123
+ updates.market = item.market;
124
+ } else {
125
+ updates = items.reduce(function(updates, item) {
126
+ updates.market = updates.market.add(item.data.market);
127
+
128
+ return updates;
129
+ }, {
130
+ market: Decimal.ZERO
131
+ });
132
+ }
133
+
134
+ const raw = group._dataRaw;
135
+ const formatted = group._dataFormat;
115
136
 
137
+ raw.market = updates.market;
138
+ formatted.market = format(updates.market, Currency.USD);
116
139
  }
117
140
 
118
141
  return PositionGroup;
@@ -3,6 +3,8 @@ const assert = require('@barchart/common-js/lang/assert'),
3
3
  Event = require('@barchart/common-js/messaging/Event'),
4
4
  is = require('@barchart/common-js/lang/is');
5
5
 
6
+ const InstrumentType = require('./../data/InstrumentType');
7
+
6
8
  module.exports = (() => {
7
9
  'use strict';
8
10
 
@@ -18,21 +20,11 @@ module.exports = (() => {
18
20
  this._data = { };
19
21
 
20
22
  this._data.current = null;
21
- this._data.previous = position.previous || null;
22
-
23
- const snapshot = this._position.snapshot;
24
-
25
- this._data.basis = snapshot.basis || Decimal.ZERO;
26
-
27
- /*
28
- let market;
23
+ this._data.previous = null;
24
+ this._data.basis = null;
29
25
 
30
- if (position.previous) {
31
- market = snapshot.open.multiply(position.previous);
32
- } else {
33
- market = snapshot.value;
34
- }
35
- */
26
+ calculateStaticData(this);
27
+ calculatePriceData(this, null);
36
28
 
37
29
  this._priceChangeEvent = new Event(this);
38
30
  }
@@ -49,9 +41,13 @@ module.exports = (() => {
49
41
  return this._summaries;
50
42
  }
51
43
 
44
+ get data() {
45
+ return this._data;
46
+ }
47
+
52
48
  setPrice(price) {
53
49
  if (this._data.price !== price) {
54
- this._data.price = price;
50
+ calculatePriceData(this, this._data.price = price);
55
51
 
56
52
  this._priceChangeEvent.fire(this._data);
57
53
  }
@@ -68,5 +64,47 @@ module.exports = (() => {
68
64
  }
69
65
  }
70
66
 
67
+ function calculateStaticData(item) {
68
+ const position = item.position;
69
+ const snapshot = item.position.snapshot;
70
+
71
+ const data = item._data;
72
+
73
+ data.previous = position.previous || null;
74
+
75
+ let basis;
76
+
77
+ if (snapshot.basis) {
78
+ basis = snapshot.basis.opposite();
79
+ } else {
80
+ basis = Decimal.ZERO;
81
+ }
82
+
83
+ data.basis = basis;
84
+ }
85
+
86
+ function calculatePriceData(item, price) {
87
+ const position = item.position;
88
+ const snapshot = item.position.snapshot;
89
+
90
+ const data = item._data;
91
+
92
+ let market;
93
+
94
+ if (position.instrument.type === InstrumentType.OTHER) {
95
+ market = snapshot.value;
96
+ } else if (position.instrument.type === InstrumentType.CASH) {
97
+ market = snapshot.open;
98
+ } else {
99
+ if (price) {
100
+ market = snapshot.open.multiply(price);
101
+ } else {
102
+ market = snapshot.value;
103
+ }
104
+ }
105
+
106
+ data.market = market;
107
+ }
108
+
71
109
  return PositionItem;
72
110
  })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barchart/portfolio-api-common",
3
- "version": "1.0.57",
3
+ "version": "1.0.61",
4
4
  "description": "Common classes used by the Portfolio system",
5
5
  "author": {
6
6
  "name": "Bryan Ingle",
@@ -1,4 +1,95 @@
1
1
  (function(){function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}return e})()({1:[function(require,module,exports){
2
+ const assert = require('@barchart/common-js/lang/assert'),
3
+ Enum = require('@barchart/common-js/lang/Enum');
4
+
5
+ module.exports = (() => {
6
+ 'use strict';
7
+
8
+ /**
9
+ * An enumeration used to classify instruments.
10
+ *
11
+ * @public
12
+ * @extends {Enum}
13
+ * @param {String} description
14
+ * @param {String} alternateDescription
15
+ * @param {String} code
16
+ * @param {Boolean} canReinvest
17
+ */
18
+ class InstrumentType extends Enum {
19
+ constructor(code, description, alternateDescription, canReinvest) {
20
+ super(code, description);
21
+
22
+ this._alternateDescription = alternateDescription;
23
+ this._canReinvest = canReinvest;
24
+ }
25
+
26
+ get alternateDescription() {
27
+ return this._alternateDescription;
28
+ }
29
+
30
+ /**
31
+ * Indicates if the instrument type allows automatic reinvestment.
32
+ *
33
+ * @returns {Boolean}
34
+ */
35
+ get canReinvest() {
36
+ return this._canReinvest;
37
+ }
38
+
39
+ /**
40
+ * Cash.
41
+ *
42
+ * @public
43
+ * @returns {InstrumentType}
44
+ */
45
+ static get CASH() {
46
+ return cash;
47
+ }
48
+
49
+ /**
50
+ * An equity issue.
51
+ *
52
+ * @public
53
+ * @returns {InstrumentType}
54
+ */
55
+ static get EQUITY() {
56
+ return equity;
57
+ }
58
+
59
+ /**
60
+ * A mutual fund.
61
+ *
62
+ * @public
63
+ * @returns {InstrumentType}
64
+ */
65
+ static get FUND() {
66
+ return fund;
67
+ }
68
+
69
+ /**
70
+ * An undefined asset (e.g. a house, or a collectible, or a salvaged alien spaceship).
71
+ *
72
+ * @public
73
+ * @returns {InstrumentType}
74
+ */
75
+ static get OTHER() {
76
+ return other;
77
+ }
78
+
79
+ toString() {
80
+ return '[InstrumentType]';
81
+ }
82
+ }
83
+
84
+ const cash = new InstrumentType('CASH', 'cash', 'Cash', false);
85
+ const equity = new InstrumentType('EQUITY', 'equity', 'Equities', true);
86
+ const fund = new InstrumentType('FUND', 'mutual fund', 'Funds', true);
87
+ const other = new InstrumentType('OTHER', 'other', 'Other', false);
88
+
89
+ return InstrumentType;
90
+ })();
91
+
92
+ },{"@barchart/common-js/lang/Enum":15,"@barchart/common-js/lang/assert":17}],2:[function(require,module,exports){
2
93
  const array = require('@barchart/common-js/lang/array'),
3
94
  assert = require('@barchart/common-js/lang/assert'),
4
95
  Day = require('@barchart/common-js/lang/Day'),
@@ -185,7 +276,7 @@ module.exports = (() => {
185
276
  return PositionSummaryFrame;
186
277
  })();
187
278
 
188
- },{"@barchart/common-js/lang/Day":11,"@barchart/common-js/lang/Enum":14,"@barchart/common-js/lang/array":15,"@barchart/common-js/lang/assert":16,"@barchart/common-js/lang/is":18}],2:[function(require,module,exports){
279
+ },{"@barchart/common-js/lang/Day":12,"@barchart/common-js/lang/Enum":15,"@barchart/common-js/lang/array":16,"@barchart/common-js/lang/assert":17,"@barchart/common-js/lang/is":19}],3:[function(require,module,exports){
189
280
  const assert = require('@barchart/common-js/lang/assert'),
190
281
  Enum = require('@barchart/common-js/lang/Enum');
191
282
 
@@ -512,7 +603,7 @@ module.exports = (() => {
512
603
  return TransactionType;
513
604
  })();
514
605
 
515
- },{"@barchart/common-js/lang/Enum":14,"@barchart/common-js/lang/assert":16}],3:[function(require,module,exports){
606
+ },{"@barchart/common-js/lang/Enum":15,"@barchart/common-js/lang/assert":17}],4:[function(require,module,exports){
516
607
  const array = require('@barchart/common-js/lang/array'),
517
608
  ComparatorBuilder = require('@barchart/common-js/collections/sorting/ComparatorBuilder'),
518
609
  comparators = require('@barchart/common-js/collections/sorting/comparators'),
@@ -522,7 +613,6 @@ const array = require('@barchart/common-js/lang/array'),
522
613
  Tree = require('@barchart/common-js/collections/Tree');
523
614
 
524
615
  const PositionGroup = require('./PositionGroup'),
525
- PositionGroupDefinition = require('./PositionGroupDefinition'),
526
616
  PositionItem = require('./PositionItem');
527
617
 
528
618
  module.exports = (() => {
@@ -592,7 +682,8 @@ module.exports = (() => {
592
682
  const currentDefinition = definitions[0];
593
683
  const additionalDefinitions = array.dropLeft(definitions);
594
684
 
595
- const populatedGroups = array.batchBy(items, currentDefinition.keySelector).map((items) => {
685
+ const populatedObjects = array.groupBy(items, currentDefinition.keySelector);
686
+ const populatedGroups = Object.keys(populatedObjects).map(key => populatedObjects[key]).map((items) => {
596
687
  const first = items[0];
597
688
 
598
689
  return new PositionGroup(items, currentDefinition.currencySelector(first), currentDefinition.descriptionSelector(first), currentDefinition.single && items.length === 1);
@@ -684,7 +775,7 @@ module.exports = (() => {
684
775
  return PositionContainer;
685
776
  })();
686
777
 
687
- },{"./PositionGroup":4,"./PositionGroupDefinition":5,"./PositionItem":6,"@barchart/common-js/collections/Tree":7,"@barchart/common-js/collections/sorting/ComparatorBuilder":8,"@barchart/common-js/collections/sorting/comparators":9,"@barchart/common-js/lang/Currency":10,"@barchart/common-js/lang/array":15,"@barchart/common-js/lang/assert":16,"@barchart/common-js/lang/is":18}],4:[function(require,module,exports){
778
+ },{"./PositionGroup":5,"./PositionItem":7,"@barchart/common-js/collections/Tree":8,"@barchart/common-js/collections/sorting/ComparatorBuilder":9,"@barchart/common-js/collections/sorting/comparators":10,"@barchart/common-js/lang/Currency":11,"@barchart/common-js/lang/array":16,"@barchart/common-js/lang/assert":17,"@barchart/common-js/lang/is":19}],5:[function(require,module,exports){
688
779
  const assert = require('@barchart/common-js/lang/assert'),
689
780
  Currency = require('@barchart/common-js/lang/Currency'),
690
781
  Decimal = require('@barchart/common-js/lang/Decimal'),
@@ -733,7 +824,7 @@ module.exports = (() => {
733
824
  this._dataFormat.current = null;
734
825
  }
735
826
 
736
- calculateVariablePriceData(this, item);
827
+ calculatePriceData(this, item);
737
828
  });
738
829
  });
739
830
 
@@ -772,21 +863,17 @@ module.exports = (() => {
772
863
  function calculateStaticData(group) {
773
864
  const items = group._items;
774
865
 
775
- const raw = group._dataRaw;
776
- const formatted = group._dataFormat;
777
-
778
866
  let updates;
779
867
 
780
868
  if (group.single) {
781
869
  const item = items[0];
782
870
 
871
+ updates = { };
872
+
783
873
  updates.basis = item.basis;
784
874
  } else {
785
875
  updates = items.reduce(function(updates, item) {
786
- const position = item.position;
787
- const snapshot = item.position.snapshot;
788
-
789
- updates.value = updates.basis.add(snapshot.basis);
876
+ updates.basis = updates.basis.add(item.data.basis);
790
877
 
791
878
  return updates;
792
879
  }, {
@@ -794,18 +881,45 @@ module.exports = (() => {
794
881
  });
795
882
  }
796
883
 
884
+ const raw = group._dataRaw;
885
+ const formatted = group._dataFormat;
886
+
797
887
  raw.basis = updates.basis;
798
888
  formatted.basis = format(updates.basis, Currency.USD);
799
889
  }
800
890
 
801
- function calculateVariablePriceData(group, item) {
891
+ function calculatePriceData(group) {
892
+ const items = group._items;
893
+
894
+ let updates;
802
895
 
896
+ if (group.single) {
897
+ updates = { };
898
+
899
+ let item = items[0];
900
+
901
+ updates.market = item.market;
902
+ } else {
903
+ updates = items.reduce(function(updates, item) {
904
+ updates.market = updates.market.add(item.data.market);
905
+
906
+ return updates;
907
+ }, {
908
+ market: Decimal.ZERO
909
+ });
910
+ }
911
+
912
+ const raw = group._dataRaw;
913
+ const formatted = group._dataFormat;
914
+
915
+ raw.market = updates.market;
916
+ formatted.market = format(updates.market, Currency.USD);
803
917
  }
804
918
 
805
919
  return PositionGroup;
806
920
  })();
807
921
 
808
- },{"@barchart/common-js/lang/Currency":10,"@barchart/common-js/lang/Decimal":12,"@barchart/common-js/lang/assert":16,"@barchart/common-js/lang/formatter":17,"@barchart/common-js/lang/is":18}],5:[function(require,module,exports){
922
+ },{"@barchart/common-js/lang/Currency":11,"@barchart/common-js/lang/Decimal":13,"@barchart/common-js/lang/assert":17,"@barchart/common-js/lang/formatter":18,"@barchart/common-js/lang/is":19}],6:[function(require,module,exports){
809
923
  const assert = require('@barchart/common-js/lang/assert'),
810
924
  is = require('@barchart/common-js/lang/is');
811
925
 
@@ -855,12 +969,14 @@ module.exports = (() => {
855
969
  return PositionGroupDefinition;
856
970
  })();
857
971
 
858
- },{"@barchart/common-js/lang/assert":16,"@barchart/common-js/lang/is":18}],6:[function(require,module,exports){
972
+ },{"@barchart/common-js/lang/assert":17,"@barchart/common-js/lang/is":19}],7:[function(require,module,exports){
859
973
  const assert = require('@barchart/common-js/lang/assert'),
860
974
  Decimal = require('@barchart/common-js/lang/Decimal'),
861
975
  Event = require('@barchart/common-js/messaging/Event'),
862
976
  is = require('@barchart/common-js/lang/is');
863
977
 
978
+ const InstrumentType = require('./../data/InstrumentType');
979
+
864
980
  module.exports = (() => {
865
981
  'use strict';
866
982
 
@@ -876,21 +992,11 @@ module.exports = (() => {
876
992
  this._data = { };
877
993
 
878
994
  this._data.current = null;
879
- this._data.previous = position.previous || null;
880
-
881
- const snapshot = this._position.snapshot;
882
-
883
- this._data.basis = snapshot.basis || Decimal.ZERO;
884
-
885
- /*
886
- let market;
995
+ this._data.previous = null;
996
+ this._data.basis = null;
887
997
 
888
- if (position.previous) {
889
- market = snapshot.open.multiply(position.previous);
890
- } else {
891
- market = snapshot.value;
892
- }
893
- */
998
+ calculateStaticData(this);
999
+ calculatePriceData(this, null);
894
1000
 
895
1001
  this._priceChangeEvent = new Event(this);
896
1002
  }
@@ -907,9 +1013,13 @@ module.exports = (() => {
907
1013
  return this._summaries;
908
1014
  }
909
1015
 
1016
+ get data() {
1017
+ return this._data;
1018
+ }
1019
+
910
1020
  setPrice(price) {
911
1021
  if (this._data.price !== price) {
912
- this._data.price = price;
1022
+ calculatePriceData(this, this._data.price = price);
913
1023
 
914
1024
  this._priceChangeEvent.fire(this._data);
915
1025
  }
@@ -926,10 +1036,52 @@ module.exports = (() => {
926
1036
  }
927
1037
  }
928
1038
 
1039
+ function calculateStaticData(item) {
1040
+ const position = item.position;
1041
+ const snapshot = item.position.snapshot;
1042
+
1043
+ const data = item._data;
1044
+
1045
+ data.previous = position.previous || null;
1046
+
1047
+ let basis;
1048
+
1049
+ if (snapshot.basis) {
1050
+ basis = snapshot.basis.opposite();
1051
+ } else {
1052
+ basis = Decimal.ZERO;
1053
+ }
1054
+
1055
+ data.basis = basis;
1056
+ }
1057
+
1058
+ function calculatePriceData(item, price) {
1059
+ const position = item.position;
1060
+ const snapshot = item.position.snapshot;
1061
+
1062
+ const data = item._data;
1063
+
1064
+ let market;
1065
+
1066
+ if (position.instrument.type === InstrumentType.OTHER) {
1067
+ market = snapshot.value;
1068
+ } else if (position.instrument.type === InstrumentType.CASH) {
1069
+ market = snapshot.open;
1070
+ } else {
1071
+ if (price) {
1072
+ market = snapshot.open.multiply(price);
1073
+ } else {
1074
+ market = snapshot.value;
1075
+ }
1076
+ }
1077
+
1078
+ data.market = market;
1079
+ }
1080
+
929
1081
  return PositionItem;
930
1082
  })();
931
1083
 
932
- },{"@barchart/common-js/lang/Decimal":12,"@barchart/common-js/lang/assert":16,"@barchart/common-js/lang/is":18,"@barchart/common-js/messaging/Event":19}],7:[function(require,module,exports){
1084
+ },{"./../data/InstrumentType":1,"@barchart/common-js/lang/Decimal":13,"@barchart/common-js/lang/assert":17,"@barchart/common-js/lang/is":19,"@barchart/common-js/messaging/Event":20}],8:[function(require,module,exports){
933
1085
  'use strict';
934
1086
 
935
1087
  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; }; }();
@@ -1238,7 +1390,7 @@ module.exports = function () {
1238
1390
  return Tree;
1239
1391
  }();
1240
1392
 
1241
- },{"./../lang/is":18}],8:[function(require,module,exports){
1393
+ },{"./../lang/is":19}],9:[function(require,module,exports){
1242
1394
  'use strict';
1243
1395
 
1244
1396
  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; }; }();
@@ -1382,7 +1534,7 @@ module.exports = function () {
1382
1534
  return ComparatorBuilder;
1383
1535
  }();
1384
1536
 
1385
- },{"./../../lang/assert":16,"./comparators":9}],9:[function(require,module,exports){
1537
+ },{"./../../lang/assert":17,"./comparators":10}],10:[function(require,module,exports){
1386
1538
  'use strict';
1387
1539
 
1388
1540
  var assert = require('./../../lang/assert');
@@ -1457,7 +1609,7 @@ module.exports = function () {
1457
1609
  };
1458
1610
  }();
1459
1611
 
1460
- },{"./../../lang/assert":16}],10:[function(require,module,exports){
1612
+ },{"./../../lang/assert":17}],11:[function(require,module,exports){
1461
1613
  'use strict';
1462
1614
 
1463
1615
  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; }; }();
@@ -1600,7 +1752,7 @@ module.exports = function () {
1600
1752
  return Currency;
1601
1753
  }();
1602
1754
 
1603
- },{"./Enum":14,"./assert":16,"./is":18}],11:[function(require,module,exports){
1755
+ },{"./Enum":15,"./assert":17,"./is":19}],12:[function(require,module,exports){
1604
1756
  'use strict';
1605
1757
 
1606
1758
  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; }; }();
@@ -2153,7 +2305,7 @@ module.exports = function () {
2153
2305
  return Day;
2154
2306
  }();
2155
2307
 
2156
- },{"./../collections/sorting/ComparatorBuilder":8,"./../collections/sorting/comparators":9,"./assert":16,"./is":18}],12:[function(require,module,exports){
2308
+ },{"./../collections/sorting/ComparatorBuilder":9,"./../collections/sorting/comparators":10,"./assert":17,"./is":19}],13:[function(require,module,exports){
2157
2309
  'use strict';
2158
2310
 
2159
2311
  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; }; }();
@@ -2733,7 +2885,7 @@ module.exports = function () {
2733
2885
  return Decimal;
2734
2886
  }();
2735
2887
 
2736
- },{"./Enum":14,"./assert":16,"./is":18,"big.js":20}],13:[function(require,module,exports){
2888
+ },{"./Enum":15,"./assert":17,"./is":19,"big.js":21}],14:[function(require,module,exports){
2737
2889
  'use strict';
2738
2890
 
2739
2891
  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; }; }();
@@ -2882,7 +3034,7 @@ module.exports = function () {
2882
3034
  return Disposable;
2883
3035
  }();
2884
3036
 
2885
- },{"./assert":16}],14:[function(require,module,exports){
3037
+ },{"./assert":17}],15:[function(require,module,exports){
2886
3038
  'use strict';
2887
3039
 
2888
3040
  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; }; }();
@@ -3024,7 +3176,7 @@ module.exports = function () {
3024
3176
  return Enum;
3025
3177
  }();
3026
3178
 
3027
- },{"./assert":16}],15:[function(require,module,exports){
3179
+ },{"./assert":17}],16:[function(require,module,exports){
3028
3180
  'use strict';
3029
3181
 
3030
3182
  var assert = require('./assert'),
@@ -3405,7 +3557,7 @@ module.exports = function () {
3405
3557
  };
3406
3558
  }();
3407
3559
 
3408
- },{"./assert":16,"./is":18}],16:[function(require,module,exports){
3560
+ },{"./assert":17,"./is":19}],17:[function(require,module,exports){
3409
3561
  'use strict';
3410
3562
 
3411
3563
  var is = require('./is');
@@ -3553,7 +3705,7 @@ module.exports = function () {
3553
3705
  };
3554
3706
  }();
3555
3707
 
3556
- },{"./is":18}],17:[function(require,module,exports){
3708
+ },{"./is":19}],18:[function(require,module,exports){
3557
3709
  'use strict';
3558
3710
 
3559
3711
  module.exports = function () {
@@ -3618,7 +3770,7 @@ module.exports = function () {
3618
3770
  };
3619
3771
  }();
3620
3772
 
3621
- },{}],18:[function(require,module,exports){
3773
+ },{}],19:[function(require,module,exports){
3622
3774
  'use strict';
3623
3775
 
3624
3776
  var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
@@ -3841,7 +3993,7 @@ module.exports = function () {
3841
3993
  };
3842
3994
  }();
3843
3995
 
3844
- },{}],19:[function(require,module,exports){
3996
+ },{}],20:[function(require,module,exports){
3845
3997
  'use strict';
3846
3998
 
3847
3999
  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; }; }();
@@ -4013,7 +4165,7 @@ module.exports = function () {
4013
4165
  return Event;
4014
4166
  }();
4015
4167
 
4016
- },{"./../lang/Disposable":13,"./../lang/assert":16}],20:[function(require,module,exports){
4168
+ },{"./../lang/Disposable":14,"./../lang/assert":17}],21:[function(require,module,exports){
4017
4169
  /*
4018
4170
  * big.js v5.0.3
4019
4171
  * A small, fast, easy-to-use library for arbitrary-precision decimal arithmetic.
@@ -4954,7 +5106,7 @@ module.exports = function () {
4954
5106
  }
4955
5107
  })(this);
4956
5108
 
4957
- },{}],21:[function(require,module,exports){
5109
+ },{}],22:[function(require,module,exports){
4958
5110
  const Day = require('@barchart/common-js/lang/Day'),
4959
5111
  Decimal = require('@barchart/common-js/lang/Decimal');
4960
5112
 
@@ -5311,10 +5463,12 @@ describe('After the PositionSummaryFrame enumeration is initialized', () => {
5311
5463
  });
5312
5464
  });
5313
5465
 
5314
- },{"./../../../lib/data/PositionSummaryFrame":1,"./../../../lib/data/TransactionType":2,"@barchart/common-js/lang/Day":11,"@barchart/common-js/lang/Decimal":12}],22:[function(require,module,exports){
5466
+ },{"./../../../lib/data/PositionSummaryFrame":2,"./../../../lib/data/TransactionType":3,"@barchart/common-js/lang/Day":12,"@barchart/common-js/lang/Decimal":13}],23:[function(require,module,exports){
5315
5467
  const Currency = require('@barchart/common-js/lang/Currency'),
5316
5468
  Decimal = require('@barchart/common-js/lang/Decimal');
5317
5469
 
5470
+ const InstrumentType = require('./../../../lib/data/InstrumentType');
5471
+
5318
5472
  const PositionContainer = require('./../../../lib/processing/PositionContainer'),
5319
5473
  PositionGroupDefinition = require('./../../../lib/processing/PositionGroupDefinition');
5320
5474
 
@@ -5329,12 +5483,15 @@ describe('When a position container data is gathered', () => {
5329
5483
  position: (positionCounter++).toString(),
5330
5484
  instrument: {
5331
5485
  symbol: {
5332
- barchart: symbol,
5333
- currency: currency || Currency.USD
5334
- }
5486
+ barchart: symbol
5487
+ },
5488
+ currency: currency || Currency.USD,
5489
+ type: InstrumentType.EQUITY
5335
5490
  },
5336
5491
  snapshot: {
5337
- basis: new Decimal(123)
5492
+ basis: new Decimal(123),
5493
+ value: new Decimal(456),
5494
+ open: new Decimal(1)
5338
5495
  }
5339
5496
  }
5340
5497
  }
@@ -5409,4 +5566,4 @@ describe('When a position container data is gathered', () => {
5409
5566
  });
5410
5567
  });
5411
5568
 
5412
- },{"./../../../lib/processing/PositionContainer":3,"./../../../lib/processing/PositionGroupDefinition":5,"@barchart/common-js/lang/Currency":10,"@barchart/common-js/lang/Decimal":12}]},{},[21,22]);
5569
+ },{"./../../../lib/data/InstrumentType":1,"./../../../lib/processing/PositionContainer":4,"./../../../lib/processing/PositionGroupDefinition":6,"@barchart/common-js/lang/Currency":11,"@barchart/common-js/lang/Decimal":13}]},{},[22,23]);
@@ -1,6 +1,8 @@
1
1
  const Currency = require('@barchart/common-js/lang/Currency'),
2
2
  Decimal = require('@barchart/common-js/lang/Decimal');
3
3
 
4
+ const InstrumentType = require('./../../../lib/data/InstrumentType');
5
+
4
6
  const PositionContainer = require('./../../../lib/processing/PositionContainer'),
5
7
  PositionGroupDefinition = require('./../../../lib/processing/PositionGroupDefinition');
6
8
 
@@ -15,12 +17,15 @@ describe('When a position container data is gathered', () => {
15
17
  position: (positionCounter++).toString(),
16
18
  instrument: {
17
19
  symbol: {
18
- barchart: symbol,
19
- currency: currency || Currency.USD
20
- }
20
+ barchart: symbol
21
+ },
22
+ currency: currency || Currency.USD,
23
+ type: InstrumentType.EQUITY
21
24
  },
22
25
  snapshot: {
23
- basis: new Decimal(123)
26
+ basis: new Decimal(123),
27
+ value: new Decimal(456),
28
+ open: new Decimal(1)
24
29
  }
25
30
  }
26
31
  }