Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
kroitor committed Nov 5, 2017
1 parent 9713a26 commit ff8f39c
Show file tree
Hide file tree
Showing 79 changed files with 630 additions and 583 deletions.
9 changes: 5 additions & 4 deletions php/_1broker.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ public function fetch_markets () {
'quote' => $quote,
'info' => $market,
'otherfield' => array (
'onemore' => array ( ),
'onemore' => array (
),
),
);
}
Expand Down Expand Up @@ -233,16 +234,16 @@ public function create_order ($symbol, $type, $side, $amount, $price = null, $pa

public function cancel_order ($id, $symbol = null, $params = array ()) {
$this->load_markets();
return $this->privatePostOrderCancel (array ('order_id' => $id));
return $this->privatePostOrderCancel (array ( 'order_id' => $id ));
}

public function sign ($path, $api = 'public', $method = 'GET', $params = array (), $headers = null, $body = null) {
if (!$this->apiKey)
throw new AuthenticationError ($this->id . ' requires apiKey for all requests');
$url = $this->urls['api'] . '/' . $this->version . '/' . $path . '.php';
$query = array_merge (array ('token' => $this->apiKey), $params);
$query = array_merge (array ( 'token' => $this->apiKey ), $params);
$url .= '?' . $this->urlencode ($query);
return array ('url' => $url, 'method' => $method, 'body' => $body, 'headers' => $headers);
return array ( 'url' => $url, 'method' => $method, 'body' => $body, 'headers' => $headers );
}

public function request ($path, $api = 'public', $method = 'GET', $params = array (), $headers = null, $body = null) {
Expand Down
67 changes: 34 additions & 33 deletions php/_1btcxe.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,43 +50,44 @@ public function describe () {
),
),
),
'markets' => array ( 'BTC/USD' => array ( 'id' => 'USD', 'symbol' => 'BTC/USD', 'base' => 'BTC', 'quote' => 'USD'),
'BTC/EUR' => array ('id' => 'EUR', 'symbol' => 'BTC/EUR', 'base' => 'BTC', 'quote' => 'EUR'),
'BTC/CNY' => array ('id' => 'CNY', 'symbol' => 'BTC/CNY', 'base' => 'BTC', 'quote' => 'CNY'),
'BTC/RUB' => array ('id' => 'RUB', 'symbol' => 'BTC/RUB', 'base' => 'BTC', 'quote' => 'RUB'),
'BTC/CHF' => array ('id' => 'CHF', 'symbol' => 'BTC/CHF', 'base' => 'BTC', 'quote' => 'CHF'),
'BTC/JPY' => array ('id' => 'JPY', 'symbol' => 'BTC/JPY', 'base' => 'BTC', 'quote' => 'JPY'),
'BTC/GBP' => array ('id' => 'GBP', 'symbol' => 'BTC/GBP', 'base' => 'BTC', 'quote' => 'GBP'),
'BTC/CAD' => array ('id' => 'CAD', 'symbol' => 'BTC/CAD', 'base' => 'BTC', 'quote' => 'CAD'),
'BTC/AUD' => array ('id' => 'AUD', 'symbol' => 'BTC/AUD', 'base' => 'BTC', 'quote' => 'AUD'),
'BTC/AED' => array ('id' => 'AED', 'symbol' => 'BTC/AED', 'base' => 'BTC', 'quote' => 'AED'),
'BTC/BGN' => array ('id' => 'BGN', 'symbol' => 'BTC/BGN', 'base' => 'BTC', 'quote' => 'BGN'),
'BTC/CZK' => array ('id' => 'CZK', 'symbol' => 'BTC/CZK', 'base' => 'BTC', 'quote' => 'CZK'),
'BTC/DKK' => array ('id' => 'DKK', 'symbol' => 'BTC/DKK', 'base' => 'BTC', 'quote' => 'DKK'),
'BTC/HKD' => array ('id' => 'HKD', 'symbol' => 'BTC/HKD', 'base' => 'BTC', 'quote' => 'HKD'),
'BTC/HRK' => array ('id' => 'HRK', 'symbol' => 'BTC/HRK', 'base' => 'BTC', 'quote' => 'HRK'),
'BTC/HUF' => array ('id' => 'HUF', 'symbol' => 'BTC/HUF', 'base' => 'BTC', 'quote' => 'HUF'),
'BTC/ILS' => array ('id' => 'ILS', 'symbol' => 'BTC/ILS', 'base' => 'BTC', 'quote' => 'ILS'),
'BTC/INR' => array ('id' => 'INR', 'symbol' => 'BTC/INR', 'base' => 'BTC', 'quote' => 'INR'),
'BTC/MUR' => array ('id' => 'MUR', 'symbol' => 'BTC/MUR', 'base' => 'BTC', 'quote' => 'MUR'),
'BTC/MXN' => array ('id' => 'MXN', 'symbol' => 'BTC/MXN', 'base' => 'BTC', 'quote' => 'MXN'),
'BTC/NOK' => array ('id' => 'NOK', 'symbol' => 'BTC/NOK', 'base' => 'BTC', 'quote' => 'NOK'),
'BTC/NZD' => array ('id' => 'NZD', 'symbol' => 'BTC/NZD', 'base' => 'BTC', 'quote' => 'NZD'),
'BTC/PLN' => array ('id' => 'PLN', 'symbol' => 'BTC/PLN', 'base' => 'BTC', 'quote' => 'PLN'),
'BTC/RON' => array ('id' => 'RON', 'symbol' => 'BTC/RON', 'base' => 'BTC', 'quote' => 'RON'),
'BTC/SEK' => array ('id' => 'SEK', 'symbol' => 'BTC/SEK', 'base' => 'BTC', 'quote' => 'SEK'),
'BTC/SGD' => array ('id' => 'SGD', 'symbol' => 'BTC/SGD', 'base' => 'BTC', 'quote' => 'SGD'),
'BTC/THB' => array ('id' => 'THB', 'symbol' => 'BTC/THB', 'base' => 'BTC', 'quote' => 'THB'),
'BTC/TRY' => array ('id' => 'TRY', 'symbol' => 'BTC/TRY', 'base' => 'BTC', 'quote' => 'TRY'),
'BTC/ZAR' => array ('id' => 'ZAR', 'symbol' => 'BTC/ZAR', 'base' => 'BTC', 'quote' => 'ZAR'),
'markets' => array (
'BTC/USD' => array ( 'id' => 'USD', 'symbol' => 'BTC/USD', 'base' => 'BTC', 'quote' => 'USD' ),
'BTC/EUR' => array ( 'id' => 'EUR', 'symbol' => 'BTC/EUR', 'base' => 'BTC', 'quote' => 'EUR' ),
'BTC/CNY' => array ( 'id' => 'CNY', 'symbol' => 'BTC/CNY', 'base' => 'BTC', 'quote' => 'CNY' ),
'BTC/RUB' => array ( 'id' => 'RUB', 'symbol' => 'BTC/RUB', 'base' => 'BTC', 'quote' => 'RUB' ),
'BTC/CHF' => array ( 'id' => 'CHF', 'symbol' => 'BTC/CHF', 'base' => 'BTC', 'quote' => 'CHF' ),
'BTC/JPY' => array ( 'id' => 'JPY', 'symbol' => 'BTC/JPY', 'base' => 'BTC', 'quote' => 'JPY' ),
'BTC/GBP' => array ( 'id' => 'GBP', 'symbol' => 'BTC/GBP', 'base' => 'BTC', 'quote' => 'GBP' ),
'BTC/CAD' => array ( 'id' => 'CAD', 'symbol' => 'BTC/CAD', 'base' => 'BTC', 'quote' => 'CAD' ),
'BTC/AUD' => array ( 'id' => 'AUD', 'symbol' => 'BTC/AUD', 'base' => 'BTC', 'quote' => 'AUD' ),
'BTC/AED' => array ( 'id' => 'AED', 'symbol' => 'BTC/AED', 'base' => 'BTC', 'quote' => 'AED' ),
'BTC/BGN' => array ( 'id' => 'BGN', 'symbol' => 'BTC/BGN', 'base' => 'BTC', 'quote' => 'BGN' ),
'BTC/CZK' => array ( 'id' => 'CZK', 'symbol' => 'BTC/CZK', 'base' => 'BTC', 'quote' => 'CZK' ),
'BTC/DKK' => array ( 'id' => 'DKK', 'symbol' => 'BTC/DKK', 'base' => 'BTC', 'quote' => 'DKK' ),
'BTC/HKD' => array ( 'id' => 'HKD', 'symbol' => 'BTC/HKD', 'base' => 'BTC', 'quote' => 'HKD' ),
'BTC/HRK' => array ( 'id' => 'HRK', 'symbol' => 'BTC/HRK', 'base' => 'BTC', 'quote' => 'HRK' ),
'BTC/HUF' => array ( 'id' => 'HUF', 'symbol' => 'BTC/HUF', 'base' => 'BTC', 'quote' => 'HUF' ),
'BTC/ILS' => array ( 'id' => 'ILS', 'symbol' => 'BTC/ILS', 'base' => 'BTC', 'quote' => 'ILS' ),
'BTC/INR' => array ( 'id' => 'INR', 'symbol' => 'BTC/INR', 'base' => 'BTC', 'quote' => 'INR' ),
'BTC/MUR' => array ( 'id' => 'MUR', 'symbol' => 'BTC/MUR', 'base' => 'BTC', 'quote' => 'MUR' ),
'BTC/MXN' => array ( 'id' => 'MXN', 'symbol' => 'BTC/MXN', 'base' => 'BTC', 'quote' => 'MXN' ),
'BTC/NOK' => array ( 'id' => 'NOK', 'symbol' => 'BTC/NOK', 'base' => 'BTC', 'quote' => 'NOK' ),
'BTC/NZD' => array ( 'id' => 'NZD', 'symbol' => 'BTC/NZD', 'base' => 'BTC', 'quote' => 'NZD' ),
'BTC/PLN' => array ( 'id' => 'PLN', 'symbol' => 'BTC/PLN', 'base' => 'BTC', 'quote' => 'PLN' ),
'BTC/RON' => array ( 'id' => 'RON', 'symbol' => 'BTC/RON', 'base' => 'BTC', 'quote' => 'RON' ),
'BTC/SEK' => array ( 'id' => 'SEK', 'symbol' => 'BTC/SEK', 'base' => 'BTC', 'quote' => 'SEK' ),
'BTC/SGD' => array ( 'id' => 'SGD', 'symbol' => 'BTC/SGD', 'base' => 'BTC', 'quote' => 'SGD' ),
'BTC/THB' => array ( 'id' => 'THB', 'symbol' => 'BTC/THB', 'base' => 'BTC', 'quote' => 'THB' ),
'BTC/TRY' => array ( 'id' => 'TRY', 'symbol' => 'BTC/TRY', 'base' => 'BTC', 'quote' => 'TRY' ),
'BTC/ZAR' => array ( 'id' => 'ZAR', 'symbol' => 'BTC/ZAR', 'base' => 'BTC', 'quote' => 'ZAR' ),
),
));
}

