bump sizeAdjustedSlippage for majors
This commit is contained in:
@@ -1440,12 +1440,17 @@ export const calculateDynamicSlippage = (
|
|||||||
|
|
||||||
// use halfway to worst price as size adjusted slippage
|
// use halfway to worst price as size adjusted slippage
|
||||||
if (startPrice && worstPrice) {
|
if (startPrice && worstPrice) {
|
||||||
const sizeAdjustedSlippage =
|
let sizeAdjustedSlippage =
|
||||||
(startPrice.sub(worstPrice).abs().toNumber() /
|
(startPrice.sub(worstPrice).abs().toNumber() /
|
||||||
BN.max(startPrice, worstPrice).toNumber() /
|
BN.max(startPrice, worstPrice).toNumber() /
|
||||||
2) *
|
2) *
|
||||||
100;
|
100;
|
||||||
|
|
||||||
|
if (isMajor) {
|
||||||
|
// add additional size adjusted multiplier for majors
|
||||||
|
sizeAdjustedSlippage = sizeAdjustedSlippage * 1.2;
|
||||||
|
}
|
||||||
|
|
||||||
dynamicSlippage = Math.max(dynamicSlippage, sizeAdjustedSlippage);
|
dynamicSlippage = Math.max(dynamicSlippage, sizeAdjustedSlippage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user