Skip to content

fix: reject a session_money_budget that is not positive (#170) - #171

Merged
mohammadp1001 merged 1 commit into
mainfrom
fix/170-session-budget-validator
Aug 9, 2026
Merged

fix: reject a session_money_budget that is not positive (#170)#171
mohammadp1001 merged 1 commit into
mainfrom
fix/170-session-budget-validator

Conversation

@mohammadp1001

Copy link
Copy Markdown
Owner

Fixes #170.

contracts/config-schema.md says session_money_budget, if set, must be > 0. 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 - test_run_budget_zero_means_no_limit covers that.

Four tests added, matching the shape of the existing stop_loss_pct ones.

598 passed in 168.10s (0:02:48)
Required test coverage of 100% reached. Total coverage: 100.00%
ruff check alphoryn/ tests/ -> All checks passed!

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
@kilo-code-bot

kilo-code-bot Bot commented Aug 9, 2026

Copy link
Copy Markdown

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (2 files)
  • alphoryn/config/models.py
  • tests/unit/test_config.py

Reviewed by step-3.7-flash · Input: 21.6K · Output: 2.1K · Cached: 61.1K

@mohammadp1001
mohammadp1001 merged commit 91c6e3c into main Aug 9, 2026
3 checks passed
@mohammadp1001
mohammadp1001 deleted the fix/170-session-budget-validator branch August 9, 2026 13:13
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.

fix: session_money_budget has no positive-value check (config-schema.md)

1 participant