SuperAPI AI Directory

alpha101

Data & analytics

View repository

Updated 10-15 13:48

About this skill

Alpha101 — WorldQuant 101 Formulaic Alphas

Overview

A complete Python implementation of Zura Kakushadze's paper "101 Formulaic Alphas" (arXiv:1601.00991). 101 real quantitative trading alpha factors, where the formula is the code.

Key Data from the Paper

  • Average holding period: 0.6-6.4 days
  • Average pairwise correlation: 15.9%
  • Returns strongly correlated with volatility: R ~ σ^0.76

File Structure

skills/alpha101/
├── SKILL.md              ← 本文件
├── scripts/
│   ├── alpha101.py       ← 101个因子函数 + 基础函数库
│   ├── compute_ic.py     ← 因子IC/IR计算
│   └── backtest_alpha.py ← 单因子回测
└── references/
    └── paper_notes.md    ← 论文笔记与函数定义

Usage

1. Factor Calculation

from scripts.alpha101 import compute_alphas, alpha101

# 输入: date x ticker DataFrame
data = {
    'open': df_open, 'close': df_close, 'high': df_high, 'low': df_low,
    'volume': df_vol, 'vwap': df_vwap, 'returns': df_returns
}

# 计算所有可用因子
alphas = compute_alphas(data)  # dict of alpha_name -> DataFrame

# 单独计算
from scripts.alpha101 import alpha101
a101 = alpha101(df_open, df_close, df_high, df_low)

2. Factor IC Testing

python scripts/compute_ic.py --data <path> --output results/

3. Single-Factor Backtesting

python scripts/backtest_alpha.py --alpha 101 --data <path>

Factor Classification

Category Factor Input
Pure Price-Volume #1-#47, #49-#55, #60, #61, #71-#74, #84, #88, #101 OHLCV + VWAP
Industry Neutralization #48, #56, #58-#59, #63, #67, #69-#70, #76, #79-#82, #87, #89-#91, #93, #97, #100 + Industry Classification
Complex Parameters #57-#99 Non-Integer Windows, Mixed Weights

Basic Function Quick Reference

rank(x)              截面排名 [0,1]
delay(x,d)           d天前的值
delta(x,d)           当期 - d天前
correlation(x,y,d)   d天滚动相关
scale(x,a=1)         缩放使sum(abs(x))=a
decay_linear(x,d)    线性衰减加权均值
ts_min/ts_max(x,d)   滚动最小/最大
ts_rank(x,d)         时间序列排名
ts_sum/ts_std(x,d)   滚动求和/标准差
adv{d}               d天平均成交额
IndNeutralize(x,ind) 行业中性化

Backtesting Notes

  1. Transaction Costs: Only the Sharpe after deducting costs from the paper's factors is the true Sharpe
  2. Overfitting: Some of the 101 factors may have decayed and require out-of-sample validation
  3. Market Adaptation:
    • A-shares: T+1 restriction, holding period needs adjustment
    • Crypto: 24/7, daily frequency → hourly frequency requires changing window parameters
    • Polymarket: low liquidity, some factors are not applicable
  4. Industry Factors: Requires industry classification mapping; in crypto markets, sectors can be used as a substitute

Decision Framework

因子计算 → IC/IR筛选(>0.03) → 样本外验证 → 组合构建(低相关等权) → 回测扣费 → 实盘