@barchart/portfolio-api-common 1.0.60 → 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 = (() => {
@@ -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.basis = 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
- formatted.basis = format(updates.basis.opposite(), Currency.USD);
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.60",
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 = (() => {
@@ -685,7 +775,7 @@ module.exports = (() => {
685
775
  return PositionContainer;
686
776
  })();
687
777
 
688
- },{"./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){
689
779
  const assert = require('@barchart/common-js/lang/assert'),
690
780
  Currency = require('@barchart/common-js/lang/Currency'),
691
781
  Decimal = require('@barchart/common-js/lang/Decimal'),
@@ -734,7 +824,7 @@ module.exports = (() => {
734
824
  this._dataFormat.current = null;
735
825
  }
736
826
 
737
- calculateVariablePriceData(this, item);
827
+ calculatePriceData(this, item);
738
828
  });
739
829
  });
740
830
 
@@ -773,21 +863,17 @@ module.exports = (() => {
773
863
  function calculateStaticData(group) {
774
864
  const items = group._items;
775
865
 
776
- const raw = group._dataRaw;
777
- const formatted = group._dataFormat;
778
-
779
866
  let updates;
780
867
 
781
868
  if (group.single) {
782
869
  const item = items[0];
783
870
 
871
+ updates = { };
872
+
784
873
  updates.basis = item.basis;
785
874
  } else {
786
875
  updates = items.reduce(function(updates, item) {
787
- const position = item.position;
788
- const snapshot = item.position.snapshot;
789
-
790
- updates.basis = updates.basis.add(snapshot.basis);
876
+ updates.basis = updates.basis.add(item.data.basis);
791
877
 
792
878
  return updates;
793
879
  }, {
@@ -795,18 +881,45 @@ module.exports = (() => {
795
881
  });
796
882
  }
797
883
 
884
+ const raw = group._dataRaw;
885
+ const formatted = group._dataFormat;
886
+
798
887
  raw.basis = updates.basis;
799
- formatted.basis = format(updates.basis.opposite(), Currency.USD);
888
+ formatted.basis = format(updates.basis, Currency.USD);
800
889
  }
801
890
 
802
- function calculateVariablePriceData(group, item) {
891
+ function calculatePriceData(group) {
892
+ const items = group._items;
893
+
894
+ let updates;
803
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);
804
917
  }
805
918
 
806
919
  return PositionGroup;
807
920
  })();
808
921
 
809
- },{"@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){
810
923
  const assert = require('@barchart/common-js/lang/assert'),
811
924
  is = require('@barchart/common-js/lang/is');
812
925
 
@@ -856,12 +969,14 @@ module.exports = (() => {
856
969
  return PositionGroupDefinition;
857
970
  })();
858
971
 
859
- },{"@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){
860
973
  const assert = require('@barchart/common-js/lang/assert'),
861
974
  Decimal = require('@barchart/common-js/lang/Decimal'),
862
975
  Event = require('@barchart/common-js/messaging/Event'),
863
976
  is = require('@barchart/common-js/lang/is');
864
977
 
978
+ const InstrumentType = require('./../data/InstrumentType');
979
+
865
980
  module.exports = (() => {
866
981
  'use strict';
867
982
 
@@ -877,21 +992,11 @@ module.exports = (() => {
877
992
  this._data = { };
878
993
 
879
994
  this._data.current = null;
880
- this._data.previous = position.previous || null;
881
-
882
- const snapshot = this._position.snapshot;
883
-
884
- this._data.basis = snapshot.basis || Decimal.ZERO;
885
-
886
- /*
887
- let market;
995
+ this._data.previous = null;
996
+ this._data.basis = null;
888
997
 
889
- if (position.previous) {
890
- market = snapshot.open.multiply(position.previous);
891
- } else {
892
- market = snapshot.value;
893
- }
894
- */
998
+ calculateStaticData(this);
999
+ calculatePriceData(this, null);
895
1000
 
896
1001
  this._priceChangeEvent = new Event(this);
897
1002
  }
@@ -908,9 +1013,13 @@ module.exports = (() => {
908
1013
  return this._summaries;
909
1014
  }
910
1015
 
1016
+ get data() {
1017
+ return this._data;
1018
+ }
1019
+
911
1020
  setPrice(price) {
912
1021
  if (this._data.price !== price) {
913
- this._data.price = price;
1022
+ calculatePriceData(this, this._data.price = price);
914
1023
 
915
1024
  this._priceChangeEvent.fire(this._data);
916
1025
  }
@@ -927,10 +1036,52 @@ module.exports = (() => {
927
1036
  }
928
1037
  }
929
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
+
930
1081
  return PositionItem;
931
1082
  })();
932
1083
 
933
- },{"@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){
934
1085
  'use strict';
935
1086
 
936
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; }; }();
@@ -1239,7 +1390,7 @@ module.exports = function () {
1239
1390
  return Tree;
1240
1391
  }();
1241
1392
 
1242
- },{"./../lang/is":18}],8:[function(require,module,exports){
1393
+ },{"./../lang/is":19}],9:[function(require,module,exports){
1243
1394
  'use strict';
1244
1395
 
1245
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; }; }();
@@ -1383,7 +1534,7 @@ module.exports = function () {
1383
1534
  return ComparatorBuilder;
1384
1535
  }();
1385
1536
 
1386
- },{"./../../lang/assert":16,"./comparators":9}],9:[function(require,module,exports){
1537
+ },{"./../../lang/assert":17,"./comparators":10}],10:[function(require,module,exports){
1387
1538
  'use strict';
1388
1539
 
1389
1540
  var assert = require('./../../lang/assert');
@@ -1458,7 +1609,7 @@ module.exports = function () {
1458
1609
  };
1459
1610
  }();
1460
1611
 
1461
- },{"./../../lang/assert":16}],10:[function(require,module,exports){
1612
+ },{"./../../lang/assert":17}],11:[function(require,module,exports){
1462
1613
  'use strict';
1463
1614
 
1464
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; }; }();
@@ -1601,7 +1752,7 @@ module.exports = function () {
1601
1752
  return Currency;
1602
1753
  }();
