Bound retry loop in Trader.one_best_trade#217
Open
Soth912 wants to merge 1 commit intoPolymarket:mainfrom
Open
Bound retry loop in Trader.one_best_trade#217Soth912 wants to merge 1 commit intoPolymarket:mainfrom
Soth912 wants to merge 1 commit intoPolymarket:mainfrom
Conversation
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.
Summary
Trader.one_best_trade()with a bounded loopWhy
During repo-audit,
Trader.one_best_trade()was found to call itself from theexceptblock. If the underlying failure persists, the method keeps recursing until Python hits the recursion limit, which hides the original operational error behind a secondaryRecursionError.Testing
/Users/soth/工作空间/githubfix/.venv/bin/python -m unittest discover -s testsNote
Medium Risk
Touches the main trading execution path by changing retry/error propagation semantics; mistakes could alter how failures are surfaced or how many times trade selection runs.
Overview
Bounds retry behavior in
Trader.one_best_trade(). The method now acceptsmax_retries, retries via a loop instead of self-recursion, and re-raises the original exception once the retry budget is exhausted.Adds a unit test (
tests/test_trade.py) that simulates repeated failure and asserts the function attemptsmax_retries + 1times and ultimately raises the original error.Written by Cursor Bugbot for commit 9b9a85a. This will update automatically on new commits. Configure here.