Don’t try to time the market!

A Python-Dash app made for long-term investments

Alvaro A. Montoya
3 min readMar 6, 2021
Some buildings in São Paulo, Brazil.

Let’s start with a Maxim: save as much as you can and invest periodically. Unless you are a professional trader, it’s best to focus on your career, art, passion; most people don’t achieve financial independence without hard work. Enough advice, here’s a tool that dynamically web-scrapes Brazilian stock market data looking for the best real-estate funds at a given time.

Real-estate funds (REITs in the US) are interesting for Brazilian investors because many yield high dividends (exempt from income tax under Brazilian law), are less volatile than common stocks (imagine the value of a high-rise in Sao Paulo), and are more accessible and hassle-free than directly owning property. These funds are very attractive for passive-income retirement goals (This is not an investment recommendation!).

The tool is straightforward, written in Python, it leverages Dash and Beautiful Soup to provide a real-estate fund ranking with three visuals. The app automatically updates (retrieves data) every time the user refreshes the site.

The first element is a Dash DataTable (Table 1) where 10 funds are picked out of over 200 using the following criteria:

  1. They must have net liquid assets of 100 million reais (R$) and over (about US$ 20M) and over 10k daily transactions. — just to make sure (loosely) they will be there for at least a few years—
  2. They must yield 8% or more annually on dividends. —this is the passive income part, and also serves as the sorting/ranking parameter —
  3. They need a price-to-assets ratio greater than 0.7 and lower than 1.15. — not too cheap, not too expensive —
  4. At least 3 individual assets (buildings) for funds based on physical assets (not securities). — diversification —
  5. Finally, the ranking must hold at least three types of funds (eg. securities, logistics, commercial). — again, diversification! —

Table 1: Funds’ ranking.

With four elements, Figure 1 holds a candlestick price chart of the last 100 days of market data, a day delta direction and percent change symbol, a dropdown-list for fund selection, and a button that redirects to the fund's profile page in a popular real-estate fund portal.

Figure 1: Price chart.

The last visual is a bar chart that feeds on Google Trends data to display the most-searched-for rising-topics related to the Portuguese term ‘Fundos de Investimentos Imobiliários.

Figure 2: Google trends chart.

Final remarks

Planning your financial well-being for the long-run is important. However limited in scope (no qualitative criteria assessed) and locality (one market), this tool can serve as a data-driven first-tier filter for choosing real-estate funds.

The app is hosted in Heroku and its code repo in this Github. Let me know what you think!

--

--

Alvaro A. Montoya

Economist, Msc. Data Science student at Georgetown University.