Update default minEquity, update readme
This commit is contained in:
parent
2a189ac952
commit
d4b6db7649
|
@ -6,7 +6,7 @@ To run the liquidator you will need:
|
|||
* A Solana account with some SOL deposited to cover transaction fees
|
||||
* A Mango Account with some collateral deposited
|
||||
* Your wallet keypair saved as a JSON file
|
||||
* `node` and `yarn`
|
||||
* `node` (v14+) and `yarn`
|
||||
* A clone of this repository
|
||||
* Dependencies installed with `yarn install`
|
||||
|
||||
|
@ -64,6 +64,7 @@ This mode never triggers advanced orders.
|
|||
| `LIQOR_PK` | N/A | Liqor Mango Account Public Key, by default uses the largest value account owned by the keypair |
|
||||
| `WEBHOOK_URL` | N/A | Discord webhook URL to post liquidation events and errors to |
|
||||
| `LIAB_LIMIT` | `0.9` | Percentage of your available margin to use when taking on liabilities |
|
||||
| `MIN_EQUITY` | `0` | Minimum account equity required to liquidate |
|
||||
| `LIQUIDATABLE_FEED_WEBSOCKET_ADDRESS` | N/A | Websocket URL of the liquidatable-accounts-feed service, see above |
|
||||
|
||||
You can add these variables to a `.env` file in the project root to load automatically on liquidator startup. For example:
|
||||
|
|
|
@ -67,10 +67,11 @@ const TARGETS = process.env.TARGETS?.replace(/\s+/g,' ').trim().split(' ').map((
|
|||
|
||||
// Do not liquidate accounts that have less than this much in value
|
||||
const minEquity = parseInt(
|
||||
process.env.MIN_EQUITY || '5',
|
||||
process.env.MIN_EQUITY || '0',
|
||||
);
|
||||
console.log(`Minimum equity required to bother: ${minEquity}`);
|
||||
|
||||
if(minEquity > 0) {
|
||||
console.log(`Minimum equity required to liquidate: ${minEquity}`);
|
||||
}
|
||||
|
||||
const mangoProgramId = groupIds.mangoProgramId;
|
||||
const mangoGroupKey = groupIds.publicKey;
|
||||
|
@ -284,7 +285,7 @@ async function maybeLiquidateAccount(mangoAccount: MangoAccount): Promise<boolea
|
|||
}
|
||||
|
||||
const equity = mangoAccount.computeValue(mangoGroup, cache).toNumber()
|
||||
if (equity < minEquity) {
|
||||
if (equity < minEquity && minEquity > 0) {
|
||||
// console.log(`Account ${mangoAccountKeyString} only has ${equity}, PASS`);
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue