alpaca-trading-mcp
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAlpaca Trading MCP
Alpaca Trading MCP
Skill by ara.so — MCP Skills collection.
Alpaca MCP Server is an official Model Context Protocol server that enables natural language trading operations through AI assistants. It provides comprehensive access to Alpaca's Trading API for stocks, options, crypto, portfolio management, and real-time market data. Built with FastMCP and OpenAPI, this is a complete v2 rewrite with spec-aligned tooling.
由ara.so开发的Skill——属于MCP Skills集合。
Alpaca MCP Server是官方的Model Context Protocol服务器,支持通过AI助手以自然语言执行交易操作。它提供对Alpaca交易API的全面访问,涵盖股票、期权、加密货币、投资组合管理及实时市场数据。基于FastMCP和OpenAPI构建,这是完全重写的v2版本,工具与规范保持一致。
What It Does
功能介绍
- Market Data Access: Real-time and historical quotes, trades, bars for stocks, crypto, and options
- Trading Operations: Place market, limit, stop, trailing-stop orders for any supported asset
- Options Trading: Search contracts, place single/multi-leg strategies, get Greeks and IV
- Portfolio Management: View account info, positions, buying power, portfolio history
- Watchlist Management: Create, update, and manage custom watchlists
- News & Corporate Actions: Access market news and corporate action announcements
- 市场数据访问:获取股票、加密货币和期权的实时及历史报价、交易记录、K线数据
- 交易操作:为所有支持的资产下达市价单、限价单、止损单、追踪止损单
- 期权交易:搜索合约、下达单腿/多腿策略订单、获取希腊值及隐含波动率
- 投资组合管理:查看账户信息、持仓情况、购买力、投资组合历史
- 自选股管理:创建、更新和管理自定义自选股列表
- 资讯与公司行动:获取市场资讯及公司行动公告
Installation
安装步骤
Prerequisites
前置要求
- Python 3.10+
- uv package manager:
curl -LsSf https://astral.sh/uv/install.sh | sh - Alpaca API keys (free paper trading account at https://app.alpaca.markets)
- An MCP-compatible client (Claude Desktop, Cursor, VS Code, etc.)
- Python 3.10+
- uv包管理器:
curl -LsSf https://astral.sh/uv/install.sh | sh - Alpaca API密钥(可在https://app.alpaca.markets免费开通模拟交易账户)
- 兼容MCP的客户端(Claude Desktop、Cursor、VS Code等)
Configuration
配置
Add to your MCP client configuration file:
Claude Desktop ( on Mac):
~/Library/Application Support/Claude/claude_desktop_config.jsonjson
{
"mcpServers": {
"alpaca": {
"command": "uvx",
"args": ["alpaca-mcp-server"],
"env": {
"ALPACA_API_KEY": "your_alpaca_api_key",
"ALPACA_SECRET_KEY": "your_alpaca_secret_key",
"ALPACA_PAPER_TRADE": "true"
}
}
}
}Cursor ():
~/.cursor/mcp.jsonjson
{
"mcpServers": {
"alpaca": {
"command": "uvx",
"args": ["alpaca-mcp-server"],
"env": {
"ALPACA_API_KEY": "your_alpaca_api_key",
"ALPACA_SECRET_KEY": "your_alpaca_secret_key",
"ALPACA_PAPER_TRADE": "true"
}
}
}
}VS Code ( in project root):
.vscode/mcp.jsonjson
{
"mcp": {
"servers": {
"alpaca": {
"type": "stdio",
"command": "uvx",
"args": ["alpaca-mcp-server"],
"env": {
"ALPACA_API_KEY": "your_alpaca_api_key",
"ALPACA_SECRET_KEY": "your_alpaca_secret_key",
"ALPACA_PAPER_TRADE": "true"
}
}
}
}
}Claude Code CLI:
bash
claude mcp add alpaca --scope user --transport stdio uvx alpaca-mcp-server \
--env ALPACA_API_KEY=your_alpaca_api_key \
--env ALPACA_SECRET_KEY=your_alpaca_secret_key \
--env ALPACA_PAPER_TRADE=true将以下内容添加到你的MCP客户端配置文件:
Claude Desktop(Mac系统路径:):
~/Library/Application Support/Claude/claude_desktop_config.jsonjson
{
"mcpServers": {
"alpaca": {
"command": "uvx",
"args": ["alpaca-mcp-server"],
"env": {
"ALPACA_API_KEY": "your_alpaca_api_key",
"ALPACA_SECRET_KEY": "your_alpaca_secret_key",
"ALPACA_PAPER_TRADE": "true"
}
}
}
}Cursor(路径:):
~/.cursor/mcp.jsonjson
{
"mcpServers": {
"alpaca": {
"command": "uvx",
"args": ["alpaca-mcp-server"],
"env": {
"ALPACA_API_KEY": "your_alpaca_api_key",
"ALPACA_SECRET_KEY": "your_alpaca_secret_key",
"ALPACA_PAPER_TRADE": "true"
}
}
}
}VS Code(项目根目录下的):
.vscode/mcp.jsonjson
{
"mcp": {
"servers": {
"alpaca": {
"type": "stdio",
"command": "uvx",
"args": ["alpaca-mcp-server"],
"env": {
"ALPACA_API_KEY": "your_alpaca_api_key",
"ALPACA_SECRET_KEY": "your_alpaca_secret_key",
"ALPACA_PAPER_TRADE": "true"
}
}
}
}
}Claude Code CLI:
bash
claude mcp add alpaca --scope user --transport stdio uvx alpaca-mcp-server \
--env ALPACA_API_KEY=your_alpaca_api_key \
--env ALPACA_SECRET_KEY=your_alpaca_secret_key \
--env ALPACA_PAPER_TRADE=trueEnvironment Variables
环境变量
| Variable | Required | Default | Description |
|---|---|---|---|
| Yes | — | Your Alpaca API key |
| Yes | — | Your Alpaca secret key |
| No | | Set to |
| No | all | Comma-separated toolsets to enable |
| 变量名 | 是否必填 | 默认值 | 描述 |
|---|---|---|---|
| 是 | — | 你的Alpaca API密钥 |
| 是 | — | 你的Alpaca密钥 |
| 否 | | 设置为 |
| 否 | all | 启用的工具集,以逗号分隔 |
Toolset Filtering
工具集过滤
Restrict available tools by setting :
ALPACA_TOOLSETSjson
{
"env": {
"ALPACA_TOOLSETS": "account,trading,stock-data"
}
}Available toolsets:
- : Account info, portfolio history, activities
account - : Orders, positions, options exercise
trading - : Watchlist CRUD operations
watchlists - : Asset lookup, option contracts, market calendar
assets - : Stock bars, quotes, trades, snapshots
stock-data - : Crypto bars, quotes, trades, orderbooks
crypto-data - : Option bars, quotes, Greeks, chain
options-data - : Corporate action announcements
corporate-actions - : News articles
news
通过设置限制可用工具:
ALPACA_TOOLSETSjson
{
"env": {
"ALPACA_TOOLSETS": "account,trading,stock-data"
}
}可用工具集:
- :账户信息、投资组合历史、交易活动
account - :订单、持仓、期权行权
trading - :自选股增删改查操作
watchlists - :资产查询、期权合约、市场日历
assets - :股票K线、报价、交易记录、快照
stock-data - :加密货币K线、报价、交易记录、订单簿
crypto-data - :期权K线、报价、希腊值、合约链
options-data - :公司行动公告
corporate-actions - :资讯文章
news
Core Trading Operations
核心交易操作
Check Account Status
查看账户状态
python
undefinedpython
undefinedNatural language prompts:
自然语言指令示例:
"What's my current account balance?"
"我当前的账户余额是多少?"
"Show my buying power"
"显示我的可用购买力"
"Am I approved for options trading?"
"我是否已开通期权交易权限?"
The MCP server exposes get_account_info tool
MCP服务器暴露get_account_info工具
Returns: account_number, status, buying_power, cash, portfolio_value, etc.
返回内容:account_number、status、buying_power、cash、portfolio_value等
undefinedundefinedPlace Stock Orders
下达股票订单
python
undefinedpython
undefinedNatural language prompts:
自然语言指令示例:
"Buy 100 shares of AAPL at market price"
"以市价买入100股AAPL"
"Place a limit order to buy TSLA at $250"
"下达限价单,以250美元买入TSLA"
"Sell 50 shares of NVDA with a trailing stop at 2%"
"以2%的追踪止损卖出50股NVDA"
Market order
市价单
Tool: post_orders
工具:post_orders
Parameters: {
参数:{
"symbol": "AAPL",
"symbol": "AAPL",
"qty": 100,
"qty": 100,
"side": "buy",
"side": "buy",
"type": "market",
"type": "market",
"time_in_force": "day"
"time_in_force": "day"
}
}
Limit order
限价单
Parameters: {
参数:{
"symbol": "TSLA",
"symbol": "TSLA",
"qty": 10,
"qty": 10,
"side": "buy",
"side": "buy",
"type": "limit",
"type": "limit",
"limit_price": 250.00,
"limit_price": 250.00,
"time_in_force": "gtc"
"time_in_force": "gtc"
}
}
Trailing stop
追踪止损单
Parameters: {
参数:{
"symbol": "NVDA",
"symbol": "NVDA",
"qty": 50,
"qty": 50,
"side": "sell",
"side": "sell",
"type": "trailing_stop",
"type": "trailing_stop",
"trail_percent": 2.0,
"trail_percent": 2.0,
"time_in_force": "gtc"
"time_in_force": "gtc"
}
}
undefinedundefinedGet Real-Time Market Data
获取实时市场数据
python
undefinedpython
undefinedNatural language prompts:
自然语言指令示例:
"What's the current price of AAPL?"
"AAPL当前价格是多少?"
"Show me the latest BTC quote"
"显示BTC最新报价"
"Get today's price bars for MSFT in 5-minute intervals"
"获取MSFT今日5分钟间隔的K线数据"
Latest quote
最新报价
Tool: get_stocks_quotes_latest
工具:get_stocks_quotes_latest
Parameters: {"symbols": "AAPL,MSFT,GOOGL"}
参数:{"symbols": "AAPL,MSFT,GOOGL"}
Crypto quote
加密货币报价
Tool: get_crypto_quotes_latest
工具:get_crypto_quotes_latest
Parameters: {"symbols": "BTC/USD,ETH/USD"}
参数:{"symbols": "BTC/USD,ETH/USD"}
Historical bars
历史K线
Tool: get_stocks_bars
工具:get_stocks_bars
Parameters: {
参数:{
"symbols": "MSFT",
"symbols": "MSFT",
"timeframe": "5Min",
"timeframe": "5Min",
"start": "2025-05-01T09:30:00Z",
"start": "2025-05-01T09:30:00Z",
"end": "2025-05-01T16:00:00Z"
"end": "2025-05-01T16:00:00Z"
}
}
undefinedundefinedOptions Trading
期权交易
python
undefinedpython
undefinedNatural language prompts:
自然语言指令示例:
"Find call options for AAPL expiring next month"
"查找AAPL下月到期的看涨期权"
"Place a covered call on my 100 shares of NVDA"
"为我的100股NVDA备兑看涨期权"
"Get the Greeks for SPY 500 calls expiring this Friday"
"获取SPY 500本周到期看涨期权的希腊值"
Search option contracts
搜索期权合约
Tool: get_options_contracts
工具:get_options_contracts
Parameters: {
参数:{
"underlying_symbols": "AAPL",
"underlying_symbols": "AAPL",
"expiration_date_gte": "2025-06-01",
"expiration_date_gte": "2025-06-01",
"expiration_date_lte": "2025-06-30",
"expiration_date_lte": "2025-06-30",
"type": "call"
"type": "call"
}
}
Place option order
下达期权订单
Tool: post_orders
工具:post_orders
Parameters: {
参数:{
"symbol": "AAPL250620C00150000",
"symbol": "AAPL250620C00150000",
"qty": 1,
"qty": 1,
"side": "sell_to_open",
"side": "sell_to_open",
"type": "limit",
"type": "limit",
"limit_price": 5.50,
"limit_price": 5.50,
"time_in_force": "day",
"time_in_force": "day",
"class": "option"
"class": "option"
}
}
Get option snapshot with Greeks
获取带希腊值的期权快照
Tool: get_options_snapshots
工具:get_options_snapshots
Parameters: {"symbols": "SPY250516C00500000"}
参数:{"symbols": "SPY250516C00500000"}
Returns: greeks (delta, gamma, theta, vega), implied_volatility, latest_quote
返回内容:greeks(delta、gamma、theta、vega)、implied_volatility、latest_quote
undefinedundefinedManage Positions
持仓管理
python
undefinedpython
undefinedNatural language prompts:
自然语言指令示例:
"Show all my open positions"
"显示我所有的未平仓头寸"
"What's my position in AAPL?"
"我持有多少AAPL?"
"Close half of my TSLA position"
"平掉一半的TSLA持仓"
Get all positions
获取所有持仓
Tool: get_positions
工具:get_positions
Get specific position
获取特定持仓
Tool: get_positions_by_symbol_or_asset_id
工具:get_positions_by_symbol_or_asset_id
Parameters: {"symbol_or_asset_id": "AAPL"}
参数:{"symbol_or_asset_id": "AAPL"}
Close position
平仓
Tool: delete_positions_by_symbol_or_asset_id
工具:delete_positions_by_symbol_or_asset_id
Parameters: {
参数:{
"symbol_or_asset_id": "TSLA",
"symbol_or_asset_id": "TSLA",
"percentage": 50 # Optional: close percentage
"percentage": 50 # 可选:平仓比例
}
}
undefinedundefinedWatchlist Management
自选股管理
python
undefinedpython
undefinedNatural language prompts:
自然语言指令示例:
"Create a tech stocks watchlist with AAPL, MSFT, GOOGL"
"创建包含AAPL、MSFT、GOOGL的科技股自选股列表"
"Add TSLA to my tech watchlist"
"把TSLA添加到我的科技股自选股"
"Show me all my watchlists"
"显示我所有的自选股列表"
Create watchlist
创建自选股
Tool: post_watchlists
工具:post_watchlists
Parameters: {
参数:{
"name": "Tech Stocks",
"name": "Tech Stocks",
"symbols": ["AAPL", "MSFT", "GOOGL"]
"symbols": ["AAPL", "MSFT", "GOOGL"]
}
}
Get all watchlists
获取所有自选股
Tool: get_watchlists
工具:get_watchlists
Add symbol to watchlist
向自选股添加标的
Tool: post_watchlists_by_watchlist_id
工具:post_watchlists_by_watchlist_id
Parameters: {
参数:{
"watchlist_id": "uuid-here",
"watchlist_id": "uuid-here",
"symbol": "TSLA"
"symbol": "TSLA"
}
}
undefinedundefinedAdvanced Market Data Queries
高级市场数据查询
Screen Stocks
股票筛选
python
undefinedpython
undefinedNatural language prompts:
自然语言指令示例:
"Find the most active stocks today"
"找出今日成交量最高的股票"
"Show me top gainers with volume over 1M"
"显示成交量超过100万的涨幅榜"
Tool: get_screener_stocks_most_actives
工具:get_screener_stocks_most_actives
Parameters: {
参数:{
"by": "volume",
"by": "volume",
"top": 10
"top": 10
}
}
Tool: get_screener_stocks_movers
工具:get_screener_stocks_movers
Parameters: {
参数:{
"market_type": "stocks",
"market_type": "stocks",
"top": 20
"top": 20
}
}
undefinedundefinedGet News
获取资讯
python
undefinedpython
undefinedNatural language prompts:
自然语言指令示例:
"Show me latest news about AAPL"
"显示AAPL的最新资讯"
"Get crypto news for Bitcoin"
"获取比特币的加密货币资讯"
Stock news
股票资讯
Tool: get_news
工具:get_news
Parameters: {
参数:{
"symbols": "AAPL",
"symbols": "AAPL",
"limit": 10,
"limit": 10,
"sort": "desc"
"sort": "desc"
}
}
Crypto news
加密货币资讯
Tool: get_crypto_news
工具:get_crypto_news
Parameters: {
参数:{
"symbols": "BTC",
"symbols": "BTC",
"limit": 10
"limit": 10
}
}
undefinedundefinedCorporate Actions
公司行动
python
undefinedpython
undefinedNatural language prompts:
自然语言指令示例:
"Are there any upcoming stock splits?"
"近期有哪些股票拆分计划?"
"Show dividend announcements for next week"
"显示下周的股息公告"
Tool: get_corporate_actions_announcements
工具:get_corporate_actions_announcements
Parameters: {
参数:{
"ca_types": "dividend,split",
"ca_types": "dividend,split",
"since": "2025-05-01",
"since": "2025-05-01",
"until": "2025-05-31"
"until": "2025-05-31"
}
}
undefinedundefinedPortfolio Analysis
投资组合分析
Get Portfolio History
获取投资组合历史
python
undefinedpython
undefinedNatural language prompts:
自然语言指令示例:
"Show my portfolio performance over the last month"
"显示我过去一个月的投资组合表现"
"Graph my portfolio value for the past year"
"绘制我过去一年的投资组合价值走势"
Tool: get_account_portfolio_history
工具:get_account_portfolio_history
Parameters: {
参数:{
"period": "1M",
"period": "1M",
"timeframe": "1D"
"timeframe": "1D"
}
}
Returns: timestamp, equity, profit_loss, profit_loss_pct arrays
返回内容:timestamp、equity、profit_loss、profit_loss_pct数组
undefinedundefinedAccount Activities
账户活动
python
undefinedpython
undefinedNatural language prompts:
自然语言指令示例:
"Show my recent trades"
"显示我最近的交易记录"
"List all dividend payments this month"
"列出本月所有的股息支付"
Tool: get_account_activities
工具:get_account_activities
Parameters: {
参数:{
"activity_types": "FILL,DIV",
"activity_types": "FILL,DIV",
"after": "2025-05-01T00:00:00Z",
"after": "2025-05-01T00:00:00Z",
"direction": "desc"
"direction": "desc"
}
}
undefinedundefinedCommon Patterns
常见使用模式
Multi-Symbol Quotes
多标的报价
python
undefinedpython
undefinedGet quotes for multiple symbols at once
同时获取多个标的的报价
"Get current prices for AAPL, MSFT, GOOGL, AMZN"
"获取AAPL、MSFT、GOOGL、AMZN的当前价格"
Tool: get_stocks_quotes_latest
工具:get_stocks_quotes_latest
Parameters: {"symbols": "AAPL,MSFT,GOOGL,AMZN"}
参数:{"symbols": "AAPL,MSFT,GOOGL,AMZN"}
Use feed parameter for realtime: "feed": "sip"
使用feed参数获取实时数据:"feed": "sip"
undefinedundefinedBatch Order Placement
批量下单
python
undefinedpython
undefinedPlace multiple orders together
同时下达多个订单
"Buy 10 shares each of AAPL, MSFT, GOOGL at market"
"以市价各买入10股AAPL、MSFT、GOOGL"
Call post_orders tool 3 times or use a loop pattern
调用post_orders工具3次或使用循环模式
Each order is submitted individually through the API
每个订单通过API单独提交
undefinedundefinedConditional Order Logic
条件订单逻辑
python
undefinedpython
undefinedComplex strategies require multiple steps
复杂策略需要多步骤执行
"If AAPL drops below $150, buy 100 shares"
"如果AAPL跌破150美元,买入100股"
1. Monitor current price with get_stocks_quotes_latest
1. 使用get_stocks_quotes_latest监控当前价格
2. When condition met, call post_orders
2. 满足条件时调用post_orders
Note: Alpaca supports bracket/OCO orders natively:
注意:Alpaca原生支持括号单/OCO订单:
Use order_class: "bracket" with take_profit and stop_loss
使用order_class: "bracket"并设置take_profit和stop_loss
undefinedundefinedOptions Strategies
期权策略
python
undefinedpython
undefinedMulti-leg options spreads
多腿期权价差
"Create a bull call spread on SPY"
"创建SPY的牛市看涨价差"
Tool: post_orders with order_class: "multileg"
工具:post_orders,设置order_class: "multileg"
Parameters: {
参数:{
"symbol": "SPY",
"symbol": "SPY",
"type": "limit",
"type": "limit",
"time_in_force": "day",
"time_in_force": "day",
"order_class": "multileg",
"order_class": "multileg",
"legs": [
"legs": [
{"symbol": "SPY250620C00500000", "side": "buy_to_open", "qty": 1},
{"symbol": "SPY250620C00500000", "side": "buy_to_open", "qty": 1},
{"symbol": "SPY250620C00510000", "side": "sell_to_open", "qty": 1}
{"symbol": "SPY250620C00510000", "side": "sell_to_open", "qty": 1}
]
]
}
}
undefinedundefinedTroubleshooting
故障排查
Server Not Showing in MCP Client
MCP客户端中未显示服务器
- Restart your MCP client after editing config
- Check JSON syntax in your config file (trailing commas cause issues)
- Verify uv is installed:
uv --version - Check logs in client's developer console/logs
- 编辑配置后重启MCP客户端
- 检查配置文件的JSON语法(尾随逗号会导致问题)
- 验证uv已安装:
uv --version - 查看客户端开发者控制台/日志
Authentication Errors
认证错误
Error: 401 Unauthorized- Verify and
ALPACA_API_KEYare correctALPACA_SECRET_KEY - Ensure you're using paper trading keys if
ALPACA_PAPER_TRADE=true - Check if keys have necessary permissions in Alpaca dashboard
Error: 401 Unauthorized- 验证和
ALPACA_API_KEY是否正确ALPACA_SECRET_KEY - 如果,确保使用的是模拟交易密钥
ALPACA_PAPER_TRADE=true - 在Alpaca控制台检查密钥是否具备必要权限
Tool Not Found
工具未找到
Error: Tool 'old_tool_name' not found- You may be using v1 tool names. V2 is a complete rewrite.
- Clear MCP client cache and restart
- Start a fresh chat session
- Check Available Tools for current tool names
Error: Tool 'old_tool_name' not found- 你可能在使用v1版本的工具名称。v2是完全重写版本。
- 清除MCP客户端缓存并重启
- 开启新的会话
- 查看可用工具获取当前工具名称
Rate Limiting
速率限制
Error: 429 Too Many Requests- Alpaca API has rate limits (200 requests/minute for paper trading)
- Batch symbol queries when possible (comma-separated symbols)
- Add delays between rapid tool calls
- Upgrade to live account for higher limits
Error: 429 Too Many Requests- Alpaca API有速率限制(模拟交易为每分钟200次请求)
- 尽可能批量查询标的(以逗号分隔)
- 在频繁调用工具之间添加延迟
- 升级到实盘账户获取更高限制
Order Rejected
订单被拒绝
Error: insufficient buying power / position limit exceeded- Check account buying power:
get_account_info - Verify position limits haven't been hit
- For options, ensure account has appropriate trading level
- Check if market is open:
get_clock
Error: insufficient buying power / position limit exceeded- 查看账户购买力:
get_account_info - 验证是否已达到持仓限制
- 期权交易需确保账户具备相应交易等级
- 检查市场是否开盘:
get_clock
Market Data Gaps
市场数据缺失
Error: no data found for timeframe- Market may be closed (check )
get_clock - Symbol may not have data for requested timeframe
- Use for consolidated US market data
feed: "sip" - Crypto trades 24/7, stocks only during market hours (9:30-16:00 ET)
Error: no data found for timeframe- 市场可能已休市(检查)
get_clock - 标的可能没有请求时间范围内的数据
- 使用获取美国市场合并数据
feed: "sip" - 加密货币24小时交易,股票仅在交易时段(美国东部时间9:30-16:00)交易
V1 to V2 Migration
V1到V2迁移
If upgrading from v1:
- Remove any .env files — v2 uses env vars in MCP config only
- Delete v1 tool references in custom instructions/rules
- Restart MCP client to clear tool cache
- Start fresh session so LLM discovers new tools
- Update toolset filtering using env var
ALPACA_TOOLSETS
如果从v1版本升级:
- 删除所有.env文件——v2仅在MCP配置中使用环境变量
- 删除自定义指令/规则中的v1工具引用
- 重启MCP客户端清除工具缓存
- 开启新会话让LLM发现新工具
- 使用环境变量更新工具集过滤
ALPACA_TOOLSETS
Docker Issues
Docker问题
bash
undefinedbash
undefinedIf server fails to start in Docker
如果Docker中服务器启动失败
docker logs <container-id>
docker logs <container-id>
Check environment variables are passed
检查环境变量是否已传递
docker run --rm -e ALPACA_API_KEY=test mcp/alpaca:latest env | grep ALPACA
docker run --rm -e ALPACA_API_KEY=test mcp/alpaca:latest env | grep ALPACA
Test connection manually
手动测试连接
docker run --rm -i
-e ALPACA_API_KEY=your_key
-e ALPACA_SECRET_KEY=your_secret
-e ALPACA_PAPER_TRADE=true
mcp/alpaca:latest
-e ALPACA_API_KEY=your_key
-e ALPACA_SECRET_KEY=your_secret
-e ALPACA_PAPER_TRADE=true
mcp/alpaca:latest
undefineddocker run --rm -i
-e ALPACA_API_KEY=your_key
-e ALPACA_SECRET_KEY=your_secret
-e ALPACA_PAPER_TRADE=true
mcp/alpaca:latest
-e ALPACA_API_KEY=your_key
-e ALPACA_SECRET_KEY=your_secret
-e ALPACA_PAPER_TRADE=true
mcp/alpaca:latest
undefinedLive Trading
实盘交易
To switch from paper to live trading:
json
{
"env": {
"ALPACA_API_KEY": "your_live_api_key",
"ALPACA_SECRET_KEY": "your_live_secret_key",
"ALPACA_PAPER_TRADE": "false"
}
}⚠️ WARNING: Live trading uses real money. Test thoroughly in paper trading first. Markets are volatile and losses can exceed expectations.
从模拟交易切换到实盘交易:
json
{
"env": {
"ALPACA_API_KEY": "your_live_api_key",
"ALPACA_SECRET_KEY": "your_live_secret_key",
"ALPACA_PAPER_TRADE": "false"
}
}⚠️ 警告:实盘交易使用真实资金。请先在模拟交易中充分测试。市场波动剧烈,损失可能超出预期。
Additional Resources
额外资源
- Alpaca API Docs: https://docs.alpaca.markets/
- Paper Trading Dashboard: https://app.alpaca.markets/paper/dashboard/overview
- Live Trading Dashboard: https://app.alpaca.markets/brokerage/dashboard/overview
- Python SDK: https://alpaca.markets/sdks/python/
- MCP Specification: https://modelcontextprotocol.io/
- Community Forum: https://forum.alpaca.markets/
- Slack Community: https://alpaca.markets/slack
- Alpaca API文档:https://docs.alpaca.markets/
- 模拟交易控制台:https://app.alpaca.markets/paper/dashboard/overview
- 实盘交易控制台:https://app.alpaca.markets/brokerage/dashboard/overview
- Python SDK:https://alpaca.markets/sdks/python/
- MCP规范:https://modelcontextprotocol.io/
- 社区论坛:https://forum.alpaca.markets/
- Slack社区:https://alpaca.markets/slack
License
许可证
MIT License - Alpaca Markets
MIT License - Alpaca Markets