1. 增加错误信息的时间字段

2. 修复qryAccount, qryPosition
3. 修改strategyAtrRsi里面的逻辑代码,保证界面的及时更新
This commit is contained in:
chenxy123 2016-05-28 22:31:47 +08:00
parent aae7ca1d0d
commit b32e5afa0f
4 changed files with 9 additions and 10 deletions

View File

@ -194,14 +194,12 @@ class AtrRsiStrategy(CtaTemplate):
if self.rsiValue > self.rsiBuy:
# 这里为了保证成交选择超价5个整指数点下单
self.buy(bar.close+5, 1)
return
if self.rsiValue < self.rsiSell:
elif self.rsiValue < self.rsiSell:
self.short(bar.close-5, 1)
return
# 持有多头仓位
if self.pos == 1:
elif self.pos == 1:
# 计算多头持有期内的最高价,以及重置最低价
self.intraTradeHigh = max(self.intraTradeHigh, bar.high)
self.intraTradeLow = bar.low
@ -210,17 +208,15 @@ class AtrRsiStrategy(CtaTemplate):
# 发出本地止损委托,并且把委托号记录下来,用于后续撤单
orderID = self.sell(longStop, 1, stop=True)
self.orderList.append(orderID)
return
# 持有空头仓位
if self.pos == -1:
elif self.pos == -1:
self.intraTradeLow = min(self.intraTradeLow, bar.low)
self.intraTradeHigh = bar.high
shortStop = self.intraTradeLow * (1+self.trailingPercent/100)
orderID = self.cover(shortStop, 1, stop=True)
self.orderList.append(orderID)
return
# 发出状态更新事件
self.putEvent()

View File

@ -458,7 +458,8 @@ class ErrorMonitor(BasicMonitor):
"""Constructor"""
super(ErrorMonitor, self).__init__(mainEngine, eventEngine, parent)
d = OrderedDict()
d = OrderedDict()
d['errorTime'] = {'chinese':u'错误时间', 'cellType':BasicCell}
d['errorID'] = {'chinese':u'错误代码', 'cellType':BasicCell}
d['errorMsg'] = {'chinese':u'错误信息', 'cellType':BasicCell}
d['additionalInfo'] = {'chinese':u'补充信息', 'cellType':BasicCell}

View File

@ -165,7 +165,7 @@ class MainEngine(object):
"""查询特定接口的账户"""
if gatewayName in self.gatewayDict:
gateway = self.gatewayDict[gatewayName]
gateway.getAccount()
gateway.qryAccount()
else:
self.writeLog(u'接口不存在:%s' %gatewayName)
@ -174,7 +174,7 @@ class MainEngine(object):
"""查询特定接口的持仓"""
if gatewayName in self.gatewayDict:
gateway = self.gatewayDict[gatewayName]
gateway.getPosition()
gateway.qryPosition()
else:
self.writeLog(u'接口不存在:%s' %gatewayName)

View File

@ -331,6 +331,8 @@ class VtErrorData(VtBaseData):
self.errorID = EMPTY_STRING # 错误代码
self.errorMsg = EMPTY_UNICODE # 错误信息
self.additionalInfo = EMPTY_UNICODE # 补充信息
self.errorTime = time.strftime('%X', time.localtime()) # 错误生成时间
########################################################################