diff --git a/php/_1broker.php b/php/_1broker.php index 80d66237f6cd9..028133ee94023 100644 --- a/php/_1broker.php +++ b/php/_1broker.php @@ -29,6 +29,10 @@ public function describe () { 'www' => 'https://1broker.com', 'doc' => 'https://1broker.com/?c=en/content/api-documentation', ), + 'requiredCredentials' => array ( + 'apiKey' => true, + 'secret' => false, + ), 'api' => array ( 'private' => array ( 'get' => array ( @@ -239,8 +243,7 @@ public function cancel_order ($id, $symbol = null, $params = array ()) { } 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'); + $this->check_required_credentials(); $url = $this->urls['api'] . '/' . $this->version . '/' . $path . '.php'; $query = array_merge (array ( 'token' => $this->apiKey ), $params); $url .= '?' . $this->urlencode ($query); diff --git a/php/_1btcxe.php b/php/_1btcxe.php index e657454187f97..02ed5894dd05a 100644 --- a/php/_1btcxe.php +++ b/php/_1btcxe.php @@ -220,6 +220,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( if ($params) $url .= '?' . $this->urlencode ($params); } else { + $this->check_required_credentials(); $query = array_merge (array ( 'api_key' => $this->apiKey, 'nonce' => $this->nonce (), diff --git a/php/acx.php b/php/acx.php index e40c2cde940f7..e92a39160ae6e 100644 --- a/php/acx.php +++ b/php/acx.php @@ -299,6 +299,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( if ($query) $url .= '?' . $this->urlencode ($query); } else { + $this->check_required_credentials(); $nonce = (string) $this->nonce (); $query = $this->urlencode ($this->keysort (array_merge (array ( 'access_key' => $this->apiKey, diff --git a/php/anxpro.php b/php/anxpro.php index 414150052b2a0..41fc8e67928fd 100644 --- a/php/anxpro.php +++ b/php/anxpro.php @@ -176,6 +176,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( if ($query) $url .= '?' . $this->urlencode ($query); } else { + $this->check_required_credentials(); $nonce = $this->nonce (); $body = $this->urlencode (array_merge (array ( 'nonce' => $nonce ), $query)); $secret = base64_decode ($this->secret); diff --git a/php/binance.php b/php/binance.php index 9c1205db19634..b184e1dc9b986 100644 --- a/php/binance.php +++ b/php/binance.php @@ -579,6 +579,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( if ($api == 'wapi') $url .= '.html'; if (($api == 'private') || ($api == 'wapi')) { + $this->check_required_credentials(); $nonce = $this->nonce (); $query = $this->urlencode (array_merge (array ( 'timestamp' => $nonce ), $params)); $signature = null; diff --git a/php/bit2c.php b/php/bit2c.php index aeb85f31b0174..ca4661666b3ff 100644 --- a/php/bit2c.php +++ b/php/bit2c.php @@ -172,6 +172,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( if ($api == 'public') { $url .= '.json'; } else { + $this->check_required_credentials(); $nonce = $this->nonce (); $query = array_merge (array ( 'nonce' => $nonce ), $params); $body = $this->urlencode ($query); diff --git a/php/bitbay.php b/php/bitbay.php index f17f92583dcf5..385219f60de49 100644 --- a/php/bitbay.php +++ b/php/bitbay.php @@ -211,6 +211,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( if ($api == 'public') { $url .= '/' . $this->implode_params($path, $params) . '.json'; } else { + $this->check_required_credentials(); $body = $this->urlencode (array_merge (array ( 'method' => $path, 'moment' => $this->nonce (), diff --git a/php/bitcoincoid.php b/php/bitcoincoid.php index 094899261d751..659273dc2df78 100644 --- a/php/bitcoincoid.php +++ b/php/bitcoincoid.php @@ -167,6 +167,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( if ($api == 'public') { $url .= '/' . $this->implode_params($path, $params); } else { + $this->check_required_credentials(); $body = $this->urlencode (array_merge (array ( 'method' => $path, 'nonce' => $this->nonce (), diff --git a/php/bitfinex.php b/php/bitfinex.php index a4ed80d822b8a..4b6d03d4091d5 100644 --- a/php/bitfinex.php +++ b/php/bitfinex.php @@ -511,6 +511,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( } } if ($api == 'private') { + $this->check_required_credentials(); $nonce = $this->nonce (); $query = array_merge (array ( 'nonce' => (string) $nonce, diff --git a/php/bitfinex2.php b/php/bitfinex2.php index 8bafa7efdbe42..361e53df37881 100644 --- a/php/bitfinex2.php +++ b/php/bitfinex2.php @@ -381,6 +381,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( $url .= '?' . $this->urlencode ($query); } } else { + $this->check_required_credentials(); $nonce = (string) $this->nonce (); $body = $this->json ($query); $auth = '/api' . '/' . $request . $nonce . $body; diff --git a/php/bitflyer.php b/php/bitflyer.php index 4353b38289e6f..9e442c5e881e6 100644 --- a/php/bitflyer.php +++ b/php/bitflyer.php @@ -244,6 +244,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( } $url = $this->urls['api'] . $request; if ($api == 'private') { + $this->check_required_credentials(); $nonce = (string) $this->nonce (); $body = $this->json ($params); $auth = implode ('', array ($nonce, $method, $request, $body)); diff --git a/php/bithumb.php b/php/bithumb.php index 67f41e7248e7a..0848b4d331a7e 100644 --- a/php/bithumb.php +++ b/php/bithumb.php @@ -232,6 +232,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( if ($query) $url .= '?' . $this->urlencode ($query); } else { + $this->check_required_credentials(); $body = $this->urlencode (array_merge (array ( 'endpoint' => $endpoint, ), $query)); diff --git a/php/bitlish.php b/php/bitlish.php index 0c3f683585fe4..2ad2ad86c0b99 100644 --- a/php/bitlish.php +++ b/php/bitlish.php @@ -23,6 +23,10 @@ public function describe () { 'www' => 'https://bitlish.com', 'doc' => 'https://bitlish.com/api', ), + 'requiredCredentials' => array ( + 'apiKey' => true, + 'secret' => false, + ), 'api' => array ( 'public' => array ( 'get' => array ( @@ -297,6 +301,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( $headers = array ( 'Content-Type' => 'application/json' ); } } else { + $this->check_required_credentials(); $body = $this->json (array_merge (array ( 'token' => $this->apiKey ), $params)); $headers = array ( 'Content-Type' => 'application/json' ); } diff --git a/php/bitmarket.php b/php/bitmarket.php index 6c9f8d8b19d80..9219475492352 100644 --- a/php/bitmarket.php +++ b/php/bitmarket.php @@ -286,6 +286,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( if ($api == 'public') { $url .= '/' . $this->implode_params($path . '.json', $params); } else { + $this->check_required_credentials(); $nonce = $this->nonce (); $query = array_merge (array ( 'tonce' => $nonce, diff --git a/php/bitmex.php b/php/bitmex.php index db07ee6320abc..17aba9e02c050 100644 --- a/php/bitmex.php +++ b/php/bitmex.php @@ -398,6 +398,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( $query .= '?' . $this->urlencode ($params); $url = $this->urls['api'] . $query; if ($api == 'private') { + $this->check_required_credentials(); $nonce = (string) $this->nonce (); if ($method == 'POST') if ($params) diff --git a/php/bitso.php b/php/bitso.php index 881ad69e55d9c..01b39bf49e592 100644 --- a/php/bitso.php +++ b/php/bitso.php @@ -233,6 +233,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( if ($params) $url .= '?' . $this->urlencode ($params); } else { + $this->check_required_credentials(); $nonce = (string) $this->nonce (); $request = implode ('', array ($nonce, $method, $query)); if ($params) { diff --git a/php/bitstamp.php b/php/bitstamp.php index 71593eaaf9ee8..72d73dfe4d246 100644 --- a/php/bitstamp.php +++ b/php/bitstamp.php @@ -21,6 +21,11 @@ public function describe () { 'www' => 'https://www.bitstamp.net', 'doc' => 'https://www.bitstamp.net/api', ), + 'requiredCredentials' => array ( + 'apiKey' => true, + 'secret' => true, + 'uid' => true, + ), 'api' => array ( 'public' => array ( 'get' => array ( @@ -253,8 +258,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( if ($query) $url .= '?' . $this->urlencode ($query); } else { - if (!$this->uid) - throw new AuthenticationError ($this->id . ' requires `' . $this->id . '.uid` property for authentication'); + $this->check_required_credentials(); $nonce = (string) $this->nonce (); $auth = $nonce . $this->uid . $this->apiKey; $signature = $this->encode ($this->hmac ($this->encode ($auth), $this->encode ($this->secret))); diff --git a/php/bitstamp1.php b/php/bitstamp1.php index 4f586b1a723fb..8935226647030 100644 --- a/php/bitstamp1.php +++ b/php/bitstamp1.php @@ -20,6 +20,11 @@ public function describe () { 'www' => 'https://www.bitstamp.net', 'doc' => 'https://www.bitstamp.net/api', ), + 'requiredCredentials' => array ( + 'apiKey' => true, + 'secret' => true, + 'uid' => true, + ), 'api' => array ( 'public' => array ( 'get' => array ( @@ -220,8 +225,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( if ($query) $url .= '?' . $this->urlencode ($query); } else { - if (!$this->uid) - throw new AuthenticationError ($this->id . ' requires `' . $this->id . '.uid` property for authentication'); + $this->check_required_credentials(); $nonce = (string) $this->nonce (); $auth = $nonce . $this->uid . $this->apiKey; $signature = $this->encode ($this->hmac ($this->encode ($auth), $this->encode ($this->secret))); diff --git a/php/bittrex.php b/php/bittrex.php index 606039497d052..b7f083f44e3a1 100644 --- a/php/bittrex.php +++ b/php/bittrex.php @@ -546,6 +546,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( if ($params) $url .= '?' . $this->urlencode ($params); } else { + $this->check_required_credentials(); $nonce = $this->nonce (); $url .= $api . '/'; if ((($api == 'account') && ($path != 'withdraw')) || ($path == 'openorders')) diff --git a/php/bl3p.php b/php/bl3p.php index 7e69bd2d1cc1b..0d46165406c01 100644 --- a/php/bl3p.php +++ b/php/bl3p.php @@ -183,6 +183,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( if ($query) $url .= '?' . $this->urlencode ($query); } else { + $this->check_required_credentials(); $nonce = $this->nonce (); $body = $this->urlencode (array_merge (array ( 'nonce' => $nonce ), $query)); $secret = base64_decode ($this->secret); diff --git a/php/btcbox.php b/php/btcbox.php index 4f6a3cb3850f5..6e110649db240 100644 --- a/php/btcbox.php +++ b/php/btcbox.php @@ -193,6 +193,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( if ($params) $url .= '?' . $this->urlencode ($params); } else { + $this->check_required_credentials(); $nonce = (string) $this->nonce (); $query = array_merge (array ( 'key' => $this->apiKey, diff --git a/php/btcchina.php b/php/btcchina.php index d0224a8ab935f..c28e2bb35a437 100644 --- a/php/btcchina.php +++ b/php/btcchina.php @@ -299,10 +299,7 @@ public function nonce () { public function sign ($path, $api = 'public', $method = 'GET', $params = array (), $headers = null, $body = null) { $url = $this->urls['api'][$api] . '/' . $path; if ($api == 'private') { - if (!$this->apiKey) - throw new AuthenticationError ($this->id . ' requires `' . $this->id . '.apiKey` property for authentication'); - if (!$this->secret) - throw new AuthenticationError ($this->id . ' requires `' . $this->id . '.secret` property for authentication'); + $this->check_required_credentials(); $p = array (); if (array_key_exists ('params', $params)) $p = $params['params']; diff --git a/php/btcmarkets.php b/php/btcmarkets.php index b000d93be79d0..1b9e8f6221172 100644 --- a/php/btcmarkets.php +++ b/php/btcmarkets.php @@ -197,6 +197,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( if ($params) $url .= '?' . $this->urlencode ($params); } else { + $this->check_required_credentials(); $nonce = (string) $this->nonce (); $auth = $uri . "\n" . $nonce . "\n"; $headers = array ( diff --git a/php/btctradeua.php b/php/btctradeua.php index 488142aed3aa6..bf162bbd5d83c 100644 --- a/php/btctradeua.php +++ b/php/btctradeua.php @@ -304,6 +304,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( if ($query) $url .= $this->implode_params($path, $query); } else { + $this->check_required_credentials(); $nonce = $this->nonce (); $body = $this->urlencode (array_merge (array ( 'out_order_id' => $nonce, diff --git a/php/btcturk.php b/php/btcturk.php index 042a9c81c2b54..d7c60514030b3 100644 --- a/php/btcturk.php +++ b/php/btcturk.php @@ -216,6 +216,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( if ($params) $url .= '?' . $this->urlencode ($params); } else { + $this->check_required_credentials(); $nonce = $this->nonce ().toString; $body = $this->urlencode ($params); $secret = $this->base64ToString ($this->secret); diff --git a/php/btcx.php b/php/btcx.php index ca762f08c5db5..48f77305fb1be 100644 --- a/php/btcx.php +++ b/php/btcx.php @@ -146,6 +146,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( if ($api == 'public') { $url .= $this->implode_params($path, $params); } else { + $this->check_required_credentials(); $nonce = $this->nonce (); $url .= $api; $body = $this->urlencode (array_merge (array ( diff --git a/php/bter.php b/php/bter.php index ee9bbe0cf0a6b..e3aaade2a7d00 100644 --- a/php/bter.php +++ b/php/bter.php @@ -265,6 +265,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( if ($query) $url .= '?' . $this->urlencode ($query); } else { + $this->check_required_credentials(); $nonce = $this->nonce (); $request = array ( 'nonce' => $nonce ); $body = $this->urlencode (array_merge ($request, $query)); diff --git a/php/bxinth.php b/php/bxinth.php index 73d45c279504b..2b14addc60157 100644 --- a/php/bxinth.php +++ b/php/bxinth.php @@ -234,6 +234,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( if ($params) $url .= '?' . $this->urlencode ($params); if ($api == 'private') { + $this->check_required_credentials(); $nonce = $this->nonce (); $auth = $this->apiKey . (string) $nonce . $this->secret; $signature = $this->hash ($this->encode ($auth), 'sha256'); diff --git a/php/ccex.php b/php/ccex.php index 0e62c50e8b713..2a95b641da08d 100644 --- a/php/ccex.php +++ b/php/ccex.php @@ -239,6 +239,7 @@ public function cancel_order ($id, $symbol = null, $params = array ()) { public function sign ($path, $api = 'public', $method = 'GET', $params = array (), $headers = null, $body = null) { $url = $this->urls['api'][$api]; if ($api == 'private') { + $this->check_required_credentials(); $nonce = (string) $this->nonce (); $query = $this->keysort (array_merge (array ( 'a' => $path, diff --git a/php/cex.php b/php/cex.php index d6aedf9f19b1f..236ba1651d95c 100644 --- a/php/cex.php +++ b/php/cex.php @@ -25,6 +25,11 @@ public function describe () { 'www' => 'https://cex.io', 'doc' => 'https://cex.io/cex-api', ), + 'requiredCredentials' => array ( + 'apiKey' => true, + 'secret' => true, + 'uid' => true, + ), 'api' => array ( 'public' => array ( 'get' => array ( @@ -381,8 +386,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( if ($query) $url .= '?' . $this->urlencode ($query); } else { - if (!$this->uid) - throw new AuthenticationError ($this->id . ' requires `' . $this->id . '.uid` property for authentication'); + $this->check_required_credentials(); $nonce = (string) $this->nonce (); $auth = $nonce . $this->uid . $this->apiKey; $signature = $this->hmac ($this->encode ($auth), $this->encode ($this->secret)); diff --git a/php/coincheck.php b/php/coincheck.php index 7668a656daf43..99e54d3f55f69 100644 --- a/php/coincheck.php +++ b/php/coincheck.php @@ -199,6 +199,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( if ($query) $url .= '?' . $this->urlencode ($query); } else { + $this->check_required_credentials(); $nonce = (string) $this->nonce (); if ($query) $body = $this->urlencode ($this->keysort ($query)); diff --git a/php/coinfloor.php b/php/coinfloor.php index 4c8ba317bc9f8..18ae90ec96c77 100644 --- a/php/coinfloor.php +++ b/php/coinfloor.php @@ -22,6 +22,11 @@ public function describe () { 'https://www.coinfloor.co.uk/api', ), ), + 'requiredCredentials' => array ( + 'apiKey' => true, + 'secret' => true, + 'uid' => true, + ), 'api' => array ( 'public' => array ( 'get' => array ( @@ -164,6 +169,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( if ($query) $url .= '?' . $this->urlencode ($query); } else { + $this->check_required_credentials(); $nonce = $this->nonce (); $body = $this->urlencode (array_merge (array ( 'nonce' => $nonce ), $query)); $auth = $this->uid . '/' . $this->apiKey . ':' . $this->password; diff --git a/php/coingi.php b/php/coingi.php index cfb0dccfa17e9..984aaff29d8dc 100644 --- a/php/coingi.php +++ b/php/coingi.php @@ -200,6 +200,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( if ($query) $url .= '?' . $this->urlencode ($query); } else { + $this->check_required_credentials(); $nonce = $this->nonce (); $request = array_merge (array ( 'token' => $this->apiKey, diff --git a/php/coinmarketcap.php b/php/coinmarketcap.php index 12b81691d8e41..aaef8cae2c4ee 100644 --- a/php/coinmarketcap.php +++ b/php/coinmarketcap.php @@ -27,6 +27,10 @@ public function describe () { 'www' => 'https://coinmarketcap.com', 'doc' => 'https://coinmarketcap.com/api', ), + 'requiredCredentials' => array ( + 'apiKey' => false, + 'secret' => false, + ), 'api' => array ( 'public' => array ( 'get' => array ( diff --git a/php/coinmate.php b/php/coinmate.php index 4b27dc5d88cdd..268e60356b0b0 100644 --- a/php/coinmate.php +++ b/php/coinmate.php @@ -22,6 +22,11 @@ public function describe () { 'https://coinmate.io/developers', ), ), + 'requiredCredentials' => array ( + 'apiKey' => true, + 'secret' => true, + 'uid' => true, + ), 'api' => array ( 'public' => array ( 'get' => array ( @@ -176,8 +181,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( if ($params) $url .= '?' . $this->urlencode ($params); } else { - if (!$this->uid) - throw new AuthenticationError ($this->id . ' requires `' . $this->id . '.uid` property for authentication'); + $this->check_required_credentials(); $nonce = (string) $this->nonce (); $auth = $nonce . $this->uid . $this->apiKey; $signature = $this->hmac ($this->encode ($auth), $this->encode ($this->secret)); diff --git a/php/coinsecure.php b/php/coinsecure.php index 88eb834e0edce..60686989e3f1c 100644 --- a/php/coinsecure.php +++ b/php/coinsecure.php @@ -23,6 +23,10 @@ public function describe () { 'https://github.com/coinsecure/plugins', ), ), + 'requiredCredentials' => array ( + 'apiKey' => true, + 'secret' => false, + ), 'api' => array ( 'public' => array ( 'get' => array ( @@ -261,6 +265,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( $url = $this->urls['api'] . '/' . $this->version . '/' . $this->implode_params($path, $params); $query = $this->omit ($params, $this->extract_params($path)); if ($api == 'private') { + $this->check_required_credentials(); $headers = array ( 'Authorization' => $this->apiKey ); if ($query) { $body = $this->json ($query); diff --git a/php/coinspot.php b/php/coinspot.php index bb96d1b9f10eb..b9d4cc9f391e4 100644 --- a/php/coinspot.php +++ b/php/coinspot.php @@ -143,6 +143,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( throw new AuthenticationError ($this->id . ' requires apiKey for all requests'); $url = $this->urls['api'][$api] . '/' . $path; if ($api == 'private') { + $this->check_required_credentials(); $nonce = $this->nonce (); $body = $this->json (array_merge (array ( 'nonce' => $nonce ), $params)); $headers = array ( diff --git a/php/cryptopia.php b/php/cryptopia.php index 86af6af7730bd..77e8249f8c7f6 100644 --- a/php/cryptopia.php +++ b/php/cryptopia.php @@ -496,6 +496,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( if ($query) $url .= '?' . $this->urlencode ($query); } else { + $this->check_required_credentials(); $nonce = (string) $this->nonce (); $body = $this->json ($query); $hash = $this->hash ($this->encode ($body), 'md5', 'base64'); diff --git a/php/exmo.php b/php/exmo.php index 29e12145f2964..d1143a4c5b9d1 100644 --- a/php/exmo.php +++ b/php/exmo.php @@ -246,6 +246,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( if ($params) $url .= '?' . $this->urlencode ($params); } else { + $this->check_required_credentials(); $nonce = $this->nonce (); $body = $this->urlencode (array_merge (array ( 'nonce' => $nonce ), $params)); $headers = array ( diff --git a/php/flowbtc.php b/php/flowbtc.php index cb46c12c1e047..7650e6c5951ed 100644 --- a/php/flowbtc.php +++ b/php/flowbtc.php @@ -20,6 +20,11 @@ public function describe () { 'www' => 'https://trader.flowbtc.com', 'doc' => 'http://www.flowbtc.com.br/api/', ), + 'requiredCredentials' => array ( + 'apiKey' => true, + 'secret' => true, + 'uid' => true, + ), 'api' => array ( 'public' => array ( 'post' => array ( @@ -191,8 +196,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( $body = $this->json ($params); } } else { - if (!$this->uid) - throw new AuthenticationError ($this->id . ' requires `' . $this->id . '.uid` property for authentication'); + $this->check_required_credentials(); $nonce = $this->nonce (); $auth = (string) $nonce . $this->uid . $this->apiKey; $signature = $this->hmac ($this->encode ($auth), $this->encode ($this->secret)); diff --git a/php/foxbit.php b/php/foxbit.php index 4d255fe52df37..b6e6d371470e2 100644 --- a/php/foxbit.php +++ b/php/foxbit.php @@ -164,6 +164,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( if ($query) $url .= '?' . $this->urlencode ($query); } else { + $this->check_required_credentials(); $nonce = (string) $this->nonce (); $request = array_merge (array ( 'MsgType' => $path ), $query); $body = $this->json ($request); diff --git a/php/fybse.php b/php/fybse.php index d90988a23f65d..fe4eb54fa2efd 100644 --- a/php/fybse.php +++ b/php/fybse.php @@ -147,6 +147,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( if ($api == 'public') { $url .= '.json'; } else { + $this->check_required_credentials(); $nonce = $this->nonce (); $body = $this->urlencode (array_merge (array ( 'timestamp' => $nonce ), $params)); $headers = array ( diff --git a/php/gatecoin.php b/php/gatecoin.php index 21edfaceade43..2072534ce784c 100644 --- a/php/gatecoin.php +++ b/php/gatecoin.php @@ -381,6 +381,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( if ($query) $url .= '?' . $this->urlencode ($query); } else { + $this->check_required_credentials(); $nonce = $this->nonce (); $contentType = ($method == 'GET') ? '' : 'application/json'; $auth = $method . $url . $contentType . (string) $nonce; diff --git a/php/gdax.php b/php/gdax.php index e740a7382ecf3..fabbdf61cab08 100644 --- a/php/gdax.php +++ b/php/gdax.php @@ -41,6 +41,11 @@ public function describe () { 'www' => 'https://www.gdax.com', 'doc' => 'https://docs.gdax.com', ), + 'requiredCredentials' => array ( + 'apiKey' => true, + 'secret' => true, + 'password' => true, + ), 'api' => array ( 'public' => array ( 'get' => array ( @@ -451,12 +456,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( } $url = $this->urls['api'] . $request; if ($api == 'private') { - if (!$this->apiKey) - throw new AuthenticationError ($this->id . ' requires apiKey property for authentication and trading'); - if (!$this->secret) - throw new AuthenticationError ($this->id . ' requires $secret property for authentication and trading'); - if (!$this->password) - throw new AuthenticationError ($this->id . ' requires password property for authentication and trading'); + $this->check_required_credentials(); $nonce = (string) $this->nonce (); $payload = ''; if ($method != 'GET') { diff --git a/php/gemini.php b/php/gemini.php index 484ec93f41a43..64c6330ff50ca 100644 --- a/php/gemini.php +++ b/php/gemini.php @@ -186,6 +186,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( if ($query) $url .= '?' . $this->urlencode ($query); } else { + $this->check_required_credentials(); $nonce = $this->nonce (); $request = array_merge (array ( 'request' => $url, diff --git a/php/hitbtc.php b/php/hitbtc.php index ffc2b64da0731..8fc54845d0432 100644 --- a/php/hitbtc.php +++ b/php/hitbtc.php @@ -383,6 +383,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( if ($query) $url .= '?' . $this->urlencode ($query); } else { + $this->check_required_credentials(); $nonce = $this->nonce (); $payload = array ( 'nonce' => $nonce, 'apikey' => $this->apiKey ); $query = array_merge ($payload, $query); diff --git a/php/hitbtc2.php b/php/hitbtc2.php index 5b24056385101..81aa7ce8d3f95 100644 --- a/php/hitbtc2.php +++ b/php/hitbtc2.php @@ -495,6 +495,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( if ($query) $url .= '?' . $this->urlencode ($query); } else { + $this->check_required_credentials(); $url .= $this->implode_params($path, $params); if ($method == 'GET') { if ($query) diff --git a/php/huobi.php b/php/huobi.php index 155804c2196ef..0adf03bdb8b80 100644 --- a/php/huobi.php +++ b/php/huobi.php @@ -215,6 +215,7 @@ public function cancel_order ($id, $symbol = null, $params = array ()) { public function sign ($path, $api = 'public', $method = 'GET', $params = array (), $headers = null, $body = null) { $url = $this->urls['api']; if ($api == 'trade') { + $this->check_required_credentials(); $url .= '/api' . $this->version; $query = $this->keysort (array_merge (array ( 'method' => $path, diff --git a/php/huobipro.php b/php/huobipro.php index e1ca144fe96e8..2188df2260eb4 100644 --- a/php/huobipro.php +++ b/php/huobipro.php @@ -331,6 +331,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( $url .= '/' . $this->implode_params($path, $params); $query = $this->omit ($params, $this->extract_params($path)); if ($api == 'private') { + $this->check_required_credentials(); $timestamp = $this->YmdHMS ($this->milliseconds (), 'T'); $request = $this->keysort (array_merge (array ( 'SignatureMethod' => 'HmacSHA256', diff --git a/php/independentreserve.php b/php/independentreserve.php index 77e63ada85263..4655b62ce1f3e 100644 --- a/php/independentreserve.php +++ b/php/independentreserve.php @@ -219,6 +219,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( if ($params) $url .= '?' . $this->urlencode ($params); } else { + $this->check_required_credentials(); $nonce = $this->nonce (); $auth = array ( $url, diff --git a/php/itbit.php b/php/itbit.php index 92d14ca84fa86..754444a6831f2 100644 --- a/php/itbit.php +++ b/php/itbit.php @@ -199,6 +199,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( if ($query) $url .= '?' . $this->urlencode ($query); } else { + $this->check_required_credentials(); if ($query) $body = $this->json ($query); else diff --git a/php/kraken.php b/php/kraken.php index 70e7138bce136..5300a95105d05 100644 --- a/php/kraken.php +++ b/php/kraken.php @@ -576,6 +576,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( if ($params) $url .= '?' . $this->urlencode ($params); } else { + $this->check_required_credentials(); $nonce = (string) $this->nonce (); $body = $this->urlencode (array_merge (array ( 'nonce' => $nonce ), $params)); $auth = $this->encode ($nonce . $body); diff --git a/php/lakebtc.php b/php/lakebtc.php index 0e99696152291..a647550a147c0 100644 --- a/php/lakebtc.php +++ b/php/lakebtc.php @@ -189,6 +189,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( if ($params) $url .= '?' . $this->urlencode ($params); } else { + $this->check_required_credentials(); $nonce = $this->nonce (); if ($params) $params = implode (',', $params); diff --git a/php/liqui.php b/php/liqui.php index e51d4f91f0f24..239aafc110340 100644 --- a/php/liqui.php +++ b/php/liqui.php @@ -566,6 +566,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( $url = $this->urls['api'][$api]; $query = $this->omit ($params, $this->extract_params($path)); if ($api == 'private') { + $this->check_required_credentials(); $nonce = $this->nonce (); $body = $this->urlencode (array_merge (array ( 'nonce' => $nonce, diff --git a/php/livecoin.php b/php/livecoin.php index ae49509de2846..b8098193d7a1c 100644 --- a/php/livecoin.php +++ b/php/livecoin.php @@ -236,6 +236,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( } } if ($api == 'private') { + $this->check_required_credentials(); if ($method == 'POST') $body = $query; $signature = $this->hmac ($this->encode ($query), $this->encode ($this->secret), 'sha256'); diff --git a/php/luno.php b/php/luno.php index f47379295566d..f53a44ebe258c 100644 --- a/php/luno.php +++ b/php/luno.php @@ -238,6 +238,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( if ($query) $url .= '?' . $this->urlencode ($query); if ($api == 'private') { + $this->check_required_credentials(); $auth = $this->encode ($this->apiKey . ':' . $this->secret); $auth = base64_encode ($auth); $headers = array ( 'Authorization' => 'Basic ' . $this->decode ($auth) ); diff --git a/php/mercado.php b/php/mercado.php index 960d842a3e91c..94acf1774142e 100644 --- a/php/mercado.php +++ b/php/mercado.php @@ -190,6 +190,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( if ($api == 'public') { $url .= $this->implode_params($path, $params); } else { + $this->check_required_credentials(); $url .= $this->version . '/'; $nonce = $this->nonce (); $body = $this->urlencode (array_merge (array ( diff --git a/php/mixcoins.php b/php/mixcoins.php index 0965382ee7a0d..cbb82b6e0095a 100644 --- a/php/mixcoins.php +++ b/php/mixcoins.php @@ -155,6 +155,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( if ($params) $url .= '?' . $this->urlencode ($params); } else { + $this->check_required_credentials(); $nonce = $this->nonce (); $body = $this->urlencode (array_merge (array ( 'nonce' => $nonce, diff --git a/php/nova.php b/php/nova.php index 0c136587d3ac2..70bd80f30a979 100644 --- a/php/nova.php +++ b/php/nova.php @@ -198,6 +198,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( if ($query) $url .= '?' . $this->urlencode ($query); } else { + $this->check_required_credentials(); $nonce = (string) $this->nonce (); $url .= '?' . $this->urlencode (array ( 'nonce' => $nonce )); $signature = $this->hmac ($this->encode ($url), $this->encode ($this->secret), 'sha512', 'base64'); diff --git a/php/okcoinusd.php b/php/okcoinusd.php index 82cd7a8fd09bd..2cddc9b6d8703 100644 --- a/php/okcoinusd.php +++ b/php/okcoinusd.php @@ -529,6 +529,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( $url .= $this->version . '/'; $url .= $path . $this->extension; if ($api == 'private') { + $this->check_required_credentials(); $query = $this->keysort (array_merge (array ( 'api_key' => $this->apiKey, ), $params)); diff --git a/php/paymium.php b/php/paymium.php index 765b44023ff1e..b74f239e0f545 100644 --- a/php/paymium.php +++ b/php/paymium.php @@ -181,6 +181,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( if ($query) $url .= '?' . $this->urlencode ($query); } else { + $this->check_required_credentials(); $body = $this->json ($params); $nonce = (string) $this->nonce (); $auth = $nonce . $url . $body; diff --git a/php/poloniex.php b/php/poloniex.php index 4f5dc495eb94c..7e575c03d3afd 100644 --- a/php/poloniex.php +++ b/php/poloniex.php @@ -610,6 +610,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( if ($api == 'public') { $url .= '?' . $this->urlencode ($query); } else { + $this->check_required_credentials(); $query['nonce'] = $this->nonce (); $body = $this->urlencode ($query); $headers = array ( diff --git a/php/qryptos.php b/php/qryptos.php index 867d19f20b785..a43cdd057058c 100644 --- a/php/qryptos.php +++ b/php/qryptos.php @@ -240,6 +240,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( if ($query) $url .= '?' . $this->urlencode ($query); } else { + $this->check_required_credentials(); $nonce = $this->nonce (); $request = array ( 'path' => $url, diff --git a/php/quadrigacx.php b/php/quadrigacx.php index 2b86b6d3efb8c..5f4b7a0ff35ea 100644 --- a/php/quadrigacx.php +++ b/php/quadrigacx.php @@ -20,6 +20,11 @@ public function describe () { 'www' => 'https://www.quadrigacx.com', 'doc' => 'https://www.quadrigacx.com/api_info', ), + 'requiredCredentials' => array ( + 'apiKey' => true, + 'secret' => true, + 'uid' => true, + ), 'api' => array ( 'public' => array ( 'get' => array ( @@ -159,8 +164,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( if ($api == 'public') { $url .= '?' . $this->urlencode ($params); } else { - if (!$this->uid) - throw new AuthenticationError ($this->id . ' requires `' . $this->id . '.uid` property for authentication'); + $this->check_required_credentials(); $nonce = $this->nonce (); $request = implode ('', array ((string) $nonce, $this->uid, $this->apiKey)); $signature = $this->hmac ($this->encode ($request), $this->encode ($this->secret)); diff --git a/php/southxchange.php b/php/southxchange.php index 963e6af666bd3..57362743522c7 100644 --- a/php/southxchange.php +++ b/php/southxchange.php @@ -213,6 +213,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( $url = $this->urls['api'] . '/' . $this->implode_params($path, $params); $query = $this->omit ($params, $this->extract_params($path)); if ($api == 'private') { + $this->check_required_credentials(); $nonce = $this->nonce (); $query = array_merge (array ( 'key' => $this->apiKey, diff --git a/php/therock.php b/php/therock.php index b5809180a071b..2d20584045ef1 100644 --- a/php/therock.php +++ b/php/therock.php @@ -227,6 +227,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( $url = $this->urls['api'] . '/' . $this->version . '/' . $this->implode_params($path, $params); $query = $this->omit ($params, $this->extract_params($path)); if ($api == 'private') { + $this->check_required_credentials(); $nonce = (string) $this->nonce (); $auth = $nonce . $url; $headers = array ( diff --git a/php/vaultoro.php b/php/vaultoro.php index f8ff7a5e2d3a1..6bba4e9884a46 100644 --- a/php/vaultoro.php +++ b/php/vaultoro.php @@ -190,6 +190,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( if ($api == 'public') { $url .= $path; } else { + $this->check_required_credentials(); $nonce = $this->nonce (); $url .= $this->version . '/' . $this->implode_params($path, $params); $query = array_merge (array ( diff --git a/php/virwox.php b/php/virwox.php index d7f2d507a713a..8f236cfb05ce5 100644 --- a/php/virwox.php +++ b/php/virwox.php @@ -22,6 +22,12 @@ public function describe () { 'www' => 'https://www.virwox.com', 'doc' => 'https://www.virwox.com/developers.php', ), + 'requiredCredentials' => array ( + 'apiKey' => true, + 'secret' => false, + 'login' => true, + 'password' => true + ), 'api' => array ( 'public' => array ( 'get' => array ( @@ -208,6 +214,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( $url = $this->urls['api'][$api]; $auth = array (); if ($api == 'private') { + $this->check_required_credentials(); $auth['key'] = $this->apiKey; $auth['user'] = $this->login; $auth['pass'] = $this->password; diff --git a/php/xbtce.php b/php/xbtce.php index 0a4b48c8b9408..94ed623401b88 100644 --- a/php/xbtce.php +++ b/php/xbtce.php @@ -26,6 +26,11 @@ public function describe () { 'https://support.xbtce.info/Knowledgebase/Article/View/52/25/xbtce-exchange-api', ), ), + 'requiredCredentials' => array ( + 'apiKey' => true, + 'secret' => true, + 'uid' => true, + ), 'api' => array ( 'public' => array ( 'get' => array ( @@ -300,7 +305,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( if (!$this->apiKey) throw new AuthenticationError ($this->id . ' requires apiKey for all requests, their public API is always busy'); if (!$this->uid) - throw new AuthenticationError ($this->id . ' requires uid property for authentication and trading'); + throw new AuthenticationError ($this->id . ' requires uid property for authentication and trading, their public API is always busy'); $url = $this->urls['api'] . '/' . $this->version; if ($api == 'public') $url .= '/' . $api; @@ -310,15 +315,16 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( if ($query) $url .= '?' . $this->urlencode ($query); } else { + $this->check_required_credentials(); $headers = array ( 'Accept-Encoding' => 'gzip, deflate' ); $nonce = (string) $this->nonce (); if ($method == 'POST') { if ($query) { $headers['Content-Type'] = 'application/json'; $body = $this->json ($query); - } - else + } else { $url .= '?' . $this->urlencode ($query); + } } $auth = $nonce . $this->uid . $this->apiKey . $method . $url; if ($body) diff --git a/php/zaif.php b/php/zaif.php index 2aa2dc884251f..6fcda439f5df4 100644 --- a/php/zaif.php +++ b/php/zaif.php @@ -321,6 +321,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( } else if ($api == 'fapi') { $url .= 'fapi/' . $this->version . '/' . $this->implode_params($path, $params); } else { + $this->check_required_credentials(); if ($api == 'ecapi') { $url .= 'ecapi'; } else if ($api == 'tlapi') { diff --git a/php/zb.php b/php/zb.php index f79aba7ba2c49..cbed41098e3f6 100644 --- a/php/zb.php +++ b/php/zb.php @@ -275,6 +275,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array ( if ($params) $url .= '?' . $this->urlencode ($params); } else { + $this->check_required_credentials(); $paramsLength = count ($params); // $params should be a string here $nonce = $this->nonce (); $auth = 'method=' . $path; diff --git a/python/ccxt/_1broker.py b/python/ccxt/_1broker.py index b8d7c022aa3cd..0ae00886d5e88 100644 --- a/python/ccxt/_1broker.py +++ b/python/ccxt/_1broker.py @@ -2,7 +2,6 @@ from ccxt.base.exchange import Exchange from ccxt.base.errors import ExchangeError -from ccxt.base.errors import AuthenticationError class _1broker (Exchange): @@ -30,6 +29,10 @@ def describe(self): 'www': 'https://1broker.com', 'doc': 'https://1broker.com/?c=en/content/api-documentation', }, + 'requiredCredentials': { + 'apiKey': True, + 'secret': False, + }, 'api': { 'private': { 'get': [ @@ -224,8 +227,7 @@ def cancel_order(self, id, symbol=None, params={}): return self.privatePostOrderCancel({'order_id': id}) def sign(self, path, api='public', method='GET', params={}, headers=None, body=None): - if not self.apiKey: - raise AuthenticationError(self.id + ' requires apiKey for all requests') + self.check_required_credentials() url = self.urls['api'] + '/' + self.version + '/' + path + '.php' query = self.extend({'token': self.apiKey}, params) url += '?' + self.urlencode(query) diff --git a/python/ccxt/_1btcxe.py b/python/ccxt/_1btcxe.py index 650734c362cbe..5adfb19d56a93 100644 --- a/python/ccxt/_1btcxe.py +++ b/python/ccxt/_1btcxe.py @@ -208,6 +208,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if params: url += '?' + self.urlencode(params) else: + self.check_required_credentials() query = self.extend({ 'api_key': self.apiKey, 'nonce': self.nonce(), diff --git a/python/ccxt/acx.py b/python/ccxt/acx.py index 66a1432101cc5..95cbc0f24836d 100644 --- a/python/ccxt/acx.py +++ b/python/ccxt/acx.py @@ -279,6 +279,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if query: url += '?' + self.urlencode(query) else: + self.check_required_credentials() nonce = str(self.nonce()) query = self.urlencode(self.keysort(self.extend({ 'access_key': self.apiKey, diff --git a/python/ccxt/anxpro.py b/python/ccxt/anxpro.py index 87395ae8c2b6f..e7ca5d8ab5462 100644 --- a/python/ccxt/anxpro.py +++ b/python/ccxt/anxpro.py @@ -167,6 +167,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if query: url += '?' + self.urlencode(query) else: + self.check_required_credentials() nonce = self.nonce() body = self.urlencode(self.extend({'nonce': nonce}, query)) secret = base64.b64decode(self.secret) diff --git a/python/ccxt/async/_1broker.py b/python/ccxt/async/_1broker.py index 81ecba47e9679..c006e14673c02 100644 --- a/python/ccxt/async/_1broker.py +++ b/python/ccxt/async/_1broker.py @@ -2,7 +2,6 @@ from ccxt.async.base.exchange import Exchange from ccxt.base.errors import ExchangeError -from ccxt.base.errors import AuthenticationError class _1broker (Exchange): @@ -30,6 +29,10 @@ def describe(self): 'www': 'https://1broker.com', 'doc': 'https://1broker.com/?c=en/content/api-documentation', }, + 'requiredCredentials': { + 'apiKey': True, + 'secret': False, + }, 'api': { 'private': { 'get': [ @@ -224,8 +227,7 @@ async def cancel_order(self, id, symbol=None, params={}): return await self.privatePostOrderCancel({'order_id': id}) def sign(self, path, api='public', method='GET', params={}, headers=None, body=None): - if not self.apiKey: - raise AuthenticationError(self.id + ' requires apiKey for all requests') + self.check_required_credentials() url = self.urls['api'] + '/' + self.version + '/' + path + '.php' query = self.extend({'token': self.apiKey}, params) url += '?' + self.urlencode(query) diff --git a/python/ccxt/async/_1btcxe.py b/python/ccxt/async/_1btcxe.py index 0d9892021da44..15c0785c1830d 100644 --- a/python/ccxt/async/_1btcxe.py +++ b/python/ccxt/async/_1btcxe.py @@ -208,6 +208,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if params: url += '?' + self.urlencode(params) else: + self.check_required_credentials() query = self.extend({ 'api_key': self.apiKey, 'nonce': self.nonce(), diff --git a/python/ccxt/async/acx.py b/python/ccxt/async/acx.py index 27bce64163b21..8b858c145f4c3 100644 --- a/python/ccxt/async/acx.py +++ b/python/ccxt/async/acx.py @@ -279,6 +279,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if query: url += '?' + self.urlencode(query) else: + self.check_required_credentials() nonce = str(self.nonce()) query = self.urlencode(self.keysort(self.extend({ 'access_key': self.apiKey, diff --git a/python/ccxt/async/anxpro.py b/python/ccxt/async/anxpro.py index 229e89034d944..599262280478a 100644 --- a/python/ccxt/async/anxpro.py +++ b/python/ccxt/async/anxpro.py @@ -167,6 +167,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if query: url += '?' + self.urlencode(query) else: + self.check_required_credentials() nonce = self.nonce() body = self.urlencode(self.extend({'nonce': nonce}, query)) secret = base64.b64decode(self.secret) diff --git a/python/ccxt/async/binance.py b/python/ccxt/async/binance.py index bf7cbf0868652..e5f57aadcd221 100644 --- a/python/ccxt/async/binance.py +++ b/python/ccxt/async/binance.py @@ -547,6 +547,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if api == 'wapi': url += '.html' if (api == 'private') or (api == 'wapi'): + self.check_required_credentials() nonce = self.nonce() query = self.urlencode(self.extend({'timestamp': nonce}, params)) signature = None diff --git a/python/ccxt/async/bit2c.py b/python/ccxt/async/bit2c.py index 64105bf60b89b..10f75bf691883 100644 --- a/python/ccxt/async/bit2c.py +++ b/python/ccxt/async/bit2c.py @@ -161,6 +161,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if api == 'public': url += '.json' else: + self.check_required_credentials() nonce = self.nonce() query = self.extend({'nonce': nonce}, params) body = self.urlencode(query) diff --git a/python/ccxt/async/bitbay.py b/python/ccxt/async/bitbay.py index 06fc62783e896..15b30f65b6c8b 100644 --- a/python/ccxt/async/bitbay.py +++ b/python/ccxt/async/bitbay.py @@ -198,6 +198,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if api == 'public': url += '/' + self.implode_params(path, params) + '.json' else: + self.check_required_credentials() body = self.urlencode(self.extend({ 'method': path, 'moment': self.nonce(), diff --git a/python/ccxt/async/bitcoincoid.py b/python/ccxt/async/bitcoincoid.py index 43d8f472d3dd9..6c95bd0f5f40a 100644 --- a/python/ccxt/async/bitcoincoid.py +++ b/python/ccxt/async/bitcoincoid.py @@ -159,6 +159,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if api == 'public': url += '/' + self.implode_params(path, params) else: + self.check_required_credentials() body = self.urlencode(self.extend({ 'method': path, 'nonce': self.nonce(), diff --git a/python/ccxt/async/bitfinex.py b/python/ccxt/async/bitfinex.py index c4fb0664fdc96..f0e9ef7aceeb2 100644 --- a/python/ccxt/async/bitfinex.py +++ b/python/ccxt/async/bitfinex.py @@ -479,6 +479,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N url += suffix request += suffix if api == 'private': + self.check_required_credentials() nonce = self.nonce() query = self.extend({ 'nonce': str(nonce), diff --git a/python/ccxt/async/bitfinex2.py b/python/ccxt/async/bitfinex2.py index 2ec50e68d9183..e50da3653fd35 100644 --- a/python/ccxt/async/bitfinex2.py +++ b/python/ccxt/async/bitfinex2.py @@ -364,6 +364,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if query: url += '?' + self.urlencode(query) else: + self.check_required_credentials() nonce = str(self.nonce()) body = self.json(query) auth = '/api' + '/' + request + nonce + body diff --git a/python/ccxt/async/bitflyer.py b/python/ccxt/async/bitflyer.py index abd90ad104486..2a8fd779437d7 100644 --- a/python/ccxt/async/bitflyer.py +++ b/python/ccxt/async/bitflyer.py @@ -226,6 +226,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N request += '?' + self.urlencode(params) url = self.urls['api'] + request if api == 'private': + self.check_required_credentials() nonce = str(self.nonce()) body = self.json(params) auth = ''.join([nonce, method, request, body]) diff --git a/python/ccxt/async/bithumb.py b/python/ccxt/async/bithumb.py index d5dbabe18d51b..6280dd2745a03 100644 --- a/python/ccxt/async/bithumb.py +++ b/python/ccxt/async/bithumb.py @@ -222,6 +222,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if query: url += '?' + self.urlencode(query) else: + self.check_required_credentials() body = self.urlencode(self.extend({ 'endpoint': endpoint, }, query)) diff --git a/python/ccxt/async/bitlish.py b/python/ccxt/async/bitlish.py index c586f16b300c2..f59d1a8c71fb1 100644 --- a/python/ccxt/async/bitlish.py +++ b/python/ccxt/async/bitlish.py @@ -23,6 +23,10 @@ def describe(self): 'www': 'https://bitlish.com', 'doc': 'https://bitlish.com/api', }, + 'requiredCredentials': { + 'apiKey': True, + 'secret': False, + }, 'api': { 'public': { 'get': [ @@ -274,6 +278,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N body = self.json(params) headers = {'Content-Type': 'application/json'} else: + self.check_required_credentials() body = self.json(self.extend({'token': self.apiKey}, params)) headers = {'Content-Type': 'application/json'} return {'url': url, 'method': method, 'body': body, 'headers': headers} diff --git a/python/ccxt/async/bitmarket.py b/python/ccxt/async/bitmarket.py index 5b7b8034b792a..da4aea614485b 100644 --- a/python/ccxt/async/bitmarket.py +++ b/python/ccxt/async/bitmarket.py @@ -270,6 +270,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if api == 'public': url += '/' + self.implode_params(path + '.json', params) else: + self.check_required_credentials() nonce = self.nonce() query = self.extend({ 'tonce': nonce, diff --git a/python/ccxt/async/bitmex.py b/python/ccxt/async/bitmex.py index eae7741cbb414..3db4b68bd05c8 100644 --- a/python/ccxt/async/bitmex.py +++ b/python/ccxt/async/bitmex.py @@ -374,6 +374,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N query += '?' + self.urlencode(params) url = self.urls['api'] + query if api == 'private': + self.check_required_credentials() nonce = str(self.nonce()) if method == 'POST': if params: diff --git a/python/ccxt/async/bitso.py b/python/ccxt/async/bitso.py index 2e6b9ad1b10b2..d2bb76ceb82f6 100644 --- a/python/ccxt/async/bitso.py +++ b/python/ccxt/async/bitso.py @@ -221,6 +221,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if params: url += '?' + self.urlencode(params) else: + self.check_required_credentials() nonce = str(self.nonce()) request = ''.join([nonce, method, query]) if params: diff --git a/python/ccxt/async/bitstamp.py b/python/ccxt/async/bitstamp.py index 5cafe2a794c94..1c167536478b0 100644 --- a/python/ccxt/async/bitstamp.py +++ b/python/ccxt/async/bitstamp.py @@ -2,7 +2,6 @@ from ccxt.async.base.exchange import Exchange from ccxt.base.errors import ExchangeError -from ccxt.base.errors import AuthenticationError class bitstamp (Exchange): @@ -22,6 +21,11 @@ def describe(self): 'www': 'https://www.bitstamp.net', 'doc': 'https://www.bitstamp.net/api', }, + 'requiredCredentials': { + 'apiKey': True, + 'secret': True, + 'uid': True, + }, 'api': { 'public': { 'get': [ @@ -238,8 +242,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if query: url += '?' + self.urlencode(query) else: - if not self.uid: - raise AuthenticationError(self.id + ' requires `' + self.id + '.uid` property for authentication') + self.check_required_credentials() nonce = str(self.nonce()) auth = nonce + self.uid + self.apiKey signature = self.encode(self.hmac(self.encode(auth), self.encode(self.secret))) diff --git a/python/ccxt/async/bitstamp1.py b/python/ccxt/async/bitstamp1.py index 0beec90d70d06..13a3effb0e13d 100644 --- a/python/ccxt/async/bitstamp1.py +++ b/python/ccxt/async/bitstamp1.py @@ -3,7 +3,6 @@ from ccxt.async.base.exchange import Exchange from ccxt.base.errors import ExchangeError from ccxt.base.errors import NotSupported -from ccxt.base.errors import AuthenticationError class bitstamp1 (Exchange): @@ -22,6 +21,11 @@ def describe(self): 'www': 'https://www.bitstamp.net', 'doc': 'https://www.bitstamp.net/api', }, + 'requiredCredentials': { + 'apiKey': True, + 'secret': True, + 'uid': True, + }, 'api': { 'public': { 'get': [ @@ -207,8 +211,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if query: url += '?' + self.urlencode(query) else: - if not self.uid: - raise AuthenticationError(self.id + ' requires `' + self.id + '.uid` property for authentication') + self.check_required_credentials() nonce = str(self.nonce()) auth = nonce + self.uid + self.apiKey signature = self.encode(self.hmac(self.encode(auth), self.encode(self.secret))) diff --git a/python/ccxt/async/bittrex.py b/python/ccxt/async/bittrex.py index 6dd5b6054afe0..6a5c1e0eafabf 100644 --- a/python/ccxt/async/bittrex.py +++ b/python/ccxt/async/bittrex.py @@ -509,6 +509,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if params: url += '?' + self.urlencode(params) else: + self.check_required_credentials() nonce = self.nonce() url += api + '/' if ((api == 'account') and(path != 'withdraw')) or (path == 'openorders'): diff --git a/python/ccxt/async/bl3p.py b/python/ccxt/async/bl3p.py index e35b89e123f0a..22af55f050469 100644 --- a/python/ccxt/async/bl3p.py +++ b/python/ccxt/async/bl3p.py @@ -168,6 +168,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if query: url += '?' + self.urlencode(query) else: + self.check_required_credentials() nonce = self.nonce() body = self.urlencode(self.extend({'nonce': nonce}, query)) secret = base64.b64decode(self.secret) diff --git a/python/ccxt/async/btcbox.py b/python/ccxt/async/btcbox.py index 06ac9188fc3df..308fa4a458577 100644 --- a/python/ccxt/async/btcbox.py +++ b/python/ccxt/async/btcbox.py @@ -181,6 +181,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if params: url += '?' + self.urlencode(params) else: + self.check_required_credentials() nonce = str(self.nonce()) query = self.extend({ 'key': self.apiKey, diff --git a/python/ccxt/async/btcchina.py b/python/ccxt/async/btcchina.py index 6b17483fc33e9..baf6653215b96 100644 --- a/python/ccxt/async/btcchina.py +++ b/python/ccxt/async/btcchina.py @@ -3,7 +3,6 @@ from ccxt.async.base.exchange import Exchange import base64 import hashlib -from ccxt.base.errors import AuthenticationError class btcchina (Exchange): @@ -280,10 +279,7 @@ def nonce(self): def sign(self, path, api='public', method='GET', params={}, headers=None, body=None): url = self.urls['api'][api] + '/' + path if api == 'private': - if not self.apiKey: - raise AuthenticationError(self.id + ' requires `' + self.id + '.apiKey` property for authentication') - if not self.secret: - raise AuthenticationError(self.id + ' requires `' + self.id + '.secret` property for authentication') + self.check_required_credentials() p = [] if 'params' in params: p = params['params'] diff --git a/python/ccxt/async/btcmarkets.py b/python/ccxt/async/btcmarkets.py index e4fcea5cf8672..401278b6caf0c 100644 --- a/python/ccxt/async/btcmarkets.py +++ b/python/ccxt/async/btcmarkets.py @@ -187,6 +187,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if params: url += '?' + self.urlencode(params) else: + self.check_required_credentials() nonce = str(self.nonce()) auth = uri + "\n" + nonce + "\n" headers = { diff --git a/python/ccxt/async/btctradeua.py b/python/ccxt/async/btctradeua.py index 01885b4244382..258f50af1aee1 100644 --- a/python/ccxt/async/btctradeua.py +++ b/python/ccxt/async/btctradeua.py @@ -279,6 +279,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if query: url += self.implode_params(path, query) else: + self.check_required_credentials() nonce = self.nonce() body = self.urlencode(self.extend({ 'out_order_id': nonce, diff --git a/python/ccxt/async/btcturk.py b/python/ccxt/async/btcturk.py index 8fa291cef4475..0e2b9c6160f22 100644 --- a/python/ccxt/async/btcturk.py +++ b/python/ccxt/async/btcturk.py @@ -202,6 +202,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if params: url += '?' + self.urlencode(params) else: + self.check_required_credentials() nonce = self.nonce().toString body = self.urlencode(params) secret = self.base64ToString(self.secret) diff --git a/python/ccxt/async/btcx.py b/python/ccxt/async/btcx.py index 00ab8a8ef8560..1289d8490fb6f 100644 --- a/python/ccxt/async/btcx.py +++ b/python/ccxt/async/btcx.py @@ -138,6 +138,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if api == 'public': url += self.implode_params(path, params) else: + self.check_required_credentials() nonce = self.nonce() url += api body = self.urlencode(self.extend({ diff --git a/python/ccxt/async/bter.py b/python/ccxt/async/bter.py index 909e6f9f5ff50..f2948381f5132 100644 --- a/python/ccxt/async/bter.py +++ b/python/ccxt/async/bter.py @@ -247,6 +247,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if query: url += '?' + self.urlencode(query) else: + self.check_required_credentials() nonce = self.nonce() request = {'nonce': nonce} body = self.urlencode(self.extend(request, query)) diff --git a/python/ccxt/async/bxinth.py b/python/ccxt/async/bxinth.py index ad988ee9b013f..0e8c6cd72f9bf 100644 --- a/python/ccxt/async/bxinth.py +++ b/python/ccxt/async/bxinth.py @@ -219,6 +219,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if params: url += '?' + self.urlencode(params) if api == 'private': + self.check_required_credentials() nonce = self.nonce() auth = self.apiKey + str(nonce) + self.secret signature = self.hash(self.encode(auth), 'sha256') diff --git a/python/ccxt/async/ccex.py b/python/ccxt/async/ccex.py index 91127e2a295ce..2ee25894bacbc 100644 --- a/python/ccxt/async/ccex.py +++ b/python/ccxt/async/ccex.py @@ -224,6 +224,7 @@ async def cancel_order(self, id, symbol=None, params={}): def sign(self, path, api='public', method='GET', params={}, headers=None, body=None): url = self.urls['api'][api] if api == 'private': + self.check_required_credentials() nonce = str(self.nonce()) query = self.keysort(self.extend({ 'a': path, diff --git a/python/ccxt/async/cex.py b/python/ccxt/async/cex.py index d9c4b783fb0ea..07c1709ed2cde 100644 --- a/python/ccxt/async/cex.py +++ b/python/ccxt/async/cex.py @@ -4,7 +4,6 @@ import math import json from ccxt.base.errors import ExchangeError -from ccxt.base.errors import AuthenticationError class cex (Exchange): @@ -28,6 +27,11 @@ def describe(self): 'www': 'https://cex.io', 'doc': 'https://cex.io/cex-api', }, + 'requiredCredentials': { + 'apiKey': True, + 'secret': True, + 'uid': True, + }, 'api': { 'public': { 'get': [ @@ -356,8 +360,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if query: url += '?' + self.urlencode(query) else: - if not self.uid: - raise AuthenticationError(self.id + ' requires `' + self.id + '.uid` property for authentication') + self.check_required_credentials() nonce = str(self.nonce()) auth = nonce + self.uid + self.apiKey signature = self.hmac(self.encode(auth), self.encode(self.secret)) diff --git a/python/ccxt/async/coincheck.py b/python/ccxt/async/coincheck.py index 7c40e64a36f88..b2f88d8014a8c 100644 --- a/python/ccxt/async/coincheck.py +++ b/python/ccxt/async/coincheck.py @@ -190,6 +190,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if query: url += '?' + self.urlencode(query) else: + self.check_required_credentials() nonce = str(self.nonce()) if query: body = self.urlencode(self.keysort(query)) diff --git a/python/ccxt/async/coinfloor.py b/python/ccxt/async/coinfloor.py index 15a59719e324b..9d80d00276daa 100644 --- a/python/ccxt/async/coinfloor.py +++ b/python/ccxt/async/coinfloor.py @@ -23,6 +23,11 @@ def describe(self): 'https://www.coinfloor.co.uk/api', ], }, + 'requiredCredentials': { + 'apiKey': True, + 'secret': True, + 'uid': True, + }, 'api': { 'public': { 'get': [ @@ -155,6 +160,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if query: url += '?' + self.urlencode(query) else: + self.check_required_credentials() nonce = self.nonce() body = self.urlencode(self.extend({'nonce': nonce}, query)) auth = self.uid + '/' + self.apiKey + ':' + self.password diff --git a/python/ccxt/async/coingi.py b/python/ccxt/async/coingi.py index 5eb073466a81f..bbfb8c37a0813 100644 --- a/python/ccxt/async/coingi.py +++ b/python/ccxt/async/coingi.py @@ -187,6 +187,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if query: url += '?' + self.urlencode(query) else: + self.check_required_credentials() nonce = self.nonce() request = self.extend({ 'token': self.apiKey, diff --git a/python/ccxt/async/coinmarketcap.py b/python/ccxt/async/coinmarketcap.py index c836b5368539c..6d0630c1b89d3 100644 --- a/python/ccxt/async/coinmarketcap.py +++ b/python/ccxt/async/coinmarketcap.py @@ -27,6 +27,10 @@ def describe(self): 'www': 'https://coinmarketcap.com', 'doc': 'https://coinmarketcap.com/api', }, + 'requiredCredentials': { + 'apiKey': False, + 'secret': False, + }, 'api': { 'public': { 'get': [ diff --git a/python/ccxt/async/coinmate.py b/python/ccxt/async/coinmate.py index eccda98c02d28..2a6f429ba60d5 100644 --- a/python/ccxt/async/coinmate.py +++ b/python/ccxt/async/coinmate.py @@ -2,7 +2,6 @@ from ccxt.async.base.exchange import Exchange from ccxt.base.errors import ExchangeError -from ccxt.base.errors import AuthenticationError class coinmate (Exchange): @@ -23,6 +22,11 @@ def describe(self): 'https://coinmate.io/developers', ], }, + 'requiredCredentials': { + 'apiKey': True, + 'secret': True, + 'uid': True, + }, 'api': { 'public': { 'get': [ @@ -166,8 +170,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if params: url += '?' + self.urlencode(params) else: - if not self.uid: - raise AuthenticationError(self.id + ' requires `' + self.id + '.uid` property for authentication') + self.check_required_credentials() nonce = str(self.nonce()) auth = nonce + self.uid + self.apiKey signature = self.hmac(self.encode(auth), self.encode(self.secret)) diff --git a/python/ccxt/async/coinsecure.py b/python/ccxt/async/coinsecure.py index e77245bf74002..978a6931f9e43 100644 --- a/python/ccxt/async/coinsecure.py +++ b/python/ccxt/async/coinsecure.py @@ -23,6 +23,10 @@ def describe(self): 'https://github.com/coinsecure/plugins', ], }, + 'requiredCredentials': { + 'apiKey': True, + 'secret': False, + }, 'api': { 'public': { 'get': [ @@ -252,6 +256,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N url = self.urls['api'] + '/' + self.version + '/' + self.implode_params(path, params) query = self.omit(params, self.extract_params(path)) if api == 'private': + self.check_required_credentials() headers = {'Authorization': self.apiKey} if query: body = self.json(query) diff --git a/python/ccxt/async/coinspot.py b/python/ccxt/async/coinspot.py index 739bf6173d84f..340f5d2a578a2 100644 --- a/python/ccxt/async/coinspot.py +++ b/python/ccxt/async/coinspot.py @@ -136,6 +136,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N raise AuthenticationError(self.id + ' requires apiKey for all requests') url = self.urls['api'][api] + '/' + path if api == 'private': + self.check_required_credentials() nonce = self.nonce() body = self.json(self.extend({'nonce': nonce}, params)) headers = { diff --git a/python/ccxt/async/cryptopia.py b/python/ccxt/async/cryptopia.py index 51ce33d7ce48e..d2d7898012a87 100644 --- a/python/ccxt/async/cryptopia.py +++ b/python/ccxt/async/cryptopia.py @@ -459,6 +459,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if query: url += '?' + self.urlencode(query) else: + self.check_required_credentials() nonce = str(self.nonce()) body = self.json(query) hash = self.hash(self.encode(body), 'md5', 'base64') diff --git a/python/ccxt/async/exmo.py b/python/ccxt/async/exmo.py index 7773ee51845a8..ca47daed681f1 100644 --- a/python/ccxt/async/exmo.py +++ b/python/ccxt/async/exmo.py @@ -232,6 +232,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if params: url += '?' + self.urlencode(params) else: + self.check_required_credentials() nonce = self.nonce() body = self.urlencode(self.extend({'nonce': nonce}, params)) headers = { diff --git a/python/ccxt/async/flowbtc.py b/python/ccxt/async/flowbtc.py index d3537ce85c7ff..d5262eade2553 100644 --- a/python/ccxt/async/flowbtc.py +++ b/python/ccxt/async/flowbtc.py @@ -2,7 +2,6 @@ from ccxt.async.base.exchange import Exchange from ccxt.base.errors import ExchangeError -from ccxt.base.errors import AuthenticationError class flowbtc (Exchange): @@ -21,6 +20,11 @@ def describe(self): 'www': 'https://trader.flowbtc.com', 'doc': 'http://www.flowbtc.com.br/api/', }, + 'requiredCredentials': { + 'apiKey': True, + 'secret': True, + 'uid': True, + }, 'api': { 'public': { 'post': [ @@ -179,8 +183,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if params: body = self.json(params) else: - if not self.uid: - raise AuthenticationError(self.id + ' requires `' + self.id + '.uid` property for authentication') + self.check_required_credentials() nonce = self.nonce() auth = str(nonce) + self.uid + self.apiKey signature = self.hmac(self.encode(auth), self.encode(self.secret)) diff --git a/python/ccxt/async/foxbit.py b/python/ccxt/async/foxbit.py index bff67d9ce7020..45061000ee889 100644 --- a/python/ccxt/async/foxbit.py +++ b/python/ccxt/async/foxbit.py @@ -156,6 +156,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if query: url += '?' + self.urlencode(query) else: + self.check_required_credentials() nonce = str(self.nonce()) request = self.extend({'MsgType': path}, query) body = self.json(request) diff --git a/python/ccxt/async/fybse.py b/python/ccxt/async/fybse.py index bb47ffa2da441..9ab1ac7cc45e6 100644 --- a/python/ccxt/async/fybse.py +++ b/python/ccxt/async/fybse.py @@ -140,6 +140,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if api == 'public': url += '.json' else: + self.check_required_credentials() nonce = self.nonce() body = self.urlencode(self.extend({'timestamp': nonce}, params)) headers = { diff --git a/python/ccxt/async/gatecoin.py b/python/ccxt/async/gatecoin.py index 45cd24ab5a415..20cd2f1d5c2d7 100644 --- a/python/ccxt/async/gatecoin.py +++ b/python/ccxt/async/gatecoin.py @@ -365,6 +365,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if query: url += '?' + self.urlencode(query) else: + self.check_required_credentials() nonce = self.nonce() contentType = '' if (method == 'GET') else 'application/json' auth = method + url + contentType + str(nonce) diff --git a/python/ccxt/async/gdax.py b/python/ccxt/async/gdax.py index 867cb672eff29..faeb5f391fc69 100644 --- a/python/ccxt/async/gdax.py +++ b/python/ccxt/async/gdax.py @@ -48,6 +48,11 @@ def describe(self): 'www': 'https://www.gdax.com', 'doc': 'https://docs.gdax.com', }, + 'requiredCredentials': { + 'apiKey': True, + 'secret': True, + 'password': True, + }, 'api': { 'public': { 'get': [ @@ -426,12 +431,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N request += '?' + self.urlencode(query) url = self.urls['api'] + request if api == 'private': - if not self.apiKey: - raise AuthenticationError(self.id + ' requires apiKey property for authentication and trading') - if not self.secret: - raise AuthenticationError(self.id + ' requires secret property for authentication and trading') - if not self.password: - raise AuthenticationError(self.id + ' requires password property for authentication and trading') + self.check_required_credentials() nonce = str(self.nonce()) payload = '' if method != 'GET': diff --git a/python/ccxt/async/gemini.py b/python/ccxt/async/gemini.py index f3746d74703a5..029fc3319dfa7 100644 --- a/python/ccxt/async/gemini.py +++ b/python/ccxt/async/gemini.py @@ -177,6 +177,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if query: url += '?' + self.urlencode(query) else: + self.check_required_credentials() nonce = self.nonce() request = self.extend({ 'request': url, diff --git a/python/ccxt/async/hitbtc.py b/python/ccxt/async/hitbtc.py index 80118eb57ea07..6e758244235be 100644 --- a/python/ccxt/async/hitbtc.py +++ b/python/ccxt/async/hitbtc.py @@ -358,6 +358,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if query: url += '?' + self.urlencode(query) else: + self.check_required_credentials() nonce = self.nonce() payload = {'nonce': nonce, 'apikey': self.apiKey} query = self.extend(payload, query) diff --git a/python/ccxt/async/hitbtc2.py b/python/ccxt/async/hitbtc2.py index 924608a32b865..4c6fef20f055a 100644 --- a/python/ccxt/async/hitbtc2.py +++ b/python/ccxt/async/hitbtc2.py @@ -464,6 +464,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if query: url += '?' + self.urlencode(query) else: + self.check_required_credentials() url += self.implode_params(path, params) if method == 'GET': if query: diff --git a/python/ccxt/async/huobi.py b/python/ccxt/async/huobi.py index a88137feb8f28..a508a877a664e 100644 --- a/python/ccxt/async/huobi.py +++ b/python/ccxt/async/huobi.py @@ -204,6 +204,7 @@ async def cancel_order(self, id, symbol=None, params={}): def sign(self, path, api='public', method='GET', params={}, headers=None, body=None): url = self.urls['api'] if api == 'trade': + self.check_required_credentials() url += '/api' + self.version query = self.keysort(self.extend({ 'method': path, diff --git a/python/ccxt/async/huobipro.py b/python/ccxt/async/huobipro.py index 58056df2439be..fc4d4d9a28dd0 100644 --- a/python/ccxt/async/huobipro.py +++ b/python/ccxt/async/huobipro.py @@ -310,6 +310,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N url += '/' + self.implode_params(path, params) query = self.omit(params, self.extract_params(path)) if api == 'private': + self.check_required_credentials() timestamp = self.YmdHMS(self.milliseconds(), 'T') request = self.keysort(self.extend({ 'SignatureMethod': 'HmacSHA256', diff --git a/python/ccxt/async/independentreserve.py b/python/ccxt/async/independentreserve.py index e0927951bbb68..6d92efa3cca75 100644 --- a/python/ccxt/async/independentreserve.py +++ b/python/ccxt/async/independentreserve.py @@ -205,6 +205,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if params: url += '?' + self.urlencode(params) else: + self.check_required_credentials() nonce = self.nonce() auth = [ url, diff --git a/python/ccxt/async/itbit.py b/python/ccxt/async/itbit.py index 4191b769fdd67..5cc5d4a7e02ef 100644 --- a/python/ccxt/async/itbit.py +++ b/python/ccxt/async/itbit.py @@ -189,6 +189,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if query: url += '?' + self.urlencode(query) else: + self.check_required_credentials() if query: body = self.json(query) else: diff --git a/python/ccxt/async/kraken.py b/python/ccxt/async/kraken.py index b41ab64bc8bd9..bb07174cf4dde 100644 --- a/python/ccxt/async/kraken.py +++ b/python/ccxt/async/kraken.py @@ -543,6 +543,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if params: url += '?' + self.urlencode(params) else: + self.check_required_credentials() nonce = str(self.nonce()) body = self.urlencode(self.extend({'nonce': nonce}, params)) auth = self.encode(nonce + body) diff --git a/python/ccxt/async/lakebtc.py b/python/ccxt/async/lakebtc.py index d83732971133b..3fba0c71c93a1 100644 --- a/python/ccxt/async/lakebtc.py +++ b/python/ccxt/async/lakebtc.py @@ -179,6 +179,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if params: url += '?' + self.urlencode(params) else: + self.check_required_credentials() nonce = self.nonce() if params: params = ','.join(params) diff --git a/python/ccxt/async/liqui.py b/python/ccxt/async/liqui.py index d4c4846cf6dd0..992e1455ec3e3 100644 --- a/python/ccxt/async/liqui.py +++ b/python/ccxt/async/liqui.py @@ -522,6 +522,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N url = self.urls['api'][api] query = self.omit(params, self.extract_params(path)) if api == 'private': + self.check_required_credentials() nonce = self.nonce() body = self.urlencode(self.extend({ 'nonce': nonce, diff --git a/python/ccxt/async/livecoin.py b/python/ccxt/async/livecoin.py index 01525082f8f8d..60ce69bdb6d41 100644 --- a/python/ccxt/async/livecoin.py +++ b/python/ccxt/async/livecoin.py @@ -221,6 +221,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if params: url += '?' + query if api == 'private': + self.check_required_credentials() if method == 'POST': body = query signature = self.hmac(self.encode(query), self.encode(self.secret), hashlib.sha256) diff --git a/python/ccxt/async/luno.py b/python/ccxt/async/luno.py index adad82b6a344f..88edba08c5809 100644 --- a/python/ccxt/async/luno.py +++ b/python/ccxt/async/luno.py @@ -224,6 +224,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if query: url += '?' + self.urlencode(query) if api == 'private': + self.check_required_credentials() auth = self.encode(self.apiKey + ':' + self.secret) auth = base64.b64encode(auth) headers = {'Authorization': 'Basic ' + self.decode(auth)} diff --git a/python/ccxt/async/mercado.py b/python/ccxt/async/mercado.py index 16b513ef0e79e..4e7ad921ed960 100644 --- a/python/ccxt/async/mercado.py +++ b/python/ccxt/async/mercado.py @@ -179,6 +179,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if api == 'public': url += self.implode_params(path, params) else: + self.check_required_credentials() url += self.version + '/' nonce = self.nonce() body = self.urlencode(self.extend({ diff --git a/python/ccxt/async/mixcoins.py b/python/ccxt/async/mixcoins.py index 9cf3b6699e0d3..d0d764a4ddef3 100644 --- a/python/ccxt/async/mixcoins.py +++ b/python/ccxt/async/mixcoins.py @@ -145,6 +145,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if params: url += '?' + self.urlencode(params) else: + self.check_required_credentials() nonce = self.nonce() body = self.urlencode(self.extend({ 'nonce': nonce, diff --git a/python/ccxt/async/nova.py b/python/ccxt/async/nova.py index 0706925530844..150610e33bd5d 100644 --- a/python/ccxt/async/nova.py +++ b/python/ccxt/async/nova.py @@ -187,6 +187,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if query: url += '?' + self.urlencode(query) else: + self.check_required_credentials() nonce = str(self.nonce()) url += '?' + self.urlencode({'nonce': nonce}) signature = self.hmac(self.encode(url), self.encode(self.secret), hashlib.sha512, 'base64') diff --git a/python/ccxt/async/okcoinusd.py b/python/ccxt/async/okcoinusd.py index 177d8f567e3bd..2c085eca3d32a 100644 --- a/python/ccxt/async/okcoinusd.py +++ b/python/ccxt/async/okcoinusd.py @@ -494,6 +494,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N url += self.version + '/' url += path + self.extension if api == 'private': + self.check_required_credentials() query = self.keysort(self.extend({ 'api_key': self.apiKey, }, params)) diff --git a/python/ccxt/async/paymium.py b/python/ccxt/async/paymium.py index 033f3f8d2b25f..7efffba2eb769 100644 --- a/python/ccxt/async/paymium.py +++ b/python/ccxt/async/paymium.py @@ -172,6 +172,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if query: url += '?' + self.urlencode(query) else: + self.check_required_credentials() body = self.json(params) nonce = str(self.nonce()) auth = nonce + url + body diff --git a/python/ccxt/async/poloniex.py b/python/ccxt/async/poloniex.py index 0ef024df13cb8..f5ddc62c5a25f 100644 --- a/python/ccxt/async/poloniex.py +++ b/python/ccxt/async/poloniex.py @@ -561,6 +561,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if api == 'public': url += '?' + self.urlencode(query) else: + self.check_required_credentials() query['nonce'] = self.nonce() body = self.urlencode(query) headers = { diff --git a/python/ccxt/async/qryptos.py b/python/ccxt/async/qryptos.py index c6bcd94ce1f2f..89bedd0354ec8 100644 --- a/python/ccxt/async/qryptos.py +++ b/python/ccxt/async/qryptos.py @@ -225,6 +225,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if query: url += '?' + self.urlencode(query) else: + self.check_required_credentials() nonce = self.nonce() request = { 'path': url, diff --git a/python/ccxt/async/quadrigacx.py b/python/ccxt/async/quadrigacx.py index 748d28f9e6a1a..6721af406e7b4 100644 --- a/python/ccxt/async/quadrigacx.py +++ b/python/ccxt/async/quadrigacx.py @@ -2,7 +2,6 @@ from ccxt.async.base.exchange import Exchange from ccxt.base.errors import ExchangeError -from ccxt.base.errors import AuthenticationError class quadrigacx (Exchange): @@ -21,6 +20,11 @@ def describe(self): 'www': 'https://www.quadrigacx.com', 'doc': 'https://www.quadrigacx.com/api_info', }, + 'requiredCredentials': { + 'apiKey': True, + 'secret': True, + 'uid': True, + }, 'api': { 'public': { 'get': [ @@ -151,8 +155,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if api == 'public': url += '?' + self.urlencode(params) else: - if not self.uid: - raise AuthenticationError(self.id + ' requires `' + self.id + '.uid` property for authentication') + self.check_required_credentials() nonce = self.nonce() request = ''.join([str(nonce), self.uid, self.apiKey]) signature = self.hmac(self.encode(request), self.encode(self.secret)) diff --git a/python/ccxt/async/southxchange.py b/python/ccxt/async/southxchange.py index 5c9b9b297de28..f5c7de4efbc45 100644 --- a/python/ccxt/async/southxchange.py +++ b/python/ccxt/async/southxchange.py @@ -198,6 +198,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N url = self.urls['api'] + '/' + self.implode_params(path, params) query = self.omit(params, self.extract_params(path)) if api == 'private': + self.check_required_credentials() nonce = self.nonce() query = self.extend({ 'key': self.apiKey, diff --git a/python/ccxt/async/therock.py b/python/ccxt/async/therock.py index fb3ae605bd192..bfc70b094819f 100644 --- a/python/ccxt/async/therock.py +++ b/python/ccxt/async/therock.py @@ -214,6 +214,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N url = self.urls['api'] + '/' + self.version + '/' + self.implode_params(path, params) query = self.omit(params, self.extract_params(path)) if api == 'private': + self.check_required_credentials() nonce = str(self.nonce()) auth = nonce + url headers = { diff --git a/python/ccxt/async/vaultoro.py b/python/ccxt/async/vaultoro.py index 72294f7016499..58e3818fb69f0 100644 --- a/python/ccxt/async/vaultoro.py +++ b/python/ccxt/async/vaultoro.py @@ -179,6 +179,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if api == 'public': url += path else: + self.check_required_credentials() nonce = self.nonce() url += self.version + '/' + self.implode_params(path, params) query = self.extend({ diff --git a/python/ccxt/async/virwox.py b/python/ccxt/async/virwox.py index f4189ea775dea..c4d3c15a42659 100644 --- a/python/ccxt/async/virwox.py +++ b/python/ccxt/async/virwox.py @@ -22,6 +22,12 @@ def describe(self): 'www': 'https://www.virwox.com', 'doc': 'https://www.virwox.com/developers.php', }, + 'requiredCredentials': { + 'apiKey': True, + 'secret': False, + 'login': True, + 'password': True + }, 'api': { 'public': { 'get': [ @@ -197,6 +203,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N url = self.urls['api'][api] auth = {} if api == 'private': + self.check_required_credentials() auth['key'] = self.apiKey auth['user'] = self.login auth['pass'] = self.password diff --git a/python/ccxt/async/xbtce.py b/python/ccxt/async/xbtce.py index 3e4e4741da51d..fa0f536b1b09d 100644 --- a/python/ccxt/async/xbtce.py +++ b/python/ccxt/async/xbtce.py @@ -29,6 +29,11 @@ def describe(self): 'https://support.xbtce.info/Knowledgebase/Article/View/52/25/xbtce-exchange-api', ], }, + 'requiredCredentials': { + 'apiKey': True, + 'secret': True, + 'uid': True, + }, 'api': { 'public': { 'get': [ @@ -284,7 +289,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if not self.apiKey: raise AuthenticationError(self.id + ' requires apiKey for all requests, their public API is always busy') if not self.uid: - raise AuthenticationError(self.id + ' requires uid property for authentication and trading') + raise AuthenticationError(self.id + ' requires uid property for authentication and trading, their public API is always busy') url = self.urls['api'] + '/' + self.version if api == 'public': url += '/' + api @@ -294,6 +299,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if query: url += '?' + self.urlencode(query) else: + self.check_required_credentials() headers = {'Accept-Encoding': 'gzip, deflate'} nonce = str(self.nonce()) if method == 'POST': diff --git a/python/ccxt/async/zaif.py b/python/ccxt/async/zaif.py index c8e7612bbb5ec..cff6d054a897a 100644 --- a/python/ccxt/async/zaif.py +++ b/python/ccxt/async/zaif.py @@ -301,6 +301,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N elif api == 'fapi': url += 'fapi/' + self.version + '/' + self.implode_params(path, params) else: + self.check_required_credentials() if api == 'ecapi': url += 'ecapi' elif api == 'tlapi': diff --git a/python/ccxt/async/zb.py b/python/ccxt/async/zb.py index a819db94d0744..6c5e110a4d9a4 100644 --- a/python/ccxt/async/zb.py +++ b/python/ccxt/async/zb.py @@ -261,6 +261,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if params: url += '?' + self.urlencode(params) else: + self.check_required_credentials() paramsLength = len(params) # params should be a string here nonce = self.nonce() auth = 'method=' + path diff --git a/python/ccxt/binance.py b/python/ccxt/binance.py index 5321dc04e13b9..7189586889be6 100644 --- a/python/ccxt/binance.py +++ b/python/ccxt/binance.py @@ -547,6 +547,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if api == 'wapi': url += '.html' if (api == 'private') or (api == 'wapi'): + self.check_required_credentials() nonce = self.nonce() query = self.urlencode(self.extend({'timestamp': nonce}, params)) signature = None diff --git a/python/ccxt/bit2c.py b/python/ccxt/bit2c.py index d40d6e563399f..56315641d7f4a 100644 --- a/python/ccxt/bit2c.py +++ b/python/ccxt/bit2c.py @@ -161,6 +161,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if api == 'public': url += '.json' else: + self.check_required_credentials() nonce = self.nonce() query = self.extend({'nonce': nonce}, params) body = self.urlencode(query) diff --git a/python/ccxt/bitbay.py b/python/ccxt/bitbay.py index 11b3de4eaeb25..f5d0c6b44790e 100644 --- a/python/ccxt/bitbay.py +++ b/python/ccxt/bitbay.py @@ -198,6 +198,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if api == 'public': url += '/' + self.implode_params(path, params) + '.json' else: + self.check_required_credentials() body = self.urlencode(self.extend({ 'method': path, 'moment': self.nonce(), diff --git a/python/ccxt/bitcoincoid.py b/python/ccxt/bitcoincoid.py index da3098a78c001..08dbd7cd71c7b 100644 --- a/python/ccxt/bitcoincoid.py +++ b/python/ccxt/bitcoincoid.py @@ -159,6 +159,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if api == 'public': url += '/' + self.implode_params(path, params) else: + self.check_required_credentials() body = self.urlencode(self.extend({ 'method': path, 'nonce': self.nonce(), diff --git a/python/ccxt/bitfinex.py b/python/ccxt/bitfinex.py index e0c898dc7f864..798180dd211b2 100644 --- a/python/ccxt/bitfinex.py +++ b/python/ccxt/bitfinex.py @@ -479,6 +479,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N url += suffix request += suffix if api == 'private': + self.check_required_credentials() nonce = self.nonce() query = self.extend({ 'nonce': str(nonce), diff --git a/python/ccxt/bitfinex2.py b/python/ccxt/bitfinex2.py index 50a956eb2cfc7..5ec285b8551b2 100644 --- a/python/ccxt/bitfinex2.py +++ b/python/ccxt/bitfinex2.py @@ -364,6 +364,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if query: url += '?' + self.urlencode(query) else: + self.check_required_credentials() nonce = str(self.nonce()) body = self.json(query) auth = '/api' + '/' + request + nonce + body diff --git a/python/ccxt/bitflyer.py b/python/ccxt/bitflyer.py index 1329c05885f56..9097427b3819c 100644 --- a/python/ccxt/bitflyer.py +++ b/python/ccxt/bitflyer.py @@ -226,6 +226,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N request += '?' + self.urlencode(params) url = self.urls['api'] + request if api == 'private': + self.check_required_credentials() nonce = str(self.nonce()) body = self.json(params) auth = ''.join([nonce, method, request, body]) diff --git a/python/ccxt/bithumb.py b/python/ccxt/bithumb.py index a9da98b06bd37..bab4deca1b677 100644 --- a/python/ccxt/bithumb.py +++ b/python/ccxt/bithumb.py @@ -222,6 +222,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if query: url += '?' + self.urlencode(query) else: + self.check_required_credentials() body = self.urlencode(self.extend({ 'endpoint': endpoint, }, query)) diff --git a/python/ccxt/bitlish.py b/python/ccxt/bitlish.py index aecc183f1478d..bc7642b0077c1 100644 --- a/python/ccxt/bitlish.py +++ b/python/ccxt/bitlish.py @@ -23,6 +23,10 @@ def describe(self): 'www': 'https://bitlish.com', 'doc': 'https://bitlish.com/api', }, + 'requiredCredentials': { + 'apiKey': True, + 'secret': False, + }, 'api': { 'public': { 'get': [ @@ -274,6 +278,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N body = self.json(params) headers = {'Content-Type': 'application/json'} else: + self.check_required_credentials() body = self.json(self.extend({'token': self.apiKey}, params)) headers = {'Content-Type': 'application/json'} return {'url': url, 'method': method, 'body': body, 'headers': headers} diff --git a/python/ccxt/bitmarket.py b/python/ccxt/bitmarket.py index 3f38aa77e0760..15b31cc2d6d05 100644 --- a/python/ccxt/bitmarket.py +++ b/python/ccxt/bitmarket.py @@ -270,6 +270,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if api == 'public': url += '/' + self.implode_params(path + '.json', params) else: + self.check_required_credentials() nonce = self.nonce() query = self.extend({ 'tonce': nonce, diff --git a/python/ccxt/bitmex.py b/python/ccxt/bitmex.py index 05de758689e4f..b3ff8ce51d41c 100644 --- a/python/ccxt/bitmex.py +++ b/python/ccxt/bitmex.py @@ -374,6 +374,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N query += '?' + self.urlencode(params) url = self.urls['api'] + query if api == 'private': + self.check_required_credentials() nonce = str(self.nonce()) if method == 'POST': if params: diff --git a/python/ccxt/bitso.py b/python/ccxt/bitso.py index 066d8e70a12cc..f402767eb9a2f 100644 --- a/python/ccxt/bitso.py +++ b/python/ccxt/bitso.py @@ -221,6 +221,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if params: url += '?' + self.urlencode(params) else: + self.check_required_credentials() nonce = str(self.nonce()) request = ''.join([nonce, method, query]) if params: diff --git a/python/ccxt/bitstamp.py b/python/ccxt/bitstamp.py index df0955c10cb32..599e37941cadd 100644 --- a/python/ccxt/bitstamp.py +++ b/python/ccxt/bitstamp.py @@ -2,7 +2,6 @@ from ccxt.base.exchange import Exchange from ccxt.base.errors import ExchangeError -from ccxt.base.errors import AuthenticationError class bitstamp (Exchange): @@ -22,6 +21,11 @@ def describe(self): 'www': 'https://www.bitstamp.net', 'doc': 'https://www.bitstamp.net/api', }, + 'requiredCredentials': { + 'apiKey': True, + 'secret': True, + 'uid': True, + }, 'api': { 'public': { 'get': [ @@ -238,8 +242,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if query: url += '?' + self.urlencode(query) else: - if not self.uid: - raise AuthenticationError(self.id + ' requires `' + self.id + '.uid` property for authentication') + self.check_required_credentials() nonce = str(self.nonce()) auth = nonce + self.uid + self.apiKey signature = self.encode(self.hmac(self.encode(auth), self.encode(self.secret))) diff --git a/python/ccxt/bitstamp1.py b/python/ccxt/bitstamp1.py index 81b7a0a4d2eab..58d20eba4e3aa 100644 --- a/python/ccxt/bitstamp1.py +++ b/python/ccxt/bitstamp1.py @@ -3,7 +3,6 @@ from ccxt.base.exchange import Exchange from ccxt.base.errors import ExchangeError from ccxt.base.errors import NotSupported -from ccxt.base.errors import AuthenticationError class bitstamp1 (Exchange): @@ -22,6 +21,11 @@ def describe(self): 'www': 'https://www.bitstamp.net', 'doc': 'https://www.bitstamp.net/api', }, + 'requiredCredentials': { + 'apiKey': True, + 'secret': True, + 'uid': True, + }, 'api': { 'public': { 'get': [ @@ -207,8 +211,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if query: url += '?' + self.urlencode(query) else: - if not self.uid: - raise AuthenticationError(self.id + ' requires `' + self.id + '.uid` property for authentication') + self.check_required_credentials() nonce = str(self.nonce()) auth = nonce + self.uid + self.apiKey signature = self.encode(self.hmac(self.encode(auth), self.encode(self.secret))) diff --git a/python/ccxt/bittrex.py b/python/ccxt/bittrex.py index 8dfd44e803b5a..de41f68ebcc44 100644 --- a/python/ccxt/bittrex.py +++ b/python/ccxt/bittrex.py @@ -509,6 +509,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if params: url += '?' + self.urlencode(params) else: + self.check_required_credentials() nonce = self.nonce() url += api + '/' if ((api == 'account') and(path != 'withdraw')) or (path == 'openorders'): diff --git a/python/ccxt/bl3p.py b/python/ccxt/bl3p.py index e67f04ac22caa..8ae80e69c655d 100644 --- a/python/ccxt/bl3p.py +++ b/python/ccxt/bl3p.py @@ -168,6 +168,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if query: url += '?' + self.urlencode(query) else: + self.check_required_credentials() nonce = self.nonce() body = self.urlencode(self.extend({'nonce': nonce}, query)) secret = base64.b64decode(self.secret) diff --git a/python/ccxt/btcbox.py b/python/ccxt/btcbox.py index 55a3bc42f9162..72b5423ee480c 100644 --- a/python/ccxt/btcbox.py +++ b/python/ccxt/btcbox.py @@ -181,6 +181,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if params: url += '?' + self.urlencode(params) else: + self.check_required_credentials() nonce = str(self.nonce()) query = self.extend({ 'key': self.apiKey, diff --git a/python/ccxt/btcchina.py b/python/ccxt/btcchina.py index 613eafe66ef46..aba93f323db5b 100644 --- a/python/ccxt/btcchina.py +++ b/python/ccxt/btcchina.py @@ -3,7 +3,6 @@ from ccxt.base.exchange import Exchange import base64 import hashlib -from ccxt.base.errors import AuthenticationError class btcchina (Exchange): @@ -280,10 +279,7 @@ def nonce(self): def sign(self, path, api='public', method='GET', params={}, headers=None, body=None): url = self.urls['api'][api] + '/' + path if api == 'private': - if not self.apiKey: - raise AuthenticationError(self.id + ' requires `' + self.id + '.apiKey` property for authentication') - if not self.secret: - raise AuthenticationError(self.id + ' requires `' + self.id + '.secret` property for authentication') + self.check_required_credentials() p = [] if 'params' in params: p = params['params'] diff --git a/python/ccxt/btcmarkets.py b/python/ccxt/btcmarkets.py index 06f11c5908f2d..897fd2792ec67 100644 --- a/python/ccxt/btcmarkets.py +++ b/python/ccxt/btcmarkets.py @@ -187,6 +187,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if params: url += '?' + self.urlencode(params) else: + self.check_required_credentials() nonce = str(self.nonce()) auth = uri + "\n" + nonce + "\n" headers = { diff --git a/python/ccxt/btctradeua.py b/python/ccxt/btctradeua.py index 0c04ebacd2271..21f608ff56f41 100644 --- a/python/ccxt/btctradeua.py +++ b/python/ccxt/btctradeua.py @@ -279,6 +279,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if query: url += self.implode_params(path, query) else: + self.check_required_credentials() nonce = self.nonce() body = self.urlencode(self.extend({ 'out_order_id': nonce, diff --git a/python/ccxt/btcturk.py b/python/ccxt/btcturk.py index f8aab61bbe76a..f5d08f4a0d553 100644 --- a/python/ccxt/btcturk.py +++ b/python/ccxt/btcturk.py @@ -202,6 +202,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if params: url += '?' + self.urlencode(params) else: + self.check_required_credentials() nonce = self.nonce().toString body = self.urlencode(params) secret = self.base64ToString(self.secret) diff --git a/python/ccxt/btcx.py b/python/ccxt/btcx.py index e44e39530fc20..f1c317a4ce92d 100644 --- a/python/ccxt/btcx.py +++ b/python/ccxt/btcx.py @@ -138,6 +138,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if api == 'public': url += self.implode_params(path, params) else: + self.check_required_credentials() nonce = self.nonce() url += api body = self.urlencode(self.extend({ diff --git a/python/ccxt/bter.py b/python/ccxt/bter.py index bf1088b6855e0..dc6bfdb8f1a60 100644 --- a/python/ccxt/bter.py +++ b/python/ccxt/bter.py @@ -247,6 +247,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if query: url += '?' + self.urlencode(query) else: + self.check_required_credentials() nonce = self.nonce() request = {'nonce': nonce} body = self.urlencode(self.extend(request, query)) diff --git a/python/ccxt/bxinth.py b/python/ccxt/bxinth.py index 2f77e8e86c9fd..5587c05a8af44 100644 --- a/python/ccxt/bxinth.py +++ b/python/ccxt/bxinth.py @@ -219,6 +219,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if params: url += '?' + self.urlencode(params) if api == 'private': + self.check_required_credentials() nonce = self.nonce() auth = self.apiKey + str(nonce) + self.secret signature = self.hash(self.encode(auth), 'sha256') diff --git a/python/ccxt/ccex.py b/python/ccxt/ccex.py index 83b04065d0eb3..c5d6c245dcccb 100644 --- a/python/ccxt/ccex.py +++ b/python/ccxt/ccex.py @@ -224,6 +224,7 @@ def cancel_order(self, id, symbol=None, params={}): def sign(self, path, api='public', method='GET', params={}, headers=None, body=None): url = self.urls['api'][api] if api == 'private': + self.check_required_credentials() nonce = str(self.nonce()) query = self.keysort(self.extend({ 'a': path, diff --git a/python/ccxt/cex.py b/python/ccxt/cex.py index 5e4d8167a9daf..9e651a586914f 100644 --- a/python/ccxt/cex.py +++ b/python/ccxt/cex.py @@ -4,7 +4,6 @@ import math import json from ccxt.base.errors import ExchangeError -from ccxt.base.errors import AuthenticationError class cex (Exchange): @@ -28,6 +27,11 @@ def describe(self): 'www': 'https://cex.io', 'doc': 'https://cex.io/cex-api', }, + 'requiredCredentials': { + 'apiKey': True, + 'secret': True, + 'uid': True, + }, 'api': { 'public': { 'get': [ @@ -356,8 +360,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if query: url += '?' + self.urlencode(query) else: - if not self.uid: - raise AuthenticationError(self.id + ' requires `' + self.id + '.uid` property for authentication') + self.check_required_credentials() nonce = str(self.nonce()) auth = nonce + self.uid + self.apiKey signature = self.hmac(self.encode(auth), self.encode(self.secret)) diff --git a/python/ccxt/coincheck.py b/python/ccxt/coincheck.py index 0d49653ce08d2..a3487ee73e2e8 100644 --- a/python/ccxt/coincheck.py +++ b/python/ccxt/coincheck.py @@ -190,6 +190,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if query: url += '?' + self.urlencode(query) else: + self.check_required_credentials() nonce = str(self.nonce()) if query: body = self.urlencode(self.keysort(query)) diff --git a/python/ccxt/coinfloor.py b/python/ccxt/coinfloor.py index 84654d1176d53..e1be4ff4772ba 100644 --- a/python/ccxt/coinfloor.py +++ b/python/ccxt/coinfloor.py @@ -23,6 +23,11 @@ def describe(self): 'https://www.coinfloor.co.uk/api', ], }, + 'requiredCredentials': { + 'apiKey': True, + 'secret': True, + 'uid': True, + }, 'api': { 'public': { 'get': [ @@ -155,6 +160,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if query: url += '?' + self.urlencode(query) else: + self.check_required_credentials() nonce = self.nonce() body = self.urlencode(self.extend({'nonce': nonce}, query)) auth = self.uid + '/' + self.apiKey + ':' + self.password diff --git a/python/ccxt/coingi.py b/python/ccxt/coingi.py index acd7731be60da..13697e484f11b 100644 --- a/python/ccxt/coingi.py +++ b/python/ccxt/coingi.py @@ -187,6 +187,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if query: url += '?' + self.urlencode(query) else: + self.check_required_credentials() nonce = self.nonce() request = self.extend({ 'token': self.apiKey, diff --git a/python/ccxt/coinmarketcap.py b/python/ccxt/coinmarketcap.py index d0a178ce3d80a..4af2f5cbc6123 100644 --- a/python/ccxt/coinmarketcap.py +++ b/python/ccxt/coinmarketcap.py @@ -27,6 +27,10 @@ def describe(self): 'www': 'https://coinmarketcap.com', 'doc': 'https://coinmarketcap.com/api', }, + 'requiredCredentials': { + 'apiKey': False, + 'secret': False, + }, 'api': { 'public': { 'get': [ diff --git a/python/ccxt/coinmate.py b/python/ccxt/coinmate.py index b9a3f925e81b7..d746aac061ec6 100644 --- a/python/ccxt/coinmate.py +++ b/python/ccxt/coinmate.py @@ -2,7 +2,6 @@ from ccxt.base.exchange import Exchange from ccxt.base.errors import ExchangeError -from ccxt.base.errors import AuthenticationError class coinmate (Exchange): @@ -23,6 +22,11 @@ def describe(self): 'https://coinmate.io/developers', ], }, + 'requiredCredentials': { + 'apiKey': True, + 'secret': True, + 'uid': True, + }, 'api': { 'public': { 'get': [ @@ -166,8 +170,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if params: url += '?' + self.urlencode(params) else: - if not self.uid: - raise AuthenticationError(self.id + ' requires `' + self.id + '.uid` property for authentication') + self.check_required_credentials() nonce = str(self.nonce()) auth = nonce + self.uid + self.apiKey signature = self.hmac(self.encode(auth), self.encode(self.secret)) diff --git a/python/ccxt/coinsecure.py b/python/ccxt/coinsecure.py index 94e29eeb56a54..851d875766d77 100644 --- a/python/ccxt/coinsecure.py +++ b/python/ccxt/coinsecure.py @@ -23,6 +23,10 @@ def describe(self): 'https://github.com/coinsecure/plugins', ], }, + 'requiredCredentials': { + 'apiKey': True, + 'secret': False, + }, 'api': { 'public': { 'get': [ @@ -252,6 +256,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N url = self.urls['api'] + '/' + self.version + '/' + self.implode_params(path, params) query = self.omit(params, self.extract_params(path)) if api == 'private': + self.check_required_credentials() headers = {'Authorization': self.apiKey} if query: body = self.json(query) diff --git a/python/ccxt/coinspot.py b/python/ccxt/coinspot.py index ad10d2c4f20cc..c9379d6c61f47 100644 --- a/python/ccxt/coinspot.py +++ b/python/ccxt/coinspot.py @@ -136,6 +136,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N raise AuthenticationError(self.id + ' requires apiKey for all requests') url = self.urls['api'][api] + '/' + path if api == 'private': + self.check_required_credentials() nonce = self.nonce() body = self.json(self.extend({'nonce': nonce}, params)) headers = { diff --git a/python/ccxt/cryptopia.py b/python/ccxt/cryptopia.py index 47dac73985049..3e4cfc5d98632 100644 --- a/python/ccxt/cryptopia.py +++ b/python/ccxt/cryptopia.py @@ -459,6 +459,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if query: url += '?' + self.urlencode(query) else: + self.check_required_credentials() nonce = str(self.nonce()) body = self.json(query) hash = self.hash(self.encode(body), 'md5', 'base64') diff --git a/python/ccxt/exmo.py b/python/ccxt/exmo.py index d7d2d0cb92d8f..952ea81fd1e55 100644 --- a/python/ccxt/exmo.py +++ b/python/ccxt/exmo.py @@ -232,6 +232,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if params: url += '?' + self.urlencode(params) else: + self.check_required_credentials() nonce = self.nonce() body = self.urlencode(self.extend({'nonce': nonce}, params)) headers = { diff --git a/python/ccxt/flowbtc.py b/python/ccxt/flowbtc.py index 200c83e304b69..2153a8b8e2852 100644 --- a/python/ccxt/flowbtc.py +++ b/python/ccxt/flowbtc.py @@ -2,7 +2,6 @@ from ccxt.base.exchange import Exchange from ccxt.base.errors import ExchangeError -from ccxt.base.errors import AuthenticationError class flowbtc (Exchange): @@ -21,6 +20,11 @@ def describe(self): 'www': 'https://trader.flowbtc.com', 'doc': 'http://www.flowbtc.com.br/api/', }, + 'requiredCredentials': { + 'apiKey': True, + 'secret': True, + 'uid': True, + }, 'api': { 'public': { 'post': [ @@ -179,8 +183,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if params: body = self.json(params) else: - if not self.uid: - raise AuthenticationError(self.id + ' requires `' + self.id + '.uid` property for authentication') + self.check_required_credentials() nonce = self.nonce() auth = str(nonce) + self.uid + self.apiKey signature = self.hmac(self.encode(auth), self.encode(self.secret)) diff --git a/python/ccxt/foxbit.py b/python/ccxt/foxbit.py index ffce8b964c17d..e3e8b5a0dce07 100644 --- a/python/ccxt/foxbit.py +++ b/python/ccxt/foxbit.py @@ -156,6 +156,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if query: url += '?' + self.urlencode(query) else: + self.check_required_credentials() nonce = str(self.nonce()) request = self.extend({'MsgType': path}, query) body = self.json(request) diff --git a/python/ccxt/fybse.py b/python/ccxt/fybse.py index d45bac696fad1..3c88fec5ff731 100644 --- a/python/ccxt/fybse.py +++ b/python/ccxt/fybse.py @@ -140,6 +140,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if api == 'public': url += '.json' else: + self.check_required_credentials() nonce = self.nonce() body = self.urlencode(self.extend({'timestamp': nonce}, params)) headers = { diff --git a/python/ccxt/gatecoin.py b/python/ccxt/gatecoin.py index d823239b413bd..5219888afffc7 100644 --- a/python/ccxt/gatecoin.py +++ b/python/ccxt/gatecoin.py @@ -365,6 +365,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if query: url += '?' + self.urlencode(query) else: + self.check_required_credentials() nonce = self.nonce() contentType = '' if (method == 'GET') else 'application/json' auth = method + url + contentType + str(nonce) diff --git a/python/ccxt/gdax.py b/python/ccxt/gdax.py index 69c81db18007b..0372920539a46 100644 --- a/python/ccxt/gdax.py +++ b/python/ccxt/gdax.py @@ -48,6 +48,11 @@ def describe(self): 'www': 'https://www.gdax.com', 'doc': 'https://docs.gdax.com', }, + 'requiredCredentials': { + 'apiKey': True, + 'secret': True, + 'password': True, + }, 'api': { 'public': { 'get': [ @@ -426,12 +431,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N request += '?' + self.urlencode(query) url = self.urls['api'] + request if api == 'private': - if not self.apiKey: - raise AuthenticationError(self.id + ' requires apiKey property for authentication and trading') - if not self.secret: - raise AuthenticationError(self.id + ' requires secret property for authentication and trading') - if not self.password: - raise AuthenticationError(self.id + ' requires password property for authentication and trading') + self.check_required_credentials() nonce = str(self.nonce()) payload = '' if method != 'GET': diff --git a/python/ccxt/gemini.py b/python/ccxt/gemini.py index ca9500f51e751..a0d9b617e9cf1 100644 --- a/python/ccxt/gemini.py +++ b/python/ccxt/gemini.py @@ -177,6 +177,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if query: url += '?' + self.urlencode(query) else: + self.check_required_credentials() nonce = self.nonce() request = self.extend({ 'request': url, diff --git a/python/ccxt/hitbtc.py b/python/ccxt/hitbtc.py index 73eba6f56d46d..722ce4cf11106 100644 --- a/python/ccxt/hitbtc.py +++ b/python/ccxt/hitbtc.py @@ -358,6 +358,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if query: url += '?' + self.urlencode(query) else: + self.check_required_credentials() nonce = self.nonce() payload = {'nonce': nonce, 'apikey': self.apiKey} query = self.extend(payload, query) diff --git a/python/ccxt/hitbtc2.py b/python/ccxt/hitbtc2.py index 1e176905ee4b5..dceb3c388e64d 100644 --- a/python/ccxt/hitbtc2.py +++ b/python/ccxt/hitbtc2.py @@ -464,6 +464,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if query: url += '?' + self.urlencode(query) else: + self.check_required_credentials() url += self.implode_params(path, params) if method == 'GET': if query: diff --git a/python/ccxt/huobi.py b/python/ccxt/huobi.py index 8b6d45227cbbf..20825c650ea6c 100644 --- a/python/ccxt/huobi.py +++ b/python/ccxt/huobi.py @@ -204,6 +204,7 @@ def cancel_order(self, id, symbol=None, params={}): def sign(self, path, api='public', method='GET', params={}, headers=None, body=None): url = self.urls['api'] if api == 'trade': + self.check_required_credentials() url += '/api' + self.version query = self.keysort(self.extend({ 'method': path, diff --git a/python/ccxt/huobipro.py b/python/ccxt/huobipro.py index eab4ec2dba41a..bf70a3c957f99 100644 --- a/python/ccxt/huobipro.py +++ b/python/ccxt/huobipro.py @@ -310,6 +310,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N url += '/' + self.implode_params(path, params) query = self.omit(params, self.extract_params(path)) if api == 'private': + self.check_required_credentials() timestamp = self.YmdHMS(self.milliseconds(), 'T') request = self.keysort(self.extend({ 'SignatureMethod': 'HmacSHA256', diff --git a/python/ccxt/independentreserve.py b/python/ccxt/independentreserve.py index e730d36fe215b..cbbf50ec70239 100644 --- a/python/ccxt/independentreserve.py +++ b/python/ccxt/independentreserve.py @@ -205,6 +205,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if params: url += '?' + self.urlencode(params) else: + self.check_required_credentials() nonce = self.nonce() auth = [ url, diff --git a/python/ccxt/itbit.py b/python/ccxt/itbit.py index 03db95f2e667c..a2a63bae8d64a 100644 --- a/python/ccxt/itbit.py +++ b/python/ccxt/itbit.py @@ -189,6 +189,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if query: url += '?' + self.urlencode(query) else: + self.check_required_credentials() if query: body = self.json(query) else: diff --git a/python/ccxt/kraken.py b/python/ccxt/kraken.py index 1ce72948a407d..0b933e54ace84 100644 --- a/python/ccxt/kraken.py +++ b/python/ccxt/kraken.py @@ -543,6 +543,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if params: url += '?' + self.urlencode(params) else: + self.check_required_credentials() nonce = str(self.nonce()) body = self.urlencode(self.extend({'nonce': nonce}, params)) auth = self.encode(nonce + body) diff --git a/python/ccxt/lakebtc.py b/python/ccxt/lakebtc.py index 4e14198809590..07197ef0892d8 100644 --- a/python/ccxt/lakebtc.py +++ b/python/ccxt/lakebtc.py @@ -179,6 +179,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if params: url += '?' + self.urlencode(params) else: + self.check_required_credentials() nonce = self.nonce() if params: params = ','.join(params) diff --git a/python/ccxt/liqui.py b/python/ccxt/liqui.py index f84decc0f8505..8b58f2eba62af 100644 --- a/python/ccxt/liqui.py +++ b/python/ccxt/liqui.py @@ -522,6 +522,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N url = self.urls['api'][api] query = self.omit(params, self.extract_params(path)) if api == 'private': + self.check_required_credentials() nonce = self.nonce() body = self.urlencode(self.extend({ 'nonce': nonce, diff --git a/python/ccxt/livecoin.py b/python/ccxt/livecoin.py index afe4a91ec736e..51d46e6864a5e 100644 --- a/python/ccxt/livecoin.py +++ b/python/ccxt/livecoin.py @@ -221,6 +221,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if params: url += '?' + query if api == 'private': + self.check_required_credentials() if method == 'POST': body = query signature = self.hmac(self.encode(query), self.encode(self.secret), hashlib.sha256) diff --git a/python/ccxt/luno.py b/python/ccxt/luno.py index 031ee5c45aa44..e08eb5a6f7a98 100644 --- a/python/ccxt/luno.py +++ b/python/ccxt/luno.py @@ -224,6 +224,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if query: url += '?' + self.urlencode(query) if api == 'private': + self.check_required_credentials() auth = self.encode(self.apiKey + ':' + self.secret) auth = base64.b64encode(auth) headers = {'Authorization': 'Basic ' + self.decode(auth)} diff --git a/python/ccxt/mercado.py b/python/ccxt/mercado.py index 3d84658ade36d..48850311f267c 100644 --- a/python/ccxt/mercado.py +++ b/python/ccxt/mercado.py @@ -179,6 +179,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if api == 'public': url += self.implode_params(path, params) else: + self.check_required_credentials() url += self.version + '/' nonce = self.nonce() body = self.urlencode(self.extend({ diff --git a/python/ccxt/mixcoins.py b/python/ccxt/mixcoins.py index 67b1c95d029e8..d57cf4173d5aa 100644 --- a/python/ccxt/mixcoins.py +++ b/python/ccxt/mixcoins.py @@ -145,6 +145,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if params: url += '?' + self.urlencode(params) else: + self.check_required_credentials() nonce = self.nonce() body = self.urlencode(self.extend({ 'nonce': nonce, diff --git a/python/ccxt/nova.py b/python/ccxt/nova.py index 3d785a2eb5aca..4a02614c8a734 100644 --- a/python/ccxt/nova.py +++ b/python/ccxt/nova.py @@ -187,6 +187,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if query: url += '?' + self.urlencode(query) else: + self.check_required_credentials() nonce = str(self.nonce()) url += '?' + self.urlencode({'nonce': nonce}) signature = self.hmac(self.encode(url), self.encode(self.secret), hashlib.sha512, 'base64') diff --git a/python/ccxt/okcoinusd.py b/python/ccxt/okcoinusd.py index 9627d9862d11d..00649816a0136 100644 --- a/python/ccxt/okcoinusd.py +++ b/python/ccxt/okcoinusd.py @@ -494,6 +494,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N url += self.version + '/' url += path + self.extension if api == 'private': + self.check_required_credentials() query = self.keysort(self.extend({ 'api_key': self.apiKey, }, params)) diff --git a/python/ccxt/paymium.py b/python/ccxt/paymium.py index 00d2edc3d6e39..471facb5267c7 100644 --- a/python/ccxt/paymium.py +++ b/python/ccxt/paymium.py @@ -172,6 +172,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if query: url += '?' + self.urlencode(query) else: + self.check_required_credentials() body = self.json(params) nonce = str(self.nonce()) auth = nonce + url + body diff --git a/python/ccxt/poloniex.py b/python/ccxt/poloniex.py index 51c56d6a38383..e2841f38b3853 100644 --- a/python/ccxt/poloniex.py +++ b/python/ccxt/poloniex.py @@ -561,6 +561,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if api == 'public': url += '?' + self.urlencode(query) else: + self.check_required_credentials() query['nonce'] = self.nonce() body = self.urlencode(query) headers = { diff --git a/python/ccxt/qryptos.py b/python/ccxt/qryptos.py index 5e0f6a58974df..a8dccd2f312ad 100644 --- a/python/ccxt/qryptos.py +++ b/python/ccxt/qryptos.py @@ -225,6 +225,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if query: url += '?' + self.urlencode(query) else: + self.check_required_credentials() nonce = self.nonce() request = { 'path': url, diff --git a/python/ccxt/quadrigacx.py b/python/ccxt/quadrigacx.py index 1eff650cde222..8647e566c1c2f 100644 --- a/python/ccxt/quadrigacx.py +++ b/python/ccxt/quadrigacx.py @@ -2,7 +2,6 @@ from ccxt.base.exchange import Exchange from ccxt.base.errors import ExchangeError -from ccxt.base.errors import AuthenticationError class quadrigacx (Exchange): @@ -21,6 +20,11 @@ def describe(self): 'www': 'https://www.quadrigacx.com', 'doc': 'https://www.quadrigacx.com/api_info', }, + 'requiredCredentials': { + 'apiKey': True, + 'secret': True, + 'uid': True, + }, 'api': { 'public': { 'get': [ @@ -151,8 +155,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if api == 'public': url += '?' + self.urlencode(params) else: - if not self.uid: - raise AuthenticationError(self.id + ' requires `' + self.id + '.uid` property for authentication') + self.check_required_credentials() nonce = self.nonce() request = ''.join([str(nonce), self.uid, self.apiKey]) signature = self.hmac(self.encode(request), self.encode(self.secret)) diff --git a/python/ccxt/southxchange.py b/python/ccxt/southxchange.py index 4ffd0a12a91be..8d31b44fcd0a8 100644 --- a/python/ccxt/southxchange.py +++ b/python/ccxt/southxchange.py @@ -198,6 +198,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N url = self.urls['api'] + '/' + self.implode_params(path, params) query = self.omit(params, self.extract_params(path)) if api == 'private': + self.check_required_credentials() nonce = self.nonce() query = self.extend({ 'key': self.apiKey, diff --git a/python/ccxt/therock.py b/python/ccxt/therock.py index bb3a4f6efac0a..1aa2cfb7f62eb 100644 --- a/python/ccxt/therock.py +++ b/python/ccxt/therock.py @@ -214,6 +214,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N url = self.urls['api'] + '/' + self.version + '/' + self.implode_params(path, params) query = self.omit(params, self.extract_params(path)) if api == 'private': + self.check_required_credentials() nonce = str(self.nonce()) auth = nonce + url headers = { diff --git a/python/ccxt/vaultoro.py b/python/ccxt/vaultoro.py index 1b72f5c0a00eb..348ca472cb6a5 100644 --- a/python/ccxt/vaultoro.py +++ b/python/ccxt/vaultoro.py @@ -179,6 +179,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if api == 'public': url += path else: + self.check_required_credentials() nonce = self.nonce() url += self.version + '/' + self.implode_params(path, params) query = self.extend({ diff --git a/python/ccxt/virwox.py b/python/ccxt/virwox.py index fb1d6bb36f451..75406bc9e6245 100644 --- a/python/ccxt/virwox.py +++ b/python/ccxt/virwox.py @@ -22,6 +22,12 @@ def describe(self): 'www': 'https://www.virwox.com', 'doc': 'https://www.virwox.com/developers.php', }, + 'requiredCredentials': { + 'apiKey': True, + 'secret': False, + 'login': True, + 'password': True + }, 'api': { 'public': { 'get': [ @@ -197,6 +203,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N url = self.urls['api'][api] auth = {} if api == 'private': + self.check_required_credentials() auth['key'] = self.apiKey auth['user'] = self.login auth['pass'] = self.password diff --git a/python/ccxt/xbtce.py b/python/ccxt/xbtce.py index d09cfc39edb91..a63a0c37a7e0b 100644 --- a/python/ccxt/xbtce.py +++ b/python/ccxt/xbtce.py @@ -29,6 +29,11 @@ def describe(self): 'https://support.xbtce.info/Knowledgebase/Article/View/52/25/xbtce-exchange-api', ], }, + 'requiredCredentials': { + 'apiKey': True, + 'secret': True, + 'uid': True, + }, 'api': { 'public': { 'get': [ @@ -284,7 +289,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if not self.apiKey: raise AuthenticationError(self.id + ' requires apiKey for all requests, their public API is always busy') if not self.uid: - raise AuthenticationError(self.id + ' requires uid property for authentication and trading') + raise AuthenticationError(self.id + ' requires uid property for authentication and trading, their public API is always busy') url = self.urls['api'] + '/' + self.version if api == 'public': url += '/' + api @@ -294,6 +299,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if query: url += '?' + self.urlencode(query) else: + self.check_required_credentials() headers = {'Accept-Encoding': 'gzip, deflate'} nonce = str(self.nonce()) if method == 'POST': diff --git a/python/ccxt/zaif.py b/python/ccxt/zaif.py index 5a8f92de314af..34f988fdb4e5d 100644 --- a/python/ccxt/zaif.py +++ b/python/ccxt/zaif.py @@ -301,6 +301,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N elif api == 'fapi': url += 'fapi/' + self.version + '/' + self.implode_params(path, params) else: + self.check_required_credentials() if api == 'ecapi': url += 'ecapi' elif api == 'tlapi': diff --git a/python/ccxt/zb.py b/python/ccxt/zb.py index 1131d0cacc01b..76d0e9b495446 100644 --- a/python/ccxt/zb.py +++ b/python/ccxt/zb.py @@ -261,6 +261,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N if params: url += '?' + self.urlencode(params) else: + self.check_required_credentials() paramsLength = len(params) # params should be a string here nonce = self.nonce() auth = 'method=' + path diff --git a/python/test-bitfinex.py b/python/test-bitfinex.py deleted file mode 100644 index 0f137c086a8bb..0000000000000 --- a/python/test-bitfinex.py +++ /dev/null @@ -1,13 +0,0 @@ -import ccxt -import time - -bitfinex = ccxt.bitfinex({ - "apiKey": "VM9UCkrumj7VRMeRwRdTDxNudfaVLcknvbSVCsbSNTH", - "secret": "ZqEtFicQAem6p1hmfayhJynulPG2ic7vhNRG9tJwuk0", - "verbose": True, -}) - -print(bitfinex.fetch_balance()) -time.sleep(5) -print(bitfinex.symbols) -print(bitfinex.create_order('BTC/USD', 'limit', 'buy', '0.01', '5500'))