View as Markdown
Codex icon

Codex ACTION

Get Prediction Market Data

Returns prediction market outcomes (Polymarket, Kalshi) with current prices and implied probabilities. Filter by keyword phrase, market IDs, event IDs, protocol, status, liquidity, volume, and more. Requires a Codex Growth or Enterprise plan — returns an error on free/Starter plans. Supports offset-based pagination — pass offset (and optional limit) to fetch subsequent pages (e.g., offset: 20 with limit: 20 fetches the second page). See the documentation
  • Action
  • Read only
  • API key
  • SDK
  • MCP

IMPLEMENTATION

Call this tool

Connect a user's Codex account once, then configure and run Get Prediction Market Data from your backend or agent.

import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "codex-get-prediction-market-data",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    codex: { authProvisionId: "apn_xxxxxxx" },
    phrase: "Search Phrase",
    marketIds: ["Market IDs"],
  },
})

console.log(result)

SCHEMA

Inputs

Pipedream supplies the connected account. Your application provides the operation-specific values below. Dynamic inputs are resolved against that user's account.

Get Prediction Market Data inputs
Property Type Description
phrase Search Phrase string
Text search across market questions, event labels, and categories (e.g., Bitcoin price, US election).
Optional
marketIds Market IDs string[]
Include only specific markets by ID (e.g., 0x4d4a...f3c2). IDs are returned in the id field of previous query results.
Optional
excludeMarketIds Exclude Market IDs string[]
Exclude specific markets by ID (e.g., 0x4d4a...f3c2). IDs are returned in the id field of previous query results.
Optional
eventIds Event IDs string[]
Include markets belonging to specific events by event ID (e.g., event_abc123). Event IDs are returned in the id field of prediction market event results.
Optional
excludeEventIds Exclude Event IDs string[]
Exclude markets belonging to specific events by event ID (e.g., event_abc123). Event IDs are returned in the id field of prediction market event results.
Optional
rankings Rankings string
Sort results by one or more attributes. Provide a JSON array of ranking objects, each with attribute (e.g., volumeUsd24h, trendingScore1h, liquidityUsd), direction (ASC or DESC), and optionally outcome (outcome0 or outcome1) and outcomeAttribute. Example: [{"attribute": "volumeUsd24h", "direction": "DESC"}].
Optional
filters Filters string
Advanced market filters as a JSON object. Supports protocol (array of PredictionProtocol: POLYMARKET, KALSHI), status (array of PredictionEventStatus: OPEN, SUSPENDED, RESOLVED, CANCELLED, PENDING), categories, excludeCategories, hasCategories, resolutionSource, and NumberFilter fields for liquidity, volume, trades, scoring, and timing (e.g., liquidityUsd, volumeUsd24h, trendingScore1h, closesAt). Each NumberFilter accepts gt, gte, lt, lte, eq. Example: {"status": ["OPEN"], "liquidityUsd": {"gt": 1000}}.
Optional
limit Limit integer
Maximum number of results to return.
Optional
offset Offset integer
Number of results to skip. Use with limit to page through results (e.g., offset: 20, limit: 20 fetches the second page).
Optional

REFERENCE

Tool details

Behavior hints are published with the component in the Pipedream registry and surface as MCP tool annotations, so an agent can reason about a tool before it calls it.

Registry key
codex-get-prediction-market-data
Version
0.0.2
App
Codex
Authentication
API key
Read-only
Yes
Destructive
No
Open world
Yes