Triggering the bitcoin trade advice alert
In order to setup the bitcoin trade advice alert, go through the following steps:
- First, start by importing the bitcoin price API, called
exchanges
:
#!/usr/bin/python # import modules # Make sure to copy the exchanges from https://github.com/dursk/bitcoin-price-api # to the same location as this script from exchanges.bitfinex import Bitfinex
- Also import
smtplib
, which we will use for triggering the bitcoin price alert. Here, we define a function calledtrigger_email
. We then set the server user and email details:
import smtplib # Function to send email def trigger_email(msg): # Change these to your email details email_user = "[email protected]" email_password = "bitcoin1" smtp_server = 'smtp.gmail.com' smtp_port = 587 email_from = "[email protected]" email_to = "[email protected]"
- Using
smtplib
, send thesendmail
function to send the price alert email, as shown in the following code:
# login to the email server server = smtplib...