🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@pear-protocol/utils

Package Overview
Dependencies
Maintainers
3
Versions
21
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.18
to
0.0.19
+0
-4
dist/basket/basket.types.d.ts

@@ -7,5 +7,1 @@ import type { InstrumentId, Side } from '@pear-protocol/types';

};
export type BasketIndexLeg = {
symbol: InstrumentId;
weight: number;
};
+1
-2
import type { InstrumentId } from '@pear-protocol/types';
import BigNumber from 'bignumber.js';
import type { BasketIndexLeg, BasketLeg } from './basket.types';
import type { BasketLeg } from './basket.types';
type PriceMap = Record<InstrumentId, string>;

@@ -15,3 +15,2 @@ /**

export declare function computeBasketWeightedRatioV1(basket: BasketLeg[], priceMap: PriceMap): BigNumber | null;
export declare function computeBasketIndexV1(basket: BasketIndexLeg[], priceMap: PriceMap): BigNumber | null;
export {};

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

}
function computeBasketIndexV1(basket, priceMap) {
let logSum = 0;
for (const leg of basket) {
const price = priceMap[leg.symbol];
if (!price) return null;
const priceNum = Number(price);
if (priceNum <= 0) return null;
logSum += leg.weight * Math.log(priceNum);
}
return exponentiate(logSum);
}
function contractsToBase(contracts, contractSize) {

@@ -618,2 +607,2 @@ return new BigNumber7(contracts).times(contractSize);

export { baseToContracts, computeAssetEntryNotional, computeAssetGrossRealizedPnL, computeAssetRealizedPnLs, computeAssetUnrealizedPnL, computeAssetUnrealizedPnLs, computeBasketIndexV1, computeBasketWeightedRatioV1, computeEntryPriceForAsset, computeRealizedPositionState, computeSyncPayload, computeUnrealizedPositionState, contractsToBase, countDecimals, exponentiate, precisePrice, preciseQuantity, validateLeverage, validateQuantity };
export { baseToContracts, computeAssetEntryNotional, computeAssetGrossRealizedPnL, computeAssetRealizedPnLs, computeAssetUnrealizedPnL, computeAssetUnrealizedPnLs, computeBasketWeightedRatioV1, computeEntryPriceForAsset, computeRealizedPositionState, computeSyncPayload, computeUnrealizedPositionState, contractsToBase, countDecimals, exponentiate, precisePrice, preciseQuantity, validateLeverage, validateQuantity };
{
"name": "@pear-protocol/utils",
"version": "0.0.18",
"version": "0.0.19",
"description": "Pear Protocol Utility functions",

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

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

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