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

如何在样本内回测结果的基础上在样本外继续跟踪策略表现? #90

Closed
wanhanwan opened this Issue Apr 12, 2017 · 7 comments

Comments

Projects
None yet
4 participants
@wanhanwan

wanhanwan commented Apr 12, 2017

例如回测时的时间区间为2005/1/1至2016/12/31,我想在继续跟踪2017年以来的策略表现,但又不想从2005年开始重新跑一遍回测,我该如何做?

@wh1100717

This comment has been minimized.

Member

wh1100717 commented Apr 12, 2017

@wanhanwan

可以通过 RQAlpha 的 persist_provider 来实现。

您可以参考 DiskPersistProvider 的实现。

您也可以参考 能不能考虑提供策略参数持久化的支持? 的讨论。

很抱歉,这块还没有比较详细的文档,而且对应的 API 和接口未来可能会重构。

我们也会尽快提供相关的文档,以及相关的 Mod 来支持回测/模拟/实盘 自定义持久化 相关的内容。

如果您不想使用我们提供的 Persist 相关内容,也可以通过 Mod 来独立实现您所需要的功能,大体思路如下:

  • 注册 EVENT.POST_SETTLEMENT 事件
  • 在响应函数中获取portfolio, 执行portfolio.get_state() 获取序列化好的数据,并进行存储
  • 重新启动的时候初始化好Portfolio以后,将存储的数据读取,并执行portfolio.set_state(state) 来进行投资组合的恢复。
@wanhanwan

This comment has been minimized.

wanhanwan commented Apr 13, 2017

@wh1100717

This comment has been minimized.

Member

wh1100717 commented Apr 13, 2017

@wanhanwan 确实是是个regression bug 下一个版本会增加对应的set_state和get_satte方法

@wh1100717

This comment has been minimized.

Member

wh1100717 commented Apr 13, 2017

@wanhanwan 我看了一下 BenchmarkAccount 继承自 StockAccount 其已经实现了 set_state
get_state 方法,是否可以贴一下具体的报错堆栈信息?

@wanhanwan

This comment has been minimized.

wanhanwan commented Apr 13, 2017

@wh1100717

This comment has been minimized.

Member

wh1100717 commented Apr 13, 2017

@wanhanwan 确实如此 非常感谢!!

@wh1100717 wh1100717 closed this in de40647 Apr 19, 2017

@wh1100717 wh1100717 added the fixed label Apr 19, 2017

shij10 added a commit to shij10/rqalpha that referenced this issue Apr 29, 2017

