rdavydov / Twitch-Channel-Points-Miner-v2

A simple script that will watch a stream for you and earn the channel points.
GNU General Public License v3.0
1.12k stars 333 forks source link

SMART_MONEY not based on total of all top predictors #308

Open KrisQuack opened 1 year ago

KrisQuack commented 1 year ago

Describe the bug

When placing a SMART_MONEY bet it seems to just use the top item in the array. This means that if a prediction has multiple max bets (250k) on each side it will just pick the first option. I believe it would be much better to have it total all the top betters and use that to decide which to pick.

An example of this is here, My discord bot logs the prediction where you can clearly see the smart money is all on No besides one. In this scenario the miner chose to vote Yes. image

Steps to reproduce

  1. Launch run.py with Strategy.SMART_MONEY selected
  2. Take part in a large streams prediction
  3. Check the side, in cases where 250k is bet on each the first option seems to be picked
  4. Loose your points

Expected behavior

The miner should bet based on the total amount from the top predictors (should be an array of 10 so perhaps the top 5)

Operating system

Fedora Silverblue 38 via Dockerfile

Python version

3.11.1

Miner version

1.8.3

Other relevant software versions

No response

Logs

Unable to get a full debug one right now as need to wait for a large stream to run it against but not sure it is too relevant to this anyway as its a logic issue.

