# InvestTester > Free portfolio backtester and algo trading simulator that runs in the browser, with no sign-up. It simulates asset allocations with historical prices of stocks, ETFs, indexes, crypto and Brazilian fixed income, in six languages (English, Portuguese, Spanish, French, Japanese, Chinese). Prices of stocks and ETFs are adjusted for dividends and splits (total return). Results are historical simulations, not investment advice. ## Tools - [Portfolio simulator](https://investtester.com/): set tickers, weights, deposits and a rebalance frequency, and compare up to 3 portfolios - [Algo trading](https://investtester.com/algo-trading): write a strategy in JavaScript and backtest it - [Compare pages](https://investtester.com/compare/SPY/QQQ): side by side simulation of two tickers, at /compare/TICKER1/TICKER2 - [Asset pages](https://investtester.com/asset/SPY): historical returns and backtest of one ticker, at /asset/TICKER ## Run a simulation from a link The simulator runs in the browser (JavaScript), so its results are not in the HTML of the page. A link opens the Portfolio page with its inputs and runs them: `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 to compare. 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`: first and last day, `YYYY-MM-DD`. Without `to`, the run goes to today - `cash`: initial balance. `dep`: deposit per period. `freq`: rebalance and deposit frequency, one of `none`, `weekly`, `monthly`, `quarterly`, `biannual`, `yearly` - Another language: put its prefix before the query (`https://investtester.com/pt-br?p1=BOVA11.SA-100`). The results are in the default currency of that language - The run starts by itself, in a browser that a tool drives too (WebDriver, headless). It takes a few seconds; the Summary tab then shows the final balance, return, annual return, volatility, max drawdown, longest drawdown, Sharpe, Alpha, Beta, and the best and worst year and month ## Price data API `GET https://investtester.com/api/search?assetCodes=SPY,QQQ&minDate=2015-01-01&maxDate=2025-12-31` - Answer: JSON, one item per ticker, `{ key, type, metadata, data: [{ date, value, currency }] }`. Stock and ETF values are total return (adjusted for dividends and splits) - Tickers use the syntax of the simulator (see Ticker modifiers below): currency (`SPY:BRL`), leverage (`SPY*2`), fixed rates (`FIXED*0.1`), Brazilian rates and bonds (`SELIC.SA`, `NTN-B.SA(2035)`), sums and differences of growth (`GLD+SELIC.SA~BIL`), and date windows that chain two series (`DIVO11.SA[|2024-09-15]+LVOL11.SA[2024-09-16|]`). URL-encode them - Limits: 10 tickers and 10 distinct codes per request, at most 4 requests at a time and about 5 per second per address (HTTP 429 above) - Interactive reference: [Swagger](https://investtester.com/api) ## Run the engine with Node For an agent that runs commands: the simulation engine of the site as one file (Node 20 or later). It fetches its prices from the API above and gives the numbers of the site, without a browser, for portfolios with fixed allocations or for a trading strategy written in JavaScript. ``` 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 summing to 100), `from` (`YYYY-MM-DD`), and optional `to` (default today), `cash` (default 1,000,000), `deposits` (per period), `frequency` (`none`, `weekly`, `monthly`, `quarterly`, `biannual`, `yearly`), `language` (`en`, `pt-br`, `es`, `fr`, `ja`, `zh`: the page of the answer's `url` and the currency) and `currency` (another currency of the results). The same fields as the `share_link` tool of the MCP server below - It prints the answer as JSON: `inputs` (with the defaults it used), `url` (the share link of the same run on the site), and per portfolio `summary` (initCash, finalCash, profit, totalVar, annualVar, annualStdDev, maxDrawdown, longestDrawdown, sharpe, alpha, beta, high, low, nTrades, periods with the best and worst year and month) and `warnings`. Fractions: `0.1234` is 12.34%. Alpha and Beta are against `^SP500TR` - A strategy, as on the Algo Trading page (https://investtester.com/docs/algo-trading has the API of the code): in place of `portfolios`, send `tickers` (a list, up to 10) and `code` (the JavaScript, as one JSON string), or `codeFile` (the path of a file with the JavaScript, absolute or relative to the directory where the command runs, which avoids the quoting of code inside JSON inside a shell argument): `{"codeFile":"strategy.js","tickers":["SPY","TLT"],"from":"2015-01-01","cash":10000}`. Optional: `leverage` (`true` for margin trading and short sales), with `initMargin` (default 0.5) and `minMargin` (default 0.3). No `deposits` or `frequency`: the code deposits with `this.depositCash`. The code needs one `this.on('data', async (next) => { ...; next(); })` listener and a last line `start();` - A strategy answers `inputs`, `summary` (the same fields), `warnings`, `messages` (the last 200 lines of `this.print` and of the engine, with `messagesOmitted` for the count before them) and `downloads` (the objects of `this.download`); no `url`. An error of the code is on stderr with the last printed lines, and the exit code is 1. stdout has only the JSON: `console.log` of the code goes to stderr - The code of a strategy runs in the Node process, on the machine of the command, with no sandbox (on the site it runs in a Web Worker): run only code that you or the person you act for wrote. A run that does not end within 5 minutes is stopped - Each run is one request to the price API per portfolio (one for a strategy), plus one for the benchmark, under its limits - License: all rights reserved, with one grant: run the file unmodified, piped from this site as above, to get results for yourself or the person you act for. Do not save, modify, redistribute or host it, or use it in a product or service ## MCP server `https://investtester.com/mcp` (Streamable HTTP, no login). Tools: `share_link` (the link of a backtest, which runs in a browser), `prices` (monthly prices of up to 10 tickers) and `engine` (the Node command above). ## Docs - [Overview](https://investtester.com/docs) - [Ticker overview](https://investtester.com/docs/tickers): which assets are available - [Market tickers](https://investtester.com/docs/ticker-market): stocks, ETFs, indexes, currency pairs and crypto of global exchanges - [Ticker modifiers](https://investtester.com/docs/ticker-modifiers): currency conversion (`:BRL`), leverage (`*2`), fixed rates (`FIXED*0.1`) - [US tickers](https://investtester.com/docs/ticker-us): T-bill and inflation-protected Treasury ETFs (BIL, SHV, SGOV, TIP, SCHP) - [Brazil tickers](https://investtester.com/docs/ticker-brazil): SELIC, IPCA and government bonds - [European tickers](https://investtester.com/docs/ticker-europe): the euro overnight rate, euro government and inflation-linked bonds, short pound bonds (XEON.DE, IBCI.DE, EUNH.DE, ERNS.L) - [Asian tickers](https://investtester.com/docs/ticker-asia): Japanese and Chinese government bond ETFs (2510.T, 511010.SS) - [Portfolio](https://investtester.com/docs/portfolio): inputs of the simulator - [Results](https://investtester.com/docs/results): how return, drawdown, Sharpe, Alpha and Beta are computed - [Monte Carlo](https://investtester.com/docs/monte-carlo): the projection tab: 1,000 paths of 10 years drawn from the daily returns of a run, how to read it, and its limits - [Methodology](https://investtester.com/docs/methodology): data sources, total return prices, simulation rules, the formula of each metric, and currency handling - [Algo trading](https://investtester.com/docs/algo-trading): the strategy API - [API, MCP and AI agents](https://investtester.com/docs/developers): share links, the price API, the engine for Node and the MCP server - [Alternatives](https://investtester.com/docs/alternatives): InvestTester compared with Portfolio Visualizer, testfol.io, Curvo, Composer, QuantConnect and Brazilian comparators ## Optional - [Sitemap](https://investtester.com/sitemap.xml)