Markets hooks
Thin wrappers over the solver and on-chain market catalogs, plus the on-chain funding state a solver keeps per market.
Every hook on this page is a read.
Import
import {
useMarkets,
useSymbols,
useMarketInfo,
useOnchainContractMarkets,
useFundingFeesOfPartyB,
} from "@symmio/trading-react";useMarkets
Solver-side market catalog (default for UIs). Adds precision / tick metadata the contract doesn’t carry.
const markets = useMarkets();On Enigma, prefer useSymbols — it reads the same catalogue but adds server-side filtering and pagination. Keep useMarkets when you need one hook that also covers Rasa.
useSymbols
Enigma symbol catalogue with server-side filtering and pagination — reach for it over useMarkets on Enigma when you want to search, filter by validity or per-side trading state, or page through symbols instead of pulling the whole list. Enigma-only: the query stays idle on non-Enigma chains (the underlying action throws UNSUPPORTED_BY_SOLVER).
// Search + filter + paginate, all solver-side.
const { data } = useSymbols({
search: "BTC",
isValid: "true",
stateLong: "enabled",
limit: 20,
offset: 0,
});See getSymbols in core for the full parameter and SolverSymbol field reference. Two sibling Enigma-only reads ship alongside it — useTradeVolume (daily volume per market) and useRevenueRecords (cursor-paginated revenue).
useMarketInfo
Per-market figures from the solver’s /get_market_info — the whole catalogue in one call. The response diverges by solver, so the result is a union discriminated on data.kind:
- Enigma —
markets: MarketVolume[](symbol,tradingVolume,lifetimeValue) plus the aggregatestotalValue24handtotalLifetimeValue. - Rasa —
markets: RasaMarketInfoRow[](symbol,price,priceChangePercent,tradeVolume,notionalCap) and no aggregate totals at all.
const { data } = useMarketInfo();
if (data?.kind === "enigma") console.log(data.totalValue24h, data.totalLifetimeValue);Pass a literal solverId ("enigma" / "rasa") to narrow the return type instead of narrowing at runtime. Every figure is a plain dollar number exactly as the solver reports it — no decimal scaling. Nothing polls by default; pass query.refetchInterval. The Enigma aggregates are the 24h and lifetime volume on a pools overview.
useOnchainContractMarkets
Raw on-chain getSymbol() — authoritative but stripped of solver metadata.
const contractMarkets = useOnchainContractMarkets();useFundingFeesOfPartyB
The accumulated-funding state a solver (partyB) keeps for one symbol — core’s getFundingFeesOfPartyB as a hook, returning the raw FundingFee struct. Use it to tell whether a market accrues accumulated funding at all — epochDuration, startEpoch and startEpochTimeStamp decide the three pair states — or to show the per-epoch rates the solver has posted.
const { data: fee } = useFundingFeesOfPartyB({ symbolId: 1n, partyB });
const accruing =
fee !== undefined && fee.epochDuration > 0n && (fee.startEpoch !== 0n || fee.startEpochTimeStamp !== 0n);The rates are raw, cost-positive contract values (positive = that side pays) — the opposite convention from the SDK’s income-positive funding amounts; see the sign table. They are per-unit rates, not amounts: for what a position owes or will receive, use useQuotePendingFunding. For the solver’s advertised next-epoch rate, use useFundingInfo.
Both symbolId and partyB are required. A quote has no partyB until a solver locks it, so pass a placeholder address and gate the read with query: { enabled: quote.partyB !== undefined }. chainId defaults to the connected chain, and nothing polls by default — pass query.refetchInterval.
Returns — UseQueryResult<FundingFee, SymmioRequestError>.
Related
- Solvers —
useMarketsalso documented under the solvers slice. - SYMMIO Contract — on-chain contract reads, including pending funding per quote.
- Funding — the funding numbers, pair states, and sign conventions.