PyCon 2016 in Portland, Or
hills next to breadcrumb illustration

Monday 12:10 p.m.–12:55 p.m.

Building a Quantitative Trading Strategy To Beat the S&P500

Karen Rubin

Audience level:


Two years ago, Karen embarked on a project to learn how to research, write and trade algorithms to invest in the market. She re-learned python and explored what would happen if you invested in women-led companies over a 12-year period. In this talk, she will walk through the highs and lows of her journey from initial data gathering, through writing a strategy to validation and trading.


According to Credit Suisse’s Gender 3000 report, at the end of 2013, women accounted for 12.9% of top management in 3000 companies across 40 countries. Additionally, since 2009, companies with women comprising 25-50% of their management team returned 22-29% more than those without women. *If companies with women in management outperform so dramatically, what would happen if you invested in women-led companies?* Karen Rubin has spent the last 12 months exploring this question. In doing so, she has developed an investment algorithm that invests in the women-led companies of the Fortune 1000. Based on a simulation run from 2002-2014, this investment algorithm would have returned 340%, or 217% more than the S&P500. In this talk, Karen will walk through the process she went through to develop and validate the strategy. She will cover how the algorithm decides to buy and sell stock, how the backtest works and how she has validated the results of the simulation. Her simulation is written entirely in IPython notebooks. She leverages Pandas extensively for data cleansing and manipulation and the open source backtester Zipline ( for running the simulation.