23 lines
914 B
Python
23 lines
914 B
Python
import sys
|
|
sys.path.insert(0, '/home/hmo/.hermes/profiles/position-analyst/scripts')
|
|
import price_monitor as pm
|
|
pm.record_event('TEST99', '测试股', 'entry_zone', 12.34, '12.0~12.5', '加仓区间')
|
|
print('record_event OK')
|
|
|
|
import sqlite3
|
|
c = sqlite3.connect('/home/hmo/MoFin/data/mofin.db')
|
|
r = c.execute("SELECT code,name,event_type,price,created_at FROM price_events WHERE code='TEST99' ORDER BY id DESC LIMIT 1").fetchone()
|
|
print('DB row:', r)
|
|
c.execute("DELETE FROM price_events WHERE code='TEST99'")
|
|
c.commit()
|
|
print('cleaned')
|
|
|
|
# also check JSON got it
|
|
import json
|
|
d = json.load(open('/home/hmo/web-dashboard/data/price_events.json'))
|
|
last = d['events'][-1]
|
|
print('JSON last:', last['code'], last['price'])
|
|
if last['code'] == 'TEST99':
|
|
d['events'] = d['events'][:-1]
|
|
json.dump(d, open('/home/hmo/web-dashboard/data/price_events.json', 'w'), ensure_ascii=False, indent=2)
|
|
print('JSON cleaned') |