@barchart/portfolio-api-common 1.0.58 → 1.0.62
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,11 +46,12 @@ module.exports = (() => {
|
|
|
46
46
|
this._dataFormat.current = null;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
calculatePriceData(this, item);
|
|
50
50
|
});
|
|
51
51
|
});
|
|
52
52
|
|
|
53
53
|
calculateStaticData(this);
|
|
54
|
+
calculatePriceData(this);
|
|
54
55
|
}
|
|
55
56
|
|
|
56
57
|
get items() {
|
|
@@ -85,21 +86,17 @@ module.exports = (() => {
|
|
|
85
86
|
function calculateStaticData(group) {
|
|
86
87
|
const items = group._items;
|
|
87
88
|
|
|
88
|
-
const raw = group._dataRaw;
|
|
89
|
-
const formatted = group._dataFormat;
|
|
90
|
-
|
|
91
89
|
let updates;
|
|
92
90
|
|
|
93
91
|
if (group.single) {
|
|
94
92
|
const item = items[0];
|
|
95
93
|
|
|
94
|
+
updates = { };
|
|
95
|
+
|
|
96
96
|
updates.basis = item.basis;
|
|
97
97
|
} else {
|
|
98
98
|
updates = items.reduce(function(updates, item) {
|
|
99
|
-
|
|
100
|
-
const snapshot = item.position.snapshot;
|
|
101
|
-
|
|
102
|
-
updates.value = updates.basis.add(snapshot.basis);
|
|
99
|
+
updates.basis = updates.basis.add(item.data.basis);
|
|
103
100
|
|
|
104
101
|
return updates;
|
|
105
102
|
}, {
|
|
@@ -107,12 +104,39 @@ module.exports = (() => {
|
|
|
107
104
|
});
|
|
108
105
|
}
|
|
109
106
|
|
|
107
|
+
const raw = group._dataRaw;
|
|
108
|
+
const formatted = group._dataFormat;
|
|
109
|
+
|
|
110
110
|
raw.basis = updates.basis;
|
|
111
111
|
formatted.basis = format(updates.basis, Currency.USD);
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
function
|
|
114
|
+
function calculatePriceData(group) {
|
|
115
|
+
const items = group._items;
|
|
116
|
+
|
|
117
|
+
let updates;
|
|
118
|
+
|
|
119
|
+
if (group.single) {
|
|
120
|
+
updates = { };
|
|
121
|
+
|
|
122
|
+
let item = items[0];
|
|
123
|
+
|
|
124
|
+
updates.market = item.market;
|
|
125
|
+
} else {
|
|
126
|
+
updates = items.reduce(function(updates, item) {
|
|
127
|
+
updates.market = updates.market.add(item.data.market);
|
|
128
|
+
|
|
129
|
+
return updates;
|
|
130
|
+
}, {
|
|
131
|
+
market: Decimal.ZERO
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
const raw = group._dataRaw;
|
|
136
|
+
const formatted = group._dataFormat;
|
|
115
137
|
|
|
138
|
+
raw.market = updates.market;
|
|
139
|
+
formatted.market = format(updates.market, Currency.USD);
|
|
116
140
|
}
|
|
117
141
|
|
|
118
142
|
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 =
|
|
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
|
-
|
|
31
|
-
|
|
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
package/test/SpecRunner.js
CHANGED
|
@@ -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":
|
|
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":
|
|
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":
|
|
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,11 +824,12 @@ module.exports = (() => {
|
|
|
734
824
|
this._dataFormat.current = null;
|
|
735
825
|
}
|
|
736
826
|
|
|
737
|
-
|
|
827
|
+
calculatePriceData(this, item);
|
|
738
828
|
});
|
|
739
829
|
});
|
|
740
830
|
|
|
741
831
|
calculateStaticData(this);
|
|
832
|
+
calculatePriceData(this);
|
|
742
833
|
}
|
|
743
834
|
|
|
744
835
|
get items() {
|
|
@@ -773,21 +864,17 @@ module.exports = (() => {
|
|
|
773
864
|
function calculateStaticData(group) {
|
|
774
865
|
const items = group._items;
|
|
775
866
|
|
|
776
|
-
const raw = group._dataRaw;
|
|
777
|
-
const formatted = group._dataFormat;
|
|
778
|
-
|
|
779
867
|
let updates;
|
|
780
868
|
|
|
781
869
|
if (group.single) {
|
|
782
870
|
const item = items[0];
|
|
783
871
|
|
|
872
|
+
updates = { };
|
|
873
|
+
|
|
784
874
|
updates.basis = item.basis;
|
|
785
875
|
} else {
|
|
786
876
|
updates = items.reduce(function(updates, item) {
|
|
787
|
-
|
|
788
|
-
const snapshot = item.position.snapshot;
|
|
789
|
-
|
|
790
|
-
updates.value = updates.basis.add(snapshot.basis);
|
|
877
|
+
updates.basis = updates.basis.add(item.data.basis);
|
|
791
878
|
|
|
792
879
|
return updates;
|
|
793
880
|
}, {
|
|
@@ -795,18 +882,45 @@ module.exports = (() => {
|
|
|
795
882
|
});
|
|
796
883
|
}
|
|
797
884
|
|
|
885
|
+
const raw = group._dataRaw;
|
|
886
|
+
const formatted = group._dataFormat;
|
|
887
|
+
|
|
798
888
|
raw.basis = updates.basis;
|
|
799
889
|
formatted.basis = format(updates.basis, Currency.USD);
|
|
800
890
|
}
|
|
801
891
|
|
|
802
|
-
function
|
|
892
|
+
function calculatePriceData(group) {
|
|
893
|
+
const items = group._items;
|
|
894
|
+
|
|
895
|
+
let updates;
|
|
803
896
|
|
|
897
|
+
if (group.single) {
|
|
898
|
+
updates = { };
|
|
899
|
+
|
|
900
|
+
let item = items[0];
|
|
901
|
+
|
|
902
|
+
updates.market = item.market;
|
|
903
|
+
} else {
|
|
904
|
+
updates = items.reduce(function(updates, item) {
|
|
905
|
+
updates.market = updates.market.add(item.data.market);
|
|
906
|
+
|
|
907
|
+
return updates;
|
|
908
|
+
}, {
|
|
909
|
+
market: Decimal.ZERO
|
|
910
|
+
});
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
const raw = group._dataRaw;
|
|
914
|
+
const formatted = group._dataFormat;
|
|
915
|
+
|
|
916
|
+
raw.market = updates.market;
|
|
917
|
+
formatted.market = format(updates.market, Currency.USD);
|
|
804
918
|
}
|
|
805
919
|
|
|
806
920
|
return PositionGroup;
|
|
807
921
|
})();
|
|
808
922
|
|
|
809
|
-
},{"@barchart/common-js/lang/Currency":
|
|
923
|
+
},{"@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
924
|
const assert = require('@barchart/common-js/lang/assert'),
|
|
811
925
|
is = require('@barchart/common-js/lang/is');
|
|
812
926
|
|
|
@@ -856,12 +970,14 @@ module.exports = (() => {
|
|
|
856
970
|
return PositionGroupDefinition;
|
|
857
971
|
})();
|
|
858
972
|
|
|
859
|
-
},{"@barchart/common-js/lang/assert":
|
|
973
|
+
},{"@barchart/common-js/lang/assert":17,"@barchart/common-js/lang/is":19}],7:[function(require,module,exports){
|
|
860
974
|
const assert = require('@barchart/common-js/lang/assert'),
|
|
861
975
|
Decimal = require('@barchart/common-js/lang/Decimal'),
|
|
862
976
|
Event = require('@barchart/common-js/messaging/Event'),
|
|
863
977
|
is = require('@barchart/common-js/lang/is');
|
|
864
978
|
|
|
979
|
+
const InstrumentType = require('./../data/InstrumentType');
|
|
980
|
+
|
|
865
981
|
module.exports = (() => {
|
|
866
982
|
'use strict';
|
|
867
983
|
|
|
@@ -877,21 +993,11 @@ module.exports = (() => {
|
|
|
877
993
|
this._data = { };
|
|
878
994
|
|
|
879
995
|
this._data.current = null;
|
|
880
|
-
this._data.previous =
|
|
881
|
-
|
|
882
|
-
const snapshot = this._position.snapshot;
|
|
883
|
-
|
|
884
|
-
this._data.basis = snapshot.basis || Decimal.ZERO;
|
|
885
|
-
|
|
886
|
-
/*
|
|
887
|
-
let market;
|
|
996
|
+
this._data.previous = null;
|
|
997
|
+
this._data.basis = null;
|
|
888
998
|
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
} else {
|
|
892
|
-
market = snapshot.value;
|
|
893
|
-
}
|
|
894
|
-
*/
|
|
999
|
+
calculateStaticData(this);
|
|
1000
|
+
calculatePriceData(this, null);
|
|
895
1001
|
|
|
896
1002
|
this._priceChangeEvent = new Event(this);
|
|
897
1003
|
}
|
|
@@ -908,9 +1014,13 @@ module.exports = (() => {
|
|
|
908
1014
|
return this._summaries;
|
|
909
1015
|
}
|
|
910
1016
|
|
|
1017
|
+
get data() {
|
|
1018
|
+
return this._data;
|
|
1019
|
+
}
|
|
1020
|
+
|
|
911
1021
|
setPrice(price) {
|
|
912
1022
|
if (this._data.price !== price) {
|
|
913
|
-
this._data.price = price;
|
|
1023
|
+
calculatePriceData(this, this._data.price = price);
|
|
914
1024
|
|
|
915
1025
|
this._priceChangeEvent.fire(this._data);
|
|
916
1026
|
}
|
|
@@ -927,10 +1037,52 @@ module.exports = (() => {
|
|
|
927
1037
|
}
|
|
928
1038
|
}
|
|
929
1039
|
|
|
1040
|
+
function calculateStaticData(item) {
|
|
1041
|
+
const position = item.position;
|
|
1042
|
+
const snapshot = item.position.snapshot;
|
|
1043
|
+
|
|
1044
|
+
const data = item._data;
|
|
1045
|
+
|
|
1046
|
+
data.previous = position.previous || null;
|
|
1047
|
+
|
|
1048
|
+
let basis;
|
|
1049
|
+
|
|
1050
|
+
if (snapshot.basis) {
|
|
1051
|
+
basis = snapshot.basis.opposite();
|
|
1052
|
+
} else {
|
|
1053
|
+
basis = Decimal.ZERO;
|
|
1054
|
+
}
|
|
1055
|
+
|
|
1056
|
+
data.basis = basis;
|
|
1057
|
+
}
|
|
1058
|
+
|
|
1059
|
+
function calculatePriceData(item, price) {
|
|
1060
|
+
const position = item.position;
|
|
1061
|
+
const snapshot = item.position.snapshot;
|
|
1062
|
+
|
|
1063
|
+
const data = item._data;
|
|
1064
|
+
|
|
1065
|
+
let market;
|
|
1066
|
+
|
|
1067
|
+
if (position.instrument.type === InstrumentType.OTHER) {
|
|
1068
|
+
market = snapshot.value;
|
|
1069
|
+
} else if (position.instrument.type === InstrumentType.CASH) {
|
|
1070
|
+
market = snapshot.open;
|
|
1071
|
+
} else {
|
|
1072
|
+
if (price) {
|
|
1073
|
+
market = snapshot.open.multiply(price);
|
|
1074
|
+
} else {
|
|
1075
|
+
market = snapshot.value;
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
data.market = market;
|
|
1080
|
+
}
|
|
1081
|
+
|
|
930
1082
|
return PositionItem;
|
|
931
1083
|
})();
|
|
932
1084
|
|
|
933
|
-
},{"@barchart/common-js/lang/Decimal":
|
|
1085
|
+
},{"./../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
1086
|
'use strict';
|
|
935
1087
|
|
|
936
1088
|
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 +1391,7 @@ module.exports = function () {
|
|
|
1239
1391
|
return Tree;
|
|
1240
1392
|
}();
|
|
1241
1393
|
|
|
1242
|
-
},{"./../lang/is":
|
|
1394
|
+
},{"./../lang/is":19}],9:[function(require,module,exports){
|
|
1243
1395
|
'use strict';
|
|
1244
1396
|
|
|
1245
1397
|
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 +1535,7 @@ module.exports = function () {
|
|
|
1383
1535
|
return ComparatorBuilder;
|
|
1384
1536
|
}();
|
|
1385
1537
|
|
|
1386
|
-
},{"./../../lang/assert":
|
|
1538
|
+
},{"./../../lang/assert":17,"./comparators":10}],10:[function(require,module,exports){
|
|
1387
1539
|
'use strict';
|
|
1388
1540
|
|
|
1389
1541
|
var assert = require('./../../lang/assert');
|
|
@@ -1458,7 +1610,7 @@ module.exports = function () {
|
|
|
1458
1610
|
};
|
|
1459
1611
|
}();
|
|
1460
1612
|
|
|
1461
|
-
},{"./../../lang/assert":
|
|
1613
|
+
},{"./../../lang/assert":17}],11:[function(require,module,exports){
|
|
1462
1614
|
'use strict';
|
|
1463
1615
|
|
|
1464
1616
|
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 +1753,7 @@ module.exports = function () {
|
|
|
1601
1753
|
return Currency;
|
|
1602
1754
|
}();
|
|
1603
1755
|
|
|
1604
|
-
},{"./Enum":
|
|
1756
|
+
},{"./Enum":15,"./assert":17,"./is":19}],12:[function(require,module,exports){
|
|
1605
1757
|
'use strict';
|
|
1606
1758
|
|
|
1607
1759
|
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 +2306,7 @@ module.exports = function () {
|
|
|
2154
2306
|
return Day;
|
|
2155
2307
|
}();
|
|
2156
2308
|
|
|
2157
|
-
},{"./../collections/sorting/ComparatorBuilder":
|
|
2309
|
+
},{"./../collections/sorting/ComparatorBuilder":9,"./../collections/sorting/comparators":10,"./assert":17,"./is":19}],13:[function(require,module,exports){
|
|
2158
2310
|
'use strict';
|
|
2159
2311
|
|
|
2160
2312
|
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 +2886,7 @@ module.exports = function () {
|
|
|
2734
2886
|
return Decimal;
|
|
2735
2887
|
}();
|
|
2736
2888
|
|
|
2737
|
-
},{"./Enum":
|
|
2889
|
+
},{"./Enum":15,"./assert":17,"./is":19,"big.js":21}],14:[function(require,module,exports){
|
|
2738
2890
|
'use strict';
|
|
2739
2891
|
|
|
2740
2892
|
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 +3035,7 @@ module.exports = function () {
|
|
|
2883
3035
|
return Disposable;
|
|
2884
3036
|
}();
|
|
2885
3037
|
|
|
2886
|
-
},{"./assert":
|
|
3038
|
+
},{"./assert":17}],15:[function(require,module,exports){
|
|
2887
3039
|
'use strict';
|
|
2888
3040
|
|
|
2889
3041
|
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 +3177,7 @@ module.exports = function () {
|
|
|
3025
3177
|
return Enum;
|
|
3026
3178
|
}();
|
|
3027
3179
|
|
|
3028
|
-
},{"./assert":
|
|
3180
|
+
},{"./assert":17}],16:[function(require,module,exports){
|
|
3029
3181
|
'use strict';
|
|
3030
3182
|
|
|
3031
3183
|
var assert = require('./assert'),
|
|
@@ -3406,7 +3558,7 @@ module.exports = function () {
|
|
|
3406
3558
|
};
|
|
3407
3559
|
}();
|
|
3408
3560
|
|
|
3409
|
-
},{"./assert":
|
|
3561
|
+
},{"./assert":17,"./is":19}],17:[function(require,module,exports){
|
|
3410
3562
|
'use strict';
|
|
3411
3563
|
|
|
3412
3564
|
var is = require('./is');
|
|
@@ -3554,7 +3706,7 @@ module.exports = function () {
|
|
|
3554
3706
|
};
|
|
3555
3707
|
}();
|
|
3556
3708
|
|
|
3557
|
-
},{"./is":
|
|
3709
|
+
},{"./is":19}],18:[function(require,module,exports){
|
|
3558
3710
|
'use strict';
|
|
3559
3711
|
|
|
3560
3712
|
module.exports = function () {
|
|
@@ -3619,7 +3771,7 @@ module.exports = function () {
|
|
|
3619
3771
|
};
|
|
3620
3772
|
}();
|
|
3621
3773
|
|
|
3622
|
-
},{}],
|
|
3774
|
+
},{}],19:[function(require,module,exports){
|
|
3623
3775
|
'use strict';
|
|
3624
3776
|
|
|
3625
3777
|
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 +3994,7 @@ module.exports = function () {
|
|
|
3842
3994
|
};
|
|
3843
3995
|
}();
|
|
3844
3996
|
|
|
3845
|
-
},{}],
|
|
3997
|
+
},{}],20:[function(require,module,exports){
|
|
3846
3998
|
'use strict';
|
|
3847
3999
|
|
|
3848
4000
|
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 +4166,7 @@ module.exports = function () {
|
|
|
4014
4166
|
return Event;
|
|
4015
4167
|
}();
|
|
4016
4168
|
|
|
4017
|
-
},{"./../lang/Disposable":
|
|
4169
|
+
},{"./../lang/Disposable":14,"./../lang/assert":17}],21:[function(require,module,exports){
|
|
4018
4170
|
/*
|
|
4019
4171
|
* big.js v5.0.3
|
|
4020
4172
|
* A small, fast, easy-to-use library for arbitrary-precision decimal arithmetic.
|
|
@@ -4955,7 +5107,7 @@ module.exports = function () {
|
|
|
4955
5107
|
}
|
|
4956
5108
|
})(this);
|
|
4957
5109
|
|
|
4958
|
-
},{}],
|
|
5110
|
+
},{}],22:[function(require,module,exports){
|
|
4959
5111
|
const Day = require('@barchart/common-js/lang/Day'),
|
|
4960
5112
|
Decimal = require('@barchart/common-js/lang/Decimal');
|
|
4961
5113
|
|
|
@@ -5312,10 +5464,12 @@ describe('After the PositionSummaryFrame enumeration is initialized', () => {
|
|
|
5312
5464
|
});
|
|
5313
5465
|
});
|
|
5314
5466
|
|
|
5315
|
-
},{"./../../../lib/data/PositionSummaryFrame":
|
|
5467
|
+
},{"./../../../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
5468
|
const Currency = require('@barchart/common-js/lang/Currency'),
|
|
5317
5469
|
Decimal = require('@barchart/common-js/lang/Decimal');
|
|
5318
5470
|
|
|
5471
|
+
const InstrumentType = require('./../../../lib/data/InstrumentType');
|
|
5472
|
+
|
|
5319
5473
|
const PositionContainer = require('./../../../lib/processing/PositionContainer'),
|
|
5320
5474
|
PositionGroupDefinition = require('./../../../lib/processing/PositionGroupDefinition');
|
|
5321
5475
|
|
|
@@ -5330,12 +5484,15 @@ describe('When a position container data is gathered', () => {
|
|
|
5330
5484
|
position: (positionCounter++).toString(),
|
|
5331
5485
|
instrument: {
|
|
5332
5486
|
symbol: {
|
|
5333
|
-
barchart: symbol
|
|
5334
|
-
|
|
5335
|
-
|
|
5487
|
+
barchart: symbol
|
|
5488
|
+
},
|
|
5489
|
+
currency: currency || Currency.USD,
|
|
5490
|
+
type: InstrumentType.EQUITY
|
|
5336
5491
|
},
|
|
5337
5492
|
snapshot: {
|
|
5338
|
-
basis: new Decimal(123)
|
|
5493
|
+
basis: new Decimal(123),
|
|
5494
|
+
value: new Decimal(456),
|
|
5495
|
+
open: new Decimal(1)
|
|
5339
5496
|
}
|
|
5340
5497
|
}
|
|
5341
5498
|
}
|
|
@@ -5410,4 +5567,4 @@ describe('When a position container data is gathered', () => {
|
|
|
5410
5567
|
});
|
|
5411
5568
|
});
|
|
5412
5569
|
|
|
5413
|
-
},{"./../../../lib/processing/PositionContainer":
|
|
5570
|
+
},{"./../../../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
|
-
|
|
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
|
}
|