Merge pull request #676 from tanzedan/dev

上海中期接口升级
This commit is contained in:
vn.py 2018-01-08 16:28:49 +08:00 committed by GitHub
commit 2bb0947a85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

View File

@ -3,7 +3,7 @@
"MONGO_PORT": 27017, "MONGO_PORT": 27017,
"SHCIFCO_IP": "180.169.126.123", "SHCIFCO_IP": "180.169.126.123",
"SHCIFCO_PORT": "45065", "SHCIFCO_PORT": "10083",
"SHCIFCO_TOKEN": "请联系上海中期申请", "SHCIFCO_TOKEN": "请联系上海中期申请",
"SYMBOLS": ["cu1707", "cu1708", "cu1709", "cu1712", "SYMBOLS": ["cu1707", "cu1708", "cu1709", "cu1712",

View File

@ -22,8 +22,8 @@ class ShcifcoApi(object):
self.ip = ip self.ip = ip
self.port = port self.port = port
self.token = token self.token = token
self.service = 'ShcifcoApi' self.service = 'shcifco/dataapi'
self.domain = 'http://' + ':'.join([self.ip, self.port]) self.domain = 'http://' + ':'.join([self.ip, self.port])
#---------------------------------------------------------------------- #----------------------------------------------------------------------
@ -59,7 +59,7 @@ class ShcifcoApi(object):
'askPrice': float(l[4]), 'askPrice': float(l[4]),
'askVolume': int(l[5]), 'askVolume': int(l[5]),
'volume': int(l[6]), 'volume': int(l[6]),
'openInterest': int(l[7]) 'openInterest': int(float(l[7]))
} }
return d return d
@ -97,14 +97,14 @@ class ShcifcoApi(object):
'low': float(l[4]), 'low': float(l[4]),
'close': float(l[5]), 'close': float(l[5]),
'volume': int(l[6]), 'volume': int(l[6]),
'openInterest': int(l[7]) 'openInterest': int(float(l[7]))
} }
return d return d
#---------------------------------------------------------------------- #----------------------------------------------------------------------
def getHisBar(self, symbol, num, date='', period=''): def getHisBar(self, symbol, num, date='', period=''):
"""获取历史K线数据""" """获取历史K线数据"""
path = 'hisbar' path = 'hisminbar'
# 默认参数 # 默认参数
params = { params = {
@ -139,7 +139,7 @@ class ShcifcoApi(object):
'low': float(barData[5]), 'low': float(barData[5]),
'close': float(barData[6]), 'close': float(barData[6]),
'volume': int(barData[7]), 'volume': int(barData[7]),
'openInterest': int(barData[8]), 'openInterest': int(float(barData[8])),
'date': barData[9] # natural day 'date': barData[9] # natural day
} }
barList.append(d) barList.append(d)