Solvers hooks
React hooks over @symmio/trading-core’s Solvers slice — market catalog, locked params, notional cap, open interest, plus the instant-open / instant-close mutation orchestrators.
Every hook on this landing page is a read. The writes (instant-open / instant-close) live on their own pages linked at the bottom.
Import
import {
useMarkets,
useLockedParams,
useNotionalCapAll,
useNotionalCapBySymbolId,
useOpenInterestBySymbolId,
useSolverErrorCodes,
useSolverErrorMessage,
} from "@symmio/trading-react";Reads
useMarkets
Solver-side market catalog. Prefer this over useOnchainContractMarkets for UI catalogs — the solver adds precision / tick metadata.
const markets = useMarkets();Returns SymbolContractSymbol[].
useLockedParams
Fetch the solver’s LockedParams for a market + leverage — the CVA / LF percentages required to open at that leverage. Used inside useInstantOpenAuto internally; expose it to render “at this leverage you lock X collateral” UIs.
const locked = useLockedParams({ symbol: "BTCUSDT", leverage: 5 });useNotionalCapBySymbolId
Available liquidity — how much notional the solver still permits for a market. Gate order size on this.
const cap = useNotionalCapBySymbolId({ symbolId: 1n });useNotionalCapAll
Batch — every market’s cap in one call.
const caps = useNotionalCapAll();useOpenInterestBySymbolId
Used vs capped notional per market.
const oi = useOpenInterestBySymbolId({ symbolId: 1n });useSolverErrorCodes
Fetch the solver’s error-code registry. Cache once, look up by code.
const codes = useSolverErrorCodes();useSolverErrorMessage
Composed — takes an error code, returns the human-readable message.
const msg = useSolverErrorMessage({ code: 42 });Trading flows
Instant Open and Instant Close live on their own pages:
- Instant Open —
useInstantOpen,useInstantOpenAuto,useInstantOpenWithTpSl,useInstantOpens,useInstantOpenQuoteId. - Instant Close —
useInstantClose,useInstantCloseAuto,useInstantCloseBulk,useInstantCloseBulkAuto,useInstantCloses.
Related
- Core Solvers — the underlying actions.
- SYMMIO Contract — on-chain analogs where applicable.
- Errors — solver failures surface as
SymmioRequestErrorkind: "api".