Dhruv Parikh
Published © GPL3+

Autonomous Crypto-stock alert system

Crypto-Currency is a new age bubble that's engaging crowd thus this system helps to improve trade

IntermediateFull instructions provided3 hours588
Autonomous Crypto-stock alert system

Things used in this project

Hardware components

Breadboard (generic)
Breadboard (generic)
×1
LED (generic)
LED (generic)
×1
Buzzer
Buzzer
×1
Male/Female Jumper Wires
Male/Female Jumper Wires
×1
Bolt WiFi Module
Bolt IoT Bolt WiFi Module
×1
USB Cable Assembly, USB Type A Plug to Micro USB Type B Plug
USB Cable Assembly, USB Type A Plug to Micro USB Type B Plug
×1

Software apps and online services

Bolt Cloud
Bolt IoT Bolt Cloud
digital ocean servers [Py]
SMS Messaging API
Twilio SMS Messaging API

Story

Read more

Schematics

Bolt IoT system

Code

Crypto-currency Alert system

Python
kindly create a directory in the digital ocean account in the ubuntu server, create a configuration file as taught in the previous section. Then add this code in the file
import conf
import requests,json,time
from boltiot import Bolt,Sms
mybolt=Bolt(conf.ak,conf.di)
sms1=Sms(conf.sid,conf.at,conf.tn,conf.fn)
def get_crypto_price(u):
    url="http://min-api.cryptocompare.com/data/price?fsym="+u+"&tsyms=INR"
    response=requests.request("GET",url)
    response=json.loads(response.text)
    current_price=response["INR"]
    return current_price
def crypto(z):
       print("Enter the rate of the crypto currency,you have purchase:")
       sp=int(input())
       y=get_crypto_price(z)
       ss=int(y)
       print("This is the current rate of "+z+" in INR")
       print(ss)
       p=(ss-sp)*(100/sp)
       p1=int(p)
       if(p1>=0):
           print("Your current Profit percent on the stock is ",p1)
       elif(p1<0):
           print("Your loss percent is",abs(p1))
       if 0<=p1<5:
          response=mybolt.digitalWrite("0","HIGH")
          print("the stock value is increased more than 1% higher than your rate:\n"+str(response))
       elif 5<=p1<10:
          response=mybolt.digitalWrite("1","HIGH")
          print("the stock value is increased more than 5% higher than your rate\n"+str(response))
       elif 10<=p1:
          response=sms1.send_sms("Cryptocurrency value is increased more than 10% kindly perform the needful exchange")
          print("the response from Twilio:\n"+str(response))
       elif p1==0 and sp<ss:
          response=mybolt.digitalWrite("0","HIGH")
          print("The stock value is just marginally higher than your rate\n",response)
       else:
          response=mybolt.digitalWrite("0","LOW")
          response=mybolt.digitalWrite("1","LOW")
          print("the prices of stock are not sufficient to exchange\n"+str(response))


while True:
  try:
     print("-------------------------------------------------------------------------------------------------------------------------------------------------------------")
     print("Welcome to Autonomus Cryptocurrency Exchange:")
     print("The variety of Crypto-currency Available for Autonomus Alert System are:")
     print("1.Bitcoin [BTC]\n2.Ethereum [ETH]\n3.EOS [EOS]\n4.Xrp [XRP]\n5.Litecoin [LTC]\n6.Okex [OKB]\n7.Tron [TRX]\nKindly choose your Crypto from 1-7")
     ch=int(input())
     if (ch==1):
          crypto("BTC")
     elif(ch==2):
          crypto("ETH")
     elif(ch==3):
          crypto("EOS")
     elif(ch==4):
          crypto("XRP")
     elif(ch==5):
          crypto("LTC")
     elif(ch==6):
          crypto("OKB")
     elif(ch==7):
          crypto("TRX")
     else:
         print("Kindly choose a correct option, the choosen currency is invalid")
  except exceptions as e:
     print("error:",e)

Credits

Dhruv Parikh

Dhruv Parikh

1 project • 0 followers

Comments