We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
实盘模拟 我初始化 两个股票例如 context.s1 = "600104.XSHG" context.s2 = "000895.XSHE" 开始 要保证一定的持仓 我就 初始化 order_lots(context.s1, 1000)
运行的时候 会遇到如下 错误信息。为什么会出现 KeyError
KeyError: '您选择的证券[600104.XSHG]不存在。' Traceback (most recent call last): File "C:\Program Files\Anaconda3\lib\site-packages\rqalpha\core\strategy.py", line 84, in handle_bar self._handle_bar(self._user_context, bar_dict) �� �� �� BarMap() �� �� <rqalpha.core.strategy.Strategy object at 0x00000214ABDBC588> �� <rqalpha.core.strategy.Strategy object at 0x00000214ABDBC588> File "rsi.py", line 18, in handle_bar order_lots(context.s1, 1000) �� �� Context({s1 = '600104.XSHG', ONE_HAND = 100, isEmpty = True, s2 = '000895.XSHE'}) �� <function order_lots at 0x000002149D27AD08> File "C:\Program Files\Anaconda3\lib\site-packages\rqalpha\execution_context.py", line 106, in wrapper return func(*args, **kwargs) �� �� �� {} �� �� ('600104.XSHG', 1000) �� <function order_lots at 0x000002149D27AE18> File "C:\Program Files\Anaconda3\lib\site-packages\rqalpha\utils\arg_checker.py", line 362, in api_rule_check_wrapper return func(*args, **kwargs) �� �� �� {} �� �� ('600104.XSHG', 1000) �� <function order_lots at 0x000002149D27AD90> File "C:\Program Files\Anaconda3\lib\site-packages\rqalpha\api\api_stock.py", line 199, in order_lots return order_shares(id_or_ins, amount * round_lot, style) �� �� �� �� �� ORDER_TYPE.MARKET �� �� �� �� 100 �� �� �� 1000 �� �� '600104.XSHG' �� <function order_shares at 0x000002149D27AAE8> File "C:\Program Files\Anaconda3\lib\site-packages\rqalpha\execution_context.py", line 106, in wrapper return func(*args, **kwargs) �� �� �� {} �� �� ('600104.XSHG', 100000, ORDER_TYPE.MARKET) �� <function order_shares at 0x000002149D27ABF8> File "C:\Program Files\Anaconda3\lib\site-packages\rqalpha\utils\arg_checker.py", line 362, in api_rule_check_wrapper return func(*args, **kwargs) �� �� �� {} �� �� ('600104.XSHG', 100000, ORDER_TYPE.MARKET) �� <function order_shares at 0x000002149D27AB70> File "C:\Program Files\Anaconda3\lib\site-packages\rqalpha\api\api_stock.py", line 148, in order_shares env.broker.submit_order(r_order) �� �� Order({'filled_quantity': 0, 'order_id': 1491374928, 'order_book_id': '600104.XSHG', 'side': SIDE.BUY, 'type': ORDER_TYPE.MARKET... �� <rqalpha.environment.Environment object at 0x000002149D950DA0> File "C:\Program Files\Anaconda3\lib\site-packages\rqalpha\mod\rqalpha_mod_sys_simulation\simulation_broker.py", line 92, in submit_order self._match() �� <rqalpha.mod.rqalpha_mod_sys_simulation.simulation_broker.SimulationBroker object at 0x00000214ABD9BEB8> File "C:\Program Files\Anaconda3\lib\site-packages\rqalpha\mod\rqalpha_mod_sys_simulation\simulation_broker.py", line 139, in _match self._matcher.match(self._open_orders) �� �� <rqalpha.mod.rqalpha_mod_sys_simulation.simulation_broker.SimulationBroker object at 0x00000214ABD9BEB8> �� <rqalpha.mod.rqalpha_mod_sys_simulation.simulation_broker.SimulationBroker object at 0x00000214ABD9BEB8> File "C:\Program Files\Anaconda3\lib\site-packages\rqalpha\mod\rqalpha_mod_sys_simulation\matcher.py", line 53, in match bar = self.board[order.order_book_id] �� �� Order({'filled_quantity': 0, 'order_id': 1491374928, 'order_book_id': '600104.XSHG', 'side': SIDE.BUY, 'type': ORDER_TYPE.MARKET... �� <rqalpha.mod.rqalpha_mod_sys_simulation.matcher.Matcher object at 0x00000214ABD9BEF0> File "C:\Program Files\Anaconda3\lib\site-packages\rqalpha\model\bar.py", line 389, in getitem raise patch_user_exc(KeyError(('id_or_symbols {} does not exist'").format(key))) �� �� �� '600104.XSHG' �� �� <function gettext at 0x000002149966A158> �� <function patch_user_exc at 0x0000021499632E18> KeyError: '��ѡ���֤ȯ[600104.XSHG]�����ڡ�'
The text was updated successfully, but these errors were encountered:
出错是因为 mod 冲突, develop 已经修复了
Sorry, something went wrong.
已经在2.0.8版本中解决了该问题
cedricporter
wh1100717
No branches or pull requests
实盘模拟 我初始化 两个股票例如 context.s1 = "600104.XSHG" context.s2 = "000895.XSHE"
开始 要保证一定的持仓 我就 初始化 order_lots(context.s1, 1000)
运行的时候 会遇到如下 错误信息。为什么会出现 KeyError
KeyError: '您选择的证券[600104.XSHG]不存在。'
Traceback (most recent call last):
File "C:\Program Files\Anaconda3\lib\site-packages\rqalpha\core\strategy.py", line 84, in handle_bar
self._handle_bar(self._user_context, bar_dict)
�� �� �� BarMap()
�� �� <rqalpha.core.strategy.Strategy object at 0x00000214ABDBC588>
�� <rqalpha.core.strategy.Strategy object at 0x00000214ABDBC588>
File "rsi.py", line 18, in handle_bar
order_lots(context.s1, 1000)
�� �� Context({s1 = '600104.XSHG', ONE_HAND = 100, isEmpty = True, s2 = '000895.XSHE'})
�� <function order_lots at 0x000002149D27AD08>
File "C:\Program Files\Anaconda3\lib\site-packages\rqalpha\execution_context.py", line 106, in wrapper
return func(*args, **kwargs)
�� �� �� {}
�� �� ('600104.XSHG', 1000)
�� <function order_lots at 0x000002149D27AE18>
File "C:\Program Files\Anaconda3\lib\site-packages\rqalpha\utils\arg_checker.py", line 362, in api_rule_check_wrapper
return func(*args, **kwargs)
�� �� �� {}
�� �� ('600104.XSHG', 1000)
�� <function order_lots at 0x000002149D27AD90>
File "C:\Program Files\Anaconda3\lib\site-packages\rqalpha\api\api_stock.py", line 199, in order_lots
return order_shares(id_or_ins, amount * round_lot, style)
�� �� �� �� �� ORDER_TYPE.MARKET
�� �� �� �� 100
�� �� �� 1000
�� �� '600104.XSHG'
�� <function order_shares at 0x000002149D27AAE8>
File "C:\Program Files\Anaconda3\lib\site-packages\rqalpha\execution_context.py", line 106, in wrapper
return func(*args, **kwargs)
�� �� �� {}
�� �� ('600104.XSHG', 100000, ORDER_TYPE.MARKET)
�� <function order_shares at 0x000002149D27ABF8>
File "C:\Program Files\Anaconda3\lib\site-packages\rqalpha\utils\arg_checker.py", line 362, in api_rule_check_wrapper
return func(*args, **kwargs)
�� �� �� {}
�� �� ('600104.XSHG', 100000, ORDER_TYPE.MARKET)
�� <function order_shares at 0x000002149D27AB70>
File "C:\Program Files\Anaconda3\lib\site-packages\rqalpha\api\api_stock.py", line 148, in order_shares
env.broker.submit_order(r_order)
�� �� Order({'filled_quantity': 0, 'order_id': 1491374928, 'order_book_id': '600104.XSHG', 'side': SIDE.BUY, 'type': ORDER_TYPE.MARKET...
�� <rqalpha.environment.Environment object at 0x000002149D950DA0>
File "C:\Program Files\Anaconda3\lib\site-packages\rqalpha\mod\rqalpha_mod_sys_simulation\simulation_broker.py", line 92, in submit_order
self._match()
�� <rqalpha.mod.rqalpha_mod_sys_simulation.simulation_broker.SimulationBroker object at 0x00000214ABD9BEB8>
File "C:\Program Files\Anaconda3\lib\site-packages\rqalpha\mod\rqalpha_mod_sys_simulation\simulation_broker.py", line 139, in _match
self._matcher.match(self._open_orders)
�� �� <rqalpha.mod.rqalpha_mod_sys_simulation.simulation_broker.SimulationBroker object at 0x00000214ABD9BEB8>
�� <rqalpha.mod.rqalpha_mod_sys_simulation.simulation_broker.SimulationBroker object at 0x00000214ABD9BEB8>
File "C:\Program Files\Anaconda3\lib\site-packages\rqalpha\mod\rqalpha_mod_sys_simulation\matcher.py", line 53, in match
bar = self.board[order.order_book_id]
�� �� Order({'filled_quantity': 0, 'order_id': 1491374928, 'order_book_id': '600104.XSHG', 'side': SIDE.BUY, 'type': ORDER_TYPE.MARKET...
�� <rqalpha.mod.rqalpha_mod_sys_simulation.matcher.Matcher object at 0x00000214ABD9BEF0>
File "C:\Program Files\Anaconda3\lib\site-packages\rqalpha\model\bar.py", line 389, in getitem
raise patch_user_exc(KeyError(('id_or_symbols {} does not exist'").format(key)))
�� �� �� '600104.XSHG'
�� �� <function gettext at 0x000002149966A158>
�� <function patch_user_exc at 0x0000021499632E18>
KeyError: '��ѡ���֤ȯ[600104.XSHG]�����ڡ�'
The text was updated successfully, but these errors were encountered: