File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -32,20 +32,20 @@ def check_price():
32
32
trig_point = float (input ("Input the trigger price(dollar) above at which you want to recieve mail alert: " ))
33
33
else :
34
34
trig_point = float (input ("Input the trigger price(dollar) below at which you want to recieve mail alert: " ))
35
-
36
- def send_mail ():
35
+
36
+ def send_mail ():
37
37
server = smtplib .SMTP (mail_server , mail_port )
38
38
server .ehlo ()
39
39
server .starttls ()
40
40
server .ehlo ()
41
41
server .login (from_email , from_email_password )
42
42
subject = f"{ spot_name .upper ()} EXCHANGE RATE"
43
-
43
+
44
44
if cpolarity == 1 :
45
45
body = f"{ spot_name .upper ()} Exchange is now above ${ trig_point } : Current Exchange Rate: ${ lprice } ."
46
46
else :
47
47
body = f"{ spot_name .upper ()} Exchange is now below ${ trig_point } : Current Exchange Rate: ${ lprice } ."
48
-
48
+
49
49
msg = f'''Subject: { subject } \n
50
50
To: { "" .join (to_email )} \n
51
51
{ body } '''
@@ -65,11 +65,11 @@ def send_mail():
65
65
if json_list [i ]["symbol" ] == spot_name .upper ():
66
66
cryptoname = json_list [i ]
67
67
try :
68
- lprice = float (cryptoname ["lastPrice" ])
68
+ lprice = float (cryptoname ["lastPrice" ][ 4 : 6 ] )
69
69
print (lprice )
70
70
except ValueError :
71
71
print ("This Exchange is not available." )
72
-
72
+
73
73
if lprice >= trig_point and cpolarity == 1 :
74
74
send_mail ()
75
75
exit ()
You can’t perform that action at this time.
0 commit comments