05/07/23 23:34:09 - INFO - [on_message]: πŸ“Š  EventPrediction(event_id=5325dfd3-09a5-4d50-b871-c1aa0d94c236, streamer=Streamer(username=dougdoug, channel_id=31507411, channel_points=202.22k), title=Does Doug get 3 first places in a row?) - Decision: 1: NO (PINK) - Result: WIN, Gained: +886
05/07/23 23:34:20 - INFO - [on_message]: ⏰  Place the bet after: 293.99s for: EventPrediction(event_id=5357a7d1-23c4-4ae9-8ff1-a320771fda2a, streamer=Streamer(username=dougdoug, channel_id=31507411, channel_points=202.22k), title=Does Doug get 3 first places in a row?)
05/07/23 23:35:13 - INFO - [on_message]: πŸš€  +12 β†’ Streamer(username=dougdoug, channel_id=31507411, channel_points=202.23k) - Reason: WATCH.
05/07/23 23:39:14 - INFO - [make_predictions]: πŸ€  Going to complete bet for EventPrediction(event_id=5357a7d1-23c4-4ae9-8ff1-a320771fda2a, streamer=Streamer(username=dougdoug, channel_id=31507411, channel_points=202.23k), title=Does Doug get 3 first places in a row?)
05/07/23 23:39:14 - INFO - [make_predictions]: πŸ€  Place 10.11k channel points on: YES (BLUE), Points: 2M, Users: 1k (48.41%), Odds: 4.63 (21.6%)
05/07/23 23:40:14 - INFO - [on_message]: πŸš€  +12 β†’ Streamer(username=dougdoug, channel_id=31507411, channel_points=192.13k) - Reason: WATCH.
05/07/23 23:40:14 - INFO - [claim_bonus]: 🎁  Claiming the bonus for Streamer(username=dougdoug, channel_id=31507411, channel_points=192.13k)!
05/07/23 23:40:14 - INFO - [on_message]: πŸš€  +60 β†’ Streamer(username=dougdoug, channel_id=31507411, channel_points=192.19k) - Reason: CLAIM.
05/07/23 23:45:13 - INFO - [on_message]: πŸš€  +12 β†’ Streamer(username=dougdoug, channel_id=31507411, channel_points=192.2k) - Reason: WATCH.
05/07/23 23:50:12 - INFO - [on_message]: πŸš€  +12 β†’ Streamer(username=dougdoug, channel_id=31507411, channel_points=192.21k) - Reason: WATCH.
05/07/23 23:55:12 - INFO - [on_message]: πŸš€  +12 β†’ Streamer(username=dougdoug, channel_id=31507411, channel_points=192.23k) - Reason: WATCH.
05/07/23 23:55:12 - INFO - [claim_bonus]: 🎁  Claiming the bonus for Streamer(username=dougdoug, channel_id=31507411, channel_points=192.23k)!
05/07/23 23:55:12 - INFO - [on_message]: πŸš€  +60 β†’ Streamer(username=dougdoug, channel_id=31507411, channel_points=192.29k) - Reason: CLAIM.
06/07/23 00:00:13 - INFO - [on_message]: πŸš€  +12 β†’ Streamer(username=dougdoug, channel_id=31507411, channel_points=192.3k) - Reason: WATCH.
06/07/23 00:04:04 - INFO - [on_message]: πŸ“Š  EventPrediction(event_id=5357a7d1-23c4-4ae9-8ff1-a320771fda2a, streamer=Streamer(username=dougdoug, channel_id=31507411, channel_points=192.3k), title=Does Doug get 3 first places in a row?) - Decision: 0: YES (BLUE) - Result: LOSE, Lost: -10.11k
06/07/23 00:04:21 - INFO - [on_message]: ⏰  Place the bet after: 293.98s for: EventPrediction(event_id=0a2037ac-eb1b-42c0-bd34-4f30a2f207f5, streamer=Streamer(username=dougdoug, channel_id=31507411, channel_points=192.3k), title=Does Doug get 3 first places in a row?)
06/07/23 00:05:13 - INFO - [on_message]: πŸš€  +12 β†’ Streamer(username=dougdoug, channel_id=31507411, channel_points=192.31k) - Reason: WATCH.
06/07/23 00:09:15 - INFO - [make_predictions]: πŸ€  Going to complete bet for EventPrediction(event_id=0a2037ac-eb1b-42c0-bd34-4f30a2f207f5, streamer=Streamer(username=dougdoug, channel_id=31507411, channel_points=192.31k), title=Does Doug get 3 first places in a row?)
06/07/23 00:09:15 - INFO - [make_predictions]: πŸ€  Place 9.62k channel points on: YES (BLUE), Points: 1M, Users: 751 (43.31%), Odds: 5.85 (17.09%)
06/07/23 00:10:12 - INFO - [on_message]: πŸš€  +12 β†’ Streamer(username=dougdoug, channel_id=31507411, channel_points=182.71k) - Reason: WATCH.
06/07/23 00:10:12 - INFO - [claim_bonus]: 🎁  Claiming the bonus for Streamer(username=dougdoug, channel_id=31507411, channel_points=182.71k)!
06/07/23 00:10:12 - INFO - [on_message]: πŸš€  +60 β†’ Streamer(username=dougdoug, channel_id=31507411, channel_points=182.77k) - Reason: CLAIM.
06/07/23 00:15:13 - INFO - [on_message]: πŸš€  +12 β†’ Streamer(username=dougdoug, channel_id=31507411, channel_points=182.78k) - Reason: WATCH.
06/07/23 00:20:13 - INFO - [on_message]: πŸš€  +12 β†’ Streamer(username=dougdoug, channel_id=31507411, channel_points=182.79k) - Reason: WATCH.
06/07/23 00:23:52 - INFO - [on_message]: πŸ“Š  EventPrediction(event_id=0a2037ac-eb1b-42c0-bd34-4f30a2f207f5, streamer=Streamer(username=dougdoug, channel_id=31507411, channel_points=182.79k), title=Does Doug get 3 first places in a row?) - Decision: 0: YES (BLUE) - Result: LOSE, Lost: -9.62k

Additional context

Thanks for reading, Was unsure if this was a bug or a feature request as it seems to not work as intended but also seems to be worded to run on just the top 1 person so hope I did this right! I am not great with Python so I chose not to do a PR but I think changing this would be a start.

https://github.com/rdavydov/Twitch-Channel-Points-Miner-v2/blob/586422a640a7a6c0f72add74da56aeb254780131/TwitchChannelPointsMiner/classes/entities/Bet.py#L154-L156

# Get the first 5 elements (most placed)
top_five = outcomes[index]["top_predictors"][:5]
# Sum the points of the first 5 elements
top_points = sum(x["points"] for x in top_five)
self.outcomes[index][OutcomeKeys.TOP_POINTS] = top_points