1603
1754
 
1604
- },{"./Enum":14,"./assert":16,"./is":18}],11:[function(require,module,exports){
1755
+ },{"./Enum":15,"./assert":17,"./is":19}],12:[function(require,module,exports){
1605
1756
  'use strict';
1606
1757
 
1607
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; }; }();
@@ -2154,7 +2305,7 @@ module.exports = function () {
2154
2305
  return Day;
2155
2306
  }();
2156
2307
 
2157
- },{"./../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){
2158
2309
  'use strict';
2159
2310
 
2160
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; }; }();
@@ -2734,7 +2885,7 @@ module.exports = function () {
2734
2885
  return Decimal;
2735
2886
  }();
2736
2887
 
2737
- },{"./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){
2738
2889
  'use strict';
2739
2890
 
2740
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; }; }();
@@ -2883,7 +3034,7 @@ module.exports = function () {
2883
3034
  return Disposable;
2884
3035
  }();
2885
3036
 
2886
- },{"./assert":16}],14:[function(require,module,exports){
3037
+ },{"./assert":17}],15:[function(require,module,exports){
2887
3038
  'use strict';
2888
3039
 
2889
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; }; }();
@@ -3025,7 +3176,7 @@ module.exports = function () {
3025
3176
  return Enum;
3026
3177
  }();
3027
3178
 
