VeighNa量化社区
你的开源社区量化交易平台
Member
avatar
加入于:
帖子: 23
声望: 0

按照github上的样板文件
运行这部分时候
setting = OptimizationSetting()
setting.set_target("sharpe_ratio")
setting.add_parameter("boll_window", 10, 30, 1)
setting.add_parameter("boll_dev", 1, 3, 1)
engine.run_optimization(setting)

5 engine.run_optimization(setting)

File c:\veighna_studio\lib\site-packages\vnpy_spreadtrading\backtesting.py:441, in BacktestingEngine.run_bf_optimization(self, optimization_setting, output)
438 return
440 evaluate_func: callable = wrap_evaluate(self, optimization_setting.target_name)
--> 441 results: list = run_bf_optimization(
442 evaluate_func,
443 optimization_setting,
444 get_target_value,
445 output=self.output,
446 )
448 if output:
449 for result in results:

File c:\veighna_studio\lib\site-packages\vnpy\trader\optimize.py:119, in run_bf_optimization(evaluate_func, optimization_setting, key_func, max_workers, output)
114 #max_workers最大worker数量,context:进程启动方式,比如spawn、fork等
115 with ProcessPoolExecutor(
116 max_workers,
117 mp_context=get_context("spawn")
118 ) as executor:
--> 119 results: List[Tuple] = list(executor.map(evaluate_func, settings))
120 results.sort(reverse=True, key=key_func)
122 end: int = perf_counter()

File c:\veighna_studio\lib\concurrent\futures\process.py:567, in _chain_from_iterable_of_lists(iterable)
561 def _chain_from_iterable_of_lists(iterable):
562 """
563 Specialized implementation of itertools.chain.from_iterable.
564 Each item in iterable should be a list. This function is
565 careful not to keep references to yielded objects.
566 """
--> 567 for element in iterable:
568 element.reverse()
569 while element:

File c:\veighna_studio\lib\concurrent\futures_base.py:609, in Executor.map.<locals>.result_iterator()
606 while fs:
607 # Careful not to keep a reference to the popped future
608 if timeout is None:
--> 609 yield fs.pop().result()
610 else:
611 yield fs.pop().result(end_time - time.monotonic())

File c:\veighna_studio\lib\concurrent\futures_base.py:439, in Future.result(self, timeout)
437 raise CancelledError()
438 elif self._state == FINISHED:
--> 439 return self.__get_result()
441 self._condition.wait(timeout)
443 if self._state in [CANCELLED, CANCELLED_AND_NOTIFIED]:

File c:\veighna_studio\lib\concurrent\futures_base.py:391, in Future.__get_result(self)
389 if self._exception:
390 try:
--> 391 raise self._exception
392 finally:
393 # Break a reference cycle with the exception in self._exception
394 self = None

QuotaExceeded: connection number exceeds

Member
avatar
加入于:
帖子: 4870
声望: 292

这是米筐的报错吧,同一个账号登录的设备超限了

Member
avatar
加入于:
帖子: 23
声望: 0

xiaohe wrote:

这是米筐的报错吧,同一个账号登录的设备超限了
应该不是,我改用另一种寻优engine.run_bf_optimization(setting),结果就是正常的,这里超限的应该是多核运算的问题吧,理论上两个寻优模块不涉及米筐的报错,只涉及本地数据库的调用吧

Member
avatar
加入于:
帖子: 4870
声望: 292

如果不配置米筐的license,然后还是一样的报错就说明不是米筐的问题了

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

沪公网安备 31011502017034号

【用户协议】
【隐私政策】
【免责条款】