BTC-e API doesn't show open orders, instead it cancels them. Code is below:
$BTCeAPI = new BTCeAPI ($apikey, $apisecret);
try {
$getInfo = $BTCeAPI -> apiQuery ('getInfo');
} catch (BTCeAPIFailureException $exception) {
echo $exception -> getMessage() . '
';
}
if ($getInfo['success']) {
if ($getInfo['return']['open_orders']) {
$params = array ('pair' => 'btc_usd');
try {
$orders = $BTCeAPI -> apiQuery ('ActiveOrders', $params)['return'];
} catch (BTCeAPIException $exception) {
echo $exception -> getMessage() . '
';
}
foreach ($orders as $key => $value) {
echo "Open order: " . $orders[$key]['type'] . ' ' .
$orders[$key]['amount'] . ' BTC @ ' . $orders[$key]['rate'] .
' USD
';
}
}
$balanceUSD = number_format ($getInfo['return']['funds']['usd'], 2);
$balanceBTC = number_format ($getInfo['return']['funds']['btc'], 2);
$timestring = gmdate ('Y, j M H:i (e)', $getInfo['return']['server_time']);
echo 'Balance: ' . $balanceUSD . ' USD + ' . $balanceBTC . ' BTC @ ' . $timestring;
}
Anybody has an idea where is the mistake?