Parcourir la source

feat:新增同花顺接口

Roc il y a 1 an
Parent
commit
db7d5e2bab
1 fichiers modifiés avec 5 ajouts et 3 suppressions
  1. 5 3
      ths_api.py

+ 5 - 3
ths_api.py

@@ -6,6 +6,8 @@ import time
 
 hug.API(__name__).http.output_format = hug.output_format.json
 
+username = "账号"
+password = "密码"
 
 @hug.get('/hz_server')
 def hello():
@@ -16,7 +18,7 @@ def hello():
 # 同花顺登录函数
 def thslogindemo():
     # 输入用户的帐号和密码
-    thsLogin = THS.THS_iFinDLogin("hzmd150", "689719")
+    thsLogin = THS.THS_iFinDLogin(username, password)
     print(thsLogin)
     if (thsLogin == 0 or thsLogin == -201):
         print('ths 登录成功')
@@ -27,7 +29,7 @@ def thslogindemo():
 @hug.get('/edbInfo/ths')
 def GetEdbDataByThs(EdbCode, StartDate, EndDate):
     print("GetEdbDataByThs")
-    thsLogin = THS.THS_iFinDLogin("账号", "密码")
+    thsLogin = THS.THS_iFinDLogin(username, password)
     thsEDBDataQuery = THS.THS_EDBQuery(EdbCode, StartDate, EndDate, True)
     print(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) + ":start GetEdbDataByThs")
     print("thsEDBDataQuery")
@@ -41,7 +43,7 @@ def GetEdbDataByThs(EdbCode, StartDate, EndDate):
 @hug.get('/edbInfo/ths/future_good')
 def GetFutureGoodEdbDataByThs(EdbCode, StartDate, EndDate):
     print("THS_HistoryQuotes start")
-    thsLogin = THS.THS_iFinDLogin("账号", "密码")
+    thsLogin = THS.THS_iFinDLogin(username, password)
 
     filed = 'lastclose,open,high,low,close,avgprice,change,changeper,volume,amount,hsl,lastsettlement,settlement,zdsettlement,zdfsettlement,ccl,ccbd,zf,zjlx,zjcd'
     # filed = 'open,high,low,close,volume,amount,settlement,ccl,zjlx'