vn.py量化社区
By Traders, For Traders.
Member
加入于:
帖子: 14
声望: 0

参数优化时一直循环出现如下提示:
020-05-03 15:11:44.588862 加载进度:######### [99%]
2020-05-03 15:11:50.913590 加载进度:########## [100%]
2020-05-03 15:11:50.919572 加载进度:########## [100%]
2020-05-03 15:11:50.931540 加载进度:########## [100%]
2020-05-03 15:11:51.405272 加载进度:######### [99%]
2020-05-03 15:11:53.545514 历史数据加载完成,数据量:472875
2020-05-03 15:11:54.140311 历史数据加载完成,数据量:472875
2020-05-03 15:11:54.141309 历史数据加载完成,数据量:472875
2020-05-03 15:11:54.707823 加载进度:########## [100%]
2020-05-03 15:11:54.707823 历史数据加载完成,数据量:472875
Traceback (most recent call last):
Traceback (most recent call last):
Traceback (most recent call last):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "<string>", line 1, in <module>
File "<string>", line 1, in <module>
File "<string>", line 1, in <module>
File "D:\vnstudio\lib\multiprocessing\spawn.py", line 105, in spawn_main
File "D:\vnstudio\lib\multiprocessing\spawn.py", line 105, in spawn_main
File "D:\vnstudio\lib\multiprocessing\spawn.py", line 105, in spawn_main
File "D:\vnstudio\lib\multiprocessing\spawn.py", line 105, in spawn_main
exitcode = _main(fd)
exitcode = _main(fd)
exitcode = _main(fd)
File "D:\vnstudio\lib\multiprocessing\spawn.py", line 114, in _main
File "D:\vnstudio\lib\multiprocessing\spawn.py", line 114, in _main
File "D:\vnstudio\lib\multiprocessing\spawn.py", line 114, in _main
prepare(preparation_data)
File "D:\vnstudio\lib\multiprocessing\spawn.py", line 225, in prepare
prepare(preparation_data)
prepare(preparation_data)
File "D:\vnstudio\lib\multiprocessing\spawn.py", line 225, in prepare
_fixup_main_from_path(data['init_main_from_path'])
File "D:\vnstudio\lib\multiprocessing\spawn.py", line 225, in prepare
File "D:\vnstudio\lib\multiprocessing\spawn.py", line 277, in _fixup_main_from_path
_fixup_main_from_path(data['init_main_from_path'])
File "D:\vnstudio\lib\multiprocessing\spawn.py", line 277, in _fixup_main_from_path
_fixup_main_from_path(data['init_main_from_path'])
File "D:\vnstudio\lib\multiprocessing\spawn.py", line 277, in _fixup_main_from_path
run_name="mp_main")
run_name="mp_main")
File "D:\vnstudio\lib\runpy.py", line 263, in run_path
File "D:\vnstudio\lib\runpy.py", line 263, in run_path
run_name="mp_main")
File "D:\vnstudio\lib\runpy.py", line 263, in run_path
exitcode = _main(fd)
File "D:\vnstudio\lib\multiprocessing\spawn.py", line 114, in _main
prepare(preparation_data)
File "D:\vnstudio\lib\multiprocessing\spawn.py", line 225, in prepare
_fixup_main_from_path(data['init_main_from_path'])
File "D:\vnstudio\lib\multiprocessing\spawn.py", line 277, in _fixup_main_from_path
run_name="mp_main")
File "D:\vnstudio\lib\runpy.py", line 263, in run_path
pkg_name=pkg_name, script_name=fname)
pkg_name=pkg_name, script_name=fname)
pkg_name=pkg_name, script_name=fname)
File "D:\vnstudio\lib\runpy.py", line 96, in _run_module_code
pkg_name=pkg_name, script_name=fname)
File "D:\vnstudio\lib\runpy.py", line 96, in _run_module_code
File "D:\vnstudio\lib\runpy.py", line 96, in _run_module_code
File "D:\vnstudio\lib\runpy.py", line 96, in _run_module_code
mod_name, mod_spec, pkg_name, script_name)
File "D:\vnstudio\lib\runpy.py", line 85, in _run_code
mod_name, mod_spec, pkg_name, script_name)
mod_name, mod_spec, pkg_name, script_name)
mod_name, mod_spec, pkg_name, script_name)
File "D:\vnstudio\lib\runpy.py", line 85, in _run_code
File "D:\vnstudio\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "c:\Users\zhong\Desktop\strategies\dual_thrust_backtesting_bar.py", line 29, in <module>
File "D:\vnstudio\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "c:\Users\zhong\Desktop\strategies\dual_thrust_backtesting_bar.py", line 29, in <module>
exec(code, run_globals)
exec(code, run_globals)
File "c:\Users\zhong\Desktop\strategies\dual_thrust_backtesting_bar.py", line 29, in <module>
File "c:\Users\zhong\Desktop\strategies\dual_thrust_backtesting_bar.py", line 29, in <module>
engine.run_optimization(setting)
engine.run_optimization(setting)
engine.run_optimization(setting)
engine.run_optimization(setting)
File "D:\vnstudio\lib\site-packages\vnpy\app\cta_strategy\backtesting.py", line 569, in run_optimization
File "D:\vnstudio\lib\site-packages\vnpy\app\cta_strategy\backtesting.py", line 569, in run_optimization
File "D:\vnstudio\lib\site-packages\vnpy\app\cta_strategy\backtesting.py", line 569, in run_optimization
File "D:\vnstudio\lib\site-packages\vnpy\app\cta_strategy\backtesting.py", line 569, in run_optimization
pool = ctx.Pool(multiprocessing.cpu_count())
pool = ctx.Pool(multiprocessing.cpu_count())
File "D:\vnstudio\lib\multiprocessing\context.py", line 119, in Pool
pool = ctx.Pool(multiprocessing.cpu_count())
File "D:\vnstudio\lib\multiprocessing\context.py", line 119, in Pool
pool = ctx.Pool(multiprocessing.cpu_count())
File "D:\vnstudio\lib\multiprocessing\context.py", line 119, in Pool
File "D:\vnstudio\lib\multiprocessing\context.py", line 119, in Pool
context=self.get_context())
context=self.get_context())
context=self.get_context())
context=self.get_context())
File "D:\vnstudio\lib\multiprocessing\pool.py", line 177, in init
File "D:\vnstudio\lib\multiprocessing\pool.py", line 177, in init
File "D:\vnstudio\lib\multiprocessing\pool.py", line 177, in init
File "D:\vnstudio\lib\multiprocessing\pool.py", line 177, in init
self._repopulate_pool()
self._repopulate_pool()
self._repopulate_pool()
self._repopulate_pool()
File "D:\vnstudio\lib\multiprocessing\pool.py", line 238, in _repopulate_pool
File "D:\vnstudio\lib\multiprocessing\pool.py", line 238, in _repopulate_pool
File "D:\vnstudio\lib\multiprocessing\pool.py", line 238, in _repopulate_pool
File "D:\vnstudio\lib\multiprocessing\pool.py", line 238, in _repopulate_pool
self._wrap_exception)
self._wrap_exception)
File "D:\vnstudio\lib\multiprocessing\pool.py", line 257, in _repopulate_pool_static
File "D:\vnstudio\lib\multiprocessing\pool.py", line 257, in _repopulate_pool_static
self._wrap_exception)
File "D:\vnstudio\lib\multiprocessing\pool.py", line 257, in _repopulate_pool_static
w.start()
self._wrap_exception)
w.start()
File "D:\vnstudio\lib\multiprocessing\process.py", line 112, in start
File "D:\vnstudio\lib\multiprocessing\pool.py", line 257, in _repopulate_pool_static
w.start()
File "D:\vnstudio\lib\multiprocessing\process.py", line 112, in start
File "D:\vnstudio\lib\multiprocessing\process.py", line 112, in start
w.start()
File "D:\vnstudio\lib\multiprocessing\process.py", line 112, in start
self._popen = self._Popen(self)
self._popen = self._Popen(self)
self._popen = self._Popen(self)
self._popen = self._Popen(self)
File "D:\vnstudio\lib\multiprocessing\context.py", line 322, in _Popen
File "D:\vnstudio\lib\multiprocessing\context.py", line 322, in _Popen
File "D:\vnstudio\lib\multiprocessing\context.py", line 322, in _Popen
File "D:\vnstudio\lib\multiprocessing\context.py", line 322, in _Popen
return Popen(process_obj)
return Popen(process_obj)
return Popen(process_obj)
File "D:\vnstudio\lib\multiprocessing\popen_spawn_win32.py", line 33, in init
return Popen(process_obj)
File "D:\vnstudio\lib\multiprocessing\popen_spawn_win32.py", line 33, in init
File "D:\vnstudio\lib\multiprocessing\popen_spawn_win32.py", line 33, in init
File "D:\vnstudio\lib\multiprocessing\popen_spawn_win32.py", line 33, in init
prep_data = spawn.get_preparation_data(process_obj._name)
prep_data = spawn.get_preparation_data(process_obj._name)
prep_data = spawn.get_preparation_data(process_obj._name)
prep_data = spawn.get_preparation_data(process_obj._name)
File "D:\vnstudio\lib\multiprocessing\spawn.py", line 143, in get_preparation_data
File "D:\vnstudio\lib\multiprocessing\spawn.py", line 143, in get_preparation_data
File "D:\vnstudio\lib\multiprocessing\spawn.py", line 143, in get_preparation_data
File "D:\vnstudio\lib\multiprocessing\spawn.py", line 143, in get_preparation_data
_check_not_importing_main()
_check_not_importing_main()
_check_not_importing_main()
File "D:\vnstudio\lib\multiprocessing\spawn.py", line 136, in _check_not_importing_main
_check_not_importing_main()
File "D:\vnstudio\lib\multiprocessing\spawn.py", line 136, in _check_not_importing_main
File "D:\vnstudio\lib\multiprocessing\spawn.py", line 136, in _check_not_importing_main
File "D:\vnstudio\lib\multiprocessing\spawn.py", line 136, in _check_not_importing_main
is not going to be frozen to produce an executable.''')
RuntimeError:
An attempt has been made to start a new process before the
current process has finished its bootstrapping phase.

    This probably means that you are not using fork to start your
    child processes and you have forgotten to use the proper idiom
    in the main module:

        if __name__ == '__main__':
            freeze_support()
            ...

    The "freeze_support()" line can be omitted if the program
    is not going to be frozen to produce an executable.    is not going to be frozen to produce an executable.''')
