Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1"""LICENSE 

2Copyright 2020 Hermann Krumrey <hermann@krumreyh.com> 

3 

4This file is part of betbot. 

5 

6betbot is free software: you can redistribute it and/or modify 

7it under the terms of the GNU General Public License as published by 

8the Free Software Foundation, either version 3 of the License, or 

9(at your option) any later version. 

10 

11betbot is distributed in the hope that it will be useful, 

12but WITHOUT ANY WARRANTY; without even the implied warranty of 

13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 

14GNU General Public License for more details. 

15 

16You should have received a copy of the GNU General Public License 

17along with betbot. If not, see <http://www.gnu.org/licenses/>. 

18LICENSE""" 

19 

20from typing import Dict, Union 

21from betbot.api.Match import Match 

22 

23 

24class Bet: 

25 """ 

26 Class that encapsulates Bet information 

27 """ 

28 

29 def __init__(self, match: Match, home_score: int, away_score: int): 

30 """ 

31 Initializes the Bet 

32 :param match: The associated match 

33 :param home_score: The score bet on the home team 

34 :param away_score: The score bet on the away team 

35 """ 

36 self.match = match 

37 self.home_score = home_score 

38 self.away_score = away_score 

39 

40 def to_dict(self) -> Dict[str, Union[int, str]]: 

41 """ 

42 :return: A dictionary that can be used to place the bet using the API 

43 """ 

44 return { 

45 "league": self.match.league, 

46 "season": self.match.season, 

47 "matchday": self.match.matchday, 

48 "home_team": self.match.home_team, 

49 "away_team": self.match.away_team, 

50 "home_score": self.home_score, 

51 "away_score": self.away_score 

52 }