- PLAN.md: full implementation plan from issue - config.py: configurable thresholds, API keys via .env - ingestion/: EDGAR RSS poller + Form 4 XML parser - db/: SQLite schema + interface (WAL mode) - signals/: filter engine (buy/10b5-1/value/role) + cluster detector - alerts/: Slack webhook alert with score gating - broker/: Alpaca paper/live trade execution - backtest/: historical signal backtesting with yfinance - main.py: CLI entrypoint (run | fetch-once | backtest)
35 lines
997 B
SQL
35 lines
997 B
SQL
CREATE TABLE IF NOT EXISTS filings (
|
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
accession_number TEXT UNIQUE,
|
|
ticker TEXT,
|
|
cik TEXT,
|
|
insider_name TEXT,
|
|
role TEXT,
|
|
transaction_date TEXT,
|
|
filed_date TEXT,
|
|
shares REAL,
|
|
price REAL,
|
|
total_value REAL,
|
|
flag TEXT,
|
|
is_10b51 INTEGER DEFAULT 0,
|
|
post_tx_shares REAL,
|
|
created_at TEXT DEFAULT (datetime('now'))
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS signals (
|
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
ticker TEXT,
|
|
trigger_date TEXT,
|
|
cluster_size INTEGER,
|
|
total_cluster_value REAL,
|
|
score REAL,
|
|
alerted INTEGER DEFAULT 0,
|
|
executed INTEGER DEFAULT 0,
|
|
created_at TEXT DEFAULT (datetime('now'))
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_filings_ticker ON filings(ticker);
|
|
CREATE INDEX IF NOT EXISTS idx_filings_transaction_date ON filings(transaction_date);
|
|
CREATE INDEX IF NOT EXISTS idx_signals_ticker ON signals(ticker);
|
|
CREATE INDEX IF NOT EXISTS idx_signals_alerted ON signals(alerted);
|