Top


Adventures in ML trading - Part 1

ML Trading
Part 1/3 - Exporing the mathematical, statistical, and probabilistic nature of the market. Specifically, I attempt building a mean-reversion probability model, backtesting it against historical data, and understanding where/why it falls short. The results explain why simple statistical models fail to capture the complex beast that is the financial market. Nevertheless, this helps with foundational understanding and there is much to learn that I then iterate in the subsequent posts on the topic of ML based Trading.

Exploring Code LLMs - Instruction fine-tuning, models and quantization

AI
Part 1/3 - Evaluating LLM’s that are specialised in code generation tasks, and evaluating their performance on writing code. This post starts with concepts and theory, while the next 2 parts evaluate specific code models.

Getting Things Done with LogSeq

Management
Introduction I was first introduced to the concept of “second-brain” from Tobi Lutke, the founder of Shopify. The topic started because someone asked whether he still codes - now that he is a founder of such a large company. Tobi went on to explain that he spent the weekend writing some code to customise Logseq to his preferences, and that he’s an active member of the Logseq community. The following weekend, I setup Logseq and learnt its weird ways of working, and have since been an ardent user and fan of the Logseq/Obsidian methodology of building a “second-brain”...

Understanding GPT - Transformers

AI
Part 2/3 - Understanding how modern LLMS work. From RNNs, to transformers, towards modern scaling laws.

All posts

Syncing historical data from IBKR

ML Trading

Syncing Historical Data from IBKR: A Comprehensive Guide In this post, we’ll walk through a complete workflow for downloading historical data from Interactive Brokers (IBKR) and preparing it for analysis and backtesting. Why download from broker ? The core assumption is that we sync data directly from the broker, ensuring its accuracy while trading and backtesting. Once this data is downloaded, we can build ML data batches for training models....

February 1, 2025

Statistical learnings from a failed 2024 santa rally

ML Trading

Intro Santa Claus Rally is a well-known narrative in the stock market, where it is claimed that investors often see positive returns during the final week of the year, from December 25th to January 2nd. But is it a real pattern or just a market myth ? It is also claimed that next years returns are positively correlated to the Santa rally. But is it a real pattern or just a market myth ?...

January 1, 2025

Adventures in ML trading - Part 2

ML Trading

Preface In my previous post, I developed a simple mean-reversion strategy based on an oscillating signal calculated from a stock’s distance to its 50-day simple moving average. However, the results revealed a key shortcoming: the algorithm struggled to account for momentum, leading to poorly timed exits during parabolic moves—either too early or too late. In this post, we’ll dive into momentum and conduct an analysis to validate our assumption. If we can confirm that incorporating momentum enhances the strategy, we’ll move forward with developing a more advanced approach to leverage it effectively....

December 25, 2024

Adventures in ML trading - Part 1

ML Trading

Part 1/3 - Exporing the mathematical, statistical, and probabilistic nature of the market. Specifically, I attempt building a mean-reversion probability model, backtesting it against historical data, and understanding where/why it falls short. The results explain why simple statistical models fail to capture the complex beast that is the financial market. Nevertheless, this helps with foundational understanding and there is much to learn that I then iterate in the subsequent posts on the topic of ML based Trading.

December 19, 2024

Understanding GPT 1, 2 and 3

Machine Learning

Introduction The goal of this series of posts, is to form foundational knowledge that helps us understanding modern state-of-the-art LLM models, and gain a comprehensive understanding of GPT via reading the seminal papers themselves. In my previous post, I covered transformers via the original paper “Attention is all you need” that brought the innovation that made all this progress possible. This post will focus on GPT-3 and its predecessors GPT-1 and 2....

October 1, 2023

Understanding GPT - Transformers

AI

Part 2/3 - Understanding how modern LLMS work. From RNNs, to transformers, towards modern scaling laws.

July 7, 2023

Understanding GPT - A Journey from RNNs to Attention

Machine Learning

Introduction ChatGPT has took the world by storm, and has possibly started the 6th wave. Given its importance, the rush to build new products and research on top is understandable. But, I’ve always liked to ground myself with foundational knowledge on how things work, before exploring anything additive. To gain such foundational knowledge, I believe understanding the progression of techniques and models is important to comprehend and appreciate how these LLM models work under the hood....

June 18, 2023

Loss Functions in ML

Machine Learning

Introduction Loss functions tell the algorithm how far we are from actual truth, and their gradients/derivates help understand how to reduce the overall loss (by changing the parameters being trained on) All losses in keras defined here But why is the loss function expressed as a negative loss? Plot: As probabilities only lie between [0-1], the plot is only relevant between X from 0-1 This means, that it penalises a low probability of success exponentially more....

February 18, 2023