Jump to content

Quick custom XRP value & profit/loss HTML page


Midwesterner

Recommended Posts

Hi all,

Sometimes I just want a quick reference to my XRP portfolio value & profit/loss value thereon without logging into a wallet or exchange!  So I threw together a quick page using HTML/Javascript and wanted to share it here in case anyone else wants to use it.  This is for XRP/USD.  

Code and instructions are below.

I am using the XRP/USD value reflected at https://xrpcharts.ripple.com/#/markets/XRP/USD:rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B? and using the Ripple API for Bitstamp from https://data.ripple.com/v2/exchanges/XRP/USD+rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B?

Anyhow, free to use if useful...

========================================================================

 

INSTRUCTIONS:

1.  Copy the entire code below into Notepad or another text editor. 

2.  In the copied code , change NNN.NNN (located in two places) with the amount of XRP you hold.  For example, you would change NNN.NNN to 719.251 if you own 719.251 tokens.
3.  In copied code, change XXX.XX to the amount you paid for your total amount of tokens.  For example, you would change XXX.XX to 800.50 if you paid a total of $800.50 for the 719.251 tokens.
4.  Save code from Notepad as an HTML file.
5.  Open saved HTML page.
6.  Page does not auto-refresh so you need to refresh page yourself as needed or just reopen page.  

 

CODE:

 

<html>
    
<head>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js">
</script>


<script>

$(document).ready(function() {

    $.getJSON('https://data.ripple.com/v2/exchanges/XRP/USD+rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B?limit=1&descending=true', function(data) {

document.write("<br>"+"CURRENT XRP/USD RATE (per Bitstamp as reported at Ripple.com) = "+(data.exchanges[0]['rate'])+"<br><br>"+"MY PORTFOLIO VALUE = $"+(data.exchanges[0]['rate']*(NNN.NNN)).toFixed(2)+"<br><br>"+"MY PROFIT/LOSS = $"+((data.exchanges[0]['rate']*(NNN.NNN)-XXX.XX)).toFixed(2));

});
});

</script>


</head>

<body>
</body>

</html>

Edited by Midwesterner
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...