No comments, but for any silent readers, I've advanced this concept a bit. The following is an updated script, which will publish a json array with various weighted rates. Some key figures are:
array['bbrates']['sale'] => current bitmunchies exchange rate
array['bbrates']['retail'] => proposed retail exchange rate
takes the mean of the following: 24h average, 24h high, 24h low, sell snapshot
then subtracts mtgox exchange fee for final rate
array['bbrates']['saleperc'] => percent off of retail at current sale rate
You can see current rates here
. This is updated every 15 minutes. Feel free to use/modify the concept for calculating rates for yourself. I intend to keep the linked rates.json file up to date, but you should use at your own risk. It will almost certainly change structure, as I continue development.
I believe that the current retail rate is fair. It will lag, but also takes outlying values into account. For instance, the 24 low and sell rates are currently dragging retail price down significantly. This is currently resulting in a retail exchange rate higher than mtgox. On the other hand, if we rebound from this low and sit near the high, the opposite will be true. Some catch for extreme price movement (i.e. capping at standard deviations) might even things out, but I haven't run the numbers yet.
Again, I'd appreciate any thoughts you may have on the fairness of this system. If you were buying something from bitmunchies, how would you feel about paying the proposed retail rate?
$peg = 32;
$sale = $peg;
if($sale < $month) $sale=$month;
if($sale < $week) $sale=$week;
if($sale < $day) $sale=$day;
if($sale < $high) $sale=$high;
$retail = ($day + $ticker['high'] + $ticker['low'] + $ticker['sell'])/4*(1-0.0065);
$lowfee = ($day + $ticker['sell'])/2*(1-0.0065-0.0015);
$normfee = ($day + $ticker['sell'])/2*(1-0.0065-0.0035);
$saleperc = round(($sale-$retail)/$sale, 2);
$bbrates = array("peg" => $peg, "retail" => $retail, "lowfee" => $lowfee, "normfee" => $normfee, "sale" => $sale, "saleperc" => $saleperc);
$jsona = array("ticker" => $ticker, "averages" => $averages, "bbrates" => $bbrates);