public function fetch_balance ($params = array ()) {
$response = $this->privatePostBalancesAndInfo ();
$balance = $response['balances-and-info'];
$result = array ('info' => $balance);
$result = array ( 'info' => $balance );
for ($c = 0; $c < count ($this->currencies); $c++) {
$currency = $this->currencies[$c];
$account = $this->account ();
Expand Down Expand Up @@ -195,7 +196,7 @@ public function create_order ($symbol, $type, $side, $amount, $price = null, $pa
}

public function cancel_order ($id, $symbol = null, $params = array ()) {
return $this->privatePostOrdersCancel (array ('id' => $id));
return $this->privatePostOrdersCancel (array ( 'id' => $id ));
}

public function withdraw ($currency, $amount, $address, $params = array ()) {
Expand Down Expand Up @@ -226,9 +227,9 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array (
$request = $this->json ($query);
$query['signature'] = $this->hmac ($this->encode ($request), $this->encode ($this->secret));
$body = $this->json ($query);
$headers = array ('Content-Type' => 'application/json');
$headers = array ( 'Content-Type' => 'application/json' );
}
return array ('url' => $url, 'method' => $method, 'body' => $body, 'headers' => $headers);
return array ( 'url' => $url, 'method' => $method, 'body' => $body, 'headers' => $headers );
}

public function request ($path, $api = 'public', $method = 'GET', $params = array (), $headers = null, $body = null) {
Expand Down
8 changes: 4 additions & 4 deletions php/acx.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public function fetch_balance ($params = array ()) {
$this->load_markets();
$response = $this->privateGetMembersMe ();
$balances = $response['accounts'];
$result = array ('info' => $balances);
$result = array ( 'info' => $balances );
for ($b = 0; $b < count ($balances); $b++) {
$balance = $balances[$b];
$currency = $balance['currency'];
Expand Down Expand Up @@ -269,7 +269,7 @@ public function create_order ($symbol, $type, $side, $amount, $price = null, $pa

public function cancel_order ($id, $symbol = null, $params = array ()) {
$this->load_markets();
return $this->privatePostOrderDelete (array ('id' => $id));
return $this->privatePostOrderDelete (array ( 'id' => $id ));
}

public function withdraw ($currency, $amount, $address, $params = array ()) {
Expand Down Expand Up @@ -311,10 +311,10 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array (
$url .= '?' . $suffix;
} else {
$body = $suffix;
$headers = array ('Content-Type' => 'application/x-www-form-urlencoded');
$headers = array ( 'Content-Type' => 'application/x-www-form-urlencoded' );
}
}
return array ('url' => $url, 'method' => $method, 'body' => $body, 'headers' => $headers);
return array ( 'url' => $url, 'method' => $method, 'body' => $body, 'headers' => $headers );
}

public function request ($path, $api = 'public', $method = 'GET', $params = array (), $headers = null, $body = null) {
Expand Down
35 changes: 18 additions & 17 deletions php/anxpro.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,20 @@ public function describe () {
),
),
),
'markets' => array ( 'BTC/USD' => array ( 'id' => 'BTCUSD', 'symbol' => 'BTC/USD', 'base' => 'BTC', 'quote' => 'USD'),
'BTC/HKD' => array ('id' => 'BTCHKD', 'symbol' => 'BTC/HKD', 'base' => 'BTC', 'quote' => 'HKD'),
'BTC/EUR' => array ('id' => 'BTCEUR', 'symbol' => 'BTC/EUR', 'base' => 'BTC', 'quote' => 'EUR'),
'BTC/CAD' => array ('id' => 'BTCCAD', 'symbol' => 'BTC/CAD', 'base' => 'BTC', 'quote' => 'CAD'),
'BTC/AUD' => array ('id' => 'BTCAUD', 'symbol' => 'BTC/AUD', 'base' => 'BTC', 'quote' => 'AUD'),
'BTC/SGD' => array ('id' => 'BTCSGD', 'symbol' => 'BTC/SGD', 'base' => 'BTC', 'quote' => 'SGD'),
'BTC/JPY' => array ('id' => 'BTCJPY', 'symbol' => 'BTC/JPY', 'base' => 'BTC', 'quote' => 'JPY'),
'BTC/GBP' => array ('id' => 'BTCGBP', 'symbol' => 'BTC/GBP', 'base' => 'BTC', 'quote' => 'GBP'),
'BTC/NZD' => array ('id' => 'BTCNZD', 'symbol' => 'BTC/NZD', 'base' => 'BTC', 'quote' => 'NZD'),
'LTC/BTC' => array ('id' => 'LTCBTC', 'symbol' => 'LTC/BTC', 'base' => 'LTC', 'quote' => 'BTC'),
'DOGE/BTC' => array ('id' => 'DOGEBTC', 'symbol' => 'DOGE/BTC', 'base' => 'DOGE', 'quote' => 'BTC'),
'STR/BTC' => array ('id' => 'STRBTC', 'symbol' => 'STR/BTC', 'base' => 'STR', 'quote' => 'BTC'),
'XRP/BTC' => array ('id' => 'XRPBTC', 'symbol' => 'XRP/BTC', 'base' => 'XRP', 'quote' => 'BTC'),
'markets' => array (
'BTC/USD' => array ( 'id' => 'BTCUSD', 'symbol' => 'BTC/USD', 'base' => 'BTC', 'quote' => 'USD' ),
'BTC/HKD' => array ( 'id' => 'BTCHKD', 'symbol' => 'BTC/HKD', 'base' => 'BTC', 'quote' => 'HKD' ),
'BTC/EUR' => array ( 'id' => 'BTCEUR', 'symbol' => 'BTC/EUR', 'base' => 'BTC', 'quote' => 'EUR' ),
'BTC/CAD' => array ( 'id' => 'BTCCAD', 'symbol' => 'BTC/CAD', 'base' => 'BTC', 'quote' => 'CAD' ),
'BTC/AUD' => array ( 'id' => 'BTCAUD', 'symbol' => 'BTC/AUD', 'base' => 'BTC', 'quote' => 'AUD' ),
'BTC/SGD' => array ( 'id' => 'BTCSGD', 'symbol' => 'BTC/SGD', 'base' => 'BTC', 'quote' => 'SGD' ),
'BTC/JPY' => array ( 'id' => 'BTCJPY', 'symbol' => 'BTC/JPY', 'base' => 'BTC', 'quote' => 'JPY' ),
'BTC/GBP' => array ( 'id' => 'BTCGBP', 'symbol' => 'BTC/GBP', 'base' => 'BTC', 'quote' => 'GBP' ),
'BTC/NZD' => array ( 'id' => 'BTCNZD', 'symbol' => 'BTC/NZD', 'base' => 'BTC', 'quote' => 'NZD' ),
'LTC/BTC' => array ( 'id' => 'LTCBTC', 'symbol' => 'LTC/BTC', 'base' => 'LTC', 'quote' => 'BTC' ),
'DOGE/BTC' => array ( 'id' => 'DOGEBTC', 'symbol' => 'DOGE/BTC', 'base' => 'DOGE', 'quote' => 'BTC' ),
'STR/BTC' => array ( 'id' => 'STRBTC', 'symbol' => 'STR/BTC', 'base' => 'STR', 'quote' => 'BTC' ),
'XRP/BTC' => array ( 'id' => 'XRPBTC', 'symbol' => 'XRP/BTC', 'base' => 'XRP', 'quote' => 'BTC' ),
),
));
}
Expand All @@ -69,7 +70,7 @@ public function fetch_balance ($params = array ()) {
$response = $this->privatePostMoneyInfo ();
$balance = $response['data'];
$currencies = array_keys ($balance['Wallets']);
$result = array ('info' => $balance);
$result = array ( 'info' => $balance );
for ($c = 0; $c < count ($currencies); $c++) {
$currency = $currencies[$c];
$account = $this->account ();
Expand Down Expand Up @@ -147,7 +148,7 @@ public function create_order ($market, $type, $side, $amount, $price = null, $pa
}

public function cancel_order ($id, $symbol = null, $params = array ()) {
return $this->privatePostCurrencyPairOrderCancel (array ('oid' => $id));
return $this->privatePostCurrencyPairOrderCancel (array ( 'oid' => $id ));
}

public function withdraw ($currency, $amount, $address, $params = array ()) {
Expand Down Expand Up @@ -176,7 +177,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array (
$url .= '?' . $this->urlencode ($query);
} else {
$nonce = $this->nonce ();
$body = $this->urlencode (array_merge (array ('nonce' => $nonce), $query));
$body = $this->urlencode (array_merge (array ( 'nonce' => $nonce ), $query));
$secret = base64_decode ($this->secret);
$auth = $request . "\0" . $body;
$signature = $this->hmac ($this->encode ($auth), $secret, 'sha512', 'base64');
Expand All @@ -186,7 +187,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array (
'Rest-Sign' => $this->decode ($signature),
);
}
return array ('url' => $url, 'method' => $method, 'body' => $body, 'headers' => $headers);
return array ( 'url' => $url, 'method' => $method, 'body' => $body, 'headers' => $headers );
}

public function request ($path, $api = 'public', $method = 'GET', $params = array (), $headers = null, $body = null) {
Expand Down
Loading

0 comments on commit ff8f39c

Please sign in to comment.