Blog

Synthetic ETF Data Generation (Part-2) - Gaussian Mixture Models
PythonQuant

Synthetic ETF Data Generation (Part-2) - Gaussian Mixture Models

This post is a summary of a more detailed Jupyter (IPython) notebook where I demonstrate a method of using Python, Scikit-Learn and Gaussian Mixture Models to generate realistic looking return series. In this post we will compare real ETF returns versus synthetic realizations. To evaluate the similarity of the real and synthetic returns we will compare the following: * visual inspection * histogram comparisons * descriptive statistics * correlations * autocorrelations The data set we will

READ MORE
A Dead Simple 2-Asset Portfolio that Crushes the S&P500 (Part 4)
PythonQuant

A Dead Simple 2-Asset Portfolio that Crushes the S&P500 (Part 4)

For newsletter subscribers this post is best viewed directly on my blog. Recap In Part 3 of the series we reviewed the relationship between returns and correlation of the 2-asset portfolio UPRO and TMF. The basic equal weight strategy was very compelling in terms of total return and CAGR. However, the strategy is susceptible to large drawdowns, especially in situations where US equities and long term bonds are out favor, for example in the 2015 and 2018 periods. We also went over some prototy

READ MORE
A Dead Simple 2-Asset Portfolio that Crushes the S&P500 (Part 3)
PythonQuant

A Dead Simple 2-Asset Portfolio that Crushes the S&P500 (Part 3)

Recap This is an update to the original blog series that explored a simple strategy of being long UPRO and TMF in equal weight, inverse volatility and inverse-inverse volatility. This strategy crushed the cumulative and risk-adjusted returns of the benchmark SPY etf. However through our research we determined that this strategy is heavily dependent on the correlation between the two assets. This strategy works best when correlations are positive and prices are trending positively, however, theo

READ MORE
Synthetic Data Generation (Part-1) - Block Bootstrapping
PythonQuant

Synthetic Data Generation (Part-1) - Block Bootstrapping

Outline * Introduction * An Alternative Solution? * Notebook Description and Links * Conclusions * Future Work * Resources and Links Introduction Data is at the core of quantitative research. The problem is history only has one path. Thus we are limited in our studies by the single historical path that a particular asset has taken. In order to gather more data, more asset data is collected and at higher and higher resolutions, however the main problem still exists; one historical path

READ MORE
Download Intraday Stock Data with IEX and Parquet
Pythondata

Download Intraday Stock Data with IEX and Parquet

Post Outline * Why IEX? * Why Parquet? * System Outline * Code * Links WHY IEX? IEX is a relatively new exchange (founded in 2012). For our purposes, what makes them different from other exchanges is they provide a robust FREE API to query their stock exchange data. As a result we can leverage the pandas-datareader framework to query IEX data quite simply. WHY PARQUET? I don't use Hadoop, however Parquet is a great storage format within the pandas ecosystem as well. It is fast, s

READ MORE
Labeling and Meta-Labeling Returns for ML Prediction
EducationPython

Labeling and Meta-Labeling Returns for ML Prediction

Post Outline * Introduction * Links * Embedded Notebook INTRODUCTION This post focuses on Chapter 3 in the new book Advances in Financial Machine Learning by Marcos Lopez De Prado. In this chapter De Prado demonstrates a workflow for improved return labeling for the purposes of supervised classification models. He introduces multiple concepts but focuses on the Triple-Barrier Labeling method, which incorporates profit-taking, stop-loss, and holding period information, and also meta-labeli

READ MORE
Exploring Alternative Price Bars
PythonQuant

Exploring Alternative Price Bars

Post Outline * Introduction * Links * Embedded Notebook Introduction This post explores a concept at the heart of quantitative financial research. Most qfin researchers utilize statistical techniques that require varying degrees of stationarity. As many of you are aware financial time series violate pretty much all the rules of stationarity and yet many researchers, including me, have applied or will apply techniques when not appropriate thereby calling into question many of the resulting

READ MORE
Mixture Model Trading (Part 5 - Algorithm Evaluation with pymc3)
PythonQuant

Mixture Model Trading (Part 5 - Algorithm Evaluation with pymc3)

Post Outline * Recap * Chapter Goals and Outline * Links * Embedded Jupyter Notebook Recap See <Mixture Model Trading (Part 1, Part 2, Part 3, Part 4, Part 5, Github Repo)>. This research demonstrates a systematic trading strategy development workflow from theory to implementation to testing. It focuses on the concept of using Gaussian Mixture Models as a method for return distribution prediction and then using a simple market timing strategy to take advantage of the predicted asset retu

READ MORE
Mixture Model Trading (Part 4 - Strategy Implementation)
PythonQuant

Mixture Model Trading (Part 4 - Strategy Implementation)

Post Outline * Chapter Goals and Outline * Links * Introduction * Mixture Model Trading Algorithm Outline * GMM Algorithm Implementation * Next Steps Chapter Goals and Outline * Use Part 3 - strategy research as a basis for algorithmic trading strategy. * Implement strategy using the Quantconnect platform. Links * Mixture Model Trading Github Repo * Part 4 Jupyter Notebook Link * Full Algorithm Python Script Introduction This notebook will walkthrough the algorithm implement

READ MORE
Mixture Model Trading (Part 3 - Strategy Research)
PythonQuant

Mixture Model Trading (Part 3 - Strategy Research)

Post Outline * Introduction * Links * Notebook * Next Steps Introduction This is the beginning of a three part series that I completed towards the end of 2017 as a learning module for Quantinsti.com. The purpose of the series is to demonstrate a research workflow focused around the theory and application of mixture models as the core framework behind a algorithmic trading strategy. Below is a quote taken from the README of the github repo: “The primary goal of this repo is to demonstrat

READ MORE
Mixture Model Trading (Part 2 - Gaussian Mixtures)
PythonQuant

Mixture Model Trading (Part 2 - Gaussian Mixtures)

Post Outline * Introduction * Links * Notebook * Next Steps Introduction This is the beginning of a three part series that I completed towards the end of 2017 as a learning module for Quantinsti.com. The purpose of the series is to demonstrate a research workflow focused around the theory and application of mixture models as the core framework behind a algorithmic trading strategy. Below is a quote taken from the README of the github repo: “The primary goal of this repo is to demonstrat

READ MORE
Mixture Model Trading (Part 1 - Motivation)
PythonQuant

Mixture Model Trading (Part 1 - Motivation)

Post Outline * Introduction * Links * Notebook * Next Steps Introduction This is the beginning of a three part series that I completed towards the end of 2017 as a learning module for Quantinsti.com. The purpose of the series is to demonstrate a research workflow focused around the theory and application of mixture models as the core framework behind a algorithmic trading strategy. Below is a quote taken from the README of the github repo: I will be presenting each of the notebooks

READ MORE