Calculate IBOV by it shares

Livio de Campos Alves
2 min readJul 3, 2023


IBOV is the abbreviation for Ibovespa, which is the main stock market index of the São Paulo Stock Exchange (B3) in Brazil. It represents a weighted average of the prices of the most actively traded stocks on the exchange and is considered a benchmark for the Brazilian stock market. IBOV stands for Índice Bovespa, which translates to Bovespa Index. The index is composed of a selected group of stocks from various sectors, including finance, industry, utilities, and more. It provides a snapshot of the overall performance of the Brazilian stock market.

You can find the list of stocks that make up the Ibovespa index (IBOV) on the website of the São Paulo Stock Exchange (B3) or through financial data providers. You can visit the B3 website and navigate to the Ibovespa section to find the list of stocks on this link B3.

In order to automate this task I will use Python which is a popular programming language widely used for data analysis, including financial and stock market analysis. It provides a rich ecosystem of libraries and tools for data manipulation, visualization, and statistical calculations.

One easy way to run it without install or setup anything complex is to use Google Colab. It is a free cloud-based platform that provides a Jupyter Notebook environment, allowing you to run Python code directly in your browser without any setup or installation. It offers access to powerful hardware resources, such as GPUs and TPUs, and allows collaboration with others in real-time.

Go to the Google Colab website ( and sign in with your Google account and create a New Notebook.

In the first cell of the notebook, import the necessary libraries for working with stock data, such as pandas, numpy, and yfinance. For example:

The function below helps out to get the current price for a symbol.

In order to read B3 data you could just write a web-scraping to B3 url and get page data or even inspect requests in order to get urls calls and it results. I chose to inspect and got the URL for this request . I extracted the json result and save it on a gist in order to be easy to work with it. In addition I also have B3 url to raw data on python script. I parsed the result text as Json showed below.

Now its time to get the adjustment index for IBOV formula, the adjustment index will divide the sum of quote multiplied by theorical quantity.

The full code could be found on this gist IBOV.ipynb if you had error on result it could be related to the B3 url, just get an update url or use the commented url on code showed to get it as a compositon of IBOV on June, 1, 2023.