Skip to content
New issue

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

mod 运行错误 #78

Closed
FallacyWalker opened this issue Mar 31, 2017 · 5 comments
Closed

mod 运行错误 #78

FallacyWalker opened this issue Mar 31, 2017 · 5 comments
Assignees

Comments

@FallacyWalker
Copy link

FallacyWalker commented Mar 31, 2017

我照着文档上mod的例子,写了一个helloworld的例子,但是运行时报错:

  • rqalpha version : 2.0.0
  • python version : 2.7.12
run -f /DeepLink/LocalRqalpha20/rqalpha/rqalpha/examples/buy_and_hold.py -sc 100000

error:

2015-06-01 ERROR Traceback (most recent call last):
  File /DeepLink/LocalRqalpha20/rqalpha/rqalpha/examples/buy_and_hold.py, line 32 in handle_bar
    order_percent(context.s1, 1)
    --> context = Context({stocks = ['000001.XSHE'], s1 = '000001.XSHE', fired = False})
    --> bar_dict = BarMap(000001.XSHE)

AttributeError: 'RQInvalidArgument' object has no attribute 'with_traceback'
Traceback (most recent call last):
  File "/DeepLink/LocalRqalpha20/rqalpha/rqalpha/core/strategy.py", line 84, in handle_bar
    self._handle_bar(self._user_context, bar_dict)
    │                │                   └ BarMap(000001.XSHE)
    │                └ <rqalpha.core.strategy.Strategy object at 0x10a692a50><rqalpha.core.strategy.Strategy object at 0x10a692a50>
  File "/DeepLink/LocalRqalpha20/rqalpha/rqalpha/examples/buy_and_hold.py", line 32, in handle_bar
    order_percent(context.s1, 1)
    │             └ Context({stocks = ['000001.XSHE'], s1 = '000001.XSHE', fired = False})
    └ <function order_percent at 0x105ea4398>
  File "/DeepLink/LocalRqalpha20/rqalpha/rqalpha/execution_context.py", line 106, in wrapper
    return func(*args, **kwargs)
           │     │       └ {}
           │     └ ('000001.XSHE', 1)
           └ <function order_percent at 0x105ea4488>
  File "/DeepLink/LocalRqalpha20/rqalpha/rqalpha/utils/arg_checker.py", line 378, in api_rule_check_wrapper
    raise e.with_traceback(tb)
          │                └ <traceback object at 0x10a5f09e0>
          └ RQInvalidArgument(u"function order_percent: invalid percent argument, expect a value < 1, got 1 (type: <type 'int'>)",)
AttributeError: 'RQInvalidArgument' object has no attribute 'with_traceback'
@wh1100717
Copy link
Member

@FallacyWalker 您更新到最新版(2.0.6)试一下?

@lizhi2013
Copy link

好像还不行

@hzliu
Copy link
Contributor

hzliu commented Apr 3, 2017

试试 develop 分支

@hzliu
Copy link
Contributor

hzliu commented Apr 3, 2017

只是 fix 了 with_backtrace 在 python2.7 上出错的问题

@wh1100717
Copy link
Member

@FallacyWalker 2.0.8 已经解决了在Python 2.7下 报错 'RQInvalidArgument' object has no attribute 'with_traceback' 的问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants