上海中期接口升级
1. 端口更改 2. 路劲更改 3. 持仓量str->float->int
This commit is contained in:
parent
c320ce844f
commit
c2b96c0444
@ -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",
|
||||||
|
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user