How to Build an AI Agent That Monitors Your Portfolio While You Sleep

Most investors check their portfolio obsessively during market hours, then worry about it after hours when they can’t do anything anyway. That’s a terrible arrangement. What if instead, an AI agent watched your positions 24/7, flagged what actually mattered, and let you get on with your life? This isn’t science fiction โ€” it’s something you can build today with tools that cost less per month than a single lunch.

This guide walks through how to set up an autonomous portfolio monitoring agent from scratch. No coding background required, though it helps. By the end, you’ll have a system that tracks your positions, alerts you to meaningful moves, and can even give you a morning briefing before the market opens.

What You’re Actually Building

Before diving into tools, it helps to be precise about what “portfolio monitoring agent” means. There are three distinct functions to consider:

  • Price monitoring โ€” tracking when a position moves more than X% in a session, or crosses a key level
  • News and catalyst monitoring โ€” watching for earnings dates, SEC filings, analyst upgrades/downgrades, and news that affects your holdings
  • Synthesis and briefing โ€” pulling everything together into a summary you can actually act on

A lot of “portfolio alert” tools only do the first one. The interesting leap happens when you add the second and third โ€” that’s when it starts feeling like having a research assistant who never sleeps.

The Tech Stack

Here’s what I use and recommend for a functional, low-cost setup:

  • OpenClaw โ€” the AI agent runtime that ties everything together. Think of it as the brain that reads data, makes decisions about what matters, and routes alerts to the right place. It runs on your Mac or a small server and is what gives the whole system autonomous behavior.
  • Polygon.io or Alpha Vantage โ€” free tiers are sufficient for end-of-day data; paid tiers get you real-time quotes. For most investors, 15-minute delayed data is completely fine.
  • Telegram or Discord โ€” where your alerts actually go. These apps are always on your phone and support rich messages with formatting. Telegram is my preference because it’s faster and the bot API is excellent.
  • A simple portfolio JSON file โ€” your positions list. This doesn’t need to be fancy; a plain text file with tickers and share counts works fine as the agent’s source of truth.

Optional but powerful additions: a brokerage API connection (Alpaca, TD Ameritrade/Schwab API) for live position sync, and a news aggregation service like NewsAPI for catalyst monitoring.

Step 1: Define Your Portfolio File

Start with a simple JSON file that the agent can read. Create a file called portfolio.json in your OpenClaw workspace:

{
  "positions": [
    {"ticker": "RKLB", "shares": 500, "avg_cost": 14.20, "alerts": {"pct_move": 5, "price_targets": [20, 25, 30]}},
    {"ticker": "ASTS", "shares": 200, "avg_cost": 22.50, "alerts": {"pct_move": 7, "price_targets": [35, 50]}},
    {"ticker": "LUNR", "shares": 300, "avg_cost": 8.10, "alerts": {"pct_move": 8, "price_targets": [12, 18]}}
  ],
  "alert_channel": "telegram",
  "briefing_time": "08:30"
}

This file is your agent’s instruction set. You control what gets watched and at what sensitivity. Volatile small-caps like space stocks warrant wider alert thresholds (7-10%) to avoid constant noise. Blue chip positions might warrant tighter ones (2-3%).

Step 2: Write the Monitoring Skill

In OpenClaw, agents operate on “skills” โ€” small instruction files that tell the AI how to handle specific tasks. Here’s the skeleton of a portfolio monitoring skill:

# Portfolio Monitor Skill

## Trigger
Runs on schedule (every 30 minutes during market hours) and at briefing_time.

## Steps
1. Read portfolio.json from workspace
2. For each position, fetch current price via Polygon.io API
3. Calculate daily % move and compare to alert thresholds
4. Check price_targets โ€” flag any positions within 3% of a target
5. If any alert conditions met, compose and send message via Telegram
6. At briefing_time, generate full morning summary regardless of alerts

## Alert Format
"๐Ÿš€ RKLB is up 6.2% today to $15.80 โ€” past your 5% alert threshold. Current P/L: +$800 (+11.3%). Next target: $20."

