Vibe coding
Give an AI coding assistant the xfinlink reference so it writes working client code, or connect it to the MCP server instead.
Give an AI coding assistant the llms.txt file before it writes code against the client. Describe the analysis you want, then run the script it produces. If you want the assistant to fetch data and answer directly instead of writing code, connect it to the MCP server.
Choose an approach
- Context file: paste
llms.txtinto the conversation. The assistant writes Python that calls thexfinlinkclient, and you run the code. Use this for scripts, notebooks and repeatable analysis. - MCP server: the assistant calls the API itself through 11 tools and answers from the JSON it gets back. Use this for questions you want answered in the chat. See MCP server.
Both use your API key and your plan's limits.
The llms.txt files
llms.txt holds the Quickstart and the Python client reference: every function with its arguments, return shape and errors, input formats, and runnable samples. Eight companion files each hold the reference pages for one group of HTTP endpoints. All are plain text (text/plain; charset=utf-8) and need no key.
https://xfinlink.com/llms.txt: the Python client.https://xfinlink.com/llms-prices.txt:GET /v1/prices/{ticker}.https://xfinlink.com/llms-fundamentals.txt:GET /v1/fundamentals/{ticker}.https://xfinlink.com/llms-metrics.txt:GET /v1/metrics/{ticker}.https://xfinlink.com/llms-resolve.txt:GET /v1/resolve/{ticker}.https://xfinlink.com/llms-search.txt:GET /v1/search.https://xfinlink.com/llms-index.txt: index constituents and index events.https://xfinlink.com/llms-insiders.txt:GET /v1/insiders/{ticker}.https://xfinlink.com/llms-holdings.txt: holdings, manager search and manager holdings.
https://api.xfinlink.com/llms.txt serves the same file. Responses may be cached for up to one hour (Cache-Control: public, max-age=3600). See llms.txt for what each file contains.
curl -s https://xfinlink.com/llms.txt | head -3# xfinlink
Python client for US equity data: prices, financial statements, computed metrics, entity resolution, search, index constituents and membership changes, insider transactions, and institutional (Form 13F) holdings. ...Load it with llm_context()
xfl.llm_context() fetches llms.txt, prints it, and returns it as a string. When the pyperclip package is installed, it also copies the text to your clipboard, ready to paste. It sends no API key.
import xfinlink as xfl
text = xfl.llm_context()
print(type(text).__name__)# xfinlink
Python client for US equity data: prices, financial statements, computed metrics, entity resolution, search, index constituents and membership changes, insider transactions, and institutional (Form 13F) holdings. ...
...
https://xfinlink.com/llms-holdings.txt
strThe returned string is the same file that https://xfinlink.com/llms.txt serves.
Write the prompt
Put four things in the prompt: the reference, how the script gets the key, what your plan allows, and the task. A template:
You are writing Python with the xfinlink client (pip install xfinlink, version 0.13.1).
The client reference is below. Start the script with xfl.set_api_key("YOUR_API_KEY").
My plan is Free: one ticker per call, and the last 12 months of prices, fundamentals and metrics.
Fundamentals money values are in millions of the currency in each row's `currency` field (USD on a `USD` row). Prices are USD per share.
[paste the output of xfl.llm_context() here]
Task: ...On a paid plan, state that plan instead, for example My plan is Pro: up to 100 tickers per call and full history. See Plans and limits.
If your assistant can open web pages, give it the URL https://xfinlink.com/llms.txt instead of pasting the text. For work against one HTTP endpoint without the Python client, paste that endpoint's companion file.
Example prompts
Each example shows the task you type after the template, the code an assistant should produce, and the real output of that code. The examples run on every plan.
Compare revenue across companies
Task: compare quarterly revenue for Apple, Microsoft and Alphabet for the quarters ending since October 2025, in billions of USD.import pandas as pd
import xfinlink as xfl
xfl.set_api_key("YOUR_API_KEY")
frames = [xfl.fundamentals(t, period_type="quarterly", start="2025-10-01", fields=["revenue"])
for t in ["AAPL", "MSFT", "GOOGL"]]
df = pd.concat(frames)
df["revenue_bn"] = df["revenue"] / 1000
cols = ["ticker", "fiscal_year", "fiscal_period", "period_end", "revenue_bn"]
print(df[cols].round(1).to_string(index=False))ticker fiscal_year fiscal_period period_end revenue_bn
AAPL 2026 Q1 2025-12-27 143.8
AAPL 2026 Q2 2026-03-28 111.2
AAPL 2026 Q3 2026-06-27 109.4
MSFT 2026 Q2 2025-12-31 81.3
MSFT 2026 Q3 2026-03-31 82.9
MSFT 2026 Q4 2026-06-30 90.0
GOOGL 2025 Q4 2025-12-31 113.8
GOOGL 2026 Q1 2026-03-31 109.9
GOOGL 2026 Q2 2026-06-30 119.8revenue arrives in millions of USD, so the code divides by 1,000. start filters on period_end, and each company's quarters end on its own fiscal calendar. The code makes one call per ticker, which works on every plan; on Pro and higher, one call can carry all three tickers.
Total return versus price return
Task: compute Apple's total return from the last close of 2025 to 25 September 2026, including dividends, and its price-only return, as percentages.import xfinlink as xfl
xfl.set_api_key("YOUR_API_KEY")
df = xfl.prices("AAPL", start="2025-12-31", end="2026-09-25")
daily = df["return_daily"].iloc[1:] # drop the 2025-12-31 base row
total_return = (1 + daily).prod() - 1 # includes cash dividends
price_return = df["adj_close"].iloc[-1] / df["adj_close"].iloc[0] - 1
print(f"Total return: {total_return:.2%}")
print(f"Price return: {price_return:.2%}")Total return: 25.80%
Price return: 25.46%return_daily is the total daily return as a decimal, including cash distributions. adj_close is adjusted for splits, stock dividends and spin-offs but not cash dividends, so the gap between the two figures is the dividend contribution. The window starts on 2025-12-31 so that the first 2026 return has a base price. See Price fields.
A recycled ticker
Task: the ticker GM has belonged to more than one company. List every company that used it and the dates each one held the ticker.import xfinlink as xfl
xfl.set_api_key("YOUR_API_KEY")
info = xfl.resolve("GM")
for e in info["data"]["GM"]["entities"]:
print(e["entity_id"], e["name"], e["ticker_valid_from"], e["ticker_valid_to"])10001879 GENERAL MOTORS CO 2010-11-18 None
10001629 GENERAL MOTORS CORP 1962-07-02 2009-06-01A ticker alone resolves to one company for your date window. resolve() lists every company that used the ticker, the current holder first, and an entity_id from that list reaches one company directly: xfl.prices(entity_id=10001629, period="max") returns General Motors Corporation's series, which ends on 2009-06-01 and needs a paid plan's full history. See Tickers and entities.
Check the generated code
Assistants reuse patterns from other libraries. Check these points before you trust a script:
periodandstartorendcannot be combined; the client raisesXfinlinkError.resolve()takes the date asdate_;date=raisesTypeError.- Fundamentals money values are millions of each row's
currency, and metrics money values millions of USD; pricesmarket_capand holdingsvalue_usdare whole USD; ratios are decimals. insiders()sendsinclude_amendments=falseandholdings()sendsinclude_amendments=trueunless the code passes a value.insiders(),holdings()andmanager_holdings()return at most 5,000 rows per call.- Without
startorperiod,prices(),fundamentals(),insiders(),holdings(),manager_holdings(), andmetrics()withannualorquarterly, ask for the last 365 days;period="max"asks for full history. On Free, prices, fundamentals and metrics cover the last 12 months whateverstartasks for.
Each point is shown with real output on the Python client reference.
Use the MCP server instead
Coding assistants that support MCP can call the API directly. In Claude Code:
claude mcp add --transport http --scope user xfinlink "https://api.xfinlink.com/mcp?api_key=YOUR_API_KEY"Setup for Cursor, VS Code, Claude, ChatGPT and others is on MCP server.
Was this page helpful?
Thank you for helping improve xfinlink documentation.
- Need help? Get in touch.
- Building with an LLM? Read llms.txt.
- Using Claude or ChatGPT? Connect the MCP server.