fix: /posts source filter, /performance closed_at basis, funding venue field

- /posts gains an optional ?source= filter. The Macro page was pulling the
  latest-500 posts globally and filtering client-side; rare scanner signals
  (btc_bottom_reversal ~2-4/cycle, funding_reversal hourly) got pushed off the
  page by frequent Trump posts, so Macro falsely showed "no signals".
- /performance now filters and orders by closed_at (realized-PnL-in-window)
  instead of opened_at, so it shares ONE basis with the frontend Analytics
  page (which filters every window by closed_at). Boundary trades no longer
  land in one basis but not the other.
- funding snapshot returns the actual `venue` (provider.name) so the frontend
  label follows the real data source instead of hardcoding "Binance".

72 tests pass.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
k
2026-05-29 15:15:32 +08:00
parent 4c34abcd55
commit 6d50357d11
3 changed files with 24 additions and 5 deletions
@@ -367,6 +367,10 @@ async def get_current_snapshot() -> dict:
return {
"ok": True,
"asset": ASSET,
# Report the ACTUAL funding venue so the frontend label follows the
# data source instead of hardcoding "Binance" (which silently lies if
# for_asset() routes to HL, or ASSET becomes an HL-native perp).
"venue": getattr(for_asset(ASSET), "name", None),
"cadence_hours": round(cadence_h, 2),
"coverage_days": round(span_days, 1),
"latest_rate_pct": round(latest, 5),