add crank instruction to perp order

This commit is contained in:
Riordan Panayides 2021-12-05 23:07:12 +00:00
parent d99d987b6e
commit af1df8ddaf
1 changed files with 6 additions and 2 deletions

View File

@ -1100,6 +1100,10 @@ async function closePositions(
side == 'sell'
? price.mul(ONE_I80F48.sub(liquidationFee)).toNumber()
: price.mul(ONE_I80F48.add(liquidationFee)).toNumber();
const bookSideInfo =
side == 'sell'
? await connection.getAccountInfo(perpMarket.bids)
: await connection.getAccountInfo(perpMarket.asks);
console.log(
`${side}ing ${basePositionSize} of ${groupIds?.perpMarkets[index].baseSymbol}-PERP for $${orderPrice}`,
@ -1115,8 +1119,8 @@ async function closePositions(
orderPrice,
basePositionSize,
'ioc',
undefined,
undefined,
0,
bookSideInfo ? bookSideInfo : undefined,
true,
);
}