Skip to content

Fix buy/lay commission handling for upfront vig#67

Merged
nova-rey merged 1 commit intomainfrom
codex/update-buy/lay-bookkeeping-for-commission
Nov 3, 2025
Merged

Fix buy/lay commission handling for upfront vig#67
nova-rey merged 1 commit intomainfrom
codex/update-buy/lay-bookkeeping-for-commission

Conversation

@nova-rey
Copy link
Owner

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

Summary

  • add an explicit buy_vig_on_win table setting and expose bet placement_cost helpers
  • track wager and vig bookkeeping on Buy and Lay bets so upfront commission reduces bankroll immediately and losses include the fee
  • update Player.add_bet to respect placement costs and add focused unit tests covering the vig-on-placement scenarios

Testing

  • pytest tests/unit/test_buy_lay_commission.py
  • pytest tests/unit/test_bet.py

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

@nova-rey nova-rey merged commit a7e52a9 into main Nov 3, 2025
1 of 5 checks passed
@nova-rey nova-rey deleted the codex/update-buy/lay-bookkeeping-for-commission branch November 3, 2025 14:16
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

crapssim/crapssim/bet.py

Lines 858 to 862 in 5ee54ca

if table.settings.get("buy_vig_on_win", True):
return self.wager
commission = _compute_commission(
table, gross_win=self.wager, bet_amount=self.wager
)

P1 Badge Charge lay upfront commission on the wrong base

When vig is collected upfront (buy_vig_on_win=False), Lay.placement_cost computes the commission using self.wager, which is the amount risked, rather than the potential win self.payout_ratio * self.wager that _compute_commission expects and that is used when vig is taken on the win. As a result, a lay 4 for $40 is charged commission on $40 instead of the $20 it can win, so players are debited $2 instead of $1 and losses also overstate vig. Every lay bet with upfront vig will overcharge the bankroll by the payout ratio.

ℹ️ 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".

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