Quant Mashup - Black Arbs

How to Get (Almost) Free Tick Data [Black Arbs]

Access to high quality, cost effective market data is a continuing problem for retail traders. I was recently told about the ongoing efforts of the startup brokerage “Alpaca”. The gentleman I spoke with said the API gave access to the tick data of thousands of stocks everyday and without cost. I

*- 3 months ago, 2 Jun 2020, 01:58am -*

Mean Reversion Strategies in Python (Course Review) [Black Arbs]

In this post I will be reviewing the course “Mean Reversion Strategies by Dr. E.P. Chan” ( His research and publications have garnered widespread appreciation, over the years. Unfortunately for Python programmers most of his past research was done in Matlab. Matlab was a very popular tool for

*- 3 months ago, 2 Jun 2020, 01:57am -*

The Secret to Shorting Stocks [Black Arbs]

Misinformation is everywhere. Many people believe the key to successful short selling is simply the inversion of a successful long strategy. I also used to believe this, among other short selling myths before I took the Short Selling Course by Laurent Bernut ( This article will demonstrate the

*- 6 months ago, 7 Mar 2020, 10:50am -*

Synthetic ETF Data Generation (Part-2) - Gaussian Mixture Models [Black Arbs]

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

*- 1 year ago, 14 Aug 2019, 12:31pm -*

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

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

*- 1 year ago, 20 May 2019, 12:39pm -*

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

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

*- 1 year ago, 3 May 2019, 03:04pm -*

Synthetic Data Generation (Part-1) - Block Bootstrapping [Black Arbs]

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

*- 1 year ago, 8 Mar 2019, 08:22pm -*

Download Intraday Stock Data with IEX and Parquet [Black Arbs]

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?

*- 2 years ago, 15 Jun 2018, 11:09pm -*

Labeling and Meta-Labeling Returns for ML Prediction [Black Arbs]

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

*- 2 years ago, 12 Jun 2018, 04:47pm -*

Exploring Alternative Price Bars [Black Arbs]

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,

*- 2 years ago, 25 Apr 2018, 10:45pm -*

Mixture Model Trading (Part 5 - Algorithm Evaluation with pymc3) [Black Arbs]

See . 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

*- 2 years ago, 19 Feb 2018, 02:08pm -*

Mixture Model Trading (Part 4 - Strategy Implementation) [Black Arbs]

This notebook will walkthrough the algorithm implementation process on the quantconnect platform. Please be advised that this notebook will not actually run the algorithm as I have not installed the quantconnect backtesting engine locally. This is a demonstration of the process. The script is

*- 2 years ago, 19 Jan 2018, 02:53pm -*

Mixture Model Trading (Part 3 - Strategy Research) [Black Arbs]

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

*- 2 years ago, 18 Jan 2018, 11:31am -*

Mixture Model Trading (Part 2 - Gaussian Mixtures) [Black Arbs]

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

*- 2 years ago, 17 Jan 2018, 01:10pm -*

Mixture Model Trading (Part 1 - Motivation) [Black Arbs]

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

*- 2 years ago, 16 Jan 2018, 09:51pm -*

Computing Option Skews with Dask [Black Arbs]

This article series provides an opportunity to move towards more interactive analysis. My plan is to integrate more Jupyter notebooks and Github repos into my research/publishing workflow. For datasets that are too big to share through github I will provide a download link both here and in the

*- 2 years ago, 27 Nov 2017, 10:34am -*

How To Get Free Intraday Options Data With Pandas-DataReader [Black Arbs]

This is a simple reference article for readers that might wonder where I get/got my options data from. In this regard I would like to shout out the contributors to the pandas-datareader, without their efforts this process would be much more complex. Intuitive Explanation So this code consists of

*- 2 years ago, 22 Nov 2017, 09:37am -*

Exploring Our Scraped Options Data Bid-Ask Spreads (Part-2) [Black Arbs]

Notes on Part-2 The Data Bid-Ask Spread Analysis How Do Aggregate Bid-Ask Spreads Vary with Days To Expiration? How Do Bid-Ask Spreads Vary with Volume? How Do Bid-Ask Spreads Vary with Volatility? Summary Conclusions Notes on Part-2 Some astute readers in the comments noted that analysis based on

*- 3 years ago, 9 Sep 2017, 11:05pm -*

Exploring Our Scraped Options Data Bid-Ask Spreads [Black Arbs]

Compared to the equity market, the options market is a level up in complexity. For each symbol there are multiple expiration dates, strike prices for each expiration date, implied volatilities, and that's before we get to the option greeks. The increased complexity presents us with more

*- 3 years ago, 8 Aug 2017, 05:51am -*

How to Build a Sequential Option Scraper with Python and Requests [Black Arbs]

In the previous post I revealed a web scraping trick that allows us to defeat AJAX/JavaScript based web pages and extract the tables we need. We also covered how to use that trick to scrape a large volume of options prices quickly and asynchronously using the combination of aiohttp and asyncio. The

*- 3 years ago, 9 Jul 2017, 10:50pm -*

How to Scrape and Parse 600 ETF Options in 10 mins with Python and Asyncio [Black Arbs]

This is Part 1 of a new series I'm doing in semi real-time to build a functional options data dashboard using Python. There are many underlying motivations to attempt this, and several challenges to implementing a tool like this from scratch. Where to get the data? Is it affordable? Easily

*- 3 years ago, 20 May 2017, 09:21pm -*

Can We Use Mixture Models to Predict Market Bottoms? (Part 3) [Black Arbs]

Thus far in the series we've explored the idea of using Gaussian mixture models (GMM) to predict outlier returns. Specifically, we were measuring two things: The accuracy of the strategy implementation in predicting return distributions. The return pattern after an outlier event. During the

*- 3 years ago, 11 May 2017, 10:27pm -*

Can We Use Mixture Models to Predict Market Bottoms? (Part 2) [Black Arbs]

In the previous post I gave a basic "proof" of concept, where we designed a trading strategy using Sklearn's implementation of Gaussian mixture models. The strategy attempts to predict an asset's return distribution such that returns that fall outside the predicted distribution

*- 3 years ago, 8 Apr 2017, 02:54am -*

Can We Use Mixture Models to Predict Market Bottoms? [Black Arbs]

In Part 1 we learned about Hidden Markov Models and their application using a toy example involving a lazy pet dog. In Part 2 we learned about the expectation-maximization algorithm, K-Means, and how Mixture Models improve on K-Means weaknesses. If you still have some questions or fuzzy

*- 3 years ago, 4 Apr 2017, 07:14am -*

Intro to Expectation-Maximization, K-Means, Gaussian Mixture Models with Python, Sklearn [Black Arbs]

Post Outline Part 1 Recap Part 2 Goals Jupyter (IPython) Notebook References part 1 recap In part 1 of this series we got a feel for Markov Models, Hidden Markov Models, and their applications. We went through the process of using a hidden Markov model to solve a toy problem involving a pet dog. We

*- 3 years ago, 21 Mar 2017, 02:27am -*

Introduction to Hidden Markov Models with Python Networkx and Sklearn [Black Arbs]

Who is Andrey Markov? What is the Markov Property? What is a Markov Model? What makes a Markov Model Hidden? A Hidden Markov Model for Regime Detection Conclusion References Who is Andrey Markov? Markov was a Russian mathematician best known for his work on stochastic processes. The focus of his

*- 3 years ago, 26 Feb 2017, 08:52am -*

Advanced Time Series Plots in Python [Black Arbs]

POST OUTLINE Motivation Get Data Default Plot with Recession Shading Add Chart Titles, Axis Labels, Fancy Legend, Horizontal Line Format X and Y Axis Tick Labels Change Font and Add Data Markers Add Annotations Add Logo/Watermarks MOTIVATION Since I started this blog a few years ago, one of my

*- 3 years ago, 7 Jan 2017, 08:19pm -*

Backtesting the Implied Volatility Long/Short Strategy [Black Arbs]

This is a stylized implementation of the strategy described in the research paper titled "What Does Individual Option Volatility Smirk Tell Us About Future Equity Returns?" by Yuhang Xing, Xiaoyan Zhang and Rui Zhao. The authors show that their SKEW factor predicts individual equity

*- 3 years ago, 31 Dec 2016, 09:05pm -*

Asset Pricing using Extreme Liquidity with Python (Part-2) [Black Arbs]

POST OUTLINE Part-1 Recap Part-1 Error Corrections Part-2 Implementation Details, Deviations, Goals Prepare Data Setup PYMC3 Generalized Linear Models (GLM) Evaluate and Interprate Models Conclusions References part-1 recap In part 1 We discussed the theorized underpinnings of Ying Wu of Stevens

*- 3 years ago, 14 Dec 2016, 09:02am -*