@panoptic-eng/sdk 1.0.54 → 1.0.55
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/dist/index.d.ts +58 -58
- package/dist/index.d.ts.map +1 -1
- package/dist/panoptic/v2/index.d.ts +39 -1
- package/dist/panoptic/v2/index.d.ts.map +1 -1
- package/dist/panoptic/v2/index.js +62 -1
- package/dist/panoptic/v2/index.js.map +1 -1
- package/dist/panoptic/v2/react-public.d.ts +39 -1
- package/dist/panoptic/v2/react-public.d.ts.map +1 -1
- package/dist/panoptic/v2/react-public.js +62 -1
- package/dist/panoptic/v2/react-public.js.map +1 -1
- package/dist/uniswap/index.d.ts +80 -1
- package/dist/uniswap/index.d.ts.map +1 -1
- package/dist/uniswap/index.js +113 -1
- package/dist/uniswap/index.js.map +1 -1
- package/dist/{v2-DZ8JTfEs.js → v2-bpvC_P3W.js} +62 -1
- package/package.json +1 -1
|
@@ -9590,6 +9590,67 @@ function isGasError(error) {
|
|
|
9590
9590
|
return /replacement transaction underpriced/i.test(message) || /gas too low/i.test(message) || /intrinsic gas too low/i.test(message) || /max fee per gas less than block base fee/i.test(message);
|
|
9591
9591
|
}
|
|
9592
9592
|
|
|
9593
|
+
//#endregion
|
|
9594
|
+
//#region src/analytics/beta.ts
|
|
9595
|
+
/**
|
|
9596
|
+
* Realized beta of `tokenReturns` on `refReturns`. Both must be index-aligned and
|
|
9597
|
+
* the same length. Returns `null` when there are too few points or the reference
|
|
9598
|
+
* has no variance (a flat series has no defined slope).
|
|
9599
|
+
*/
|
|
9600
|
+
function realizedBeta(tokenReturns, refReturns, { minSamples = 8 } = {}) {
|
|
9601
|
+
const n = Math.min(tokenReturns.length, refReturns.length);
|
|
9602
|
+
if (n < minSamples) return null;
|
|
9603
|
+
let sumT = 0;
|
|
9604
|
+
let sumR = 0;
|
|
9605
|
+
let count = 0;
|
|
9606
|
+
for (let i = 0; i < n; i++) {
|
|
9607
|
+
const t = tokenReturns[i];
|
|
9608
|
+
const r = refReturns[i];
|
|
9609
|
+
if (!Number.isFinite(t) || !Number.isFinite(r)) continue;
|
|
9610
|
+
sumT += t;
|
|
9611
|
+
sumR += r;
|
|
9612
|
+
count++;
|
|
9613
|
+
}
|
|
9614
|
+
if (count < minSamples) return null;
|
|
9615
|
+
const meanT = sumT / count;
|
|
9616
|
+
const meanR = sumR / count;
|
|
9617
|
+
let cov = 0;
|
|
9618
|
+
let varR = 0;
|
|
9619
|
+
let varT = 0;
|
|
9620
|
+
for (let i = 0; i < n; i++) {
|
|
9621
|
+
const t = tokenReturns[i];
|
|
9622
|
+
const r = refReturns[i];
|
|
9623
|
+
if (!Number.isFinite(t) || !Number.isFinite(r)) continue;
|
|
9624
|
+
const dt = t - meanT;
|
|
9625
|
+
const dr = r - meanR;
|
|
9626
|
+
cov += dt * dr;
|
|
9627
|
+
varR += dr * dr;
|
|
9628
|
+
varT += dt * dt;
|
|
9629
|
+
}
|
|
9630
|
+
if (!(varR > 0)) return null;
|
|
9631
|
+
const beta = cov / varR;
|
|
9632
|
+
const rSquared = varT > 0 ? cov * cov / (varR * varT) : 0;
|
|
9633
|
+
return {
|
|
9634
|
+
beta,
|
|
9635
|
+
rSquared: Math.min(1, Math.max(0, rSquared)),
|
|
9636
|
+
samples: count
|
|
9637
|
+
};
|
|
9638
|
+
}
|
|
9639
|
+
/**
|
|
9640
|
+
* Log returns of a price series (`ln(p_i / p_{i-1})`), skipping non-positive or
|
|
9641
|
+
* non-finite prices by emitting `NaN` at that step so downstream alignment stays
|
|
9642
|
+
* index-consistent. The output is one shorter than the input.
|
|
9643
|
+
*/
|
|
9644
|
+
function logReturns(prices) {
|
|
9645
|
+
const out = [];
|
|
9646
|
+
for (let i = 1; i < prices.length; i++) {
|
|
9647
|
+
const a = prices[i - 1];
|
|
9648
|
+
const b = prices[i];
|
|
9649
|
+
out.push(Number.isFinite(a) && Number.isFinite(b) && a > 0 && b > 0 ? Math.log(b / a) : Number.NaN);
|
|
9650
|
+
}
|
|
9651
|
+
return out;
|
|
9652
|
+
}
|
|
9653
|
+
|
|
9593
9654
|
//#endregion
|
|
9594
9655
|
//#region src/analytics/market-indicators.ts
|
|
9595
9656
|
const D = Decimal.clone({ precision: 40 });
|
|
@@ -9783,4 +9844,4 @@ function calculateVarianceProfile(candles, isAssetToken0, intervalSeconds = 3600
|
|
|
9783
9844
|
}
|
|
9784
9845
|
|
|
9785
9846
|
//#endregion
|
|
9786
|
-
export { DEFAULT_MIN_SWAP_RATIO_BPS, DEFAULT_RECONNECT_CONFIG, MARKET_INDICATOR_PERIODS, REQUIRED_BASE_ERROR_SENTINEL, STRIKE_LADDER_TARGET_STRIKES, VARIANCE_RATIO_LAG, addPendingPosition, addTrackedChunks, apportion, assertCanBurn, assertCanForceExercise, assertCanLiquidate, assertCanMint, assertFresh, assertHealthy, assertLpPositionFunded, assertTradeable, buildCreditWrappedDispatch, buildSfpmSwapCalldata, buildSfpmSwapPlan, buildTemporaryLoanRecoveryDispatch, buildTokenShortfallRecoveryDispatch, calculateAccountGreeksPure, calculateMarketIndicator, calculateSpreadWad, calculateVarianceProfile, checkCollateralAcrossTicks, classifyStrategyGroups, classifyStrike, cleanupStalePendingPositions, clearPendingPositions, clearTrackedChunks, clearTradeHistory, collateralRuleKindFor, computeV4PoolId, confirmPendingPosition, convertToAssets, convertToShares, createEventPoller, createEventSubscription, createFlowNeutralTokenId, decodePanopticTokenURI, emptyLiquidateParams, encodePoolKeyBytes, encodeV3PoolKeyBytes, ensureSfpmV3PoolInitialized, estimateBlockNumbers, estimateCollateralBreakdown, estimateCollateralRequired, failPendingPosition, feesFromFeeGrowthDelta, fetchSfpmV3PoolId, getAccountBuyingPower, getAccountGreeks, getAccountHistory, getChunkLiquidities, getChunkSpreads, getClosedPositions, getCollateralRequiredBase, getCollateralSharePrices, getCollateralTotalAssetsBatch, getDeltaHedgeParams, getEnforcedTickLimits, getExecutableLpMaxSize, getFactoryConstructMetadata, getFactoryOwnerOf, getFactoryTokenURI, getGuardianUnlockState, getHedgeLimits, getItmAmounts, getMarginBuffer, getMaxPositionSize, getMaxRedeem, getMaxWithdrawable, getNativeTokenPrice, getNotEnoughTokensError, getOpenPositionPreview, getPanopticPoolAddress, getPanopticPoolFromPoolId, getPendingPositions, getPoolCollateralAddresses, getPoolLiquidities, getPortfolioValue, getPositionChunkData, getPositionEnrichmentData, getPriceHistory, getRealizedPnL, getRequiredCreditForITM, getSafeMode, getStreamiaHistory, getSyncStatus, getTrackedChunks, getTradeHistory, getUniswapFeeHistory, getUniswapV3LpPositionState, getUniswapV3PoolFromId, getUniswapV3PoolInfo, getUniswapV3PoolLiquidities, getUniswapV4LpPositionState, getUniswapV4PoolBasicState, getUniswapV4PoolInfo, getUniswapV4PoolKeyFromId, getUniswapV4PoolLiquidities, interpolateBlocks, isGasError, isNonceError, isRetryableRpcError, isolateGroupTokenId, ladderStrikeSequence, minePoolAddress, minePoolAddressLocalAsync, multicallRead, optimizeTokenIdRiskPartners, parseCollateralLog, parsePoolLog, prepareIndicatorCandles, previewDeposit, previewMint, previewRedeem, previewWithdraw, quoteLiquidation, quoteOneTokenFlow, quoteSfpmSwap, quoteTemporaryLoanRecovery, quoteTokenShortfallRecovery, removeTrackedChunks, resolveBlockNumbers, resolveLadderStrike, resolvePanopticPoolFromPoolId, resolveUniswapV4PoolKey, saveClosedPosition, scaleCollateralRequired, scanChunks, screenAccountExact, simulateBatchDispatch, simulateClosePosition, simulateDeployNewPool, simulateDeposit, simulateDispatch, simulateForceExercise, simulateLiquidate, simulateSFPMBurn, simulateSFPMMint, simulateSwapExactIn, simulateSwapExactOut, simulateWithdraw, slippageBpsToTickDistance, watchEvents };
|
|
9847
|
+
export { DEFAULT_MIN_SWAP_RATIO_BPS, DEFAULT_RECONNECT_CONFIG, MARKET_INDICATOR_PERIODS, REQUIRED_BASE_ERROR_SENTINEL, STRIKE_LADDER_TARGET_STRIKES, VARIANCE_RATIO_LAG, addPendingPosition, addTrackedChunks, apportion, assertCanBurn, assertCanForceExercise, assertCanLiquidate, assertCanMint, assertFresh, assertHealthy, assertLpPositionFunded, assertTradeable, buildCreditWrappedDispatch, buildSfpmSwapCalldata, buildSfpmSwapPlan, buildTemporaryLoanRecoveryDispatch, buildTokenShortfallRecoveryDispatch, calculateAccountGreeksPure, calculateMarketIndicator, calculateSpreadWad, calculateVarianceProfile, checkCollateralAcrossTicks, classifyStrategyGroups, classifyStrike, cleanupStalePendingPositions, clearPendingPositions, clearTrackedChunks, clearTradeHistory, collateralRuleKindFor, computeV4PoolId, confirmPendingPosition, convertToAssets, convertToShares, createEventPoller, createEventSubscription, createFlowNeutralTokenId, decodePanopticTokenURI, emptyLiquidateParams, encodePoolKeyBytes, encodeV3PoolKeyBytes, ensureSfpmV3PoolInitialized, estimateBlockNumbers, estimateCollateralBreakdown, estimateCollateralRequired, failPendingPosition, feesFromFeeGrowthDelta, fetchSfpmV3PoolId, getAccountBuyingPower, getAccountGreeks, getAccountHistory, getChunkLiquidities, getChunkSpreads, getClosedPositions, getCollateralRequiredBase, getCollateralSharePrices, getCollateralTotalAssetsBatch, getDeltaHedgeParams, getEnforcedTickLimits, getExecutableLpMaxSize, getFactoryConstructMetadata, getFactoryOwnerOf, getFactoryTokenURI, getGuardianUnlockState, getHedgeLimits, getItmAmounts, getMarginBuffer, getMaxPositionSize, getMaxRedeem, getMaxWithdrawable, getNativeTokenPrice, getNotEnoughTokensError, getOpenPositionPreview, getPanopticPoolAddress, getPanopticPoolFromPoolId, getPendingPositions, getPoolCollateralAddresses, getPoolLiquidities, getPortfolioValue, getPositionChunkData, getPositionEnrichmentData, getPriceHistory, getRealizedPnL, getRequiredCreditForITM, getSafeMode, getStreamiaHistory, getSyncStatus, getTrackedChunks, getTradeHistory, getUniswapFeeHistory, getUniswapV3LpPositionState, getUniswapV3PoolFromId, getUniswapV3PoolInfo, getUniswapV3PoolLiquidities, getUniswapV4LpPositionState, getUniswapV4PoolBasicState, getUniswapV4PoolInfo, getUniswapV4PoolKeyFromId, getUniswapV4PoolLiquidities, interpolateBlocks, isGasError, isNonceError, isRetryableRpcError, isolateGroupTokenId, ladderStrikeSequence, logReturns, minePoolAddress, minePoolAddressLocalAsync, multicallRead, optimizeTokenIdRiskPartners, parseCollateralLog, parsePoolLog, prepareIndicatorCandles, previewDeposit, previewMint, previewRedeem, previewWithdraw, quoteLiquidation, quoteOneTokenFlow, quoteSfpmSwap, quoteTemporaryLoanRecovery, quoteTokenShortfallRecovery, realizedBeta, removeTrackedChunks, resolveBlockNumbers, resolveLadderStrike, resolvePanopticPoolFromPoolId, resolveUniswapV4PoolKey, saveClosedPosition, scaleCollateralRequired, scanChunks, screenAccountExact, simulateBatchDispatch, simulateClosePosition, simulateDeployNewPool, simulateDeposit, simulateDispatch, simulateForceExercise, simulateLiquidate, simulateSFPMBurn, simulateSFPMMint, simulateSwapExactIn, simulateSwapExactOut, simulateWithdraw, slippageBpsToTickDistance, watchEvents };
|