robinhood-for-agents
AI-native Robinhood trading interface. No MCP server required — this skill works standalone via the TypeScript client API and bun.
How to Use
Run Robinhood operations by executing TypeScript code with bun. The robinhood-for-agents npm package provides a full client library — just import it and call methods:
CODEBLOCK0
See client-api.md for all available methods and signatures.
MCP users: If you have the robinhood-for-agents MCP server configured, you may use MCP tools instead. See reference.md for tool parameters. MCP is optional — the client API above does everything the MCP tools do.
CRITICAL SAFETY RULES
- 1. Always confirm before placing any order — show order preview, get explicit "yes"
- Show current price before order confirmation so user knows the cost
- Never place orders without user confirmation
- Fund transfers and bank operations are BLOCKED — refuse these requests
- Never place bulk cancel operations — cancel orders one at a time
BLOCKED Operations (never use)
- - Bulk cancel operations
- Fund transfers (withdraw/deposit)
- Bank unlinking
Routing
| User Intent | Domain File | Example Triggers |
|---|
| Auth / login / connect | setup.md | "setup robinhood", "connect to robinhood", "robinhood login" |
| Portfolio / holdings / positions |
portfolio.md | "show my portfolio", "my holdings", "account summary" |
| Stock research / analysis |
research.md | "research AAPL", "analyze TSLA", "due diligence on NVDA" |
| Buy / sell / orders / cancel |
trade.md | "buy 10 shares of AAPL", "sell my TSLA", "cancel my order" |
| Options / calls / puts / chains |
options.md | "show AAPL options", "SPX calls", "0DTE options", "covered calls" |
Read the corresponding domain file for detailed workflow instructions.
Authentication Prerequisite
Before any data-fetching or trading operation, verify the session is active:
bun -e 'import { getClient } from "robinhood-for-agents"; const rh = getClient(); await rh.restoreSession(); console.log("ok");'
If it throws, follow
setup.md to authenticate.
Client Method Inventory
| Method | Category | Description |
|---|
| INLINECODE4 | Auth | Restore/validate session (throws if not authenticated) |
| INLINECODE5 |
Account | Account details and preferences |
|
getAccounts() | Account | All brokerage accounts |
|
buildHoldings(opts?) | Portfolio | Holdings with P&L, equity, buying power |
|
getCryptoPositions() | Crypto | Crypto holdings |
|
getCryptoQuote(symbol) | Crypto | Current crypto price |
|
getQuotes(symbols) | Research | Stock quotes (price, bid/ask, P/E) |
|
getFundamentals(symbols) | Research | Market cap, 52-week range, sector |
|
getNews(symbol) | Research | Recent news articles |
|
getRatings(symbol) | Research | Analyst buy/hold/sell ratings |
|
getEarnings(symbol) | Research | Quarterly EPS history |
|
getStockHistoricals(symbols, opts?) | Research | OHLCV price history |
|
findInstruments(query) | Research | Search stocks by keyword |
|
getChains(symbol) | Options | Option chain expirations |
|
findTradableOptions(symbol, opts?) | Options | Option instruments by expiration/strike/type |
|
getOptionMarketData(symbol, exp, strike, type) | Options | Greeks and pricing |
|
getIndexValue(symbol) | Options | Current index value (SPX, NDX, etc.) |
|
getMovers() | Markets | Top market movers |
|
orderStock(symbol, qty, side, opts?) | Trading | Place stock order |
|
orderOption(symbol, legs, price, qty, dir, opts?) | Trading | Place option order |
|
orderCrypto(symbol, side, amount, opts?) | Trading | Place crypto order |
|
getAllStockOrders() /
getOpenStockOrders() | Trading | View stock orders |
|
cancelStockOrder(id) | Trading | Cancel stock order |
|
getStockOrder(id) | Trading | Check order fill status |
Important Notes
- - Do NOT use
phoenix.robinhood.com — use api.robinhood.com endpoints only - Multi-account is first-class: always ask which account when multiple exist
- Session tokens expire ~24h; the client auto-refreshes before requiring re-auth
robinhood-for-agents
AI原生Robinhood交易界面。无需MCP服务器——此技能通过TypeScript客户端API和bun独立运行。
使用方法
通过使用bun执行TypeScript代码来运行Robinhood操作。robinhood-for-agents npm包提供了完整的客户端库——只需导入并调用方法:
bash
bun -e
import { getClient } from robinhood-for-agents;
const rh = getClient();
await rh.restoreSession();
// 调用任意方法,以JSON格式打印结果
const holdings = await rh.buildHoldings();
console.log(JSON.stringify(holdings, null, 2));
所有可用方法及签名请参见client-api.md。
MCP用户: 如果您已配置robinhood-for-agents MCP服务器,可以使用MCP工具替代。工具参数请参见reference.md。MCP为可选项——上述客户端API可完成MCP工具的所有功能。
关键安全规则
- 1. 在下单前务必确认——显示订单预览,获取明确的是回复
- 在订单确认前显示当前价格,以便用户了解成本
- 未经用户确认绝不执行下单
- 资金转账和银行操作已被阻止——拒绝此类请求
- 绝不执行批量取消操作——逐个取消订单
被阻止的操作(切勿使用)
- - 批量取消操作
- 资金转账(提现/存入)
- 解除银行绑定
路由
| 用户意图 | 领域文件 | 示例触发词 |
|---|
| 认证/登录/连接 | setup.md | 设置Robinhood、连接Robinhood、Robinhood登录 |
| 投资组合/持仓/头寸 |
portfolio.md | 显示我的投资组合、我的持仓、账户摘要 |
| 股票研究/分析 |
research.md | 研究AAPL、分析TSLA、对NVDA进行尽职调查 |
| 买入/卖出/订单/取消 |
trade.md | 买入10股AAPL、卖出我的TSLA、取消我的订单 |
| 期权/看涨/看跌/链 |
options.md | 显示AAPL期权、SPX看涨、0DTE期权、备兑开仓 |
详细工作流程说明请阅读相应的领域文件。
认证前提
在执行任何数据获取或交易操作前,验证会话是否活跃:
bash
bun -e import { getClient } from robinhood-for-agents; const rh = getClient(); await rh.restoreSession(); console.log(ok);
如果抛出异常,请按照setup.md进行认证。
客户端方法清单
| 方法 | 类别 | 描述 |
|---|
| restoreSession() | 认证 | 恢复/验证会话(未认证时抛出异常) |
| getAccountProfile() |
账户 | 账户详情和偏好设置 |
| getAccounts() | 账户 | 所有经纪账户 |
| buildHoldings(opts?) | 投资组合 | 持仓信息(含盈亏、权益、购买力) |
| getCryptoPositions() | 加密货币 | 加密货币持仓 |
| getCryptoQuote(symbol) | 加密货币 | 当前加密货币价格 |
| getQuotes(symbols) | 研究 | 股票报价(价格、买卖价、市盈率) |
| getFundamentals(symbols) | 研究 | 市值、52周范围、行业 |
| getNews(symbol) | 研究 | 最新新闻文章 |
| getRatings(symbol) | 研究 | 分析师买入/持有/卖出评级 |
| getEarnings(symbol) | 研究 | 季度每股收益历史 |
| getStockHistoricals(symbols, opts?) | 研究 | OHLCV价格历史 |
| findInstruments(query) | 研究 | 按关键词搜索股票 |
| getChains(symbol) | 期权 | 期权链到期日 |
| findTradableOptions(symbol, opts?) | 期权 | 按到期日/行权价/类型查找期权工具 |
| getOptionMarketData(symbol, exp, strike, type) | 期权 | 希腊值和定价 |
| getIndexValue(symbol) | 期权 | 当前指数值(SPX、NDX等) |
| getMovers() | 市场 | 市场热门涨跌股 |
| orderStock(symbol, qty, side, opts?) | 交易 | 下达股票订单 |
| orderOption(symbol, legs, price, qty, dir, opts?) | 交易 | 下达期权订单 |
| orderCrypto(symbol, side, amount, opts?) | 交易 | 下达加密货币订单 |
| getAllStockOrders() / getOpenStockOrders() | 交易 | 查看股票订单 |
| cancelStockOrder(id) | 交易 | 取消股票订单 |
| getStockOrder(id) | 交易 | 检查订单成交状态 |
重要说明
- - 请勿使用phoenix.robinhood.com——仅使用api.robinhood.com端点
- 多账户为一级支持:存在多个账户时始终询问使用哪个账户
- 会话令牌约24小时过期;客户端在需要重新认证前会自动刷新