import { useEffect, useState } from 'react'; import type { ScheduleConfig } from '../../lib/types'; import { useScheduleSettings, useUpdateScheduleSettings } from '../../hooks/useAdmin'; import { SkeletonTable } from '../ui/Skeleton'; const DEFAULTS: ScheduleConfig = { schedule_timezone: 'Europe/Berlin', schedule_daily_pipeline_cron: '0 7 * * *', schedule_intraday_pipeline_cron: '0 14-22 * * 1-5', schedule_fundamentals_cron: '0 4 * * 1', }; const FIELDS: { key: keyof ScheduleConfig; label: string; hint: string; mono?: boolean }[] = [ { key: 'schedule_timezone', label: 'Timezone', hint: 'IANA name, e.g. Europe/Berlin. All times below are in this zone.', }, { key: 'schedule_daily_pipeline_cron', label: 'Daily pipeline (full)', hint: 'OHLCV → sentiment → R:R scan → outcomes → regime. Default 07:00 so data is ready by 8.', mono: true, }, { key: 'schedule_intraday_pipeline_cron', label: 'Intraday pipeline (light)', hint: 'Refresh prices + resolve outcomes. Default hourly across the US session, weekdays.', mono: true, }, { key: 'schedule_fundamentals_cron', label: 'Fundamentals (weekly)', hint: 'Slow, rate-limited. Default early Monday so it finishes well before the day starts.', mono: true, }, ]; export function ScheduleSettings() { const { data, isLoading, isError, error } = useScheduleSettings(); const update = useUpdateScheduleSettings(); const [form, setForm] = useState(DEFAULTS); useEffect(() => { if (data) setForm(data); }, [data]); if (isLoading) return ; if (isError) return

{(error as Error)?.message || 'Failed to load schedule'}

; return (

Pipeline Schedule

When the jobs run, as 5-field cron (min hour day month weekday). Saved changes apply to the running scheduler immediately — no redeploy. The big nightly run does the full refresh; the light intraday run just keeps prices current.

{FIELDS.map((f) => ( ))}
); }