diff --git a/build/ccxt.browser.js b/build/ccxt.browser.js index 4ede2038c899a..f5240e4b5dac3 100644 --- a/build/ccxt.browser.js +++ b/build/ccxt.browser.js @@ -45,7 +45,7 @@ const Exchange = require ('./js/base/Exchange') //----------------------------------------------------------------------------- // this is updated by vss.js when building -const version = '1.17.393' +const version = '1.17.394' Exchange.ccxtVersion = version @@ -52548,6 +52548,7 @@ module.exports = class theocean extends Exchange { 'CORS': false, // ? 'fetchTickers': true, 'fetchOHLCV': false, + 'fetchOrder': true, 'fetchOrders': true, 'fetchOpenOrders': true, 'fetchClosedOrders': true, @@ -53428,7 +53429,7 @@ module.exports = class theocean extends Exchange { id = this.safeString (zeroExOrder, 'orderHash'); } let side = this.safeString (order, 'side'); - let type = 'limit'; + let type = this.safeString (order, 'type'); // injected from outside let timestamp = this.safeInteger (order, 'created'); timestamp = (timestamp !== undefined) ? timestamp * 1000 : timestamp; let symbol = undefined; @@ -53463,11 +53464,15 @@ module.exports = class theocean extends Exchange { let lastTradeTimestamp = undefined; let timeline = this.safeValue (order, 'timeline'); let trades = undefined; + let status = undefined; if (timeline !== undefined) { let numEvents = timeline.length; if (numEvents > 0) { // status = this.parseOrderStatus (this.safeString (timeline[numEvents - 1], 'action')); let timelineEventsGroupedByAction = this.groupBy (timeline, 'action'); + if ('error' in timelineEventsGroupedByAction) { + status = 'failed'; + } if ('placed' in timelineEventsGroupedByAction) { let placeEvents = this.safeValue (timelineEventsGroupedByAction, 'placed'); if (amount === undefined) { @@ -53480,7 +53485,6 @@ module.exports = class theocean extends Exchange { timestamp = this.safeInteger (timelineEventsGroupedByAction['filled'][0], 'timestamp'); timestamp = (timestamp !== undefined) ? timestamp * 1000 : timestamp; } - type = 'market'; } if ('filled' in timelineEventsGroupedByAction) { let fillEvents = this.safeValue (timelineEventsGroupedByAction, 'filled'); @@ -53536,13 +53540,14 @@ module.exports = class theocean extends Exchange { 'сurrency': feeCurrency, }; } - let status = undefined; let amountPrecision = market ? market['precision']['amount'] : 8; if (remaining !== undefined) { - status = 'open'; - const rest = remaining - failedAmount - deadAmount - prunedAmount; - if (rest < Math.pow (10, -amountPrecision)) { - status = (filled < amount) ? 'canceled' : 'closed'; + if (status === undefined) { + status = 'open'; + const rest = remaining - failedAmount - deadAmount - prunedAmount; + if (rest < Math.pow (10, -amountPrecision)) { + status = (filled < amount) ? 'canceled' : 'closed'; + } } } let result = { diff --git a/ccxt.js b/ccxt.js index 4979299a681fd..f3419ef62f606 100644 --- a/ccxt.js +++ b/ccxt.js @@ -37,7 +37,7 @@ const Exchange = require ('./js/base/Exchange') //----------------------------------------------------------------------------- // this is updated by vss.js when building -const version = '1.17.393' +const version = '1.17.394' Exchange.ccxtVersion = version diff --git a/package-lock.json b/package-lock.json index a660e2a0139da..5d78520fdb717 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "ccxt", - "version": "1.17.393", + "version": "1.17.394", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 5427a5eb3554c..47713d3523ac1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ccxt", - "version": "1.17.393", + "version": "1.17.394", "description": "A JavaScript / Python / PHP cryptocurrency trading library with support for 100+ exchanges", "main": "./ccxt.js", "unpkg": "build/ccxt.browser.js", diff --git a/php/Exchange.php b/php/Exchange.php index e86ed977482b6..168fbfe9db434 100644 --- a/php/Exchange.php +++ b/php/Exchange.php @@ -34,7 +34,7 @@ use kornrunner\Secp256k1; use kornrunner\Solidity; -$version = '1.17.393'; +$version = '1.17.394'; // rounding mode const TRUNCATE = 0; @@ -50,7 +50,7 @@ class Exchange { - const VERSION = '1.17.393'; + const VERSION = '1.17.394'; public static $eth_units = array ( 'wei' => '1', diff --git a/php/theocean.php b/php/theocean.php index 1591a6fc5f39c..86d1a5d880158 100644 --- a/php/theocean.php +++ b/php/theocean.php @@ -31,6 +31,7 @@ public function describe () { 'CORS' => false, // ? 'fetchTickers' => true, 'fetchOHLCV' => false, + 'fetchOrder' => true, 'fetchOrders' => true, 'fetchOpenOrders' => true, 'fetchClosedOrders' => true, @@ -911,7 +912,7 @@ public function parse_order ($order, $market = null) { $id = $this->safe_string($zeroExOrder, 'orderHash'); } $side = $this->safe_string($order, 'side'); - $type = 'limit'; + $type = $this->safe_string($order, 'type'); // injected from outside $timestamp = $this->safe_integer($order, 'created'); $timestamp = ($timestamp !== null) ? $timestamp * 1000 : $timestamp; $symbol = null; @@ -946,11 +947,15 @@ public function parse_order ($order, $market = null) { $lastTradeTimestamp = null; $timeline = $this->safe_value($order, 'timeline'); $trades = null; + $status = null; if ($timeline !== null) { $numEvents = is_array ($timeline) ? count ($timeline) : 0; if ($numEvents > 0) { // $status = $this->parse_order_status($this->safe_string($timeline[$numEvents - 1], 'action')); $timelineEventsGroupedByAction = $this->group_by($timeline, 'action'); + if (is_array ($timelineEventsGroupedByAction) && array_key_exists ('error', $timelineEventsGroupedByAction)) { + $status = 'failed'; + } if (is_array ($timelineEventsGroupedByAction) && array_key_exists ('placed', $timelineEventsGroupedByAction)) { $placeEvents = $this->safe_value($timelineEventsGroupedByAction, 'placed'); if ($amount === null) { @@ -963,7 +968,6 @@ public function parse_order ($order, $market = null) { $timestamp = $this->safe_integer($timelineEventsGroupedByAction['filled'][0], 'timestamp'); $timestamp = ($timestamp !== null) ? $timestamp * 1000 : $timestamp; } - $type = 'market'; } if (is_array ($timelineEventsGroupedByAction) && array_key_exists ('filled', $timelineEventsGroupedByAction)) { $fillEvents = $this->safe_value($timelineEventsGroupedByAction, 'filled'); @@ -1019,13 +1023,14 @@ public function parse_order ($order, $market = null) { 'сurrency' => $feeCurrency, ); } - $status = null; $amountPrecision = $market ? $market['precision']['amount'] : 8; if ($remaining !== null) { - $status = 'open'; - $rest = $remaining - $failedAmount - $deadAmount - $prunedAmount; - if ($rest < pow (10, -$amountPrecision)) { - $status = ($filled < $amount) ? 'canceled' : 'closed'; + if ($status === null) { + $status = 'open'; + $rest = $remaining - $failedAmount - $deadAmount - $prunedAmount; + if ($rest < pow (10, -$amountPrecision)) { + $status = ($filled < $amount) ? 'canceled' : 'closed'; + } } } $result = array ( diff --git a/python/ccxt/__init__.py b/python/ccxt/__init__.py index 9e35765434f21..039856ba214a2 100644 --- a/python/ccxt/__init__.py +++ b/python/ccxt/__init__.py @@ -22,7 +22,7 @@ # ---------------------------------------------------------------------------- -__version__ = '1.17.393' +__version__ = '1.17.394' # ---------------------------------------------------------------------------- diff --git a/python/ccxt/async_support/__init__.py b/python/ccxt/async_support/__init__.py index 59ee11f2a77f4..4131a694ffc39 100644 --- a/python/ccxt/async_support/__init__.py +++ b/python/ccxt/async_support/__init__.py @@ -4,7 +4,7 @@ # ----------------------------------------------------------------------------- -__version__ = '1.17.393' +__version__ = '1.17.394' # ----------------------------------------------------------------------------- diff --git a/python/ccxt/async_support/base/exchange.py b/python/ccxt/async_support/base/exchange.py index 11012e87e3c73..a6abc171863a2 100644 --- a/python/ccxt/async_support/base/exchange.py +++ b/python/ccxt/async_support/base/exchange.py @@ -2,7 +2,7 @@ # ----------------------------------------------------------------------------- -__version__ = '1.17.393' +__version__ = '1.17.394' # ----------------------------------------------------------------------------- diff --git a/python/ccxt/async_support/theocean.py b/python/ccxt/async_support/theocean.py index cfc87c3f464ad..18cf905870427 100644 --- a/python/ccxt/async_support/theocean.py +++ b/python/ccxt/async_support/theocean.py @@ -52,6 +52,7 @@ def describe(self): 'CORS': False, # ? 'fetchTickers': True, 'fetchOHLCV': False, + 'fetchOrder': True, 'fetchOrders': True, 'fetchOpenOrders': True, 'fetchClosedOrders': True, @@ -881,7 +882,7 @@ def parse_order(self, order, market=None): if (id is None) and(zeroExOrder is not None): id = self.safe_string(zeroExOrder, 'orderHash') side = self.safe_string(order, 'side') - type = 'limit' + type = self.safe_string(order, 'type') # injected from outside timestamp = self.safe_integer(order, 'created') timestamp = timestamp * 1000 if (timestamp is not None) else timestamp symbol = None @@ -913,11 +914,14 @@ def parse_order(self, order, market=None): lastTradeTimestamp = None timeline = self.safe_value(order, 'timeline') trades = None + status = None if timeline is not None: numEvents = len(timeline) if numEvents > 0: # status = self.parse_order_status(self.safe_string(timeline[numEvents - 1], 'action')) timelineEventsGroupedByAction = self.group_by(timeline, 'action') + if 'error' in timelineEventsGroupedByAction: + status = 'failed' if 'placed' in timelineEventsGroupedByAction: placeEvents = self.safe_value(timelineEventsGroupedByAction, 'placed') if amount is None: @@ -928,7 +932,6 @@ def parse_order(self, order, market=None): if 'filled' in timelineEventsGroupedByAction: timestamp = self.safe_integer(timelineEventsGroupedByAction['filled'][0], 'timestamp') timestamp = timestamp * 1000 if (timestamp is not None) else timestamp - type = 'market' if 'filled' in timelineEventsGroupedByAction: fillEvents = self.safe_value(timelineEventsGroupedByAction, 'filled') numFillEvents = len(fillEvents) @@ -971,13 +974,13 @@ def parse_order(self, order, market=None): 'сost': self.fromWei(feeCost, 'ether', feeDecimals), 'сurrency': feeCurrency, } - status = None amountPrecision = market['precision']['amount'] if market else 8 if remaining is not None: - status = 'open' - rest = remaining - failedAmount - deadAmount - prunedAmount - if rest < math.pow(10, -amountPrecision): - status = 'canceled' if (filled < amount) else 'closed' + if status is None: + status = 'open' + rest = remaining - failedAmount - deadAmount - prunedAmount + if rest < math.pow(10, -amountPrecision): + status = 'canceled' if (filled < amount) else 'closed' result = { 'info': order, 'id': id, diff --git a/python/ccxt/base/exchange.py b/python/ccxt/base/exchange.py index 8b992ec001388..e99b9a33b9879 100644 --- a/python/ccxt/base/exchange.py +++ b/python/ccxt/base/exchange.py @@ -4,7 +4,7 @@ # ----------------------------------------------------------------------------- -__version__ = '1.17.393' +__version__ = '1.17.394' # ----------------------------------------------------------------------------- diff --git a/python/ccxt/theocean.py b/python/ccxt/theocean.py index a8ddf593ebedf..8b9f127bd95ed 100644 --- a/python/ccxt/theocean.py +++ b/python/ccxt/theocean.py @@ -52,6 +52,7 @@ def describe(self): 'CORS': False, # ? 'fetchTickers': True, 'fetchOHLCV': False, + 'fetchOrder': True, 'fetchOrders': True, 'fetchOpenOrders': True, 'fetchClosedOrders': True, @@ -881,7 +882,7 @@ def parse_order(self, order, market=None): if (id is None) and(zeroExOrder is not None): id = self.safe_string(zeroExOrder, 'orderHash') side = self.safe_string(order, 'side') - type = 'limit' + type = self.safe_string(order, 'type') # injected from outside timestamp = self.safe_integer(order, 'created') timestamp = timestamp * 1000 if (timestamp is not None) else timestamp symbol = None @@ -913,11 +914,14 @@ def parse_order(self, order, market=None): lastTradeTimestamp = None timeline = self.safe_value(order, 'timeline') trades = None + status = None if timeline is not None: numEvents = len(timeline) if numEvents > 0: # status = self.parse_order_status(self.safe_string(timeline[numEvents - 1], 'action')) timelineEventsGroupedByAction = self.group_by(timeline, 'action') + if 'error' in timelineEventsGroupedByAction: + status = 'failed' if 'placed' in timelineEventsGroupedByAction: placeEvents = self.safe_value(timelineEventsGroupedByAction, 'placed') if amount is None: @@ -928,7 +932,6 @@ def parse_order(self, order, market=None): if 'filled' in timelineEventsGroupedByAction: timestamp = self.safe_integer(timelineEventsGroupedByAction['filled'][0], 'timestamp') timestamp = timestamp * 1000 if (timestamp is not None) else timestamp - type = 'market' if 'filled' in timelineEventsGroupedByAction: fillEvents = self.safe_value(timelineEventsGroupedByAction, 'filled') numFillEvents = len(fillEvents) @@ -971,13 +974,13 @@ def parse_order(self, order, market=None): 'сost': self.fromWei(feeCost, 'ether', feeDecimals), 'сurrency': feeCurrency, } - status = None amountPrecision = market['precision']['amount'] if market else 8 if remaining is not None: - status = 'open' - rest = remaining - failedAmount - deadAmount - prunedAmount - if rest < math.pow(10, -amountPrecision): - status = 'canceled' if (filled < amount) else 'closed' + if status is None: + status = 'open' + rest = remaining - failedAmount - deadAmount - prunedAmount + if rest < math.pow(10, -amountPrecision): + status = 'canceled' if (filled < amount) else 'closed' result = { 'info': order, 'id': id,