🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@pear-protocol/utils

Package Overview
Dependencies
Maintainers
4
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pear-protocol/utils - npm Package Compare versions

Comparing version
0.0.22
to
0.0.23
+1
-1
dist/index.d.ts

@@ -5,3 +5,3 @@ export * from './asset/index';

export * from './fills/index';
export { countDecimals, exponentiate } from './math/index';
export * from './math/index';
export * from './position/index';

@@ -8,0 +8,0 @@ export * from './precise-price';

@@ -10,2 +10,6 @@ import BigNumber7, { BigNumber } from 'bignumber.js';

}
function sign(value) {
if (value.isZero()) return 0;
return value.isPositive() ? 1 : -1;
}
function countDecimals(value) {

@@ -15,2 +19,5 @@ const parts = value.split(".");

}
function compareValue(track, value, threshold) {
return track === "PEAK" ? value.isGreaterThanOrEqualTo(threshold) : value.isLessThan(threshold);
}

@@ -134,4 +141,4 @@ // src/fills/compute.ts

if (priceNum <= 0) return null;
const sign = leg.side === "BUY" ? 1 : -1;
logSum += sign * leg.weight * Math.log(priceNum);
const sign2 = leg.side === "BUY" ? 1 : -1;
logSum += sign2 * leg.weight * Math.log(priceNum);
}

@@ -477,4 +484,4 @@ return exponentiate(logSum);

const quantity = new BigNumber(fill.quantity);
const sign = fill.side === "BUY" ? 1 : -1;
const signedQuantity = quantity.multipliedBy(sign);
const sign2 = fill.side === "BUY" ? 1 : -1;
const signedQuantity = quantity.multipliedBy(sign2);
netDelta = netDelta.plus(signedQuantity);

@@ -496,4 +503,4 @@ }

}
const sign = fill.side === "BUY" ? 1 : -1;
const quantity = new BigNumber(fill.quantity).multipliedBy(sign);
const sign2 = fill.side === "BUY" ? 1 : -1;
const quantity = new BigNumber(fill.quantity).multipliedBy(sign2);
walkDelta = walkDelta.minus(quantity);

@@ -611,2 +618,2 @@ }

export { baseToContracts, computeAssetEntryNotional, computeAssetGrossRealizedPnL, computeAssetRealizedPnLs, computeAssetUnrealizedPnL, computeAssetUnrealizedPnLs, computeBasketWeightedRatioV1, computeEntryPriceForAsset, computeRealizedPositionState, computeSyncPayload, computeUnrealizedPositionState, contractsToBase, countDecimals, exponentiate, precisePrice, preciseQuantity, validateLeverage, validateQuantity };
export { BIPS, ZERO, baseToContracts, compareValue, computeAssetEntryNotional, computeAssetGrossRealizedPnL, computeAssetRealizedPnLs, computeAssetUnrealizedPnL, computeAssetUnrealizedPnLs, computeBasketWeightedRatioV1, computeEntryPriceForAsset, computeRealizedPositionState, computeSyncPayload, computeUnrealizedPositionState, contractsToBase, countDecimals, exponentiate, precisePrice, preciseQuantity, sign, validateLeverage, validateQuantity };

@@ -24,1 +24,2 @@ import BigNumber from 'bignumber.js';

export declare function countDecimals(value: string): number;
export declare function compareValue(track: 'PEAK' | 'TROUGH', value: BigNumber, threshold: number): boolean;
{
"name": "@pear-protocol/utils",
"version": "0.0.22",
"version": "0.0.23",
"description": "Pear Protocol Utility functions",

@@ -29,3 +29,3 @@ "private": false,

"dependencies": {
"@pear-protocol/types": "^0.1.0",
"@pear-protocol/types": "^1.0.0",
"bignumber.js": "9.3.1"

@@ -32,0 +32,0 @@ },