diff --git a/README.md b/README.md index ebe96fb..0870581 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ I've also take some piece of code - and idea to use Selenium fo do bet from: htt Read more here: https://help.twitch.tv/s/article/channel-points-guide?language=en_US -![Screenshot](./screenshot.png) +![Screenshot](./assets/main_screen.png) ## Main difference from the original repository: @@ -76,8 +76,19 @@ twitch_miner.mine(["streamer1", "streamer2"], followers=True) # Mixed - **MOST_VOTED**: Select the option most voted based on users count - **HIGH_ODDS**: Select the option with the highest odds +- **PERCENTAGE**: Select the option with the highest percentage based on odds (It's the same that show Twitch) - Should be the same of select LOWEST_ODDS - **SMART**: If the majority in percent chose an option then follow the other users, otherwise choose the option with the highest odds +![Screenshot](./assets/prediction_screen.png) + +Here a concrete example: + +- **MOST_VOTED**: 21 Users have select **'over 7.5'**, instead of 9 'under 7.5' +- **HIGH_ODDS**: The highest odds are 2.27 on **'over 7.5'** vs 1.79 on 'under 7.5' +- **PERCENTAGE**: The highest percentage is 56% for **'under 7.5'** +- **SMART**: Calculate the percentage based on the users. The percentage are: 'over 7.5': 70% and 'under 7.5': 30%. If the difference between the two percatage are lower thant `percentage_gap` select the highest percentage, else the highest odds. +In this case if percentage_gap = 20 ; 70-30 = 40 > percentage_gap, so the bot will select 'over 7.5' + ## Migrating from old repository (the original one): If you already have a `twitch-cookies.pkl` and you don't want to login again please create a `cookies/` folder in the current directory and then copy the .pkl file with a new name `your-twitch-username.pkl` ``` diff --git a/TwitchChannelPointsMiner/classes/Bet.py b/TwitchChannelPointsMiner/classes/Bet.py index 7446d4f..6474281 100644 --- a/TwitchChannelPointsMiner/classes/Bet.py +++ b/TwitchChannelPointsMiner/classes/Bet.py @@ -9,6 +9,7 @@ logger = logging.getLogger(__name__) class Strategy(Enum): MOST_VOTED = auto() HIGH_ODDS = auto() + PERCENTAGE = auto() SMART = auto() @@ -74,6 +75,13 @@ class Bet: self.total_points / self.outcomes[1]["total_points"] ) + self.outcomes[0]["odds_percetange"] = float_round( + 100 / self.outcomes[0]["odds"] + ) + self.outcomes[1]["odds_percetange"] = float_round( + 100 / self.outcomes[1]["odds"] + ) + self.__clear_outcomes() def __repr__(self): @@ -103,16 +111,13 @@ class Bet: self.decision["choice"] = self.__return_choice("total_users") elif self.settings.strategy == Strategy.HIGH_ODDS: self.decision["choice"] = self.__return_choice("odds") + elif self.settings.strategy == Strategy.PERCENTAGE: + self.decision["choice"] = self.__return_choice("odds_percetange") elif self.settings.strategy == Strategy.SMART: + difference = abs(self.outcomes[0]["percentage_users"] - self.outcomes[1]["percentage_users"]) self.decision["choice"] = ( self.__return_choice("odds") - if ( - abs( - self.outcomes[0]["percentage_users"] - - self.outcomes[1]["percentage_users"] - ) - < self.settings.percentage_gap - ) + if difference < self.settings.percentage_gap else self.__return_choice("total_users") ) diff --git a/TwitchChannelPointsMiner/classes/TwitchBrowser.py b/TwitchChannelPointsMiner/classes/TwitchBrowser.py index 47529eb..8cf1cb4 100644 --- a/TwitchChannelPointsMiner/classes/TwitchBrowser.py +++ b/TwitchChannelPointsMiner/classes/TwitchBrowser.py @@ -253,7 +253,7 @@ class TwitchBrowser: draw = ImageDraw.Draw(image) font = ImageFont.truetype( - os.path.join(Path().absolute(), "Roboto-Bold.ttf"), size=35 + os.path.join(Path().absolute(), "assets", "Roboto-Bold.ttf"), size=35 ) (x, y) = (15, image.height // 3) datetime_text = datetime.now().strftime("%d/%m %H:%M:%S.%f") diff --git a/Roboto-Bold.ttf b/assets/Roboto-Bold.ttf similarity index 100% rename from Roboto-Bold.ttf rename to assets/Roboto-Bold.ttf diff --git a/screenshot.png b/assets/main_screen.png similarity index 100% rename from screenshot.png rename to assets/main_screen.png diff --git a/assets/prediction_screen.png b/assets/prediction_screen.png new file mode 100644 index 0000000..f4745d4 Binary files /dev/null and b/assets/prediction_screen.png differ