Skip to content

Commit

Permalink
1.18.148
Browse files Browse the repository at this point in the history
[ci skip]
  • Loading branch information
Travis CI committed Jan 24, 2019
1 parent aa68435 commit ca10897
Show file tree
Hide file tree
Showing 12 changed files with 301 additions and 19 deletions.
77 changes: 73 additions & 4 deletions build/ccxt.browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const Exchange = require ('./js/base/Exchange')
//-----------------------------------------------------------------------------
// this is updated by vss.js when building

const version = '1.18.147'
const version = '1.18.148'

Exchange.ccxtVersion = version

Expand Down Expand Up @@ -33529,7 +33529,7 @@ module.exports = class cryptopia extends Exchange {
// ---------------------------------------------------------------------------

const Exchange = require ('./base/Exchange');
const { AuthenticationError, PermissionDenied } = require ('./base/errors');
const { AuthenticationError, ExchangeError, PermissionDenied, InvalidOrder, OrderNotFound, DDoSProtection, NotSupported, ExchangeNotAvailable, InsufficientFunds } = require ('./base/errors');

// ---------------------------------------------------------------------------

Expand Down Expand Up @@ -33599,8 +33599,59 @@ module.exports = class deribit extends Exchange {
},
},
'exceptions': {
'Invalid API Key.': AuthenticationError,
'Access Denied': PermissionDenied,
// 0 or absent Success, No error
'9999': PermissionDenied, // "api_not_enabled" User didn't enable API for the Account
'10000': AuthenticationError, // "authorization_required" Authorization issue, invalid or absent signature etc
'10001': ExchangeError, // "error" Some general failure, no public information available
'10002': InvalidOrder, // "qty_too_low" Order quantity is too low
'10003': InvalidOrder, // "order_overlap" Rejection, order overlap is found and self-trading is not enabled
'10004': OrderNotFound, // "order_not_found" Attempt to operate with order that can't be found by specified id
'10005': InvalidOrder, // "price_too_low <Limit>" Price is too low, <Limit> defines current limit for the operation
'10006': InvalidOrder, // "price_too_low4idx <Limit>" Price is too low for current index, <Limit> defines current bottom limit for the operation
'10007': InvalidOrder, // "price_too_high <Limit>" Price is too high, <Limit> defines current up limit for the operation
'10008': InvalidOrder, // "price_too_high4idx <Limit>" Price is too high for current index, <Limit> defines current up limit for the operation
'10009': InsufficientFunds, // "not_enough_funds" Account has not enough funds for the operation
'10010': OrderNotFound, // "already_closed" Attempt of doing something with closed order
'10011': InvalidOrder, // "price_not_allowed" This price is not allowed for some reason
'10012': InvalidOrder, // "book_closed" Operation for instrument which order book had been closed
'10013': PermissionDenied, // "pme_max_total_open_orders <Limit>" Total limit of open orders has been exceeded, it is applicable for PME users
'10014': PermissionDenied, // "pme_max_future_open_orders <Limit>" Limit of count of futures' open orders has been exceeded, it is applicable for PME users
'10015': PermissionDenied, // "pme_max_option_open_orders <Limit>" Limit of count of options' open orders has been exceeded, it is applicable for PME users
'10016': PermissionDenied, // "pme_max_future_open_orders_size <Limit>" Limit of size for futures has been exceeded, it is applicable for PME users
'10017': PermissionDenied, // "pme_max_option_open_orders_size <Limit>" Limit of size for options has been exceeded, it is applicable for PME users
'10019': PermissionDenied, // "locked_by_admin" Trading is temporary locked by admin
'10020': ExchangeError, // "invalid_or_unsupported_instrument" Instrument name is not valid
'10022': InvalidOrder, // "invalid_quantity" quantity was not recognized as a valid number
'10023': InvalidOrder, // "invalid_price" price was not recognized as a valid number
'10024': InvalidOrder, // "invalid_max_show" max_show parameter was not recognized as a valid number
'10025': InvalidOrder, // "invalid_order_id" Order id is missing or its format was not recognized as valid
'10026': InvalidOrder, // "price_precision_exceeded" Extra precision of the price is not supported
'10027': InvalidOrder, // "non_integer_contract_amount" Futures contract amount was not recognized as integer
'10028': DDoSProtection, // "too_many_requests" Allowed request rate has been exceeded
'10029': OrderNotFound, // "not_owner_of_order" Attempt to operate with not own order
'10030': ExchangeError, // "must_be_websocket_request" REST request where Websocket is expected
'10031': ExchangeError, // "invalid_args_for_instrument" Some of arguments are not recognized as valid
'10032': InvalidOrder, // "whole_cost_too_low" Total cost is too low
'10033': NotSupported, // "not_implemented" Method is not implemented yet
'10034': InvalidOrder, // "stop_price_too_high" Stop price is too high
'10035': InvalidOrder, // "stop_price_too_low" Stop price is too low
'11035': InvalidOrder, // "no_more_stops <Limit>" Allowed amount of stop orders has been exceeded
'11036': InvalidOrder, // "invalid_stoppx_for_index_or_last" Invalid StopPx (too high or too low) as to current index or market
'11037': InvalidOrder, // "outdated_instrument_for_IV_order" Instrument already not available for trading
'11038': InvalidOrder, // "no_adv_for_futures" Advanced orders are not available for futures
'11039': InvalidOrder, // "no_adv_postonly" Advanced post-only orders are not supported yet
'11040': InvalidOrder, // "impv_not_in_range 0..499%" Implied volatility is out of allowed range
'11041': InvalidOrder, // "not_adv_order" Advanced order properties can't be set if the order is not advanced
'11042': PermissionDenied, // "permission_denied" Permission for the operation has been denied
'11044': OrderNotFound, // "not_open_order" Attempt to do open order operations with the not open order
'11045': ExchangeError, // "invalid_event" Event name has not been recognized
'11046': ExchangeError, // "outdated_instrument" At several minutes to instrument expiration, corresponding advanced implied volatility orders are not allowed
'11047': ExchangeError, // "unsupported_arg_combination" The specified combination of arguments is not supported
'11048': ExchangeError, // "not_on_this_server" The requested operation is not available on this server.
'11050': ExchangeError, // "invalid_request" Request has not been parsed properly
'11051': ExchangeNotAvailable, // "system_maintenance" System is under maintenance
'11030': ExchangeError, // "other_reject <Reason>" Some rejects which are not considered as very often, more info may be specified in <Reason>
'11031': ExchangeError, // "other_error <Error>" Some errors which are not considered as very often, more info may be specified in <Error>
},
'options': {
'fetchTickerQuotes': true,
Expand Down Expand Up @@ -33957,6 +34008,24 @@ module.exports = class deribit extends Exchange {
}
return { 'url': url, 'method': method, 'body': body, 'headers': headers };
}

