useActiveMarkets
The useActiveMarkets hook is wrapper over useActiveConditions for groupping active conditions by market.
Usage
import { useActiveMarkets } from '@azuro-org/sdk'
const { data, isFetching, error } = useActiveMarkets(props)Props
{
gameId: string
filter?: {
outcomeIds?: string[]
maxMargin?: number
}
query?: QueryParameter<ConditionsQuery['conditions']> // useQuery params
}⚠️
gameId property is not the same as id. Each game fetched using useGames hook contains the gameId:
import { useGame } from '@azuro-org/sdk'
const { data: games } = useGames()
const gameId = games?.[0]?.gameIdReturn Value
UseQueryResult<GameMarkets>import { type UseQueryResult } from '@tanstack/react-query'
type GameMarkets = Market[]
type Market = {
marketKey: string
name: string
description: string
conditions: Condition[]
}
type Condition = {
conditionId: string
state: ConditionState
margin: string
isExpressForbidden: boolean
outcomes: MarketOutcome[]
}
type MarketOutcome = {
selectionName: string
odds: number
gameId: string
isExpressForbidden: boolean
isWon?: boolean
} & Selection
type Selection = {
conditionId: string
outcomeId: string
}