3028
- },{"./assert":16}],15:[function(require,module,exports){
3179
+ },{"./assert":17}],16:[function(require,module,exports){
3029
3180
  'use strict';
3030
3181
 
3031
3182
  var assert = require('./assert'),
@@ -3406,7 +3557,7 @@ module.exports = function () {
3406
3557
  };
3407
3558
  }();
3408
3559
 
3409
- },{"./assert":16,"./is":18}],16:[function(require,module,exports){
3560
+ },{"./assert":17,"./is":19}],17:[function(require,module,exports){
3410
3561
  'use strict';
3411
3562
 
3412
3563
  var is = require('./is');
@@ -3554,7 +3705,7 @@ module.exports = function () {
3554
3705
  };
3555
3706
  }();
3556
3707
 
3557
- },{"./is":18}],17:[function(require,module,exports){
3708
+ },{"./is":19}],18:[function(require,module,exports){
3558
3709
  'use strict';
3559
3710
 
3560
3711
  module.exports = function () {
@@ -3619,7 +3770,7 @@ module.exports = function () {
3619
3770
  };
3620
3771
  }();
3621
3772
 
3622
- },{}],18:[function(require,module,exports){
3773
+ },{}],19:[function(require,module,exports){
3623
3774
  'use strict';
3624
3775
 
3625
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; };
@@ -3842,7 +3993,7 @@ module.exports = function () {
3842
3993
  };
3843
3994
  }();
3844
3995
 
3845
- },{}],19:[function(require,module,exports){
3996
+ },{}],20:[function(require,module,exports){
3846
3997
  'use strict';
3847
3998
 
3848
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; }; }();
@@ -4014,7 +4165,7 @@ module.exports = function () {
4014
4165
  return Event;
4015
4166
  }();
4016
4167
 
4017
- },{"./../lang/Disposable":13,"./../lang/assert":16}],20:[function(require,module,exports){
4168
+ },{"./../lang/Disposable":14,"./../lang/assert":17}],21:[function(require,module,exports){
4018
4169
  /*
4019
4170
  * big.js v5.0.3
4020
4171
  * A small, fast, easy-to-use library for arbitrary-precision decimal arithmetic.
@@ -4955,7 +5106,7 @@ module.exports = function () {
4955
5106
  }
4956
5107
  })(this);
4957
5108
 
4958
- },{}],21:[function(require,module,exports){
5109
+ },{}],22:[function(require,module,exports){
4959
5110
  const Day = require('@barchart/common-js/lang/Day'),
4960
5111
  Decimal = require('@barchart/common-js/lang/Decimal');
4961
5112
 
@@ -5312,10 +5463,12 @@ describe('After the PositionSummaryFrame enumeration is initialized', () => {
5312
5463
  });
5313
5464
  });
5314
5465
 
5315
- },{"./../../../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){
5316
5467
  const Currency = require('@barchart/common-js/lang/Currency'),
5317
5468
  Decimal = require('@barchart/common-js/lang/Decimal');
5318
5469
 
5470
+ const InstrumentType = require('./../../../lib/data/InstrumentType');
5471
+
5319
5472
  const PositionContainer = require('./../../../lib/processing/PositionContainer'),
5320
5473
  PositionGroupDefinition = require('./../../../lib/processing/PositionGroupDefinition');
5321
5474
 
@@ -5330,12 +5483,15 @@ describe('When a position container data is gathered', () => {
5330
5483
  position: (positionCounter++).toString(),
5331
5484
  instrument: {
5332
5485
  symbol: {
5333
- barchart: symbol,
5334
- currency: currency || Currency.USD
5335
- }
5486
+ barchart: symbol
5487
+ },
5488
+ currency: currency || Currency.USD,
5489
+ type: InstrumentType.EQUITY
5336
5490
  },
5337
5491
  snapshot: {
5338
- basis: new Decimal(123)
5492
+ basis: new Decimal(123),
5493
+ value: new Decimal(456),
5494
+ open: new Decimal(1)
5339
5495
  }
5340
5496
  }
5341
5497
  }
@@ -5410,4 +5566,4 @@ describe('When a position container data is gathered', () => {
5410
5566
  });
5411
5567
  });
5412
5568
 
5413
- },{"./../../../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
  }