Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 18 additions & 16 deletions bitcurex.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
<?

function cmpDESC($a, $b) {
if ($a[0] == $b[0])
return 0;
return ($a[0] < $b[0]) ? -1 : 1;
}

function cmpASC($a, $b) {
if ($a[0] == $b[0])
return 0;
return ($a[0] > $b[0]) ? -1 : 1;
}

Class Bitcurex {
class Bitcurex {

private $bitcurexUrl = 'https://api.bitcurex.com/v2/';
private $apiKey;
private $secretKey;

private static function cmpDESC($a, $b) {
if ($a[0] == $b[0]) {
return 0;
}
return ($a[0] < $b[0]) ? -1 : 1;
}

private static function cmpASC($a, $b) {
if ($a[0] == $b[0]) {
return 0;
}
return ($a[0] > $b[0]) ? -1 : 1;
}

public function __construct($apiKey = '', $secretKey = '') {
$this->apiKey = $apiKey;
Expand Down Expand Up @@ -96,8 +98,8 @@ public function getUserTransaction($market = 'pln', $fromts = 0, $nonce = null)
public function orderBook($market = 'pln', $depth = 100) {
$url = $market . '/' . $depth . '/orderbook';
$data = $this->_getData($url);
usort($data->bids, "cmpASC");
usort($data->asks, "cmpDESC");
usort($data->bids, array($this, "cmpASC"));
usort($data->asks, array($this, "cmpDESC"));
return $data;
}

Expand All @@ -116,4 +118,4 @@ protected function nonce() {
}
}

?>
?>