Yfinance 交易者 Mcp 工具 用於 Claude 桌面
概覽
什麼是 YFinance-Trader-MCP-ClaudeDesktop?
YFinance-Trader-MCP-ClaudeDesktop 是一個專為股市愛好者和交易者設計的強大工具。它利用 yfinance 庫提供即時的股市數據和交易能力。這個工具專門為 Claude Desktop 調整,使其對於希望無縫分析和交易股票的人來說,既友好又高效。
YFinance-Trader-MCP-ClaudeDesktop 的特點
- 即時數據訪問:獲取即時的股市數據,包括價格、歷史數據和財務指標。
- 交易能力:通過應用程序直接執行交易,根據即時數據快速做出決策。
- 友好的用戶界面:設計簡單易用,界面直觀,讓新手和經驗豐富的交易者都能輕鬆使用。
- 可自定義警報:設置特定股票變動或價格變化的警報,以便隨時了解市場狀況。
- 全面的分析:使用各種指標和可視化工具分析股票表現,以便做出明智的交易決策。
如何使用 YFinance-Trader-MCP-ClaudeDesktop
- 安裝:從官方庫下載並安裝 YFinance-Trader-MCP-ClaudeDesktop 應用程序。
- 設置:配置您的帳戶設置並連接到您的交易平台。
- 探索功能:熟悉儀表板,您可以在此查看股票數據、執行交易和設置警報。
- 開始交易:利用即時數據做出明智的交易決策,並直接從應用程序執行交易。
- 監控表現:跟踪您的投資並使用內置的分析工具分析表現。
常見問題
問:YFinance-Trader-MCP-ClaudeDesktop 是免費使用的嗎?
答:是的,這個工具是開源的,並且可以免費獲取。您可以從 GitHub 倉庫下載。
問:它支持哪些平台?
答:YFinance-Trader-MCP-ClaudeDesktop 專門為 Claude Desktop 設計,確保兼容性和最佳性能。
問:我可以自定義警報嗎?
答:可以,使用者可以設置特定股票變動或價格變化的可自定義警報,以便隨時更新。
問:股票數據更新的頻率是多少?
答:該應用程序提供即時數據,確保用戶擁有最新的交易決策信息。
問:我可以在哪裡找到支持或報告問題?
答:支持和問題報告可以通過 GitHub 倉庫的問題追蹤器進行,您還可以在那裡找到社區討論和更新。
詳細
YFinance Trader MCP Tool for Claude Desktop
An MCP (Model Context Protocol) tool that provides stock market data and trading capabilities using the yfinance library, specifically adapted for Claude Desktop.
Credit: This project was inspired by mcp-stocks by Luigi Ajah, which is a similar implementation for Cursor. This adaptation modifies the original concept to work with Claude Desktop.
Tutorial
For a detailed guide on setting up and using this tool, check out our Medium tutorial: Tutorial: Using Claude Desktop with YFinance Trader MCP Tool to Access Real-Time Stock Market Data
Features
- Real-time stock quotes
- Company information and financial metrics
- Historical price data
- Symbol search functionality
- Analyst recommendations
- Insider transaction tracking
Setup
-
Ensure you have Python 3.10 or higher installed
-
Install dependencies:
pip install -r requirements.txt
Integration with Claude Desktop
- Configure your MCP settings in Claude Desktop by adding the following to your MCP configuration:
{
"mcpServers": {
"yfinance-trader": {
"command": "py",
"args": ["-3.13", "path/to/your/main.py"]
}
}
}
- Replace the path with the full path to your main.py file
- Restart Claude Desktop if needed
Available Tools
1. get_stock_quote
Get real-time stock quote information:
{
"symbol": "AAPL",
"price": 150.25,
"change": 2.5,
"changePercent": 1.67,
"volume": 1234567,
"timestamp": "2024-03-20T10:30:00"
}
2. get_company_overview
Get company information and key metrics:
{
"name": "Apple Inc.",
"sector": "Technology",
"industry": "Consumer Electronics",
"marketCap": 2500000000000,
"peRatio": 25.4,
"forwardPE": 24.2,
"dividendYield": 0.65,
"52WeekHigh": 182.94,
"52WeekLow": 124.17
}
3. get_time_series_daily
Get historical daily price data:
{
"symbol": "AAPL",
"timeSeriesDaily": [
{
"date": "2024-03-20T00:00:00",
"open": 150.25,
"high": 152.30,
"low": 149.80,
"close": 151.75,
"volume": 12345678
}
// ... more data points
]
}
4. search_symbol
Search for stocks and other securities:
{
"results": [
{
"symbol": "AAPL",
"name": "Apple Inc.",
"type": "EQUITY",
"exchange": "NASDAQ"
}
// ... more results
]
}
5. get_recommendations
Get analyst recommendations for a stock:
{
"symbol": "AAPL",
"recommendations": [
{
"period": "2024-03-15T00:00:00",
"strongBuy": 15,
"buy": 20,
"hold": 8,
"sell": 2,
"strongSell": 0
}
// ... more periods
]
}
6. get_insider_transactions
Get insider trading information:
{
"symbol": "AAPL",
"transactions": [
{
"date": "2024-03-15T00:00:00",
"insider": "John Doe",
"position": "Director",
"transactionType": "Buy",
"shares": 1000,
"value": 150250.00,
"url": "https://finance.yahoo.com/...",
"text": "Purchase of 1000 shares",
"startDate": "2024-03-15",
"ownership": "Direct"
}
// ... more transactions
]
}
Sample Queries
You can ask Claude Desktop questions like:
- "What is the current stock price and daily change for AAPL?"
- "Can you give me a company overview for Microsoft (MSFT)?"
- "Show me the historical price data for Tesla (TSLA) over the last 3 months."
- "Search for stocks related to 'NVDA'."
- "What are the analyst recommendations for Amazon (AMZN)?"
- "Have there been any recent insider transactions for Google (GOOGL)?"
Cryptocurrency Support
Limited cryptocurrency data is available using special ticker formats:
- BTC-USD for Bitcoin
- ETH-USD for Ethereum
- DOGE-USD for Dogecoin
Error Handling
All tools include proper error handling and will return an error message if something goes wrong:
{
"error": "Failed to fetch quote for INVALID_SYMBOL"
}
Troubleshooting
If the MCP server is not working in Claude Desktop:
- Make sure the server is running - you should see output when you start the script
- Verify the path in your settings is correct and absolute
- Make sure Python 3.10+ is in your system PATH
- Check that all dependencies are installed
- Try restarting Claude Desktop
- Check logs for any error messages
Differences from the original mcp-stocks project
- Uses the MCP library directly instead of FastAPI
- Adapted for Claude Desktop instead of Cursor
- Modified error handling and response formats
- Updated configuration approach
License
MIT License
伺服器配置
{
"mcpServers": {
"yfinance-trader-mcp-claude-desktop": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"ghcr.io/metorial/mcp-container--saintdoresh--yfinance-trader-mcp-claudedesktop--yfinance-trader-mcp-claude-desktop",
"python main.py"
],
"env": {}
}
}
}