SOFTWARE
Several of my papers discuss implementations of various algorithms in Python language. This facilitates the replication of my results, and allows the reader to run independent experiments. Enthought's Canopy product contains all the necessary libraries. Although the code is generally included in the appendix, it is easier to download the source code from the table below. In order to do that, please follow these steps:
1) Point your mouse on a link.
2) Right-click, select "Save as" and press "Save".
3) Rename the saved file, by removing the extension ".txt"
Note: All code in this website is provided “as is”, and contributed to the
academic community for non-business purposes only, under a GNU-GPL license.
Users explicitly renounce to any claim against the authors. The authors retain
the commercial rights of any for-profit application of this software, which must
be pre-authorized in written by the authors.
AUTHOR |
VERSION |
LINK |
PAPER |
DESCRIPTION |
Berkeley Lab |
2014 |
Backtest Overfitting Simulator | This online tools overfits a seasonal investment strategy within the parameter ranges specified by the user. Special thanks to Stephanie Ger, who set up this web application and prepared this research poster. | |
20151227 |
HRP.py.txt HRP_MC.py.txt |
Building Diversified Portfolios that Outperform Out-Of-Sample |
HRP.py performs a hierarchical portfolio construction. Changing the np.random.seed in generateData() will produce different random correlation matrices on which the method can be tested. HRP_MC.py runs a Monte Carlo experiment to show that HRP solutions deliver lower variance than CLA's out-of-sample, even though minimum-variance is CLA's optimization goal. | |
20140731 |
DSR.py.txt |
The Deflated Sharpe Ratio: Correcting for Selection Bias, Backtest Overfitting and Non-Normality |
DSR.py computes the expected value of the maximum of a series of IID Normal random variables, applying our closed-form solution. The accuracy of this solution is verified numerically. | |
20140407 |
KCA_1.py implements the Kinetic Component
Analysis (KCA) algorithm. KCA_2.py carries out the analogous
calculation using a Fast Fourier Transform (FFT). KCA_3.py performs a
comparison of KCA vs. FFT. KCA_4.py compares KCA with the Locally
Weighted Scatterplot Smoothing (LOWESS) method. |
|||
20140131 |
Determining Optimal Trading Rules without Backtesting |
OTR.py contains the code needed to
determine the Optimal Trading Rule (OTR) on an instrument with a price that
follows a discrete Ornstein-Uhlenbeck process. |
||
20140119 |
SFD_1.py contains the code needed to build
Stochastic Flow Diagrams. |
|||
20140119 |
The Topology of Macro
Financial Flows: An Application of Stochastic Flow Diagrams |
SFD_2.py implements Fisher's variance
stabilizing transformation on the Correlation coefficient. |
||
20130813 |
CSCV_1.py implements the PBO estimation via
Monte Carlo. CSCV_2.py implements the PBO estimation by Extreme Value
Theory. |
|||
20130813 |
CSCV_3.py simulates the performance of a
seasonal trading strategy under various overfitting
scenarios, which can be used to corroborate the Probability of Backtest Overfitting (PBO)
usefulness in real investment applications. |
|||
20130108 |
DD1.py.txt |
DD1.py contains the Monte Carlo which confirms the accuracy of
our close-formula derivation of the quantile
function. DD2.py computes the maximum of the Drawdown (DD) function,
under the more general assumption of first-order serially-correlated outcomes.
DD3.py the maximum of the Time under Water (TuW) function, under the more
general assumption of first-order serially-correlated outcomes. DD4.py
reproduces our empirical analysis on hedge fund indices (Data1.csv and
Data2.csv). |
||
20130108 |
An Open-Source implementation of the Critical-Line
Algorithm for Portfolio Optimization |
A Python class containing the Critical-Line Algorithm for
quadratic optimization subject to inequality constraints. CLA.py is the
class. CLA_Main.py is an example of how to use the CLA class.
CLA_Data.csv
is sample data. A seminar on this code can be watched here, and the presentation downloaded here. Enthough has built a GUI on our CLA class, which can be
downloaded here. |
||
20120516 |
Balanced Baskets: A
New Approach to Trading and Hedging Risks |
ERC basket optimization algorithm. |
||
20120516 |
Balanced Baskets: A
New Approach to Trading and Hedging Risks |
MMSC basket optimization algorithm. |
||
20120516 |
Balanced Baskets: A
New Approach to Trading and Hedging Risks |
Covariance clustering algorithm. |
||
20120502 |
Implementation of PSR statistics. |
|||
20120502 |
Implementation of PSR portfolio
optimization. |
|||
20120316 |
Determination of the optimal execution horizon. |
|||
20120217 |
Markowitz meets
Darwin: Portfolio Oversight and Evolutionary Divergence |
Implementation of the EF3M algorithm. |