-
Notifications
You must be signed in to change notification settings - Fork 2
/
mining.py
52 lines (39 loc) · 1.28 KB
/
mining.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# You will need to coin_scraper from this repo: https://github.com/oidz1234/CoinScraper
# Install autoscraper and playsound using pip :)
# You'll also need to download a song that you want to play and change the sound variable in this script to be the file location of song
from autoscraper import AutoScraper
scraper = AutoScraper()
scraper.load('coins_scraper')
import time
import random
from playsound import playsound
sound = './usuffer.webm'
def get_coin_value(url):
return scraper.get_result_exact(url)
"""
return True if we need to stop
return False if we don't
It's complicated.
"""
def super_sophisticated_algorithm_to_determine_mining_value(new, old):
# if coin is bigger then old
# and a random number is odd
# then it's good!
if new > old:
rn = random.randint(1, 100)
if rn % 2 == 0:
return True
return False
coin = 'BTC'
old_coin = 0
while True:
url = f'https://finance.yahoo.com/quote/{coin}-USD'
coin_value = get_coin_value(url)
print(coin_value)
new_coin = float(coin_value[0].replace(',', ''))
print(f'old = {old_coin}, new = {new_coin}')
stop = super_sophisticated_algorithm_to_determine_mining_value(new_coin, old_coin)
if stop:
playsound(sound, False)
old_coin = new_coin
time.sleep(1