sync with the latest (#1)
* release 2.0.0-beta

* update README

* disable register event for offline scripts

* add repr

* persist broker if need

* fix portfolio set_state

* update i18n

* add is_st_stock && is_suspended

* update i18n

* release 2.0.0

* fix broker persist

* remove duplicate option in .gitignore

* update setup.py

* add LIVE_TRADING

* do not copy; add LIVE_TRADING

* fix RunInfo

* fix dt

* 修改配置的读取方式,不再从~/.rqalpha/config.yml读取用户配置信息,而是默认从当前命令行读取config.yml,如果没有找到,则会读取系统默认配置信息。

* 1.	config 现在不再进行版本检查
2.	generate_config 现在会生成默认系统配置信息的config.yml文件
3.	不再使用config_template.yml模板

* release 2.0.1

* fix typo

* little refactory

* little fixes

* remove run_id

* use integer value for ACCOUNT_TYPE

* support context_vars with dict input

* remove debug print

* release 2.0.2

* fix mavg and vwap

* include requirements-py2.txt

* bug fixed

* release 2.0.5

* Bug Fixed: ricequant#76

* 解决 get_mod_config_path  返回值不正确的问题

* analyser benchmark bug fixed

* release 0.2.6

* fix typo

* fix de_listed

* fix AnalyserMod

* add tick event source

* implement get_ticks for test

* fix concatenate bug

* use merge sort to merge ticks

* fill open price from snapshot

* add tick price board

* get tick from event

* rename matcher & simulation broker

* remove internal limit up & limit down from bar.py

* let matcher use price board

* enable volume_limit only when frequency is 1d/1m

* update tick model

* filter past time when universe is change

* refactor

* fix limit up / limit down

* fix limit up / limit down typo

* fix typo

* fix bug when missing market data

* fix doc typo

* add match order_book_id filter

* fix before_trading

* python2 unicode compatible

* make better_exceptions unicode str compatible with python 2.7

* print time spend when performance regress

* arg_checker: fix check_are_valid_fields, is_valid_date

* fix for python2

* add count for is_suspended and is_st_stock

* fix

* fix

* fix order_percent; clear comment

* update docs

* release 2.0.7

* update version

* fix before_trading time bug

* update FAQ doc

* remove useless code

* performance tune

* add matching type check

* publish EVENT.POST_UNIVERSE_CHANGED only when universe changes really

* cache get_account_type because it is god damn slow

* update repr of snapshot

* fix before_trading time bug

* auto set default encoding with utf8

* format code

* update sys_stock_realtime readme

* add limit up & limit down

* implement a1 b1

* add data_board

* use order_book_id to be index

* fix realtime stock cause by mod conflict

* refactor event source

* remove StockRealtimePriceBoard

* add intro/optimizing_parameters

* add batch run test code

* add batch run by main.run

* add analyser batch run performance

* fix docs

* use `from rqalpha import run` to run batch

* refactor ptimizing_parameterso

* fix subscribe bug & refactor event source

* bug fixed

* release 2.0.8

* add missing logger in api

* add missing logger in api

* add  mod_sys_analyser README.rst

* update sys_analyser README

* Update README.rst

* 增加 sys_progress Mod 对应的 README.rst 文档

* 增加 sys_risk_mod 对应的README.rst

* add sys_simulation mod README.rst

* update sys_stock_realtime mod README.rst

* update docs

* update

* seems better

* preload carray

* data type matters

* update sys_funcat docs

* add more examples into sys_funcat doc

* add mod requirement

* fix format style

* update rqalpha_mod_sys_analyser docs

* update docs

* update docs

* add optimizing parameters examples in docs

* unify is_suspended/is_st_stock

* add set_pending_cancel

* fix logic bug in order.is_final

* refactor deal_price_decider create

* format test code

* format example code

* fix test_api_base

* refactor test_api

* remove test code

* show progress bar for test_api

* fix typo

* fix test_api_future/test_api_stock

* fix doc

* fix test code

* update simulation broker

* use env.get_instrument instead of data_proxy

* update signal broker

* bug fixed

* update sys analyser mod

* format code

* update history_bars api

* add signal test algo

* disable test_api temporarily

* fix rqalpha cmd error

* format code

* update i18n

* release 2.0.9

* add error message, fix bug in test cases

* fix only export custom user mod config issue

* Update signal_broker.py

81行修改了一处BUG

* format code

* update docs

* Develop (ricequant#89)

* test

* test

* merge 2.0.6

* commit

* commit

* fix no settlement

* delete tags

* add extend_api example

* update docs

* update docs

* release 2.1.0

* release 2.1.0

* update docs

* 提供 `from rqalpha import cli` 方便第三方 Mod 扩展 `rqalpha` command

* add include_now

* fix data_proxy

* Fix ricequant#90

* fix concept testcase

* do not create position until first trade

* add quarter arg checker

* fix include_now in BEFORE_TRADING

* refactor

refactor rqalpha_mod_sys_funcat

* fix bar_count

* refactor get_price

remove useless code

* refactor sys_funcat

* Fix bug issue#94

* release 2.1.2

* add bar count scale

* don't create position

* add stock & future test case

* refactor test.py

* fix travis in 2.7 because ipython==6.0+ is not support python 2

* fix bug when running future

* fix alpha calculate error

* update test pkl

* update i18n

* require six

* only futures has settle price

* use int32/int64

* fix transaction_cost

* fix typo

* add pnl/starting_cash/fronzen_cash

* fix frozen_cash

* add requests lib requirement

* update translation

* fix tiny bug for rqalpha mod install cmd

* fix history_bars

* make price_limit as a warning switcher option for signal model

* fix history_bars when include_now=True

* remove force include_now=False

* fix history_bars

* fix regression

* support config.json as user config file

* bug fixed

* add issue template

* Update issue_template.md

* add comment

* bug fixed

* fix future calc

* fix ricequant#101

* release 2.1.3

* update version

* update pkl

* remove unused typing lib

* add deprecated property for making old version RQA compatible

* fix plot when only backtest with one day

* fix settlement price

* fix history_bars because we misuse ExecutionContext.phase()

* 增加期货账户级别仓位强平 ricequant#108

* pass test case

* update i18n

* release 2.1.4

* bug fixed

* fix frozen_cash cal

* fix clear position
@zeyu203

This comment has been minimized.

zeyu203 commented Oct 16, 2018

请问现在是否已经有详细的文档了呢?或者是否可以指导如何能够实现这一功能呢?谢谢

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