Skip to content

Commit

Permalink
Merge pull request ccxt#1777 from wannesdemaeght/master
Browse files Browse the repository at this point in the history
Kucoin parseOrder was not working correctly for fetchOrder
  • Loading branch information
kroitor authored Feb 5, 2018
2 parents 6dd1c61 + 3d70cdb commit e3973cc
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions js/kucoin.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ module.exports = class kucoin extends Exchange {
'name': currency['name'],
'active': active,
'status': 'ok',
'fee': currency['withdrawFeeRate'], // todo: redesign
'fee': currency['withdrawMinFee'], // todo: redesign
'precision': precision,
'limits': {
'amount': {
Expand Down Expand Up @@ -297,11 +297,11 @@ module.exports = class kucoin extends Exchange {
symbol = order['coinType'] + '/' + order['coinTypePair'];
}
let timestamp = this.safeValue (order, 'createdAt');
let price = this.safeValue (order, 'price');
let price = this.safeFloat (order, 'price');
if (typeof price === 'undefined')
price = this.safeValue (order, 'dealPrice');
price = this.safeFloat (order, 'dealPrice');
if (typeof price === 'undefined')
price = this.safeValue (order, 'dealPriceAverage');
price = this.safeFloat (order, 'dealPriceAverage');
let remaining = this.safeFloat (order, 'pendingAmount');
let status = this.safeValue (order, 'status');
let filled = this.safeFloat (order, 'dealAmount');
Expand All @@ -312,12 +312,15 @@ module.exports = class kucoin extends Exchange {
else
status = 'closed';
}
if (typeof status !== 'undefined') {
if (status === 'closed')
filled = this.safeFloat (order, 'amount');
if (typeof filled === 'undefined') {
if (typeof status !== 'undefined')
if (status === 'closed')
filled = this.safeFloat (order, 'amount');
}
let amount = this.safeFloat (order, 'amount');
let cost = this.safeFloat (order, 'dealValue');
if (typeof cost === 'undefined')
cost = this.safeFloat (order, 'dealValueTotal');
if (typeof filled !== 'undefined') {
if (typeof price !== 'undefined') {
if (typeof cost === 'undefined')
Expand All @@ -336,7 +339,7 @@ module.exports = class kucoin extends Exchange {
let fee = undefined;
if ('feeTotal' in order) {
fee = {
'cost': this.safeValue (order, 'feeTotal'),
'cost': this.safeFloat (order, 'feeTotal'),
'rate': undefined,
'currency': undefined,
};
Expand Down

0 comments on commit e3973cc

Please sign in to comment.