Creating Your Own Spreadsheets and Charts Using Poloniex API – Part 9

If you have reached this page without going through the previous instructions, please Click Here to start at Part 1.

Reminder: Please remember to copy and paste your script code from the link at the bottom of this page.  If you do not you may get an ‘illegal character’ message when you try to save your script.

The final cool feature I want to show you is how to send yourself an Email when a certain level or target indicator is reached.  You may find when the Bid Order Total goes up to its high for the day, you want to know what the price is to see if it has reacted to the move.  This coding is done in the script, so let’s head back there.

First we need a value to Trigger our Email.  For this example, whenever the Max Bid Order Total is set, we will send it.  In real life, this will drive you nuts because you will receive too many Emails, but you can customize it after we code it to do what you want.

First, we want to name our new sheet ‘ChartSheet’ in the script.  Next, in the last step of Part 8 we set up a cell in our Chart sheet with the Maximum Bid Order Total from column B of our TableData sheet, and another cell with the current Bid Order Total.  Let’s grab those fields to compare in the next step.  Your cell values will probably be different than H4 & H6 depending on where you put the information on your Chart sheet.

*

var ChartSheet = ss.getSheetByName(“Chart”);
var maxBid = ChartSheet.getRange(“H4”).getDisplayValue();
var currentBid = ChartSheet.getRange(“H6”).getDisplayValue();

*

We need an ‘if’ statement here to compare the two values.  If they are equal, then we have set a new Max value and need to send an Email.  You can include any information you want in the message.  You just have to calculate it and pull it in first.  You may also want to include the URL for your chart so you can easily click to see your chart whenever the Email arrives.  The code for this looks like:

*

if (currentBid == maxBid) {
var subject = “XMR Buy Order New Maximum Value”;
var message = “Current: ” + currentBid + ” *** https://docs.google.com/spreadsheets/d/1usaMtuJ6eq0DbPaHZ7BDspgoWMcr0akEzaDZfKZHL/edit#gid=510852470″;
MailApp.sendEmail(“author@GMAIL.com”, subject, message);
}

*

The MailApp.sendEmail command is built into Google scripts.  You don’t need to add anything to your code to use it.  There are also some other things you can do with it, so I recommend looking it up to see what kind of parameters you can also utilize.

The last thing I want to show you is how to publish your new chart to the web.  Go to your chart and under File, choose Publish to the web.

part9image1

This will pull up a window where you can specify just to publish your Chart sheet (see below).  You can also make your Chart sheet available in other formats besides a web page, such as PDF.  Once you click Publish you will receive a URL where anyone can view the latest version of your Chart sheet.  Your published chart should also update every ten minutes when your script runs, but this seems to work sometimes, and not at others.

part9image2

 

I have learned a lot researching and creating this document.  Before I am done I will have spent over a month, and close to 200 hours, from the time I started looking into this until I get it published for everyone to use.  I was frustrated there was nobody who had already created a document with this information, but most people do not want to share information if they perceive it gives them an advantage over everyone else.

My final script is in the link below.  I would appreciate it if you were able to make a small donation to

Bitcoin address: 1EPyFDbRtfxMvpAhCyXBH2xwMuJ77Wwb41

or

ETH address: 0x2F4203691f48a95D96A261f3453f39fdf490c386

if you found this helpful.  Also, don’t forget, there is a cheat sheet I have available which shows how to pull every Public Poloniex API to anyone sending a donation.  Just send me a message using the Contact Form letting me know your Email address and when you sent the BTC or ETH.  I will reply with the document as soon as I see your message.

 

Here is the final version of my Script.

Please recognize a lot of effort went into figuring this process out and documenting it to save you time, with the goal of giving you information you can use to make more BTC in the future.  If this is useful information for you, I would appreciate any tips you are able to send to the following BTC address.

1EPyFDbRtfxMvpAhCyXBH2xwMuJ77Wwb41

 

Advertisements