@barchart/portfolio-api-common 1.4.3 → 1.4.4
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.
|
@@ -102,8 +102,8 @@ module.exports = (() => {
|
|
|
102
102
|
.withField('legacy.portfolio', DataType.STRING, true)
|
|
103
103
|
.withField('legacy.position', DataType.STRING, true)
|
|
104
104
|
.withField('system.version', DataType.NUMBER, true)
|
|
105
|
-
.withField('system.locked', DataType.BOOLEAN, true)
|
|
106
105
|
.withField('system.calculate.processors', DataType.NUMBER, true)
|
|
106
|
+
.withField('system.locked', DataType.BOOLEAN, true)
|
|
107
107
|
.withField('root', DataType.STRING, true)
|
|
108
108
|
.schema
|
|
109
109
|
);
|
|
@@ -133,8 +133,8 @@ module.exports = (() => {
|
|
|
133
133
|
.withField('snapshot.basis', DataType.DECIMAL)
|
|
134
134
|
.withField('snapshot.income', DataType.DECIMAL)
|
|
135
135
|
.withField('snapshot.value', DataType.DECIMAL)
|
|
136
|
-
.withField('system.locked', DataType.BOOLEAN, true)
|
|
137
136
|
.withField('system.calculate.processors', DataType.NUMBER, true)
|
|
137
|
+
.withField('system.locked', DataType.BOOLEAN, true)
|
|
138
138
|
.withField('previous', DataType.NUMBER, true)
|
|
139
139
|
.schema
|
|
140
140
|
);
|
package/package.json
CHANGED
package/test/SpecRunner.js
CHANGED
|
@@ -272,7 +272,7 @@ module.exports = (() => {
|
|
|
272
272
|
return InstrumentType;
|
|
273
273
|
})();
|
|
274
274
|
|
|
275
|
-
},{"@barchart/common-js/lang/Enum":
|
|
275
|
+
},{"@barchart/common-js/lang/Enum":26,"@barchart/common-js/lang/assert":31,"uuid":49}],2:[function(require,module,exports){
|
|
276
276
|
const assert = require('@barchart/common-js/lang/assert'),
|
|
277
277
|
Decimal = require('@barchart/common-js/lang/Decimal'),
|
|
278
278
|
Enum = require('@barchart/common-js/lang/Enum');
|
|
@@ -406,7 +406,7 @@ module.exports = (() => {
|
|
|
406
406
|
return PositionDirection;
|
|
407
407
|
})();
|
|
408
408
|
|
|
409
|
-
},{"@barchart/common-js/lang/Decimal":
|
|
409
|
+
},{"@barchart/common-js/lang/Decimal":24,"@barchart/common-js/lang/Enum":26,"@barchart/common-js/lang/assert":31}],3:[function(require,module,exports){
|
|
410
410
|
const array = require('@barchart/common-js/lang/array'),
|
|
411
411
|
assert = require('@barchart/common-js/lang/assert'),
|
|
412
412
|
Day = require('@barchart/common-js/lang/Day'),
|
|
@@ -754,7 +754,7 @@ module.exports = (() => {
|
|
|
754
754
|
return PositionSummaryFrame;
|
|
755
755
|
})();
|
|
756
756
|
|
|
757
|
-
},{"@barchart/common-js/lang/Day":
|
|
757
|
+
},{"@barchart/common-js/lang/Day":23,"@barchart/common-js/lang/Decimal":24,"@barchart/common-js/lang/Enum":26,"@barchart/common-js/lang/array":30,"@barchart/common-js/lang/assert":31}],4:[function(require,module,exports){
|
|
758
758
|
const assert = require('@barchart/common-js/lang/assert'),
|
|
759
759
|
Enum = require('@barchart/common-js/lang/Enum');
|
|
760
760
|
|
|
@@ -1288,7 +1288,7 @@ module.exports = (() => {
|
|
|
1288
1288
|
return TransactionType;
|
|
1289
1289
|
})();
|
|
1290
1290
|
|
|
1291
|
-
},{"@barchart/common-js/lang/Enum":
|
|
1291
|
+
},{"@barchart/common-js/lang/Enum":26,"@barchart/common-js/lang/assert":31}],5:[function(require,module,exports){
|
|
1292
1292
|
const assert = require('@barchart/common-js/lang/assert'),
|
|
1293
1293
|
array = require('@barchart/common-js/lang/array'),
|
|
1294
1294
|
is = require('@barchart/common-js/lang/is'),
|
|
@@ -1595,7 +1595,68 @@ module.exports = (() => {
|
|
|
1595
1595
|
return TransactionValidator;
|
|
1596
1596
|
})();
|
|
1597
1597
|
|
|
1598
|
-
},{"./InstrumentType":1,"./PositionDirection":2,"./TransactionType":4,"@barchart/common-js/lang/Day":
|
|
1598
|
+
},{"./InstrumentType":1,"./PositionDirection":2,"./TransactionType":4,"@barchart/common-js/lang/Day":23,"@barchart/common-js/lang/array":30,"@barchart/common-js/lang/assert":31,"@barchart/common-js/lang/is":35}],6:[function(require,module,exports){
|
|
1599
|
+
const Enum = require('@barchart/common-js/lang/Enum');
|
|
1600
|
+
|
|
1601
|
+
module.exports = (() => {
|
|
1602
|
+
'use strict';
|
|
1603
|
+
|
|
1604
|
+
/**
|
|
1605
|
+
* An enumeration item that describes a strategy for calculating basis.
|
|
1606
|
+
*
|
|
1607
|
+
* @public
|
|
1608
|
+
* @extends {Enum}
|
|
1609
|
+
* @param {String} description
|
|
1610
|
+
* @param {String} code
|
|
1611
|
+
*/
|
|
1612
|
+
class ValuationType extends Enum {
|
|
1613
|
+
constructor(code, description) {
|
|
1614
|
+
super(code, description);
|
|
1615
|
+
}
|
|
1616
|
+
|
|
1617
|
+
/**
|
|
1618
|
+
* Given a code, returns the enumeration item.
|
|
1619
|
+
*
|
|
1620
|
+
* @public
|
|
1621
|
+
* @param {String} code
|
|
1622
|
+
* @returns {ValuationType|null}
|
|
1623
|
+
*/
|
|
1624
|
+
static parse(code) {
|
|
1625
|
+
return Enum.fromCode(ValuationType, code);
|
|
1626
|
+
}
|
|
1627
|
+
|
|
1628
|
+
/**
|
|
1629
|
+
* A valuation method that uses average costing.
|
|
1630
|
+
*
|
|
1631
|
+
* @public
|
|
1632
|
+
* @returns {ValuationType}
|
|
1633
|
+
*/
|
|
1634
|
+
static get AVERAGE_COST() {
|
|
1635
|
+
return averageCost;
|
|
1636
|
+
}
|
|
1637
|
+
|
|
1638
|
+
/**
|
|
1639
|
+
* A valuation method that uses first-in, first-out methodology.
|
|
1640
|
+
*
|
|
1641
|
+
* @public
|
|
1642
|
+
* @returns {ValuationType}
|
|
1643
|
+
*/
|
|
1644
|
+
static get FIFO() {
|
|
1645
|
+
return fifo;
|
|
1646
|
+
}
|
|
1647
|
+
|
|
1648
|
+
toString() {
|
|
1649
|
+
return `[ValuationType (code=${this.code})]`;
|
|
1650
|
+
}
|
|
1651
|
+
}
|
|
1652
|
+
|
|
1653
|
+
const fifo = new ValuationType('FIFO', 'first in, first out');
|
|
1654
|
+
const averageCost = new ValuationType('AVG', 'average cost');
|
|
1655
|
+
|
|
1656
|
+
return ValuationType;
|
|
1657
|
+
})();
|
|
1658
|
+
|
|
1659
|
+
},{"@barchart/common-js/lang/Enum":26}],7:[function(require,module,exports){
|
|
1599
1660
|
const array = require('@barchart/common-js/lang/array'),
|
|
1600
1661
|
assert = require('@barchart/common-js/lang/assert'),
|
|
1601
1662
|
ComparatorBuilder = require('@barchart/common-js/collections/sorting/ComparatorBuilder'),
|
|
@@ -2732,7 +2793,7 @@ module.exports = (() => {
|
|
|
2732
2793
|
return PositionContainer;
|
|
2733
2794
|
})();
|
|
2734
2795
|
|
|
2735
|
-
},{"./../data/PositionSummaryFrame":3,"./PositionGroup":
|
|
2796
|
+
},{"./../data/PositionSummaryFrame":3,"./PositionGroup":8,"./PositionItem":9,"./definitions/PositionLevelDefinition":10,"./definitions/PositionLevelType":11,"./definitions/PositionTreeDefinition":12,"@barchart/common-js/collections/Tree":17,"@barchart/common-js/collections/sorting/ComparatorBuilder":18,"@barchart/common-js/collections/sorting/comparators":19,"@barchart/common-js/collections/specialized/DisposableStack":20,"@barchart/common-js/lang/Currency":22,"@barchart/common-js/lang/Day":23,"@barchart/common-js/lang/Decimal":24,"@barchart/common-js/lang/Rate":28,"@barchart/common-js/lang/array":30,"@barchart/common-js/lang/assert":31,"@barchart/common-js/lang/is":35,"@barchart/common-js/messaging/Event":37}],8:[function(require,module,exports){
|
|
2736
2797
|
const array = require('@barchart/common-js/lang/array'),
|
|
2737
2798
|
assert = require('@barchart/common-js/lang/assert'),
|
|
2738
2799
|
Currency = require('@barchart/common-js/lang/Currency'),
|
|
@@ -3761,7 +3822,7 @@ module.exports = (() => {
|
|
|
3761
3822
|
return PositionGroup;
|
|
3762
3823
|
})();
|
|
3763
3824
|
|
|
3764
|
-
},{"./../data/InstrumentType":1,"./definitions/PositionLevelDefinition":
|
|
3825
|
+
},{"./../data/InstrumentType":1,"./definitions/PositionLevelDefinition":10,"./definitions/PositionLevelType":11,"@barchart/common-js/collections/specialized/DisposableStack":20,"@barchart/common-js/lang/Currency":22,"@barchart/common-js/lang/Decimal":24,"@barchart/common-js/lang/Disposable":25,"@barchart/common-js/lang/Rate":28,"@barchart/common-js/lang/array":30,"@barchart/common-js/lang/assert":31,"@barchart/common-js/lang/formatter":33,"@barchart/common-js/lang/is":35,"@barchart/common-js/messaging/Event":37}],9:[function(require,module,exports){
|
|
3765
3826
|
const assert = require('@barchart/common-js/lang/assert'),
|
|
3766
3827
|
Currency = require('@barchart/common-js/lang/Currency'),
|
|
3767
3828
|
Decimal = require('@barchart/common-js/lang/Decimal'),
|
|
@@ -4546,7 +4607,7 @@ module.exports = (() => {
|
|
|
4546
4607
|
return PositionItem;
|
|
4547
4608
|
})();
|
|
4548
4609
|
|
|
4549
|
-
},{"./../data/InstrumentType":1,"./../data/PositionDirection":2,"@barchart/common-js/lang/Currency":
|
|
4610
|
+
},{"./../data/InstrumentType":1,"./../data/PositionDirection":2,"@barchart/common-js/lang/Currency":22,"@barchart/common-js/lang/Decimal":24,"@barchart/common-js/lang/Disposable":25,"@barchart/common-js/lang/assert":31,"@barchart/common-js/lang/is":35,"@barchart/common-js/messaging/Event":37}],10:[function(require,module,exports){
|
|
4550
4611
|
const assert = require('@barchart/common-js/lang/assert'),
|
|
4551
4612
|
Currency = require('@barchart/common-js/lang/Currency'),
|
|
4552
4613
|
is = require('@barchart/common-js/lang/is');
|
|
@@ -4830,7 +4891,7 @@ module.exports = (() => {
|
|
|
4830
4891
|
return PositionLevelDefinition;
|
|
4831
4892
|
})();
|
|
4832
4893
|
|
|
4833
|
-
},{"./../../data/InstrumentType":1,"./PositionLevelType":
|
|
4894
|
+
},{"./../../data/InstrumentType":1,"./PositionLevelType":11,"@barchart/common-js/lang/Currency":22,"@barchart/common-js/lang/assert":31,"@barchart/common-js/lang/is":35}],11:[function(require,module,exports){
|
|
4834
4895
|
const Enum = require('@barchart/common-js/lang/Enum');
|
|
4835
4896
|
|
|
4836
4897
|
module.exports = (() => {
|
|
@@ -4891,7 +4952,7 @@ module.exports = (() => {
|
|
|
4891
4952
|
return PositionLevelType;
|
|
4892
4953
|
})();
|
|
4893
4954
|
|
|
4894
|
-
},{"@barchart/common-js/lang/Enum":
|
|
4955
|
+
},{"@barchart/common-js/lang/Enum":26}],12:[function(require,module,exports){
|
|
4895
4956
|
const assert = require('@barchart/common-js/lang/assert');
|
|
4896
4957
|
|
|
4897
4958
|
const PositionLevelDefinition = require('./PositionLevelDefinition');
|
|
@@ -4963,7 +5024,165 @@ module.exports = (() => {
|
|
|
4963
5024
|
return PositionTreeDefinitions;
|
|
4964
5025
|
})();
|
|
4965
5026
|
|
|
4966
|
-
},{"./PositionLevelDefinition":
|
|
5027
|
+
},{"./PositionLevelDefinition":10,"@barchart/common-js/lang/assert":31}],13:[function(require,module,exports){
|
|
5028
|
+
const Currency = require('@barchart/common-js/lang/Currency'),
|
|
5029
|
+
DataType = require('@barchart/common-js/serialization/json/DataType'),
|
|
5030
|
+
Enum = require('@barchart/common-js/lang/Enum'),
|
|
5031
|
+
Schema = require('@barchart/common-js/serialization/json/Schema'),
|
|
5032
|
+
SchemaBuilder = require('@barchart/common-js/serialization/json/builders/SchemaBuilder');
|
|
5033
|
+
|
|
5034
|
+
const InstrumentType = require('./../data/InstrumentType'),
|
|
5035
|
+
PositionDirection = require('./../data/PositionDirection'),
|
|
5036
|
+
ValuationType = require('./../data/ValuationType');
|
|
5037
|
+
|
|
5038
|
+
module.exports = (() => {
|
|
5039
|
+
'use strict';
|
|
5040
|
+
|
|
5041
|
+
/**
|
|
5042
|
+
* The schemas which can be used to represent position objects.
|
|
5043
|
+
*
|
|
5044
|
+
* @public
|
|
5045
|
+
* @extends {Enum}
|
|
5046
|
+
*/
|
|
5047
|
+
class PositionSchema extends Enum {
|
|
5048
|
+
constructor(schema) {
|
|
5049
|
+
super(schema.name, schema.name);
|
|
5050
|
+
|
|
5051
|
+
this._schema = schema;
|
|
5052
|
+
}
|
|
5053
|
+
|
|
5054
|
+
/**
|
|
5055
|
+
* The actual {@link Schema}.
|
|
5056
|
+
*
|
|
5057
|
+
* @public
|
|
5058
|
+
* @returns {Schema}
|
|
5059
|
+
*/
|
|
5060
|
+
get schema() {
|
|
5061
|
+
return this._schema;
|
|
5062
|
+
}
|
|
5063
|
+
|
|
5064
|
+
/**
|
|
5065
|
+
* The complete position schema.
|
|
5066
|
+
*
|
|
5067
|
+
* @static
|
|
5068
|
+
* @public
|
|
5069
|
+
* @returns {PositionSchema}
|
|
5070
|
+
*/
|
|
5071
|
+
static get COMPLETE() {
|
|
5072
|
+
return complete;
|
|
5073
|
+
}
|
|
5074
|
+
|
|
5075
|
+
/**
|
|
5076
|
+
* Position data transmitted to the client, omitting some system data.
|
|
5077
|
+
*
|
|
5078
|
+
* @static
|
|
5079
|
+
* @public
|
|
5080
|
+
* @returns {PositionSchema}
|
|
5081
|
+
*/
|
|
5082
|
+
static get CLIENT() {
|
|
5083
|
+
return client;
|
|
5084
|
+
}
|
|
5085
|
+
|
|
5086
|
+
/**
|
|
5087
|
+
* Data required to update a position.
|
|
5088
|
+
*
|
|
5089
|
+
* @static
|
|
5090
|
+
* @public
|
|
5091
|
+
* @returns {PositionSchema}
|
|
5092
|
+
*/
|
|
5093
|
+
static get UPDATE() {
|
|
5094
|
+
return update;
|
|
5095
|
+
}
|
|
5096
|
+
|
|
5097
|
+
toString() {
|
|
5098
|
+
return '[PositionSchema]';
|
|
5099
|
+
}
|
|
5100
|
+
}
|
|
5101
|
+
|
|
5102
|
+
const complete = new PositionSchema(SchemaBuilder.withName('complete')
|
|
5103
|
+
.withField('user', DataType.STRING)
|
|
5104
|
+
.withField('portfolio', DataType.STRING)
|
|
5105
|
+
.withField('instrument.id', DataType.STRING)
|
|
5106
|
+
.withField('instrument.name', DataType.STRING)
|
|
5107
|
+
.withField('instrument.type', DataType.forEnum(InstrumentType, 'InstrumentType'))
|
|
5108
|
+
.withField('instrument.currency', DataType.forEnum(Currency, 'Currency'))
|
|
5109
|
+
.withField('instrument.delist', DataType.DAY, true)
|
|
5110
|
+
.withField('instrument.symbol.barchart', DataType.STRING, true)
|
|
5111
|
+
.withField('instrument.symbol.display', DataType.STRING, true)
|
|
5112
|
+
.withField('position', DataType.STRING)
|
|
5113
|
+
.withField('open', DataType.BOOLEAN, true)
|
|
5114
|
+
.withField('transaction', DataType.NUMBER)
|
|
5115
|
+
.withField('cash', DataType.BOOLEAN, true)
|
|
5116
|
+
.withField('reinvest', DataType.BOOLEAN, true)
|
|
5117
|
+
.withField('valuation', DataType.forEnum(ValuationType, 'ValuationType'))
|
|
5118
|
+
.withField('snapshot.date', DataType.DAY)
|
|
5119
|
+
.withField('snapshot.open', DataType.DECIMAL)
|
|
5120
|
+
.withField('snapshot.direction', DataType.forEnum(PositionDirection, 'PositionDirection'))
|
|
5121
|
+
.withField('snapshot.buys', DataType.DECIMAL)
|
|
5122
|
+
.withField('snapshot.sells', DataType.DECIMAL)
|
|
5123
|
+
.withField('snapshot.gain', DataType.DECIMAL)
|
|
5124
|
+
.withField('snapshot.basis', DataType.DECIMAL)
|
|
5125
|
+
.withField('snapshot.income', DataType.DECIMAL)
|
|
5126
|
+
.withField('snapshot.value', DataType.DECIMAL)
|
|
5127
|
+
.withField('legacy.system', DataType.STRING, true)
|
|
5128
|
+
.withField('legacy.user', DataType.STRING, true)
|
|
5129
|
+
.withField('legacy.portfolio', DataType.STRING, true)
|
|
5130
|
+
.withField('legacy.position', DataType.STRING, true)
|
|
5131
|
+
.withField('system.version', DataType.NUMBER, true)
|
|
5132
|
+
.withField('system.calculate.processors', DataType.NUMBER, true)
|
|
5133
|
+
.withField('system.locked', DataType.BOOLEAN, true)
|
|
5134
|
+
.withField('root', DataType.STRING, true)
|
|
5135
|
+
.schema
|
|
5136
|
+
);
|
|
5137
|
+
|
|
5138
|
+
const client = new PositionSchema(SchemaBuilder.withName('client')
|
|
5139
|
+
.withField('user', DataType.STRING)
|
|
5140
|
+
.withField('portfolio', DataType.STRING)
|
|
5141
|
+
.withField('instrument.id', DataType.STRING)
|
|
5142
|
+
.withField('instrument.name', DataType.STRING)
|
|
5143
|
+
.withField('instrument.type', DataType.forEnum(InstrumentType, 'InstrumentType'))
|
|
5144
|
+
.withField('instrument.currency', DataType.forEnum(Currency, 'Currency'))
|
|
5145
|
+
.withField('instrument.delist', DataType.DAY, true)
|
|
5146
|
+
.withField('instrument.symbol.barchart', DataType.STRING, true)
|
|
5147
|
+
.withField('instrument.symbol.display', DataType.STRING, true)
|
|
5148
|
+
.withField('position', DataType.STRING)
|
|
5149
|
+
.withField('open', DataType.BOOLEAN, true)
|
|
5150
|
+
.withField('transaction', DataType.NUMBER)
|
|
5151
|
+
.withField('cash', DataType.BOOLEAN, true)
|
|
5152
|
+
.withField('reinvest', DataType.BOOLEAN, true)
|
|
5153
|
+
.withField('valuation', DataType.forEnum(ValuationType, 'ValuationType'))
|
|
5154
|
+
.withField('snapshot.date', DataType.DAY)
|
|
5155
|
+
.withField('snapshot.open', DataType.DECIMAL)
|
|
5156
|
+
.withField('snapshot.direction', DataType.forEnum(PositionDirection, 'PositionDirection'))
|
|
5157
|
+
.withField('snapshot.buys', DataType.DECIMAL)
|
|
5158
|
+
.withField('snapshot.sells', DataType.DECIMAL)
|
|
5159
|
+
.withField('snapshot.gain', DataType.DECIMAL)
|
|
5160
|
+
.withField('snapshot.basis', DataType.DECIMAL)
|
|
5161
|
+
.withField('snapshot.income', DataType.DECIMAL)
|
|
5162
|
+
.withField('snapshot.value', DataType.DECIMAL)
|
|
5163
|
+
.withField('system.calculate.processors', DataType.NUMBER, true)
|
|
5164
|
+
.withField('system.locked', DataType.BOOLEAN, true)
|
|
5165
|
+
.withField('previous', DataType.NUMBER, true)
|
|
5166
|
+
.schema
|
|
5167
|
+
);
|
|
5168
|
+
|
|
5169
|
+
const update = new PositionSchema(SchemaBuilder.withName('update')
|
|
5170
|
+
.withField('portfolio', DataType.STRING)
|
|
5171
|
+
.withField('position', DataType.STRING)
|
|
5172
|
+
.withField('mapping.name', DataType.STRING, true)
|
|
5173
|
+
.withField('mapping.type', DataType.forEnum(InstrumentType, 'InstrumentType'), true)
|
|
5174
|
+
.withField('mapping.currency', DataType.forEnum(Currency, 'Currency'), true)
|
|
5175
|
+
.withField('mapping.symbol.barchart', DataType.STRING, true)
|
|
5176
|
+
.withField('mapping.symbol.display', DataType.STRING, true)
|
|
5177
|
+
.withField('cash', DataType.BOOLEAN, true)
|
|
5178
|
+
.withField('reinvest', DataType.BOOLEAN, true)
|
|
5179
|
+
.schema
|
|
5180
|
+
);
|
|
5181
|
+
|
|
5182
|
+
return PositionSchema;
|
|
5183
|
+
})();
|
|
5184
|
+
|
|
5185
|
+
},{"./../data/InstrumentType":1,"./../data/PositionDirection":2,"./../data/ValuationType":6,"@barchart/common-js/lang/Currency":22,"@barchart/common-js/lang/Enum":26,"@barchart/common-js/serialization/json/DataType":39,"@barchart/common-js/serialization/json/Schema":41,"@barchart/common-js/serialization/json/builders/SchemaBuilder":43}],14:[function(require,module,exports){
|
|
4967
5186
|
const is = require('@barchart/common-js/lang/is'),
|
|
4968
5187
|
Currency = require('@barchart/common-js/lang/Currency'),
|
|
4969
5188
|
DataType = require('@barchart/common-js/serialization/json/DataType'),
|
|
@@ -5345,7 +5564,7 @@ module.exports = (() => {
|
|
|
5345
5564
|
return TransactionSchema;
|
|
5346
5565
|
})();
|
|
5347
5566
|
|
|
5348
|
-
},{"./../data/InstrumentType":1,"./../data/PositionDirection":2,"./../data/TransactionType":4,"@barchart/common-js/lang/Currency":
|
|
5567
|
+
},{"./../data/InstrumentType":1,"./../data/PositionDirection":2,"./../data/TransactionType":4,"@barchart/common-js/lang/Currency":22,"@barchart/common-js/lang/Enum":26,"@barchart/common-js/lang/is":35,"@barchart/common-js/serialization/json/DataType":39,"@barchart/common-js/serialization/json/Schema":41,"@barchart/common-js/serialization/json/builders/SchemaBuilder":43}],15:[function(require,module,exports){
|
|
5349
5568
|
module.exports = (() => {
|
|
5350
5569
|
'use strict';
|
|
5351
5570
|
/**
|
|
@@ -5424,7 +5643,7 @@ module.exports = (() => {
|
|
|
5424
5643
|
return LinkedList;
|
|
5425
5644
|
})();
|
|
5426
5645
|
|
|
5427
|
-
},{}],
|
|
5646
|
+
},{}],16:[function(require,module,exports){
|
|
5428
5647
|
const assert = require('./../lang/assert');
|
|
5429
5648
|
|
|
5430
5649
|
module.exports = (() => {
|
|
@@ -5529,7 +5748,7 @@ module.exports = (() => {
|
|
|
5529
5748
|
return Stack;
|
|
5530
5749
|
})();
|
|
5531
5750
|
|
|
5532
|
-
},{"./../lang/assert":
|
|
5751
|
+
},{"./../lang/assert":31}],17:[function(require,module,exports){
|
|
5533
5752
|
const is = require('./../lang/is');
|
|
5534
5753
|
|
|
5535
5754
|
module.exports = (() => {
|
|
@@ -5847,7 +6066,7 @@ module.exports = (() => {
|
|
|
5847
6066
|
return Tree;
|
|
5848
6067
|
})();
|
|
5849
6068
|
|
|
5850
|
-
},{"./../lang/is":
|
|
6069
|
+
},{"./../lang/is":35}],18:[function(require,module,exports){
|
|
5851
6070
|
const assert = require('./../../lang/assert'),
|
|
5852
6071
|
comparators = require('./comparators');
|
|
5853
6072
|
|
|
@@ -5966,7 +6185,7 @@ module.exports = (() => {
|
|
|
5966
6185
|
return ComparatorBuilder;
|
|
5967
6186
|
})();
|
|
5968
6187
|
|
|
5969
|
-
},{"./../../lang/assert":
|
|
6188
|
+
},{"./../../lang/assert":31,"./comparators":19}],19:[function(require,module,exports){
|
|
5970
6189
|
const assert = require('./../../lang/assert');
|
|
5971
6190
|
|
|
5972
6191
|
module.exports = (() => {
|
|
@@ -6056,7 +6275,7 @@ module.exports = (() => {
|
|
|
6056
6275
|
};
|
|
6057
6276
|
})();
|
|
6058
6277
|
|
|
6059
|
-
},{"./../../lang/assert":
|
|
6278
|
+
},{"./../../lang/assert":31}],20:[function(require,module,exports){
|
|
6060
6279
|
const Stack = require('./../Stack');
|
|
6061
6280
|
|
|
6062
6281
|
const assert = require('./../../lang/assert'),
|
|
@@ -6135,7 +6354,7 @@ module.exports = (() => {
|
|
|
6135
6354
|
return DisposableStack;
|
|
6136
6355
|
})();
|
|
6137
6356
|
|
|
6138
|
-
},{"./../../lang/Disposable":
|
|
6357
|
+
},{"./../../lang/Disposable":25,"./../../lang/assert":31,"./../../lang/is":35,"./../Stack":16}],21:[function(require,module,exports){
|
|
6139
6358
|
const assert = require('./assert');
|
|
6140
6359
|
|
|
6141
6360
|
module.exports = (() => {
|
|
@@ -6201,7 +6420,7 @@ module.exports = (() => {
|
|
|
6201
6420
|
return AdHoc;
|
|
6202
6421
|
})();
|
|
6203
6422
|
|
|
6204
|
-
},{"./assert":
|
|
6423
|
+
},{"./assert":31}],22:[function(require,module,exports){
|
|
6205
6424
|
const assert = require('./assert'),
|
|
6206
6425
|
Enum = require('./Enum'),
|
|
6207
6426
|
is = require('./is');
|
|
@@ -6307,7 +6526,7 @@ module.exports = (() => {
|
|
|
6307
6526
|
return Currency;
|
|
6308
6527
|
})();
|
|
6309
6528
|
|
|
6310
|
-
},{"./Enum":
|
|
6529
|
+
},{"./Enum":26,"./assert":31,"./is":35}],23:[function(require,module,exports){
|
|
6311
6530
|
const assert = require('./assert'),
|
|
6312
6531
|
ComparatorBuilder = require('./../collections/sorting/ComparatorBuilder'),
|
|
6313
6532
|
comparators = require('./../collections/sorting/comparators'),
|
|
@@ -6826,7 +7045,7 @@ module.exports = (() => {
|
|
|
6826
7045
|
return Day;
|
|
6827
7046
|
})();
|
|
6828
7047
|
|
|
6829
|
-
},{"./../collections/sorting/ComparatorBuilder":
|
|
7048
|
+
},{"./../collections/sorting/ComparatorBuilder":18,"./../collections/sorting/comparators":19,"./assert":31,"./is":35}],24:[function(require,module,exports){
|
|
6830
7049
|
const assert = require('./assert'),
|
|
6831
7050
|
Enum = require('./Enum'),
|
|
6832
7051
|
is = require('./is');
|
|
@@ -7408,7 +7627,7 @@ module.exports = (() => {
|
|
|
7408
7627
|
return Decimal;
|
|
7409
7628
|
})();
|
|
7410
7629
|
|
|
7411
|
-
},{"./Enum":
|
|
7630
|
+
},{"./Enum":26,"./assert":31,"./is":35,"big.js":44}],25:[function(require,module,exports){
|
|
7412
7631
|
const assert = require('./assert');
|
|
7413
7632
|
|
|
7414
7633
|
module.exports = (() => {
|
|
@@ -7519,7 +7738,7 @@ module.exports = (() => {
|
|
|
7519
7738
|
return Disposable;
|
|
7520
7739
|
})();
|
|
7521
7740
|
|
|
7522
|
-
},{"./assert":
|
|
7741
|
+
},{"./assert":31}],26:[function(require,module,exports){
|
|
7523
7742
|
const assert = require('./assert');
|
|
7524
7743
|
|
|
7525
7744
|
module.exports = (() => {
|
|
@@ -7639,7 +7858,7 @@ module.exports = (() => {
|
|
|
7639
7858
|
return Enum;
|
|
7640
7859
|
})();
|
|
7641
7860
|
|
|
7642
|
-
},{"./assert":
|
|
7861
|
+
},{"./assert":31}],27:[function(require,module,exports){
|
|
7643
7862
|
const assert = require('./assert'),
|
|
7644
7863
|
is = require('./is');
|
|
7645
7864
|
|
|
@@ -7740,7 +7959,7 @@ module.exports = (() => {
|
|
|
7740
7959
|
return Money;
|
|
7741
7960
|
})();
|
|
7742
7961
|
|
|
7743
|
-
},{"./Currency":
|
|
7962
|
+
},{"./Currency":22,"./Decimal":24,"./assert":31,"./is":35}],28:[function(require,module,exports){
|
|
7744
7963
|
const assert = require('./assert'),
|
|
7745
7964
|
memoize = require('./memoize');
|
|
7746
7965
|
|
|
@@ -7952,7 +8171,7 @@ module.exports = (() => {
|
|
|
7952
8171
|
return Rate;
|
|
7953
8172
|
})();
|
|
7954
8173
|
|
|
7955
|
-
},{"./Currency":
|
|
8174
|
+
},{"./Currency":22,"./Decimal":24,"./assert":31,"./memoize":36}],29:[function(require,module,exports){
|
|
7956
8175
|
const assert = require('./assert'),
|
|
7957
8176
|
is = require('./is');
|
|
7958
8177
|
|
|
@@ -8064,7 +8283,7 @@ module.exports = (() => {
|
|
|
8064
8283
|
return Timestamp;
|
|
8065
8284
|
})();
|
|
8066
8285
|
|
|
8067
|
-
},{"./assert":
|
|
8286
|
+
},{"./assert":31,"./is":35,"moment-timezone":46}],30:[function(require,module,exports){
|
|
8068
8287
|
const assert = require('./assert'),
|
|
8069
8288
|
is = require('./is');
|
|
8070
8289
|
|
|
@@ -8519,7 +8738,7 @@ module.exports = (() => {
|
|
|
8519
8738
|
}
|
|
8520
8739
|
})();
|
|
8521
8740
|
|
|
8522
|
-
},{"./assert":
|
|
8741
|
+
},{"./assert":31,"./is":35}],31:[function(require,module,exports){
|
|
8523
8742
|
const is = require('./is');
|
|
8524
8743
|
|
|
8525
8744
|
module.exports = (() => {
|
|
@@ -8664,7 +8883,7 @@ module.exports = (() => {
|
|
|
8664
8883
|
};
|
|
8665
8884
|
})();
|
|
8666
8885
|
|
|
8667
|
-
},{"./is":
|
|
8886
|
+
},{"./is":35}],32:[function(require,module,exports){
|
|
8668
8887
|
const assert = require('./assert'),
|
|
8669
8888
|
is = require('./is');
|
|
8670
8889
|
|
|
@@ -8827,7 +9046,7 @@ module.exports = (() => {
|
|
|
8827
9046
|
};
|
|
8828
9047
|
})();
|
|
8829
9048
|
|
|
8830
|
-
},{"./assert":
|
|
9049
|
+
},{"./assert":31,"./is":35}],33:[function(require,module,exports){
|
|
8831
9050
|
module.exports = (() => {
|
|
8832
9051
|
'use strict';
|
|
8833
9052
|
|
|
@@ -8887,7 +9106,7 @@ module.exports = (() => {
|
|
|
8887
9106
|
};
|
|
8888
9107
|
})();
|
|
8889
9108
|
|
|
8890
|
-
},{}],
|
|
9109
|
+
},{}],34:[function(require,module,exports){
|
|
8891
9110
|
module.exports = (() => {
|
|
8892
9111
|
'use strict';
|
|
8893
9112
|
|
|
@@ -8930,7 +9149,7 @@ module.exports = (() => {
|
|
|
8930
9149
|
};
|
|
8931
9150
|
})();
|
|
8932
9151
|
|
|
8933
|
-
},{}],
|
|
9152
|
+
},{}],35:[function(require,module,exports){
|
|
8934
9153
|
module.exports = (() => {
|
|
8935
9154
|
'use strict';
|
|
8936
9155
|
/**
|
|
@@ -9149,7 +9368,7 @@ module.exports = (() => {
|
|
|
9149
9368
|
};
|
|
9150
9369
|
})();
|
|
9151
9370
|
|
|
9152
|
-
},{}],
|
|
9371
|
+
},{}],36:[function(require,module,exports){
|
|
9153
9372
|
const assert = require('./assert');
|
|
9154
9373
|
|
|
9155
9374
|
module.exports = (() => {
|
|
@@ -9213,7 +9432,7 @@ module.exports = (() => {
|
|
|
9213
9432
|
};
|
|
9214
9433
|
})();
|
|
9215
9434
|
|
|
9216
|
-
},{"./assert":
|
|
9435
|
+
},{"./assert":31}],37:[function(require,module,exports){
|
|
9217
9436
|
const assert = require('./../lang/assert'),
|
|
9218
9437
|
Disposable = require('./../lang/Disposable');
|
|
9219
9438
|
|
|
@@ -9345,7 +9564,7 @@ module.exports = (() => {
|
|
|
9345
9564
|
return Event;
|
|
9346
9565
|
})();
|
|
9347
9566
|
|
|
9348
|
-
},{"./../lang/Disposable":
|
|
9567
|
+
},{"./../lang/Disposable":25,"./../lang/assert":31}],38:[function(require,module,exports){
|
|
9349
9568
|
const Currency = require('./../../lang/Currency'),
|
|
9350
9569
|
Money = require('./../../lang/Money');
|
|
9351
9570
|
|
|
@@ -9421,7 +9640,7 @@ module.exports = (() => {
|
|
|
9421
9640
|
return Component;
|
|
9422
9641
|
})();
|
|
9423
9642
|
|
|
9424
|
-
},{"./../../lang/Currency":
|
|
9643
|
+
},{"./../../lang/Currency":22,"./../../lang/Money":27,"./DataType":39,"./Field":40}],39:[function(require,module,exports){
|
|
9425
9644
|
const moment = require('moment');
|
|
9426
9645
|
|
|
9427
9646
|
const AdHoc = require('./../../lang/AdHoc'),
|
|
@@ -9737,7 +9956,7 @@ module.exports = (() => {
|
|
|
9737
9956
|
return DataType;
|
|
9738
9957
|
})();
|
|
9739
9958
|
|
|
9740
|
-
},{"./../../lang/AdHoc":
|
|
9959
|
+
},{"./../../lang/AdHoc":21,"./../../lang/Day":23,"./../../lang/Decimal":24,"./../../lang/Enum":26,"./../../lang/Timestamp":29,"./../../lang/assert":31,"./../../lang/is":35,"moment":48}],40:[function(require,module,exports){
|
|
9741
9960
|
module.exports = (() => {
|
|
9742
9961
|
'use strict';
|
|
9743
9962
|
/**
|
|
@@ -9798,7 +10017,7 @@ module.exports = (() => {
|
|
|
9798
10017
|
return Field;
|
|
9799
10018
|
})();
|
|
9800
10019
|
|
|
9801
|
-
},{}],
|
|
10020
|
+
},{}],41:[function(require,module,exports){
|
|
9802
10021
|
const attributes = require('./../../lang/attributes'),
|
|
9803
10022
|
functions = require('./../../lang/functions'),
|
|
9804
10023
|
is = require('./../../lang/is');
|
|
@@ -10121,7 +10340,7 @@ module.exports = (() => {
|
|
|
10121
10340
|
return Schema;
|
|
10122
10341
|
})();
|
|
10123
10342
|
|
|
10124
|
-
},{"./../../collections/LinkedList":
|
|
10343
|
+
},{"./../../collections/LinkedList":15,"./../../collections/Tree":17,"./../../lang/attributes":32,"./../../lang/functions":34,"./../../lang/is":35,"./Component":38,"./Field":40}],42:[function(require,module,exports){
|
|
10125
10344
|
const assert = require('./../../../lang/assert');
|
|
10126
10345
|
|
|
10127
10346
|
const Component = require('./../Component'),
|
|
@@ -10196,7 +10415,7 @@ module.exports = (() => {
|
|
|
10196
10415
|
return ComponentBuilder;
|
|
10197
10416
|
})();
|
|
10198
10417
|
|
|
10199
|
-
},{"./../../../lang/assert":
|
|
10418
|
+
},{"./../../../lang/assert":31,"./../Component":38,"./../DataType":39,"./../Field":40}],43:[function(require,module,exports){
|
|
10200
10419
|
const assert = require('./../../../lang/assert'),
|
|
10201
10420
|
is = require('./../../../lang/is');
|
|
10202
10421
|
|
|
@@ -10310,7 +10529,7 @@ module.exports = (() => {
|
|
|
10310
10529
|
return SchemaBuilder;
|
|
10311
10530
|
})();
|
|
10312
10531
|
|
|
10313
|
-
},{"./../../../lang/assert":
|
|
10532
|
+
},{"./../../../lang/assert":31,"./../../../lang/is":35,"./../Component":38,"./../DataType":39,"./../Field":40,"./../Schema":41,"./ComponentBuilder":42}],44:[function(require,module,exports){
|
|
10314
10533
|
/*
|
|
10315
10534
|
* big.js v5.2.2
|
|
10316
10535
|
* A small, fast, easy-to-use library for arbitrary-precision decimal arithmetic.
|
|
@@ -11253,7 +11472,7 @@ module.exports = (() => {
|
|
|
11253
11472
|
}
|
|
11254
11473
|
})(this);
|
|
11255
11474
|
|
|
11256
|
-
},{}],
|
|
11475
|
+
},{}],45:[function(require,module,exports){
|
|
11257
11476
|
module.exports={
|
|
11258
11477
|
"version": "2019b",
|
|
11259
11478
|
"zones": [
|
|
@@ -11854,11 +12073,11 @@ module.exports={
|
|
|
11854
12073
|
"Pacific/Tarawa|Pacific/Wallis"
|
|
11855
12074
|
]
|
|
11856
12075
|
}
|
|
11857
|
-
},{}],
|
|
12076
|
+
},{}],46:[function(require,module,exports){
|
|
11858
12077
|
var moment = module.exports = require("./moment-timezone");
|
|
11859
12078
|
moment.tz.load(require('./data/packed/latest.json'));
|
|
11860
12079
|
|
|
11861
|
-
},{"./data/packed/latest.json":
|
|
12080
|
+
},{"./data/packed/latest.json":45,"./moment-timezone":47}],47:[function(require,module,exports){
|
|
11862
12081
|
//! moment-timezone.js
|
|
11863
12082
|
//! version : 0.5.26
|
|
11864
12083
|
//! Copyright (c) JS Foundation and other contributors
|
|
@@ -12487,7 +12706,7 @@ moment.tz.load(require('./data/packed/latest.json'));
|
|
|
12487
12706
|
return moment;
|
|
12488
12707
|
}));
|
|
12489
12708
|
|
|
12490
|
-
},{"moment":
|
|
12709
|
+
},{"moment":48}],48:[function(require,module,exports){
|
|
12491
12710
|
//! moment.js
|
|
12492
12711
|
|
|
12493
12712
|
;(function (global, factory) {
|
|
@@ -17091,7 +17310,7 @@ moment.tz.load(require('./data/packed/latest.json'));
|
|
|
17091
17310
|
|
|
17092
17311
|
})));
|
|
17093
17312
|
|
|
17094
|
-
},{}],
|
|
17313
|
+
},{}],49:[function(require,module,exports){
|
|
17095
17314
|
var v1 = require('./v1');
|
|
17096
17315
|
var v4 = require('./v4');
|
|
17097
17316
|
|
|
@@ -17101,7 +17320,7 @@ uuid.v4 = v4;
|
|
|
17101
17320
|
|
|
17102
17321
|
module.exports = uuid;
|
|
17103
17322
|
|
|
17104
|
-
},{"./v1":
|
|
17323
|
+
},{"./v1":52,"./v4":53}],50:[function(require,module,exports){
|
|
17105
17324
|
/**
|
|
17106
17325
|
* Convert array of 16 byte values to UUID string format of the form:
|
|
17107
17326
|
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
|
@@ -17129,7 +17348,7 @@ function bytesToUuid(buf, offset) {
|
|
|
17129
17348
|
|
|
17130
17349
|
module.exports = bytesToUuid;
|
|
17131
17350
|
|
|
17132
|
-
},{}],
|
|
17351
|
+
},{}],51:[function(require,module,exports){
|
|
17133
17352
|
// Unique ID creation requires a high quality random # generator. In the
|
|
17134
17353
|
// browser this is a little complicated due to unknown quality of Math.random()
|
|
17135
17354
|
// and inconsistent support for the `crypto` API. We do the best we can via
|
|
@@ -17165,7 +17384,7 @@ if (getRandomValues) {
|
|
|
17165
17384
|
};
|
|
17166
17385
|
}
|
|
17167
17386
|
|
|
17168
|
-
},{}],
|
|
17387
|
+
},{}],52:[function(require,module,exports){
|
|
17169
17388
|
var rng = require('./lib/rng');
|
|
17170
17389
|
var bytesToUuid = require('./lib/bytesToUuid');
|
|
17171
17390
|
|
|
@@ -17276,7 +17495,7 @@ function v1(options, buf, offset) {
|
|
|
17276
17495
|
|
|
17277
17496
|
module.exports = v1;
|
|
17278
17497
|
|
|
17279
|
-
},{"./lib/bytesToUuid":
|
|
17498
|
+
},{"./lib/bytesToUuid":50,"./lib/rng":51}],53:[function(require,module,exports){
|
|
17280
17499
|
var rng = require('./lib/rng');
|
|
17281
17500
|
var bytesToUuid = require('./lib/bytesToUuid');
|
|
17282
17501
|
|
|
@@ -17307,7 +17526,7 @@ function v4(options, buf, offset) {
|
|
|
17307
17526
|
|
|
17308
17527
|
module.exports = v4;
|
|
17309
17528
|
|
|
17310
|
-
},{"./lib/bytesToUuid":
|
|
17529
|
+
},{"./lib/bytesToUuid":50,"./lib/rng":51}],54:[function(require,module,exports){
|
|
17311
17530
|
const Day = require('@barchart/common-js/lang/Day'),
|
|
17312
17531
|
Decimal = require('@barchart/common-js/lang/Decimal');
|
|
17313
17532
|
|
|
@@ -17938,7 +18157,7 @@ describe('After the PositionSummaryFrame enumeration is initialized', () => {
|
|
|
17938
18157
|
});
|
|
17939
18158
|
});
|
|
17940
18159
|
|
|
17941
|
-
},{"./../../../lib/data/PositionSummaryFrame":3,"./../../../lib/data/TransactionType":4,"@barchart/common-js/lang/Day":
|
|
18160
|
+
},{"./../../../lib/data/PositionSummaryFrame":3,"./../../../lib/data/TransactionType":4,"@barchart/common-js/lang/Day":23,"@barchart/common-js/lang/Decimal":24}],55:[function(require,module,exports){
|
|
17942
18161
|
const Day = require('@barchart/common-js/lang/Day');
|
|
17943
18162
|
|
|
17944
18163
|
const TransactionType = require('./../../../lib/data/TransactionType'),
|
|
@@ -18033,7 +18252,7 @@ describe('When requesting all the user-initiated transaction types', () => {
|
|
|
18033
18252
|
expect(userInitiated.length).toEqual(9);
|
|
18034
18253
|
});
|
|
18035
18254
|
});
|
|
18036
|
-
},{"./../../../lib/data/TransactionType":4,"./../../../lib/data/TransactionValidator":5,"@barchart/common-js/lang/Day":
|
|
18255
|
+
},{"./../../../lib/data/TransactionType":4,"./../../../lib/data/TransactionValidator":5,"@barchart/common-js/lang/Day":23}],56:[function(require,module,exports){
|
|
18037
18256
|
const Currency = require('@barchart/common-js/lang/Currency'),
|
|
18038
18257
|
Decimal = require('@barchart/common-js/lang/Decimal');
|
|
18039
18258
|
|
|
@@ -18220,7 +18439,73 @@ describe('When a position container data is gathered', () => {
|
|
|
18220
18439
|
});
|
|
18221
18440
|
});
|
|
18222
18441
|
|
|
18223
|
-
},{"./../../../lib/data/InstrumentType":1,"./../../../lib/data/PositionSummaryFrame":3,"./../../../lib/processing/PositionContainer":
|
|
18442
|
+
},{"./../../../lib/data/InstrumentType":1,"./../../../lib/data/PositionSummaryFrame":3,"./../../../lib/processing/PositionContainer":7,"./../../../lib/processing/definitions/PositionLevelDefinition":10,"./../../../lib/processing/definitions/PositionLevelType":11,"./../../../lib/processing/definitions/PositionTreeDefinition":12,"@barchart/common-js/lang/Currency":22,"@barchart/common-js/lang/Decimal":24}],57:[function(require,module,exports){
|
|
18443
|
+
const PositionSchema = require('./../../../lib/serialization/PositionSchema');
|
|
18444
|
+
|
|
18445
|
+
describe('When positions are serialized', () => {
|
|
18446
|
+
'use strict';
|
|
18447
|
+
|
|
18448
|
+
describe('for a read operation (user error #1)', () => {
|
|
18449
|
+
let position;
|
|
18450
|
+
let serialized;
|
|
18451
|
+
|
|
18452
|
+
beforeEach(() => {
|
|
18453
|
+
position = {
|
|
18454
|
+
"user": "855e15c0-9e32-40ac-9bd9-5f0cc2780111",
|
|
18455
|
+
"portfolio": "c2a743e8-8efa-4a88-9a6c-9202d3fec29f",
|
|
18456
|
+
"instrument": {
|
|
18457
|
+
"id": "TGAM-CASH-USD",
|
|
18458
|
+
"name": "US Dollar",
|
|
18459
|
+
"type": "CASH",
|
|
18460
|
+
"currency": "USD"
|
|
18461
|
+
},
|
|
18462
|
+
"position": "a5cdc2e8-d9c6-4a1f-8f05-e271a5824f87",
|
|
18463
|
+
"transaction": 2987,
|
|
18464
|
+
"cash": true,
|
|
18465
|
+
"valuation": "AVG",
|
|
18466
|
+
"snapshot": {
|
|
18467
|
+
"date": "2020-06-11",
|
|
18468
|
+
"open": "222105.56",
|
|
18469
|
+
"direction": "LONG",
|
|
18470
|
+
"buys": "0",
|
|
18471
|
+
"sells": "0",
|
|
18472
|
+
"gain": "0",
|
|
18473
|
+
"basis": "0",
|
|
18474
|
+
"income": "0",
|
|
18475
|
+
"value": "0"
|
|
18476
|
+
},
|
|
18477
|
+
"system": {
|
|
18478
|
+
"calculate": {
|
|
18479
|
+
"processors": 1
|
|
18480
|
+
},
|
|
18481
|
+
"locked": false
|
|
18482
|
+
}
|
|
18483
|
+
};
|
|
18484
|
+
|
|
18485
|
+
serialized = JSON.stringify(position);
|
|
18486
|
+
});
|
|
18487
|
+
|
|
18488
|
+
describe('and the data is deserialized', () => {
|
|
18489
|
+
let deserialized;
|
|
18490
|
+
|
|
18491
|
+
beforeEach(() => {
|
|
18492
|
+
const reviver = PositionSchema.CLIENT.schema.getReviver();
|
|
18493
|
+
|
|
18494
|
+
deserialized = JSON.parse(serialized, reviver);
|
|
18495
|
+
});
|
|
18496
|
+
|
|
18497
|
+
it('the deserialized data should be an object', () => {
|
|
18498
|
+
expect(typeof deserialized).toEqual('object');
|
|
18499
|
+
});
|
|
18500
|
+
|
|
18501
|
+
it('the deserialized data should be correct', () => {
|
|
18502
|
+
expect(deserialized.position).toEqual(position.position);
|
|
18503
|
+
});
|
|
18504
|
+
});
|
|
18505
|
+
});
|
|
18506
|
+
});
|
|
18507
|
+
|
|
18508
|
+
},{"./../../../lib/serialization/PositionSchema":13}],58:[function(require,module,exports){
|
|
18224
18509
|
const Day = require('@barchart/common-js/lang/Day'),
|
|
18225
18510
|
Decimal = require('@barchart/common-js/lang/Decimal');
|
|
18226
18511
|
|
|
@@ -18271,7 +18556,7 @@ describe('When transactions are serialized', () => {
|
|
|
18271
18556
|
expect(typeof serialized === 'string').toEqual(true);
|
|
18272
18557
|
});
|
|
18273
18558
|
|
|
18274
|
-
describe('and the
|
|
18559
|
+
describe('and the data is deserialized', () => {
|
|
18275
18560
|
let deserialized;
|
|
18276
18561
|
|
|
18277
18562
|
beforeEach(() => {
|
|
@@ -18287,4 +18572,4 @@ describe('When transactions are serialized', () => {
|
|
|
18287
18572
|
});
|
|
18288
18573
|
});
|
|
18289
18574
|
|
|
18290
|
-
},{"./../../../lib/data/TransactionType":4,"./../../../lib/serialization/TransactionSchema":
|
|
18575
|
+
},{"./../../../lib/data/TransactionType":4,"./../../../lib/serialization/TransactionSchema":14,"@barchart/common-js/lang/Day":23,"@barchart/common-js/lang/Decimal":24}]},{},[54,55,56,57,58]);
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
const PositionSchema = require('./../../../lib/serialization/PositionSchema');
|
|
2
|
+
|
|
3
|
+
describe('When positions are serialized', () => {
|
|
4
|
+
'use strict';
|
|
5
|
+
|
|
6
|
+
describe('for a read operation (user error #1)', () => {
|
|
7
|
+
let position;
|
|
8
|
+
let serialized;
|
|
9
|
+
|
|
10
|
+
beforeEach(() => {
|
|
11
|
+
position = {
|
|
12
|
+
"user": "855e15c0-9e32-40ac-9bd9-5f0cc2780111",
|
|
13
|
+
"portfolio": "c2a743e8-8efa-4a88-9a6c-9202d3fec29f",
|
|
14
|
+
"instrument": {
|
|
15
|
+
"id": "TGAM-CASH-USD",
|
|
16
|
+
"name": "US Dollar",
|
|
17
|
+
"type": "CASH",
|
|
18
|
+
"currency": "USD"
|
|
19
|
+
},
|
|
20
|
+
"position": "a5cdc2e8-d9c6-4a1f-8f05-e271a5824f87",
|
|
21
|
+
"transaction": 2987,
|
|
22
|
+
"cash": true,
|
|
23
|
+
"valuation": "AVG",
|
|
24
|
+
"snapshot": {
|
|
25
|
+
"date": "2020-06-11",
|
|
26
|
+
"open": "222105.56",
|
|
27
|
+
"direction": "LONG",
|
|
28
|
+
"buys": "0",
|
|
29
|
+
"sells": "0",
|
|
30
|
+
"gain": "0",
|
|
31
|
+
"basis": "0",
|
|
32
|
+
"income": "0",
|
|
33
|
+
"value": "0"
|
|
34
|
+
},
|
|
35
|
+
"system": {
|
|
36
|
+
"calculate": {
|
|
37
|
+
"processors": 1
|
|
38
|
+
},
|
|
39
|
+
"locked": false
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
serialized = JSON.stringify(position);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
describe('and the data is deserialized', () => {
|
|
47
|
+
let deserialized;
|
|
48
|
+
|
|
49
|
+
beforeEach(() => {
|
|
50
|
+
const reviver = PositionSchema.CLIENT.schema.getReviver();
|
|
51
|
+
|
|
52
|
+
deserialized = JSON.parse(serialized, reviver);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it('the deserialized data should be an object', () => {
|
|
56
|
+
expect(typeof deserialized).toEqual('object');
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it('the deserialized data should be correct', () => {
|
|
60
|
+
expect(deserialized.position).toEqual(position.position);
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
});
|
|
@@ -48,7 +48,7 @@ describe('When transactions are serialized', () => {
|
|
|
48
48
|
expect(typeof serialized === 'string').toEqual(true);
|
|
49
49
|
});
|
|
50
50
|
|
|
51
|
-
describe('and the
|
|
51
|
+
describe('and the data is deserialized', () => {
|
|
52
52
|
let deserialized;
|
|
53
53
|
|
|
54
54
|
beforeEach(() => {
|