问答交流

昨日成交均价因子怎么构建?分时均线价

由supertrim2582创建,最终由supertrim2582 被浏览 63 用户

问题

昨日成交均价因子怎么构建?分时均线价

解答

start = time.clock()
N = 10
begin_date = '2013-01-01'
end_date = '2018-01-01'
获取半月日期列表dateList = get_period_date('2W',begin_date, end_date)
factorData_2W = {}
for date in dateList:
stockList = get_stock_A(date)
# 获取价格类数据
df_data = get_price(stockList, count = N, end_date = date, frequency='1d', fields=['high', 'open', 'low', 'close', 'avg'])
# 因子计算
temp1 = log(df_data["high"] / df_data["open"]).mean()
temp2 = log(df_data["close"] / df_data["low"]).mean()
temp3 = log(df_data["avg"] / df_data["close"]).mean()
tempData = pd.DataFrame()
tempData["HighOpen"] = temp1
tempData["CloseLow"] = temp2
tempData["VwapClose"] = temp3
tempData = standardlize(tempData, axis=0)
factorData_2W[date] = tempData
elapsed = (time.clock() - start)
print("Time used:",elapsed)

temp3 = log(df_data["avg"] / df_data["close"]).mean()这段代码里面的昨日成交均价?好像平台上莫有吧~~~~类似分时均线。

\

标签

Python均线
评论
  • 这个昨日成交均价具体是如何计算的?
{link}