InvestTester
🇺🇸  en🇧🇷  pt-br🇪🇸  es🇫🇷  fr🇯🇵  ja🇨🇳  zh
  • Portfolio
  • Algo Trading
  • AI
  • Docs
  • API
  • WatchlistBlogComparisonsAssets
  • Platform
  • Tickers
  • Portfolio
  • Algo Trading
  • Results
  • Methodology
  • Alternatives
  • API and MCP
DocsTickersMarket TickersTicker ModifiersBrazilian Tickers: SELIC, IPCA and BondsUS Tickers: T-bills and TIPSEuropean Tickers: Euro Cash and BondsAsian Tickers: Japanese and Chinese BondsPortfolio BacktestAlgo TradingBacktest ResultsMonte Carlo SimulationMethodologyPortfolio Visualizer AlternativesAPI, MCP and AI Agents

API, MCP and AI Agents

InvestTester works from code and from AI assistants, with no account: a link that opens a simulation, a price API, the simulation engine as one file for Node, and an MCP server. A summary for language models is in llms.txt.

Share links

A link opens the Portfolio page with its inputs and runs the simulation:

https://investtester.com/?p1=SPY-60_TLT-40&p2=QQQ-100&from=2015-01-01&cash=10000&dep=500&freq=monthly

  • p1, p2, p3: up to 3 portfolios. Assets are joined by _, each one TICKER-PERCENT; the percent is the text after the last -, so BTC-USD-50 is BTC-USD at 50%. URL-encode the ticker (+ is %2B). At most 10 tickers in all portfolios together.
  • from, to: the first and last day, YYYY-MM-DD. Without to, the run goes to today.
  • cash: the initial balance. dep: the deposit per period. freq: none, weekly, monthly, quarterly, biannual or yearly.
  • Another language: put its prefix before the query (/pt-br?p1=BOVA11.SA-100). The results are in the currency of that language.

The watchlist has share links too: /watchlist?t=SPY,QQQ,BTC-USD.

Price API

GET https://investtester.com/api/search?assetCodes=SPY,QQQ&minDate=2015-01-01&maxDate=2025-12-31

The daily prices of up to 10 tickers, in the ticker syntax of the site (see Tickers). The answer is JSON, one item per ticker, with key, type, metadata and data (date, value and currency). Stock and ETF prices include dividends and splits. The interactive reference is the Swagger page.

  • Limits: 10 tickers and 10 distinct codes per request, at most 4 requests at a time and about 5 per second per address. Above that, the answer is HTTP 429.
  • The API sends no CORS headers: call it from a server or a script, not from a web page of another site.

Simulation engine for Node

The engine of the site as one file, for a script or an agent that runs commands (Node 20 or later). It takes its prices from the API above and prints the numbers of the site as JSON, without a browser:

curl -s https://investtester.com/tools/invest-tester.mjs | node --input-type=module - '{"portfolios":[{"SPY":60,"TLT":40},{"QQQ":100}],"from":"2015-01-01","cash":10000}'

  • The argument is one JSON object: portfolios (up to 3, each a ticker to percent map that sums to 100), from, and the optional to, cash, deposits, frequency, language and currency.
  • The answer has the inputs with the defaults it used, the url of the same run on the site, and for each portfolio its summary (balance, return, annual return, volatility, max drawdown, Sharpe, Alpha, Beta, and the best and worst year and month) and warnings. Fractions: 0.1234 is 12.34%.
  • A strategy, as on the Algo Trading page: in place of portfolios, send tickers (up to 10) and code with the JavaScript, or codeFile with the path of a file that has it: '{"codeFile":"strategy.js","tickers":["SPY","TLT"],"from":"2015-01-01","cash":10000}'. Optional: leverage, initMargin and minMargin. The answer has the summary, the warnings and the last 200 lines of this.print in messages; it has no url. The code runs in Node on your machine, not in the sandbox of a browser, so run only code that you trust. A run stops after 5 minutes.
  • License: run the file unmodified, piped from the site as above, to get results for yourself or for the person you act for. Do not save, change, redistribute or host it, or use it in a product or service.

MCP server

https://investtester.com/mcp is an MCP server (Streamable HTTP), with no login. Its tools:

  • share_link: the link of a backtest from its inputs. The page runs the simulation in the browser.
  • prices: the monthly prices (the last price of each month) of up to 10 tickers.
  • engine: the Node command above.

Add it to an MCP client as a remote HTTP server with that URL. In Claude Code, for example: claude mcp add --transport http investtester https://investtester.com/mcp

The prices come from public market sources and can have gaps or errors. The results are historical simulations, not investment advice.

InvestTester | Created by Tpessia
support@investtester.com