R
Published © Apache-2.0

Crypto Alert System Using Bolt IoT

A system to alert the Bitcoin pricing.

BeginnerProtip2 hours6,264
Crypto Alert System Using  Bolt IoT

Things used in this project

Hardware components

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

Software apps and online services

Bolt Cloud
Bolt IoT Bolt Cloud
Bolt IoT Bolt Python Library

Story

Read more

Code

crypto_alert.py

Python
import json
import requests
import time
from boltiot import Bolt



SELLING_PRICE  =  17082.93

API_KEY = "your_api_key"
DEVICE_ID  = "your_device_id"
bolt = Bolt(API_KEY, DEVICE_ID)


def price_check():
    url = "https://min-api.cryptocompare.com/data/price"

    querystring = {"fsym":"BTC","tsyms":"USD"}

    response = requests.request("GET", url, params=querystring)
    response = json.loads(response.text)
    current_price = response['USD']
    return current_price

while True:
    market_price = price_check()
    print "Market price is", market_price
    print "Selling price is", SELLING_PRICE
    time.sleep(4)
    if market_price > SELLING_PRICE:
        bolt.digitalWrite("0", "HIGH")
        time.sleep(60)
        bolt.digitalWrite("0", "LOW")

Credits

R

R

7 projects • 94 followers
Senior Software Developer

Comments