Bitcoin Forum
November 02, 2024, 04:07:14 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   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 649 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!