## Morning Briefing Format
- Market futures summary (SPY, QQQ direction)
- Each position: current price, daily move, distance to nearest target
- Any earnings dates in the next 7 days
- Notable news from overnight

The key insight here is that you’re not writing code โ€” you’re writing instructions in plain English that the AI agent interprets and executes. This is what makes modern AI tooling so accessible for non-engineers.

Step 3: Connect the Data Sources

Sign up for a free Polygon.io account and grab your API key. Their free tier includes end-of-day data for all US stocks, which is sufficient for a daily briefing setup. If you want intraday alerts (mid-session), the Starter tier at $29/month covers 15-minute delayed data.

Store your API key in OpenClaw’s credentials system rather than hardcoding it anywhere. This keeps it out of your files and makes it easy to rotate:

# In your terminal:
openclaw credentials set polygon_api_key YOUR_KEY_HERE

For news monitoring, NewsAPI has a generous free tier that covers headlines from major financial outlets. Add it as a second data source in your skill and have the agent filter for your tickers. The AI is good at separating meaningful news (earnings beats, contract wins, executive changes) from noise (analyst price target adjustments that are 6 months old).

Step 4: Set Up Your Alert Channel

Connect OpenClaw to Telegram by creating a bot via BotFather (it’s literally just sending messages to a Telegram account called @BotFather). You get a token, add it to OpenClaw’s channel config, and suddenly your agent can send you formatted messages with buttons, charts, and links.

A few formatting tips that make alerts actually useful:

  • Use emoji as visual flags: ๐Ÿš€ for significant upward moves, ๐Ÿ”ป for drops, โšก for news/catalyst events, โ˜€๏ธ for morning briefings
  • Always include the P/L impact in dollars, not just percentage โ€” “RKLB up 6%” feels different when you see “+$840 today”
  • Include a direct link to the chart or relevant news so you can go deeper in one tap
  • Add a mute button or snooze option so you can silence non-urgent alerts without losing the data

Step 5: Schedule It and Let It Run

OpenClaw has a built-in cron scheduler. Set your monitoring skill to run at whatever cadence makes sense for your style:

  • Active trader: every 15-30 minutes during market hours (9:30amโ€“4pm ET)
  • Swing trader: once at open, once midday, once at close
  • Long-term investor: daily morning briefing, instant alert only on 10%+ moves

The morning briefing is the most valuable output for most people. Getting a concise, personalized summary of your portfolio’s status before the market opens โ€” while you’re having coffee โ€” lets you make better decisions than scrambling to check quotes after the bell rings.

Advanced: Adding Earnings Calendar Awareness

This is where the agent goes from useful to genuinely impressive. Have it check an earnings calendar API (Polygon.io includes this) and flag when any of your holdings have earnings within the next 7 days. Instruct it to:

  • Alert you 5 days before an earnings date with a reminder
  • Include the consensus EPS estimate and revenue estimate
  • Note the average post-earnings move for that stock (historical implied volatility)
  • Ask if you want to adjust position size before the event

That last point is where it gets interesting โ€” you can configure the agent to actually prompt you for a decision, then log your response. Over time, you build a record of how you handle earnings events, which becomes useful for reviewing your own decision patterns.

What This Actually Changes

The practical impact of having this system running is less about catching specific price moves and more about mental bandwidth. When you know you’ll get alerted if something important happens, you stop refreshing your brokerage app every 20 minutes. That attention reclaims hours each week and tends to lead to better decisions โ€” you’re acting on alerts rather than reacting to anxiety.

It also creates a paper trail. Every briefing gets logged. You can look back at what the agent told you last Tuesday, what you did, and what happened. That feedback loop is genuinely valuable for improving as an investor over time.

The whole stack โ€” OpenClaw on an older Mac mini, Polygon free tier, Telegram โ€” runs for essentially zero incremental cost. The time investment to set it up is maybe 4-6 hours the first time. After that, it just runs.


Want the pre-built version of this? I put together a step-by-step guide with the full skill templates, the portfolio JSON schema, and the exact Telegram bot setup. Grab it free at flamingofelix.gumroad.com/l/xrmtsg โ€” no email required, just download and start building.