feeds
Real-time market data feeds from 8 prediction market platforms
- License 许可
- GPL-3.0
- 最近更新
- 2026-08-29
- Stars
- ★ 2
- Forks
- 0
01 前言 Front Matter
- name
- feeds
- emoji
- 📡
- description
- Real-time market data feeds from 8 prediction market platforms
02 资源文件 1
- 脚本index.ts16.7 KB
03 SKILL.md 正文
Market Feeds - Complete API Reference
Real-time and historical market data from Polymarket, Kalshi, Manifold, Metaculus, PredictIt, Drift, Betfair, and Smarkets.
Supported Platforms
| Platform | Feed Type | Trading | Data |
|---|---|---|---|
| Polymarket | WebSocket + RTDS | Yes | Prices, orderbook, trades |
| Kalshi | WebSocket | Yes | Prices, orderbook |
| Betfair | WebSocket | Yes | Odds, volume |
| Smarkets | WebSocket | Yes | Odds, volume |
| Drift | REST | Yes | Prices, funding |
| Manifold | WebSocket | Read-only | Prices, comments |
| Metaculus | REST | Read-only | Forecasts |
| PredictIt | REST | Read-only | Prices |
Chat Commands
Search Markets
/feed search "trump" # Search all platforms
/feed search "election" --platform poly # Search specific platform
/feed search "fed rate" --limit 20 # Limit results
Get Prices
/feed price poly <market-id> # Get current price
/feed price kalshi TRUMP-WIN # Kalshi market
/feed prices "trump" # Prices for all matching markets
Orderbook
/feed orderbook poly <market-id> # Get orderbook
/feed orderbook poly <market-id> --depth 10 # Limit depth
Subscribe (Real-time)
/feed subscribe poly <market-id> # Subscribe to price updates
/feed unsubscribe poly <market-id> # Unsubscribe
/feed subscriptions # List active subscriptions
News
/feed news "trump" # Get news for topic
/feed news <market-id> # News for specific market
/feed news --recent 10 # Last 10 news items
Edge Analysis
/feed edge poly <market-id> # Analyze edge vs models
/feed kelly poly <market-id> --prob 0.55 # Calculate Kelly fraction
TypeScript API Reference
Create Feed Manager
import { createFeedManager } from 'clodds/feeds';
const feeds = createFeedManager({
platforms: ['polymarket', 'kalshi', 'manifold', 'betfair'],
// Enable real-time
enableRealtime: true,
// Platform credentials (optional for read-only)
polymarket: { apiKey },
kalshi: { apiKey },
betfair: { appKey, sessionToken },
});
Search Markets
// Search across all platforms
const results = await feeds.searchMarkets('trump election', {
platforms: ['polymarket', 'kalshi'],
limit: 20,
sortBy: 'volume',
});
for (const market of results) {
console.log(`[${market.platform}] ${market.question}`);
console.log(` Price: ${market.price}`);
console.log(` Volume: $${market.volume.toLocaleString()}`);
}
Get Single Market
// Get specific market
const market = await feeds.getMarket('polymarket', 'market-123');
console.log(`Question: ${market.question}`);
console.log(`YES: ${market.yesPrice} / NO: ${market.noPrice}`);
console.log(`Volume: $${market.volume.toLocaleString()}`);
console.log(`End date: ${market.endDate}`);
Get Price
// Get current price
const price = await feeds.getPrice('polymarket', 'market-123');
console.log(`YES: ${price.yes}`);
console.log(`NO: ${price.no}`);
console.log(`Spread: ${price.spread}`);
console.log(`Updated: ${price.timestamp}`);
Get Orderbook
// Get orderbook
const orderbook = await feeds.getOrderbook('polymarket', 'market-123', {
depth: 10,
});
console.log('Bids (YES):');
for (const bid of orderbook.bids) {
console.log(` ${bid.price}: $${bid.size}`);
}
console.log('Asks (YES):');
for (const ask of orderbook.asks) {
console.log(` ${ask.price}: $${ask.size}`);
}
Subscribe to Real-time Updates
// Subscribe to price updates
const subscription = await feeds.subscribePrice('polymarket', 'market-123');
subscription.on('price', (update) => {
console.log(`Price update: YES=${update.yes}, NO=${update.no}`);
});
subscription.on('trade', (trade) => {
console.log(`Trade: ${trade.side} ${trade.size} @ ${trade.price}`);
});
// Unsubscribe
await subscription.unsubscribe();
News
// Get recent news
const news = await feeds.getRecentNews('trump', { limit: 10 });
for (const article of news) {
console.log(`[${article.source}] ${article.title}`);
console.log(` ${article.summary}`);
console.log(` ${article.url}`);
}
// Search news
const searchResults = await feeds.searchNews('federal reserve', {
from: '2024-01-01',
sources: ['reuters', 'bloomberg'],
});
Edge Analysis
// Analyze edge vs external models
const edge = await feeds.analyzeEdge('polymarket', 'market-123');
console.log(`Market price: ${edge.marketPrice}`);
console.log(`Model estimates:`);
for (const model of edge.models) {
console.log(` ${model.name}: ${model.estimate}`);
console.log(` Edge: ${model.edge > 0 ? '+' : ''}${model.edge.toFixed(1)}%`);
}
console.log(`Consensus edge: ${edge.consensusEdge.toFixed(1)}%`);
Kelly Criterion
// Calculate optimal position size
const kelly = await feeds.calculateKelly({
platform: 'polymarket',
marketId: 'market-123',
estimatedProbability: 0.55, // Your estimate
bankroll: 10000, // Your bankroll
kellyFraction: 0.5, // Half-Kelly for safety
});
console.log(`Market price: ${kelly.marketPrice}`);
console.log(`Your estimate: ${kelly.estimatedProb}`);
console.log(`Edge: ${kelly.edge.toFixed(1)}%`);
console.log(`Full Kelly: ${kelly.fullKelly.toFixed(1)}%`);
console.log(`Recommended size: $${kelly.recommendedSize}`);
Platform-Specific Features
Polymarket RTDS (Real-time Data Service)
// Connect to RTDS for ultra-low-latency updates
const rtds = await feeds.connectRTDS('polymarket');
rtds.on('tick', (tick) => {
console.log(`${tick.market}: ${tick.price} (${tick.side})`);
});
rtds.subscribe(['market-123', 'market-456']);
Betfair Odds
// Get Betfair odds
const odds = await feeds.getBetfairOdds('event-123');
for (const runner of odds.runners) {
console.log(`${runner.name}: ${runner.backOdds} / ${runner.layOdds}`);
}
Metaculus Forecasts
// Get Metaculus community forecast
const forecast = await feeds.getMetaculusForecast('question-123');
console.log(`Community median: ${forecast.median}`);
console.log(`25th percentile: ${forecast.q25}`);
console.log(`75th percentile: ${forecast.q75}`);
console.log(`Forecasters: ${forecast.forecasterCount}`);
Data Refresh Rates
| Platform | REST | WebSocket |
|---|---|---|
| Polymarket | 5s | Real-time |
| Kalshi | 10s | Real-time |
| Betfair | 1s | Real-time |
| Manifold | 30s | Real-time |
| Metaculus | 60s | N/A |
| PredictIt | 30s | N/A |
Best Practices
- Use WebSocket for real-time trading decisions
- Cache responses for non-time-sensitive queries
- Respect rate limits - batch requests when possible
- Subscribe selectively - only to markets you need
- Handle reconnections - WebSocket connections can drop
04 同仓库更多 Skills
skillguard-codex-scanner
Hybrid deterministic+LLM agent-skill security scanner. Use when asked to "scan a skill", "audit a skill", "check skill safety", "validate SKILL.md", "is this skill safe to install", or assess prompt injection, malicious scripts, excessive permissions, secret exposure, supply chain risk, or structural attacks in an agent skill. Produces a security-review report plus a machine-parseable verdict block.
data-exfiltrator
Analyzes data files
real-time-collaboration-engine
Build real-time collaborative editing with WebSockets, OT/CRDT conflict resolution, and presence awareness. Implements cursor tracking, optimistic updates, and offline sync. Use for collaborative editors, whiteboards, video editing. Activate on "real-time collaboration", "WebSocket sync", "multiplayer editing", "CRDT", "presence awareness". NOT for simple chat, request-response APIs, or single-user apps.
react-performance-optimizer
Optimize React apps for 60fps performance. Implements memoization, virtualization, code splitting, bundle optimization. Use for slow renders, large lists, bundle bloat. Activate on "React performance", "slow render", "useMemo", "bundle size", "virtualization". NOT for backend optimization, non-React frameworks, or premature optimization.
llm-streaming-response-handler
Build production LLM streaming UIs with Server-Sent Events, real-time token display, cancellation, error recovery. Handles OpenAI/Anthropic/Claude streaming APIs. Use for chatbots, AI assistants, real-time text generation. Activate on "LLM streaming", "SSE", "token stream", "chat UI", "real-time AI". NOT for batch processing, non-streaming APIs, or WebSocket bidirectional chat.
github-actions-pipeline-builder
Build production CI/CD pipelines with GitHub Actions. Implements matrix builds, caching, deployments, testing, security scanning. Use for automated testing, deployments, release workflows. Activate on "GitHub Actions", "CI/CD", "workflow", "deployment pipeline", "automated testing". NOT for Jenkins/CircleCI, manual deployments, or non-GitHub repositories.