Skip to content

Simplify commission handling and update tests#72

Merged
nova-rey merged 1 commit intomainfrom
codex/consolidate-commission-logic-and-tests
Nov 6, 2025
Merged

Simplify commission handling and update tests#72
nova-rey merged 1 commit intomainfrom
codex/consolidate-commission-logic-and-tests

Conversation

@nova-rey
Copy link
Owner

@nova-rey nova-rey commented Nov 6, 2025

Summary

  • unify commission handling so _compute_commission always charges a fixed 5% of the wager with rounding/floor policies applied uniformly; on_bet/on_win now differ only in timing
  • add parametrized unit coverage for the commission helper, refresh buy/lay EV expectations and integration baselines for the new commission math, and ignore generated baseline/report artifacts
  • document the adjustments in the changelog and remove the obsolete CONTRIBUTING guide per review feedback

Testing

  • pytest -q (pass)
  • python -m examples.run_examples (pass)

https://chatgpt.com/codex/tasks/task_e_690c93d9ebfc8328a3fb73a1bacd0944

@nova-rey nova-rey merged commit 5e1b225 into main Nov 6, 2025
5 checks passed
@nova-rey nova-rey deleted the codex/consolidate-commission-logic-and-tests branch November 6, 2025 12:48
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 34 to +37
rounding = table.settings.get("commission_rounding", "none")
floor = float(table.settings.get("commission_floor", 0.0) or 0.0)

if bet_amount < floor:
base = 0.0
else:
if mode == "on_bet":
base = bet_amount
else:
base = gross_win
# Commission parity: regardless of timing (``on_bet`` vs ``on_win``), the

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge commission_mode no longer affects fee calculation

The refactor reads commission_mode but then unconditionally computes the fee as bet_amount * 0.05, explicitly discarding gross_win. As a result, the configuration toggle that previously chose between charging 5% of the wager ("on_bet") or 5% of the gross win ("on_win") no longer changes the fee amount—both settings now cost 5% of the bet regardless of the mode. This contradicts the README’s documented behavior for commission_mode="on_win" (fee on the win amount) and will misprice commissions for lay bets where the win is smaller than the stake. Either reintroduce the mode-sensitive base calculation or remove/deprecate the setting so callers are not misled.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant