def wset_futureoi(): '通过windpy的接口获得数据,并用pandas处理数据并另存为csv文件' # wset格式:w.wset("sectorconstituent","date=2016-06-23;sectorid= # 1000019227000000") p1 = "futureoi" code = input('input code:') p = "startdate={0};enddate={1};varity={2};wind_code=all;member_name=all;order_by=long" p2 = p.format(sDate(), eDate(), code) # print(p1,p2) wset = w.wset(p1, p2) df = pd.DataFrame(wset.Data).T return df
def wset_sector(): '通过windpy的接口获得数据,并用pandas处理数据并另存为csv文件' # wset格式:w.wset("sectorconstituent","date=2016-06-23;sectorid= # 1000019227000000") # 构造参数字符串 p1 = "sectorconstituent" date = "=".join(['date', datetime.now().strftime('%Y-%m-%d')]) sectorid = "=".join(['sectorid', input(r'input sectorid:')]) p2 = ','.join([date, sectorid]) # 提取数据 wset = w.wset(p1, p2) # 将数据转化为pandas dataframe结构 df = pd.DataFrame(wset.Data).T return df