function price_to_currency_from_btc($tocurrency, $fromprice) { $round = 3; $mtgoxrate = cachemtGoxRate($tocurrency); $toprice = $fromprice * $mtgoxrate; $toprice = round($toprice, $round, PHP_ROUND_HALF_UP); $messageline = $fromprice . " BTC = " . $toprice . " " . $tocurrency; return $messageline; }
function btcprice_from_currency($fromcurrency, $fromprice) { $round = 3; $mtgoxrate = cachemtGoxRate($fromcurrency); $btcprice = $fromprice / $mtgoxrate; $btcprice = round($btcprice, $round, PHP_ROUND_HALF_UP); $messageline = $fromprice . " " . $fromcurrency . " = " . $btcprice . " BTC "; return $messageline; }
<?php //require_once ( dirname(__FILE__) . "/../lib/mtgoxrate.php"); require_once dirname(__FILE__) . "/../lib/cachemtgoxrate.php"; echo cachemtGoxRate(); ?>
$link = "http://p.b.gw.gd/ti/miniticker.php?date={$timestamp}"; $exchangename = " mtgox "; $exchangelink = "https://mtgox.com"; // input rss header //if ( $image == true ) //addfeedimage(imageurl, imagelink,imagetitle) //echo $format; $link = "http://bitcoin.gw.gd"; $title = "bitcoin price feed"; $description = "RSS feed providing the latest bitcoin price, from " . $exchangename . " API, provided by http://bitcoin.gw.gd"; $self = "http://p.b.gw.gd/pf/bitcoin_price_feed.php"; $rssfeed = feedheader($date, $ttl, $format, $title, $link, $description, $self); // add data / RSS items if ($format == "short") { require_once dirname(__FILE__) . "/../lib/cachemtgoxrate.php"; $ticker = cachemtGoxRate($fromcurrency = "USD", "last_local"); $title = $ticker; //$link .= "&format=short"; $description = "bitcoin price at date " . $date . " "; } if ($format == "fullticker") { require_once dirname(__FILE__) . "/../lib/cacheticker.php"; $ticker = cachegetBitcoinPrice("text", "vertical"); $title = $ticker; //$link .= "&format=fullticker"; $description = "bitcoin price at date " . $date . " "; } $rssfeed .= addfeeditem($title, $link, $description, $timestamp, $ticker); // add RSS footer $rssfeed .= feedfooter(); // echo the full RSS feed