fix: Macro fetches by source, Analytics single-basis stats, funding venue label

- Macro page fetches getPosts(200, 1, source) per active tab instead of
  filtering the latest-500 global feed — rare bottom/funding signals no longer
  vanish behind Trump posts (backend now supports ?source=).
- Analytics: compute ALL time windows from the one closed_at-filtered trades
  list; dropped the 30d-only backend /performance special-case that mixed an
  opened_at basis into the same screen as the closed_at metric grid. Trade
  fetch raised 100→500 so the local computation covers ample history.
- Funding panel shows snap.venue (capitalized) instead of hardcoded "Binance".
- lib/api: getPosts gains optional source param; FundingSnapshot gains venue.

tsc + next build clean.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
k
2026-05-29 15:15:41 +08:00
parent 3ac1431336
commit a8522a2bf8
3 changed files with 39 additions and 27 deletions
+4 -2
View File
@@ -29,8 +29,9 @@ async function fetchJson<T>(path: string, init?: RequestInit): Promise<T> {
return res.json() as Promise<T>
}
export async function getPosts(limit = 20, page = 1): Promise<TrumpPost[]> {
return fetchJson<TrumpPost[]>(`/posts?limit=${limit}&page=${page}`)
export async function getPosts(limit = 20, page = 1, source?: string): Promise<TrumpPost[]> {
const q = `/posts?limit=${limit}&page=${page}` + (source ? `&source=${encodeURIComponent(source)}` : '')
return fetchJson<TrumpPost[]>(q)
}
export async function getPost(id: number): Promise<TrumpPost> {
@@ -459,6 +460,7 @@ export interface FundingSnapshot {
ok: boolean
error?: string
asset?: string
venue?: string
cadence_hours?: number
coverage_days?: number
latest_rate_pct?: number