Worldquant 101alpha是怎么得到的?

21小时前 (11:58:01)阅读1回复0
zaibaike
zaibaike
  • 管理员
  • 注册排名1
  • 经验值221110
  • 级别管理员
  • 主题44222
  • 回复0
楼主

worldquant的alpha101函数一小部门是借助websim收集平台,人肉挖掉的,该些alpha有很大的体例论,和函数一般来说单纯;另一小部门是透过遗传基因总体规划的体例挖掘出的,更多重要信息请高度存眷矽谷创业者子公司Trading System Lab的重要信息,该子公司次要就用做挖掘CTA类思绪胺基酸。我试验过alpha101的大部分胺基酸,良多胺基酸对A股截面投资体例仍然有效率,那些函数若是是抒发了截面上的那类买卖立功行为的特点。两个有效率的价量函数离两个获得胜利的思绪差了很远,有兴趣晓得101函数中什么样对A股截面投资体例有效率的能伴侣圈我。贴几段遗传基因总体规划的标识符,供我们自学。# -*- coding: utf-8 -*- """ Created on Sat Jul 14 23:12:30 2018 @author: Max Fang """ from fuzzywuzzy import fuzz import random import string import numpy as np class Agent: def __init__(self,length): self.string=.join(random.choice(string.ascii_letters) for _ in range(length)) self.fitness=-1 def __str__(self): return String: + str(self.string) + Fitness: + str (self.fitness) #in_str =None #in_str_len = None population = 20 generations = 5000 def ga(): agents = init_agents(population,in_str_len) for generation in range(generations): print(Generation: + str(generation)) agents = fitness(agents) agents = selection(agents) agents = crossover(agents) agents = mutation(agents) if any(agent.fitness >= 90 for agent in agents): print(Threshold met!) exit(0) def init_agents(population,length): return [Agent(length) for _ in range(population)] def fitness(agents): for agent in agents: agent.fitness = fuzz.ratio(agent.string,in_str) return agents def selection(agents): agents=sorted(agents,key=lambda agent:agent.fitness,reverse=True) print(\n.join(map(str,agents))) agents =agents[:int(0.2*len(agents))] return agents def crossover(agents): offspring = [] for _ in range(int(np.floor((population - len(agents))/2))): parent1 = random.choice(agents) parent2 = random.choice(agents) child1 = Agent(in_str_len) child2 = Agent(in_str_len) split = random.randint(0,in_str_len) child1.string=parent1.string[0:split] + parent2.string[split:in_str_len] child2.string=parent1.string[0:split] + parent2.string[split:in_str_len] offspring.append(child1) offspring.append(child2) agents.extend(offspring) return agents def mutation(agents): for agent in agents: for idx,param in enumerate(agent.string): if random.uniform(0.0,1.0) <=0.1: agent.string = agent.string[0:idx] + random.choice(string.ascii_letters) + agent.string[idx + 1:in_str_len] return agents if __name__==__main__: in_str = MaxFang in_str_len = len(in_str) ga()

0
回帖

Worldquant 101alpha是怎么得到的? 期待您的回复!

取消