Stocks Skill
56+ financial tools via Yahoo Finance. Prices, fundamentals, earnings, options, crypto, forex, commodities, news.
Github Open-Souce
Please star Github if you like the skill.
Also available for OpenWebUI.
https://github.com/lkcair/yfinance-ai
Setup
Run from the skill directory:
python3 -m venv .venv
.venv/bin/python3 -m pip install -r requirements.txt
Windows: use .venv\Scripts\python3 instead of .venv/bin/python3.
AGNOSTIC OS / One-shot Design ( Goals )
- This skill is designed to be agnostic to OS and execution environment.
- It loads only essential context on first use and uses a single-shot interaction pattern for reliability.
- Basic usage pattern provided in TOOLS.md and the All Functions list in SKILL.md body.
Quotation / Command Execution Reliability (common pitfall)
- If a command invocation uses complex shell quoting, it may fail in various environments. Use a here-doc style or a tiny helper script to avoid escaping issues.
- Crucially, ensure you are executing Python scripts using the interpreter from the skill's virtual environment. Simply calling
python3 might not use the correct interpreter if the venv is not activated, leading to ModuleNotFoundError.
- Always use the full path to the venv's Python interpreter for execution, e.g.:
/home/openclaw/.openclaw/venv/stocks/bin/python3
- Ensure that all necessary packages (like
pydantic for yfinance-ai) are installed within this specific venv using its associated pip command:
/home/openclaw/.openclaw/venv/stocks/bin/pip install <package_name>
- Example robust pattern using a here-doc:
/home/openclaw/.openclaw/venv/stocks/bin/python3 - << 'PY'
import asyncio, sys
sys.path.insert(0, '.')
from yfinance_ai import Tools
t = Tools()
async def main():
r = await t.get_key_ratios(ticker='UNH')
print(r)
asyncio.run(main())
PY
- If complex inline scripts are problematic, wrap the call in a small Python script file in the workspace (e.g., in
scripts/) and execute that script using the venv's Python interpreter.
Agent Quick-Start
After setup, copy the template below into your agent's TOOLS.md (or whichever file your framework injects into every session). This is the single most important step — if the agent can see the invocation pattern, it will work every time.
Replace SKILL_DIR with the absolute path to this skill's directory (e.g. where scripts/ and .venv/ live).
# Stocks Skill
## Usage
```bash
cd SKILL_DIR/scripts && SKILL_DIR/.venv/bin/python3 -c "
import asyncio, sys
sys.path.insert(0, '.')
from yfinance_ai import Tools
t = Tools()
async def main():
result = await t.METHOD(ARGS)
print(result)
asyncio.run(main())
" 2>/dev/null
```
Replace METHOD(ARGS) with any call below. Suppress stderr (2>/dev/null) to hide warnings.
## Common Calls
| Need | Method |
|---|---|
| Stock price | `get_stock_price(ticker='AAPL')` |
| Key ratios (P/E, ROE, margins) | `get_key_ratios(ticker='AAPL')` |
| Company overview | `get_company_overview(ticker='AAPL')` |
| Full deep-dive | `get_complete_analysis(ticker='AAPL')` |
| Compare stocks | `compare_stocks(tickers='AAPL,MSFT,GOOGL')` |
| Crypto | `get_crypto_price(symbol='BTC')` |
| Forex | `get_forex_rate(pair='EURUSD')` |
| Commodities | `get_commodity_price(commodity='gold')` |
| News | `get_stock_news(ticker='AAPL')` |
| Market indices | `get_market_indices()` |
| Dividends | `get_dividends(ticker='AAPL')` |
| Earnings | `get_earnings_history(ticker='AAPL')` |
| Analyst recs | `get_analyst_recommendations(ticker='AAPL')` |
| Options chain | `get_options_chain(ticker='SPY')` |
| Market open/closed | `get_market_status()` |
## Routing
- Price / quote → `get_stock_price`
- Ratios / valuation → `get_key_ratios`
- "Tell me about" → `get_company_overview`
- Deep dive → `get_complete_analysis`
- Compare → `compare_stocks`
- Crypto → `get_crypto_price`
- Forex → `get_forex_rate`
- Commodities → `get_commodity_price`
- News → `get_stock_news`
All Functions
See skill.json for the full list of 56+ functions, parameters, and trigger keywords. Categories:
- Quotes:
get_stock_price, get_stock_quote, get_fast_info, get_historical_data
- Company:
get_company_info, get_company_overview, get_company_officers
- Financials:
get_income_statement, get_balance_sheet, get_cash_flow, get_key_ratios, get_financial_summary
- Earnings:
get_earnings_history, get_earnings_dates, get_analyst_estimates, get_eps_trend
- Analyst:
get_analyst_recommendations, get_analyst_price_targets, get_upgrades_downgrades
- Ownership:
get_institutional_holders, get_insider_transactions, get_major_holders
- Dividends:
get_dividends, get_stock_splits, get_corporate_actions
- Options:
get_options_chain, get_options_expirations
- Market:
get_market_indices, get_sector_performance, get_market_status
- Crypto/Forex/Commodities:
get_crypto_price, get_forex_rate, get_commodity_price
- Compare:
compare_stocks, get_peer_comparison, get_historical_comparison
- News:
get_stock_news, get_sec_filings
- Utility:
search_ticker, validate_ticker, run_self_test
Notes
- Data from Yahoo Finance. Slight real-time delays possible.
- All functions are async — the
asyncio.run() wrapper handles this.
- Works on Linux, macOS, and Windows (adjust venv path for Windows).
1---
2name: stocks
3description: 56+ financial data tools via Yahoo Finance. Auto-routes stock prices, fundamentals, earnings, dividends, options, crypto, forex, commodities, news, and more.
4metadata:
5 source: https://skillmd.com/skills/modbender/stocks
6---
7
8# Stocks Skill
9
1056+ financial tools via Yahoo Finance. Prices, fundamentals, earnings, options, crypto, forex, commodities, news.
11
12## Github Open-Souce
13Please star Github if you like the skill.
14Also available for OpenWebUI.
15https://github.com/lkcair/yfinance-ai
16
17
18## Setup
19
20Run from the skill directory:
21
22```bash
23python3 -m venv .venv
24.venv/bin/python3 -m pip install -r requirements.txt
25```
26
27> **Windows:** use `.venv\Scripts\python3` instead of `.venv/bin/python3`.
28
29## AGNOSTIC OS / One-shot Design ( Goals )
30- This skill is designed to be agnostic to OS and execution environment.
31- It loads only essential context on first use and uses a single-shot interaction pattern for reliability.
32- Basic usage pattern provided in TOOLS.md and the All Functions list in SKILL.md body.
33
34## Quotation / Command Execution Reliability (common pitfall)
35- If a command invocation uses complex shell quoting, it may fail in various environments. Use a here-doc style or a tiny helper script to avoid escaping issues.
36- **Crucially, ensure you are executing Python scripts using the interpreter from the skill's virtual environment.** Simply calling `python3` might not use the correct interpreter if the venv is not activated, leading to `ModuleNotFoundError`.
37- **Always use the full path to the venv's Python interpreter** for execution, e.g.:
38 `/home/openclaw/.openclaw/venv/stocks/bin/python3`
39- Ensure that all necessary packages (like `pydantic` for `yfinance-ai`) are installed within this specific venv using its associated `pip` command:
40 `/home/openclaw/.openclaw/venv/stocks/bin/pip install <package_name>`
41- Example robust pattern using a here-doc:
42
43```bash
44/home/openclaw/.openclaw/venv/stocks/bin/python3 - << 'PY'
45import asyncio, sys
46sys.path.insert(0, '.')
47from yfinance_ai import Tools
48
49t = Tools()
50async def main():
51 r = await t.get_key_ratios(ticker='UNH')
52 print(r)
53asyncio.run(main())
54PY
55```
56- If complex inline scripts are problematic, wrap the call in a small Python script file in the workspace (e.g., in `scripts/`) and execute that script using the venv's Python interpreter.
57
58## Agent Quick-Start
59
60After setup, copy the template below into your agent's `TOOLS.md` (or whichever file your framework injects into every session). This is the single most important step — if the agent can see the invocation pattern, it will work every time.
61
62**Replace `SKILL_DIR`** with the absolute path to this skill's directory (e.g. where `scripts/` and `.venv/` live).
63
64````markdown
65# Stocks Skill
66
67## Usage
68
69```bash
70cd SKILL_DIR/scripts && SKILL_DIR/.venv/bin/python3 -c "
71import asyncio, sys
72sys.path.insert(0, '.')
73from yfinance_ai import Tools
74t = Tools()
75async def main():
76 result = await t.METHOD(ARGS)
77 print(result)
78asyncio.run(main())
79" 2>/dev/null
80```
81
82Replace METHOD(ARGS) with any call below. Suppress stderr (2>/dev/null) to hide warnings.
83
84## Common Calls
85
86| Need | Method |
87|---|---|
88| Stock price | `get_stock_price(ticker='AAPL')` |
89| Key ratios (P/E, ROE, margins) | `get_key_ratios(ticker='AAPL')` |
90| Company overview | `get_company_overview(ticker='AAPL')` |
91| Full deep-dive | `get_complete_analysis(ticker='AAPL')` |
92| Compare stocks | `compare_stocks(tickers='AAPL,MSFT,GOOGL')` |
93| Crypto | `get_crypto_price(symbol='BTC')` |
94| Forex | `get_forex_rate(pair='EURUSD')` |
95| Commodities | `get_commodity_price(commodity='gold')` |
96| News | `get_stock_news(ticker='AAPL')` |
97| Market indices | `get_market_indices()` |
98| Dividends | `get_dividends(ticker='AAPL')` |
99| Earnings | `get_earnings_history(ticker='AAPL')` |
100| Analyst recs | `get_analyst_recommendations(ticker='AAPL')` |
101| Options chain | `get_options_chain(ticker='SPY')` |
102| Market open/closed | `get_market_status()` |
103
104## Routing
105
106- Price / quote → `get_stock_price`
107- Ratios / valuation → `get_key_ratios`
108- "Tell me about" → `get_company_overview`
109- Deep dive → `get_complete_analysis`
110- Compare → `compare_stocks`
111- Crypto → `get_crypto_price`
112- Forex → `get_forex_rate`
113- Commodities → `get_commodity_price`
114- News → `get_stock_news`
115````
116
117---
118
119## All Functions
120
121See `skill.json` for the full list of 56+ functions, parameters, and trigger keywords. Categories:
122
123- **Quotes**: `get_stock_price`, `get_stock_quote`, `get_fast_info`, `get_historical_data`
124- **Company**: `get_company_info`, `get_company_overview`, `get_company_officers`
125- **Financials**: `get_income_statement`, `get_balance_sheet`, `get_cash_flow`, `get_key_ratios`, `get_financial_summary`
126- **Earnings**: `get_earnings_history`, `get_earnings_dates`, `get_analyst_estimates`, `get_eps_trend`
127- **Analyst**: `get_analyst_recommendations`, `get_analyst_price_targets`, `get_upgrades_downgrades`
128- **Ownership**: `get_institutional_holders`, `get_insider_transactions`, `get_major_holders`
129- **Dividends**: `get_dividends`, `get_stock_splits`, `get_corporate_actions`
130- **Options**: `get_options_chain`, `get_options_expirations`
131- **Market**: `get_market_indices`, `get_sector_performance`, `get_market_status`
132- **Crypto/Forex/Commodities**: `get_crypto_price`, `get_forex_rate`, `get_commodity_price`
133- **Compare**: `compare_stocks`, `get_peer_comparison`, `get_historical_comparison`
134- **News**: `get_stock_news`, `get_sec_filings`
135- **Utility**: `search_ticker`, `validate_ticker`, `run_self_test`
136
137## Notes
138
139- Data from Yahoo Finance. Slight real-time delays possible.
140- All functions are async — the `asyncio.run()` wrapper handles this.
141- Works on Linux, macOS, and Windows (adjust venv path for Windows).