
Security News
White House Authorizes Private Companies to Conduct Offensive Cyber Operations
A new federal program will let vetted U.S. cybersecurity firms help investigate and disrupt foreign cybercrime groups under government direction.
prediction-market-context
Advanced tools
Real-time prediction market context for AI agents and LLMs. World state, uncertainty index, edges, and market data from 30,000+ markets.
Real-time prediction market context for AI agents and LLMs. One function call gives your agent calibrated world awareness from 30,000+ prediction markets.
import { world } from 'prediction-market-context'
const state = await world()
console.log(state.index.uncertainty) // 35 (0-100, how much markets disagree)
console.log(state.regimeSummary) // "Risk-off: geo elevated, momentum negative"
console.log(state.actionableEdges) // Markets where model price != market price
console.log(state.movers) // What moved in the last 24h
LLMs don't know what's happening today. Web search returns narratives and opinions. Prediction markets return calibrated probabilities backed by real money.
This package gives any AI agent instant world awareness:
All data sourced from Kalshi and Polymarket via SimpleFunctions.
npm install prediction-market-context
import { world, index, edges, delta, market } from 'prediction-market-context'
// Full world state (~800 tokens, refreshes every 15 min)
const state = await world()
// Just the uncertainty index (4 numbers)
const { uncertainty, geopolitical, momentum, activity } = await index()
// Actionable edges (thesis price != market price)
const { edges: list } = await edges()
// What changed in the last hour (~30-50 tokens)
const changes = await delta('1h')
// Specific market detail with orderbook
const m = await market('KXFEDDECISION', { depth: true })
import { PredictionMarketClient } from 'prediction-market-context'
const client = new PredictionMarketClient({
apiKey: process.env.SF_API_KEY, // optional, enables portfolio overlay
timeout: 10_000, // default 15s
})
const state = await client.world()
const idx = await client.index({ history: true })
const markdown = await world({ format: 'markdown' })
// Returns ~800 tokens of structured markdown, ready to inject into a system prompt
# World state
npx prediction-market-context world
npx prediction-market-context world --json
# What changed
npx prediction-market-context delta 1h
# Uncertainty index
npx prediction-market-context index
npx prediction-market-context index --history
# Edges
npx prediction-market-context edges
# Specific market
npx prediction-market-context market KXFEDDECISION
# Search
npx prediction-market-context search "oil prices"
import OpenAI from 'openai'
import { world } from 'prediction-market-context'
const state = await world({ format: 'markdown' })
const response = await new OpenAI().chat.completions.create({
model: 'gpt-4o',
messages: [
{ role: 'system', content: `You are a market analyst.\n\n${state}` },
{ role: 'user', content: 'What are the key risks right now?' },
],
})
import Anthropic from '@anthropic-ai/sdk'
import { world } from 'prediction-market-context'
const state = await world({ format: 'markdown' })
const response = await new Anthropic().messages.create({
model: 'claude-sonnet-4-20250514',
max_tokens: 1024,
system: `You are a geopolitical analyst.\n\n${state}`,
messages: [{ role: 'user', content: 'Summarize the current risk environment.' }],
})
import { tool } from '@langchain/core/tools'
import { world, index } from 'prediction-market-context'
const worldTool = tool(async () => {
return JSON.stringify(await world())
}, {
name: 'get_world_state',
description: 'Get real-time prediction market world state with uncertainty index, edges, and movers',
})
const indexTool = tool(async () => {
return JSON.stringify(await index())
}, {
name: 'get_uncertainty_index',
description: 'Get the prediction market uncertainty index (0-100) with geopolitical risk and momentum',
})
For full MCP server integration, use the SimpleFunctions MCP Server:
npx @spfunctions/cli --mcp
| Function | Returns | Description |
|---|---|---|
world(options?) | WorldState | string | Full world state. { format: 'markdown' } for LLM injection. |
index(options?) | UncertaintyIndex | Four-signal uncertainty index. { history: true } for 24h data. |
edges() | EdgesResponse | Actionable edges with reasoning, causal path, absorption. |
delta(since?) | WorldDelta | Incremental changes. "1h", "6h", "24h", or ISO timestamp. |
market(ticker, options?) | MarketDetail | Single market detail. { depth: true } for orderbook. |
markets(tickers, options?) | MarketDetail[] | Batch query up to 20 markets. |
search(query) | SearchResult | Search markets by topic. |
pip install simplefunctions-ai)MIT — SimpleFunctions
FAQs
Real-time prediction market context for AI agents and LLMs. World state, uncertainty index, edges, and market data from 30,000+ markets.
The npm package prediction-market-context receives a total of 2 weekly downloads. As such, prediction-market-context popularity was classified as not popular.
We found that prediction-market-context demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
A new federal program will let vetted U.S. cybersecurity firms help investigate and disrupt foreign cybercrime groups under government direction.

Research
/Security News
The campaign amassed more than 75,000 installs by targeting Russian-speaking users seeking access to blocked services.

Company News
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.