agenthood 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- agenthood-0.1.0/.gitignore +12 -0
- agenthood-0.1.0/AGENTS.md +74 -0
- agenthood-0.1.0/PKG-INFO +144 -0
- agenthood-0.1.0/README.md +134 -0
- agenthood-0.1.0/pyproject.toml +28 -0
- agenthood-0.1.0/skills/options-playbook/SKILL.md +73 -0
- agenthood-0.1.0/skills/risk-management/SKILL.md +73 -0
- agenthood-0.1.0/skills/technical-analysis/SKILL.md +59 -0
- agenthood-0.1.0/src/agenthood/__init__.py +8 -0
- agenthood-0.1.0/src/agenthood/agent.py +1089 -0
- agenthood-0.1.0/src/agenthood/cli.py +325 -0
- agenthood-0.1.0/src/agenthood/config.py +205 -0
- agenthood-0.1.0/src/agenthood/daemon.py +346 -0
- agenthood-0.1.0/src/agenthood/hooks.py +79 -0
- agenthood-0.1.0/src/agenthood/notify.py +322 -0
- agenthood-0.1.0/src/agenthood/setup.py +302 -0
- agenthood-0.1.0/src/agenthood/token.py +197 -0
- agenthood-0.1.0/src/agenthood/tui.py +1319 -0
- agenthood-0.1.0/src/agenthood/watcher.py +177 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# AgentHood -- Trading Agent Rules
|
|
2
|
+
|
|
3
|
+
## Identity
|
|
4
|
+
You are AgentHood, a disciplined Robinhood trading assistant. You have deep knowledge
|
|
5
|
+
of equities, options, technical analysis, and portfolio risk management.
|
|
6
|
+
|
|
7
|
+
## Safety rules (non-negotiable)
|
|
8
|
+
1. **Never place an order without a prior review call.** Always run review_equity_order
|
|
9
|
+
or review_option_order first and show the result to the user.
|
|
10
|
+
2. **Never place an order without explicit user confirmation.** Even if the user says
|
|
11
|
+
"buy X", confirm: "I'm about to place a [details]. Confirm? (yes/no)".
|
|
12
|
+
3. **Flag high-risk plays clearly.** Options, leveraged ETFs, penny stocks, and
|
|
13
|
+
earnings plays must include a risk warning before any review/order call.
|
|
14
|
+
4. **Prefer limit orders.** Only use market orders when user explicitly requests it.
|
|
15
|
+
5. **Respect dry_run mode.** If the system says dry_run is active, explain this to
|
|
16
|
+
the user and offer to simulate instead.
|
|
17
|
+
|
|
18
|
+
## Architecture
|
|
19
|
+
|
|
20
|
+
### Dispatch pipeline (order matters)
|
|
21
|
+
`_direct_dispatch` in agent.py processes user input in this order:
|
|
22
|
+
1. **Watch/alert detection** -- regex match, returns `__watch__` sentinel
|
|
23
|
+
2. **Meta questions** -- "what can you do?", "hello", etc. Returns canned string (no LLM)
|
|
24
|
+
3. **Stock query detection** -- natural language ("how's PYPL doing?") or bare tickers ("pypl, google, meta"). Returns `__analyze__` sentinel
|
|
25
|
+
4. **Fallthrough** -- returns None, goes to LLM via `agent.infer()`
|
|
26
|
+
|
|
27
|
+
### TUI command dispatch (handle_meta in tui.py)
|
|
28
|
+
Dot commands are handled BEFORE the agent's dispatch pipeline:
|
|
29
|
+
- `.analyze TICKER [, TICKER2]` -- returns list of tickers
|
|
30
|
+
- `.portfolio` / `.port` / `.p` -- returns `__portfolio__` sentinel
|
|
31
|
+
- `.positions` / `.pos` -- returns `__positions__` sentinel
|
|
32
|
+
- `.quote TICKER` / `.q TICKER` -- returns `(__quote__, TICKER)` tuple
|
|
33
|
+
- `.model`, `.cost`, `.memory`, `.tools`, `.verbose` -- handled inline, returns True
|
|
34
|
+
|
|
35
|
+
### Provider config
|
|
36
|
+
- **Chat model**: `model` field in agenthood.json (OpenRouter free tier)
|
|
37
|
+
- **Analyze model**: separate `analyze_model`, `analyze_api_base`, `analyze_api_key` fields
|
|
38
|
+
- Groq is the fast path for `.analyze` (~1s vs ~14s on free tier)
|
|
39
|
+
- The status bar shows both: `model gemma-4-26b | analyze llama-3.3-70b (groq) LIVE`
|
|
40
|
+
|
|
41
|
+
### MCP tool calls
|
|
42
|
+
- Portfolio and positions require `account_number` param (fetch via `get_accounts` first)
|
|
43
|
+
- Prefer the agentic account (`agentic_allowed: true`), then default, then first
|
|
44
|
+
- Accounts response shape: `data.accounts[]` (NOT `data.results[]`)
|
|
45
|
+
- Quotes use `symbols: [TICKER]` param
|
|
46
|
+
- Technical indicators require `type`, `interval`, `start_time` params
|
|
47
|
+
|
|
48
|
+
### Ticker resolution
|
|
49
|
+
- `_NAME_TO_TICKER` in tui.py and `_NAMES` in agent.py map company names to symbols
|
|
50
|
+
- Bare ticker lists (e.g. "pypl, google, meta") are detected when ALL words are known names/tickers
|
|
51
|
+
- Unknown tickers are uppercase 1-5 letter words; stopwords are filtered out
|
|
52
|
+
- Fallback: Robinhood search MCP tool for unrecognized company names
|
|
53
|
+
|
|
54
|
+
## Reasoning style
|
|
55
|
+
- Think step-by-step before making tool calls.
|
|
56
|
+
- State assumptions (e.g. "I'll assume you want a 0DTE call on AAPL").
|
|
57
|
+
- After gathering data, provide a brief analysis before recommending action.
|
|
58
|
+
- Prefer fewer, well-targeted tool calls over many redundant ones.
|
|
59
|
+
- Include BUY, SELL, or HOLD verdict in every analysis.
|
|
60
|
+
|
|
61
|
+
## Output style
|
|
62
|
+
- Use markdown tables for quotes, positions, and order previews.
|
|
63
|
+
- Use bullet points for analysis.
|
|
64
|
+
- No emojis. No em-dashes.
|
|
65
|
+
- All analysis output renders through Rich Markdown panels.
|
|
66
|
+
- Multi-ticker analysis shows separate panels per ticker.
|
|
67
|
+
- Keep streaming progress clean: show step labels, not character counts.
|
|
68
|
+
|
|
69
|
+
## Testing rules
|
|
70
|
+
- Run `python3.14 -m pytest tests/test_tui.py` for TUI changes.
|
|
71
|
+
- Test dispatch detection with inline scripts before declaring it works.
|
|
72
|
+
- Clear `__pycache__` after edits: the CLI uses editable install.
|
|
73
|
+
- The full test suite (`tests/`) has 200+ tests; some mock agentu and may hang.
|
|
74
|
+
Run specific test files instead of the full suite for fast feedback.
|
agenthood-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: agenthood
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Robinhood trading agent powered by agentu + Robinhood MCP
|
|
5
|
+
License: MIT
|
|
6
|
+
Requires-Python: >=3.11
|
|
7
|
+
Requires-Dist: agentu>=2.4.0
|
|
8
|
+
Requires-Dist: rich>=13.0
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
|
|
11
|
+
# agenthood
|
|
12
|
+
|
|
13
|
+
Robinhood trading agent -- talk to your portfolio in plain English.
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pip install agenthood
|
|
17
|
+
agenthood setup
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
`setup` walks you through Robinhood OAuth and LLM selection. Config saves to `~/.agenthood/config.json`. After that, just run `agenthood`.
|
|
21
|
+
|
|
22
|
+
## Quick start
|
|
23
|
+
|
|
24
|
+
```python
|
|
25
|
+
import asyncio
|
|
26
|
+
from agenthood import AgentHood
|
|
27
|
+
|
|
28
|
+
async def main():
|
|
29
|
+
async with AgentHood() as agent:
|
|
30
|
+
print(await agent.chat("What are my open positions?"))
|
|
31
|
+
print(await agent.chat("Get me a quote for NVDA and AAPL"))
|
|
32
|
+
print(await agent.chat("Review a limit buy of 5 AAPL at $210"))
|
|
33
|
+
|
|
34
|
+
asyncio.run(main())
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
`chat()` sends a prompt and returns the response. The agent picks the right Robinhood tools, fetches data, and explains what it found.
|
|
38
|
+
|
|
39
|
+
## CLI
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
agenthood # interactive REPL
|
|
43
|
+
agenthood "What is TSLA at?" # one-shot
|
|
44
|
+
agenthood --live # real orders
|
|
45
|
+
agenthood --stream # token-by-token
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Inside the REPL, dot commands skip the LLM entirely:
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
.portfolio show portfolio (alias: .p)
|
|
52
|
+
.positions show open positions (alias: .pos)
|
|
53
|
+
.quote NVDA quick price quote (alias: .q NVDA)
|
|
54
|
+
.analyze PYPL multi-source analysis
|
|
55
|
+
.help all commands
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Direct tool calls
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
import asyncio, json
|
|
62
|
+
from agenthood import AgentHood
|
|
63
|
+
|
|
64
|
+
async def main():
|
|
65
|
+
async with AgentHood() as agent:
|
|
66
|
+
result = json.loads(await agent.call_tool("robinhood_get_equity_quotes", {
|
|
67
|
+
"symbols": ["NVDA", "AAPL"]
|
|
68
|
+
}))
|
|
69
|
+
print(result["data"]["results"])
|
|
70
|
+
|
|
71
|
+
asyncio.run(main())
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
`call_tool(name, params)` bypasses the LLM and calls a Robinhood MCP tool directly. 53 tools available.
|
|
75
|
+
|
|
76
|
+
## Safety
|
|
77
|
+
|
|
78
|
+
```python
|
|
79
|
+
from agenthood import AgentHood, AgentHoodConfig
|
|
80
|
+
|
|
81
|
+
cfg = AgentHoodConfig(
|
|
82
|
+
dry_run=False, # default True -- blocks place_* tools
|
|
83
|
+
max_order_value=1000, # hard cap per order in USD
|
|
84
|
+
allowed_symbols=["AAPL", "NVDA", "TSLA"],
|
|
85
|
+
)
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Safety hooks run at the tool-call level. The LLM cannot talk its way around them.
|
|
89
|
+
|
|
90
|
+
## Config
|
|
91
|
+
|
|
92
|
+
All config lives in `~/.agenthood/`:
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
~/.agenthood/
|
|
96
|
+
config.json # model, api keys, safety settings
|
|
97
|
+
history # readline history
|
|
98
|
+
sessions/ # saved chat sessions
|
|
99
|
+
watches.json # price alerts
|
|
100
|
+
triggered.db # alert history
|
|
101
|
+
logs/ # daemon logs
|
|
102
|
+
daemon.pid # background process
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
```json
|
|
106
|
+
{
|
|
107
|
+
"model": "meta-llama/llama-3.3-70b-instruct:free",
|
|
108
|
+
"api_base": "https://openrouter.ai/api/v1",
|
|
109
|
+
"api_key": "sk-or-...",
|
|
110
|
+
"analyze_model": "llama-3.3-70b-versatile",
|
|
111
|
+
"analyze_api_base": "https://api.groq.com/openai/v1",
|
|
112
|
+
"analyze_api_key": "gsk_...",
|
|
113
|
+
"dry_run": false,
|
|
114
|
+
"max_order_value": 1000,
|
|
115
|
+
"max_turns": 20
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Robinhood token is auto-discovered from `~/.mcp-auth/`. No manual setup needed after the first `npx mcp-remote` auth flow.
|
|
120
|
+
|
|
121
|
+
## Multi-provider routing
|
|
122
|
+
|
|
123
|
+
```json
|
|
124
|
+
{
|
|
125
|
+
"model": "google/gemma-4-26b-a4b-it:free",
|
|
126
|
+
"model_fallbacks": ["nvidia/nemotron-3-super-120b-a12b:free"],
|
|
127
|
+
"analyze_model": "llama-3.3-70b-versatile",
|
|
128
|
+
"analyze_api_base": "https://api.groq.com/openai/v1"
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
`model` handles chat. `analyze_model` handles `.analyze` -- Groq runs analysis in ~1s vs ~14s on free tier. Dot commands use no model at all.
|
|
133
|
+
|
|
134
|
+
## Autonomous scanning
|
|
135
|
+
|
|
136
|
+
```python
|
|
137
|
+
cfg = AgentHoodConfig(scan_interval=300) # every 5 minutes
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
The agent wakes up on a schedule, checks for positions down >5%, scans for RSI breakouts, and records findings.
|
|
141
|
+
|
|
142
|
+
## License
|
|
143
|
+
|
|
144
|
+
MIT [Hemanth.HM](https://h3manth.com)
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# agenthood
|
|
2
|
+
|
|
3
|
+
Robinhood trading agent -- talk to your portfolio in plain English.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
pip install agenthood
|
|
7
|
+
agenthood setup
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
`setup` walks you through Robinhood OAuth and LLM selection. Config saves to `~/.agenthood/config.json`. After that, just run `agenthood`.
|
|
11
|
+
|
|
12
|
+
## Quick start
|
|
13
|
+
|
|
14
|
+
```python
|
|
15
|
+
import asyncio
|
|
16
|
+
from agenthood import AgentHood
|
|
17
|
+
|
|
18
|
+
async def main():
|
|
19
|
+
async with AgentHood() as agent:
|
|
20
|
+
print(await agent.chat("What are my open positions?"))
|
|
21
|
+
print(await agent.chat("Get me a quote for NVDA and AAPL"))
|
|
22
|
+
print(await agent.chat("Review a limit buy of 5 AAPL at $210"))
|
|
23
|
+
|
|
24
|
+
asyncio.run(main())
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
`chat()` sends a prompt and returns the response. The agent picks the right Robinhood tools, fetches data, and explains what it found.
|
|
28
|
+
|
|
29
|
+
## CLI
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
agenthood # interactive REPL
|
|
33
|
+
agenthood "What is TSLA at?" # one-shot
|
|
34
|
+
agenthood --live # real orders
|
|
35
|
+
agenthood --stream # token-by-token
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Inside the REPL, dot commands skip the LLM entirely:
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
.portfolio show portfolio (alias: .p)
|
|
42
|
+
.positions show open positions (alias: .pos)
|
|
43
|
+
.quote NVDA quick price quote (alias: .q NVDA)
|
|
44
|
+
.analyze PYPL multi-source analysis
|
|
45
|
+
.help all commands
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Direct tool calls
|
|
49
|
+
|
|
50
|
+
```python
|
|
51
|
+
import asyncio, json
|
|
52
|
+
from agenthood import AgentHood
|
|
53
|
+
|
|
54
|
+
async def main():
|
|
55
|
+
async with AgentHood() as agent:
|
|
56
|
+
result = json.loads(await agent.call_tool("robinhood_get_equity_quotes", {
|
|
57
|
+
"symbols": ["NVDA", "AAPL"]
|
|
58
|
+
}))
|
|
59
|
+
print(result["data"]["results"])
|
|
60
|
+
|
|
61
|
+
asyncio.run(main())
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
`call_tool(name, params)` bypasses the LLM and calls a Robinhood MCP tool directly. 53 tools available.
|
|
65
|
+
|
|
66
|
+
## Safety
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
from agenthood import AgentHood, AgentHoodConfig
|
|
70
|
+
|
|
71
|
+
cfg = AgentHoodConfig(
|
|
72
|
+
dry_run=False, # default True -- blocks place_* tools
|
|
73
|
+
max_order_value=1000, # hard cap per order in USD
|
|
74
|
+
allowed_symbols=["AAPL", "NVDA", "TSLA"],
|
|
75
|
+
)
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Safety hooks run at the tool-call level. The LLM cannot talk its way around them.
|
|
79
|
+
|
|
80
|
+
## Config
|
|
81
|
+
|
|
82
|
+
All config lives in `~/.agenthood/`:
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
~/.agenthood/
|
|
86
|
+
config.json # model, api keys, safety settings
|
|
87
|
+
history # readline history
|
|
88
|
+
sessions/ # saved chat sessions
|
|
89
|
+
watches.json # price alerts
|
|
90
|
+
triggered.db # alert history
|
|
91
|
+
logs/ # daemon logs
|
|
92
|
+
daemon.pid # background process
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
```json
|
|
96
|
+
{
|
|
97
|
+
"model": "meta-llama/llama-3.3-70b-instruct:free",
|
|
98
|
+
"api_base": "https://openrouter.ai/api/v1",
|
|
99
|
+
"api_key": "sk-or-...",
|
|
100
|
+
"analyze_model": "llama-3.3-70b-versatile",
|
|
101
|
+
"analyze_api_base": "https://api.groq.com/openai/v1",
|
|
102
|
+
"analyze_api_key": "gsk_...",
|
|
103
|
+
"dry_run": false,
|
|
104
|
+
"max_order_value": 1000,
|
|
105
|
+
"max_turns": 20
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Robinhood token is auto-discovered from `~/.mcp-auth/`. No manual setup needed after the first `npx mcp-remote` auth flow.
|
|
110
|
+
|
|
111
|
+
## Multi-provider routing
|
|
112
|
+
|
|
113
|
+
```json
|
|
114
|
+
{
|
|
115
|
+
"model": "google/gemma-4-26b-a4b-it:free",
|
|
116
|
+
"model_fallbacks": ["nvidia/nemotron-3-super-120b-a12b:free"],
|
|
117
|
+
"analyze_model": "llama-3.3-70b-versatile",
|
|
118
|
+
"analyze_api_base": "https://api.groq.com/openai/v1"
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
`model` handles chat. `analyze_model` handles `.analyze` -- Groq runs analysis in ~1s vs ~14s on free tier. Dot commands use no model at all.
|
|
123
|
+
|
|
124
|
+
## Autonomous scanning
|
|
125
|
+
|
|
126
|
+
```python
|
|
127
|
+
cfg = AgentHoodConfig(scan_interval=300) # every 5 minutes
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
The agent wakes up on a schedule, checks for positions down >5%, scans for RSI breakouts, and records findings.
|
|
131
|
+
|
|
132
|
+
## License
|
|
133
|
+
|
|
134
|
+
MIT [Hemanth.HM](https://h3manth.com)
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "agenthood"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Robinhood trading agent powered by agentu + Robinhood MCP"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = { text = "MIT" }
|
|
11
|
+
requires-python = ">=3.11"
|
|
12
|
+
dependencies = [
|
|
13
|
+
"agentu>=2.4.0",
|
|
14
|
+
"rich>=13.0",
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
[project.scripts]
|
|
18
|
+
agenthood = "agenthood.cli:cli"
|
|
19
|
+
|
|
20
|
+
[tool.hatch.build.targets.sdist]
|
|
21
|
+
include = ["src/", "skills/", "README.md", "AGENTS.md"]
|
|
22
|
+
|
|
23
|
+
[tool.pytest.ini_options]
|
|
24
|
+
testpaths = ["tests"]
|
|
25
|
+
asyncio_mode = "auto"
|
|
26
|
+
|
|
27
|
+
[tool.hatch.build.targets.wheel]
|
|
28
|
+
packages = ["src/agenthood"]
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: options-playbook
|
|
3
|
+
description: Use when the user asks about options — buying calls/puts, covered calls, spreads, earnings plays, IV crush, or anything involving options chains, greeks, or expiration strategy.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Options Playbook Skill
|
|
7
|
+
|
|
8
|
+
## Before Any Options Trade
|
|
9
|
+
|
|
10
|
+
Always gather:
|
|
11
|
+
```
|
|
12
|
+
1. get_option_chains(symbol) → available expirations + strikes
|
|
13
|
+
2. get_option_instruments(...) → specific contracts
|
|
14
|
+
3. get_option_quotes(...) → bid/ask, IV, greeks
|
|
15
|
+
4. get_equity_fundamentals(symbol) → earnings date (IV crush risk!)
|
|
16
|
+
5. get_equity_technical_indicators(rsi) → entry timing
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
**Always show**: breakeven, max profit, max loss, IV rank.
|
|
20
|
+
|
|
21
|
+
## Common Strategies
|
|
22
|
+
|
|
23
|
+
### Long Call (bullish, defined risk)
|
|
24
|
+
- Buy when: RSI < 60, bullish catalyst expected, IV rank < 40%
|
|
25
|
+
- Strike: ATM or 1 strike OTM
|
|
26
|
+
- Expiry: 30–60 DTE (avoid 0DTE for beginners)
|
|
27
|
+
- Max loss: premium paid | Max profit: unlimited
|
|
28
|
+
- Breakeven: strike + premium
|
|
29
|
+
- Exit: at 50% profit or 21 DTE (whichever first)
|
|
30
|
+
|
|
31
|
+
### Long Put (bearish, defined risk)
|
|
32
|
+
- Buy when: RSI > 65, distribution pattern, high IV is fine (protective)
|
|
33
|
+
- Strike: ATM or 1 strike OTM
|
|
34
|
+
- Expiry: 30–45 DTE
|
|
35
|
+
- Max loss: premium paid | Max profit: strike - premium (near zero)
|
|
36
|
+
|
|
37
|
+
### Covered Call (neutral-to-slightly-bullish, income)
|
|
38
|
+
- Requires 100 shares of underlying
|
|
39
|
+
- Sell OTM call (delta 0.20–0.30) against shares
|
|
40
|
+
- Collect premium as income
|
|
41
|
+
- Risk: shares called away if price rises above strike
|
|
42
|
+
- Best in: sideways or slowly rising market
|
|
43
|
+
|
|
44
|
+
### Cash-Secured Put (neutral-to-bullish, income)
|
|
45
|
+
- Sell OTM put, hold cash to buy shares if assigned
|
|
46
|
+
- Collect premium | Effective entry: strike - premium
|
|
47
|
+
- Risk: must buy shares at strike if price drops
|
|
48
|
+
|
|
49
|
+
## ⚠️ Earnings Warning
|
|
50
|
+
If earnings within **14 days**:
|
|
51
|
+
- IV is inflated → options are expensive
|
|
52
|
+
- IV crush after earnings can destroy long option value even if direction is right
|
|
53
|
+
- Use spreads (defined risk) not naked longs
|
|
54
|
+
- State this warning prominently before any earnings play
|
|
55
|
+
|
|
56
|
+
## Greeks Quick Reference
|
|
57
|
+
| Greek | Meaning | Watch for |
|
|
58
|
+
|-------|---------|-----------|
|
|
59
|
+
| Delta | Price sensitivity | 0.5 = ATM |
|
|
60
|
+
| Theta | Time decay per day | Hurts buyers |
|
|
61
|
+
| Vega | IV sensitivity | Hurts on IV crush |
|
|
62
|
+
| Gamma | Delta acceleration | High near expiry |
|
|
63
|
+
|
|
64
|
+
## Output Format for Options
|
|
65
|
+
```
|
|
66
|
+
📊 AAPL $200C 2026-09-19
|
|
67
|
+
Bid/Ask : $3.20 / $3.40 (mid: $3.30)
|
|
68
|
+
IV : 42% (IV Rank: 38% — fair)
|
|
69
|
+
Delta : 0.48 | Theta: -$0.08/day
|
|
70
|
+
Breakeven: $203.30 (+1.6% from current)
|
|
71
|
+
Max Loss: $330 (premium paid)
|
|
72
|
+
⚠️ Earnings: 2026-08-01 — IV crush risk after report
|
|
73
|
+
```
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: risk-management
|
|
3
|
+
description: Use when evaluating position sizing, portfolio concentration, stop-loss placement, drawdown risk, or when the user asks "should I buy more" or "how much should I invest".
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Risk Management Skill
|
|
7
|
+
|
|
8
|
+
## Position Sizing Rules
|
|
9
|
+
|
|
10
|
+
### The 1% Rule (default for agenthood)
|
|
11
|
+
- Never risk more than **1% of portfolio value** on a single trade.
|
|
12
|
+
- Risk = entry price - stop-loss price × quantity
|
|
13
|
+
- Example: $10,000 portfolio → max risk per trade = $100
|
|
14
|
+
- AAPL at $300, stop at $290 → max 10 shares ($3,000 position)
|
|
15
|
+
|
|
16
|
+
### Portfolio Concentration Limits
|
|
17
|
+
- **Single stock**: max 10% of portfolio
|
|
18
|
+
- **Single sector**: max 25% of portfolio
|
|
19
|
+
- **Options/speculative**: max 5% of portfolio
|
|
20
|
+
- Flag if user is overconcentrated before recommending adds.
|
|
21
|
+
|
|
22
|
+
## Stop-Loss Placement
|
|
23
|
+
|
|
24
|
+
| Strategy | Stop Level |
|
|
25
|
+
|----------|-----------|
|
|
26
|
+
| Momentum trade | Below recent swing low |
|
|
27
|
+
| Breakout trade | Below breakout level |
|
|
28
|
+
| Mean reversion | 1.5× ATR below entry |
|
|
29
|
+
| Options | Exit at 50% loss of premium |
|
|
30
|
+
|
|
31
|
+
Always calculate ATR when placing stops:
|
|
32
|
+
```
|
|
33
|
+
get_equity_historicals → compute daily ranges → average = ATR
|
|
34
|
+
Stop = entry - (1.5 × ATR)
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Pre-Trade Checklist
|
|
38
|
+
|
|
39
|
+
Before recommending any order, verify:
|
|
40
|
+
- [ ] Position size within 1% risk rule
|
|
41
|
+
- [ ] Sector not already overweight
|
|
42
|
+
- [ ] Earnings not within 2 weeks (if directional bet)
|
|
43
|
+
- [ ] RSI not in extreme zone against the trade direction
|
|
44
|
+
- [ ] Buying power sufficient (check get_portfolio)
|
|
45
|
+
- [ ] Dry run mode is off if placing real order
|
|
46
|
+
|
|
47
|
+
## Portfolio Health Check Workflow
|
|
48
|
+
```
|
|
49
|
+
1. get_equity_positions → current holdings
|
|
50
|
+
2. get_portfolio → total value + cash
|
|
51
|
+
3. For each position:
|
|
52
|
+
- calculate % of portfolio
|
|
53
|
+
- get RSI → flag overbought longs
|
|
54
|
+
4. Summarize: concentration, total risk exposure, cash %
|
|
55
|
+
5. Flag anything > 10% single stock or > 25% sector
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Output Format
|
|
59
|
+
```
|
|
60
|
+
⚖️ Risk Assessment: AAPL 10 shares @ $309
|
|
61
|
+
Position size : $3,090 (30.9% of $10k portfolio) ⚠️ HIGH
|
|
62
|
+
Risk (to stop) : $190 (1.9% of portfolio)
|
|
63
|
+
Recommended : Reduce to 5 shares ($1,545 = 15%)
|
|
64
|
+
Stop-loss : $290.00 (1× ATR below entry)
|
|
65
|
+
Max loss : $95 (0.95% of portfolio) ✅
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Risk Warnings — Always Emit
|
|
69
|
+
- ⚠️ **Earnings within 14 days**: high volatility risk
|
|
70
|
+
- ⚠️ **Position > 10% portfolio**: concentration risk
|
|
71
|
+
- ⚠️ **RSI > 75**: overbought, stop should be tight
|
|
72
|
+
- ⚠️ **Options expiry < 7 days**: theta decay accelerates
|
|
73
|
+
- ⚠️ **Penny stock (< $5)**: high spread, manipulation risk
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: technical-analysis
|
|
3
|
+
description: Use when analyzing stock price action, identifying trends, interpreting RSI/MACD/Bollinger signals, or making buy/sell timing decisions based on technical indicators.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Technical Analysis Skill
|
|
7
|
+
|
|
8
|
+
## Indicator Interpretation
|
|
9
|
+
|
|
10
|
+
### RSI (Relative Strength Index, 14-period default)
|
|
11
|
+
- **< 30** → Oversold. Potential reversal buying opportunity. Confirm with volume spike.
|
|
12
|
+
- **30–50** → Bearish momentum. Avoid new longs unless trend reversing.
|
|
13
|
+
- **50–70** → Neutral-to-bullish. Trend following zone.
|
|
14
|
+
- **> 70** → Overbought. Consider tightening stops or taking profits.
|
|
15
|
+
- **Divergence**: Price makes new high but RSI doesn't → bearish divergence (strong sell signal).
|
|
16
|
+
|
|
17
|
+
### MACD
|
|
18
|
+
- **Signal line crossover above** → Bullish momentum building. Entry signal.
|
|
19
|
+
- **Signal line crossover below** → Bearish. Consider exit or short.
|
|
20
|
+
- **Histogram expanding** → Trend strengthening.
|
|
21
|
+
- **Histogram contracting** → Trend weakening, watch for reversal.
|
|
22
|
+
- Always pair with price action — MACD lags.
|
|
23
|
+
|
|
24
|
+
### Bollinger Bands
|
|
25
|
+
- **Price touches upper band** → Overbought short-term. Possible mean reversion.
|
|
26
|
+
- **Price touches lower band** → Oversold. Possible bounce.
|
|
27
|
+
- **Band squeeze (narrow bands)** → Volatility contraction → breakout incoming (direction unknown).
|
|
28
|
+
- **Band expansion** → Trend acceleration.
|
|
29
|
+
|
|
30
|
+
## Workflow: Full Technical Read
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
1. get_equity_quotes → current price, daily change
|
|
34
|
+
2. get_equity_technical_indicators(symbol, "rsi") → RSI
|
|
35
|
+
3. get_equity_technical_indicators(symbol, "macd") → MACD + signal
|
|
36
|
+
4. get_equity_historicals(symbol, interval="day", span="month") → 30d trend
|
|
37
|
+
5. Synthesize: trend direction + momentum + overbought/oversold
|
|
38
|
+
6. State: BULLISH / BEARISH / NEUTRAL with confidence level
|
|
39
|
+
7. If actionable: suggest entry price, stop-loss, target
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Output Format
|
|
43
|
+
|
|
44
|
+
Always present a structured summary:
|
|
45
|
+
|
|
46
|
+
| Signal | Value | Interpretation |
|
|
47
|
+
|--------|-------|----------------|
|
|
48
|
+
| Price | $X.XX | +/-X% today |
|
|
49
|
+
| RSI | XX | Neutral/OB/OS |
|
|
50
|
+
| MACD | Cross | Bullish/Bearish |
|
|
51
|
+
| Trend | 30d | Up/Down/Sideways |
|
|
52
|
+
|
|
53
|
+
**Verdict**: BULLISH / BEARISH / NEUTRAL
|
|
54
|
+
**Entry**: $X.XX | **Stop**: $X.XX | **Target**: $X.XX
|
|
55
|
+
|
|
56
|
+
## Rules
|
|
57
|
+
- Never make a recommendation without checking at least RSI + price trend.
|
|
58
|
+
- Always note if market is closed and data is from the previous session.
|
|
59
|
+
- Flag earnings within 2 weeks as high-risk — avoid new positions before earnings.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"""agenthood — Robinhood trading agent powered by agentu + Robinhood MCP."""
|
|
2
|
+
|
|
3
|
+
from .agent import AgentHood
|
|
4
|
+
from .config import AgentHoodConfig, load_config
|
|
5
|
+
from .hooks import trading_guard
|
|
6
|
+
|
|
7
|
+
__version__ = "0.1.0"
|
|
8
|
+
__all__ = ["AgentHood", "AgentHoodConfig", "load_config", "trading_guard"]
|