MCPcopy Index your code
hub / github.com/Morgansy/Genetic-Alpha

github.com/Morgansy/Genetic-Alpha @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
96 symbols 220 edges 7 files 58 documented · 60%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Genetic-Alpha

A genetic programming algorithm used for generating alpha factors in the multi-factor investment strategy

Introduction

Want to find investment factors that are significantly correlated to the returns of securities? Use Genetic-alpha! Recently, more and more investors are using the factor investment strategy, where the most important task is to find alpha your own factors. Most of tranditional alpha factors are known by many investors, then gradually becomes invalid. Genetic-Alpha is build based on the Genetic programming algorithm, which is a symbolic regression technique. It begins by building a population of naive random formulas to represent a relationship between known independent variables and their dependent variable targets in order to predict new data. In our content, the dependent variable is the security returns, while the independent variables can be any variables that you think are related to the security returns. Each successive generation of programs is then evolved from the one that came before it by selecting the fittest individuals from the population to undergo genetic operations.

functionality

The fitness.py documents provides API where you could design your own measures to test the performance of the generated alpha factors, several commonly used measures includes IR, ICIR, etc. I have already buile these measures in this package.

The function.py documents can produce functions (or operators) objects that will be used in the formulas of the alpha facors. Still, you can also customize your own fucntions to design alpha factors that are in your interest.

Parallel computting is supported by utils.py, details can be checked.

The main machanism of genetic programming algorithm is defined and implemented in program.py and genetic.py

data

This package supports time series data, which is a big difference to the original genetic programming algorithm. For example, the data of the vairable adjusted price is should be a two dimensional dataframe, the first dimension represents tickers, while the second dimensioan is time.

test run

To run a test program for this package, please see demo.py

Finally, have fun with alpha investing!

Core symbols most depended-on inside this repo

execute
called by 5
_program.py
raw_fitness
called by 4
_program.py
check_random_state
called by 3
utils.py
get_subtree_func
called by 3
_program.py
_tournament
called by 2
genetic.py
_verbose_reporter
called by 2
genetic.py
fit
called by 2
genetic.py
get_subtree_con
called by 2
_program.py

Shape

Function 51
Method 38
Class 7

Languages

Python100%

Modules by API surface

functions.py36 symbols
genetic.py22 symbols
_program.py22 symbols
fitness.py10 symbols
utils.py3 symbols
demo.py3 symbols

For agents

$ claude mcp add Genetic-Alpha \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact