@barchart/portfolio-api-common 1.2.91 → 1.2.92
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.
|
@@ -171,6 +171,16 @@ module.exports = (() => {
|
|
|
171
171
|
* @property {Day} end
|
|
172
172
|
*/
|
|
173
173
|
|
|
174
|
+
/**
|
|
175
|
+
* The start and and date for a {@link PositionSummaryFrame} along with the frame type.
|
|
176
|
+
*
|
|
177
|
+
* @typedef PositionSummaryDefinition
|
|
178
|
+
* @type {Object}
|
|
179
|
+
* @property {Day} start
|
|
180
|
+
* @property {Day} end
|
|
181
|
+
* @property {PositionSummaryFrame} frame
|
|
182
|
+
*/
|
|
183
|
+
|
|
174
184
|
function getRange(start, end) {
|
|
175
185
|
return {
|
|
176
186
|
start: start,
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
const DataType = require('@barchart/common-js/serialization/json/DataType'),
|
|
2
|
+
Enum = require('@barchart/common-js/lang/Enum'),
|
|
3
|
+
Schema = require('@barchart/common-js/serialization/json/Schema'),
|
|
4
|
+
SchemaBuilder = require('@barchart/common-js/serialization/json/builders/SchemaBuilder');
|
|
5
|
+
|
|
6
|
+
const PositionSummaryFrame = require('./../data/PositionSummaryFrame');
|
|
7
|
+
|
|
8
|
+
module.exports = (() => {
|
|
9
|
+
'use strict';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The schemas which can be used to represent position summary objects.
|
|
13
|
+
*
|
|
14
|
+
* @public
|
|
15
|
+
* @extends {Enum}
|
|
16
|
+
*/
|
|
17
|
+
class PositionSummaryDefinitionSchema extends Enum {
|
|
18
|
+
constructor(schema) {
|
|
19
|
+
super(schema.name, schema.name);
|
|
20
|
+
|
|
21
|
+
this._schema = schema;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The actual {@link Schema}.
|
|
26
|
+
*
|
|
27
|
+
* @public
|
|
28
|
+
* @returns {Schema}
|
|
29
|
+
*/
|
|
30
|
+
get schema() {
|
|
31
|
+
return this._schema;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The complete position summary definition schema.
|
|
36
|
+
*
|
|
37
|
+
* @static
|
|
38
|
+
* @public
|
|
39
|
+
* @returns {PositionSummaryDefinitionSchema}
|
|
40
|
+
*/
|
|
41
|
+
static get COMPLETE() {
|
|
42
|
+
return complete;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
toString() {
|
|
46
|
+
return '[PositionSummaryDefinitionSchema]';
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const complete = new PositionSummaryDefinitionSchema(SchemaBuilder.withName('complete')
|
|
51
|
+
.withField('start', DataType.DAY)
|
|
52
|
+
.withField('end', DataType.DAY)
|
|
53
|
+
.withField('frame', DataType.forEnum(PositionSummaryFrame, 'PositionSummaryFrame'))
|
|
54
|
+
.schema
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
return PositionSummaryDefinitionSchema;
|
|
58
|
+
})();
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
const
|
|
2
|
-
DataType = require('@barchart/common-js/serialization/json/DataType'),
|
|
1
|
+
const DataType = require('@barchart/common-js/serialization/json/DataType'),
|
|
3
2
|
Enum = require('@barchart/common-js/lang/Enum'),
|
|
4
3
|
Schema = require('@barchart/common-js/serialization/json/Schema'),
|
|
5
4
|
SchemaBuilder = require('@barchart/common-js/serialization/json/builders/SchemaBuilder');
|
package/package.json
CHANGED
package/test/SpecRunner.js
CHANGED
|
@@ -562,6 +562,16 @@ module.exports = (() => {
|
|
|
562
562
|
* @property {Day} end
|
|
563
563
|
*/
|
|
564
564
|
|
|
565
|
+
/**
|
|
566
|
+
* The start and and date for a {@link PositionSummaryFrame} along with the frame type.
|
|
567
|
+
*
|
|
568
|
+
* @typedef PositionSummaryDefinition
|
|
569
|
+
* @type {Object}
|
|
570
|
+
* @property {Day} start
|
|
571
|
+
* @property {Day} end
|
|
572
|
+
* @property {PositionSummaryFrame} frame
|
|
573
|
+
*/
|
|
574
|
+
|
|
565
575
|
function getRange(start, end) {
|
|
566
576
|
return {
|
|
567
577
|
start: start,
|