Articles

Vibe Coding, Kotlin, Finance, and Data Visualization

Recently, I came across a paper discussing an experiment and tried to reproduce it. Here’s a brief summary: - Portfolio A: In a bull market, grows by 20%; in a bear market, drops by 20%. - Portfolio B: In a bull market, grows by 25%; in a bear market, drops by 35%. - Bull market probability: 75%. According to the paper, both portfolios should have a one-year expected return of 10%.

Treat life like a marathon, not like a sprint

Like most of us, I am daily flooded with thoughts about life, my objective position in it, whether I am missing anything, or whether I need to do better. Am I providing enough for my family? Is my career on track? Am I being healthy enough? Am I just passing through life instead of aiming to strive? Those thoughts have been slowly mitigated, but they never got away. Over time, I have been slowly accepting this reality, and I came to realise that all the marathon training and long-distance running have helped me come to terms with these facts.

Uploading SARIF Reports to GitHub

Recently I wanted to add Lint reports to a repository on GitHub. The goal is to report potential Lint violations when new code is committed, to make sure that all the committed code is lint-warning-free and pretty. My first idea was to look for a GitHub action that could run ./gradlew lint and report it as a PR comment. After asking about ideas in the Android Study Group, Carter Jernigan and Justin Brooks suggested me to upload directly the SARIF files into GitHub.

KotlinConf 2024 announcements

The first day of the KotlinConf 2024 is over, and there has been a significant amount. After 5 years the conference happened again at The Bella Center in Copenhagen, a fantastic venue close to the historical center of the Danish capital. The last two weeks have been intense, with the Google I/O announcing another set of relevant features for Android and Kotlin developers. Most notably, Google is now supporting KMP for Android development.

HTTP chunk requests with Android and ktor

In this very short article, I will explain briefly what is a chunk or streamed HTTP request, what are the benefits of using it, and how it works in Android. Android apps use HTTP requests to download data from a backend. This information is stored and processed on the app to make it functional. HTTP requests are executed using different frameworks on Android. The most common ones are Retrofit or OkHttp.

My Investing Summary of 2022

Another solar rotation passed, and the world experienced a plethora of unexpected events. In the aftermath of the Corona epidemic that altered the course of the last couple of years, we had the unfortunate invasion of Ukraine by Russian forces, the tightening of Corona measures in China (and toward the end of the year, their withdrawal and gradual reopening of the economy), an ongoing economic recession, the rate hike by the FED and the general uncertainty of the most immediate future.

KMP, iOS Developers and Production

Kotlin Multiplatform (or KMP, KMM Mobile, etc) has been widely used for a number of years in applications that are currently in production. JetBrains compiled a website listing some of the companies that are currently using KMP. Since the advent of the mobile platforms we enjoy today, there has always been a certain market interest to push multiplatform technologies, such as Cordova, Xamarin, and others. With more or less success, those technologies aimed to provide a unified framework to develop multiple codebases, mostly focusing on the aspect of pricing (create code once, deploy multiple times).

A recapitulation of investing in pandemic times

It has been around 14 months since the pandemic started. We have all been affected by it to a greater or lesser degree, and the investing world has not been an exception (although surprisingly, the stock market is one of the winners of the pandemic). In this post I will share how the pandemic changed my investment thesis, the things I learned, and the mistakes I did. 14 months into the crisis of our generation (and with a few months to recover whatever the new normal will be), we now know that things will never be the way they used to be.

A short story of randomness (I)

I have always been fascinated by the above comic strip. A discussion on randomness and determinism becomes as much a philosophical issue as it is a practical one. They are used in a variety of applications: from the obvious cryptography, gaming or gambling to the less evident politics or arts. How can we be sure that a number is random? Will observing the process mine our efforts on generating the random number, similar to the observation of a cat inside a box with a decaying radioactive atom?

From Java to Kotlin and back (III): Calling Java from Kotlin

This article is part of a series. You can find the remaining article of the series here: From Java to Kotlin and back (I) — Calling Kotlin from Java From Java to Kotlin and back (II): Calling Kotlin from Java In this last chapter of the series, we will evaluate consideration when calling Java code from Kotlin. One could argue that even in this situation happens often, keeping considerations in mind for some code that might legacy is not that practical.

A recapitulation of investing in pandemic times

Planted June 20, 2021

It has been around 14 months since the pandemic started. We have all been affected by it to a greater or lesser degree, and the investing world has not been an exception (although surprisingly, the stock market is one of the winners of the pandemic).

In this post I will share how the pandemic changed my investment thesis, the things I learned, and the mistakes I did. 14 months into the crisis of our generation (and with a few months to recover whatever the new normal will be), we now know that things will never be the way they used to be.

This is all based on my personal experience and views, without censorship or sweeteners. All, something or nothing might apply to your personal circumstances. But it is how it works for me.

This is how my portfolio looked like before the pandemic started, in December 2019:

Certainly, over time we increase our investment knowledge and hone our craft. The more time we spend, the more mistakes we make. And subsequently, the more mistakes we avoid in the future. Whereas the portfolio was undergoing some refinement, it was questionable pandemically-resilient:

  • It didn’t have enough aristocracy (companies steadily increasing their dividend over time)
  • There was too much weight of the cyclical sector, which does not perform regularly.
  • There was too little weight of the defensive sector (and particularly consumer defensive), which acts more stable during time crisis).
  • The quality of certain companies was questionable.

When the pandemic started, around March 2020, the portfolio hit a -25% of value. Many companies slashed their dividend last year (Unibail Rodamco, British Telecom, Aegon and Banc Sabadell), some of them announced the dividend will not be paid for years to come (Unibail) and some others have not even announced the new dividend policy (Banc Sabadell).

I was lured in some of those companies for the high yield. A pandemic proved this parameter should not be trusted too much.

Fast forward to 2021

Let’s move to the current days, and see how the portfolio has changed:

Despite being an evolution of the portfolio of 2019, it has changed significantly. Now most of the portfolio has a certain degree of aristocracy, it is mostly composed by defensive companies, and the quality of them has undoubtedly increased. I sold a few of the companies I owned (BMW, Daimler, BNP Paribas) and rotated to other ones I feel more comfortable with.

During 2020 my dividend income increased by 28.38% compared with 2019. 2021 has currently a similar trajectory.

I learned the following lessons:

Sell infrequently

When the stock was crashing in 2019, many thoughts crossed my mind. I previously did the homework, and learn the theory about buying instead of selling during a crisis. I did not struggle too much to avoid selling, but the thoughts occasionally appeared. I am thankful I didn’t.

I will use some examples of my particular portfolio. Daimler hit 22 EUR during the low bottom of the crisis (now 77):

Even quality stock like Microsoft took a toll during the Corona time, just with a less pronounced slope:

A crash in the market happens when many people (or machines) are selling most of the stock and not having enough buyers, hence the prices plummet. In a world with so much automated trading, there are also stop-losses that start triggering and provoke a chain reaction. The market crashes, and a lot of money gets lost.

Prices have recovered in different phases, and in these unusual times the stock market is back on an all-time high:

Selling when everybody is selling will likely deteriorate your patrimony. Profitable investing is the result of a slow cognitive process, and not of a process forced by impulses and emotions.

Losses are not losses unless you sell, that is when they materialize.

Think carefully before selling a stock. And when you do it, never look back.

Buy quality

High dividend yield lures investors, attracted by the possibility of finding a bargain in the market. More often than not, a high dividend yield is premonitory of future problems. Some examples of companies with a high dividend yield that cut their dividend:

  • Unibail Rodamco had a dividend yield of around 8% pre-pandemic. They have slashed their dividend until at least 2024.
  • British Telecom had a dividend yield of 7%. They cut their dividend for the second half of 2020 and for the entire.
  • Simon Property Group cut its dividend from $2.10 per share to $1.30 per share.

There are many examples like this. However, quality companies like Microsoft, Coca-Cola, Johnson&Johnson, Procter&Gamble… did not cut the dividend. In fact, they have increased it as they have done in the last 20, 40 or 50 years.

Looking forward to the future, these are the sort of companies I want to have on my portfolio. I want to have a steady and predictable source of income for many years to go, and companies with a certain degree of aristocracy provide that stability. I am sure I will be losing some trains, but I do prefer having a solid financial ground.

Buy mostly companies with a solid track of dividend payment.

Ignore the pirates and focus on trustable sources

We live in a world with an abundance of information, and it is easy to fall prey to too much information.

Hit a stone with your feet and you will find 10 financial advisors, 3 paid webinars, and another plethora of dodgy individuals trying to make money from your money. I will be copying a brilliant excerpt from <em>The Four Pillars of Investing</em>, I book I highly recommend:

When a broker calls you suggesting that the price of a particular stock is going to skyrocket, what he is really telling you is that he does not consider you to be too smart, otherwise you would realize that if he really knew the price was going to go up, he wouldn’t tell you, not even his own mother. Instead, this individual would immediately quit his job, mortgage himself up to his neck, buy as many shares as he could, and then lie down on a beach.

We need to reconcile the legit sources with the fact that we might face predatory behavior to learn. Besides reading books and regularly tackling my progress, I feed myself with the literature of some individuals I know and trust, and I know they are not guided by unscrupulous and ulterior motives. Twitter is actually a fantastic source to connect with people sharing their investment ideas and thesis. This is a non-exhaustive list of folks I follow and I can recommend:

Also, as Craig Rowland puts it in the book The Permanent Portfolio, “the majority of the money that is earned during your life will come from your profession.”. I have a highly paid occupation as a Software Engineer and do not have the time to constantly monitor stocks and analyze them. I read about them at a high level, as a manager would handle its company, without micromanaging its decisions. You need to understand financial vocabulary, be able to analyze companies yourself, and understand the nomenclature. But you do not need to do 100% of the analysis for your portfolio.

I externalize the company analysis to folks I trust and focus on what I do better: developing software, and getting a good paycheck for that.

Diversify

Mistakes will be made, no matter how hard you work to avoid them. Mainly because it is not up to you: companies may lie on their SEC filings and 10-K, guidances might not be meet, pandemics start, or any other external vicissitude.

When Kraft&Heinz cut its dividend from $0.625 to $0.40, Warren Buffet had a significant portion of its shares. If Warren Buffet cannot predict a dividend cut, we all can forget about it.

If a company cut its dividend by 100% and this company accounts for 20% of your portfolio, your passive income decreased by 20%. If this company accounts for 1% of your portfolio, your passive income decreased by 1%.

Always diversify in companies.

Increase your sources of income

Having several sources of income protect us as well against future crisis. The average billionaire has seven sources of income. I haven’t found anything, but the average laborer likely has one: the labor. That is fantastic until your labor ceases to exist.

Another source of income, besides the dividend, can be a second job, an online business, or a side gig like book writing, articles, etc. They might not account at the beginning for a significant chunk of your total income, but every bit ads.

As a book author, I have found interesting side effects of writing technical books. The pay might not be great (although it certainly adds), but being a recognized expert in your field allows you to meet interesting people, have conversations with certain companies and attend conferences. This does not mean per-se to increase your income, but it might lead to other circumstances (for instance, getting paid consultancy).

Every bit counts. Try to generate more sources of income

Some thoughts for the future

After the massive generation of money that governments and central banks incurred during this crisis, there is a pending threat of inflation and some other economic difficulties on the horizon. This might likely happen (or maybe not), but certain stock seems to provide decent protection against inflation. Consumer staples and other industries can cope with inflation and reflect it on its value, and I plan to keep adding this sector in the future.

I do not plan to retire anytime soon, but I am certainly worried about the prospect of inflation eroding my patrimony. Inflation destroys cash value, and over a long period it can have severe consequences. By now I will keep adding Defensive and Consumer Defensive stocks to my portfolio.

Debt

There are passionate discussions at the Financial Community on Twitter. Some people do take debt in order to get mortgages, buy houses and increase their patrimony faster. Certainly, the theory says that in a period of low-interest rates getting yourself in debt to invest can be highly profitable. I will not be doing this. Not because I do not believe the theory, but because I am debt-averse. I only have the contracts that are strictly required to live (I do not even have a telephone contract, I just pay it on a monthly basis). I do not like having external dependencies I can’t control, and debt is one of them.

I read frequently of people using margin on their broker. Doing this during March 2020 would have been highly profitable, as prices went abnormally down for a period of time. However, I dislike completely the idea of owning money to my bank or broker.

I will be losing this train, and that is perfectly fine. I am psychologically very happy receiving passive income monthly without the need of getting into debt.

I write my thoughts about Software Engineering and life in general on my Twitter account. If you have liked this article or if it did help you, feel free to share, 👏 it and/or leave a comment. This is the currency that fuels amateur writers.