Michael's blog

Life-long Learning

Generated through Gemini

On April 7, 2025, somewhere near the bottom of the tariff crash, my trading bot sold three of its four positions. It wasn’t supposed to be trading that day. It wasn’t supposed to be trading that week. And, I didn’t find out for another eighteen months.

Two and a half years ago, I backtested Hybrid Asset Allocation (HAA) and liked what I saw: steady growth, small drawdowns, a strategy that quietly steps aside when the market turns ugly. So I put it live. Steady, it turned out, was a polite word for slow. From June 2024 to October 2026, my account compounded at 8.2% a year while SPY did 17.0%, and the drawdown protection I’d signed up for came in about 2 percentage points better than simply holding the index. I didn’t assume HAA was broken. I thought it was just sluggish, and that it would surge someday.

So I went looking: a stack of papers on tactical asset allocation, each promising a way to make strategies like HAA react faster or hold up better. The plan was simple. Test the best ideas, keep the winner.

The plan lasted about ten minutes.

Read more »

Ever built something so carefully that its most valuable answer turned out to be “no”?

That’s pretty much the story of my last few weeks. I went looking for edge in the mean reversion behind pairs trading — the whole statistical-arbitrage playbook — and built a framework as rigorous as I could to test the idea honestly instead of flatteringly. Then I ran it on three different asset universes, one after another, and the backtest results failed me three times in a row.

This whole project started life as my final project for the CQF (Certificate in Quantitative Finance). I passed — but when I handed it in, I had that nagging feeling that I’d rushed it, and that I could do it far more thoroughly if I actually gave it the time it deserved. A couple of months later, I went back, rebuilt the framework from scratch, and let it run on real data until it told me something I didn’t want to hear. This post is the story of those three rejections — stocks, ETFs, and commodity futures — and why I’ve come around to thinking of this carefully built framework like the manager who rejects every proposal you bring him… and turns out to be right every time.

Read more »

Photo by Gemini, Two trading scripts. One IB Gateway. Constant timeouts.

Picture two people trying to call the same phone number at the same time. One gets through. The other gets a busy signal — or worse, connects but hears nothing. Neither knows what the other is doing. Neither knows there is another person.

Running multiple trading strategies through a single IBKR TWS or IB Gateway is almost exactly this. The platform wasn’t designed for concurrent connections — it’s a trading terminal, not a message router. When two strategies fire at the same time, one gets data and one gets silence, and the logs rarely tell you which is which.

I’d been sitting on the fix for a while: a message queue in the middle, one process owning the IB connection, everything else talking to it. The architecture was clear in my head. I just didn’t have the time to build it solo. Now, since the AI coding capability improves drastically, I finally decided to open the Claude Code and said: “I have an idea. Help me build it.“

This is what building with AI actually feels like.

Read more »

Extracted from Website: SteadyOptions

Stock option has always been a popular way to trade due to its high leverage, which allows traders to control a large amount of assets with a small amount of capital. However, the complexity of stock options can be overwhelming for many traders. For those who are the beginners of the stock option, today we’re going to introduce a simple trading strategy that can help you to get started with stock options trading without much effort.

Read more »

Cover image created through Copilot

Calculating the arithmetic mean and the variance (or the standard deviation) of a dataset is a fundamental task in statistics. These calculations provide valuable insights into the central tendency and distribution of the data in the linear space. However, it’s going to be a resource-intensive operation if you do these calculations repeatedly, especially when dealing with large datasets. To save you time and the memory on your computer, we’re going to explore an incremental approach to calculate the arithmetic mean and the variance (or the standard deviation) of a dataset.

Read more »

Cover image created through Copilot

Traditional grid trading systems, despite their popularity, face critical limitations with static price levels and poor performance in trending markets. Also, the vulnerability to sudden market gaps and the inability to adapt to changing market volatility is another huge obstacle. Given the promising and speedy advance in both hard and software of machine learning, Francesco Rundo, *Francesca Trenta, Agatino Luigi di Stallo, and Sebastiano Battiato* in the article Grid Trading System Robot (GTSbot): A Novel Mathematical Algorithm for Trading FX Market proposed a new type of Grid Trading System that solves the challenges of the traditional one. This system dynamically optimizes entry/exit points and adapts to market conditions in real-time, maximizing profit potential while managing risks. Join me as I break down the complete process, from data preparation to model training, and reveal how you can implement this advanced trading strategy yourself.

Read more »

Cover image created through Copilot

Have you ever struggled to understand Bayes’ Theorem? You’re not alone. I used to find the formal definitions and explanations of Bayes’ Theorem on Wikipedia confusing and hard to grasp. But after revisiting the basics of Venn Diagrams, everything suddenly became clear! Let me break down the complex formula into easy-to-digest parts using color coding and visual aids with Venn diagrams. Let’s dive in!

Read more »

Cover image created through Copilot

Ever wondered how to tell if the market is roaring like a bull or growling like a bear? This article will dive deep into how these indicators perform in different market conditions, comparing manual identification with indicator-based methods. By adding this market indicator, you’ll see how momentum strategies shine in bull markets, while mean reversion and pair trading strategies come into play during bear markets. Plus, we’ll uncover some insights that you might never have considered while applying market indicators in your own algorithm trading script. Now, let’s dive in and uncover the secrets of the market together!

Read more »

Cover image created through Copilot

Feature engineering is a make-or-break step in the machine learning pipeline, but even seasoned practitioners can fall victim to a subtle yet devastating mistake. While labeling or transforming data may seem like a straightforward task, a common pitfall lurks in the shadows, waiting to undermine your model’s performance in ways you might not expect. This often overlooked issue can lead to a phenomenon known as “look-ahead bias,” where your model inadvertently gains access to information it shouldn’t have during training. In this post, we’re going to talk about what this pitfall exactly is and how to address it.

Read more »

Cover image created through Copilot

Testing APIs with OAuth 2.0 authentication can be a complex task, but Postman simplifies the process by providing built-in support for various OAuth 2.0 flows. Postman seamlessly complements OAuth 2.0 authentication, allowing developers to easily configure settings, obtain access tokens, and manage token lifecycle. In this post, we will quickly go through this process by utilizing the Postman software.

Read more »
0%