Skip to content

Commit

Permalink
1.10.732
Browse files Browse the repository at this point in the history
[ci skip]
  • Loading branch information
Travis CI committed Jan 16, 2018
1 parent dccb919 commit 7a73378
Show file tree
Hide file tree
Showing 15 changed files with 194 additions and 53 deletions.
70 changes: 51 additions & 19 deletions build/ccxt.browser.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion ccxt.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const errors = require ('./js/base/errors')
//-----------------------------------------------------------------------------
// this is updated by vss.js when building

const version = '1.10.731'
const version = '1.10.732'

Exchange.ccxtVersion = version

Expand Down
13 changes: 13 additions & 0 deletions doc/manual.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1648,6 +1648,19 @@ To cancel an existing order pass the order id to ``cancelOrder (id, symbol, para
// PHP
$exchange->cancel_order ('1234567890'); // replace with your order id here (a string)
Exceptions on order cancelling
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Usually one use ``cancelOrder()`` on open orders only. At the same time it may happen that your order gets executed
before you your cancellation request comes, so it might hit closed order.
It also might happen that cancellation request results in a ``NetworkError`` which means it might or might not
have been completed and you need to retry. In this case repeated cancellation request may hit already cancelled order.

As such, ``cancelOrder()`` may throw in the following exceptions:

- cancelling closed order -> ``OrderNotFound``
- cancelling cancelled order -> either ``OrderNotFound`` or not exception

Funding Your Account
--------------------

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ccxt",
"version": "1.10.731",
"version": "1.10.732",
"description": "A JavaScript / Python / PHP cryptocurrency trading library with support for 90+ exchanges",
"main": "./ccxt.js",
"unpkg": "build/ccxt.browser.js",
Expand Down
2 changes: 1 addition & 1 deletion php/Exchange.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

namespace ccxt;

$version = '1.10.731';
$version = '1.10.732';

abstract class Exchange {

Expand Down
56 changes: 45 additions & 11 deletions php/cex.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ public function describe () {
'api' => 'https://cex.io/api',
'www' => 'https://cex.io',
'doc' => 'https://cex.io/cex-api',
'fees' => array (
'https://cex.io/fee-schedule',
'https://cex.io/limits-commissions',
),
),
'requiredCredentials' => array (
'apiKey' => true,
Expand Down Expand Up @@ -68,8 +72,38 @@ public function describe () {
),
'fees' => array (
'trading' => array (
'maker' => 0,
'taker' => 0.2 / 100,
'maker' => 0.16 / 100,
'taker' => 0.25 / 100,
),
'funding' => array (
'withdraw' => array (
// 'USD' => null,
// 'EUR' => null,
// 'RUB' => null,
// 'GBP' => null,
'BTC' => 0.001,
'ETH' => 0.01,
'BCH' => 0.001,
'DASH' => 0.01,
'BTG' => 0.001,
'ZEC' => 0.001,
'XRP' => 0.02,
'XLM' => null,
),
'deposit' => array (
// 'USD' => amount => amount * 0.035 . 0.25,
// 'EUR' => amount => amount * 0.035 . 0.24,
// 'RUB' => amount => amount * 0.05 . 15.57,
// 'GBP' => amount => amount * 0.035 . 0.2,
'BTC' => 0.0,
'ETH' => 0.0,
'BCH' => 0.0,
'DASH' => 0.0,
'BTG' => 0.0,
'ZEC' => 0.0,
'XRP' => 0.0,
'XLM' => 0.0,
),
),
),
));
Expand Down Expand Up @@ -267,11 +301,11 @@ public function create_order ($symbol, $type, $side, $amount, $price = null, $pa
'type' => $side,
'amount' => $amount,
);
if ($type == 'limit') {
if ($type === 'limit') {
$order['price'] = $price;
} else {
// for market buy CEX.io requires the $amount of quote currency to spend
if ($side == 'buy') {
if ($side === 'buy') {
if (!$price) {
throw new InvalidOrder ('For market buy orders ' . $this->id . " requires the $amount of quote currency to spend, to calculate proper costs call createOrder ($symbol, 'market', 'buy', $amount, $price)");
}
Expand Down Expand Up @@ -300,13 +334,13 @@ public function parse_order ($order, $market = null) {
$market = $this->market ($symbol);
}
$status = $order['status'];
if ($status == 'a') {
if ($status === 'a') {
$status = 'open'; // the unified $status
} else if ($status == 'cd') {
} else if ($status === 'cd') {
$status = 'canceled';
} else if ($status == 'c') {
} else if ($status === 'c') {
$status = 'canceled';
} else if ($status == 'd') {
} else if ($status === 'd') {
$status = 'closed';
}
$price = $this->safe_float($order, 'price');
Expand Down Expand Up @@ -394,7 +428,7 @@ public function nonce () {
public function sign ($path, $api = 'public', $method = 'GET', $params = array (), $headers = null, $body = null) {
$url = $this->urls['api'] . '/' . $this->implode_params($path, $params);
$query = $this->omit ($params, $this->extract_params($path));
if ($api == 'public') {
if ($api === 'public') {
if ($query)
$url .= '?' . $this->urlencode ($query);
} else {
Expand All @@ -418,11 +452,11 @@ public function request ($path, $api = 'public', $method = 'GET', $params = arra
$response = $this->fetch2 ($path, $api, $method, $params, $headers, $body);
if (!$response) {
throw new ExchangeError ($this->id . ' returned ' . $this->json ($response));
} else if ($response == true) {
} else if ($response === true) {
return $response;
} else if (is_array ($response) && array_key_exists ('e', $response)) {
if (is_array ($response) && array_key_exists ('ok', $response))
if ($response['ok'] == 'ok')
if ($response['ok'] === 'ok')
return $response;
throw new ExchangeError ($this->id . ' ' . $this->json ($response));
} else if (is_array ($response) && array_key_exists ('error', $response)) {
Expand Down
6 changes: 2 additions & 4 deletions php/zb.php
Original file line number Diff line number Diff line change
Expand Up @@ -310,11 +310,9 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array (
$url .= '?' . $this->urlencode ($params);
} else {
$this->check_required_credentials();
$paramsLength = is_array ($params) ? count ($params) : 0; // $params should be a string here
$nonce = $this->nonce ();
$auth = 'method=' . $path;
$auth .= '&accesskey=' . $this->apiKey;
$auth .= $paramsLength ? $params : '';
$auth = 'accesskey=' . $this->apiKey;
$auth .= '&$method=' . $path;
$secret = $this->hash ($this->encode ($this->secret), 'sha1');
$signature = $this->hmac ($this->encode ($auth), $this->encode ($secret), 'md5');
$suffix = 'sign=' . $signature . '&reqTime=' . (string) $nonce;
Expand Down
2 changes: 1 addition & 1 deletion python/ccxt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

# ----------------------------------------------------------------------------

__version__ = '1.10.731'
__version__ = '1.10.732'

# ----------------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion python/ccxt/async/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# -----------------------------------------------------------------------------

__version__ = '1.10.731'
__version__ = '1.10.732'

# -----------------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion python/ccxt/async/base/exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# -----------------------------------------------------------------------------

__version__ = '1.10.731'
__version__ = '1.10.732'

# -----------------------------------------------------------------------------

Expand Down
38 changes: 36 additions & 2 deletions python/ccxt/async/cex.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ def describe(self):
'api': 'https://cex.io/api',
'www': 'https://cex.io',
'doc': 'https://cex.io/cex-api',
'fees': [
'https://cex.io/fee-schedule',
'https://cex.io/limits-commissions',
],
},
'requiredCredentials': {
'apiKey': True,
Expand Down Expand Up @@ -73,8 +77,38 @@ def describe(self):
},
'fees': {
'trading': {
'maker': 0,
'taker': 0.2 / 100,
'maker': 0.16 / 100,
'taker': 0.25 / 100,
},
'funding': {
'withdraw': {
# 'USD': None,
# 'EUR': None,
# 'RUB': None,
# 'GBP': None,
'BTC': 0.001,
'ETH': 0.01,
'BCH': 0.001,
'DASH': 0.01,
'BTG': 0.001,
'ZEC': 0.001,
'XRP': 0.02,
'XLM': None,
},
'deposit': {
# 'USD': amount => amount * 0.035 + 0.25,
# 'EUR': amount => amount * 0.035 + 0.24,
# 'RUB': amount => amount * 0.05 + 15.57,
# 'GBP': amount => amount * 0.035 + 0.2,
'BTC': 0.0,
'ETH': 0.0,
'BCH': 0.0,
'DASH': 0.0,
'BTG': 0.0,
'ZEC': 0.0,
'XRP': 0.0,
'XLM': 0.0,
},
},
},
})
Expand Down
6 changes: 2 additions & 4 deletions python/ccxt/async/zb.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,11 +298,9 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N
url += '?' + self.urlencode(params)
else:
self.check_required_credentials()
paramsLength = len(params) # params should be a string here
nonce = self.nonce()
auth = 'method=' + path
auth += '&accesskey=' + self.apiKey
auth += params if paramsLength else ''
auth = 'accesskey=' + self.apiKey
auth += '&method=' + path
secret = self.hash(self.encode(self.secret), 'sha1')
signature = self.hmac(self.encode(auth), self.encode(secret), hashlib.md5)
suffix = 'sign=' + signature + '&reqTime=' + str(nonce)
Expand Down
2 changes: 1 addition & 1 deletion python/ccxt/base/exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# -----------------------------------------------------------------------------

__version__ = '1.10.731'
__version__ = '1.10.732'

# -----------------------------------------------------------------------------

Expand Down
38 changes: 36 additions & 2 deletions python/ccxt/cex.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ def describe(self):
'api': 'https://cex.io/api',
'www': 'https://cex.io',
'doc': 'https://cex.io/cex-api',
'fees': [
'https://cex.io/fee-schedule',
'https://cex.io/limits-commissions',
],
},
'requiredCredentials': {
'apiKey': True,
Expand Down Expand Up @@ -73,8 +77,38 @@ def describe(self):
},
'fees': {
'trading': {
'maker': 0,
'taker': 0.2 / 100,
'maker': 0.16 / 100,
'taker': 0.25 / 100,
},
'funding': {
'withdraw': {
# 'USD': None,
# 'EUR': None,
# 'RUB': None,
# 'GBP': None,
'BTC': 0.001,
'ETH': 0.01,
'BCH': 0.001,
'DASH': 0.01,
'BTG': 0.001,
'ZEC': 0.001,
'XRP': 0.02,
'XLM': None,
},
'deposit': {
# 'USD': amount => amount * 0.035 + 0.25,
# 'EUR': amount => amount * 0.035 + 0.24,
# 'RUB': amount => amount * 0.05 + 15.57,
# 'GBP': amount => amount * 0.035 + 0.2,
'BTC': 0.0,
'ETH': 0.0,
'BCH': 0.0,
'DASH': 0.0,
'BTG': 0.0,
'ZEC': 0.0,
'XRP': 0.0,
'XLM': 0.0,
},
},
},
})
Expand Down
6 changes: 2 additions & 4 deletions python/ccxt/zb.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,11 +298,9 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N
url += '?' + self.urlencode(params)
else:
self.check_required_credentials()
paramsLength = len(params) # params should be a string here
nonce = self.nonce()
auth = 'method=' + path
auth += '&accesskey=' + self.apiKey
auth += params if paramsLength else ''
auth = 'accesskey=' + self.apiKey
auth += '&method=' + path
secret = self.hash(self.encode(self.secret), 'sha1')
signature = self.hmac(self.encode(auth), self.encode(secret), hashlib.md5)
suffix = 'sign=' + signature + '&reqTime=' + str(nonce)
Expand Down

0 comments on commit 7a73378

Please sign in to comment.