Created
January 10, 2018 02:34
-
-
Save clintmjohnson/b584e0db777da6cc8ef59214d49c900c to your computer and use it in GitHub Desktop.
Send Crypto Currency price Alerts via Text, using Binance API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def alertonlow(): | |
""" This Program uses the Binance API to Send Text Alerts for Price Action. Right now it's set up to | |
send a Text Alert, when any Crypto Coin is Less than or Equal to 2% of the 24HR Low """ | |
from binance.client import Client | |
from twilio.rest import Client as twilioclient | |
twilioclientsid = '' # Twilio User ID | |
twilioclienttok = '' # Twilio User Token | |
bnak = '' # Binance Key | |
bnas = '' # Binance Secret | |
client = Client(bnak,bnas) | |
twillapp = twilioclient(twilioclientsid,twilioclienttok) | |
tickers = client.get_ticker() | |
buys = [] | |
try : | |
for coin in tickers: | |
if (float(coin['lowPrice'])/float(coin['lastPrice'])) >= .98: | |
buys.append(('Coin :'+coin['symbol'],'Current : '+coin['lastPrice'],'Low :'+coin['lowPrice'])) | |
else: | |
pass | |
except ZeroDivisionError: | |
print('') | |
print(buys) | |
if buys: | |
twillapp.messages.create(to='', from_='', body=str(buys)) # Enter Send to Number, and Send From number here. | |
alertonlow() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment