Author

Topic: BTC-e API cancels orders (Read 634 times)

full member
Activity: 152
Merit: 100
July 04, 2014, 11:29:05 AM
#1
Hi,

BTC-e API doesn't show open orders, instead it cancels them. Code is below:

Code:
$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?
Jump to: