@PYer/

Live Bitcoin USD Value

Python

No description

fork
loading
Files
  • main.py
  • today.txt
  • val.py
main.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
53
54
55
56
57
58
import val, replit, time
replit.clear()
print('Hello! Welcome To A Live Bitcoin Value Tracker. Coded by @PYer.')
time.sleep(3)
print('I am currently gathering data, and this may take a bit.')
time.sleep(3)
print('Please wait...')
start = val.get()[0]
frame = '''LIVE \u001b[1mBITCOIN\u001b[0m VALUE COUNTER (USD) \u001b[33;1m$$$\u001b[0m
=========================================
Current:  [ $ \u001b[1m{}\u001b[0m ]

Change:   [ $ \u001b[30m\u001b[1m{}\u001b[0m ]

Percent:  [ \u001b[30m\u001b[1m{}\u001b[0m % ]
========================================

24 Hour Data
=========================================
Value:    [ \u001b[1m{}\u001b[0m ]

Change:   [ $ \u001b[30m\u001b[1m{}\u001b[0m ]

Percent:  [ \u001b[30m\u001b[1m{}\u001b[0m % ]
=========================================

Credits:
=========================================
coinmarketcap.com
cointelegraph.com
=========================================

Live Bitcoin Value Tracker (USD)'''
while True:
  data = val.get()
  current = data[0]
  hour24 = data[1]
  replit.clear()
  curr = str(current)
  change = str(current-start)[:7]
  pchange = str(((current-start)/start)*100)[:6]
  h24 = str(hour24)
  change24 = str(current-hour24)[:7]
  pchange24 = str(((current-hour24)/start)*100)[:6]
  if pchange.startswith('-'):
    pchange = '\u001b[41;1m' + pchange + '\u001b[0m'
    change = '\u001b[41;1m' + change + '\u001b[0m'
  else:
    pchange = '\u001b[42;1m' + pchange + '\u001b[0m'
    change = '\u001b[42;1m' + change + '\u001b[0m'
  if pchange24.startswith('-'):
    pchange24 = '\u001b[41;1m' + pchange24 + '\u001b[0m'
    change24 = '\u001b[41;1m' + change24 + '\u001b[0m'
  else:
    pchange24 = '\u001b[42;1m' + pchange24 + '\u001b[0m'
    change24 = '\u001b[42;1m' + change24 + '\u001b[0m'
  print(frame.format(curr, change, pchange, h24, change24, pchange24))
  time.sleep(.35)