Skip to content

fix(strategy): use get_risk_degree() in TopkDropoutStrategy for position sizing - #2331

Open
Akshay Kumar Hudedmani (akshaykumarhudedmani) wants to merge 1 commit into
microsoft:mainfrom
akshaykumarhudedmani:fix-topk-risk-degree
Open

fix(strategy): use get_risk_degree() in TopkDropoutStrategy for position sizing#2331
Akshay Kumar Hudedmani (akshaykumarhudedmani) wants to merge 1 commit into
microsoft:mainfrom
akshaykumarhudedmani:fix-topk-risk-degree

Conversation

@akshaykumarhudedmani

Description

Fixes #2276. TopkDropoutStrategy.generate_trade_decision was sizing new buys using the raw attribute self.risk_degree instead of calling self.get_risk_degree(trade_step). This prevented subclasses from implementing market timing by overriding get_risk_degree(). This PR replaces self.risk_degree with self.get_risk_degree(trade_step).

Motivation and Context

Fixes #2276. Using the getter allows subclasses to dynamically adjust the risk degree over time, which is the documented way to implement market timing.

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):

Pipeline test passed successfully.

Types of changes

  • Fix bugs
  • Add new feature
  • Update documentation

@akshaykumarhudedmani

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

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.

TopkDropoutStrategy ignores get_risk_degree() for position sizing

1 participant