This commit is contained in:
silas 2022-05-13 08:46:38 +01:00
parent 2dfa344948
commit 05031a51f7
7 changed files with 12 additions and 22 deletions

View File

@ -45,8 +45,6 @@ spec:
value: "3000"
- name: LIAB_LIMIT
value: "0.7"
- name: MIN_EQUITY
value: "0.2"
- name: PRIVATE_KEY
valueFrom:
secretKeyRef:

View File

@ -45,8 +45,6 @@ spec:
value: "3000"
- name: LIAB_LIMIT
value: "0.7"
- name: MIN_EQUITY
value: "0.2"
- name: PRIVATE_KEY
valueFrom:
secretKeyRef:

View File

@ -45,8 +45,6 @@ spec:
value: "2500"
- name: LIAB_LIMIT
value: "0.7"
- name: MIN_EQUITY
value: "0.2"
- name: LIQUIDATABLE_FEED_WEBSOCKET_ADDRESS
value: ws://10.121.128.69:9123
- name: PRIVATE_KEY

View File

@ -45,8 +45,6 @@ spec:
value: "2500"
- name: LIAB_LIMIT
value: "0.7"
- name: MIN_EQUITY
value: "0.2"
- name: LIQUIDATABLE_FEED_WEBSOCKET_ADDRESS
value: ws://10.121.128.69:9123
- name: PRIVATE_KEY

View File

@ -38,7 +38,7 @@
"trailingComma": "all"
},
"dependencies": {
"@blockworks-foundation/mango-client": "^3.4.3",
"@blockworks-foundation/mango-client": "https://github.com/blockworks-foundation/mango-client-v3/#liq_fixes",
"@project-serum/anchor": "^0.16.2",
"@project-serum/serum": "0.13.55",
"@project-serum/sol-wallet-adapter": "^0.2.0",
@ -53,4 +53,4 @@
"dotenv-expand": "^5.1.0",
"ts-node": "^9.1.1"
}
}
}

View File

@ -77,7 +77,7 @@ const TARGETS = process.env.TARGETS?.replace(/\s+/g, ' ')
.map((s) => parseFloat(s)) ?? [0, 0, 0, 0, 0, 0, 0, 0, 0];
// Do not liquidate accounts that have less than this much in value
const minEquity = parseFloat(process.env.MIN_EQUITY || '0');
const minEquity = parseInt(process.env.MIN_EQUITY || '0');
if (minEquity > 0) {
console.log(`Minimum equity required to liquidate: ${minEquity}`);
}
@ -603,11 +603,10 @@ async function liquidateAccount(
}
for (let r = 0; r < 5 && liqee.hasAnySpotOrders(); r++) {
for (let i = 0; i < groupIds.spotMarkets.length; i++) {
for (let i = 0; i < mangoGroup.spotMarkets.length; i++) {
if (liqee.inMarginBasket[i]) {
const spotMarketConfig = groupIds.spotMarkets[i];
const spotMarket = spotMarkets[spotMarketConfig.marketIndex];
const baseRootBank = rootBanks[spotMarketConfig.marketIndex];
const spotMarket = spotMarkets[i];
const baseRootBank = rootBanks[i];
const quoteRootBank = rootBanks[QUOTE_INDEX];
if (baseRootBank && quoteRootBank) {
@ -1275,7 +1274,7 @@ async function closePositions(
side,
orderPrice,
basePositionSize,
'ioc',
'limit',
0,
bookSideInfo ? bookSideInfo : undefined,
true,
@ -1327,4 +1326,4 @@ process.on('unhandledRejection', (err: any, p: any) => {
console.error(`Unhandled rejection: ${err} promise: ${p})`, err);
});
main();
main();

View File

@ -37,10 +37,9 @@
dependencies:
regenerator-runtime "^0.13.4"
"@blockworks-foundation/mango-client@^3.4.3":
version "3.4.3"
resolved "https://registry.yarnpkg.com/@blockworks-foundation/mango-client/-/mango-client-3.4.3.tgz#a5d72cc4520736edf843caaf8aff5376d1c056a4"
integrity sha512-8JFyE3nlwolfcqbhAYIenv25VnNvvYcEIUUUczHc31WaCtrcwC96Epj7wprHQO4OP6uLc9TBF4zuuGlZY3Fd6Q==
"@blockworks-foundation/mango-client@https://github.com/blockworks-foundation/mango-client-v3/#liq_fixes":
version "3.4.5"
resolved "https://github.com/blockworks-foundation/mango-client-v3/#83e22c5fa6fa6dc284f4413be8bccf6da64fc343"
dependencies:
"@project-serum/anchor" "^0.21.0"
"@project-serum/serum" "0.13.55"
@ -2307,4 +2306,4 @@ yn@3.1.1:
yocto-queue@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b"
integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==
integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==