is not going to be frozen to produce an executable.''')
is not going to be frozen to produce an executable.''')

RuntimeError:
An attempt has been made to start a new process before the
current process has finished its bootstrapping phase.

    This probably means that you are not using fork to start your
    child processes and you have forgotten to use the proper idiom
    in the main module:

        if __name__ == '__main__':
            freeze_support()
            ...

    The "freeze_support()" line can be omitted if the program
    is not going to be frozen to produce an executable.RuntimeError:
    An attempt has been made to start a new process before the
    current process has finished its bootstrapping phase.

    This probably means that you are not using fork to start your
    child processes and you have forgotten to use the proper idiom
    in the main module:

        if __name__ == '__main__':
            freeze_support()
            ...

    The "freeze_support()" line can be omitted if the program
    is not going to be frozen to produce an executable.RuntimeError: 
    An attempt has been made to start a new process before the
    current process has finished its bootstrapping phase.

    This probably means that you are not using fork to start your
    child processes and you have forgotten to use the proper idiom
    in the main module:

        if __name__ == '__main__':
            freeze_support()
            ...

    The "freeze_support()" line can be omitted if the program
    is not going to be frozen to produce an executable.


description

description

请问参数优化代码哪里错了。
k1 = 0.4
k2 = 0.6
trailing_percent = 0.8
这三个参数需要设为0吗。

Member
加入于:
帖子: 14
声望: 0

description

为什么一直处于循环状态,不会结束的

Member
avatar
加入于:
帖子: 736
声望: 35

看不到完整代码,请问是使用的自己编写的DualThrustStrategy还是cta_strategy附带的呢?附带的DualThrustStrategy里好像没有trailing_percent这个参数。

© 2015-2019 上海韦纳软件科技有限公司
备案服务号:沪ICP备18006526号-3