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

Fix backtest #719

Merged
merged 10 commits into from
Dec 7, 2021
Merged

Fix backtest #719

merged 10 commits into from
Dec 7, 2021

Conversation

zhupr
Copy link
Collaborator

@zhupr zhupr commented Nov 27, 2021

Description

Motivation and Context

How Has This Been Tested?

  • Pass the test by running: pytest qlib/tests/test_all_pipeline.py under upper directory of qlib.
  • If you are adding a new feature, test on your own test scripts.

Screenshots of Test Results (if appropriate):

  1. Pipeline test:
  2. Your own tests:

Types of changes

  • Fix bugs
  • Add new feature
  • Update documentation

@zhupr zhupr mentioned this pull request Nov 27, 2021
@zhupr zhupr requested a review from you-n-g November 27, 2021 17:06
docs/component/strategy.rst Show resolved Hide resolved
qlib/backtest/__init__.py Outdated Show resolved Hide resolved
qlib/backtest/exchange.py Outdated Show resolved Hide resolved
qlib/config.py Show resolved Hide resolved
qlib/data/storage/file_storage.py Outdated Show resolved Hide resolved
qlib/data/storage/file_storage.py Show resolved Hide resolved
@you-n-g
Copy link
Collaborator

you-n-g commented Dec 2, 2021

Please show the result of workflow.py

portfolio_metric_dict, indicator_dict = backtest_daily(
start_time="2017-01-01", end_time="2020-08-01", strategy=strategy_obj, executor=executor_obj
)
analysis_freq = "{0}{1}".format(*Freq.parse(FREQ))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can integrate this analysis_freq into backtest_daily.

**NOTE**: This will be applied to the outmost executor's calendar.
E.g. Executor[day](Executor[1min]), setting `end_time == 20XX0301` will include all the minutes on 20XX0301
strategy : Union[str, dict, BaseStrategy]
for initializing outermost portfolio strategy. Please refer to the docs of init_instance_by_config for more information.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can give a example in the docstring of this parameter

)
return report_dict.get("report_df"), report_dict.get("positions")
return portfolio_metric_dict, indicator_dict
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return the daily result directly

@you-n-g you-n-g merged commit c276de4 into microsoft:main Dec 7, 2021
qianyun210603 pushed a commit to qianyun210603/qlib that referenced this pull request Mar 23, 2023
* modify FileStorage to support multiple freqs

* modify backtest's sample documentation

* change the logging level of read data exception from error to debug

* fix the backtest exception when volume is 0 or np.nan

* fix test_storage.py

* add backtest_daily

* modify backtest_daily's docstring

* add __repr__/__str__ to Position

* fix the bug of nested_decision_execution example

Co-authored-by: Young <[email protected]>
Co-authored-by: you-n-g <[email protected]>
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

Successfully merging this pull request may close these issues.

2 participants