[verified] add event-study readiness gate
This commit is contained in:
@@ -5,6 +5,7 @@ const summary = ref(null)
|
||||
const observations = ref(null)
|
||||
const signalData = ref(null)
|
||||
const ledger = ref({ entries: [] })
|
||||
const backtest = ref(null)
|
||||
const loading = ref(true)
|
||||
const error = ref('')
|
||||
const notice = ref('')
|
||||
@@ -47,22 +48,33 @@ async function fetchJson(url, options) {
|
||||
return response.json()
|
||||
}
|
||||
|
||||
async function fetchBacktestReadiness() {
|
||||
const response = await fetch('/api/v1/backtest/tourism?min_events=12')
|
||||
const body = await response.json().catch(() => ({}))
|
||||
if (![200, 409].includes(response.status)) {
|
||||
throw new Error(body.error || `Request failed: ${response.status}`)
|
||||
}
|
||||
return body
|
||||
}
|
||||
|
||||
async function loadDashboard() {
|
||||
loading.value = true
|
||||
error.value = ''
|
||||
try {
|
||||
const [summaryBody, observationBody, signalBody, ledgerBody, sessionBody] = await Promise.all([
|
||||
const [summaryBody, observationBody, signalBody, ledgerBody, sessionBody, backtestBody] = await Promise.all([
|
||||
fetchJson('/api/v1/dashboard/summary'),
|
||||
fetchJson('/api/v1/factors/tourism/observations'),
|
||||
fetchJson('/api/v1/signals'),
|
||||
fetchJson('/api/v1/paper/ledger'),
|
||||
fetchJson('/api/v1/auth/paper', { credentials: 'include' }),
|
||||
fetchBacktestReadiness(),
|
||||
])
|
||||
summary.value = summaryBody
|
||||
observations.value = observationBody
|
||||
signalData.value = signalBody
|
||||
ledger.value = ledgerBody
|
||||
paperAuthenticated.value = Boolean(sessionBody.authenticated)
|
||||
backtest.value = backtestBody
|
||||
} catch (caught) {
|
||||
error.value = caught.message
|
||||
} finally {
|
||||
@@ -205,6 +217,11 @@ onMounted(loadDashboard)
|
||||
<div class="kpi-value quality-value">{{ summary.data_health.status }}</div>
|
||||
<div class="kpi-foot">Vintage {{ summary.data_health.vintage_id }}</div>
|
||||
</article>
|
||||
<article class="kpi-card">
|
||||
<div class="kpi-label">Backtest gate</div>
|
||||
<div class="kpi-value quality-value">{{ backtest?.status || '—' }}</div>
|
||||
<div class="kpi-foot">{{ backtest?.available_events || 0 }} / {{ backtest?.required_events || 0 }} vintages</div>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
<section class="hero-grid" id="factors">
|
||||
|
||||
Reference in New Issue
Block a user