Quant Mashup - Quant Insti Retrospective Simulation in Trading: Testing Strategies Beyond Realized Price Paths [Quant Insti]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(...) Step-by-Step Python Guide for Regime-Specific Trading Using HMM and Random Forest [Quant Insti]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(...) Bias-Variance Decomposition for Trading: ML Pipeline with PCA, VIF & Evaluation [Quant Insti]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(...) Bias-Variance Tradeoff in Machine Learning for Trading [Quant Insti]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:(...) How to Download Multiple Stocks Data at Once Using Python Multithreading [Quant Insti]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(...) Autoregressive Drift Detection Method (ADDM) in Trading [Quant Insti]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(...) Historical Market Data Sources [Quant Insti]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(...) ARTFIMA Model for Trading [Quant Insti]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(...) Laying the Groundwork for Ito's Lemma and Financial Stochastic Models [Quant Insti]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(...) The Risk-Constrained Kelly Criterion: From definition to trading [Quant Insti]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(...) A time-varying-parameter vector autoregression model with stochastic volatility [Quant Insti]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 in Finance: Resources and Expert Advice from Paul Bilokon [Quant Insti]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(...) Crypto Perpetual Contract Pair Trading [Quant Insti]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(...) Directional Change in Trading: Indicators, Python Coding, and HMM Strategies [Quant Insti]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(...) Introduction to XGBoost in Python [Quant Insti]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(...) Vector AutoRegression models: Implementation in Python and R [Quant Insti]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.(...) AutoRegressive Fractionally Integrated Moving Average (ARFIMA) model [Quant Insti]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(...) AutoRegressive Moving Average (ARMA) models: Using R [Quant Insti]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(...) AutoRegressive Moving Average (ARMA) models: Using Python [Quant Insti]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.(...) K-Nearest Neighbors Algorithm: Steps to Implement in Python [Quant Insti]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 growth(...) Autocorrelation in Trading: A Practical Python Approach to Analyzing Time Series Data [Quant Insti]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(...) Best Quant websites | An unconventional guide [Quant Insti]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(...) Top 7 blogs on Sentiment Trading | 2022 [Quant Insti]“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(...) Top 10 blogs on Machine Learning in 2022 [Quant Insti]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(...) Long Short Equity Strategy [Quant Insti]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 how(...) Dijkstra algorithm [Quant Insti]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(...) Linear regression on market data using Python and R [Quant Insti]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(...) Free Resources to Learn Machine Learning for Trading [Quant Insti]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(...) Stock Market Data And Analysis In Python [Quant Insti]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(...) An Introduction to Unsupervised Learning for Trading [Quant Insti]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(...) Kalman Filter Techniques And Statistical Arbitrage In China's Futures Market In Python [Quant Insti]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(...) Building a Zipline bundle for Yahoo CSV files [Quant Insti]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. Hierarchical Clustering in Python [Quant Insti]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(...) Autoregression: Model, Autocorrelation and Python Implementation [Quant Insti]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(...) Why is data cleaning important and how to do it the right way? [Quant Insti]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(...) Fundamental and Sentiment analysis with different data sources [Quant Insti]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(...) How to Get Historical Market Data Through Python Apis [Quant Insti]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(...) Gold Price Prediction Using Machine Learning In Python [Quant Insti]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(...) VADER Sentiment Analysis in Algorithmic Trading [Quant Insti]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 news(...) LSTM Networks: Can They Predict Equity Index Prices? [Quant Insti]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(...) Trend Analysis using Open Interest, Rollover and FII/DII Activity in Python [Quant Insti]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 for(...) Markov Model - An Introduction [Quant Insti]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(...) Building and Regularizing Linear Regression Models in Scikit-learn [Quant Insti]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(...) Essential Books on Algorithmic Trading [Quant Insti]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(...) All About Time Series: Analysis and Forecasting [Quant Insti]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(...) Predicting Bank Nifty Open Price Using Deep Learning [Quant Insti]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(...) Principal Component Analysis in Trading [Quant Insti]As trading becomes automated, we have seen that traders seek to use as much data as they can for their analyses. But we all know that adding more variables leads to more complications and that in turn might make it harder to come to solid conclusions. Think about it, we have more than 3000 companies(...) Monte Carlo Simulation: Definition, Example, Code [Quant Insti]Years ago, I had made it to the final round in an interview for a Senior Delta One/Quantitative Futures position at an HFT firm (unnamed for privacy). Things were going well, I had answered two out of three of those ridiculous questions that are only applicable in Subsaharan Africa or Finance(...) Automated Trading Systems: Architecture, Protocols, Types of Latency [Quant Insti]The automated trading system or Algorithmic Trading has been at the centre-stage of the trading world for more than a decade now. A “trading system”, more commonly referred as a “trading strategy” is nothing but a set of rules, which is applied to the given input data to generate entry and(...) Pivot Point Strategy [Quant Insti]In this project, we analyze different intraday trading strategies with Pivot Points. After defining different ways of calculating the Pivot Point, we do a Backtest with the most classic strategies and a different variant to those normally taught in textbooks. To learn about Pivot Point and how to(...)