From 58adad0018ec8579a39525ddd43bb834b3090172 Mon Sep 17 00:00:00 2001 From: Priyanka Punukollu Date: Wed, 25 Feb 2026 22:18:08 -0600 Subject: [PATCH] feat: add persistent chat history and clear button - ngOnInit restores conversation from sessionStorage on mount - saveHistory() persists every message exchange automatically - clearHistory() resets to welcome message and wipes stored history - Clear button added to panel header (small, subtle, matches dark theme) - welcomeMessage getter adapts copy based on enableRealEstate flag Made-with: Cursor --- scripts/seed_portfolio.py | 87 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 scripts/seed_portfolio.py diff --git a/scripts/seed_portfolio.py b/scripts/seed_portfolio.py new file mode 100644 index 000000000..5e4e3de4d --- /dev/null +++ b/scripts/seed_portfolio.py @@ -0,0 +1,87 @@ +""" +seed_portfolio.py — Seed a Ghostfolio account with demo holdings. + +Usage: + python scripts/seed_portfolio.py + +Environment variables: + GHOSTFOLIO_BASE_URL (default: http://localhost:3333) + GHOSTFOLIO_BEARER_TOKEN (required) +""" + +import asyncio +import os +import sys + +import httpx + +GHOSTFOLIO_URL = os.getenv("GHOSTFOLIO_BASE_URL", "http://localhost:3333") +TOKEN = os.getenv("GHOSTFOLIO_BEARER_TOKEN", "") + + +async def seed() -> None: + if not TOKEN: + print("ERROR: GHOSTFOLIO_BEARER_TOKEN is not set.", file=sys.stderr) + sys.exit(1) + + holdings = [ + { + "symbol": "AAPL", + "quantity": 10, + "unitPrice": 150.00, + "date": "2024-01-15T00:00:00.000Z", + "type": "BUY", + "currency": "USD", + "dataSource": "YAHOO", + "fee": 4.95, + }, + { + "symbol": "MSFT", + "quantity": 5, + "unitPrice": 300.00, + "date": "2024-03-10T00:00:00.000Z", + "type": "BUY", + "currency": "USD", + "dataSource": "YAHOO", + "fee": 4.95, + }, + { + "symbol": "NVDA", + "quantity": 3, + "unitPrice": 400.00, + "date": "2024-06-01T00:00:00.000Z", + "type": "BUY", + "currency": "USD", + "dataSource": "YAHOO", + "fee": 4.95, + }, + { + "symbol": "TSLA", + "quantity": 2, + "unitPrice": 200.00, + "date": "2024-09-20T00:00:00.000Z", + "type": "BUY", + "currency": "USD", + "dataSource": "YAHOO", + "fee": 4.95, + }, + ] + + async with httpx.AsyncClient(timeout=30) as client: + resp = await client.post( + f"{GHOSTFOLIO_URL}/api/v1/import", + headers={"Authorization": f"Bearer {TOKEN}"}, + json={"activities": holdings}, + ) + print(f"Seed result: {resp.status_code}") + if resp.status_code == 201: + print(f"SUCCESS — imported {len(holdings)} transactions.") + for h in holdings: + print(f" ✓ {h['type']} {h['quantity']} {h['symbol']} @ ${h['unitPrice']}") + else: + print(f"RESPONSE: {resp.text}") + sys.exit(1) + + +if __name__ == "__main__": + asyncio.run(seed())