美味代理:TastyTrade MCP服务器

TastyTrade经纪账户的模型上下文协议服务器。使LLM能够监控投资组合、分析头寸和执行交易。具有自动IV分析提示和内置速率限制(2次请求/秒),以防止API错误。
认证
OAuth设置:
- 在以下位置创建OAuth应用程序https://my.tastytrade.com/app.html#/manage/api-访问/oauth应用程序
- 检查所有范围,保存您的客户端ID和客户端密码
- 在OAuth应用程序设置中创建“新的个人OAuth授权”(检查所有范围)
- 复制生成的刷新令牌
- 使用您的凭据配置MCP服务器(请参阅下面的使用部分)
MCP工具
账户和投资组合
account_overview(include=["balances","positions"])-账户余额(包括净清算价值)和未结头寸。
市场数据与研究
get_quotes(instruments, timeout=10.0)-通过DXLink流媒体实时报价股票、期权、期货和指数get_greeks(options, timeout=10.0)-通过DXLink流媒体提供希腊语(delta、gamma、theta、vega、rho)选项get_market_metrics(symbols)-IV等级、百分位数、贝塔系数、多种交易品种的流动性market_status(exchanges=['Equity'])-市场时间、状态、假期和当前纽约时间(“股票”、“芝加哥商品交易所”、“CFE”、“Smalls”)search_symbols(symbol, limit=10)-按名称/股票代码搜索交易品种
历史
get_history(type, days=None, underlying_symbol=None, transaction_type=None, page_offset=0, limit=25)-交易历史(type="transactions",默认90天)或订单历史记录(type="orders",默认为7天)。分页--使用page_offset和limit对于大型结果集。按以下条件筛选交易"Trade"或"Money Movement".
订单管理
place_order(legs, target_value=None, time_in_force="Day", dry_run=false)-仅使用基于报价的中间价下多段订单。该工具获取精确解析工具的实时报价,计算已签名的净中间价,根据买卖护栏验证最终限额,并可选择从以下位置确定数量target_value.
- quantity 是实际的股份/合同数量。 target_value=50000 根据报价衍生定价确定股票或股票期权订单的规模;省略 quantity 对于单腿目标值订单。适用于多腿点差 target_value,使用 quantity 仅表示腿比,如1:1或2:1。 - 在提交之前,订单价格与经纪商的有效勾选网格对齐。期权订单需要tastytrade期权报价单大小数据;如果它不可用,则该工具在放置之前会失败,而不是提交无效的价格增量。 - 订单操作遵循tastytrade Python SDK合约:股票和期权使用 Buy to Open, Buy to Close, Sell to Open,或 Sell to Close;期货使用 Buy 或 Sell.
replace_order(order_id)-在当前报价中间重新报价现有的实时订单。cancel_order(order_id)-取消订单。list_orders()-获取所有实时订单。- 工具输出简洁:报价表包括可操作的出价/要价/中等/大小字段;订单结果包括紧凑订单、购买力、费用、警告/错误和规模汇总。
观察名单管理
watchlist(action, ...)-统一观察名单管理:
- action="list" -没有 name 返回紧凑的监视列表元数据(name, group, symbol_count);与 name,返回紧凑的符号条目。 - action="add" -将符号添加到观察列表(如果不存在则创建) - action="remove" -从监视列表中删除符号 - action="delete" -删除监视列表
MCP提示
- 四、排名分析 -自动提示分析各个职位和观察名单中的IV级极端情况,以寻找进入/退出机会
用法
本地(stdio)
添加到您的MCP客户端配置中(例如。, claude_desktop_config.json):
{
"mcpServers": {
"tastytrade": {
"command": "uvx",
"args": ["tasty-agent"],
"env": {
"TASTYTRADE_CLIENT_SECRET": "your_client_secret",
"TASTYTRADE_REFRESH_TOKEN": "your_refresh_token",
"TASTYTRADE_ACCOUNT_ID": "your_account_id"
}
}
}
}远程(模态)
在上部署为远程MCP服务器 模态 使用代理身份验证:
uvx modal setup
# Create secrets
uvx modal secret create tasty-agent-secrets \
TASTYTRADE_CLIENT_SECRET=your_secret \
TASTYTRADE_REFRESH_TOKEN=your_token
# Create a proxy auth token at https://modal.com/settings/proxy-auth-tokens
# Export your workspace host
export MODAL_HOST=--tasty-agent-mcp-server.modal.run
# Deploy
uvx modal deploy examples/modal_deploy.py客户端通过以下方式进行身份验证 Modal-Key 和 Modal-Secret 标题。看 examples/modal_deploy.py.
程序化(Python客户端)
连接到远程美味代理并直接调用工具:
# List all tools
uv run examples/mcp_client.py
# Call a tool
uv run examples/mcp_client.py market_status
uv run examples/mcp_client.py get_market_metrics '{"symbols": ["AAPL", "SPY"]}'看 examples/mcp_client.py 获取完整的客户端代码。
例子
"Get my account balances and current positions"
"What's my net liquidating value?"
"Get real-time quotes for SPY and AAPL"
"Get quotes for TQQQ C option with strike 100 expiring 2026-01-16"
"Get Greeks for AAPL P option with strike 150 expiring 2024-12-20"
"Buy to open 100 AAPL shares at mid"
"Buy to open 17 TQQQ calls, strike 100, exp 2026-01-16"
"Buy $50K of TSLA calls, strike 300, exp 2026-01-16"
"Place a call spread: buy to open AAPL 150C and sell to open AAPL 155C, both exp 2024-12-20"
"Buy 1 /ESM26 future at mid"
"Reprice order 12345 at mid"
"Cancel order 12345"
"Show my live orders"
"Get my trading history from January"
"Get my order history for SPY"
"Get my private watchlists"
"Add TSLA and NVDA to my tech watchlist"发展
# Run tests
uv run pytest
# Interactive chat client (requires .env with credentials + OPENAI_API_KEY)
uv run examples/chat.py
# Debug with MCP inspector
npx @modelcontextprotocol/inspector uvx tasty-agent许可证
麻省理工学院
