26 lines
1.1 KiB
SQL
26 lines
1.1 KiB
SQL
CREATE TABLE IF NOT EXISTS short_tf_signal_samples (
|
|
id BIGSERIAL PRIMARY KEY,
|
|
signal_time TEXT NOT NULL,
|
|
symbol TEXT NOT NULL,
|
|
timeframe TEXT NOT NULL,
|
|
signal_code TEXT NOT NULL,
|
|
signal_label TEXT NOT NULL,
|
|
entry_price DOUBLE PRECISION NOT NULL,
|
|
volume_24h DOUBLE PRECISION DEFAULT 0,
|
|
change_24h DOUBLE PRECISION DEFAULT 0,
|
|
gain_pct DOUBLE PRECISION DEFAULT 0,
|
|
vol_ratio DOUBLE PRECISION DEFAULT 0,
|
|
body_ratio DOUBLE PRECISION DEFAULT 0,
|
|
age_bars INTEGER DEFAULT 0,
|
|
resonance INTEGER NOT NULL DEFAULT 0,
|
|
context_json TEXT DEFAULT '{}',
|
|
review_status TEXT NOT NULL DEFAULT 'pending',
|
|
created_at TEXT NOT NULL
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_short_tf_samples_time ON short_tf_signal_samples(signal_time DESC);
|
|
CREATE INDEX IF NOT EXISTS idx_short_tf_samples_symbol_time ON short_tf_signal_samples(symbol, signal_time DESC);
|
|
CREATE INDEX IF NOT EXISTS idx_short_tf_samples_code_time ON short_tf_signal_samples(signal_code, signal_time DESC);
|
|
CREATE UNIQUE INDEX IF NOT EXISTS idx_short_tf_samples_dedupe
|
|
ON short_tf_signal_samples(symbol, timeframe, signal_code, signal_time);
|