Skip to content

Conversation

@bravegag
Copy link

@bravegag bravegag commented Oct 5, 2025

The patch corresponds to issue #1318, auto-AI generated and it does not change the backtesting result.

@bravegag bravegag changed the title Implementation for issue #1318 CGPT5 proposed enhancements Oct 5, 2025
Copy link
Owner

@kernc kernc left a 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()
Copy link
Owner

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 ... 🤔

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
Copy link
Owner

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)
Copy link
Owner

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 ...

@bravegag
Copy link
Author

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! 😃

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.

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