Open source
yfinance Agent Skill
Prototype an agent that can inspect price history, company metadata and corporate events.
- Source
- Open-source community
- Access
- Open source
What this adds to your agent
Download adjusted price history
Read selected company metadata
Inspect dividends and splits
Download adjusted price history
yfinance is an unofficial wrapper and can change unexpectedly; do not treat it as a production market-data contract.
Open-source community · research
Build the tool server
from mcp.server.fastmcp import FastMCP
import yfinance as yf
mcp = FastMCP("yfinance")
@mcp.tool()
def price_history(symbol: str, period: str = "1y") -> list:
"""Return adjusted historical prices for a ticker."""
data = yf.Ticker(symbol).history(period=period, auto_adjust=True)
return data.reset_index().tail(100).astype({"Date": "str"}).to_dict("records")
if __name__ == "__main__": mcp.run()Examples and expected outcomes
Fetch prices and statements in agent chat
- Sourced evidence
- Repeatable steps
- Explicit uncertainty
Create a read-only research brief
- Sourced evidence
- Repeatable steps
- Explicit uncertainty
Compare tickers with source timestamps
- Sourced evidence
- Repeatable steps
- Explicit uncertainty
Access requirements
Open source
Review source and upstream data licenses
Use caching, backoff and bounded concurrency
Connect to your Agent
{
"mcpServers": {
"yfinance-agent": {
"command": "python",
"args": [
"server.py"
]
}
}
}“Use yfinance Agent Skill to research AAPL. List sources and timestamps first, then separate facts, calculations, risks and missing data. Do not give personalized trading advice.”
When not to use it
- yfinance is an unofficial wrapper and can change unexpectedly; do not treat it as a production market-data contract.
Connect it to your agent
{
"mcpServers": {
"yfinance-agent": {
"command": "python",
"args": [
"server.py"
]
}
}
}“Use the connected tool to research AAPL. State the source and timestamp for every factual claim, separate facts from interpretation, and do not give personalized financial advice.”
Production checklist
- Keep secrets outside prompts and source code
- Allowlist read-only tools first
- Log tool inputs, outputs and source timestamps
- Require citations and handle missing data explicitly
When not to use it
yfinance is an unofficial wrapper and can change unexpectedly; do not treat it as a production market-data contract.
Open official documentationProject-specific questions
What can yfinance Agent Skill do in a real workflow?
Download adjusted price history Read selected company metadata Inspect dividends and splits
What access and compatibility does yfinance Agent Skill require?
Open source. Open-source community.
What is the main implementation risk with yfinance Agent Skill?
yfinance is an unofficial wrapper and can change unexpectedly; do not treat it as a production market-data contract.