add Eurostat + UK ONS sources; valuation/bubble/economy/bonds groups; aggregate read; market-open header

Three new data sources hooked into the existing SOURCES registry. All
open APIs, no keys:

  - EUROSTAT: prefix EUROSTAT:dataset?dim=val&... — current EU bond
    yields (Bund/OAT/BTP/EZ) and Eurozone economic indicators that
    FRED's OECD-mirror series stopped updating in 2022-2023.
  - ONS: prefix ONS:topic/cdid/dataset — current UK CPI, unemployment,
    GDP, industrial production. Replaces the 5+ month-stale FRED
    LRHUTTTTGBM156S mirror.

New indicator groups in default.toml feed the strategic/fundamental
lens we converged on: valuation (CAPE/Buffett anchors), bubble_watch
(SKEW/VVIX/RSP vs SPY/HYG vs TLT/IPO/crypto), economy (multi-region,
ALL current-or-stale-flagged), bonds (UK/EU/US/JPN sovereign yields).

Indicator panel now opens with an AI "read" interpretation per group
(generated hourly at :07 UTC alongside an aggregate cross-group read
shown in the dashboard header). The aggregate is grounded by a markets
strip — NYSE/LSE/Frankfurt/Tokyo/HK/Shanghai with open/closed LEDs and
next-open countdown, computed locally from each exchange's tz.

Other UX bits: indicator-row tooltips populated from TOML notes;
rows whose last observation is >90 days old get a 'stale' chip;
ghost symbols (in DB but no longer in TOML) filtered out of the
panel; Eurostat/ONS symbols display as short codes rather than the
full API path.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Giorgio Gilestro 2026-05-15 23:07:42 +01:00
parent a10409c02b
commit 1edf9cad41
15 changed files with 1156 additions and 10 deletions

View file

@ -0,0 +1,43 @@
"""indicator_summaries — short AI-generated read per indicator group
Revision ID: 0004
Revises: 0003
Create Date: 2026-05-15
"""
from typing import Sequence, Union
import sqlalchemy as sa
from alembic import op
revision: str = "0004"
down_revision: Union[str, None] = "0003"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
op.create_table(
"indicator_summaries",
sa.Column("id", sa.BigInteger, primary_key=True, autoincrement=True),
sa.Column("group_name", sa.String(64), nullable=False),
sa.Column("generated_at", sa.DateTime(timezone=True), nullable=False),
sa.Column("model", sa.String(64), nullable=False),
sa.Column("tone", sa.String(16)),
sa.Column("analysis", sa.String(16)),
sa.Column("prompt_version", sa.Integer, nullable=False, server_default=sa.text("1")),
sa.Column("content", sa.Text, nullable=False),
sa.Column("prompt_tokens", sa.Integer),
sa.Column("completion_tokens", sa.Integer),
sa.Column("cost_usd", sa.Float),
)
op.create_index(
"ix_indsumm_group_generated",
"indicator_summaries",
["group_name", "generated_at"],
)
def downgrade() -> None:
op.drop_index("ix_indsumm_group_generated", table_name="indicator_summaries")
op.drop_table("indicator_summaries")

View file

@ -0,0 +1,34 @@
"""widen quotes.symbol to 128 chars to fit Eurostat / ONS path identifiers
Revision ID: 0005
Revises: 0004
Create Date: 2026-05-15
"""
from typing import Sequence, Union
import sqlalchemy as sa
from alembic import op
revision: str = "0005"
down_revision: Union[str, None] = "0004"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
op.alter_column(
"quotes", "symbol",
existing_type=sa.String(64),
type_=sa.String(128),
existing_nullable=False,
)
def downgrade() -> None:
op.alter_column(
"quotes", "symbol",
existing_type=sa.String(128),
type_=sa.String(64),
existing_nullable=False,
)