feat(evolver): api.js에 evolver + lotto activity fetch helpers (6개)
This commit is contained in:
42
src/api.js
42
src/api.js
@@ -681,3 +681,45 @@ export const refreshScreenerSnap = () => apiPost('/api/stock/screener
|
|||||||
export const listScreenerRuns = (limit = 30) => apiGet (`/api/stock/screener/runs?limit=${limit}`);
|
export const listScreenerRuns = (limit = 30) => apiGet (`/api/stock/screener/runs?limit=${limit}`);
|
||||||
export const getScreenerRun = (id) => apiGet (`/api/stock/screener/runs/${id}`);
|
export const getScreenerRun = (id) => apiGet (`/api/stock/screener/runs/${id}`);
|
||||||
|
|
||||||
|
// --- Lotto Weight Evolver ---
|
||||||
|
|
||||||
|
export async function fetchEvolverStatus() {
|
||||||
|
const r = await fetch('/api/lotto/evolver/status');
|
||||||
|
if (!r.ok) throw new Error(`evolver/status ${r.status}`);
|
||||||
|
return r.json();
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function fetchEvolverHistory(weeks = 12) {
|
||||||
|
const r = await fetch(`/api/lotto/evolver/history?weeks=${weeks}`);
|
||||||
|
if (!r.ok) throw new Error(`evolver/history ${r.status}`);
|
||||||
|
return r.json();
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function fetchLottoTasks({ days = 7, taskType = null } = {}) {
|
||||||
|
const params = new URLSearchParams({ days: String(days), limit: '100' });
|
||||||
|
if (taskType) params.set('task_type', taskType);
|
||||||
|
const r = await fetch(`/api/agent-office/agents/lotto/tasks?${params}`);
|
||||||
|
if (!r.ok) throw new Error(`agent-office tasks ${r.status}`);
|
||||||
|
return r.json();
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function fetchLottoLogs({ days = 7 } = {}) {
|
||||||
|
const r = await fetch(`/api/agent-office/agents/lotto/logs?limit=200`);
|
||||||
|
if (!r.ok) throw new Error(`agent-office logs ${r.status}`);
|
||||||
|
const data = await r.json();
|
||||||
|
if (!days) return data;
|
||||||
|
const cutoff = new Date(Date.now() - days * 24 * 3600 * 1000).toISOString();
|
||||||
|
return { items: (data.items || data.logs || []).filter(l => (l.created_at || '') >= cutoff) };
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function triggerEvolverGenerate() {
|
||||||
|
const r = await fetch('/api/lotto/evolver/generate-now', { method: 'POST' });
|
||||||
|
if (!r.ok) throw new Error(`generate-now ${r.status}`);
|
||||||
|
return r.json();
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function triggerEvolverEvaluate() {
|
||||||
|
const r = await fetch('/api/lotto/evolver/evaluate-now', { method: 'POST' });
|
||||||
|
if (!r.ok) throw new Error(`evaluate-now ${r.status}`);
|
||||||
|
return r.json();
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user