增加cta模块优化参数时传入固定参数的功能
This commit is contained in:
parent
5eaefd0537
commit
bef9248e7e
@ -764,6 +764,7 @@ class BacktestingEngine(object):
|
|||||||
# 多进程优化,启动一个对应CPU核心数量的进程池
|
# 多进程优化,启动一个对应CPU核心数量的进程池
|
||||||
pool = multiprocessing.Pool(multiprocessing.cpu_count())
|
pool = multiprocessing.Pool(multiprocessing.cpu_count())
|
||||||
l = []
|
l = []
|
||||||
|
|
||||||
for setting in settingList:
|
for setting in settingList:
|
||||||
l.append(pool.apply_async(optimize, (strategyClass, setting,
|
l.append(pool.apply_async(optimize, (strategyClass, setting,
|
||||||
targetName, self.mode,
|
targetName, self.mode,
|
||||||
@ -817,10 +818,14 @@ class OptimizationSetting(object):
|
|||||||
self.optimizeTarget = '' # 优化目标字段
|
self.optimizeTarget = '' # 优化目标字段
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
def addParameter(self, name, start, end, step):
|
def addParameter(self, name, start, end=None, step=None):
|
||||||
"""增加优化参数"""
|
"""增加优化参数"""
|
||||||
if end <= start:
|
if end is None and step is None:
|
||||||
print u'参数起始点必须小于终止点'
|
self.paramDict[name] = [start]
|
||||||
|
return
|
||||||
|
|
||||||
|
if end < start:
|
||||||
|
print u'参数起始点必须不大于终止点'
|
||||||
return
|
return
|
||||||
|
|
||||||
if step <= 0:
|
if step <= 0:
|
||||||
|
Loading…
Reference in New Issue
Block a user