|
@@ -49,9 +49,9 @@ def GetEdbDataByWind(EdbCode, StartDate, EndDate):
|
|
|
return result
|
|
|
|
|
|
|
|
|
-@hug.get('/edbInfo/wind/future_good')
|
|
|
-def GetFutureGoodEdbDataByWind(FutureGoodEdbCode, StartDate, EndDate):
|
|
|
- print("GetFutureGoodEdbDataByWind:", FutureGoodEdbCode)
|
|
|
+@hug.get('/edbInfo/wind/wsd')
|
|
|
+def GetEdbDataWindWsd(StockCode,EdbCode, StartDate, EndDate):
|
|
|
+ print("GetEdbDataByWind:", EdbCode)
|
|
|
isConnected = w.isconnected()
|
|
|
print("isconnected")
|
|
|
print(isConnected)
|
|
@@ -62,38 +62,20 @@ def GetFutureGoodEdbDataByWind(FutureGoodEdbCode, StartDate, EndDate):
|
|
|
if isConnected == False:
|
|
|
return "{'ErrMsg':'启动Wind接口失败'}"
|
|
|
|
|
|
- print("getdata")
|
|
|
option = "Fill=Previous"
|
|
|
- data = w.edb(FutureGoodEdbCode, StartDate, EndDate, option)
|
|
|
- data = w.wsd(FutureGoodEdbCode, "trade_code,open,high,low,close,volume,amt,oi,settle", StartDate, EndDate, option)
|
|
|
- print("wind data")
|
|
|
- print(data)
|
|
|
- df = pd.DataFrame()
|
|
|
+ wsd_data = w.wsd(StockCode,EdbCode, StartDate, EndDate, option)
|
|
|
|
|
|
- if data.ErrorCode == -40521010:
|
|
|
+ if wsd_data.ErrorCode == -40521010:
|
|
|
os._exit(0)
|
|
|
return "a"
|
|
|
-
|
|
|
- df['DT'] = data.Times
|
|
|
- df['TRADE_CODE'] = data.Data[0]
|
|
|
- df['OPEN'] = data.Data[1]
|
|
|
- df['HIGH'] = data.Data[2]
|
|
|
- df['LOW'] = data.Data[3]
|
|
|
- df['CLOSE'] = data.Data[4]
|
|
|
- df['VOLUME'] = data.Data[5]
|
|
|
- df['AMT'] = data.Data[6]
|
|
|
- df['OI'] = data.Data[7]
|
|
|
- df['SETTLE'] = data.Data[8]
|
|
|
- df['ErrorCode'] = data.ErrorCode
|
|
|
- df = df[['DT', 'TRADE_CODE', 'OPEN', 'HIGH', 'LOW', 'CLOSE', 'VOLUME', 'AMT', 'OI', 'SETTLE', 'ErrorCode']]
|
|
|
- df = df.dropna()
|
|
|
- json_data = df.to_json()
|
|
|
-
|
|
|
- print("wind data end")
|
|
|
+
|
|
|
+ fm=pd.DataFrame(wsd_data.Data,index=wsd_data.Fields,columns=wsd_data.Times)
|
|
|
+ json_data=fm.to_json()
|
|
|
result = json.loads(json_data)
|
|
|
return result
|
|
|
|
|
|
|
|
|
+
|
|
|
if __name__ == "__main__":
|
|
|
|
|
|
wStart = w.start()
|