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

有没有更好的方式对持久化的策略传参呢? #740

Open
Daic115 opened this issue Oct 18, 2022 · 1 comment
Open

有没有更好的方式对持久化的策略传参呢? #740

Daic115 opened this issue Oct 18, 2022 · 1 comment

Comments

@Daic115
Copy link

Daic115 commented Oct 18, 2022

1. RQAlpha的版本

4.11.3

2. Python的版本

3.8.10

3. 是Windows/Linux/MacOS or others?

Windows

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

目前使用run_file的形式运行策略,并使用 rqalpha-mod-incremental进行策略持久化; 由于策略会每日读取一个文件,目前用如下方式:

run_file("./strategy/strategy_test.py",
         config={
             ...
             "extra": {
                 "log_level": "info",
                 "context_vars": {"file": "当日加载的文件路径"},
             },
             ...
         })

通过 context_vars 的形式进行传值给 ucontext 会被 persist_helper 中之前的内容覆盖 main.py#L205
目前的解决方法就是直接固定死context_vars中需要读取的文件路径,然后每日进行覆盖,但感觉这种方式不太灵活;请问下有没有更好的方式对持久化的策略传参呢?

@hzliu
Copy link
Contributor

hzliu commented Mar 21, 2023

策略内动态调整的参数应该在 before_trading 阶段读取。persisit的目的是保存策略运行状态。

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

No branches or pull requests

2 participants