import Big from "big.js"; import { PositionSide } from "../position/types"; interface GetTransactionFeeParams { isBaseToQuote: boolean; exchangedPositionNotional: Big; deltaAvailableQuote: Big; feeRatio: Big; } export declare function getTransactionFee({ isBaseToQuote, exchangedPositionNotional, deltaAvailableQuote, feeRatio, }: GetTransactionFeeParams): Big; interface GetUnrealizedPnlParams { isLong: boolean; openNotionalAbs: Big; deltaAvailableQuote: Big; } export declare function getUnrealizedPnl({ isLong, openNotionalAbs, deltaAvailableQuote }: GetUnrealizedPnlParams): Big; interface GetSwapRateParams { amountBase: Big; amountQuote: Big; } export declare function getSwapRate({ amountBase, amountQuote }: GetSwapRateParams): Big; interface GetPriceImpactParams { price: Big; marketPrice: Big; } export declare function getPriceImpact({ price, marketPrice }: GetPriceImpactParams): Big; interface GetBuyingPowerParams { imRatio: Big; freeCollateral: Big; side: PositionSide; existingPositionValue?: Big; nextFreeCollateral: Big; } export declare function getBuyingPower({ imRatio, freeCollateral, existingPositionValue, side, nextFreeCollateral, }: GetBuyingPowerParams): Big; /** * NOTE: * nextAccountValue = accountValue + deltaAccountValue * deltaAccountValue = signedDeltaAvailableBase * indexTwapPrice + signedDeltaAvailableQuote */ interface GetNextAccountValueParams { indexTwapPrice: Big; accountValue: Big; signedDeltaAvailableBase: Big; signedDeltaAvailableQuote: Big; } export declare function getNextAccountValue({ indexTwapPrice, accountValue, signedDeltaAvailableBase, signedDeltaAvailableQuote, }: GetNextAccountValueParams): Big; /** * NOTE: the formula did not consider the realized PNL, we should include it in the future * nextOpenOrderMarginReq = ((otherBaseDebtValue + absMinNextThisBaseBalance * thisBaseIndexPrice) + absMinNextQuoteBalance) * ratio */ interface GetNextOpenOrderMarginReqParams { sumOfOtherBaseDebtValue: Big; sumOfQuoteDebtValue: Big; thisBaseBalance: Big; signedDeltaAvailableBase: Big; signedDeltaAvailableQuote: Big; indexTwapPrice: Big; imRatio: Big; } export declare function getNextOpenOrderMarginReq({ sumOfOtherBaseDebtValue, sumOfQuoteDebtValue, thisBaseBalance, signedDeltaAvailableBase, signedDeltaAvailableQuote, indexTwapPrice, imRatio, }: GetNextOpenOrderMarginReqParams): Big; /** * NOTE: * nextUnrealizedPNL = signedDeltaAvailableBase * indexPrice + signedDeltaAvailableQuote * nextTotalUnrealizedPNL = totalUnrealizedPNL + nextUnrealizedPNL * nextTotalCollateralValue * = nextAccountValue - nextTotalUnrealizedPNL * = nextAccountValue - (totalUnrealizedPNL + nextUnrealizedPNL) */ interface GetNextTotalCollateralValueParams { nextAccountValue: Big; signedDeltaAvailableBase: Big; signedDeltaAvailableQuote: Big; indexTwapPrice: Big; totalUnrealizedPNLFromAllMarkets: Big; } export declare function getNextTotalCollateralValue({ nextAccountValue, signedDeltaAvailableBase, signedDeltaAvailableQuote, indexTwapPrice, totalUnrealizedPNLFromAllMarkets, }: GetNextTotalCollateralValueParams): Big; /** * NOTE: next free collateral * FIXME: this result might have negative value somehow * nextFreeCollateral = min(nextTotalCollateralValue, nextAccountValue) - nextOpenOrderMarginReq(Ratio) */ interface GetNextFreeCollateralParams { nextTotalCollateralValue: Big; nextAccountValue: Big; nextOpenOrderMarginReq: Big; } export declare function getNextFreeCollateral({ nextTotalCollateralValue, nextAccountValue, nextOpenOrderMarginReq, }: GetNextFreeCollateralParams): Big; export {};