19 lines
741 B
Python
19 lines
741 B
Python
import sqlite3, json
|
|
# price_events in web-dashboard db
|
|
c = sqlite3.connect('/home/hmo/web-dashboard/data/mofin.db')
|
|
try:
|
|
r = c.execute("SELECT MAX(created_at), COUNT(*) FROM price_events").fetchone()
|
|
print('web-dashboard mofin.db price_events:', r)
|
|
except Exception as e:
|
|
print('web-dashboard db err:', e)
|
|
c.close()
|
|
|
|
# price_events.json tail
|
|
try:
|
|
d = json.load(open('/home/hmo/web-dashboard/data/price_events.json'))
|
|
print('price_events.json type:', type(d).__name__, 'len:', len(d) if hasattr(d, '__len__') else '?')
|
|
items = d if isinstance(d, list) else d.get('events', [])
|
|
if items:
|
|
print('last event:', json.dumps(items[-1], ensure_ascii=False)[:250])
|
|
except Exception as e:
|
|
print('json err:', e) |