Bitcoin Forum
June 15, 2024, 05:19:31 PM *
News: Voting for pizza day contest
 
   Home   Help Search Login Register More  
Warning: One or more bitcointalk.org users have reported that they strongly believe that the creator of this topic is a scammer. (Login to see the detailed trust ratings.) While the bitcointalk.org administration does not verify such claims, you should proceed with extreme caution.
Pages: [1]
  Print  
Author Topic: BTC-e API cancels orders  (Read 634 times)
Najska (OP)
Full Member
***
Offline Offline

Activity: 152
Merit: 100


View Profile
July 04, 2014, 03:29:05 PM
 #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() . '<br/><br/>';
}
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() . '<br/><br/>';
}
foreach ($orders as $key => $value) {
echo "Open order: " . $orders[$key]['type'] . ' ' .
$orders[$key]['amount'] . ' BTC @ ' . $orders[$key]['rate'] .
' USD<br/><br/>';
}
}
$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?

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!