Track Any Stock Portfolio With a Raspberry Pi No Paid APIs, Just Telegram
Track Any Stock Portfolio
With a Raspberry Pi
No Paid APIs, Just Telegram
A step-by-step guide to setting up OpenClaw on a Raspberry Pi 5 to track any stock portfolio — live P&L, dividend-adjusted returns, SMA signals, and twice-daily Telegram updates. Works with NYSE, LSE, TSX, and any Yahoo Finance supported market.
Setting Up Portfolio Tracking
This is Part 3 of the series. You need OpenClaw running on HAOS with tools.profile: full set (covered in Part 2). The portfolio-watcher and memory skills must be installed.
root@openclaw:/# npx clawhub search stock stock-watcher Stock Watcher (3.592) stock-daily-report A่กๆฏๆฅๆฅๅ (3.490) # Chinese market only — skip portfolio-watcher Portfolio Watcher (3.575)
Two skills appear viable. stock-daily-report and stock-watcher are Chinese market focused. portfolio-watcher is the right choice — it's prompt-based and uses Claw's own web tools to fetch prices, which means it works with any Yahoo Finance symbol — US stocks, European equities, Asian markets, ETFs, and more.
root@openclaw:/# npx clawhub --workdir /config/clawd install portfolio-watcher ✔ OK. Installed portfolio-watcher -> /config/clawd/skills/portfolio-watcher
Restart the add-on from HA → Apps → OpenClaw → Restart before proceeding.
Before saving your full portfolio, do a quick test with two of your stocks. Send Claw on Telegram:
What's the current price of AAPL (Apple) and SHEL (Shell)?
| AAPL — Apple Inc. | $189.50 |
| SHEL — Shell PLC | $31.20 |
✅ Yahoo Finance symbols work perfectly — any market, any exchange, any currency.
Send Claw a message listing each stock with ticker, shares, and average cost. Format:
Please save my stock portfolio to memory: - Apple (AAPL) - 50 shares bought at $142.00 - Shell (SHEL) - 200 shares bought at $28.40 - Samsung (005930.KS) - 10 shares bought at ₩71,000 [... all holdings ...] Save to memory/portfolio-saudi-stocks.json
The portfolio JSON is saved to /config/clawd/memory/portfolio-stocks.json on your local Pi. However, the actual data is sent to the Anthropic API when Claw processes your message. Don't share this conversation publicly.
The memory skill uses two separate storage mechanisms. After saving your portfolio, manually link it in MEMORY.md so Claw finds it every session:
root@openclaw:/# cat >> /config/clawd/MEMORY.md << 'EOF' ## Portfolio - Stock portfolio: ~/memory/portfolio-stocks.json ## Standing Instructions - Add 2 second delay between each stock price fetch - Never fetch all stocks simultaneously - Always include dividend-adjusted total return EOF
Yahoo Finance rate limits aggressive fetching. With 21 stocks fetched simultaneously you'll hit the limit within seconds. A 2-second delay between each fetch adds ~42 seconds to the total fetch time but makes it completely reliable.
Live Portfolio P&L — Capital Only
| Stock | Cost | Price | P&L% |
| Shell (SHEL) | $28.40 | $31.20 | +9.9% ๐ข |
| Samsung (005930.KS) | ₩71,000 | ₩58,400 | -17.7% ๐ด |
| Apple (AAPL) | $142.00 | $189.50 | +33.5% ๐ข |
| BP (BP.L) | £4.82 | £3.96 | -17.8% ๐ด |
| LVMH (MC.PA) | €680 | €592 | -12.9% ๐ด |
| Microsoft (MSFT) | $298 | $415 | +39.3% ๐ข |
| Total Invested | $42,800 | ||
| Current Value | $44,100 | ||
| Capital P&L | +3.0% ๐ข | ||
๐ Winners: Microsoft (+39.3%), Apple (+33.5%), Shell (+9.9%)
๐ Biggest drags: BP (-17.8%), Samsung (-17.7%), LVMH (-12.9%)
A stock down 25% looks terrible — until you realize it's been paying dividends for years. The capital-only view is the wrong lens for a dividend portfolio. Tab 3 shows what changes when dividends are included.
Loads your holdings from ~/memory/portfolio-saudi-stocks.json at session start.
Queries each ticker symbol with a 2-second delay between requests to avoid rate limiting.
Multiplies shares × (current price − avg cost) per holding. Sums to portfolio total.
Sorts by performance, identifies winners and losers, formats as a clean table.
The Dividend Revelation
After saving your portfolio, send Claw your total cumulative dividends received per stock, then request the combined analysis:
| Stock | Cap% | Divs | Total% |
| Microsoft (MSFT) | +39.3% | $412 | +43.1% ๐ข |
| Apple (AAPL) | +33.5% | $186 | +35.8% ๐ข |
| Shell (SHEL) | +9.9% | $1,240 | +19.2% ๐ข |
| BP (BP.L) | -17.8% | $1,890 | +4.6% ๐ข |
| LVMH (MC.PA) | -12.9% | $680 | -7.4% ๐ด |
| Samsung (005930.KS) | -17.7% | $320 | -14.2% ๐ด |
| Total Invested | $42,800 |
| Current Value | $44,100 |
| Capital P&L | +3.0% ๐ข |
| Total Dividends | +$4,728 |
| True Total Return | +14.1% ๐ข |
๐ Rescued by dividends: BP (-17.8% → +4.6% after $1,890 in dividends)
๐ด Still underwater after dividends: LVMH, Samsung
BP looked like a clear loser at -17.8% capital loss — but $1,890 in dividends flipped it to +4.6% total return. Shell's dividend income nearly doubled its capital gain. This is the analysis most retail investors never do because calculating it manually for a multi-stock, multi-currency portfolio is genuinely tedious. Claw does it in one message.
Twice-Daily Automated Updates
Send this to Claw on Telegram. The key detail is "do not fetch prices now" — this prevents an immediate rate limit hit during setup:
Set up two daily portfolio updates using cron. Do not fetch any prices now — just save the schedule. Schedule: - 10:15 AM Riyadh time (GMT+3) every day - 2:30 PM Riyadh time (GMT+3) every day When each job runs: 1. Read portfolio from ~/memory/portfolio-saudi-stocks.json 2. Fetch prices with 2 second delay between each stock 3. Calculate value, capital P&L, dividend-adjusted total return 4. For stocks moving more than 3%: fetch SMA20, SMA50, SMA200 5. Send summary to Telegram
On a quiet day with no big movers:
๐ผ Current Value: $44,800
๐ True Total Return: +13.8% (capital + dividends)
๐ Today's Move: +$180
✅ 21 stocks within normal range
On a volatile day with big movers — SMA context is automatically included:
๐ผ Current Value: $43,900
๐ True Total Return: +12.2% (capital + dividends)
๐ Today's Move: -$900
๐จ Big Movers (+/- 3%):
Showing SMA for every stock every day creates noise you'll stop reading. A 3% move is significant enough to warrant context — is the stock breaking down through its SMA200 for the first time, or just a normal pullback? That distinction is actionable. Quiet days stay clean.
Lessons Learned
Any Yahoo Finance symbol works via Claw's web tools. No paid API key needed. US stocks (AAPL, MSFT), European equities (BP.L, MC.PA), Asian markets (005930.KS), ETFs — if Yahoo Finance covers it, Claw can fetch it.
Fetching 21 stocks simultaneously hits Yahoo Finance rate limits immediately. The fix is a 2-second delay between fetches — add it as a standing instruction in MEMORY.md so it applies to every session including cron jobs. Adds ~42 seconds to fetch time but eliminates rate limit errors entirely.
MEMORY.md must be created manually from the template. The memory skill installs but does not create /config/clawd/MEMORY.md automatically. Copy it from the template: cp /config/clawd/skills/memory/memory-template.md /config/clawd/MEMORY.md. Without this, every memory read fails silently.
Portfolio JSON is saved to /config/clawd/memory/ not linked in MEMORY.md. Claw saves the file correctly but won't find it in future sessions unless you manually add a reference in MEMORY.md. One append command fixes this permanently.
Claw automatically fetches prices when it sees ticker symbols. Even a simple "read my portfolio from memory" triggers price fetches if Claw sees ticker symbols in the data. Be explicit: "do not fetch prices — just read the file." This prevents unexpected rate limit hits.
Capital P&L alone is the wrong lens for a dividend portfolio. Stocks that look like losers at -3% to -4% capital loss can be profitable once dividends are included. The dividend-adjusted analysis took 10 minutes to set up and changed the entire picture — half the apparent loss was recovered by dividends already received.
The cron setup message must say "do not fetch prices now." Without this explicit instruction Claw immediately fetches all 21 prices when setting up the cron schedule, hitting the rate limit before the schedule is even saved. Always separate the schedule setup from the first run.
SMA on all stocks every day is too much information. The right threshold is 3%+ movers only — significant enough to be actionable, rare enough to stay meaningful. On quiet days the update is 5 lines. On volatile days it shows exactly the context you need for the stocks that moved.
OpenClaw installed on HAOS, Telegram secured, skills set up, identity files configured.
Home Assistant skill connected. Vacuum, AC, sensors, automations — all controlled via Telegram in plain English.
Any stock portfolio tracked. Live P&L, dividend-adjusted returns, SMA signals, twice-daily automated updates.
Hardware: ~$80 (Raspberry Pi 5). Anthropic API: ~$3–8/month depending on usage. Paid stock data APIs: $0. The intelligence is cloud, the execution is local, the data is yours.
Comments
Post a Comment