Book Image

Hands-On Bitcoin Programming with Python

By : BignumWorks Software LLP
Book Image

Hands-On Bitcoin Programming with Python

By: BignumWorks Software LLP

Overview of this book

Bitcoin is a cryptocurrency that’s changing the face of online payments. Hands-On Bitcoin Programming with Python teaches you to build software applications for mining and creating Bitcoins using Python. This book starts with the basics of both Bitcoin and blockchain and gives you an overview of these inherent concepts by showing you how to build Bitcoin-driven applications with Python. Packed with clear instructions and practical examples, you will learn to understand simple Python coding examples that work with this cryptocurrency. By the end of the book, you’ll be able to mine Bitcoins, accept Bitcoin payments on the app, and work with the basics of blockchain technology to create simply distributed ledgers.
Table of Contents (6 chapters)

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 = "[email protected]"
email_password = "bitcoin1"
smtp_server = 'smtp.gmail.com'
smtp_port = 587
email_from = "[email protected]"
email_to = "bitcoin.harish@gmail...