16 lines
631 B
Python
16 lines
631 B
Python
import sqlite3
|
|
db = sqlite3.connect('/home/hmo/web-dashboard/data/mofin.db')
|
|
|
|
# Check when portfolio was last updated
|
|
r = db.execute("SELECT updated_at, total_assets, total_mv, cash FROM portfolio_summary WHERE id=1").fetchone()
|
|
print(f"Portfolio last updated: {r[0]}")
|
|
print(f"total_assets={r[1]} total_mv={r[2]} cash={r[3]}")
|
|
|
|
# Check hold prices
|
|
print("\nAll holdings:")
|
|
for r in db.execute("SELECT code, name, price, change_pct, cost, shares FROM holdings WHERE is_active=1 ORDER BY code"):
|
|
mv = (r[2] or 0) * (r[5] or 0)
|
|
print(f" {r[0]} {r[1]}: price={r[2]} chg={r[3]} cost={r[4]} shares={r[5]} mv={mv}")
|
|
|
|
db.close()
|