[Mod]增加富途接口订阅本日所有委托推送的功能
This commit is contained in:
parent
6a2b12420d
commit
440bd2812f
@ -231,7 +231,7 @@ class FutuGateway(VtGateway):
|
|||||||
code, data = self.tradeCtx.place_order(orderReq.price, orderReq.volume,
|
code, data = self.tradeCtx.place_order(orderReq.price, orderReq.volume,
|
||||||
orderReq.symbol, side,
|
orderReq.symbol, side,
|
||||||
priceType, self.env,
|
priceType, self.env,
|
||||||
orderpush=True, dealpush=True)
|
order_deal_push=True)
|
||||||
|
|
||||||
if code:
|
if code:
|
||||||
self.writeError(code, u'委托失败:%s' %data)
|
self.writeError(code, u'委托失败:%s' %data)
|
||||||
@ -303,7 +303,7 @@ class FutuGateway(VtGateway):
|
|||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
def qryPosition(self):
|
def qryPosition(self):
|
||||||
"""查询持仓"""
|
"""查询持仓"""
|
||||||
code, data = self.tradeCtx.position_list_query(self.env)
|
code, data = self.tradeCtx.position_list_query(envtype=self.env)
|
||||||
|
|
||||||
if code:
|
if code:
|
||||||
self.writeError(code, u'查询持仓失败:%s' %data)
|
self.writeError(code, u'查询持仓失败:%s' %data)
|
||||||
@ -329,13 +329,13 @@ class FutuGateway(VtGateway):
|
|||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
def qryOrder(self):
|
def qryOrder(self):
|
||||||
"""查询委托"""
|
"""查询委托"""
|
||||||
code, data = self.tradeCtx.order_list_query("", self.env)
|
code, data = self.tradeCtx.order_list_query("", envtype=self.env)
|
||||||
|
|
||||||
if code:
|
if code:
|
||||||
self.writeError(code, u'查询委托失败:%s' %data)
|
self.writeError(code, u'查询委托失败:%s' %data)
|
||||||
return
|
return
|
||||||
|
|
||||||
self.processOrder(data)
|
self.processOrder(data, qry=True)
|
||||||
self.writeLog(u'委托查询成功')
|
self.writeLog(u'委托查询成功')
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
@ -453,7 +453,7 @@ class FutuGateway(VtGateway):
|
|||||||
self.onTick(tick)
|
self.onTick(tick)
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
def processOrder(self, data):
|
def processOrder(self, data, qry=False):
|
||||||
"""处理委托推送"""
|
"""处理委托推送"""
|
||||||
for ix, row in data.iterrows():
|
for ix, row in data.iterrows():
|
||||||
order = VtOrderData()
|
order = VtOrderData()
|
||||||
@ -476,6 +476,11 @@ class FutuGateway(VtGateway):
|
|||||||
order.direction = directionMapReverse[str(row['order_side'])]
|
order.direction = directionMapReverse[str(row['order_side'])]
|
||||||
self.onOrder(order)
|
self.onOrder(order)
|
||||||
|
|
||||||
|
if qry:
|
||||||
|
self.tradeCtx.subscribe_order_deal_push(row['orderid'],
|
||||||
|
order_deal_push=True,
|
||||||
|
envtype=self.env)
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
def processDeal(self, data):
|
def processDeal(self, data):
|
||||||
"""处理成交推送"""
|
"""处理成交推送"""
|
||||||
|
Loading…
Reference in New Issue
Block a user