@barchart/portfolio-client-js 1.1.9 → 1.1.12
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.
- package/example/example.html +18 -5
- package/example/example.js +708 -216
- package/example/example.shim.js +6 -2
- package/lib/gateway/PortfolioGateway.js +70 -18
- package/lib/index.js +1 -1
- package/package.json +1 -1
package/example/example.html
CHANGED
|
@@ -49,8 +49,6 @@
|
|
|
49
49
|
.then((data) => {
|
|
50
50
|
writeConsoleText(action, true);
|
|
51
51
|
writeConsoleObject(data);
|
|
52
|
-
|
|
53
|
-
debugger;
|
|
54
52
|
}).catch((e) => {
|
|
55
53
|
writeConsoleText(action, true);
|
|
56
54
|
writeConsoleObject(e);
|
|
@@ -63,15 +61,15 @@
|
|
|
63
61
|
|
|
64
62
|
var portfolio = {
|
|
65
63
|
name: `Random ${Math.random()}`,
|
|
66
|
-
timezone:
|
|
64
|
+
timezone: Barchart.Timezones.AMERICA_NEW_YORK,
|
|
67
65
|
dates: {
|
|
68
66
|
create: Barchart.Day.getToday(),
|
|
69
67
|
cash: Barchart.Day.getToday()
|
|
70
68
|
},
|
|
71
69
|
defaults: {
|
|
72
|
-
currency:
|
|
70
|
+
currency: Barchart.Currency.CAD,
|
|
73
71
|
reinvest: true,
|
|
74
|
-
valuation:
|
|
72
|
+
valuation: Barchart.ValuationType.AVERAGE_COST
|
|
75
73
|
},
|
|
76
74
|
miscellany: {
|
|
77
75
|
testing: {
|
|
@@ -154,6 +152,20 @@
|
|
|
154
152
|
writeConsoleText(action, true);
|
|
155
153
|
writeConsoleObject(e);
|
|
156
154
|
|
|
155
|
+
that.setConsoleMode();
|
|
156
|
+
});
|
|
157
|
+
};
|
|
158
|
+
var readPositionSummaries = function() {
|
|
159
|
+
var action = 'portfolioGateway.readPositionSummaries()';
|
|
160
|
+
|
|
161
|
+
that.gateway.readPositionSummaries(that.portfolio() || null, that.position() || null)
|
|
162
|
+
.then((data) => {
|
|
163
|
+
writeConsoleText(action, true);
|
|
164
|
+
writeConsoleObject(data);
|
|
165
|
+
}).catch((e) => {
|
|
166
|
+
writeConsoleText(action, true);
|
|
167
|
+
writeConsoleObject(e);
|
|
168
|
+
|
|
157
169
|
that.setConsoleMode();
|
|
158
170
|
});
|
|
159
171
|
};
|
|
@@ -300,6 +312,7 @@
|
|
|
300
312
|
{ text: 'Update Portfolio', action: updatePortfolio },
|
|
301
313
|
{ text: 'Delete Portfolio', action: deletePortfolio },
|
|
302
314
|
{ text: 'Get Positions', action: getPositions },
|
|
315
|
+
{ text: 'Get Positions Summaries', action: readPositionSummaries },
|
|
303
316
|
{ text: 'Delete Position', action: deletePosition },
|
|
304
317
|
{ text: 'Get Transactions', action: getTransactions },
|
|
305
318
|
{ text: 'Get Transactions (Formatted)', action: getTransactionsFormatted },
|