fix: address sanity-check issues + rebrand to Smaug

Co-authored-by: dodox <dodox@users.noreply.local>
This commit is contained in:
2026-05-04 16:32:00 +00:00
co-authored by dodox
parent 8c0085e503
commit 2e2be3e9c7
7 changed files with 167 additions and 103 deletions
+25 -2
View File
@@ -76,13 +76,25 @@ def mark_signal_alerted(signal_id: int):
def mark_signal_executed(signal_id: int):
conn = get_connection()
try:
conn.execute("UPDATE signals SET executed=1 WHERE id=?", (signal_id,))
conn.execute(
"UPDATE signals SET executed=1, executed_at=? WHERE id=?",
(datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%SZ"), signal_id),
)
conn.commit()
finally:
conn.close()
def get_unalerted_signals():
def mark_signal_closed(signal_id: int):
conn = get_connection()
try:
conn.execute("UPDATE signals SET closed=1 WHERE id=?", (signal_id,))
conn.commit()
finally:
conn.close()
def get_unalerted_signals() -> list[dict]:
conn = get_connection()
try:
rows = conn.execute(
@@ -93,6 +105,17 @@ def get_unalerted_signals():
conn.close()
def get_executed_unclosed_signals() -> list[dict]:
conn = get_connection()
try:
rows = conn.execute(
"SELECT * FROM signals WHERE executed=1 AND closed=0 AND executed_at IS NOT NULL"
).fetchall()
return [dict(r) for r in rows]
finally:
conn.close()
def get_recent_buys_for_ticker(ticker: str, window_days: int) -> list:
conn = get_connection()
try:
+3
View File
@@ -25,6 +25,8 @@ CREATE TABLE IF NOT EXISTS signals (
score REAL,
alerted INTEGER DEFAULT 0,
executed INTEGER DEFAULT 0,
executed_at TEXT,
closed INTEGER DEFAULT 0,
created_at TEXT DEFAULT (datetime('now'))
);
@@ -32,3 +34,4 @@ 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);
CREATE INDEX IF NOT EXISTS idx_signals_executed ON signals(executed);