toGroupTpSlChildren
Build GroupTpSlChilds from a grouped position’s child quotes. This is the adapter every other grouped TP/SL helper takes as input — it is the only place in the slice that knows about UnifiedQuote.
Every quote produces a child, including off-chain ones. Those come back with quoteId: undefined so the summary still counts them — an unprotected leg genuinely drags coverage down — while planGroupTpSl skips them as "not-anchored".
Two derivations are worth knowing:
openPriceuses the same fallbackaggregateGroupMetricsuses:openedPricewhen settled and non-zero, elserequestedOpenPrice.virtualAccountisvaAddress ?? partyA, which for a Virtual-Account-scoped position is the VA itself — the address the conditional order must be signed for.
import { toGroupTpSlChildren, summarizeQuoteGroupTpSl } from "@symmio/trading-core";
const children = toGroupTpSlChildren(group.quotes, (quote) => tpslByKey.get(quote.key));
const summary = summarizeQuoteGroupTpSl(children);Parameters
quotesreadonly UnifiedQuote[]requiredThe grouped position’s child quotes — QuoteGroup.quotes.
snapshotGroupTpSlSnapshotLookuprequiredResolves each quote’s confirmed TP/SL snapshot. Receives the whole quote, so you can look up by key, by quoteId,
or through a store index that aliases both. A missing snapshot becomes a blank one (both sides empty, both states
"canceled").
Returns
One child per quote, in input order.
Related
GroupTpSlChild— the produced shape.summarizeQuoteGroupTpSl— folds children into the cell state.planGroupTpSl— diffs children against a desired state.