phase-7: code restructure

This commit is contained in:
Sai Kiran Vella
2026-06-05 22:05:55 -04:00
committed by saikiranvella
parent c160e65bd6
commit 357b0c0f6e
108 changed files with 8931 additions and 3434 deletions
+32
View File
@@ -0,0 +1,32 @@
import type { ScreenerResult } from '$lib/types.js';
import type { LLMAnalysis, CatalystStory } from '$lib/types.js';
const BASE = '/api';
export async function screenTickers(tickers: string[]): Promise<ScreenerResult> {
const res = await fetch(`${BASE}/screen`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ tickers }),
});
if (!res.ok) throw new Error(await res.text());
return res.json();
}
export async function fetchCatalysts(): Promise<{ tickers: string[]; stories: CatalystStory[] }> {
const res = await fetch(`${BASE}/screen/catalysts`);
if (!res.ok) throw new Error(await res.text());
return res.json();
}
export async function analyzeTickers(
tickers: string[],
): Promise<{ analysis: LLMAnalysis | null; reason?: string | null }> {
const res = await fetch(`${BASE}/analyze`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ tickers }),
});
if (!res.ok) throw new Error(await res.text());
return res.json();
}