<?php
$bin1 = curl_init();
curl_setopt($bin1, CURLOPT_URL, "https://api.binance.com/api/v3/ticker/bookTicker?symbol=RCNETH");
curl_setopt($bin1, CURLOPT_RETURNTRANSFER, 1);
$output1 = curl_exec($bin1);
$arraydata1 = json_decode($output1,true);
echo '<hr>';
print_r($arraydata1);
echo '<br><b>RCN ASSET</b> <br>';
//echo 'LAST:'.$arraydata2[''].' eth';
echo ' BUY:'.$arraydata1['bidPrice'].' eth';
echo ' SELL:'.$arraydata1['askPrice'].' eth';
//$belibin = $arraydata3['askPrice'];
$totrcn= 282;
$belircn = 0.07219200;
$jualrcn = $arraydata1['bidPrice'];
$hasilrcn = ($totrcn*$jualrcn) - $belircn;
//echo number_format($totrcn)*$jualrcn.'<br>';
//echo $hasilrcn.' '.$jualrcn.' '.$belircn;
echo '<br>Eth get: '.$totrcn*$jualrcn;
echo '<br>Net: '.number_format($hasilrcn,8).' eth';
echo '<hr>';
$bin2 = curl_init();
curl_setopt($bin2, CURLOPT_URL, "https://api.binance.com/api/v3/ticker/bookTicker?symbol=BCPTETH");
curl_setopt($bin2, CURLOPT_RETURNTRANSFER, 1);
$output2 = curl_exec($bin2);
$arraydata2 = json_decode($output2,true);
echo '<hr>';
print_r($arraydata2);
echo '<br><b>BCPT ASSET</b> <br>';
echo ' BUY:'.$arraydata2['bidPrice'].' eth';
echo ' SELL:'.$arraydata2['askPrice'].' eth';
$totbcpt= 132;
$belibcpt = 0.05959536;
$jualbcpt = $arraydata2['bidPrice'];
$hasilbcpt = ($totbcpt*$jualbcpt) - $belibcpt;
echo '<br>Eth get: '.$totbcpt*$jualbcpt;
echo '<br>Net: '.number_format($hasilbcpt,8).' eth';
echo '<hr>';
preferences:
58.54 ms | 402 KiB | 5 Q