fix: reject a session_money_budget that is not positive (#170) - #171
Merged
Conversation
contracts/config-schema.md says session_money_budget, if set, must be > 0, but there was no validator - only stop_loss_pct had one. A config of 0 or -500 was accepted, and then every buy failed the budget check, so the run placed no orders and looked as though the market simply never gave a signal. FR-017 exists to stop exactly that kind of silent no-op. null stays valid and keeps meaning "no session cap". `--budget 0` also still clears the cap: the CLI turns it into CLEAR before the config is built, so it never reaches this validator as 0. Closes #170
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (2 files)
Reviewed by step-3.7-flash · Input: 21.6K · Output: 2.1K · Cached: 61.1K |
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.
Fixes #170.
contracts/config-schema.mdsayssession_money_budget, if set, must be > 0. There was no validator - onlystop_loss_pcthad one.A config of
0or-500was accepted, and then every buy failed the budget check, so the run placed no orders and looked as though the market simply never gave a signal. FR-017 exists to stop exactly that kind of silent no-op.nullstays valid and keeps meaning "no session cap".--budget 0also still clears the cap: the CLI turns it intoCLEARbefore the config is built, so it never reaches this validator as0-test_run_budget_zero_means_no_limitcovers that.Four tests added, matching the shape of the existing
stop_loss_pctones.