@parifi/sdk
Version:
Parifi SDK with common utility functions
33 lines (30 loc) • 1.47 kB
TypeScript
import Decimal__default from 'decimal.js';
import { Position, CollateralDeposit } from '../interfaces/sdkTypes.js';
import '../interfaces/subgraphTypes.js';
declare const calculateUnrealizedPnlForPositions: (positions: Position[], priceData: {
id: string;
price: number;
}[]) => Decimal__default;
declare const calculateUsdValueOfCollateralDeposits: (collateralDeposits: CollateralDeposit[], priceData: {
id: string;
price: number;
}[]) => Decimal__default;
declare const getPriceFromPriceArray: (priceData: {
id: string;
price: number;
}[], priceId?: string | undefined, tokenSymbol?: string | undefined) => number;
/**
* Calculates the liquidation price for a position
* @param availableMarginInUsd USD value of the margin that is available
* @param marginBufferInUsd Margin used as buffer for the account
* @param formattedPositionSize Formatted position size
* @param formattedMarketPrice Formatted market price of the market
* @returns liquidationPrice Approximate liquidation price of the asset
*/
declare const calculateLiquidationPriceOffchain: ({ availableMarginInUsd, marginBufferInUsd, formattedPositionSize, formattedMarketPrice, }: {
availableMarginInUsd: number;
marginBufferInUsd: number;
formattedPositionSize: number;
formattedMarketPrice: number;
}) => number;
export { calculateLiquidationPriceOffchain, calculateUnrealizedPnlForPositions, calculateUsdValueOfCollateralDeposits, getPriceFromPriceArray };