Translate all remaining Chinese to English across entire codebase

All user-facing text now in English: reports, logs, email subjects,
briefing templates, stats summaries, trader profiles, signal context,
volatility reports, and Twitter section headers.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
SII-leiyu
2026-04-18 17:01:00 +08:00
co-authored by Claude Opus 4.6
parent aa968421ca
commit 4a380a6769
9 changed files with 168 additions and 168 deletions
+1 -1
View File
@@ -166,7 +166,7 @@ class WhaleWatcher:
try:
subject = (
f"异常交易警报 ({likelihood:.0%}) — "
f"Anomalous Trade Alert ({likelihood:.0%}) — "
f"BUY {trade.outcome} @ {trade.price:.4f} "
f"${trade.usdc_size:,.0f}{whale_trade.market_question[:50]}"
)
+11 -11
View File
@@ -66,7 +66,7 @@ class AnomalySignal(BaseModel):
trade_time = datetime.fromtimestamp(self.trade_timestamp).strftime('%Y-%m-%d %H:%M:%S')
# Trader ranking info
trader_rank_str = "未上榜"
trader_rank_str = "Unranked"
trader_pnl_str = "N/A"
trader_vol_str = "N/A"
if self.trader_ranking:
@@ -81,14 +81,14 @@ class AnomalySignal(BaseModel):
trader_history_str = ""
if self.trader_history:
trader_history_str = f"""
- 近期交易数: {self.trader_history.total_trades}
- 交易总额: ${self.trader_history.total_volume:,.2f}
- 大额交易数: {self.trader_history.large_trades_count}"""
- Recent Trades: {self.trader_history.total_trades}
- Total Volume: ${self.trader_history.total_volume:,.2f}
- Large Trades: {self.trader_history.large_trades_count}"""
return f"""**交易时间**: {trade_time}
**交易方向**: {self.trade_side}
**交易金额**: ${self.trade_size_usd:,.2f} USDC
**交易价格**: {self.trade_price:.4f}
**交易结果**: {self.trade_outcome}
**交易者钱包**: {self.trader_wallet or 'Unknown'}
**交易者排名**: {trader_rank_str} (PnL: {trader_pnl_str}, 交易量: {trader_vol_str}){trader_history_str}"""
return f"""**Trade Time**: {trade_time}
**Direction**: {self.trade_side}
**Trade Size**: ${self.trade_size_usd:,.2f} USDC
**Trade Price**: {self.trade_price:.4f}
**Outcome**: {self.trade_outcome}
**Trader Wallet**: {self.trader_wallet or 'Unknown'}
**Trader Rank**: {trader_rank_str} (PnL: {trader_pnl_str}, Volume: {trader_vol_str}){trader_history_str}"""
+52 -52
View File
@@ -120,49 +120,49 @@ class WhaleTrade(BaseModel):
def format_event_positions(self) -> str:
"""Format whale's event positions for LLM context."""
if self.whale_event_positions:
info = "### 该鲸鱼在同一事件下其他市场的持仓\n"
info += "(用于判断是否存在对冲或关联押注)\n\n"
info = "### Whale's Positions in Other Markets Under the Same Event\n"
info += "(Used to identify hedging or correlated bets)\n\n"
for pos in self.whale_event_positions:
pnl_str = f"盈亏 ${pos.pnl:+,.0f}" if pos.pnl else ""
pnl_str = f"PnL ${pos.pnl:+,.0f}" if pos.pnl else ""
info += (
f"- **{pos.market_question[:60]}{'...' if len(pos.market_question) > 60 else ''}**\n"
f" {pos.side_summary} | "
f"当前价值 ${pos.current_value:,.0f} | 成本 ${pos.initial_value:,.0f} | "
f"Current Value ${pos.current_value:,.0f} | Cost Basis ${pos.initial_value:,.0f} | "
f"{pnl_str}\n"
)
return info
return "### 该鲸鱼在同一事件下其他市场的持仓\n- 无其他关联持仓(单一市场事件或无跨市场交易)\n"
return "### Whale's Positions in Other Markets Under the Same Event\n- No other related positions (single-market event or no cross-market trades)\n"
def format_top_traders(self) -> str:
"""Format market top holders for LLM context."""
info = "### 该市场 Top 5 多空双方持仓者\n"
info += "(反映市场主要参与者的立场和资质)\n"
info = "### Top 5 Bulls and Bears on This Market\n"
info += "(Reflects the stance and credentials of major participants)\n"
if self.market_top_buyers:
info += "\n**看多方 (持有 Yes Token)**:\n"
info += "\n**Bulls (Holding Yes Token)**:\n"
for i, t in enumerate(self.market_top_buyers, 1):
rank_str = f"排名 #{t.rank}" if t.rank else "未上榜"
rank_str = f"Rank #{t.rank}" if t.rank else "Unranked"
pnl_str = f"PnL ${t.pnl:,.0f}" if t.pnl is not None else ""
name_str = t.name or t.wallet[:10] + "..."
info += (
f" {i}. **{name_str}** ({rank_str}{', ' + pnl_str if pnl_str else ''}) "
f"持仓价值 ${t.net_volume_usd:,.0f}\n"
f"Position Value ${t.net_volume_usd:,.0f}\n"
)
else:
info += "\n**看多方**: 无显著持仓\n"
info += "\n**Bulls**: No significant positions\n"
if self.market_top_sellers:
info += "\n**看空方 (持有 No Token)**:\n"
info += "\n**Bears (Holding No Token)**:\n"
for i, t in enumerate(self.market_top_sellers, 1):
rank_str = f"排名 #{t.rank}" if t.rank else "未上榜"
rank_str = f"Rank #{t.rank}" if t.rank else "Unranked"
pnl_str = f"PnL ${t.pnl:,.0f}" if t.pnl is not None else ""
name_str = t.name or t.wallet[:10] + "..."
info += (
f" {i}. **{name_str}** ({rank_str}{', ' + pnl_str if pnl_str else ''}) "
f"持仓价值 ${t.net_volume_usd:,.0f}\n"
f"Position Value ${t.net_volume_usd:,.0f}\n"
)
else:
info += "\n**看空方**: 无显著持仓\n"
info += "\n**Bears**: No significant positions\n"
return info
@@ -171,70 +171,70 @@ class WhaleTrade(BaseModel):
# Format trader ranking info
trader_info = ""
if self.trader_ranking:
rank_str = f"#{self.trader_ranking.rank}" if self.trader_ranking.rank else "未上榜"
rank_str = f"#{self.trader_ranking.rank}" if self.trader_ranking.rank else "Unranked"
pnl_str = f"${self.trader_ranking.pnl:,.2f}" if self.trader_ranking.pnl else "N/A"
vol_str = f"${self.trader_ranking.volume:,.2f}" if self.trader_ranking.volume else "N/A"
verified_str = "✅ 已认证" if self.trader_ranking.verified else "未认证"
verified_str = "Verified" if self.trader_ranking.verified else "Unverified"
trader_info = f"""
### 交易者排名信息 (盈利排行榜)
- **排名**: {rank_str} (时间范围: {self.trader_ranking.time_period})
- **累计盈亏 (PnL)**: {pnl_str}
- **交易量**: {vol_str}
- **用户名**: {self.trader_ranking.user_name or 'Anonymous'}
- **认证状态**: {verified_str}
### Trader Ranking (PnL Leaderboard)
- **Rank**: {rank_str} (Period: {self.trader_ranking.time_period})
- **Cumulative PnL**: {pnl_str}
- **Volume**: {vol_str}
- **Username**: {self.trader_ranking.user_name or 'Anonymous'}
- **Verification**: {verified_str}
"""
else:
trader_info = """
### 交易者排名信息
- 该交易者不在盈利排行榜上(可能是新用户或小额交易者)
### Trader Ranking
- This trader is not on the PnL leaderboard (possibly a new user or small trader)
"""
# Format trader history info
history_info = ""
if self.trader_history:
history_info = f"""
### 交易者历史交易记录
- **近期交易总数**: {self.trader_history.total_trades}
- **近期交易总额**: ${self.trader_history.total_volume:,.2f} USDC
- **平均交易金额**: ${self.trader_history.avg_trade_size:,.2f} USDC
- **大额交易次数** ($5000): {self.trader_history.large_trades_count}
- **活跃市场**: {', '.join(self.trader_history.recent_markets[:5]) if self.trader_history.recent_markets else 'N/A'}
### Trader History
- **Recent Trades**: {self.trader_history.total_trades}
- **Recent Volume**: ${self.trader_history.total_volume:,.2f} USDC
- **Avg Trade Size**: ${self.trader_history.avg_trade_size:,.2f} USDC
- **Large Trades** (>=$5000): {self.trader_history.large_trades_count}
- **Active Markets**: {', '.join(self.trader_history.recent_markets[:5]) if self.trader_history.recent_markets else 'N/A'}
"""
# Add recent large trades details
if self.trader_history.recent_trades:
history_info += "\n**近期大额交易明细**:\n"
history_info += "\n**Recent Large Trade Details**:\n"
for i, t in enumerate(self.trader_history.recent_trades[:5], 1):
history_info += f" {i}. {t.get('side', 'N/A')} ${t.get('usdc_size', 0):,.2f} @ {t.get('price', 0):.4f} - {t.get('title', 'N/A')[:40]}...\n"
else:
history_info = """
### 交易者历史交易记录
- 无法获取该交易者的历史交易记录
### Trader History
- Unable to retrieve this trader's trading history
"""
return f"""
## 异常交易检测
## Anomalous Trade Detection
### 交易信息
- 交易方向: BUY {self.trade.outcome} Token ({'看多,认为事件会发生' if self.trade.outcome == 'Yes' else '看空,认为事件不会发生'})
- 交易金额: ${self.trade.usdc_size:,.2f} USDC
- 买入价格: {self.trade.price:.4f}(赔率约 {1/self.trade.price:.1f}x
- 交易时间: {datetime.fromtimestamp(self.trade.timestamp).strftime('%Y-%m-%d %H:%M:%S')}
- 交易者钱包: {self.trade.proxy_wallet or 'Unknown'}
### Trade Information
- Direction: BUY {self.trade.outcome} Token ({'Bullish — expects the event to occur' if self.trade.outcome == 'Yes' else 'Bearish — expects the event will not occur'})
- Trade Size: ${self.trade.usdc_size:,.2f} USDC
- Entry Price: {self.trade.price:.4f} (Odds ~{1/self.trade.price:.1f}x)
- Trade Time: {datetime.fromtimestamp(self.trade.timestamp).strftime('%Y-%m-%d %H:%M:%S')}
- Trader Wallet: {self.trade.proxy_wallet or 'Unknown'}
{trader_info}{history_info}
{self.format_event_positions()}
{self.format_top_traders()}
### 市场信息
- 市场问题: {self.market_question}
- 市场描述: {self.market_description or 'N/A'}
- 可能结果: {', '.join(self.market_outcomes)}
- 当前价格: {', '.join([f'{o}: {p:.4f}' for o, p in zip(self.market_outcomes, self.market_outcome_prices)])}
### Market Information
- Market Question: {self.market_question}
- Market Description: {self.market_description or 'N/A'}
- Possible Outcomes: {', '.join(self.market_outcomes)}
- Current Prices: {', '.join([f'{o}: {p:.4f}' for o, p in zip(self.market_outcomes, self.market_outcome_prices)])}
### 分析要点
1. 这笔大额交易 (${self.trade.usdc_size:,.2f}) 的方向为 **BUY {self.trade.outcome} Token**{'表明交易者看多,认为事件会发生' if self.trade.outcome == 'Yes' else '表明交易者看空,认为事件不会发生'}
2. 买入价格 {self.trade.price:.4f},赔率约 {1/self.trade.price:.1f}x
3. **交易者排名和历史交易是判断信息不对称可信度的重要参考**
4. **注意分析该鲸鱼在同一事件下的其他持仓** — 如果持有反向仓位可能是对冲策略
5. **参考该市场 Top 多空持仓者的阵营** — 精英交易者集中在哪一方
### Key Analysis Points
1. This large trade (${self.trade.usdc_size:,.2f}) is **BUY {self.trade.outcome} Token**, {'indicating the trader is Bullish and expects the event to occur' if self.trade.outcome == 'Yes' else 'indicating the trader is Bearish and expects the event will not occur'}
2. Entry price {self.trade.price:.4f}, odds ~{1/self.trade.price:.1f}x
3. **Trader ranking and history are key references for assessing information asymmetry credibility**
4. **Review the whale's other positions under the same event** — opposite positions may indicate a hedging strategy
5. **Check the top bulls and bears on this market** — which side has the elite traders
"""
+25 -25
View File
@@ -170,31 +170,31 @@ class DailyBriefingGenerator:
date_str = date.strftime("%Y-%m-%d")
lines = [
f"# 每日信号简报 - {date_str}",
f"# Daily Signal Briefing - {date_str}",
"",
f"生成时间: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}",
f"Generated at: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}",
"",
]
# Summary stats
if is_fallback:
summary_line = f"- 今日无可信度 ≥ 60% 的内幕信号,以下为可信度最高的 **{len(insider_signals)}** "
summary_line = f"- No signals with confidence >= 60% today; showing the top **{len(insider_signals)}** by confidence"
else:
summary_line = f"- 高可信度信息不对称信号: **{len(insider_signals)}** 个 (可信度 ≥ 60%)"
summary_line = f"- High-confidence information asymmetry signals: **{len(insider_signals)}** (confidence >= 60%)"
lines.extend([
"## 今日概览",
"## Today's Overview",
"",
summary_line,
f"- 异常价格波动: **{len(volatility_alerts)}**",
f"- Abnormal price volatility events: **{len(volatility_alerts)}**",
"",
])
# Insider trading signals section
if is_fallback:
section_title = "## 今日可信度最高的异常交易"
section_title = "## Today's Top Anomalous Trades by Confidence"
else:
section_title = "## 高可信度信息不对称信号"
section_title = "## High-Confidence Information Asymmetry Signals"
lines.extend([
"---",
@@ -220,32 +220,32 @@ class DailyBriefingGenerator:
lines.extend([
f"### {i}. {market_question[:80]}{'...' if len(market_question) > 80 else ''}",
"",
f"| 指标 | 值 |",
f"|------|-----|",
f"| 信息不对称 | **{likelihood:.0%}** |",
f"| 交易方向 | BUY {trade_outcome} Token ({'看多' if trade_outcome == 'Yes' else '看空'}) |",
f"| 买入价格 | {trade_price:.4f}(赔率 {odds_str} |",
f"| 花费金额 | **${trade_size:,.0f}** USDC |",
f"| 检测时间 | {detected_at} |",
f"| Metric | Value |",
f"|--------|-------|",
f"| Info Asymmetry | **{likelihood:.0%}** |",
f"| Direction | BUY {trade_outcome} Token ({'Bullish' if trade_outcome == 'Yes' else 'Bearish'}) |",
f"| Entry Price | {trade_price:.4f} (Odds {odds_str}) |",
f"| Trade Size | **${trade_size:,.0f}** USDC |",
f"| Detected At | {detected_at} |",
"",
])
if reasoning:
lines.extend([
f"**分析过程**: {reasoning}",
f"**Analysis**: {reasoning}",
"",
])
if insider_evidence:
lines.extend([
f"**内幕证据**: {insider_evidence}",
f"**Insider Evidence**: {insider_evidence}",
"",
])
lines.append("")
else:
lines.extend([
"*今日无异常交易信号*",
"*No anomalous trade signals today*",
"",
])
@@ -253,14 +253,14 @@ class DailyBriefingGenerator:
lines.extend([
"---",
"",
"## 异常价格波动",
"## Abnormal Price Volatility",
"",
])
if volatility_alerts:
lines.extend([
"| 市场 | 方向 | 波动幅度 | 起始价格 | 结束价格 | 检测时间 |",
"|------|------|----------|----------|----------|----------|",
"| Market | Direction | Change | Start Price | End Price | Detected At |",
"|--------|-----------|--------|-------------|-----------|-------------|",
])
for alert in volatility_alerts:
@@ -269,7 +269,7 @@ class DailyBriefingGenerator:
if len(market_question) > 40:
market_question = market_question[:37] + "..."
direction = "下跌" if alert.get("direction") == "DOWN" else "上涨"
direction = "Down" if alert.get("direction") == "DOWN" else "Up"
price_change = abs(alert.get("price_change_percent", 0))
start_price = alert.get("start_price", 0)
end_price = alert.get("end_price", 0)
@@ -283,7 +283,7 @@ class DailyBriefingGenerator:
lines.append("")
else:
lines.extend([
"*今日无异常价格波动*",
"*No abnormal price volatility today*",
"",
])
@@ -300,7 +300,7 @@ class DailyBriefingGenerator:
lines.extend([
"---",
"",
"*此简报由 Polymarket Whale Watcher 自动生成*",
"*This briefing was automatically generated by Polymarket Whale Watcher*",
])
return "\n".join(lines)
@@ -364,7 +364,7 @@ class DailyBriefingGenerator:
recipients = [r.strip() for r in settings.email_recipient.split(",") if r.strip()]
msg = MIMEMultipart("alternative")
msg["Subject"] = f"Polymarket 鲸鱼日报 - {date_str}"
msg["Subject"] = f"Polymarket Whale Daily Briefing - {date_str}"
msg["From"] = settings.email_sender
msg["To"] = ", ".join(recipients)
+30 -30
View File
@@ -381,49 +381,49 @@ class LLMAnalyzer:
ias = rec.information_asymmetry_score
if ias >= 0.7:
insider_indicator = f"🔴 高信息不对称 ({ias:.0%})"
insider_indicator = f"High Information Asymmetry ({ias:.0%})"
elif ias >= 0.4:
insider_indicator = f"🟡 中等信息不对称 ({ias:.0%})"
insider_indicator = f"Medium Information Asymmetry ({ias:.0%})"
else:
insider_indicator = f"🟢 低信息不对称 ({ias:.0%})"
insider_indicator = f"Low Information Asymmetry ({ias:.0%})"
rank_num = whale_trade.trader_ranking.rank if whale_trade.trader_ranking and whale_trade.trader_ranking.rank else None
credibility_indicators = {
TraderCredibility.HIGH: f"🏆 高可信度 (#{rank_num})" if rank_num else "🏆 高可信度",
TraderCredibility.MEDIUM: f"⭐ 中等可信度 (#{rank_num})" if rank_num else "⭐ 中等可信度",
TraderCredibility.LOW: f"📉 低可信度 (#{rank_num})" if rank_num else "📉 低可信度",
TraderCredibility.UNKNOWN: "❓ 未知 (未上榜)",
TraderCredibility.HIGH: f"High Credibility (#{rank_num})" if rank_num else "High Credibility",
TraderCredibility.MEDIUM: f"Medium Credibility (#{rank_num})" if rank_num else "Medium Credibility",
TraderCredibility.LOW: f"Low Credibility (#{rank_num})" if rank_num else "Low Credibility",
TraderCredibility.UNKNOWN: "Unknown (Unranked)",
}
credibility_str = credibility_indicators.get(rec.trader_credibility, "❓ 未知")
credibility_str = credibility_indicators.get(rec.trader_credibility, "Unknown")
trader_ranking_str = ""
if whale_trade.trader_ranking:
tr = whale_trade.trader_ranking
rank_str = f"#{tr.rank}" if tr.rank else "未上榜"
rank_str = f"#{tr.rank}" if tr.rank else "Unranked"
pnl_str = f"${tr.pnl:,.2f}" if tr.pnl else "N/A"
trader_ranking_str = f"| **交易者排名** | {rank_str} (PnL: {pnl_str}) |"
trader_ranking_str = f"| **Trader Rank** | {rank_str} (PnL: {pnl_str}) |"
historical_info = ""
if historical_signal_count > 0:
historical_info = f"\n**参考历史异常信号**: {historical_signal_count} 笔 (已综合分析)"
historical_info = f"\n**Historical Anomaly Signals Referenced**: {historical_signal_count} (analyzed together)"
report = f"""
{'='*70}
# 🐋 鲸鱼交易分析报告
# Whale Trade Analysis Report
{'='*70}
**生成时间**: {datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S')} UTC{historical_info}
**Generated at**: {datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S')} UTC{historical_info}
## 交易摘要
## Trade Summary
| 项目 | 详情 |
|------|------|
| **市场** | {whale_trade.market_question} |
| **交易金额** | ${trade.usdc_size:,.2f} USDC |
| **交易方向** | BUY {trade.outcome} Token ({'看多' if trade.outcome == 'Yes' else '看空'}) |
| **交易价格** | {trade.price:.4f} ({trade.price:.1%}) |
| **当前赔率** | {prices_str} |
| **交易时间** | {datetime.fromtimestamp(trade.timestamp).strftime('%Y-%m-%d %H:%M:%S') if trade.timestamp else 'N/A'} |
| Field | Details |
|-------|---------|
| **Market** | {whale_trade.market_question} |
| **Trade Size** | ${trade.usdc_size:,.2f} USDC |
| **Direction** | BUY {trade.outcome} Token ({'Bullish' if trade.outcome == 'Yes' else 'Bearish'}) |
| **Trade Price** | {trade.price:.4f} ({trade.price:.1%}) |
| **Current Odds** | {prices_str} |
| **Trade Time** | {datetime.fromtimestamp(trade.timestamp).strftime('%Y-%m-%d %H:%M:%S') if trade.timestamp else 'N/A'} |
{trader_ranking_str}
{'='*70}
@@ -431,20 +431,20 @@ class LLMAnalyzer:
{decision.analysis}
{'='*70}
## 🔍 信息不对称评估
## Information Asymmetry Assessment
{'='*70}
| 项目 | 评估 |
|------|------|
| **信息不对称程度** | {insider_indicator} |
| **交易者可信度** | {credibility_str} |
| Field | Assessment |
|-------|------------|
| **Information Asymmetry** | {insider_indicator} |
| **Trader Credibility** | {credibility_str} |
**关键证据**: {rec.insider_evidence or '无明确证据'}
**Key Evidence**: {rec.insider_evidence or 'No clear evidence'}
**推理过程**: {rec.reasoning}
**Reasoning**: {rec.reasoning}
{'='*70}
⚠️ 免责声明:本报告由AI生成,仅供参考,不构成投资建议。
Disclaimer: This report is AI-generated for informational purposes only and does not constitute investment advice.
{'='*70}
"""
return report
+12 -12
View File
@@ -56,16 +56,16 @@ class StatsEngine:
return ""
lines = [
"## 信号历史战绩",
"## Signal Performance History",
"",
f"| 指标 | 值 |",
f"|------|-----|",
f"| 总信号数 | {stats['total_signals']} |",
f"| 已验证 | {stats['resolved']} |",
f"| 正确 | {stats['correct']} |",
f"| 胜率 | **{stats['win_rate']:.1%}** |",
f"| 平均ROI | **{stats['avg_roi']:+.1%}** |",
f"| 理论总PnL | **{stats['total_theoretical_pnl']:+.2f}x** |",
f"| Metric | Value |",
f"|--------|-------|",
f"| Total Signals | {stats['total_signals']} |",
f"| Resolved | {stats['resolved']} |",
f"| Correct | {stats['correct']} |",
f"| Win Rate | **{stats['win_rate']:.1%}** |",
f"| Avg ROI | **{stats['avg_roi']:+.1%}** |",
f"| Total Theoretical PnL | **{stats['total_theoretical_pnl']:+.2f}x** |",
"",
]
@@ -73,10 +73,10 @@ class StatsEngine:
has_resolved_tiers = any(t["resolved"] > 0 for t in tier_stats)
if has_resolved_tiers:
lines.extend([
"### 按信号可信度分层",
"### By Signal Confidence Tier",
"",
"| 可信度区间 | 信号数 | 已验证 | 胜率 | 平均ROI |",
"|-----------|-------|-------|------|---------|",
"| Confidence Range | Signals | Resolved | Win Rate | Avg ROI |",
"|-----------------|---------|----------|----------|---------|",
])
for t in tier_stats:
if t["total"] > 0:
+3 -3
View File
@@ -473,9 +473,9 @@ class TradeMonitor:
# Build human-readable summary
if outcome == "Yes":
side_summary = f"持有 Yes {size:,.0f} 份 @ 均价 {avg_price:.2%},当前 {cur_price:.2%}"
side_summary = f"Holding Yes {size:,.0f} tokens @ avg {avg_price:.2%}, current {cur_price:.2%}"
else:
side_summary = f"持有 No {size:,.0f} 份 @ 均价 {avg_price:.2%},当前 {cur_price:.2%}"
side_summary = f"Holding No {size:,.0f} tokens @ avg {avg_price:.2%}, current {cur_price:.2%}"
result.append(EventPosition(
market_question=title,
@@ -649,7 +649,7 @@ class TradeMonitor:
market_id=market_id,
)
rank_str = f"(排名 #{trader_ranking.rank})" if trader_ranking and trader_ranking.rank else "(未上榜)"
rank_str = f"(Rank #{trader_ranking.rank})" if trader_ranking and trader_ranking.rank else "(Unranked)"
breakdown_short = " | ".join(f"{k}={v:.2f}" for k, v in breakdown.items())
if not should_analyze:
+2 -2
View File
@@ -195,12 +195,12 @@ class TwitterSearchService:
# 1. Search TOP tweets - high engagement, represents importance
top_result = self.search_tweets(query, search_mode="top", limit=limit)
if "No recent tweets" not in top_result and "Error" not in top_result:
results.append("## 🔥 热门推文(高互动/重要性)\n" + top_result)
results.append("## Hot Tweets (High Engagement / Importance)\n" + top_result)
# 2. Search LATEST tweets - real-time info, represents timeliness
latest_result = self.search_tweets(query, search_mode="latest", limit=limit)
if "No recent tweets" not in latest_result and "Error" not in latest_result:
results.append("## ⚡ 最新推文(实时/时效性)\n" + latest_result)
results.append("## Latest Tweets (Real-Time / Timeliness)\n" + latest_result)
if not results:
return f"No relevant tweets found for: {market_question[:50]}..."
+32 -32
View File
@@ -256,59 +256,59 @@ class VolatilityAnalyzer:
Returns:
Formatted report string
"""
direction_cn = "上涨" if signal.direction == "UP" else "下跌"
signal_type_cn = {
SignalType.LEADING_SIGNAL: "🚨 领先信号(价格早于新闻)",
SignalType.NEWS_DRIVEN: "📰 新闻驱动",
SignalType.SOCIAL_DRIVEN: "🐦 社交驱动",
SignalType.SPECULATION: "💭 投机波动",
direction_label = "Up" if signal.direction == "UP" else "Down"
signal_type_label = {
SignalType.LEADING_SIGNAL: "Leading Signal (Price Preceded News)",
SignalType.NEWS_DRIVEN: "News-Driven",
SignalType.SOCIAL_DRIVEN: "Social-Driven",
SignalType.SPECULATION: "Speculative Volatility",
}
news_headlines = "\n".join([f" - {h}" for h in signal.key_news_headlines]) or " "
social_posts = "\n".join([f" - {p}" for p in signal.key_social_posts]) or " "
news_headlines = "\n".join([f" - {h}" for h in signal.key_news_headlines]) or " None"
social_posts = "\n".join([f" - {p}" for p in signal.key_social_posts]) or " None"
report = f"""
{'='*70}
# 📊 价格波动分析报告
# Price Volatility Analysis Report
{'='*70}
**分析时间**: {signal.detected_at}
**Analysis Time**: {signal.detected_at}
## 波动详情
## Volatility Details
| 项目 | 详情 |
|------|------|
| **市场** | {signal.market_question} |
| **价格变动** | {direction_cn} {abs(signal.price_change_percent):.1%} |
| **起始价格** | {signal.start_price:.2%} |
| **结束价格** | {signal.end_price:.2%} |
| **时间窗口** | {signal.window_seconds // 60} 分钟 |
| Field | Details |
|-------|---------|
| **Market** | {signal.market_question} |
| **Price Change** | {direction_label} {abs(signal.price_change_percent):.1%} |
| **Start Price** | {signal.start_price:.2%} |
| **End Price** | {signal.end_price:.2%} |
| **Time Window** | {signal.window_seconds // 60} min |
{'='*70}
## 🔍 分析结果
## Analysis Results
{'='*70}
| 项目 | 结果 |
|------|------|
| **信号类型** | {signal_type_cn.get(signal.signal_type, '未知')} |
| **置信度** | {signal.confidence:.1%} |
| **是否领先信号** | {'✅ 是' if signal.is_leading_signal else '❌ 否'} |
| **时间优势** | {signal.time_advantage_minutes} 分钟 |
| Field | Result |
|-------|--------|
| **Signal Type** | {signal_type_label.get(signal.signal_type, 'Unknown')} |
| **Confidence** | {signal.confidence:.1%} |
| **Is Leading Signal** | {'Yes' if signal.is_leading_signal else 'No'} |
| **Time Advantage** | {signal.time_advantage_minutes} min |
**最早新闻时间**: {signal.earliest_news_time or 'N/A'}
**最早社交时间**: {signal.earliest_social_time or 'N/A'}
**Earliest News Time**: {signal.earliest_news_time or 'N/A'}
**Earliest Social Time**: {signal.earliest_social_time or 'N/A'}
## 关键新闻
## Key News
{news_headlines}
## 关键社交帖子
## Key Social Posts
{social_posts}
## 分析理由
## Reasoning
{signal.reasoning}
## 推测信息来源
{signal.potential_information_source or '未知'}
## Suspected Information Source
{signal.potential_information_source or 'Unknown'}
{'='*70}
{signal.full_analysis}