@barchart/portfolio-api-common 1.2.13 → 1.2.14

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.
@@ -197,8 +197,18 @@ module.exports = (() => {
197
197
  });
198
198
 
199
199
  formatters.set(TransactionType.VALUATION, (t) => {
200
+ let rate;
201
+
202
+ if (t.valuation.rate) {
203
+ rate = t.valuation.rate;
204
+ } else if (t.snapshot.open.getIsZero()) {
205
+ rate = null;
206
+ } else {
207
+ rate = t.valuation.value.divide(t.snapshot.open)
208
+ }
209
+
200
210
  return {
201
- price: t.valuation.value
211
+ rate: rate
202
212
  };
203
213
  });
204
214
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barchart/portfolio-api-common",
3
- "version": "1.2.13",
3
+ "version": "1.2.14",
4
4
  "description": "Common classes used by the Portfolio system",
5
5
  "author": {
6
6
  "name": "Bryan Ingle",