From 0c431d141589fe6b2e097d555478eb67357ea2ee Mon Sep 17 00:00:00 2001 From: Igor Kroitor Date: Fri, 19 Oct 2018 04:32:20 +0300 Subject: [PATCH] theocean parseOrder status = failed case --- js/theocean.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/js/theocean.js b/js/theocean.js index 88b1e75be1d21..c856c962a7414 100644 --- a/js/theocean.js +++ b/js/theocean.js @@ -942,11 +942,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) { @@ -1014,13 +1018,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 = {