Crypto 2
[insert_php]
$myCoins = array(
‘BTC’ => array ( ‘balance’ => 0.00000169 ),
‘ETH’ => array ( ‘balance’ => 2 ),
‘BCH’ => array ( ‘balance’ => 1.6228 ),
‘OMG’ => array ( ‘balance’ => 433.52064613208 ),
‘XRP’ => array ( ‘balance’ => 3200 ),
‘ZRX’ => array ( ‘balance’ => 16774.558936502 ),
‘FUN’ => array ( ‘balance’ => 29162.29529845 ),
‘XLM’ => array ( ‘balance’ => 28999 ),
‘DTR’ => array ( ‘balance’ => 95744 ),
‘DNT’ => array ( ‘balance’ => 16483.59689007 ),
‘COB’ => array ( ‘balance’ => 574.71 ),
‘BNT’ => array ( ‘balance’ => 527.28344482 ),
‘ICN’ => array ( ‘balance’ => 2958.20814 ),
‘ETN’ => array ( ‘balance’ => 79200 ),
‘UTNP’ => array ( ‘balance’ => 100000 ),
‘RDN’ => array ( ‘balance’ => 3394.7 ),
‘LTC’ => array ( ‘balance’ => 0 ),
‘DRGN’ => array ( ‘balance’ => 0 ),
‘KNC’ => array ( ‘balance’ => 0 ),
‘ANT’ => array ( ‘balance’ => 0 ),
‘POWR’ => array ( ‘balance’ => 0 ),
‘REP’ => array ( ‘balance’ => 0 ),
‘GNT’ => array ( ‘balance’ => 0 ),
‘CVC’ => array ( ‘balance’ => 0 ),
);
// ok now hit the api…
$coinbasePublicAPI = ‘https://api.coinmarketcap.com/v1/ticker/?convert=$curr&limit=0’;
$coinData = file_get_contents($coinbasePublicAPI);
$coinData = json_decode($coinData, true);
echo ‘
NAME | SYMBOL | Rank | PRICE | HOLDINGS | VALUE | 1hr | 24hr | 7day |
‘ . $coinData[$xx][‘name’] .’ | ‘ . $thisCoinSymbol .’ | $’ . number_format($thisCoinPrice,2) .’ | ‘; if ($coinHeld) { $myBalance_units = $myCoins[$thisCoinSymbol][‘balance’]; echo number_format($myBalance_units,10); } echo ‘ |
$’. number_format($myBalance_USD,2) .’ | ‘ . $coinData[$xx][‘percent_change_1h’] .’% | ‘ . $coinData[$xx][‘percent_change_24h’] .’% | ‘ . $coinData[$xx][‘percent_change_7d’] .’% | |
TOTAL | $’ . number_format($portfolioValue,2) . ‘ |
‘;
[/insert_php]