$all_time=json_decode(file_get_contents("https://poloniex.com/public?command=returnChartData¤cyPair=BTC_BURST&start=0&end=9999999999&period=14400"));
foreach($all_time as $day){ $vol_btc+=$day->volume; $vol_burst+=$day->quoteVolume; }
echo "BTC Volume: $vol_btc\nBURST Volume: $vol_burst\nAverage price: ".sprintf("%0.10f\n",$vol_btc/$vol_burst); ?>
output:
BTC Volume: 1465.00789347
BURST Volume: 765966241.39725
Average price: 0.0000019126
Is this good? Bad? Any comments?
Here's another one:
$volume=array(); $volume['sell']=0; $volume['buy']=0;
$total=array(); $total['sell']=0; $total['buy']=0;
$all_time=json_decode(file_get_contents("https://poloniex.com/public?command=returnTradeHistory¤cyPair=BTC_BURST&start=0&end=9999999999"));
foreach($all_time as $trade)
{
$volume[$trade->type]+=$trade->amount;
$total[$trade->type]+=$trade->total;
}
echo "SELL Volume: {$volume['sell']}\nBUY Volume: {$volume['buy']}\nsell/buy ratio: ".sprintf("%0.5f\n",$volume['sell']/$volume['buy']);
echo sprintf("SELL Average: %0.10f\nBUY Average: %0.10f\n", $total['sell']/$volume['sell'], $total['buy']/$volume['buy']);
?>
output:
SELL Volume: 473821664.21902
BUY Volume: 292144577.17823
sell/buy ratio: 1.62187
SELL Average: 0.0000018629
BUY Average: 0.0000019932
My api does all that, and includes bittrex / ccex