KOL feeds: fix dead/blocked sources, drop stale feeds (29→25)
Feed-health pass over KOL_FEEDS: - raoulpal: stale Substack (last 2024-05) → Real Vision podcast feed - dampedspring: paywalled (0 entries) → free "Damped Spring 101" Substack - unchained: Cloudflare 403 → canonical Megaphone podcast feed - lynalden: Cloudflare 202 → FeedBurner mirror - glassnode: recovered via httpx http2=True (was 403 on HTTP/1.1) - browser User-Agent + Accept headers on feed fetch - removed dead feeds with no active replacement: placeholder, dragonfly, niccarter, eugene - pin h2==4.3.0 (required by http2=True) All 25 remaining feeds verified fetching real body content; newest post per feed ≤88d. Bundles in-flight KOL-module work already in the working tree (kol_x ingest, migration 027, tests). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+20
-5
@@ -76,14 +76,29 @@ async def get_performance(
|
||||
max_drawdown_pct=0.0,
|
||||
)
|
||||
|
||||
winning = sum(1 for t in trades if (t.pnl_usd or 0) > 0)
|
||||
win_rate = winning / total_trades
|
||||
# Only include trades with a known PnL in financial statistics.
|
||||
# Trades with pnl_usd=NULL were externally closed or unsettled — treating
|
||||
# them as 0 silently inflates trade count and distorts win rate / net PnL.
|
||||
settled = [t for t in trades if t.pnl_usd is not None]
|
||||
if not settled:
|
||||
return BotPerformance(
|
||||
period_days=PERIOD_DAYS,
|
||||
total_trades=total_trades,
|
||||
win_rate=0.0,
|
||||
net_pnl_usd=0.0,
|
||||
avg_hold_seconds=0.0,
|
||||
max_drawdown_pct=0.0,
|
||||
)
|
||||
|
||||
pnl_values = [(t.pnl_usd or 0.0) for t in trades]
|
||||
winning = sum(1 for t in settled if t.pnl_usd > 0) # type: ignore[operator]
|
||||
win_rate = winning / len(settled)
|
||||
|
||||
pnl_values = [t.pnl_usd for t in settled] # type: ignore[misc]
|
||||
net_pnl = sum(pnl_values)
|
||||
|
||||
hold_values = [(t.hold_seconds or 0) for t in trades]
|
||||
avg_hold = sum(hold_values) / len(hold_values)
|
||||
# For hold time use all trades (we always have opened_at + closed_at when closed)
|
||||
hold_values = [t.hold_seconds for t in trades if t.hold_seconds is not None]
|
||||
avg_hold = sum(hold_values) / len(hold_values) if hold_values else 0.0
|
||||
|
||||
# Max drawdown: running peak → trough of cumulative PnL
|
||||
cumulative = 0.0
|
||||
|
||||
Reference in New Issue
Block a user