Created
November 15, 2017 06:46
-
-
Save anonymous/1eae59bcad3be75c2714718bd0027613 to your computer and use it in GitHub Desktop.
This script helps you get the best exchange rate for your coins on shapeshift.io
This file contains hidden or 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
| // This line ads a alert sound to be played when your target exchange has been met | |
| $('body').append('<audio id="audio" src="https://www.soundjay.com/button/beep-07.wav" autostart="false" ></audio>'); | |
| // This line puts the sound into a variable to be used later | |
| var sound = document.getElementById("audio"); | |
| // This is where the user enters the target exchange rate they wish to receive from those coins | |
| var targetExchangeAmount = prompt("Please enter the target exchange rate you wish to receive at a minimum", "0"); | |
| // setInterval creates a loop that will check the price every 5 seconds. | |
| setInterval(function() { | |
| // This line of code grabs the exchange rate data from the shapeshift webpage | |
| var exhangeRate = $('#signup-form > div.form-heading.clearfix > div > div > div.col-md-12.col-sm-12.rate.ng-binding > span:nth-child(3)').text(); | |
| // The next 3 lines format the exchange rate to a readable number | |
| exhangeRate = exhangeRate.split("=")[1]; | |
| exhangeRate = exhangeRate.split(" ")[1]; | |
| exchangeRate = parseFloat(exhangeRate); | |
| if(exhangeRate >= targetExchangeAmount) { | |
| // Play the alert sound | |
| sound.play(); | |
| } | |
| }, 5000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment