Drishti PantKriti Tripathi
Published

Cryptocurrency Price Alert System using IoT

A system that provides an alert each time the prices of crypto go up or down.

IntermediateFull instructions provided505
Cryptocurrency Price Alert System using IoT

Things used in this project

Hardware components

Bolt WiFi Module
Bolt IoT Bolt WiFi Module
×1
LED (generic)
LED (generic)
×1
Buzzer, Piezo
Buzzer, Piezo
×1
Solderless Breadboard Half Size
Solderless Breadboard Half Size
×1
Connecting Wires
×1

Software apps and online services

SMS Messaging API
Twilio SMS Messaging API
Snappy Ubuntu Core
Snappy Ubuntu Core

Story

Read more

Schematics

Circuit_diagram

Code

cryptocurrency_alert_main_source_code

Python
This is the main code which first let the user choose their favorable currency then asks them for their selling price. Then it searches the web for current bitcoin market value according to the chosen currency then it prints the current market value and selling price on screen then it checks the following conditions :
(i) if current market price bitcoin is less than of selling price
(ii) if current market price bitcoin is greater than of selling price
then it gives corresponding message alert in both cases which triggers both led and buzzer respectively.
import conf      
import time
import json 
import requests
from boltiot import Bolt,Sms

bolt=Bolt(conf.BOLT_API,conf.DEVICE_ID)
sms=Sms(conf.SSID,conf.AUTH_TOKEN,conf.TO_NUMBER,conf.FROM_NUMBER)

print("Select any one of the following currency input\nINR\nUSD\nJPY\nEUR")
currency=input("Enter the above Currency from which you have to invest in:")
sell_price=float(input("Enter Your Selling Price:"))

def price_check():
    url=("https://min-api.cryptocompare.com/data/price?fsym=BTC&tsyms={}".format(currency.upper()))
    response=requests.request("GET",url)
    response=json.loads(response.text)
    current_price=response[currency.upper()]
    return current_price

while True:
    market_price=price_check()
    print("Market price of Bitcoin is:",market_price)
    print("Selling Price is:",sell_price)
    try:
         if market_price < sell_price:      
             bolt.digitalWrite("0","HIGH")
             response1=sms.send_sms("The Bitcoins are at price ={} You can Invest now if you want".format(current_bitcoin_value))
             print("Status of Sms at Twilo:"+str(response1.status))
             
            
          elif market_price > sell_price:
              bolt.digitalWrite("1","HIGH")#BUZZER gets "ON
             response1=sms.send_sms("The Bitcoins are at price ={} You need to be cautious".format(current_bitcoin_value))
             print("Status of Sms at Twilo:"+str(response1.status))
             
    except Exception as e:
        print("An error occured\n")
        print(e)
    time.sleep(5).
    bolt.digitalWrite("0","LOW")#led gets off
    bolt.digitalWrite("1","LOW")#buzzer gets off
    time.sleep(30)

Credits

Drishti Pant
2 projects • 2 followers
Contact
Kriti Tripathi
0 projects • 1 follower
Contact

Comments

Please log in or sign up to comment.