[Fix]修复缺失委托价格类型的错误
This commit is contained in:
parent
f38ec0aa33
commit
65d9f15052
@ -229,22 +229,26 @@ class JsEngine(object):
|
|||||||
params = req['params']
|
params = req['params']
|
||||||
s, e = params['security'].split('.')
|
s, e = params['security'].split('.')
|
||||||
|
|
||||||
|
contract = self.mainEngine.getContract(s)
|
||||||
|
|
||||||
|
if not contract:
|
||||||
|
vtOrderID = ''
|
||||||
|
error = [-1, u'委托失败,找不到合约%s' %params['security']]
|
||||||
|
else:
|
||||||
vor = VtOrderReq()
|
vor = VtOrderReq()
|
||||||
vor.symbol = s
|
vor.symbol = s
|
||||||
vor.exchange = EXCHANGE_MAP[e]
|
vor.exchange = EXCHANGE_MAP[e]
|
||||||
vor.direction, vor.offset = ACTION_MAP[params['action']]
|
vor.direction, vor.offset = ACTION_MAP[params['action']]
|
||||||
vor.price = params['price']
|
vor.price = float(params['price'])
|
||||||
vor.volume = params['size']
|
vor.volume = int(params['size'])
|
||||||
|
vor.priceType = PRICETYPE_LIMITPRICE
|
||||||
contract = self.mainEngine.getContract(contract)
|
|
||||||
|
|
||||||
vtOrderID = self.mainEngine.sendOrder(vor, contract.gatewayName)
|
vtOrderID = self.mainEngine.sendOrder(vor, contract.gatewayName)
|
||||||
|
|
||||||
error = [0, '']
|
error = [0, '']
|
||||||
|
|
||||||
self.server.send_rsp(clientId, req, vtOrderID, error)
|
self.server.send_rsp(clientId, req, vtOrderID, error)
|
||||||
|
|
||||||
self.writeLog(u'发出响应:%s' %result)
|
self.writeLog(u'发出响应:%s' %vtOrderID)
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
def onCancelOrder(self, clientId, req):
|
def onCancelOrder(self, clientId, req):
|
||||||
|
Loading…
Reference in New Issue
Block a user