Franco Joe M
Created August 9, 2020

Crypto Alert System using Bolt IoT(in Ubuntu Linux)

A system to alert the Bitcoin pricing

Full instructions provided50
Crypto Alert System using Bolt IoT(in Ubuntu Linux)

Things used in this project

Hardware components

Bolt WiFi Module
Bolt IoT Bolt WiFi Module
×1
USB-A to Micro-USB Cable
USB-A to Micro-USB Cable
×1
Male/Female Jumper Wires
Male/Female Jumper Wires
×2
Buzzer
Buzzer
×1

Software apps and online services

Bolt Cloud
Bolt IoT Bolt Cloud
Bolt IoT Android App
Bolt IoT Android App
Bolt IoT Python Library
Ubuntu Terminal

Story

Read more

Schematics

Circuit Connection

Code

crypto_alert.py

Python
import json # library for handling JSON data
import time # module for sleep operation
import requests # for making HTTP requests
from boltiot import Bolt # importing Bolt from boltiot module
selling_price = 600000.00 # Set your desired selling price here
api_key =  " Enter your Bolt IOT API key here"
device_id = " Enter your Bolt device ID from Bolt Cloud(starts with BOLT) "
mybolt = Bolt(api_key, device_id) # Creating an object in Bolt

def price_check(): # Function returns current price of Bitcoin
    url = "https://min-api.cryptocompare.com/data/price"
    querystring = {"fsym":"BTC","tsyms":"INR"}
    response = requests.request("GET", url, params=querystring)  # Requesting per bitcoin rate in Rupees from cryptocompare
    response = json.loads(response.text)#converts the text response to a JSON object and stores it in response variable
    current_price = response['INR']
    return current_price

while True:
    market_price = price_check() #Getting the current market price from price_check function
    print ('market price is: ',market_price)
    print ('Selling price is: ',selling_price)
    time.sleep(10)# Pauses execution of program for 10 seconds
    if market_price > selling_price:
        mybolt.digitalWrite("0","HIGH")
        time.sleep(60)# Pauses execution of program for 60 seconds
        mybolt.digitalWrite("0","LOW")

Credits

Franco Joe M
1 project • 0 followers

Comments