feat: add postgres market time series schema
Validators (Pushes and Pull Requests) / validate-ui-and-storage (push) Failing after 15s
Validators (Pushes and Pull Requests) / validate-core (push) Failing after 55s

This commit is contained in:
2026-07-12 12:11:18 +09:00
parent daec1a0e1b
commit d833d386d0
3 changed files with 68 additions and 2 deletions
+30
View File
@@ -385,6 +385,36 @@ Table engine_history.market_vs_engine_gap_history {
// Schema: engine_history (V5 normalized learning history)
// =============================================================================
Table quantengine.price_history_daily {
ticker TEXT [not null]
trade_date DATE [not null]
open NUMERIC [not null]
high NUMERIC [not null]
low NUMERIC [not null]
close NUMERIC [not null]
volume BIGINT [not null]
source TEXT [not null]
collected_at TIMESTAMPTZ [not null, default: "NOW()"]
provenance JSONB [not null, default: "'{}'::jsonb"]
indexes {
(ticker, trade_date) [pk]
}
}
Table quantengine.macro_history_daily {
symbol TEXT [not null]
trade_date DATE [not null]
value NUMERIC [not null]
source TEXT [not null]
collected_at TIMESTAMPTZ [not null, default: "NOW()"]
provenance JSONB [not null, default: "'{}'::jsonb"]
indexes {
(symbol, trade_date) [pk]
}
}
Table engine_history.source_observation {
observation_id UUID [pk]
observed_at TIMESTAMPTZ [not null]
+2 -2
View File
@@ -375,11 +375,11 @@ tasks:
# M2 — 히스토리 시계열 저장소
# ---------------------------------------------------------------------------
QE-M2-01:
title: "V4 마이그레이션: price_history_daily + macro_history_daily"
title: "V6 마이그레이션: price_history_daily + macro_history_daily"
status: PENDING
depends_on: [QE-M1-01]
owner_files:
- src/dotnet/QuantEngine.Infrastructure/Migrations/V4__Add_Price_History.sql
- src/dotnet/QuantEngine.Infrastructure/Migrations/V6__Add_Market_Time_Series.sql
notes: >
price_history_daily(ticker, trade_date, open/high/low/close numeric, volume bigint,
source text, collected_at timestamptz, PK(ticker, trade_date));
@@ -0,0 +1,36 @@
-- V6__Add_Market_Time_Series.sql
-- Canonical PostgreSQL daily series for point-in-time factor calculations.
CREATE SCHEMA IF NOT EXISTS quantengine;
CREATE TABLE IF NOT EXISTS quantengine.price_history_daily (
ticker TEXT NOT NULL,
trade_date DATE NOT NULL,
open NUMERIC NOT NULL,
high NUMERIC NOT NULL,
low NUMERIC NOT NULL,
close NUMERIC NOT NULL,
volume BIGINT NOT NULL,
source TEXT NOT NULL,
collected_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
provenance JSONB NOT NULL DEFAULT '{}'::jsonb,
PRIMARY KEY (ticker, trade_date),
CONSTRAINT price_history_daily_ohlc_order CHECK (high >= low AND high >= open AND high >= close AND low <= open AND low <= close),
CONSTRAINT price_history_daily_volume_nonnegative CHECK (volume >= 0)
);
CREATE INDEX IF NOT EXISTS idx_price_history_daily_date
ON quantengine.price_history_daily (trade_date DESC, ticker);
CREATE TABLE IF NOT EXISTS quantengine.macro_history_daily (
symbol TEXT NOT NULL,
trade_date DATE NOT NULL,
value NUMERIC NOT NULL,
source TEXT NOT NULL,
collected_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
provenance JSONB NOT NULL DEFAULT '{}'::jsonb,
PRIMARY KEY (symbol, trade_date)
);
CREATE INDEX IF NOT EXISTS idx_macro_history_daily_date
ON quantengine.macro_history_daily (trade_date DESC, symbol);