ridhi
Published

Cryptocurrency tracker

Get started with the most efficient and stress free invesments.

BeginnerFull instructions provided484
Cryptocurrency tracker

Things used in this project

Hardware components

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

Software apps and online services

Ubuntu Core
Ubuntu Core
SMS Messaging API
Twilio SMS Messaging API

Story

Read more

Schematics

hardware setup

screenshot

screenshot

Code

Code

Python
import requests                 		# for making HTTP requests
import json                     			# library for handling JSON data
import time                    			# module for sleep operation
from boltiot import Sms
from boltiot import Bolt       	 	# importing Bolt from boltiot module
import conf_bit                     		# config file

mybolt = Bolt(conf_bit.bolt_api_key, conf_bit.device_id)
sms = Sms(conf_bit.SID, conf_bit.AUTH_TOKEN, conf_bit.TO_NUMBER, conf_bit.FROM_NUMBER)

def get_bitcoin_price():
   URL = "https://min-api.cryptocompare.com/data/price?fsym=BTC&tsyms=USD,JPY,EUR,INR" # REPLACE WITH CORRECT URL
   response = requests.request("GET", URL)
   response = json.loads(response.text)
   current_price = response["INR"]
   return current_price

while True:
    bitcoin_value = get_bitcoin_price()
    print("The current bitcoin value is:", bitcoin_value)

    if bitcoin_value >= conf_bit.threshold:
        print("bitcoin value has exceeded threshold")
        mybolt.digitalWrite(0, 'HIGH')

        res = sms.send_sms("The Current bitcoin value is " +str(bitcoin_value))
        print("Response received from Twilio is: " + str(res))
        print("Status of SMS at Twilio is :" + str(res.status))

    time.sleep(10)
    mybolt.digitalWrite(0,'LOW')
    time.sleep(30)

Credits

ridhi
1 project • 1 follower

Comments