Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Hands-On Bitcoin Programming with Python

You're reading from   Hands-On Bitcoin Programming with Python Build powerful online payment centric applications with Python

Arrow left icon
Product type Paperback
Published in Aug 2018
Publisher
ISBN-13 9781789537000
Length 90 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Harish Garg Harish Garg
Author Profile Icon Harish Garg
Harish Garg
Arrow right icon
View More author details
Toc

Triggering the bitcoin trade advice alert

In order to setup the bitcoin trade advice alert, go through the following steps:

  1. 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
  1. Also import smtplib, which we will use for triggering the bitcoin price alert. Here, we define a function called trigger_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 = "bitcoin.harish@gmail.com"
email_password = "bitcoin1"
smtp_server = 'smtp.gmail.com'
smtp_port = 587
email_from = "bitcoin.harish@gmail.com"
email_to = "bitcoin.harish@gmail...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime