Install
openclaw skills install portfolio-drift-monitorReal-time Kalshi portfolio drift alerts — monitors positions and fires when any moves beyond your configured threshold since last check. Snapshot comparison, rate-limited checking, directional emoji indicators. Schedule hourly to catch position swings between morning and evening briefs. Part of the OpenClaw Prediction Market Trading Stack — risk management layer that pairs with Kalshi Command Center and Market Morning Brief.
openclaw skills install portfolio-drift-monitorReal-time monitoring of Kalshi portfolio positions with configurable alerts when positions move significantly. Ideal for active traders tracking exposure, P&L swings, and position concentration.
The Portfolio Drift Monitor tracks your Kalshi positions and alerts when any position moves beyond your configured threshold percentage since the last check. It:
~/.openclaw/state/portfolio_snapshot.jsonpip install kalshi-pythonKALSHI_KEY_ID and KALSHI_KEY_PATH environment variablesKALSHI_KEY_PATH (typically ~/.kalshi/key.pem)Set these environment variables or edit defaults in your environment:
| Variable | Default | Purpose |
|---|---|---|
KALSHI_KEY_ID | (required) | Your Kalshi API key ID from dev.kalshi.com |
KALSHI_KEY_PATH | (required) | Path to your Kalshi private key file (ES256 PEM) |
PORTFOLIO_DRIFT_THRESHOLD | 5.0 | Percentage change to trigger alert (e.g., 5 = 5%) |
PORTFOLIO_DRIFT_INTERVAL | 60 | Minutes between checks (rate limiting, prevents API spam) |
Use any of these phrases in conversation:
The skill calls Kalshi's API to get your current open positions:
python scripts/portfolio_drift.py
This reads KALSHI_KEY_ID and KALSHI_KEY_PATH from environment, authenticates with Kalshi, and retrieves all open positions.
On first run, creates baseline snapshot. On subsequent runs, compares current positions with the last recorded snapshot stored at ~/.openclaw/state/portfolio_snapshot.json.
For each position, calculates percent change in:
If any metric ≥ threshold, flags that position.
Outputs drift alerts with:
Saves current portfolio as new baseline for next check.
Example output for a position that drifted:
📈 YES/TRUMP.25DEC → +12.5% (↑$1,250 P&L, ↑350 shares)
Last check: 47 minutes ago
📉 NO/ELEX.HOUSEGOV → -8.3% (↓$425 unrealized P&L)
Last check: 42 minutes ago
No significant drift: KALSHI.USD, CRYPTO.BTC
PORTFOLIO_DRIFT_THRESHOLD=3.0 python scripts/portfolio_drift.py
PORTFOLIO_DRIFT_THRESHOLD=10.0 python scripts/portfolio_drift.py
python scripts/portfolio_drift.py && cat ~/.openclaw/state/portfolio_snapshot.json | python -m json.tool
| Profile | Threshold | Interval | Use Case |
|---|---|---|---|
| Tight | 3% | 30 min | Active day trading, many positions |
| Standard | 5% | 60 min | Default — balanced signal-to-noise |
| Loose | 10% | 120 min | Long-term positions, fewer alerts |
| News-reactive | 2% | 15 min | Event-driven trading (FOMC, elections) |
Risk management layer for the Prediction Market Trading Stack. Schedule hourly checks to catch position swings between Morning Briefs.
Scheduling:
skills:
portfolio-drift-monitor:
enabled: true
schedule: "0 * * * *" # Every hour
timeout_seconds: 30
| Connected Skill | How It Connects |
|---|---|
| Market Morning Brief | Morning/evening briefs bookend your day; drift alerts fill the gaps |
| Kalshi Command Center | Monitors positions opened through the command center |
| Kalshalyst | Tracks exposure on positions flagged by contrarian analysis |
Install the complete stack:
clawhub install kalshalyst kalshi-command-center polymarket-command-center prediction-market-arbiter xpulse portfolio-drift-monitor market-morning-brief personality-engine
portfolio_snapshot.json)24 checks/day (hourly) = 24 Kalshi API calls. Well within free tier limits.
Check logs and state:
# View current snapshot
cat ~/.openclaw/state/portfolio_snapshot.json | python -m json.tool
# Run manually with debug output
python -u scripts/portfolio_drift.py 2>&1 | head -50
# Verify credentials
echo $KALSHI_KEY_ID
ls -la $KALSHI_KEY_PATH
CRITICAL: When you (the agent) discover and fix a bug in any script during a conversation, you MUST write the fix to the source file on disk using file editing tools. Showing the fix in chat is NOT sufficient — the next scheduled run starts a fresh session and will not have your conversational fix.
Checklist after finding a bug:
.py file on disk (e.g., ~/skills/portfolio-drift-monitor/scripts/portfolio_drift.py)~/.openclaw/skills/portfolio-drift-monitor/scripts/portfolio_drift.py~/skills/Never say "fixed" if you only demonstrated the fix in conversation output.
Found a bug? Have a feature request? Want to share results?
Part of the OpenClaw Prediction Stack — the first prediction market skill suite on ClawHub.