Post
Topic
Board Speculation
Re: Quick math question.
by
NothinG
on 11/08/2011, 17:46:58 UTC
Well done. It would help to add at the end "Price to sell back at to break even: "   eg. 10.12
I wrote the script at 5am.

Give me a few minutes and I'll add that.

[Edit]:

http://zombietoday.com/trade_calculator.php
Code:
echo "
What's the minimum price I would have to sell back at to break even?
"
;
if(
$_GET['volume']>&& $_GET['ppb']>&& is_numeric($_GET['volume']) && is_numeric($_GET['ppb']) && $_GET['fee']>&& is_numeric($_GET['fee']))
{
$volume $_GET['volume'];
$ppb $_GET['ppb'];
$fee $_GET['fee'];
$fee_c = ($fee 1000); //yea, I know...decided to not use the full percentage
$total_buy $volume $ppb;
$min_sell $total_buy + ($total_buy $fee_c);
$minMarket_low_sell = ($min_sell $volume);

echo "[Volume]: ".$volume."";
echo "[Buy]: ".$total_buy."";
echo "[Sell]: ".$min_sell."";
echo "Minimum sell when Price Per Bitcoin is ".$minMarket_low_sell."USD to break even."
;

} else {
echo "";
echo "Buy  @ .mtGoxAvg()."'>";
echo "Fee 0.% ";
echo "";
}

function 
mtGoxAvg()
{
$opts = array(
  'http'=> array(
'method'=>   "GET",
'user_agent'=>    "MozillaXYZ/1.0"));
$context stream_context_create($opts);
$json file_get_contents('https://mtgox.com/code/data/ticker.php'false$context);
$jdec json_decode($json);
return $jdec->{'ticker'}->{'avg'};
}
?>
Enjoy!