Skip to content

Commit

Permalink
Release. Bump version number
Browse files Browse the repository at this point in the history
  • Loading branch information
bryaningl3 committed Apr 5, 2021
1 parent 7cd4a37 commit d1735f9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@barchart/portfolio-api-common",
"version": "1.11.2",
"version": "1.11.3",
"description": "Common code used by the Portfolio system",
"author": {
"name": "Bryan Ingle",
Expand Down
10 changes: 5 additions & 5 deletions test/SpecRunner.js
Original file line number Diff line number Diff line change
Expand Up @@ -3689,7 +3689,7 @@ module.exports = (() => {
let marketChange = updates.market.subtract(actual.marketPrevious);
let marketChangePercent;

if (actual.marketPrevious.getIsZero()) {
if (actual.marketPrevious.getIsApproximate(Decimal.ZERO, 4)) {
if (marketChange.getIsPositive()) {
marketChangePercent = Decimal.ONE;
} else if (marketChange.getIsNegative()) {
Expand Down Expand Up @@ -3747,7 +3747,7 @@ module.exports = (() => {
if (parent && !excluded) {
const parentData = parent._dataActual;

if (parentData.marketAbsolute !== null && !parentData.marketAbsolute.getIsZero()) {
if (parentData.marketAbsolute !== null && !parentData.marketAbsolute.getIsApproximate(Decimal.ZERO, 4)) {
let numerator;

if (group.currency !== parent.currency) {
Expand Down Expand Up @@ -3789,7 +3789,7 @@ module.exports = (() => {
const numerator = actual.realized;
const denominator = totalBasis.subtract(openBasis);

if (denominator.getIsZero()) {
if (denominator.getIsApproximate(Decimal.ZERO, 4)) {
actual.realizedPercent = Decimal.ZERO;
} else {
actual.realizedPercent = numerator.divide(denominator);
Expand All @@ -3805,7 +3805,7 @@ module.exports = (() => {
const numerator = actual.unrealized;
const denominator = actual.basis.absolute();

if (denominator.getIsZero()) {
if (denominator.getIsApproximate(Decimal.ZERO, 4)) {
actual.unrealizedPercent = Decimal.ZERO;
} else {
actual.unrealizedPercent = numerator.divide(denominator);
Expand All @@ -3815,7 +3815,7 @@ module.exports = (() => {
}

function calculateGainPercent(gain, basis) {
return basis.getIsZero() ? Decimal.ZERO : gain.divide(basis);
return basis.getIsApproximate(Decimal.ZERO, 4) ? Decimal.ZERO : gain.divide(basis);
}

const unchanged = { up: false, down: false };
Expand Down

0 comments on commit d1735f9

Please sign in to comment.