3. closePosition
enter the AMM address from step 1_quoteAssetAmountLimit
- this limits the amount of slippage you will accept. In a severe emergency, consider entering 0 (allow 100% slippage).1 - %
of slippage. E.g. to allow up to 0.5% slippage with $1000 worth of margin, 1000 * (1-0.5) = 995
.995 * 10^18 = 995000000000000000000
_quoteAssetAmountLimit
addMargin
, openPosition
etc. _side
refers to short (0) and long (1), and _baseAssetAmountLimit
is the minimum position size (to control slippage - value must be multiplied by 10^18).