handleErrors (httpCode, reason, url, method, headers, body, response) {
if (!response) {
return; // fallback to default error handler
}
//
// {"usOut":1535877098645376,"usIn":1535877098643364,"usDiff":2012,"testnet":false,"success":false,"message":"order_not_found","error":10004}
//
const error = this.safeString (response, 'error');
if ((error !== undefined) && (error !== '0')) {
const feedback = this.id + ' ' + body;
const exceptions = this.exceptions;
if (error in exceptions) {
throw new exceptions[error] (feedback);
}
throw new ExchangeError (feedback); // unknown message
}
}
};

},{"./base/Exchange":8,"./base/errors":10}],85:[function(require,module,exports){
Expand Down
2 changes: 1 addition & 1 deletion ccxt.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const Exchange = require ('./js/base/Exchange')
//-----------------------------------------------------------------------------
// this is updated by vss.js when building

const version = '1.18.147'
const version = '1.18.148'

Exchange.ccxtVersion = version

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ccxt",
"version": "1.18.147",
"version": "1.18.148",
"description": "A JavaScript / Python / PHP cryptocurrency trading library with support for 100+ exchanges",
"main": "./ccxt.js",
"unpkg": "build/ccxt.browser.js",
Expand Down
4 changes: 2 additions & 2 deletions php/Exchange.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
use kornrunner\Secp256k1;
use kornrunner\Solidity;

$version = '1.18.147';
$version = '1.18.148';

// rounding mode
const TRUNCATE = 0;
Expand All @@ -50,7 +50,7 @@

class Exchange {

const VERSION = '1.18.147';
const VERSION = '1.18.148';

public static $eth_units = array (
'wei' => '1',
Expand Down
73 changes: 71 additions & 2 deletions php/deribit.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,59 @@ public function describe () {
),
),
'exceptions' => array (
'Invalid API Key.' => '\\ccxt\\AuthenticationError',
'Access Denied' => '\\ccxt\\PermissionDenied',
// 0 or absent Success, No error
'9999' => '\\ccxt\\PermissionDenied', // "api_not_enabled" User didn't enable API for the Account
'10000' => '\\ccxt\\AuthenticationError', // "authorization_required" Authorization issue, invalid or absent signature etc
'10001' => '\\ccxt\\ExchangeError', // "error" Some general failure, no public information available
'10002' => '\\ccxt\\InvalidOrder', // "qty_too_low" Order quantity is too low
'10003' => '\\ccxt\\InvalidOrder', // "order_overlap" Rejection, order overlap is found and self-trading is not enabled
'10004' => '\\ccxt\\OrderNotFound', // "order_not_found" Attempt to operate with order that can't be found by specified id
'10005' => '\\ccxt\\InvalidOrder', // "price_too_low {Limit}" Price is too low, {Limit} defines current limit for the operation
'10006' => '\\ccxt\\InvalidOrder', // "price_too_low4idx {Limit}" Price is too low for current index, {Limit} defines current bottom limit for the operation
'10007' => '\\ccxt\\InvalidOrder', // "price_too_high {Limit}" Price is too high, {Limit} defines current up limit for the operation
'10008' => '\\ccxt\\InvalidOrder', // "price_too_high4idx {Limit}" Price is too high for current index, {Limit} defines current up limit for the operation
'10009' => '\\ccxt\\InsufficientFunds', // "not_enough_funds" Account has not enough funds for the operation
'10010' => '\\ccxt\\OrderNotFound', // "already_closed" Attempt of doing something with closed order
'10011' => '\\ccxt\\InvalidOrder', // "price_not_allowed" This price is not allowed for some reason
'10012' => '\\ccxt\\InvalidOrder', // "book_closed" Operation for instrument which order book had been closed
'10013' => '\\ccxt\\PermissionDenied', // "pme_max_total_open_orders {Limit}" Total limit of open orders has been exceeded, it is applicable for PME users
'10014' => '\\ccxt\\PermissionDenied', // "pme_max_future_open_orders {Limit}" Limit of count of futures' open orders has been exceeded, it is applicable for PME users
'10015' => '\\ccxt\\PermissionDenied', // "pme_max_option_open_orders {Limit}" Limit of count of options' open orders has been exceeded, it is applicable for PME users
'10016' => '\\ccxt\\PermissionDenied', // "pme_max_future_open_orders_size {Limit}" Limit of size for futures has been exceeded, it is applicable for PME users
'10017' => '\\ccxt\\PermissionDenied', // "pme_max_option_open_orders_size {Limit}" Limit of size for options has been exceeded, it is applicable for PME users
'10019' => '\\ccxt\\PermissionDenied', // "locked_by_admin" Trading is temporary locked by admin
'10020' => '\\ccxt\\ExchangeError', // "invalid_or_unsupported_instrument" Instrument name is not valid
'10022' => '\\ccxt\\InvalidOrder', // "invalid_quantity" quantity was not recognized as a valid number
'10023' => '\\ccxt\\InvalidOrder', // "invalid_price" price was not recognized as a valid number
'10024' => '\\ccxt\\InvalidOrder', // "invalid_max_show" max_show parameter was not recognized as a valid number
'10025' => '\\ccxt\\InvalidOrder', // "invalid_order_id" Order id is missing or its format was not recognized as valid
'10026' => '\\ccxt\\InvalidOrder', // "price_precision_exceeded" Extra precision of the price is not supported
'10027' => '\\ccxt\\InvalidOrder', // "non_integer_contract_amount" Futures contract amount was not recognized as integer
'10028' => '\\ccxt\\DDoSProtection', // "too_many_requests" Allowed request rate has been exceeded
'10029' => '\\ccxt\\OrderNotFound', // "not_owner_of_order" Attempt to operate with not own order
'10030' => '\\ccxt\\ExchangeError', // "must_be_websocket_request" REST request where Websocket is expected
'10031' => '\\ccxt\\ExchangeError', // "invalid_args_for_instrument" Some of arguments are not recognized as valid
'10032' => '\\ccxt\\InvalidOrder', // "whole_cost_too_low" Total cost is too low
'10033' => '\\ccxt\\NotSupported', // "not_implemented" Method is not implemented yet
'10034' => '\\ccxt\\InvalidOrder', // "stop_price_too_high" Stop price is too high
'10035' => '\\ccxt\\InvalidOrder', // "stop_price_too_low" Stop price is too low
'11035' => '\\ccxt\\InvalidOrder', // "no_more_stops {Limit}" Allowed amount of stop orders has been exceeded
'11036' => '\\ccxt\\InvalidOrder', // "invalid_stoppx_for_index_or_last" Invalid StopPx (too high or too low) as to current index or market
'11037' => '\\ccxt\\InvalidOrder', // "outdated_instrument_for_IV_order" Instrument already not available for trading
'11038' => '\\ccxt\\InvalidOrder', // "no_adv_for_futures" Advanced orders are not available for futures
'11039' => '\\ccxt\\InvalidOrder', // "no_adv_postonly" Advanced post-only orders are not supported yet
'11040' => '\\ccxt\\InvalidOrder', // "impv_not_in_range 0..499%" Implied volatility is out of allowed range
'11041' => '\\ccxt\\InvalidOrder', // "not_adv_order" Advanced order properties can't be set if the order is not advanced
'11042' => '\\ccxt\\PermissionDenied', // "permission_denied" Permission for the operation has been denied
'11044' => '\\ccxt\\OrderNotFound', // "not_open_order" Attempt to do open order operations with the not open order
'11045' => '\\ccxt\\ExchangeError', // "invalid_event" Event name has not been recognized
'11046' => '\\ccxt\\ExchangeError', // "outdated_instrument" At several minutes to instrument expiration, corresponding advanced implied volatility orders are not allowed
'11047' => '\\ccxt\\ExchangeError', // "unsupported_arg_combination" The specified combination of arguments is not supported
'11048' => '\\ccxt\\ExchangeError', // "not_on_this_server" The requested operation is not available on this server.
'11050' => '\\ccxt\\ExchangeError', // "invalid_request" Request has not been parsed properly
'11051' => '\\ccxt\\ExchangeNotAvailable', // "system_maintenance" System is under maintenance
'11030' => '\\ccxt\\ExchangeError', // "other_reject {Reason}" Some rejects which are not considered as very often, more info may be specified in {Reason}
'11031' => '\\ccxt\\ExchangeError', // "other_error {Error}" Some errors which are not considered as very often, more info may be specified in {Error}
),
'options' => array (
'fetchTickerQuotes' => true,
Expand Down Expand Up @@ -432,4 +483,22 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array (
}
return array ( 'url' => $url, 'method' => $method, 'body' => $body, 'headers' => $headers );
}

public function handle_errors ($httpCode, $reason, $url, $method, $headers, $body, $response) {
if (!$response) {
return; // fallback to default $error handler
}
//
// array ("usOut":1535877098645376,"usIn":1535877098643364,"usDiff":2012,"testnet":false,"success":false,"message":"order_not_found","$error":10004)
//
$error = $this->safe_string($response, 'error');
if (($error !== null) && ($error !== '0')) {
$feedback = $this->id . ' ' . $body;
$exceptions = $this->exceptions;
if (is_array ($exceptions) && array_key_exists ($error, $exceptions)) {
throw new $exceptions[$error] ($feedback);
}
throw new ExchangeError ($feedback); // unknown message
}
}
}
2 changes: 1 addition & 1 deletion python/ccxt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

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

__version__ = '1.18.147'
__version__ = '1.18.148'

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

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

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

__version__ = '1.18.147'
__version__ = '1.18.148'

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

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

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

__version__ = '1.18.147'
__version__ = '1.18.148'

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

Expand Down
Loading

0 comments on commit ca10897

Please sign in to comment.