feat: 订单列表按市场分组并支持跳转到Polymarket
- 后端添加市场slug和分类字段 - 在 BuyOrderInfo、SellOrderInfo、MatchedOrderInfo DTO 中添加 marketSlug 和 marketCategory 字段 - 在 CopyTradingStatisticsService 中填充这些字段(从 Market 实体获取) - 前端实现按市场分组功能 - 添加分组视图切换开关(列表视图/分组视图) - 分组显示:按市场分组,显示市场名称、订单数、总金额、盈亏等统计信息 - 买入订单分组显示是否完全成交状态(全部成交/部分成交) - 卖出订单分组显示总盈亏 - 支持展开/折叠功能(单个和全部) - 桌面端默认全部展开,移动端默认全部折叠 - 市场名称点击跳转功能 - 添加 getPolymarketUrl 工具函数,根据市场分类构建URL - sports 分类市场跳转到 /moneyline 页面(spread 市场) - 其他分类市场跳转到普通市场页面 - 如果没有 slug,使用 marketId 作为后备(跳转到 condition 页面) - 分组视图、列表视图、移动端卡片视图均支持点击跳转 - 多语言支持 - 添加分组相关翻译键:groupByMarket、expandAll、collapseAll、allFullyMatched、partiallyMatched、orderCount、totalAmount、totalPnl、statusBreakdown
This commit is contained in:
@@ -94,6 +94,37 @@ export const isAutoGeneratedOrderId = (orderId: string | undefined | null): bool
|
||||
return orderId.startsWith('AUTO_') || orderId.startsWith('AUTO_FIFO_')
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建 Polymarket 市场 URL
|
||||
* 对于 spread 市场(sports 分类),跳转到 moneyline 页面
|
||||
* @param marketSlug - 市场 slug
|
||||
* @param marketCategory - 市场分类(sports, crypto 等)
|
||||
* @param marketId - 市场ID(作为后备)
|
||||
* @returns Polymarket URL,如果无法构建则返回 null
|
||||
*/
|
||||
export const getPolymarketUrl = (
|
||||
marketSlug?: string | null,
|
||||
marketCategory?: string | null,
|
||||
marketId?: string | null
|
||||
): string | null => {
|
||||
// 优先使用 slug
|
||||
if (marketSlug) {
|
||||
// 如果是 sports 分类,跳转到 moneyline 页面(spread 市场)
|
||||
if (marketCategory?.toLowerCase() === 'sports') {
|
||||
return `https://polymarket.com/event/${marketSlug}/moneyline`
|
||||
}
|
||||
// 其他分类跳转到普通市场页面
|
||||
return `https://polymarket.com/event/${marketSlug}`
|
||||
}
|
||||
|
||||
// 如果没有 slug,使用 marketId(作为后备)
|
||||
if (marketId && marketId.startsWith('0x')) {
|
||||
return `https://polymarket.com/condition/${marketId}`
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
/**
|
||||
* 复制文本到剪贴板
|
||||
* @param text - 要复制的文本
|
||||
|
||||
Reference in New Issue
Block a user