parent
55b57ca781
commit
05a58c24ba
@ -62,6 +62,11 @@ class AtrRsiStrategy(CtaTemplate):
|
||||
'rsiBuy',
|
||||
'rsiSell']
|
||||
|
||||
# 同步列表,保存了需要保存到数据库的变量名称
|
||||
syncList = ['pos',
|
||||
'intraTradeHigh',
|
||||
'intraTradeLow']
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def __init__(self, ctaEngine, setting):
|
||||
"""Constructor"""
|
||||
@ -154,7 +159,7 @@ class AtrRsiStrategy(CtaTemplate):
|
||||
# 计算多头移动止损
|
||||
longStop = self.intraTradeHigh * (1-self.trailingPercent/100)
|
||||
|
||||
# 发出本地止损委托,并且把委托号记录下来,用于后续撤单
|
||||
# 发出本地止损委托
|
||||
self.sell(longStop, abs(self.pos), stop=True)
|
||||
|
||||
# 持有空头仓位
|
||||
@ -165,6 +170,9 @@ class AtrRsiStrategy(CtaTemplate):
|
||||
shortStop = self.intraTradeLow * (1+self.trailingPercent/100)
|
||||
self.cover(shortStop, abs(self.pos), stop=True)
|
||||
|
||||
# 同步数据到数据库
|
||||
self.saveSyncData()
|
||||
|
||||
# 发出状态更新事件
|
||||
self.putEvent()
|
||||
|
||||
|
@ -77,6 +77,11 @@ class BollChannelStrategy(CtaTemplate):
|
||||
'longStop',
|
||||
'shortStop']
|
||||
|
||||
# 同步列表,保存了需要保存到数据库的变量名称
|
||||
syncList = ['pos',
|
||||
'intraTradeHigh',
|
||||
'intraTradeLow']
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def __init__(self, ctaEngine, setting):
|
||||
"""Constructor"""
|
||||
@ -173,6 +178,9 @@ class BollChannelStrategy(CtaTemplate):
|
||||
|
||||
self.cover(self.shortStop, abs(self.pos), True)
|
||||
|
||||
# 同步数据到数据库
|
||||
self.saveSyncData()
|
||||
|
||||
# 发出状态更新事件
|
||||
self.putEvent()
|
||||
|
||||
|
@ -54,6 +54,9 @@ class DoubleMaStrategy(CtaTemplate):
|
||||
'slowMa0',
|
||||
'slowMa1']
|
||||
|
||||
# 同步列表,保存了需要保存到数据库的变量名称
|
||||
syncList = ['pos']
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def __init__(self, ctaEngine, setting):
|
||||
"""Constructor"""
|
||||
|
@ -56,6 +56,9 @@ class DualThrustStrategy(CtaTemplate):
|
||||
'shortEntry',
|
||||
'exitTime']
|
||||
|
||||
# 同步列表,保存了需要保存到数据库的变量名称
|
||||
syncList = ['pos']
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def __init__(self, ctaEngine, setting):
|
||||
"""Constructor"""
|
||||
|
@ -57,6 +57,11 @@ class KkStrategy(CtaTemplate):
|
||||
'kkUp',
|
||||
'kkDown']
|
||||
|
||||
# 同步列表,保存了需要保存到数据库的变量名称
|
||||
syncList = ['pos',
|
||||
'intraTradeHigh',
|
||||
'intraTradeLow']
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def __init__(self, ctaEngine, setting):
|
||||
"""Constructor"""
|
||||
@ -146,6 +151,9 @@ class KkStrategy(CtaTemplate):
|
||||
abs(self.pos), True)
|
||||
self.orderList.extend(l)
|
||||
|
||||
# 同步数据到数据库
|
||||
self.saveSyncData()
|
||||
|
||||
# 发出状态更新事件
|
||||
self.putEvent()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user