Author

Topic: Pebble Watch Script For The Obsessed Speculator (Read 1687 times)

full member
Activity: 168
Merit: 100
December 08, 2013, 06:50:10 PM
#1
Warning, it may affect your mood Smiley

Requirements:

A pebble watch, tasker, android phone, and canvas.  You should have some basic knowledge of these.   Not hard just takes a bit of learning.

Note that the web call uses bitcoinaverage.com api vs. bitstamp api.

In tasker:

Add Net http get: to the web page of the bitcoinaverage.com api.

Add Script JavaScript: Set the path to your saved javascript file
   
Add Plugin> Pebble Notifier: Add notifier to "BitStamp"

You can change the percentages for the + and - as you see fit.




---script---
var parsebitstamp = JSON.parse(global('HTTPD'));

var err = "";
try {
       
       var bittemp = global('BitLast');
        var input= parsebitstamp['last'];
   setGlobal('BitLast', input);
   if (input >= bittemp)
        {
   var percent = 100-bittemp/input*100;
      if (percent > .25)
      {
       var lastout = "+";
           }
           else
      {
             var lastout = "=";
           }
    }

        if (input < bittemp)
   {
        var percent = 100-input/bittemp*100;
         if (percent > .25)
      {
       var lastout = "-";
           }
           else
      {
             var lastout = "=";
           }

   }


   setGlobal('LastOutA',global('LastOutB'));
        setGlobal('LastOutB',global('LastOutC'));
        setGlobal('LastOutC',global('LastOutD'));
        setGlobal('LastOutD',global('LastOutE'));
   setGlobal('LastOutE',global('LastOutF'));
   setGlobal('LastOutF',global('LastOutG'));
        setGlobal('LastOutG',lastout);
        var trend = global('LastOutA')+global('LastOutB')+global('LastOutC')+global('LastOutD')+global('LastOutE')+global('LastOutF')+global('LastOutG');
        var output = trend+input.toFixed(0);
     
}
catch(err) {
            output += err;
}

setGlobal('BitStamp', output);

-----
Jump to: