← Index · Redmine Daten_Suche_Backups_&_Integrationen Daten Suche Backups & Integrationen
Projekt-Datenbankschema (PostgreSQL, Schema: core)
Allgemein
Datenbank: mf_app
Schema: core
Standardsuchpfad: core, public
Tabellen
1) securities
Zweck: Stammdaten je Wertpapier
Spalten: isin (PK), name, country, sector, industry, currency, activeflag (bool, default true), added at (timestamptz)
Schlüssel: PK (isin)
2) listings
Zweck: Zuordnung ISIN ↔ Börsenlisting
Spalten: isin (FK → securities.isin, ON DELETE CASCADE), mic, ticker, primaryflag (bool), source, valid from (date), valid_to (date)
Schlüssel: PK (isin, mic)
Indizes: UX uxlistings primaryone (isin) WHERE primary flag
3) fx_rates
Zweck: Wechselkurse für EUR‑Umrechnung
Spalten: date, base (default 'EUR'), quote, rate, source, fetched_at (timestamptz)
Schlüssel: PK (date, base, quote)
4) prices_daily
Zweck: Tageskurse und Indikatoren je Listing
Spalten: isin (FK), date, mic, closelocal, close eur, adjclose eur, volume, sma200, high52w, high 3d, drawdown, source
Schlüssel: PK (isin, date, mic)
Indizes: idxprices dailyisin date (isin, date)
5) corporate_actions
Zweck: Splits/Dividenden für Adjustierungen
Spalten: isin (FK), date, type ('split'|'dividend'), ratio, amount, currency, note, source
Schlüssel: PK (isin, date, type)
6) liquidity
Zweck: Liquiditätskennzahlen (Ø‑Umsatz/Volumen)
Spalten: isin (FK), windowdays (30|90), avg turnoverlocal, avg turnovereur, avg volume, last_updated (timestamptz)
Schlüssel: PK (isin, window_days)
7) fundamentals
Zweck: Fundamentaldaten für Magic‑Formula
Spalten: isin (FK), periodend (date), period type ('TTM'|'Annual'|'Quarterly'), ebit, totaldebt, cash, nwc, ppe, total assets, currentliab, shares out, source, confidence ('high'|'med'|'low'), last_updated (timestamptz)
Schlüssel: PK (isin, periodend, period type)
8) mf_rank
Zweck: Magic‑Formula‑Ranking je Region/Monat
Spalten: region, runmonth (date), isin (FK), earn yield, capreturn, rank ey, rankcr, rank sum, percentile, confidence ('high'|'med'|'low')
Schlüssel: PK (region, run_month, isin)
Indizes: idxmf rankregion monthpct (region, run month, percentile)
9) signals
Zweck: Täglicher Signalstatus mit Regelaufschlüsselung
Spalten: isin (FK), asofdate (date), status ('yes'|'no'), rule breakdown (jsonb), reason (text), cooldownuntil (date), last flip_at (date)
Schlüssel: PK (isin, asof_date)
10) alerts_log
Zweck: Protokoll der verschickten Alerts
Spalten: alertid (bigserial, PK), isin (FK), timestamp (timestamptz, default now), prev status ('yes'|'no'), newstatus ('yes'|'no'), channel, delivered, message id
11) market_state
Zweck: Fear-&-Greed‑Wert/Quelle pro Tag
Spalten: date (PK), feargreed value, delta5d, source, components (jsonb), fetched at (timestamptz)
12) news_cache
Zweck: Cache von Schlagzeilen je ISIN (für manuelle KI-Auswertung)
Spalten: id (bigserial, PK), isin (FK), fetched_at (timestamptz), headline, url, source, sentiment
13) ai_evaluations
Zweck: Manuelle KI‑Bewertungen mit Begründung
Spalten: evalid (bigserial, PK), isin (FK), timestamp (timestamptz), inputs ref (jsonb), recommendation ('yes'|'no'|'hold'), rationale (text), model_version
14) config
Zweck: Konfiguration/Parameter
Spalten: key (PK), value, scope (default 'global'), updated_at (timestamptz)
15) job_runs
Zweck: Monitoring der n8n‑Jobläufe
Spalten: jobname, started at (timestamptz, default now), finishedat (timestamptz), status ('ok'|'fail'|'partial'), rows affected, error_message
Schlüssel: PK (jobname, started at)
16) data_quality
Zweck: Tracking von Datenqualitäts‑Issues
Spalten: entity, refkey, issue type, severity ('low'|'med'|'high'), note, detectedat (timestamptz, default now), resolved at (timestamptz)
Schlüssel: PK (entity, refkey, detected at)
Hinweise
Alle FK auf securities haben ON DELETE CASCADE.
Preise/Indikatoren werden täglich aktualisiert (EU 18:30, US 23:30 Europe/Berlin).
MF‑Ranking monatlich (5. US‑Handelstag).
Fear & Greed: Original mit Proxy‑Fallback (Quelle im Feld source markiert).
Confidence‑Flags in fundamentals/mf_rank kennzeichnen Datenqualität (US=high, EU je nach Quelle).
Daten Suche Backups & Integrationen
Seitenregeln
Single Source of Truth für Persistenz (DB/Storage/Indices), Datenflüsse nach außen (APIs/Webhooks) und Sicherung/Wiederherstellung.
Technische Verträge/Endpunkte dokumentieren; keine Policy‑Texte (z. B. DSGVO → „Sicherheit & Compliance“).
Backups/Restore praxisnah dokumentieren und regelmäßig verproben; Tests hier protokollieren.
Keine Geheimniswerte; nur Referenzen/Orte.
Aktualisieren bei: Schema‑Änderungen (high level), neue/angepasste APIs/Webhooks, Backup‑Plan‑Anpassungen.
Verweise auf: „Betrieb, Observability & Notfälle“ (Restore‑Runbooks), „Sicherheit & Compliance“ (Datenklassen/Retention‑Policy).
Benenne betroffene Dateien inkl. Pfad als Unterpunkte, wenn für zukünftige Änderungen relevant.
Zweck und Abgrenzung
Zweck: Dokumentation aller Datenhaltungen (DB/Volumes), externen Datenquellen (APIs), Import-/Exportpfade sowie Backup/Restore‑Vorgehen für „n8n aktien“.
Abgrenzung: Keine Sicherheits‑/Compliance‑Regeln (eigene Seite). Keine ToDo‑Listen (eigene Seite).
Primärdatenbanken (Typ/Version, Schemata high level)
PostgreSQL 16 (Container: n8n-n8n-postgres-1; Image: postgres:16-alpine)
Datenbank: mfapp (Owner: mf app; Encoding: UTF8)
Schema: core (Standard search_path: core, public)
Haupttabellen (Auszug; vollständig auf „Architektur & Entscheidungen“):
core.securities, core.listings, core.fxrates, core.prices daily, core.corporateactions
core.liquidity, core.fundamentals, core.mfrank, core.signals, core.alerts log
core.marketstate, core.news cache, core.aievaluations, core.config
core.jobruns, core.data quality
Indizes:
idxprices dailyisin date (pricesdaily: isin, date)
idxmf rankregion monthpct (mf rank: region, runmonth, percentile)
uxlistings primaryone (unique WHERE primary flag)
Datei‑/Objektspeicher/Volumes
PostgreSQL-Volume: n8nn8n pg_data
Mount im Container: /var/lib/postgresql/data
Host-Pfad (Docker-managed): /var/lib/docker/volumes/n8nn8n pgdata/ data
n8n (Flows/Credentials): im n8n‑Container (Standard n8n‑Persistenz gemäß Deployment)
Suche/Indexe
Postgres als einzige Such-/Abfrage‑Schicht (kein externer Suchindex).
Performance‑relevante Indizes siehe oben (pricesdaily, mf rank, listings).
Importe (laufend, automatisiert via n8n):
Kurse (Stooq): CSV (HTTP GET, s={TICKER}.de, i=d) → Parsing in Zeilen → Upsert core.pricesdaily.
Kurse (Alpha Vantage, Fallback): JSON (function=TIMESERIES DAILY, datatype=json, outputsize=compact) → Parsing → Upsert core.pricesdaily.
Marktproxy (VIX via Stooq): CSV (s=vi.c) → Parsing → Mapping zu Fear-&-Greed‑Proxy → Upsert core.marketstate.
Listing‑Mapping (OpenFIGI): JSON (POST /v3/mapping; idType=IDISIN, idValue, micCode=XETR) → Set → Upsert core.securities/core.listings.
Eingabe (manuell):
ISIN via n8n‑Form („Form: Add ISIN“) → Workflow „mf_workflow - Add Security (ISIN → Listing → Prices)“.
Exporte:
Aktuell keine periodischen Exporte konfiguriert (Abfragen erfolgen direkt gegen Postgres; Dashboards lesen live).
Backups (Was/Wann/Womit, Aufbewahrung)
PostgreSQL:
Aktueller Stand: keine automatisierten Backups konfiguriert (Fakt).
Empfohlener Ist‑Pfad (manuell bereits verprobt möglich):
Logischer Dump: pgdump -Fc -d mf app → Artefakt: ./backups/mfapp YYYYMMDD.dump
Volume‑Snapshot (Docker/Host): Snapshot des Volumes n8nn8n pg_data
Aufbewahrung: noch nicht formal festgelegt (siehe ToDo‑Seite für Planung).
n8n:
Workflow‑Exports: manuell via UI (JSON‑Export je Workflow), noch keine Automatisierung.
Restore‑Prozeduren und Testprotokoll
PostgreSQL:
Restore (logischer Dump): createdb mfapp restore → pgrestore -d mf apprestore ./backups/mf app_YYYYMMDD.dump
Aktueller Teststatus: kein Restore‑Test ausgeführt (Fakt).
n8n:
Workflow‑Import via UI (JSON), kein Testlauf dokumentiert (Fakt).
APIs und Webhooks (Auth, Limits, Versionierung)
OpenFIGI
Endpoint: https://api.openfigi.com/v3/mapping (POST)
Auth: Header Auth (X-OPENFIGI-APIKEY; Credential „openfigi_api“; Allowed Domain: api.openfigi.com)
Format: JSON; Body ist Array (idType, idValue, optional micCode)
Nutzung: Primärlisting/Ticker‑Mapping (XETR bevorzugt)
Alpha Vantage
Endpoint: https://www.alphavantage.co/query (GET)
Auth: Query Auth (apikey=…; Credential „alpha_vantage“; Allowed Domains: www.alphavantage.co)
Nutzung: TIMESERIES DAILY (datatype=json, compact) als Fallback für Kurse
Limits: Free‑Tier Rate‑Limits (Fehlermeldungen berücksichtigt)
Stooq
Endpoint: https://stooq.com/q/d/l/ (GET)
Auth: keine
Nutzung: Daily‑Kurse (CSV), VIX‑Proxy (Symbol vi.c)
Webex
Status: noch nicht angebunden (Bot noch nicht erstellt)
SimFin, Financial Modeling Prep (FMP)
Credentials vorhanden (Query Auth); derzeit noch nicht in Workflows eingebunden (Fakt).
Integrationen zu Drittsystemen (Verträge/Kompatibilität)
n8n (Community Edition)
Workflows produktiv:
„mfworkflow - Add Security (ISIN → Listing → Prices)“
Knoten (Auszug, in Reihenfolge): Form: Add ISIN → OpenFIGI: ISIN → XETR mapping → Set: ISIN+Name+Ticker+MIC → PG: Upsert security → PG: Upsert listing (XETR) → AlphaVantage: Daily (compact, JSON) → Code: Parse AV JSON → rows → PG: Upsert prices (AV, last 100) → Stooq: Daily CSV (full) → Code: Parse Stooq CSV → rows → PG: Upsert prices (Stooq, full) → PG: Update indicators (SMA200/52W/3D) → PG: Compute signal (price-only test) → PG: Inspect last signal (Utility)
„Market State Update“
Knoten: VIX Fetch (Stooq vi.c) → VIX Parse (Proxy‑Berechnung) → Market State Upsert (Postgres)
Credentials (ausgewählte): openfigiapi (Header Auth), alpha vantage (Query Auth), simfin (Query Auth), fmp (Query Auth), Postgres (mfapp)
Metabase
Status: noch nicht installiert/angebunden (Fakt).