summarizeQuoteGroupTpSl
Fold a grouped position’s children into one QuoteGroupTpSlSummary — per-side counts, the uniform-vs-mixed display state, and notional-weighted coverage — in a single pass.
This is the data model behind a TP/SL (N quotes) table cell. Three display states per side:
display | Condition | Render |
|---|---|---|
"none" | No child carries a trigger | ”Not set” |
"uniform" | Every child carries the same trigger price and price type | The price itself |
"mixed" | Some children carry one, or the values differ | The count / covered share |
Coverage is notional-weighted, not count-weighted. A group of one 9-unit leg and one 1-unit leg with only the small leg protected reports 10%, not 50% — because the number a trader needs is how much value is exposed, not how many rows are ticked.
import { summarizeQuoteGroupTpSl } from "@symmio/trading-core";
const summary = summarizeQuoteGroupTpSl(children);
if (summary.isEmpty) return "Not set";
if (summary.takeProfit.display === "uniform") return summary.takeProfit.price;
return `${summary.takeProfit.count} TP`;Pass an editor’s buffer as overrides for a live readout while the trader types — an explicit "" trigger price clears that side.
Parameters
The grouped position’s children, from toGroupTpSlChildren.
options.overridesGroupTpSlDesiredMapoptionalPending per-child edits that win over the confirmed snapshot, keyed by GroupTpSlChild.key. Omit for the
confirmed-only view.
Returns
Per-side summaries plus the group’s total open notional and an isEmpty flag.
Related
GroupTpSlSideSummary— one side’s folded state.toGroupTpSlOrders— the per-order breakdown behind the same data.useQuoteGroupTpSl— the React hook that calls this for you.