Merge branch 'dev' of https://github.com/vnpy/vnpy into dev
This commit is contained in:
commit
be8cc6b42f
1
.gitignore
vendored
1
.gitignore
vendored
@ -45,6 +45,7 @@ Release/
|
|||||||
vn.ctp/build/*
|
vn.ctp/build/*
|
||||||
vn.lts/build/*
|
vn.lts/build/*
|
||||||
.idea
|
.idea
|
||||||
|
.vscode
|
||||||
.gitignore
|
.gitignore
|
||||||
|
|
||||||
vn.trader/ctaAlgo/data/*
|
vn.trader/ctaAlgo/data/*
|
||||||
|
@ -132,14 +132,15 @@ class ShcifcoApi(object):
|
|||||||
barData = barStr.split(',')
|
barData = barStr.split(',')
|
||||||
d = {
|
d = {
|
||||||
'symbol': barData[0],
|
'symbol': barData[0],
|
||||||
'date': barData[1],
|
# 'date': barData[1], # trading day
|
||||||
'time': barData[2],
|
'time': barData[2],
|
||||||
'open': float(barData[3]),
|
'open': float(barData[3]),
|
||||||
'high': float(barData[4]),
|
'high': float(barData[4]),
|
||||||
'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(barData[8]),
|
||||||
|
'date': barData[9] # natural day
|
||||||
}
|
}
|
||||||
barList.append(d)
|
barList.append(d)
|
||||||
|
|
||||||
|
@ -180,7 +180,7 @@ class LhangApi(LhangApi):
|
|||||||
err = VtErrorData()
|
err = VtErrorData()
|
||||||
err.gatewayName = self.gatewayName
|
err.gatewayName = self.gatewayName
|
||||||
err.errorMsg = str(error)
|
err.errorMsg = str(error)
|
||||||
err.errorTime = datetime.now().strftime('%H:%M:%S')
|
err.errorTime = datetime.now().strftime('%H:%M:%S.%f')[:-3]
|
||||||
self.gateway.onError(err)
|
self.gateway.onError(err)
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
@ -236,7 +236,7 @@ class LhangApi(LhangApi):
|
|||||||
tick.askPrice5, tick.askVolume5 = data['asks'][4]
|
tick.askPrice5, tick.askVolume5 = data['asks'][4]
|
||||||
|
|
||||||
now = datetime.now()
|
now = datetime.now()
|
||||||
tick.time = now.strftime('%H:%M:%S')
|
tick.time = now.strftime('%H:%M:%S.%f')[:-3]
|
||||||
tick.date = now.strftime('%Y%m%d')
|
tick.date = now.strftime('%Y%m%d')
|
||||||
|
|
||||||
self.gateway.onTick(tick)
|
self.gateway.onTick(tick)
|
||||||
@ -356,7 +356,7 @@ class LhangApi(LhangApi):
|
|||||||
trade.direction = order.direction
|
trade.direction = order.direction
|
||||||
trade.offset = order.offset
|
trade.offset = order.offset
|
||||||
trade.exchange = order.exchange
|
trade.exchange = order.exchange
|
||||||
trade.tradeTime = datetime.now().strftime('%H:%M:%S')
|
trade.tradeTime = datetime.now().strftime('%H:%M:%S.%f')[:-3]
|
||||||
|
|
||||||
self.gateway.onTrade(trade)
|
self.gateway.onTrade(trade)
|
||||||
|
|
||||||
@ -447,7 +447,7 @@ class LhangApi(LhangApi):
|
|||||||
err = VtErrorData()
|
err = VtErrorData()
|
||||||
err.gatewayName = self.gatewayName
|
err.gatewayName = self.gatewayName
|
||||||
err.errorMsg = u'链行接口仅支持限价单'
|
err.errorMsg = u'链行接口仅支持限价单'
|
||||||
err.errorTime = datetime.now().strftime('%H:%M:%S')
|
err.errorTime = datetime.now().strftime('%H:%M:%S.%f')[:-3]
|
||||||
self.gateway.onError(err)
|
self.gateway.onError(err)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@ -480,7 +480,7 @@ class LhangApi(LhangApi):
|
|||||||
order.offset = OFFSET_UNKNOWN
|
order.offset = OFFSET_UNKNOWN
|
||||||
order.price = req.price
|
order.price = req.price
|
||||||
order.volume = req.volume
|
order.volume = req.volume
|
||||||
order.orderTime = datetime.now().strftime('%H:%M:%S')
|
order.orderTime = datetime.now().strftime('%H:%M:%S.%f')[:-3]
|
||||||
order.status = STATUS_UNKNOWN
|
order.status = STATUS_UNKNOWN
|
||||||
|
|
||||||
self.workingOrderDict[localID] = order
|
self.workingOrderDict[localID] = order
|
||||||
|
@ -350,7 +350,7 @@ class DataEngine(object):
|
|||||||
self.orderDict[order.vtOrderID] = order
|
self.orderDict[order.vtOrderID] = order
|
||||||
|
|
||||||
# 如果订单的状态是全部成交或者撤销,则需要从workingOrderDict中移除
|
# 如果订单的状态是全部成交或者撤销,则需要从workingOrderDict中移除
|
||||||
if order.status == STATUS_ALLTRADED or order.status == STATUS_CANCELLED:
|
if order.status in [STATUS_ALLTRADED, STATUS_REJECTED, STATUS_CANCELLED]:
|
||||||
if order.vtOrderID in self.workingOrderDict:
|
if order.vtOrderID in self.workingOrderDict:
|
||||||
del self.workingOrderDict[order.vtOrderID]
|
del self.workingOrderDict[order.vtOrderID]
|
||||||
# 否则则更新字典中的数据
|
# 否则则更新字典中的数据
|
||||||
|
Loading…
Reference in New Issue
Block a user