Build Your Own AI-Powered Trader with Claude and YFinance MCP

Learn how to navigate the unpredictable stock market using AI tools for personalized investment advice. This tutorial guides you to build a free AI trader using your portfolio, current quotes, and news, without needing advanced tech. Harness AI for informed decisions while tapping into resources ...

Build Your Own AI-Powered Trader with Claude and YFinance MCP

The stock market has been very unpredictable in recent weeks and I expect it to continue to be so. Some people have lived through similar uncertainties in previous decades and understand the importance of making thoughtful decisions rather than just following the crowd.

But the more you have at stake, the more important it is to make informed decisions about whether to act or simply watch and wait.

Some trading platforms offer tools for analysis, news aggregation and even the use of AI, but unfortunately not all offer these features.

Regardless of whether you have such a tool (such as a robo-advisor), AI can help you make more informed decisions than ever before, based on your portfolio, the latest news and best practices.

In this tutorial I will show you how to build your own free AI trader based on your portfolio, current quotes and news.

Disclaimer
This demonstration is for educational purposes only and demonstrates the technological capabilities of AI in financial decision support. I am not a financial advisor, broker or investment professional. The information provided is not investment advice and should not be relied upon in making financial decisions. Past performance is not a guide to future results. Always consult a qualified financial professional before making any investment decision. You are solely responsible for any actions you take based on this information.

---

What you need

We will use Claude Sonnet 3.7 for this, using the Claude desktop application, which has built-in support for MCP.

For the actual market data, including quotes, we will use two MCP servers, Yfinance (Open Source) and Tavily (Free registration required).

If you want to experiment with yfinance first, you can try this free UI I created on Hugging Face:

https://huggingface.co/spaces/airabbitX/yfinance-ui

---

1. Export your Stock Portfolio

In the first step, gather the data you want to use for analysis and make a few notes on your preferences—such as how risk-averse you are, whether you need short-term liquidity, and so on.

Then, export your portfolio in any textual format (e.g., CSV or PDF).

Here is an example portfolio that includes all the necessary information such as symbol, amount, and current price. The current price is relevant because it helps determine the weight of each symbol in the entire portfolio. Note that the tools below can also fetch the current price, but including it yourself can reduce time and API calls to yfinance.

---

#2. Install Yahoo Finance MCP

https://github.com/tooyipjee/yahoofinance-mcp

git clone https://github.com/tooyipjee/yahoofinance-mcp.git 
cd yahoofinance-mcp/
docker build -t yahoofinance-mcp .

Then, configure it by adding something like this to your Claude Desktop settings:

"yahoofinance": {
  "command": "docker",
  "args": [
    "run",
    "-i",
    "--rm",
    "yahoofinance-mcp"
  ]
}

Data Privacy | Imprint