Originally published on medium.com

Most âAI trading agentsâ you see on YouTube arenât agents. Theyâre an LLM with a nice prompt and made-up data.
A real agent needs three things: the ability to reason, tools to act, and real data so it doesnât hallucinate. If youâre missing the third one, the other two donât matter.
This article is for you if:
Letâs get into it.
Ask any LLM for the current price of a stock.
Itâll give you a number. That number could be months old, or straight-up invented.
Language models donât have access to live markets. They donât know what happened yesterday. They donât know the latest earnings report. And yet, plenty of âAI trading projectsâ use them as if they did.
The result is predictable:
This isnât an intelligence problem. GPT-4 or Claude arenât âbad at finance.â
The problem is that nobody is feeding them the right data.
An LLM without tools is a library with no windows. It knows a lot, but sees nothing of whatâs happening today.
The fix isnât âa bigger model.â Itâs giving it access to verifiable external data, and letting it decide when to check it.
Thatâs exactly what an agent does.
LangChain orchestrates the agentâs logic: it takes the userâs question, decides which tool to call, executes the call, interprets the result, and generates a response. Itâs not magic, itâs a reasoning loop with rules.
EODHD provides the missing piece: real financial data through a REST API. With it, the agent can query:
After testing several data sources for this type of automation, I consistently use EODHD. The reasons are concrete:
Want to build financial agents with real data?
EODHD gives you access to prices, fundamentals, and technicals via REST API â no scraping, no stale data.
â Try EODHD for free
Before you wire any data provider into an agent, itâs worth being honest about tradeoffs. Hereâs what stands out after building several agent tools on top of EODHDâs API.
Pros:
close, change_p, PERatio, etc.), which makes writing LangChain tool wrappers straightforward â no HTML parsing, no scraping fragility.Cons:
Net: for a project like this â a reasoning agent that needs real, structured financial data without building a scraping pipeline â the tradeoffs favor EODHD over rolling your own data layer.
It helps to open up what âagentâ means mechanically, because this is the part most tutorials skip.
A LangChain agent built on the ReAct pattern (Reason + Act) runs a loop with four components:
get_live_price, get_fundamentals, and get_rsi live.In practice, a single query like âShould we be looking at AAPL.US right now?â triggers a chain like this:
Thought: I need the current price first.
Action: get_live_price("AAPL.US")
Observation: AAPL.US: current price 227.50, change +0.8%
Thought: Price alone isn't enough â check momentum.
Action: get_rsi("AAPL.US")
Observation: AAPL.US â RSI(14): 58.3Thought: Not overbought. Check if valuation is reasonable.
Action: get_fundamentals("AAPL.US")
Observation: AAPL.US â PE: 31.2, Market Cap: 3.4T, Dividend Yield: 0.4%Thought: I now have enough data to answer.
Final Answer: [synthesized response]
This is the architectural difference between an agent and a chatbot with a system prompt: the LLM decides the sequence of tool calls at runtime, based on what it learns from each observation â it isnât a fixed script. Thatâs also exactly why the quality and structure of your data source matters so much. If get_fundamentals returns garbage or stale numbers, the "Thought" steps built on top of it inherit that error silently, with no warning sign in the output.
This is the core reason financial agents need a real, structured API like EODHD instead of scraped or cached data: every reasoning step downstream depends on the reliability of the step before it.
See the data behind every reasoning step
EODHDâs structured endpoints are built for exactly this kind of tool-calling architecture.
â Explore the EODHD API
Letâs build an agent with three tools connected to EODHD: live price, fundamentals, and technical indicators.
pip install langchain langchain-openai requests
Each tool is a function that calls an EODHD endpoint and returns a structured response the agent can interpret.
import requests
from langchain.tools import tool
EODHD_API_KEY = "YOUR_API_KEY"
BASE_URL = "https://eodhd.com/api"
@tool
def get_live_price(ticker: str) -> str:
"""Returns the current price of a stock. Example ticker: AAPL.US"""
url = f"{BASE_URL}/real-time/{ticker}"
params = {"api_token": EODHD_API_KEY, "fmt": "json"}
r = requests.get(url, params=params).json()
return f"{ticker}: current price {r['close']}, change {r['change_p']}%"
@tool
def get_fundamentals(ticker: str) -> str:
"""Returns key fundamental metrics: PE ratio, market cap, dividend yield."""
url = f"{BASE_URL}/fundamentals/{ticker}"
params = {"api_token": EODHD_API_KEY}
r = requests.get(url, params=params).json()
highlights = r.get("Highlights", {})
return (
f"{ticker} - PE: {highlights.get('PERatio')}, "
f"Market Cap: {highlights.get('MarketCapitalization')}, "
f"Dividend Yield: {highlights.get('DividendYield')}"
)
@tool
def get_rsi(ticker: str) -> str:
"""Returns the 14-day RSI to assess overbought or oversold conditions."""
url = f"{BASE_URL}/technical/{ticker}"
params = {"api_token": EODHD_API_KEY, "function": "rsi", "period": 14, "fmt": "json"}
r = requests.get(url, params=params).json()
latest = r[-1]
return f"{ticker} - RSI(14): {latest['rsi']} as of {latest['date']}"
from langchain_openai import ChatOpenAI
from langchain.agents import create_react_agent, AgentExecutor
from langchain import hub
llm = ChatOpenAI(model="gpt-4o", temperature=0)
tools = [get_live_price, get_fundamentals, get_rsi]
prompt = hub.pull("hwchase17/react")
agent = create_react_agent(llm, tools, prompt)
executor = AgentExecutor(agent=agent, tools=tools, verbose=True)
prompt = hub.pull("hwchase17/react")
agent = create_react_agent(llm, tools, prompt)
executor = AgentExecutor(agent=agent, tools=tools, verbose=True)
Three tools. One LLM. One reasoning loop that decides which one to use based on the question.
response = executor.invoke({
"input": "Should we be looking at AAPL.US right now?"
})
print(response["output"])
The agent doesnât answer directly from memory. It first calls get_live_price, then get_rsi, and if valuation matters, get_fundamentals. It combines all three results into a response grounded in real data, not a confidently-formatted hallucination.
From here you can build:
If youâre a software or API company looking to explain your product through high-quality educational content (not marketing fluff), feel free to connect with me on LinkedIn: đ linkedin.com/in/kevin-meneses-gonzalez
Ready to build your own financial agent?
Get access to real-time prices, fundamentals, and technicals with the EODHD API.
â Get started with EODHD
â What is an AI agent in the context of trading?
â
Itâs a system where an LLM doesnât just respond with text, but decides which tools to use â prices, fundamentals, news â to complete a task with real data, instead of relying only on its trained knowledge.
â Why use LangChain instead of calling the API directly?
â
Because LangChain manages the decision loop: which tool to use, when, and how to combine multiple results into a coherent response. Without this, youâd have to hardcode that decision logic yourself for every case.
â Do I need a paid EODHD account to try this?
â
No. EODHDâs free tier is enough to prototype the agent with real data before scaling to production.
â Whatâs the main tradeoff of using EODHD instead of building my own data pipeline?
â
You trade full control over data sourcing for speed and reliability â one structured API instead of maintaining scrapers or multiple vendor integrations. The main limitation to plan around is the free tierâs daily request cap once you move past prototyping.
Looking for technical content for your company? I can help â LinkedIn · kevinmenesesgonzalez@gmail.com