Changed UnknownTicket to UnknownBet

This commit is contained in:
Chlupaty
2026-03-22 11:44:59 +01:00
parent 98ed0521df
commit fa19b30601

View File

@@ -20,7 +20,7 @@ class BetType(str, Enum):
class BetOutcome(str, Enum): class BetOutcome(str, Enum):
WIN = "win" WIN = "win"
LOSE = "lose" LOSE = "lose"
VOID = "void" # stake returned (e.g. WinLose on draw, integer goal line hit) VOID = "void" # stake returned (e.g. WinLose on draw, integer goal line hit)
UNKNOWN = "unknown" # fixture not found or unclassified bet UNKNOWN = "unknown" # fixture not found or unclassified bet
@@ -49,6 +49,7 @@ class Bet(ABC):
@dataclass @dataclass
class WinDrawLose(Bet): class WinDrawLose(Bet):
"""Výsledek zápasu 1X2""" """Výsledek zápasu 1X2"""
betType: Literal["X", "0", "1", "2"] = "0" betType: Literal["X", "0", "1", "2"] = "0"
def resolve(self, match: MatchInfo) -> BetOutcome: def resolve(self, match: MatchInfo) -> BetOutcome:
@@ -71,6 +72,7 @@ class Advance(Bet):
@dataclass @dataclass
class WinDrawLoseDouble(Bet): class WinDrawLoseDouble(Bet):
"""Výsledek zápasu - double""" """Výsledek zápasu - double"""
betType: Literal["01", "12", "02"] = "01" betType: Literal["01", "12", "02"] = "01"
def resolve(self, match: MatchInfo) -> BetOutcome: def resolve(self, match: MatchInfo) -> BetOutcome:
@@ -82,6 +84,7 @@ class WinDrawLoseDouble(Bet):
@dataclass @dataclass
class WinLose(Bet): class WinLose(Bet):
"""Výsledek zápasu bez remízy""" """Výsledek zápasu bez remízy"""
betType: Literal["1", "2"] = "1" betType: Literal["1", "2"] = "1"
def resolve(self, match: MatchInfo) -> BetOutcome: def resolve(self, match: MatchInfo) -> BetOutcome:
@@ -101,8 +104,9 @@ class BothTeamScored(Bet):
@dataclass @dataclass
class GoalAmount(Bet): class GoalAmount(Bet):
"""Počet gólů v zápasu — over/under total goals""" """Počet gólů v zápasu — over/under total goals"""
line: float = 0.0 # goal line, e.g. 2.5
over: bool = True # True = more than line, False = less than line line: float = 0.0 # goal line, e.g. 2.5
over: bool = True # True = more than line, False = less than line
def resolve(self, match: MatchInfo) -> BetOutcome: def resolve(self, match: MatchInfo) -> BetOutcome:
total = match.goals_home + match.goals_away total = match.goals_home + match.goals_away
@@ -115,8 +119,9 @@ class GoalAmount(Bet):
@dataclass @dataclass
class GoalHandicap(Bet): class GoalHandicap(Bet):
"""Goal handicap for a specific team — add handicap_amount to team's score, team wins = you win""" """Goal handicap for a specific team — add handicap_amount to team's score, team wins = you win"""
team_bet: Literal["1", "2"] = "1" # which team the handicap is applied to team_bet: Literal["1", "2"] = "1" # which team the handicap is applied to
handicap_amount: float = 0.0 # e.g. +1.5 or -0.5 handicap_amount: float = 0.0 # e.g. +1.5 or -0.5
def resolve(self, match: MatchInfo) -> BetOutcome: def resolve(self, match: MatchInfo) -> BetOutcome:
home = match.goals_home + (self.handicap_amount if self.team_bet == "1" else 0.0) home = match.goals_home + (self.handicap_amount if self.team_bet == "1" else 0.0)
@@ -128,8 +133,9 @@ class GoalHandicap(Bet):
@dataclass @dataclass
class UnknownTicket(Bet): class UnknownBet(Bet):
"""Bet type that could not be classified""" """Bet type that could not be classified"""
raw_text: str = "" raw_text: str = ""
def resolve(self, match: MatchInfo) -> BetOutcome: def resolve(self, match: MatchInfo) -> BetOutcome: