How I Built an AI Agent That Monitors My Positions
The idea was simple: I wanted something watching my positions 24/7 that could think, not just alert on thresholds.
The Problem
Traditional alerting is dumb. You set a stop-loss, maybe a trailing stop, and you get a notification when price hits a number. But markets don't move in isolation — correlations shift, volatility regimes change, and a -2% move in a low-vol environment is very different from -2% during a VIX spike.
I wanted an agent that could reason about context.
Architecture
The system has three layers:
- Data ingestion — WebSocket feeds from exchanges, normalized into a common schema
- Context engine — Aggregates position data, market regime signals, and correlation matrices
- LLM reasoning — Claude processes the context and generates structured assessments
class PositionMonitor:
def __init__(self, positions, market_context):
self.positions = positions
self.context = market_context
self.agent = TradingAgent(role="risk_monitor")
async def assess(self):
prompt = self.build_context_prompt()
return await self.agent.reason(prompt)
What I Learned
The biggest insight: confidence scoring matters more than the recommendation itself. When the agent says "consider reducing exposure" with 0.4 confidence vs 0.9 confidence, the appropriate action is completely different.
More on this in the next post.