Form 4 looks unusually convenient for quantitative research. It is public, structured and tied to a regulatory deadline: in general, a reporting person must file by the end of the second business day after a reportable transaction. The SEC's Form 4 instructions state the rule and also show why(...)
TL;DR This project tests whether trend-following, a strategy family with decades of documented success in futures markets, transfers to spot FX. Three approaches (time-series momentum, moving-average crossover, and channel breakout) were backtested across the seven major currency pairs from 2003 to(...)
TL;DR: This post builds a forex backtest where a DeepSeek LLM labels market regimes from compact numeric summaries. We compare it to a KMeans baseline, apply monthly walk-forward optimization, and report out-of-sample results from 2023 onward. Prerequisites To fully grasp the regime-labeling(...)
In the previous blogs, we examined supervised learning algorithms like linear regression in detail. In this blog, we look at what unsupervised learning is and how it differs from supervised learning. Then, we move on to discuss some use cases of unsupervised learning in investment and trading. We(...)
This blog introduces retrospective simulation, inspired by Taleb’s "Fooled by Randomness," to simulate 1,000 alternate historical price paths using a non-parametric Brownian bridge method. Using SENSEX data (2000–2020) as in-sample data, the author optimises an EMA crossover strategy(...)
Most trading strategies fail because they assume the market behaves the same all the time. But real markets shift between calm and chaotic, and strategies must adapt accordingly. This project builds a Python-based adaptive trading strategy that: Detects current market regime using a Hidden Markov(...)
Welcome to the second part of this two-part blog series on the bias-variance tradeoff and its application to trading in financial markets. In the first part, we attempted to develop an intuition for bias-variance decomposition. In this part, we’ll extend what we learned and develop a trading(...)
Prerequisites To fully grasp the bias-variance tradeoff and its role in trading, it is essential first to build a strong foundation in mathematics, machine learning, and programming. Start with the fundamental mathematical concepts necessary for algorithmic trading by reading Stock Market Math:(...)
Imagine you have to backtest a strategy on 50 stocks and for that you have to download price data of 50 stocks. But traditionally you have to download ticker by ticker. This sequential download process can be painfully slow, especially when each API call requires waiting for external servers to(...)
Imagine yourself, a great retail trader with an algorithm that flawlessly predicts stock movements for months—until a surprise Fed rate hike sends markets into chaos. Overnight, the model’s accuracy plummets. Why? Concept drift: your model no longer finds patterns in historical data and now(...)
A good trading or investment strategy is only as good as the data behind it. High-quality data is essential if you are backtesting a quant model, analyzing market trends, or building an algorithmic trading system. Prerequisites: To make the most of this blog, it is essential to have a strong(...)
The ARFIMA model is well suited for capturing long-range memory in financial time series. However, it’s not always the case the time series exhibits long memory in their autocorrelation. The ARTFIMA model comes to the rescue to capture not only the long memory but also its short one and the(...)
This is a two-part blog where we’ll explore how Ito’s Lemma extends traditional calculus to model the randomness in financial markets. Using real-world examples and Python code, we’ll break down concepts like drift, volatility, and geometric Brownian motion, showing how they help us understand and(...)
The Kelly Criterion is good enough for long-term trading where the investor is risk-neutral and can handle big drawdowns. However, we cannot accept long-duration and big drawdowns in real trading. To overcome the big drawdowns caused by the Kelly Criterion, Busseti et al. (2016) offered a(...)
The basic Vector Autoregression (VAR) model is heavily used in macro-econometrics for explanatory purposes and forecasting purposes in trading. In recent years, a VAR model with time-varying parameters has been used to understand the interrelationships between macroeconomic variables. Since(...)
Reinforcement learning (RL) is one of the most exciting areas of Machine Learning, especially when applied to trading. RL is so appealing because it allows you to optimise strategies and enhance decision-making in ways that traditional methods can’t. One of its biggest advantages? You don’t have to(...)
Statistical arbitrage is a classic quantitative trading strategy, and pairs trading is one of them. Digital currency perpetual contracts are non-delivery perpetual futures. This project describes using data from the Binance exchange to find perpetual contract pairs whose pairing spreads conform to(...)
Usually, regime detection is made with an HMM estimation over price returns or price return volatility. However, Chen and Tsang (2021) propose to use the Directional Change indicators as input for a HMM to detect regime shifts. They show that the HMM applied to the Directional Change indicators(...)
XGBoost…!!!! Often considered a miraculous tool embraced by machine learning enthusiasts and competition champions, XGBoost was designed to enhance computational speed and optimise machine learning model’s performance. Let's proceed with XGBoost!!! We will cover the following things: Brief of(...)
Whenever you want to estimate a model for multiple time series, the Vector Autoregression (VAR) model will serve you well. This model is suitable for handling multiple time series in a single model. You will learn here the theory, the intricacies, the issues and the implementation in Python and R.(...)
Usually, in algorithmic trading, we talk about AutoRegressive Integrated Moving Average (ARIMA) models. They’re very popular in the industry. You might remember that the “d” component in the model can be 0, 1, 2, etc. What if 'd' could take fractional values? We’ll learn about such models(...)
In the AutoRegressive Moving Average (ARMA) models: A Comprehensive Guide of my ARMA article series, I covered the theoretical aspects of Autoregressive Moving Average models (ARMA). In the AutoRegressive Moving Average (ARMA) models: Using Python, I simulated different ARMA models, their(...)
In the first part of my ARMA article series, I covered the background theory of lag operators, the stationarity and invertibility of Autoregressive Moving Average models (ARMA) and the different types of versions you can create from it. Here, we’ll explore theoretically these models using Python.(...)
Machine Learning (ML) has emerged as a powerful tool in the field of Artificial Intelligence, revolutionising various aspects of our lives. Whether it's recognising human handwriting or enabling self-driving cars, ML has become an integral part of our daily routines. With the exponential(...)
Autocorrelation is a statistical concept that measures the correlation between observations of a time series and its lagged values. It is commonly used in various fields, including trading for technical analysis, to identify patterns, trends, and relationships within data. Autocorrelation helps(...)
Generally, a quant is a professional in the financial technology industry who designs complex algorithms with the help of quantitative analysis. Quants are skilled in mathematics, finance, and computer skills. In the trading domain, quants design and implement algorithms to predict the price and(...)
“The intelligent investor is a realist who sells to optimists and buys from pessimists.” - Benjamin Graham Sentiment Trading strategies work on market sentiment and the trends around them. The strategies are often determined by the price and value of an asset that may fluctuate. Market sentiments(...)
Algorithmic Trading is seeing a rapid expansion of the application of artificial intelligence (AI) and machine learning (ML). These technological developments have completely transformed Algo trading. Making informed decisions requires carefully analyzing both current and historical market data. In(...)
As the name suggests, long short equity strategy is one where we take both long and short positions in different equities. This strategy is normally used by hedge funds to generate greater risk adjusted returns due to its inherently low risk characteristics. In this article, you will learn about(...)
Start learning all about the Dijkstra algorithm for finding the shortest path. We briefly review the Kruskal algorithm, Prim algorithm, Johnson algorithm and Bellman algorithm as well. We'll cover: What is the Dijkstra algorithm? How does the Dijkstra algorithm work? Pseudo code of Dijkstra(...)
This is the second installment of my series on regression analysis used in finance. In the first installment, we touched upon the most important technique in financial econometrics: regression analysis, specifically linear regression and two of its most popular flavours: univariate linear(...)
Machine learning is a need in almost every sector today. Sectors like medicine, transportation, healthcare, advertising and financial technology are tremendously reliant on machine learning. Speaking about the financial technology domain, algorithmic trading practice is extremely efficient with the(...)
Are you looking to get stock market data and analyse the historical data in Python? You have come to right place. After reading this, you will be able to: Get historical data for stocks Plot the stock market data and analyse the performance Get the fundamental, futures and options data For easy(...)
In the previous blogs, we examined supervised learning algorithms like linear regression in detail. In this blog, we look at what unsupervised learning is and how it differs from supervised learning. Then, we move on to discuss some use cases of unsupervised learning in investment and trading. We(...)
Contrary to a more developed market, arbitrage opportunities are not readily realised which suggests there might be opportunities for those looking and able to take advantage of them. This project focuses on China's futures market using Statistical Arbitrage and Pair trading techniques. This(...)
Zipline is a fantastic tool for backtesting and data is the main raw material for doing this kind of analysis. In this post, we are going to focus on how to load our own data files. Through an example, we will create a bundle to load data from csv files downloaded from Yahoo finance.
With the abundance of raw data and the need for analysis, the concept of unsupervised learning became popular over time. The main goal of unsupervised learning is to discover hidden and exciting patterns in unlabeled data. The most common unsupervised learning algorithm is clustering. Applications(...)
Time series modelling is a very powerful tool to forecast future values of time-based data. Time-based data is data observed at different timestamps (time intervals) and is called a time series. These time intervals can be regular or irregular. Based on the pattern, trend, etc. observed in the past(...)
Data cleaning is the time-consuming but the most important and rewarding part of the data analysis process. The process of data analysis is incomplete without cleaning data. But what happens if we skip this step? Suppose we had certain erroneous data in our price data. The incorrect data formed(...)
Technical analysis of price and volume history won’t cut it alone nowadays. When we want to perform value investing and/or measure a security’s intrinsic value, we need to make a fundamental analysis of the security. To perform fundamental analysis we need data, lots of data. We want fundamental(...)
As a quant trader, you are always on the lookout to create and optimise your trading strategies. Backtesting forms a very important part of this process. And for backtesting, access to historical data is a necessity. But it’s a very daunting task to find decent historical price data for backtesting(...)
Is it possible to predict where the Gold price is headed? Yes, let’s use machine learning regression techniques to predict the price of one of the most important precious metal, the Gold. Machine Learning in Trading We will create a machine learning linear regression model that takes information(...)
In Finance and Trading, a large amount of data is generated every day. This data comes in the form of News, Scheduled Economic releases, employment figures, etc. It is clear that the news has a great impact on the prices of stocks. Every trader takes great efforts in keeping track of the latest(...)
In this article, we will study a deep learning framework based on recurrent neural networks to predict daily equity index price movements. Specifically, the focus will be on long short-term memory (LSTM) networks - which are a type of recurrent neural network. Different types of inputs and network(...)
The first quarter of 2020 has been one of the most challenging times in the post World War II era. The crash in oil prices due to geopolitical reasons and the COVID-19 global pandemic were the dominant themes. Financial markets act as bellwethers and give us a reflection of the overall sentiment(...)
In this post, we will learn about Markov Model and review two of the best known Markov Models namely the Markov Chains, which serves as a basis for understanding the Markov Models and the Hidden Markov Model (HMM) that has been widely studied for multiple purposes in the field of forecasting and(...)
In the last blog, we examined the steps to train and optimize a classification model in scikit learn. In this blog, we bring our focus to linear regression models. We will discuss the concept of regularization, its examples(Ridge, Lasso and Elastic Net regularizations) and how they can be(...)
When you are completely immersed in wanting to learn something new, you start looking for everything that surrounds the learning process. And with the aspiration to learn Algorithmic Trading, there must be certain questions crowding your mind, like: How do I learn Algorithmic Trading? What are the(...)
Since predicting the future stock prices in the stock market is crucial for the investors, Time Series and its related concepts help in organizing the data for accurate prediction. In this article, we are focusing on Time Series, its analysis and forecasting. In this article, we aim to cover the(...)
With the advent of several machine / deep learning models, there have been several theories emerging in applying these techniques for stock market prediction because of the difficulty and complexity it involves. In this project, we’re trying to solve the problem using a classifier to predict(...)