Refactored optimization & backtest modules#25
Open
rrawatt wants to merge 5 commits intoGeomScale:mainfrom
Open
Refactored optimization & backtest modules#25rrawatt wants to merge 5 commits intoGeomScale:mainfrom
rrawatt wants to merge 5 commits intoGeomScale:mainfrom
Conversation
Refactor Optimization & Backtest modules - Update header formatting and licensing comments. - Use setdefault in OptimizationParameter and simplify Objective. - Revise Optimization base class: complete solve() implementation and clarify turnover constraints. - Fix MeanVariance bug by properly instantiating MeanEstimator. - Simplify PercentilePortfolios for clear portfolio segmentation and weight assignment. - Update BacktestService and custom append function to use new "portfolio_ids" key.
Author
|
Fixed mutable default args in Portfolio.init Using datetime conversion for comparisons Refactored cost subtraction in simulate Minor improvements and error handling |
Empty Filter Handling: The df() method now checks if no filter names are provided and returns an empty DataFrame instead of attempting to concatenate an empty dictionary. Safe MultiIndex Handling: In df_binary(), a check was added to ensure the columns are a MultiIndex with more than one level before calling .droplevel(1). Type and Value Checks: The setter for selected enforces that the input is a pd.Index, and the add_filtered() method validates that filters (Series or DataFrame) are properly formatted with a binary column containing only 0s and 1s. Consistent Filter Processing: The code consistently processes filters by using their keys, ensuring only filters with 'binary' in their column names are considered during binary selection.
Expanded docstrings provide clarity on the purpose and usage of each function. Type hints were added Enhanced overall readability
docstrings have been added. Fixed add_l1 Method to correctly accept values like 0. modified to_GhAb Method to handle handles edge cases.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refactored Optimization & Backtest modules