priceSlippageCalculation
Shift a trigger price by slippage percent in the direction the conditional order would fill at. Used to derive the price field on each TpSlConditionalOrderLeg — the handler fills against this wide tolerance. The result is rounded to pricePrecision decimals to match the market.
SHORT: shifts up by1 + slippage / 100.LONG: shifts down by1 − slippage / 100.
import { priceSlippageCalculation } from "@symmio/trading-core";
priceSlippageCalculation("100", 90, PositionType.LONG, 4); // "10.0000"Parameters
pricestringrequiredTrigger price to shift (decimal string).
slippagenumberrequiredSlippage percent.
positionTypePositionTyperequiredQuote direction; sets the shift direction.
pricePrecisionnumberrequiredDecimals to round the result to.
Returns
stringThe slippage-shifted price as a decimal string, rounded to
pricePrecision decimals.DEFAULT_TPSL_SLIPPAGE_LOWCAPS
When a caller doesn’t pass slippage, setQuoteTpSl falls back to the exported default:
import { DEFAULT_TPSL_SLIPPAGE_LOWCAPS } from "@symmio/trading-core";
// 90 (percent — the handler quotes against a very wide tolerance for lowcap markets)Related
buildConditionalOrderLeg— consumes the shiftedprice.setQuoteTpSl— applies this per side.
Last updated on