Formulas
Borrow Formulas
interestPerYear
to interestPerSecond
interestPerYear
to interestPerSecond
with both and interest accrual factors (and not interest rates) and where it is assumed that one full year consists of 31622400 seconds (366 days with 86400 seconds each).
Find a sample calculation here.
interestPerSecond
to interestPerYear
interestPerSecond
to interestPerYear
with both and interest accrual factors (and not interest rates) and where it is assumed that one full year consists of 31622400 seconds (366 days with 86400 seconds each).
interestPerSecond
to interestToMaturity
interestPerSecond
to interestToMaturity
where is the current block.timestamp
and is the collateral asset’s maturity
both expressed in seconds.
normalDebt
to debt
normalDebt
to debt
debt
to normalDebt
debt
to normalDebt
where it is assumed that .
The following correction has to be performed on the resulting amount to avoid rounding errors due to precision loss:
normalDebt
to debtAtMaturity
normalDebt
to debtAtMaturity
collateralizationRatio
collateralizationRatio
Max.debt
for a given collateralizationRatio
and collateral
amount
debt
for a given collateralizationRatio
and collateral
amountMin. collateral
for a given collateralizationRatio
and debt
amount
collateral
for a given collateralizationRatio
and debt
amountLeverage Formulas
Min. collateralizationRatio
for a levered deposit
collateralizationRatio
for a levered depositwhere and are the FIAT/underlying and underlying/collateral exchange rates including price impact and slippage.
Max. collateralizationRatio
for a levered deposit
collateralizationRatio
for a levered depositwhere is the deposited underlier amount and is the underlying/collateral exchange rate including price impact and slippage.
flashloan
amount for a levered deposit
flashloan
amount for a levered depositwhere is the deposited underlier amount and and are the FIAT/underlying and underlying/collateral exchange rates including price impact and slippage.
Min. collateralizationRatio
for a levered withdrawal
collateralizationRatio
for a levered withdrawalwhere and are the position collateral and debt, and is the withdrawn collateral amount.
Max. collateralizationRatio
for a levered withdrawal
collateralizationRatio
for a levered withdrawalwhere is the position collateral and the withdrawn collateral amount.
flashloan
amount for a levered withdrawal
flashloan
amount for a levered withdrawalwhere and are the position collateral and debt, and is the withdrawn collateral amount. It is thus assumed that and as the computation would otherwise yield an invalid result.
Estimated underlier
for a levered withdrawal
underlier
for a levered withdrawalwhere is the withdrawn collateral amount, is the flashloan amount used for the withdrawal, and and are the underlying/FIAT and collateral/underlying exchange rates including price impact and slippage.
Note that for a collateral asset beyond its maturity the formula remains intact with the difference that the input underlying/collateral exchange rate is fixed, i.e. .
profitAtMaturity
for a levered deposit
profitAtMaturity
for a levered depositwhere is the estimated underlier amount withdrawn at maturity (i.e. with an input of and ) and is the deposited underlier amount. It is further assumed that the collateral token can be redeemed for underlier tokens at a rate of .
yieldToMaturity
for a levered deposit
yieldToMaturity
for a levered depositwhere is the deposited underlier amount and is the estimated profitAtMaturity
.
yieldToMaturity
to annualYield
yieldToMaturity
to annualYield
Trade Formulas
Minimal amountOut
for a max slippagePercentage
amountOut
for a max slippagePercentage
where is the estimated amountOut
without accounting for slippage.
Last updated