Halloween Cycle
来源:https://uqer.io/community/share/5663db06f9f06c6c8a91b37c
import numpy as np
start = '2006-01-01'
end = '2015-12-01'
benchmark = 'HS300'
universe = ['601398.XSHG','600028.XSHG', '601988.XSHG', '600036.XSHG','600030.XSHG','601318.XSHG', '600000.XSHG', '600019.XSHG', '600519.XSHG', '601166.XSHG']
capital_base = 100000
freq = 'd'
refresh_rate = 1
def initialize(account):
pass
def handle_data(account):
today = account.current_date
for stock in account.universe:
if(today.month == 10):
p = account.referencePrice.get(stock, 0)
if np.isnan(p) or p == 0:
continue
order_pct_to(stock, 0.1)
elif today.month == 5 and stock in account.valid_secpos:
order_to(stock,0)