Added printing of Max borrow account
This commit is contained in:
parent
2b2ad948fc
commit
a8458f8c1c
|
@ -153,6 +153,8 @@ async function runLiquidator() {
|
||||||
)
|
)
|
||||||
console.log(vaultValues)
|
console.log(vaultValues)
|
||||||
|
|
||||||
|
let maxBorrAcc = ""
|
||||||
|
let maxBorrVal = 0;
|
||||||
for (let ma of marginAccounts) { // parallelize this if possible
|
for (let ma of marginAccounts) { // parallelize this if possible
|
||||||
|
|
||||||
let liquidated = false
|
let liquidated = false
|
||||||
|
@ -161,6 +163,10 @@ async function runLiquidator() {
|
||||||
try {
|
try {
|
||||||
const assetsVal = ma.getAssetsVal(mangoGroup, prices)
|
const assetsVal = ma.getAssetsVal(mangoGroup, prices)
|
||||||
const liabsVal = ma.getLiabsVal(mangoGroup, prices)
|
const liabsVal = ma.getLiabsVal(mangoGroup, prices)
|
||||||
|
if (liabsVal > maxBorrVal) {
|
||||||
|
maxBorrVal = liabsVal
|
||||||
|
maxBorrAcc = ma.publicKey.toBase58()
|
||||||
|
}
|
||||||
|
|
||||||
if (liabsVal < 0.1) { // too small of an account; number precision may cause errors
|
if (liabsVal < 0.1) { // too small of an account; number precision may cause errors
|
||||||
break
|
break
|
||||||
|
@ -218,8 +224,11 @@ async function runLiquidator() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(`Max Borrow Account: ${maxBorrAcc} | Max Borrow Val: ${maxBorrVal}`)
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
notify(`unknown error: ${e}`);
|
notify(`unknown error: ${e}`);
|
||||||
console.error(e);
|
console.error(e);
|
||||||
|
|
Loading…
Reference in New Issue