Created
May 5, 2016 19:40
-
-
Save Retord/971d09e2d4f17d1a8dd2696280fde325 to your computer and use it in GitHub Desktop.
Simple DCR to USD
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
<?php | |
$dcrurl = "https://bittrex.com/api/v1.1/public/getmarketsummary?market=btc-dcr"; | |
$usdurl = "https://bitpay.com/api/rates"; | |
$dcrjson = file_get_contents($dcrurl); | |
$dcrdata = json_decode($dcrjson, TRUE); | |
$usdjson = file_get_contents($usdurl); | |
$usddata = json_decode($usdjson, TRUE); | |
$DCRrate = $dcrdata['result'][0]['Last']; | |
$USDrate = $usddata[1]["rate"]; | |
$DCRtoUSD = round( $DCRrate * $USDrate , 8 ); | |
?> | |
1 BTC is: | |
<ul> | |
<li>USD: <?=$USDrate ?> $ </li> | |
<li>Decred: <?=$DCRrate ?> DCR </li> | |
<li>1 DCR = <?=$DCRtoUSD ?> $ </li> | |
</ul> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment