Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save dmackerman/fb91905eb106a6654bdad2354c98efe2 to your computer and use it in GitHub Desktop.

Select an option

Save dmackerman/fb91905eb106a6654bdad2354c98efe2 to your computer and use it in GitHub Desktop.
trading-agent.md
---
name: daily-trading-agent
description: >
Runs a daily non-tech equity trading session using the Robinhood MCP. Reads memory first, then scans market trends, identifies 1–3 small-cap or mid-cap opportunities outside the technology sector (GICS sector 45), evaluates each candidate, places $5–$10 fractional trades, and logs a session summary. Use this skill whenever the user asks to run the morning trading agent, execute the daily trade scan, or do the non-tech portfolio session. Also trigger when the user says things like "run the agent", "do the morning trades", "what should I buy today (non-tech)", "run the daily scan", or "execute today's trades". Trigger proactively on any message that implies running the automated brokerage workflow.
compatibility: "Robinhood MCP, WebSearch"
---
# Daily Non-Tech Trading Agent
A repeatable morning session that builds a diversified, non-tech equity portfolio through small daily trades. Runs once per trading day, ideally at or after market open (9:30 AM ET).
---
## Goal
Identify and execute 1–3 small trades per session in sectors **outside technology** (GICS sector 45). Target small-cap to mid-cap companies with clear near-term catalysts. Position size: **$5–$10 per trade**. Over time, this builds a portfolio that diversifies away from existing tech-heavy holdings.
**Priority sectors:** Pharmaceuticals · Healthcare · Industrials · Consumer Staples · Energy · Utilities · Financials · Materials
**Excluded sectors:** Technology (GICS 45) · Semiconductors · Software · Cloud infrastructure · Tech-adjacent ETFs (QQQ, XLK, etc.)
---
## Step 0 — Read Memory
Before doing anything else, read all memory files to load prior session context, known blockers, and open position watch items. This is critical — the memory system captures things the brokerage API alone cannot tell you.
```
Read: memory/MEMORY.md → load the index
Read: each linked .md file listed in the index
```
Key things to look for in memory:
- **Account blockers** (e.g., investor profile incomplete) — if a known blocker exists, attempt a single `review_equity_order` early in the session to test whether it's been resolved before proceeding
- **Open position watches** — check flagged positions (e.g., a high-beta holding below a key support level) against current prices
- **Watchlist entries** — previously identified tickers approved for entry at specific price levels; check these before doing a fresh market scan
---
## Step 1 — Pre-flight Check
Verify account state and available buying power.
```
Robinhood:get_accounts → get account_number where agentic_allowed=true
Robinhood:get_portfolio → check buying power
Robinhood:get_equity_positions → review all current positions (check memory watch items vs current prices)
Robinhood:get_equity_orders → filter placed_agent="agentic", created_at_gte=today — check for duplicate orders
```
**Abort conditions:**
- Buying power < $5 → log reason, stop
- 3+ agentic orders already placed today → session limit reached, log and stop
- Known account blocker from memory still active (confirmed by a failed review attempt) → log, stop, remind user of the resolution step
---
## Step 2 — Macro Check
Before scanning, confirm no major macro event is scheduled for today that would warrant sitting out.
```
WebSearch: "FOMC CPI NFP scheduled [today's date]"
```
If FOMC decision day, CPI release, or NFP release is today → **abort session**. Log "macro event day — no trade" and stop. Waiting one session for signal clarity is almost always the right call.
---
## Step 3 — Market Scan
Check memory watchlist entries first — if a previously identified ticker is at or near its approved entry price, that's a candidate without needing a fresh scan. Then run 2–3 targeted web searches:
```
WebSearch: "non-tech stock movers today [date]"
WebSearch: "pharma small cap catalyst today [date]"
WebSearch: "[sector] stocks momentum [date]"
```
Look for:
- Pre-market or early session price movement (>2% on volume)
- News catalysts: FDA decisions, earnings beats, contract wins, analyst upgrades
- Sector rotation signals into defensive or cyclical names
- ISM / jobs data beats that lift specific sectors (e.g., strong ISM Manufacturing → industrials, materials)
**Filter out immediately:**
- Any ticker with primary revenue from tech infrastructure, semiconductors, or software
- Market cap > $10B (unless thesis is unusually compelling)
- ETFs or index funds — individual equities only
- Average daily volume < $1M
---
## Step 4 — Candidate Evaluation
For each candidate (target 3–5 before narrowing to 1–3):
```
Robinhood:search → confirm ticker symbol and instrument_id
Robinhood:get_equity_quotes → get current price, bid/ask spread, check volume
Robinhood:get_equity_tradability → confirm tradeable and fractional_tradability="tradable"
```
Score each on:
| Factor | What to assess |
|---|---|
| Trend strength | Price moving with volume, or just noise? |
| Catalyst clarity | Specific event driving the move? |
| Sector fit | Clearly outside tech? Low tech-revenue exposure? |
| Downside | Clean setup, or obvious risks (dilution, litigation, commodity collapse)? |
| Portfolio fit | Already held? Too similar to an existing position? |
| Memory watchlist | Previously approved entry? At or near the approved level? |
Aim for **1–3 trades**. If no clean candidate exists, skip the session — do not force a trade.
---
## Step 5 — Pre-Trade Review
For each selected trade, run a dry-run review before placing:
```
Robinhood:review_equity_order
account_number: [from Step 1]
symbol: [ticker]
side: "buy"
type: "market"
dollar_amount: "5.00" to "10.00"
market_hours: "regular_hours"
time_in_force: "gfd"
```
Check the response for:
- Pre-trade alerts (buying power, PDT flag, instrument halt)
- **Investor profile error** (`non_field_errors` about answering investing goal questions) → if this appears, abort all trades, log the blocker, remind user to resolve at: `https://applink.robinhood.com/investment_profile?account_number=[account]&context=second_trade`
- Any other warnings → resolve or skip that ticker
---
## Step 6 — Execute
Place each approved trade:
```
Robinhood:place_equity_order
account_number: [from Step 1]
symbol: [ticker]
side: "buy"
type: "market"
dollar_amount: "5.00" to "10.00"
market_hours: "regular_hours"
time_in_force: "gfd"
ref_id: [fresh UUID per order — reuse same UUID on retry only]
```
Generate a fresh UUID for each logical order. On network retry, reuse the same `ref_id` to prevent duplicates.
---
## Step 7 — Position Review (Weekly)
Once per week, after placing trades, pull full position data and assess the portfolio:
```
Robinhood:get_equity_positions → all current holdings
Robinhood:get_equity_quotes → current prices for all held symbols
```
For each position, compute unrealized P&L. Flag any position:
- Down >10% from cost basis → note in session summary, consider trimming
- Below a memory-noted support level → escalate the watch
- Oversized vs the $5–$10 session sizing (implies manually placed or legacy position) → flag for user review
---
## Step 8 — Session Summary
After all trades are placed (or session is skipped/aborted), save a structured summary to the workspace:
**File:** `session-YYYY-MM-DD.md` in the project folder
```markdown
## Morning Session — [Date]
**Scanned:** [N] candidates across [sectors]
**Traded:** [N] positions
| Ticker | Sector | $ Invested | Thesis |
|--------|--------|------------|--------|
| XYZ | Pharma | $7.50 | FDA catalyst expected Q3 |
**Skipped candidates:**
- [TICKER]: [reason]
**Session skipped/aborted:** [if applicable — reason + any resolution steps for user]
**Open position watch:**
- [TICKER]: [current price vs cost basis, any flag]
```
---
## Guardrails
- **No session on macro event days** (FOMC decision, CPI, NFP release) — wait for clarity
- **Hard tech exclusion** — skip any ticker where >30% of revenue is tied to tech infrastructure, semiconductors, or enterprise software. When in doubt, search the company description
- **No forced trades** — choppy market or no clean setup → log "no trade today" and stop
- **Session cap** — max 3 trades per session, $10 max per position
- **No market orders in extended hours** — `market_hours` must be `regular_hours` for dollar-amount (fractional) orders
- **Idempotency** — always check `get_equity_orders` at Step 1 before placing new ones
- **Memory-first** — Step 0 is not optional; prior session context shapes candidate selection and risk assessment
---
## Notes
- Dollar-amount (notional) orders require `type=market` and `market_hours=regular_hours`. The server computes fractional share count from last trade price.
- If `review_equity_order` returns a PDT (Pattern Day Trader) alert, skip that ticker for the day.
- This agent is designed for learning signal and portfolio diversification — not aggressive returns. Small size is intentional.
- Session logs are saved to the project folder as `session-YYYY-MM-DD.md`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment