@barchart/portfolio-api-common 1.0.14 → 1.0.15

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.
@@ -0,0 +1,126 @@
1
+ const assert = require('@barchart/common-js/lang/assert'),
2
+ Enum = require('@barchart/common-js/lang/Enum');
3
+
4
+ module.exports = (() => {
5
+ 'use strict';
6
+
7
+ /**
8
+ * An enumeration item that describes a strategy for calculating basis.
9
+ *
10
+ * @public
11
+ * @extends {Enum}
12
+ * @param {String} description
13
+ * @param {String} code
14
+ */
15
+ class PortfolioType extends Enum {
16
+ constructor(code, description) {
17
+ super(code, description);
18
+ }
19
+
20
+ /**
21
+ * Given a code, returns the enumeration item.
22
+ *
23
+ * @public
24
+ * @param {String} code
25
+ * @returns {PortfolioType|null}
26
+ */
27
+ static parse(code) {
28
+ return Enum.fromCode(PortfolioType, code);
29
+ }
30
+
31
+ /**
32
+ * A valuation method that uses first-in, first-out methodology.
33
+ *
34
+ * @public
35
+ * @returns {PortfolioType}
36
+ */
37
+ static get TFSA() {
38
+ return tfsa;
39
+ }
40
+
41
+ /**
42
+ * A valuation method that uses first-in, first-out methodology.
43
+ *
44
+ * @public
45
+ * @returns {PortfolioType}
46
+ */
47
+ static get RRSP() {
48
+ return rrsp;
49
+ }
50
+
51
+ /**
52
+ * A valuation method that uses first-in, first-out methodology.
53
+ *
54
+ * @public
55
+ * @returns {PortfolioType}
56
+ */
57
+ static get RRIF() {
58
+ return rrif;
59
+ }
60
+
61
+ /**
62
+ * A valuation method that uses first-in, first-out methodology.
63
+ *
64
+ * @public
65
+ * @returns {PortfolioType}
66
+ */
67
+ static get RESP() {
68
+ return resp;
69
+ }
70
+
71
+ /**
72
+ * A valuation method that uses first-in, first-out methodology.
73
+ *
74
+ * @public
75
+ * @returns {PortfolioType}
76
+ */
77
+ static get RDSP() {
78
+ return rdsp;
79
+ }
80
+
81
+ /**
82
+ * A valuation method that uses first-in, first-out methodology.
83
+ *
84
+ * @public
85
+ * @returns {PortfolioType}
86
+ */
87
+ static get IRA() {
88
+ return ira;
89
+ }
90
+
91
+ /**
92
+ * A valuation method that uses first-in, first-out methodology.
93
+ *
94
+ * @public
95
+ * @returns {PortfolioType}
96
+ */
97
+ static get CASH() {
98
+ return cash;
99
+ }
100
+
101
+ /**
102
+ * A valuation method that uses first-in, first-out methodology.
103
+ *
104
+ * @public
105
+ * @returns {PortfolioType}
106
+ */
107
+ static get OTHER() {
108
+ return other;
109
+ }
110
+
111
+ toString() {
112
+ return '[PortfolioType]';
113
+ }
114
+ }
115
+
116
+ const tfsa = new PortfolioType('TFSA', 'Tax-Free Savings (TFSA)');
117
+ const rrsp = new PortfolioType('RRSP', 'Retirement Savings (RRSP)');
118
+ const rrif = new PortfolioType('RRIF', 'Retirement Income (RRIF)');
119
+ const resp = new PortfolioType('RESP', 'Education Savings (RESP)');
120
+ const rdsp = new PortfolioType('RDSP', 'Disability Savings (RDSP)');
121
+ const ira = new PortfolioType('IRA', 'Individual Retirement Account (IRA)');
122
+ const cash = new PortfolioType('CASH', 'Taxable (Cash)');
123
+ const other = new PortfolioType('OTHER', 'Other Assets');
124
+
125
+ return PortfolioType;
126
+ })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barchart/portfolio-api-common",
3
- "version": "1.0.14",
3
+ "version": "1.0.15",
4
4
  "description": "Common classes used by the Portfolio system",
5
5
  "author": {
6
6
  "name": "Bryan Ingle",