Solvers
The solver APIs are off-chain REST endpoints configured per chain in createConfig. @symmio/trading-core exposes them as framework-agnostic actions plus TanStack Query option factories.
Use these APIs when you need solver metadata before building a trade flow: market lists, leverage limits, and locked percentages for a market/leverage pair.
Protocol model — intent-based, no orderbook
SYMMIO is intent-based. The current lowcap version has no orderbook. Positions are opened peer-to-peer between two roles:
- partyA — the user. Sends an intent to open a position.
- partyB — a solver. Watches partyA intents and takes the opposite side, becoming the direct counterparty.
Every lowcap position is one partyA ↔ one partyB agreement. There is no shared book, no matching engine, no other users on the other side. The solver is the counterparty.
Implications when building on the SDK:
- No bid/ask depth to render. Prices come from off-chain feeds (see Price Service), not an on-chain book.
- Trade lifecycle is intent → solver acceptance → on-chain settlement. Surface intent state, not order-fill progress.
partyA/partyBin ABIs, events, and notifications always mean user / solver respectively.
Markets
getMarkets
Fetch tradable markets from the chain solver’s /contract-symbols endpoint.
import { getMarkets } from "@symmio/trading-core";
const markets = await getMarkets(config);
const btc = markets.find((market) => market.name === "BTCUSDT");Parameters
| Name | Type | Default | Notes |
|---|---|---|---|
chainId | number? | config default | Optional chain override. |
Returns — SymbolContractSymbol[].
Important market fields:
| Field | Type | Notes |
|---|---|---|
symbol_id | number? | Contract symbol id. |
name | string? | Solver market name, often the value to pass as symbol. |
symbol | string? | Display symbol. |
state | number? | 0 disabled, 1 close only, 2 open only, 3 enabled. |
max_leverage | string? | Maximum leverage accepted for this market. |
getMarketsQueryOptions
Build TanStack Query options for getMarkets.
import { getMarketsQueryOptions } from "@symmio/trading-core";
import { useQuery } from "@tanstack/react-query";
const query = useQuery(getMarketsQueryOptions(config, { query: { staleTime: 30_000 } }));Locked Params
getLockedParams
Fetch locked params from the chain solver’s /get_locked_params/{symbol} endpoint.
The symbol parameter is the solver path value. In trade UIs, use the selected market’s name when available, with symbol as a fallback.
import { getLockedParams } from "@symmio/trading-core";
const locked = await getLockedParams(config, {
symbol: "BTCUSDT",
leverage: 5,
});
console.log(locked.cva, locked.lf, locked.partyAmm, locked.partyBmm);Parameters
| Name | Type | Default | Notes |
|---|---|---|---|
symbol | string | required | Solver market path value. |
leverage | number | required | Leverage used to calculate locked params. |
chainId | number? | config default | Optional chain override. |
Returns — SolverLockedParams.
interface SolverLockedParams {
cva?: string;
lf?: string;
partyAmm?: string;
partyBmm?: string;
leverage?: string;
}getLockedParamsQueryOptions
Build TanStack Query options for getLockedParams.
import { getLockedParamsQueryOptions } from "@symmio/trading-core";
import { useQuery } from "@tanstack/react-query";
const options = getLockedParamsQueryOptions(config, {
symbol: "BTCUSDT",
leverage: 5,
query: { staleTime: 10_000 },
});
const query = useQuery(options);GetLockedParamsOptions requires symbol and leverage. The query factory does not make required action inputs optional and does not validate missing inputs inside queryFn.
For form UIs where values may be incomplete, gate the query outside the factory:
const ready = Boolean(symbol) && leverage > 0;
const options = getLockedParamsQueryOptions(config, {
symbol: symbol ?? "",
leverage: leverage ?? 0,
query: { enabled: ready },
});getLockedParamsQueryKey
Build a cache key for a locked-params query.
import { getLockedParamsQueryKey } from "@symmio/trading-core";
const key = getLockedParamsQueryKey({
symbol: "BTCUSDT",
leverage: 5,
});symbol and leverage are part of the key, so each market/leverage pair caches independently.
Notional Cap (available liquidity)
Per-market caps on how much notional the solver still permits — the frontline “can I open this size?” gate.
getNotionalCapBySymbolId
Cap for one market.
import { getNotionalCapBySymbolId } from "@symmio/trading-core";
const cap = await getNotionalCapBySymbolId(config, { symbolId: 1n });
// { used: bigint, cap: bigint, availability: bigint }getNotionalCapAll
Batch — every market’s cap in one call. Cheaper than looping getNotionalCapBySymbolId.
import { getNotionalCapAll } from "@symmio/trading-core";
const caps = await getNotionalCapAll(config, {});getOpenInterestBySymbolId
Used vs capped notional per market.
import { getOpenInterestBySymbolId } from "@symmio/trading-core";
const oi = await getOpenInterestBySymbolId(config, { symbolId: 1n });Instant Open / Instant Close
The lowcap trading flows live on their own pages:
- Instant Open —
instantOpen,instantOpenAuto,prepareInstantOpenParams,getInstantOpens,getInstantOpenQuoteId. - Instant Close —
instantClose,instantCloseAuto,instantCloseBulk,prepareInstantCloseParams,getInstantCloses.
Related
- SYMMIO Contract — on-chain reads.
getOnchainContractMarketsis the contract-side analog togetMarkets. - Unified Quotes —
PendingInstantOpen/PendingInstantClosefromgetInstantOpens/getInstantClosesfeedreconcileQuotes. - Errors — solver failures surface as
SymmApiError.