InvestTester
🇺🇸  en🇧🇷  pt-br🇪🇸  es🇫🇷  fr🇯🇵  ja🇨🇳  zh
  • Portfolio
  • Algo Trading
  • AI
  • Docs
  • API
  • Platform
  • Tickers
  • Portfolio
  • Algo Trading
  • Results
  • Methodology
DocsTickersYahoo Finance TickersTicker ModifiersBrazilian TickersPortfolio BacktestAlgo TradingBacktest ResultsMethodology

Methodology

This page states where the data comes from and how each number is computed, so you can check a result or compare it with another source.

Data sources:

  • Yahoo Finance: daily prices of stocks, ETFs, indices, crypto and currency pairs. USFED is built from the yield of the 13-week US Treasury bill (^IRX).
  • Banco Central do Brasil: the SELIC rate (SELIC.SA), the IPCA inflation index (IPCA.SA) and the IMA-B index (IMAB.SA).
  • Tesouro Nacional: the prices of Brazilian government bonds (Tesouro Direto), e.g. NTN-B.SA(2035).

See Tickers for how to write each code.

Prices and total return:

Stock and ETF prices are the Yahoo adjusted close, which is adjusted for splits and dividends. A dividend shows as a higher return of the asset, not as cash in the portfolio, so the results are total return. SELIC.SA, USFED and FIXED accumulate their full yield.

A result can differ from another site for these reasons:

  • The other site shows the price return, without dividends.
  • Each new dividend or split rescales the earlier adjusted prices, so a past price can differ from the price traded on that day. The returns stay the same.
  • Yahoo can apply a recent dividend late, which shows as a false drop on the ex-dividend date until it does.
  • Spin-offs are not adjusted and show as a loss.
  • Brazilian bonds that pay coupons (NTN-B, NTN-C, NTN-F) show price changes only.
  • Only whole units are bought, so part of the balance can stay in cash.

How the simulation works:

  • The simulation runs in your browser with one price per asset per day, and orders are filled at the price of that day.
  • On the first date the balance is invested by the target percentages. Only whole units are bought, so use the fraction modifier for expensive assets.
  • Deposits enter on the dates of the selected frequency, counted from the start date, and available cash is invested every day.
  • With a frequency other than None, the portfolio is rebalanced to the target percentages on the same dates. With None there are no deposits and the first allocation is held.
  • There are no fees, taxes, bid-ask spreads or slippage, and uninvested cash earns no interest.

How the results are computed:

  • Return (Var): the daily returns compounded over the range (time-weighted). The daily return is (value - deposit of the day) / previous value - 1, so deposits do not count as return.
  • Annual return (Annual Var): (1 + return) ^ (trading days per year / number of daily returns) - 1. The trading days per year are measured from the dates of the range: about 252 for stocks and 365 for crypto.
  • Volatility: the sample standard deviation of the daily returns, multiplied by the square root of the trading days per year.
  • Max Drawdown: the largest drop of the compounded return from its previous peak, so a deposit does not hide a loss.
  • Sharpe: (annual return - Risk Free Rate) / volatility. The Risk Free Rate is a setting, 5% per year by default.
  • Beta: the covariance of the daily returns of the portfolio and of the benchmark, divided by the variance of the benchmark returns, on the dates that both have.
  • Alpha: annual return - (Risk Free Rate + Beta × (annual return of the benchmark - Risk Free Rate)).

The Market Benchmark is a setting, ^SP500TR by default (the S&P 500 with dividends). It is simulated with the same balance, deposits, frequency and range as the portfolio. See Results for every field.

Currency:

Each asset keeps the currency of its market, and nothing is converted unless the ticker has a currency suffix (e.g. NVDA:BRL), which converts the prices with the daily exchange rate from Yahoo Finance. An asset in a currency other than the page currency gets a warning, and its prices are used as they are. The Market Benchmark is converted to the page currency, unless its ticker sets one.

Limits:

The results are historical simulations. Past performance does not guarantee future results, and nothing on this site is investment advice.

InvestTester | Created by Tpessia
support@investtester.com