-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
CGPT5 proposed enhancements #1319
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, I'm finding most people's LLMs presently are doing lousy jobs with full projects' sources. But fascinatingly, while the PR contains no items listed in #1318 (🤔), there are a few bits here we would like to keep! 😃
| try: | ||
| value = func(*args, **kwargs) | ||
| if isinstance(value, pd.Series): | ||
| value = value.to_numpy() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This case is covered a few lines further below ... 🤔
backtesting.py/backtesting/backtesting.py
Lines 153 to 154 in cc1ebc8
| if value is not None: | |
| value = try_(lambda: np.asarray(value, order='C'), None) |
| ('contingent', self.is_contingent), | ||
| ('tag', self.__tag), | ||
| ) if value is not None)) # noqa: E126 | ||
| ) if (value is not None and (not isinstance(value, bool) or value)))) # noqa: E126 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Covered by the use of try_, fixed in 8dd1e36.
| warnings.warn( | ||
| f'({data.index[self._i]}) broker canceled order {order} due to insufficient margin ' | ||
| f'(equity={self.equity:.2f}, margin_available={self.margin_available:.2f}).', | ||
| category=UserWarning) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This hunk is legit, I think. 👍 If it can be made to match the prior art in 5e72e7b ...
Indeed, CGPT went wild on it and changed the functional behavior of the backtest. I wanted to keep it simple and avoid going down a rabbit hole of changes so trimmed it to the minimum valid changes without breaking the current backtest behavior. |
The patch corresponds to issue #1318, auto-AI generated and it does not change the backtesting result.