GroupTpSlAction
What planGroupTpSl decided for one child. A discriminated union on action.
type GroupTpSlAction =
| {
action: "set";
key: string;
quoteId: bigint;
virtualAccount: Address;
symbolId: bigint;
positionType: PositionType;
/** Decimal string, from the child's `openQuantity`. */
quantity: string;
/** Present only when the take-profit side actually changed. */
tp?: SetTpSlSide;
/** Present only when the stop-loss side actually changed. */
sl?: SetTpSlSide;
}
| {
action: "delete";
key: string;
quoteId: bigint;
virtualAccount: Address;
cohQuoteId: string;
conditionalOrderType: TpSlConditionalOrderType;
}
| {
action: "skip";
key: string;
reason: GroupTpSlSkipReason;
/** Per-side errors, when `reason` is `"invalid"`. */
validation?: TpSlValidation;
};A set action is shaped to spread straight into setQuoteTpSl — add subAccount and pricePrecision and it is a complete call.
Skip reasons
unchangedGroupTpSlSkipReasonEvery desired side already matches the child’s confirmed snapshot.
nothing-to-doGroupTpSlSkipReasonThe child has no desired entry, or nothing to write and nothing to remove.
not-anchoredGroupTpSlSkipReasonNot anchored on-chain yet, or no Virtual Account resolved.
no-open-quantityGroupTpSlSkipReasonNo open size left to attach a conditional order to.
invalidGroupTpSlSkipReasonThe resulting pair failed validateTpSl.
Last updated on