市场指数 market-index

市场指数是一个提供搜索、发现和浏览所有预测市场平台上的索引市场的工具,具备高级过滤和分类功能,关键词包括搜索、发现、浏览、预测市场、索引市场、高级过滤、分类。

量化策略 0 次安装 0 次浏览 更新于 3/5/2026

市场指数 - 完整的API参考

搜索、发现和浏览所有预测市场平台上的索引市场,具有高级过滤和分类功能。


聊天命令

搜索

/index search "trump"                       # 搜索所有索引市场
/index search "election" --platform poly    # 搜索特定平台
/index search "fed rate" --category finance # 按类别过滤
/index search "crypto" --min-volume 10000   # 最小交易量过滤
/index search "sports" --active-only        # 仅活跃市场

浏览类别

/index categories                           # 列出所有类别
/index category politics                    # 浏览政治市场
/index category crypto                      # 浏览加密货币市场
/index category sports                      # 浏览体育市场
/index trending                             # 热门市场

市场发现

/index new                                  # 新创建的市场
/index new --last 24h                       # 最近24小时
/index hot                                  # 高活跃度市场
/index closing-soon                         # 即将结束的市场

索引管理

/index update                               # 刷新市场索引
/index update poly                          # 更新特定平台
/index stats                                # 索引统计
/index status                               # 索引健康状态

TypeScript API参考

创建市场索引

import { createMarketIndex } from 'clodds/market-index';

const index = createMarketIndex({
  platforms: ['polymarket', 'kalshi', 'manifold', 'betfair'],

  // 自动刷新
  autoRefresh: true,
  refreshIntervalMs: 300000,  // 5分钟

  // 存储
  cachePath: './market-index.db',
});

搜索市场

// 全文搜索
const results = await index.search('trump election', {
  platforms: ['polymarket', 'kalshi'],
  limit: 20,
  sortBy: 'volume',  // 'volume' | 'relevance' | 'endDate' | 'created'
});

for (const market of results) {
  console.log(`[${market.platform}] ${market.question}`);
  console.log(`  类别: ${market.category}`);
  console.log(`  交易量: $${market.volume.toLocaleString()}`);
  console.log(`  结束: ${market.endDate}`);
}

// 带过滤器
const filtered = await index.search('', {
  category: 'politics',
  minVolume: 10000,
  activeOnly: true,
  endsBefore: '2024-12-31',
});

浏览类别

// 获取所有类别
const categories = await index.getCategories();

for (const cat of categories) {
  console.log(`${cat.name}: ${cat.marketCount} 市场`);
}

// 获取类别中的市场
const politics = await index.getMarketsByCategory('politics', {
  limit: 50,
  sortBy: 'volume',
});

市场发现

// 获取新市场
const newMarkets = await index.getNewMarkets({
  since: Date.now() - 24 * 60 * 60 * 1000,  // 最近24小时
  limit: 20,
});

// 获取趋势/热门市场
const trending = await index.getTrendingMarkets({
  period: '24h',
  limit: 10,
});

for (const market of trending) {
  console.log(`${market.question}`);
  console.log(`  24小时交易量: $${market.volume24h.toLocaleString()}`);
  console.log(`  交易量变化: ${market.volumeChange > 0 ? '+' : ''}${market.volumeChange}%`);
}

// 即将结束的市场
const closingSoon = await index.getClosingSoon({
  within: '48h',
  minVolume: 1000,
});

索引管理

// 更新索引
await index.update();

// 更新特定平台
await index.update('polymarket');

// 获取索引统计
const stats = await index.getStats();

console.log(`总市场数: ${stats.totalMarkets}`);
console.log(`按平台:`);
for (const [platform, count] of Object.entries(stats.byPlatform)) {
  console.log(`  ${platform}: ${count}`);
}
console.log(`按类别:`);
for (const [category, count] of Object.entries(stats.byCategory)) {
  console.log(`  ${category}: ${count}`);
}
console.log(`最后更新: ${stats.lastUpdated}`);

// 检查状态
const status = await index.getStatus();
console.log(`状态: ${status.status}`);
console.log(`索引市场数: ${status.marketCount}`);
console.log(`索引年龄: ${status.ageMinutes} 分钟`);

获取单个市场

// 获取市场详情
const market = await index.getMarket('polymarket', 'market-123');

console.log(`问题: ${market.question}`);
console.log(`描述: ${market.description}`);
console.log(`类别: ${market.category}`);
console.log(`平台: ${market.platform}`);
console.log(`交易量: $${market.volume.toLocaleString()}`);
console.log(`流动性: $${market.liquidity.toLocaleString()}`);
console.log(`开始: ${market.startDate}`);
console.log(`结束: ${market.endDate}`);
console.log(`结果: ${market.outcomes.join(', ')}`);

类别

跨平台的标准类别:

类别 描述
政治 选举,政策,政府
加密货币 加密货币价格,事件
财务 联邦利率,股票,经济
体育 比赛,锦标赛,奖项
娱乐 电影,电视,名人
科学 研究,太空,气候
技术 科技公司,产品
世界 国际事件
其他 杂项

搜索语法

语法 示例 描述
关键词 trump election 匹配任意单词
精确短语 "federal reserve" 匹配精确短语
排除 election -trump 排除单词
平台过滤器 platform:poly 特定平台
类别过滤器 category:politics 特定类别

排序选项

选项 描述
volume 按交易量从高到低排序
relevance 最佳匹配优先
endDate 即将结束的市场优先
created 最新的市场优先
liquidity 按流动性从高到低排序

最佳实践

  1. 定期刷新 - 市场变化频繁
  2. 使用过滤器 - 缩小大型结果集
  3. 检查流动性 - 不仅仅是交易量
  4. 监控新市场 - 新上市的机会
  5. 跟踪结束日期 - 不要错过决议