The Result Extraction Algorithm is the core component responsible for determining match outcomes in the MbetterClient betting system. It ensures fair play while maintaining system profitability through sophisticated redistribution controls and CAP (Controlled Redistribution) logic.
## Algorithm Flow
### Phase 1: Initialization and Data Collection
#### Step 1.1: Input Validation
-**Inputs**: `fixture_id`, `match_id`
-**Validation**: Ensure match exists and has pending bets
-**Initialization**: Set `selected_result = None`, `extraction_winning_outcome_names = []`
"""Update bet results for UNDER/OVER and selected result with win amount calculation"""
"""Update bet results for UNDER/OVER and selected result with win amount calculation"""
try:
try:
logger.info(f"DEBUG _update_bet_results: Starting for match {match_id}, selected_result='{selected_result}'")
logger.info(f"DEBUG _update_bet_results: Starting for match {match_id}, selected_result='{selected_result}', extraction_winning_outcome_names={extraction_winning_outcome_names}")
# Initialize variables to avoid UnboundLocalError
# Initialize match variable to avoid UnboundLocalError
extraction_winning_outcome_names=[]
match=None
match=None
# Get coefficient for the selected result
# Get coefficient for the selected result
...
@@ -3221,8 +3335,8 @@ class GamesThread(ThreadedComponent):
...
@@ -3221,8 +3335,8 @@ class GamesThread(ThreadedComponent):
# Check if there are any active fixtures (matches in non-terminal states)
# Check if there are any active fixtures (matches in non-terminal states)
session=self.db_manager.get_session()
session=self.db_manager.get_session()
try:
try:
# Get today's date
# Get today's date in UTC (consistent with database)