Files
MoFin/archive/20260722-scripts-cleanup/test_db_only.py
T

16 lines
692 B
Python

import sys, os
sys.path.insert(0, '/home/hmo/.hermes/profiles/position-analyst/scripts')
import price_monitor as pm
pm.record_event('000850', '华茂股份', 'entry_zone', 3.98, '3.91~4.04', '加仓区间')
print('record_event done')
import sqlite3
c = sqlite3.connect('/home/hmo/MoFin/data/mofin.db')
r = c.execute("SELECT code,name,price,created_at FROM price_events WHERE code='000850' ORDER BY id DESC LIMIT 1").fetchone()
print('DB:', r)
c.execute("DELETE FROM price_events WHERE code='000850' AND created_at > '2026-07-20 17:50'")
c.commit()
print('cleaned test row')
# JSON must NOT be recreated
print('JSON exists?', os.path.exists('/home/hmo/web-dashboard/data/price_events.json'))