Alpha Compiler

Given an alpha equation, this tool generates Python code to be used on Quantopian’s platform or in Zipline. The code generated can be cut and pasted directly into your Quantopian code. For examples of how to use factors and the necessary includes, please see the latest notebook posted here. The code genrates a custom factor named AlphaX, if you are going to use multiple alpha factors generated here you will need to change the name of AlphaX to something unique for each factor.


The syntax is inspired by the document 101 Formulaic Alphas by Zura Kakushadze. I recommend you read that paper if you creating your own alphas.


The following can be used as inputs:

Unirary Operators

Binary Operators

Ternary Operator

Time-Series Operators

The time-series operators as a special case of binary operators where the last argument is the number of days. In the inspiration paper this could be any positive real number, but it this implementation the number needs to be a positive integer. For example the delay(sig, N) operator will return a version of the sig data delayed N days.

Binary Time-Series Operators

Ternary Time-Series Operators