Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SMART_HIGH_ODDS strategy #172

Open
wants to merge 170 commits into
base: master
Choose a base branch
from
Open

Add SMART_HIGH_ODDS strategy #172

wants to merge 170 commits into from

Conversation

1v
Copy link
Contributor

@1v 1v commented May 6, 2021

Description

Adds new strategy.

Type of change

  • Breaking change (fix or feature that would cause existing functionality not to work as expected)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented on my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (README.md)
  • My changes generate no new warnings
  • Any dependent changes have been updated in requirements.txt

@Tkd-Alex
Copy link
Owner

@1v Please review your code

@1v
Copy link
Contributor Author

1v commented May 23, 2021

It probably requires refactoring. I have zero experience with python, learning on this repo.

@1v
Copy link
Contributor Author

1v commented May 24, 2021

I also made stats console output.

image
Worth adding pull request?

@Tkd-Alex
Copy link
Owner

Hi! @1v
Have you timed to finish this PR? Don't worry about the check fails, I can review later if you want :)
If you want to learn, please read https://github.com/Tkd-Alex/Twitch-Channel-Points-Miner-v2/blob/master/CONTRIBUTING.md

@Tkd-Alex Tkd-Alex added the enhancement New feature or request label Aug 16, 2021
@1v
Copy link
Contributor Author

1v commented Aug 17, 2021

Hi @Tkd-Alex. What I need to do? I think what currently in PR is ok.
But honestly I think Bet class should be refactored. I'm adding target_odd strategy specific setting to common settings, that's feels not right.
I think strategies should be moved from Bet class. skip and calculate methods should be moved to main strategy class. Other strategies should inherit main strategy class. skip and calculate methods in strategy specific class should be possible to be partially adjusted or completely replaced. There should be possibility to add strategy specific settings.

@Tkd-Alex
Copy link
Owner

Yup, convert Strategy Enum to a custom class could be an idea of refactory.
The new SMART_HIGH_ODDS strategy It's the only one that need additional parameters?

@1v
Copy link
Contributor Author

1v commented Aug 18, 2021

SMART strategy also has percentage_gap.

@1v
Copy link
Contributor Author

1v commented Oct 6, 2021

@Tkd-Alex I'm currently refactoring and it looks good to me. Also adding tests.

@1v 1v force-pushed the smart_high_odds branch 2 times, most recently from 96edbb3 to 07e125e Compare October 22, 2021 05:05
@FirstThread
Copy link

Hi, is it possible to implement the TwitchLogin like in the Main repo? I cant log in with the Login in 1v:smart_high_odds. I would like to Test the SMART_HIGH_ODDS feature and give feedback :)

@1v
Copy link
Contributor Author

1v commented Jan 30, 2023

@FirstThread hi, can you login with main repo? I guess predictions is not working in main repo. I tried fork but I failed to install chrome executables. So I don't run this script anymore, but it should work if you manage to make predictions work, because tests are passing.

@FirstThread
Copy link

Hi, yes i can login with the main repo and predictions are working fine:

30/01/23 10:21:44 - INFO - [on_message]: ⏰ Place the bet after: 89.99s for: EventPrediction(event_id=77f4f9c7-0b0f-4e11-acd0-cf4ab429af67, streamer=Streamer(username=rax1337, channel_id=28213443, channel_points=13.66k), title=Das nächste Match wird?)
30/01/23 10:23:14 - INFO - [make_predictions]: 🍀 Going to complete bet for EventPrediction(event_id=77f4f9c7-0b0f-4e11-acd0-cf4ab429af67, streamer=Streamer(username=rax1337, channel_id=28213443, channel_points=13.66k), title=Das nächste Match wird?)
30/01/23 10:23:14 - INFO - [make_predictions]: 🍀 Place 1.37k channel points on: Gewonnen (BLUE), Points: 184k, Users: 26 (68.42%), Odds: 1.42 (70.42%)

The only problem is that I can't log in to your version with SMART_HIGH_ODDS. Is it possible to do the registration like in the main repo with https://www.twitch.tv/activate?

@1v
Copy link
Contributor Author

1v commented Jan 30, 2023

But is it really placing the bet?

@FirstThread
Copy link

image
It is

@1v
Copy link
Contributor Author

1v commented Jan 30, 2023

yes i can login with the main repo and predictions are working fine

How do you logged in? I tried clean install and I get:

30/01/23 13:39:34 - ERROR - [login_flow]: Unknown error: {'error': 'Please update your app to continue', 'error_code': 5023, 'error_description': 'client is not supported for this feature'}

@FirstThread
Copy link

I'll Reinstall this evening and i'll send you all the steps i did.

@FirstThread
Copy link

The things i did:

git clone https://github.com/Tkd-Alex/Twitch-Channel-Points-Miner-v2.git
cd Twitch-Channel-Points-Miner-v2/
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
vim example.py added my TwitchUsername and Password and added one Streamer and Emoji to False (The Startup did only work for me if i set Emojis to False.
python example.py

image
Login into my Twitch Account on the given domain
image

@1v
Copy link
Contributor Author

1v commented Jan 31, 2023

It says "by rdavydov" I don't have these log messages. And I'm cloning exactly like you.
Also I'm using wsl ubuntu not docker.

@FirstThread
Copy link

FirstThread commented Jan 31, 2023

This is running on a Synology machine. I think it says "by rdavydov" because the origin of the channel point miner is from rdavydov. Your error is the same as #685 which was fixed in release 1.6.0 and 1.7.0.

PS: I think i had the same issue too, if i had Emojis on True, i know they have no direct correlation, but it worked for me.

@1v
Copy link
Contributor Author

1v commented Jan 31, 2023

No, disabling emoji not helped.
#685 it doesn't say bug is fixed there. I guess it fixed in rdavydov fork. But I couldn't run this fork.

@FirstThread
Copy link

I am very sorry. I made a mistake, because the two repos refer to each other, I cloned the wrong repo. So I use the rdavydov repo all the time. sorry for the confusion. Is it possible to do the twitch login method the same as the rdavydov repo? What error do you get when you try to run the rdavydov repo?

@rdavydov
Copy link

git clone https://github.com/rdavydov/Twitch-Channel-Points-Miner-v2.git

You don't need Chrome in the latest version 1.7.0.

@FirstThread
Copy link

Thats correct. Im using the Bot on a Synology Nas, and this is a headless machine.

@rdavydov
Copy link

@1v @FirstThread May I integrate this new strategy into my fork? So more people will be able to test it properly.

I guess I can just incorporate this commit 84b3dbe

@FirstThread
Copy link

I would love that :)

@1v
Copy link
Contributor Author

1v commented Feb 1, 2023

@rdavydov No, this commit is not enough. Here diff https://github.com/rdavydov/Twitch-Channel-Points-Miner-v2/compare/master...1v:Twitch-Channel-Points-Miner-v2:smart_high_odds?expand=1 not everything is needed here.
Here files need to be copied (changes)
README.md
TwitchChannelPointsMiner/classes/entities/Bet.py (replace whole file)
TwitchChannelPointsMiner/classes/entities/Strategy.py
TwitchChannelPointsMiner/classes/entities/strategies/ (whole folder)
example.py
pytest.ini
tests/test_bet.py

Then run pytest. It should work right away, because I fixed it in your fork.
Other changes in pull request can be ignored.
Btw it will be not back compatible because of new option strategy_settings and because option percentage_gap is moved to strategy_settings.

@1v
Copy link
Contributor Author

1v commented Feb 9, 2023

@rdavydov I'm about to submit pull request with this changes. But it needs testing before merging. Do you know how to test it faster?

@arie-2
Copy link

arie-2 commented Feb 25, 2023

This doesn't seem to work if you try so setup custom settings for specific streamers, default settings work fine

twitch_miner.mine(
  [
    Streamer("xQc",
             settings=StreamerSettings(make_predictions=True,
                                       follow_raid=True,
                                       claim_drops=True,
                                       watch_streak=True,
                                       bet=BetSettings(
                                         delay_mode=DelayMode.FROM_START,
                                         delay=45,
                                         filter_condition=FilterCondition(
                                           by=OutcomeKeys.TOTAL_USERS,
                                           where=Condition.LTE,
                                           value=5000)))),
...

Error message:

25/02/23 23:06:09 - INFO - [__init__]: Twitch Channel Points Miner v2-1.7.4 (fork by rdavydov)
25/02/23 23:06:09 - INFO - [__init__]: https://github.com/rdavydov/Twitch-Channel-Points-Miner-v2
Traceback (most recent call last):
  File "run.py", line 117, in <module>
    bet=BetSettings(
  File "/home/runner/Twitch-Channel-Points-Miner-v2-smart-high-odds/TwitchChannelPointsMiner/classes/entities/Bet.py", line 86, in __init__
    self.strategy_settings = StrategySettings(
TypeError: type object argument after ** must be a mapping, not NoneType

@1v
Copy link
Contributor Author

1v commented Feb 26, 2023

This pull request is outdated. There is new one rdavydov#141.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.