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

扩展数据源无法覆写get_last_price方法? #115

Closed
dongyi opened this Issue May 3, 2017 · 3 comments

Comments

Projects
None yet
2 participants
@dongyi
Contributor

dongyi commented May 3, 2017

1. RQAlpha的版本 2.1.4

2. Python的版本 3.6

3. 是Windows/Linux/MacOS or others? windows

4. 您出现问题对应的源码/或者能复现问题的简易代码 以及对应的配置

# 在自己的DataSource类里定义获取最新价格的函数
def get_last_price(self, *args, **kwargs):
    print("call here....")
    return super().get_last_price(*args, **kwargs)

并没有执行到

5. 您出现的错误堆栈日志信息

@dongyi

This comment has been minimized.

Contributor

dongyi commented May 3, 2017

看了下是要写在自己的BarDictPriceBoard的子类里,但是mod初始化注入的时候要生成一个BarDictPriceBoard的实例, 需要bar_dict参数 不知如何生成

@wh1100717

This comment has been minimized.

Member

wh1100717 commented May 3, 2017

BarDictPriceBoard 是基于AbstractPriceBoard 扩展的 但实际上不需要初始化的时候获取 bar_dict 这只是我们的一种实现而已。

实际上可以直接通过 Environment.get_instance().bar_dict 来获取。

2c076bb Commit 取消了初始化的时候 bar_dict 作为依赖项的传入,改用了 创建了一个 _bar_dict 的property 来实现对应数据的读取,您可以参考一下。

目前代码提交到了develop 分支,如果您需要继承BarDictPriceBoard,要么使用develop分支 要么稍微等一下 今天会发布一个新的版本,其中包含了此次修改。

@wh1100717 wh1100717 self-assigned this May 3, 2017

@wh1100717 wh1100717 closed this in 2c076bb May 3, 2017

@wh1100717

This comment has been minimized.

Member

wh1100717 commented May 3, 2017

@dongyi 2.2.0 已经发布

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