buildConditionalOrderLeg
Build one leg (TP or SL) of a conditional-order message (TpSlConditionalOrderLeg). Maps the SDK’s TpSlPriceType (markPrice / lastPrice) onto the handler’s wire form (market / last_close) and defaults orderType to market. setQuoteTpSl builds each leg with this.
import { buildConditionalOrderLeg } from "@symmio/trading-core";
const leg = buildConditionalOrderLeg({
quantity: "100",
price: "10.0000",
conditionalPrice: "150.0000",
priceType: "markPrice",
});Parameters
quantitystringrequiredQuote quantity (decimal string).
pricestringrequiredSlippage-shifted fill price (decimal string, rounded to market precision).
conditionalPricestringrequiredTrigger price (decimal string, rounded to market precision).
markPrice or lastPrice; mapped to the wire conditionalPriceType.
orderTypenumberoptionalWire order_type. Defaults to 1 (market).
Returns
The leg, with conditionalPriceType set to last_close when priceType is lastPrice, else market.
Related
TpSlConditionalOrderLeg— the return shape.buildConditionalOrderMessage— assembles legs into a message.priceSlippageCalculation— derives thepricefield.
Last updated on