> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getelyra.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# DFlow Solana prediction markets: Elyra integration

> Access Solana-native DFlow prediction market orderbooks, taker flow analysis, and cross-book arbitrage signals directly through Elyra.

DFlow is a Solana-native prediction market platform that tokenizes Kalshi markets on-chain. Elyra integrates DFlow alongside Polymarket so you can query Solana-native orderbooks, inspect taker flow, and compare odds across platforms — all without an API key. Responses are cached for 60 seconds on the server to keep latency low under repeated queries.

## Natural language usage

You can query DFlow markets through Elyra's assistant using plain language.

```text theme={null}
"Show me DFlow prediction markets"
"Find arbitrage opportunities on DFlow"
"What's the taker flow on [market]?"
```

## What DFlow provides through Elyra

**Solana-native orderbooks** — Direct access to DFlow's on-chain order matching. Every market has a live YES and NO price derived from the current book state, not a delayed feed.

**Taker flow analysis** — Identifies whether large orders are hitting bids or lifting asks. This asymmetry is a leading indicator for directional conviction before it shows up in price.

**Cross-book line shopping** — Compares DFlow odds against Polymarket for the same underlying event. When the two platforms disagree on probability, Elyra surfaces the divergence.

**Structural arbitrage detection** — Surfaces correlated markets with divergent pricing across the DFlow universe so you can act before the spread closes.

## API endpoint

The DFlow prediction market endpoint is a Next.js route handler at `/api/prediction-market`. It accepts a single `GET` request and returns either a list of active markets or a single market by ticker.

```
GET /api/prediction-market
```

### Query parameters

<ParamField query="ticker" type="string">
  Market ticker to look up. When provided, the endpoint returns a single `DFlowMarket` object for that ticker. The value is normalised to uppercase before the lookup. If the exact ticker is not found, the endpoint attempts a search fallback and then a fuzzy match against active markets before returning an error object.

  When omitted, the endpoint returns a list of the most active markets.
</ParamField>

<ParamField query="limit" type="integer">
  Maximum number of markets to return when `ticker` is not provided. Defaults to `8`. The value is clamped server-side to a maximum of `25`.
</ParamField>

### Response — list mode

When `ticker` is not provided, the response has `type: "list"` and `data` is an array of `DFlowMarket` objects.

```json theme={null}
{
  "type": "list",
  "data": [
    {
      "id": "KXBTCD-25DEC31-T95000",
      "ticker": "KXBTCD-25DEC31-T95000",
      "title": "Will BTC close above $95,000 on Dec 31, 2025?",
      "description": "Resolves YES if BTC/USD closes above $95,000...",
      "yes_price": "0.61",
      "no_price": "0.39",
      "yes_probability": "61%",
      "volume": "$4.20M",
      "category": "crypto",
      "end_date": "2025-12-31T00:00:00Z",
      "success": true
    }
  ]
}
```

<ResponseField name="type" type="string">
  Always `"list"` in this mode.
</ResponseField>

<ResponseField name="data" type="array">
  Array of `DFlowMarket` objects. See the field definitions below. If DFlow returns no active markets, the array contains a single error object with `success: false`.
</ResponseField>

### Response — single market mode

When `ticker` is provided, the response has `type: "single"` and `data` is a single `DFlowMarket` object.

```json theme={null}
{
  "type": "single",
  "data": {
    "id": "KXBTCD-25DEC31-T95000",
    "ticker": "KXBTCD-25DEC31-T95000",
    "title": "Will BTC close above $95,000 on Dec 31, 2025?",
    "yes_price": "0.61",
    "no_price": "0.39",
    "yes_probability": "61%",
    "volume": "$4.20M",
    "success": true
  }
}
```

<ResponseField name="type" type="string">
  Always `"single"` in this mode.
</ResponseField>

<ResponseField name="data" type="object">
  A single `DFlowMarket` object. When the ticker cannot be found after all fallbacks are exhausted, `success` is `false` and `error` contains a human-readable explanation.
</ResponseField>

### `DFlowMarket` fields

<ResponseField name="id" type="string">
  Market identifier. Falls back to `ticker` when an explicit ID is not present in the DFlow response.
</ResponseField>

<ResponseField name="ticker" type="string">
  Normalised market ticker, for example `KXBTCD-25DEC31-T95000`.
</ResponseField>

<ResponseField name="title" type="string">
  Human-readable market title. Falls back to `eventTitle` when `title` is absent in the upstream response.
</ResponseField>

<ResponseField name="description" type="string">
  Optional longer description of the market's resolution criteria.
</ResponseField>

<ResponseField name="yes_price" type="string">
  Current YES price as a decimal string rounded to two places, for example `"0.61"`.
</ResponseField>

<ResponseField name="no_price" type="string">
  Current NO price as a decimal string rounded to two places, for example `"0.39"`. Derived from `1 − yes_price` when the upstream field is absent.
</ResponseField>

<ResponseField name="yes_probability" type="string">
  YES probability expressed as a rounded percentage string, for example `"61%"`.
</ResponseField>

<ResponseField name="volume" type="string">
  Total traded volume formatted as a dollar amount in millions, for example `"$4.20M"`.
</ResponseField>

<ResponseField name="category" type="string">
  Market category string when available, such as `"crypto"` or `"politics"`. Falls back to the first tag in the `tags` array if `category` is absent.
</ResponseField>

<ResponseField name="end_date" type="string">
  ISO 8601 expiration date string when available. Maps from the upstream `expirationDate` or `endDate` field.
</ResponseField>

<ResponseField name="success" type="boolean">
  `true` when the market was fetched and normalised successfully. `false` when the upstream API returned an error or the ticker could not be resolved after all fallbacks.
</ResponseField>

<ResponseField name="error" type="string">
  Present only when `success` is `false`. Contains the upstream error message and, for ticker lookups, a hint to use `"Show active prediction markets"` to retrieve valid tickers.
</ResponseField>

## Ticker lookup fallbacks

When you query a specific ticker, the endpoint attempts three resolution strategies in order before returning an error:

1. **Direct lookup** — `GET /api/v1/market/{ticker}` against the DFlow API.
2. **Search endpoint** — `GET /api/v1/markets?search={ticker}&limit=50`. Returns an exact match if the normalised ticker matches, or the closest result otherwise.
3. **Active market fuzzy match** — Fetches up to 50 active markets and checks for exact ticker equality, substring containment, or title match against the requested ticker.

<Note>
  DFlow is currently in development. The API connects to a development environment, and tickers available in the current dataset may not yet reflect the full production catalogue. If a specific ticker is unavailable, ask Elyra to "show active prediction markets" to retrieve the current list of valid tickers.
</Note>
