YahooClaw - Yahoo Finance API Integration
🔒 Security
- ✅ No shell command execution
- ✅ All API calls use HTTPS
- ✅ Rate limiting implemented
- ✅ Open source and auditable
- ⚠️ API keys must be set via environment variables
- ℹ️ Uses in-memory caching for performance (no database)
Overview
YahooClaw is an OpenClaw skill that integrates Yahoo Finance API, providing real-time stock data queries, financial analysis, historical stock prices, and more.
Permissions
Required Permissions
- ✅ Network Access: Yahoo Finance API (HTTPS)
- ✅ File Access: Local SQLite database storage (optional caching)
- ❌ No Admin/Root Privileges Required
- ❌ No System Command Execution
- ❌ No Access to User Privacy Data
Data Flow
- Stock Data: Yahoo Finance API → Local Processing → Return Results
- No user data uploaded
- Temporary caching only (optional)
Use Cases
1. Real-time Stock Quotes
Query AAPL stock price
How much is Tesla now
NVDA latest stock price
2. Company Information
What is Apple's market cap
Microsoft's P/E ratio
Google's revenue data
3. Historical Data
Show AAPL stock price for the past 30 days
Tesla's trend last month
4. Financial Metrics
Apple's balance sheet
Tencent's income statement
5. Dividends
What is AAPL's dividend
Which stocks have high dividend yields
Usage Examples
Basic Usage
const YahooClaw = require('./src/yahoo-finance.js');
// Get real-time stock quote
const quote = await YahooClaw.getQuote('AAPL');
console.log(quote);
// Get historical data
const history = await YahooClaw.getHistory('TSLA', '1mo');
console.log(history);
// Get company information
const info = await YahooClaw.getCompanyInfo('MSFT');
console.log(info);
OpenClaw Integration
// Call in OpenClaw agent
const result = await tools.yahooclaw.getQuote({symbol: 'AAPL'});
API Parameters
getQuote(symbol)
- symbol: Stock code (e.g., AAPL, TSLA, 0700.HK)
- Returns: Real-time stock price, change, volume, etc.
getHistory(symbol, period)
- symbol: Stock code
- period: Time period (1d, 5d, 1mo, 3mo, 6mo, 1y, 2y, 5y, 10y, ytd, max)
- Returns: Historical stock price data
getCompanyInfo(symbol)
- symbol: Stock code
- Returns: Company information, market cap, P/E ratio, P/B ratio, etc.
getDividends(symbol)
- symbol: Stock code
- Returns: Dividend history
Environment Variables
# Optional: Alpha Vantage API (backup data source)
# Get from: https://www.alphavantage.co/support/#api-key
ALPHA_VANTAGE_API_KEY=your_api_key_here
# Optional: Database path for caching
DATABASE_PATH=./yahooclaw.db
Notes
- Data Delay: Yahoo Finance real-time data may have 15-minute delay
- Rate Limiting: Control request frequency to avoid rate limits
- HK/A-Shares: Supports HK stocks (0700.HK), A-shares (600519.SS), etc.
- Error Handling: Network issues or invalid codes will return error messages
Troubleshooting
Common Issues
Failed to Get Data
- Check network connection
- Verify stock code format
- Check Yahoo Finance service status
Data Delay
- This is normal, Yahoo Finance real-time data has delay
- Consider using paid API for truly real-time data
A-Share/HK Stock Code Format
- A-Shares: 600519.SS (Moutai)
- HK Stocks: 0700.HK (Tencent)
- US Stocks: AAPL (Apple)
Resources
Changelog
v1.0.0 (2026-03-12)
- ✅ Security improvements
- ✅ Removed all test/debug files
- ✅ Fixed unicode characters
- ✅ Updated documentation
- ✅ Production ready
v0.1.0 (2026-03-09)
- ✅ Initial release
- ✅ Real-time stock quotes
- ✅ Historical data queries
- ✅ Company information queries
- ✅ Dividend queries
- ✅ OpenClaw integration
License
MIT License
Author
PocketAI for Leo - OpenClaw Community
1---2name: yahooclaw3description: Yahoo Finance API integration for OpenClaw. Use when users ask for stock prices, company financials, historical data, dividends, or market data. Supports real-time quotes, financial statements, and market analysis.4---56# YahooClaw - Yahoo Finance API Integration78## 🔒 Security910- ✅ No shell command execution11- ✅ All API calls use HTTPS12- ✅ Rate limiting implemented13- ✅ Open source and auditable14- ⚠️ API keys must be set via environment variables15- ℹ️ Uses in-memory caching for performance (no database)1617## Overview1819YahooClaw is an OpenClaw skill that integrates Yahoo Finance API, providing real-time stock data queries, financial analysis, historical stock prices, and more.2021## Permissions2223### Required Permissions24- ✅ Network Access: Yahoo Finance API (HTTPS)25- ✅ File Access: Local SQLite database storage (optional caching)26- ❌ No Admin/Root Privileges Required27- ❌ No System Command Execution28- ❌ No Access to User Privacy Data2930### Data Flow31- Stock Data: Yahoo Finance API → Local Processing → Return Results32- No user data uploaded33- Temporary caching only (optional)3435## Use Cases3637### 1. Real-time Stock Quotes38```39Query AAPL stock price40How much is Tesla now41NVDA latest stock price42```4344### 2. Company Information45```46What is Apple's market cap47Microsoft's P/E ratio48Google's revenue data49```5051### 3. Historical Data52```53Show AAPL stock price for the past 30 days54Tesla's trend last month55```5657### 4. Financial Metrics58```59Apple's balance sheet60Tencent's income statement61```6263### 5. Dividends64```65What is AAPL's dividend66Which stocks have high dividend yields67```6869## Usage Examples7071### Basic Usage72```javascript73const YahooClaw = require('./src/yahoo-finance.js');7475// Get real-time stock quote76const quote = await YahooClaw.getQuote('AAPL');77console.log(quote);7879// Get historical data80const history = await YahooClaw.getHistory('TSLA', '1mo');81console.log(history);8283// Get company information84const info = await YahooClaw.getCompanyInfo('MSFT');85console.log(info);86```8788### OpenClaw Integration89```javascript90// Call in OpenClaw agent91const result = await tools.yahooclaw.getQuote({symbol: 'AAPL'});92```9394## API Parameters9596### getQuote(symbol)97- **symbol**: Stock code (e.g., AAPL, TSLA, 0700.HK)98- **Returns**: Real-time stock price, change, volume, etc.99100### getHistory(symbol, period)101- **symbol**: Stock code102- **period**: Time period (1d, 5d, 1mo, 3mo, 6mo, 1y, 2y, 5y, 10y, ytd, max)103- **Returns**: Historical stock price data104105### getCompanyInfo(symbol)106- **symbol**: Stock code107- **Returns**: Company information, market cap, P/E ratio, P/B ratio, etc.108109### getDividends(symbol)110- **symbol**: Stock code111- **Returns**: Dividend history112113## Environment Variables114115```bash116# Optional: Alpha Vantage API (backup data source)117# Get from: https://www.alphavantage.co/support/#api-key118ALPHA_VANTAGE_API_KEY=your_api_key_here119120# Optional: Database path for caching121DATABASE_PATH=./yahooclaw.db122```123124## Notes1251261. **Data Delay**: Yahoo Finance real-time data may have 15-minute delay1272. **Rate Limiting**: Control request frequency to avoid rate limits1283. **HK/A-Shares**: Supports HK stocks (0700.HK), A-shares (600519.SS), etc.1294. **Error Handling**: Network issues or invalid codes will return error messages130131## Troubleshooting132133### Common Issues1341351. **Failed to Get Data**136 - Check network connection137 - Verify stock code format138 - Check Yahoo Finance service status1391402. **Data Delay**141 - This is normal, Yahoo Finance real-time data has delay142 - Consider using paid API for truly real-time data1431443. **A-Share/HK Stock Code Format**145 - A-Shares: 600519.SS (Moutai)146 - HK Stocks: 0700.HK (Tencent)147 - US Stocks: AAPL (Apple)148149## Resources150151- [Yahoo Finance API Documentation](https://finance.yahoo.com/)152- [yfinance Python Library](https://pypi.org/project/yfinance/)153- [OpenClaw Documentation](https://docs.openclaw.ai/)154155## Changelog156157### v1.0.0 (2026-03-12)158- ✅ Security improvements159- ✅ Removed all test/debug files160- ✅ Fixed unicode characters161- ✅ Updated documentation162- ✅ Production ready163164### v0.1.0 (2026-03-09)165- ✅ Initial release166- ✅ Real-time stock quotes167- ✅ Historical data queries168- ✅ Company information queries169- ✅ Dividend queries170- ✅ OpenClaw integration171172## License173174MIT License175176## Author177178PocketAI for Leo - OpenClaw Community