wukan1986 / alpha_examples

alpha投研示例
MIT License
51 stars 16 forks source link

alpha_examples

本项目是将polars_ta, expr_codegen, AlphaInspect等几个项目利用起来的开箱即用示例

  1. polars_ta: 基于polars表达式的指标库
  2. expr_codegen: 将WorldQuant Alpha101风格的表达式转换成polars风格代码的工具
  3. AlphaInspect: 仿alphalens的单因子分析工具

使用方法

git clone --depth=1 https://github.com/wukan1986/alpha_examples.git

然后使用PyCharmVSCode打开即可。

每个文件夹中的requirements.txt都需要安装

pip install -r requirements.txt

每个文件夹下的README.md都请认真先看一看

注意:如果github无法访问,用户可以在gitee中新建仓库,然后导入github仓库即可

data、codes、codegen 三目录

data生成测试用数据,它依赖于codes目录,而codes目录由codegen中的脚本生成

research 单因子分析示例

可以将它做为研发单因子的模板,只要改一行因子表达式即可

  1. step1.py: 演示准备数据
  2. step2.py: 演示特征的研究
  3. step3.py: 生成报表
  4. step4.py: 修改于step2.py,用于生成多个特征
  5. step5.py: 比较多个特证的相关性

gp_base_cs/gp_base_ts/gp_run 遗传编程

自动大批量生成表达式。可将生成的表达式直接复制到research/step2.pyresearch/step3.py中进行进一步分析

transformer 第三方表达转换

演示了Alpha101Alpha191转换成polars_ta风格表达式