1.0.0 • Published 4 years ago
profit-calc v1.0.0
To use this, call method calculate from profitCalc
Cdp example:
let cdpExample = {
debt: 800,
collateral: 10.45,
optimalRatioBoost: 2.0,
maxBoost: 2.1,
optimalRatioRepay: 2.0,
minRepay: 1.7,
liquidationRatio: 1.50,
block: 9073086 // block when cdp is created
};
second parameter is toBlock if you want to calculate to specific point in time
Method returns:
{
actions: [
{
name,
beforeRatio,
afterRatio,
newCollateral,
newDebt,
newProfit,
blockNumber,
price
}
],
finalCdp: {
price,
collateral,
debt,
profit
},
liquidated, // true or false, indicates if this cdp would be liquidated without DFS automation
liquidationInfo: {
price,
block
} // if liquidated is true, here will be when it would be the first time that this cdp would be liquidated
}
1.0.0
4 years ago