getQuoteTpSl
Read the raw TP/SL rows for one quote from the handler.
Hits GET /api/v5/?quote_id=<id> and returns the full row list (every state). Framework layers (@symmio/trading-react) fold and filter these into UI-facing snapshots — core keeps the raw shape so consumers can apply their own selection rules.
import { getQuoteTpSl } from "@symmio/trading-core";
const rows = await getQuoteTpSl(config, {
quoteId: 42n,
});Parameters
quoteIdbigintrequiredOn-chain quote id. A negative hedger tempQuoteId is also accepted, so a pre-chain quote’s TP/SL can be read the
moment the hedger accepts an instant open.
chainIdnumberoptionalTarget chain id. Defaults to the config’s defaultChainId.
Returns
Every conditional-order row for the quote, in every state. See QuoteTpSlRow for the
field list. A quote with no conditional orders resolves to an empty array.
The handler reports “this quote has never had a TP/SL” as a 404 rather than as an empty 200. getQuoteTpSl
absorbs that case and resolves to [], so the most ordinary state a position can be in is not an error: it does not
trip a query client’s retry ladder, and the result caches like any other. A 404 that does not carry the handler’s
response envelope — a decommissioned route, a mistyped tpsl.url — still throws.
Throws
SymmErrorwhen the chain has notpslconfig.SymmApiErrorwhen the HTTP request fails for any reason other than the handler’s “no conditional orders”404.
Query options
import { getQuoteTpSlQueryOptions } from "@symmio/trading-core";
import { useQuery } from "@tanstack/react-query";
useQuery(getQuoteTpSlQueryOptions(config, { quoteId: 42n }));getQuoteTpSlQueryOptions is disabled until quoteId is a real id (present and non-zero); it accepts negative ids so a pre-chain quote can be read without waiting for on-chain reconciliation. GetQuoteTpSlOptions requires quoteId. The getQuoteTpSlQueryKey builder stringifies quoteId for cache matching.
Related
QuoteTpSlRow— the raw row shape.useQuoteTpSl— React binding that folds rows into a per-side snapshot.