ccxt 4.0.82 → 4.0.83
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/ccxt.browser.js +166 -84
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +0 -1
- package/dist/cjs/src/bigone.js +1 -1
- package/dist/cjs/src/binance.js +1 -1
- package/dist/cjs/src/bitfinex2.js +2 -1
- package/dist/cjs/src/bitmart.js +9 -6
- package/dist/cjs/src/bittrex.js +14 -1
- package/dist/cjs/src/bybit.js +68 -53
- package/dist/cjs/src/exmo.js +41 -3
- package/dist/cjs/src/gate.js +1 -5
- package/dist/cjs/src/kucoin.js +7 -2
- package/dist/cjs/src/latoken.js +8 -4
- package/dist/cjs/src/lykke.js +2 -1
- package/dist/cjs/src/ndax.js +6 -1
- package/dist/cjs/src/pro/gate.js +5 -2
- package/dist/cjs/src/yobit.js +0 -1
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/base/Exchange.d.ts +0 -1
- package/js/src/base/Exchange.js +0 -1
- package/js/src/bigone.js +1 -1
- package/js/src/binance.js +1 -1
- package/js/src/bitfinex2.js +2 -1
- package/js/src/bitmart.js +9 -6
- package/js/src/bittrex.js +14 -1
- package/js/src/bybit.js +68 -53
- package/js/src/exmo.js +41 -3
- package/js/src/gate.js +1 -5
- package/js/src/kucoin.js +7 -2
- package/js/src/latoken.js +8 -4
- package/js/src/lykke.js +2 -1
- package/js/src/ndax.js +6 -1
- package/js/src/pro/gate.js +5 -2
- package/js/src/yobit.js +0 -1
- package/package.json +1 -1
package/js/src/binance.js
CHANGED
|
@@ -280,7 +280,7 @@ export default class binance extends Exchange {
|
|
|
280
280
|
'capital/deposit/hisrec': 0.1,
|
|
281
281
|
'capital/deposit/subAddress': 0.1,
|
|
282
282
|
'capital/deposit/subHisrec': 0.1,
|
|
283
|
-
'capital/withdraw/history':
|
|
283
|
+
'capital/withdraw/history': 1800,
|
|
284
284
|
'capital/contract/convertible-coins': 4.0002,
|
|
285
285
|
'convert/tradeFlow': 20.001,
|
|
286
286
|
'convert/exchangeInfo': 50,
|
package/js/src/bitfinex2.js
CHANGED
|
@@ -702,7 +702,8 @@ export default class bitfinex2 extends Exchange {
|
|
|
702
702
|
const label = this.safeValue(indexed['label'], id, []);
|
|
703
703
|
const name = this.safeString(label, 1);
|
|
704
704
|
const pool = this.safeValue(indexed['pool'], id, []);
|
|
705
|
-
const
|
|
705
|
+
const rawType = this.safeString(pool, 1);
|
|
706
|
+
const type = (rawType === undefined) ? 'other' : 'crypto';
|
|
706
707
|
const feeValues = this.safeValue(indexed['fees'], id, []);
|
|
707
708
|
const fees = this.safeValue(feeValues, 1, []);
|
|
708
709
|
const fee = this.safeNumber(fees, 1);
|
package/js/src/bitmart.js
CHANGED
|
@@ -1473,11 +1473,13 @@ export default class bitmart extends Exchange {
|
|
|
1473
1473
|
request[fromRequest] = start;
|
|
1474
1474
|
request[toRequest] = Math.min(end, now);
|
|
1475
1475
|
}
|
|
1476
|
-
let
|
|
1476
|
+
let response = undefined;
|
|
1477
1477
|
if (type === 'swap') {
|
|
1478
|
-
|
|
1478
|
+
response = await this.publicGetContractPublicKline(this.extend(request, params));
|
|
1479
|
+
}
|
|
1480
|
+
else {
|
|
1481
|
+
response = await this.publicGetSpotQuotationV3Klines(this.extend(request, params));
|
|
1479
1482
|
}
|
|
1480
|
-
const response = await this[method](this.extend(request, params));
|
|
1481
1483
|
//
|
|
1482
1484
|
// spot
|
|
1483
1485
|
//
|
|
@@ -1514,8 +1516,7 @@ export default class bitmart extends Exchange {
|
|
|
1514
1516
|
// }
|
|
1515
1517
|
//
|
|
1516
1518
|
const data = this.safeValue(response, 'data', {});
|
|
1517
|
-
const
|
|
1518
|
-
const ohlcv = (type === 'spot') ? klines : data;
|
|
1519
|
+
const ohlcv = this.safeValue(data, 'klines', data);
|
|
1519
1520
|
return this.parseOHLCVs(ohlcv, market, timeframe, since, limit);
|
|
1520
1521
|
}
|
|
1521
1522
|
async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
@@ -3216,8 +3217,10 @@ export default class bitmart extends Exchange {
|
|
|
3216
3217
|
// {"errno":"OK","message":"INVALID_PARAMETER","code":49998,"trace":"eb5ebb54-23cd-4de2-9064-e090b6c3b2e3","data":null}
|
|
3217
3218
|
//
|
|
3218
3219
|
const message = this.safeStringLower(response, 'message');
|
|
3220
|
+
const isErrorMessage = (message !== undefined) && (message !== 'ok') && (message !== 'success');
|
|
3219
3221
|
const errorCode = this.safeString(response, 'code');
|
|
3220
|
-
|
|
3222
|
+
const isErrorCode = (errorCode !== undefined) && (errorCode !== '1000');
|
|
3223
|
+
if (isErrorCode || isErrorMessage) {
|
|
3221
3224
|
const feedback = this.id + ' ' + body;
|
|
3222
3225
|
this.throwExactlyMatchedException(this.exceptions['exact'], errorCode, feedback);
|
|
3223
3226
|
this.throwBroadlyMatchedException(this.exceptions['broad'], errorCode, feedback);
|
package/js/src/bittrex.js
CHANGED
|
@@ -476,11 +476,24 @@ export default class bittrex extends Exchange {
|
|
|
476
476
|
const precision = this.parseNumber('1e-8'); // default precision, seems exchange has same amount-precision across all pairs in UI too. todo: fix "magic constants"
|
|
477
477
|
const fee = this.safeNumber(currency, 'txFee'); // todo: redesign
|
|
478
478
|
const isActive = this.safeString(currency, 'status');
|
|
479
|
+
const coinType = this.safeString(currency, 'coinType');
|
|
480
|
+
let type = undefined;
|
|
481
|
+
if (coinType === 'FIAT') {
|
|
482
|
+
type = 'fiat';
|
|
483
|
+
}
|
|
484
|
+
else if (coinType === 'Award') {
|
|
485
|
+
// these are exchange credits
|
|
486
|
+
type = 'other';
|
|
487
|
+
}
|
|
488
|
+
else {
|
|
489
|
+
// all others are cryptos
|
|
490
|
+
type = 'crypto';
|
|
491
|
+
}
|
|
479
492
|
result[code] = {
|
|
480
493
|
'id': id,
|
|
481
494
|
'code': code,
|
|
482
495
|
'info': currency,
|
|
483
|
-
'type':
|
|
496
|
+
'type': type,
|
|
484
497
|
'name': this.safeString(currency, 'name'),
|
|
485
498
|
'active': (isActive === 'ONLINE'),
|
|
486
499
|
'deposit': undefined,
|
package/js/src/bybit.js
CHANGED
|
@@ -3953,11 +3953,11 @@ export default class bybit extends Exchange {
|
|
|
3953
3953
|
else if (timeInForce === 'ioc') {
|
|
3954
3954
|
request['timeInForce'] = 'IOC';
|
|
3955
3955
|
}
|
|
3956
|
-
let triggerPrice = this.
|
|
3957
|
-
const stopLossTriggerPrice = this.
|
|
3958
|
-
const takeProfitTriggerPrice = this.
|
|
3959
|
-
const stopLoss = this.
|
|
3960
|
-
const takeProfit = this.
|
|
3956
|
+
let triggerPrice = this.safeValue2(params, 'triggerPrice', 'stopPrice');
|
|
3957
|
+
const stopLossTriggerPrice = this.safeValue(params, 'stopLossPrice');
|
|
3958
|
+
const takeProfitTriggerPrice = this.safeValue(params, 'takeProfitPrice');
|
|
3959
|
+
const stopLoss = this.safeValue(params, 'stopLoss');
|
|
3960
|
+
const takeProfit = this.safeValue(params, 'takeProfit');
|
|
3961
3961
|
const isStopLossTriggerOrder = stopLossTriggerPrice !== undefined;
|
|
3962
3962
|
const isTakeProfitTriggerOrder = takeProfitTriggerPrice !== undefined;
|
|
3963
3963
|
const isStopLoss = stopLoss !== undefined;
|
|
@@ -3976,15 +3976,20 @@ export default class bybit extends Exchange {
|
|
|
3976
3976
|
}
|
|
3977
3977
|
else if (isStopLoss || isTakeProfit) {
|
|
3978
3978
|
if (isStopLoss) {
|
|
3979
|
-
|
|
3979
|
+
const stopLossTriggerPrice = this.safeValue2(stopLoss, 'triggerPrice', 'stopPrice', stopLoss);
|
|
3980
|
+
request['stopLoss'] = this.priceToPrecision(symbol, stopLossTriggerPrice);
|
|
3980
3981
|
}
|
|
3981
3982
|
if (isTakeProfit) {
|
|
3982
|
-
|
|
3983
|
+
const takeProfitTriggerPrice = this.safeValue2(takeProfit, 'triggerPrice', 'stopPrice', takeProfit);
|
|
3984
|
+
request['takeProfit'] = this.priceToPrecision(symbol, takeProfitTriggerPrice);
|
|
3983
3985
|
}
|
|
3984
3986
|
}
|
|
3985
3987
|
if (market['spot']) {
|
|
3986
3988
|
// only works for spot market
|
|
3987
|
-
if (triggerPrice !== undefined
|
|
3989
|
+
if (triggerPrice !== undefined) {
|
|
3990
|
+
request['orderFilter'] = 'StopOrder';
|
|
3991
|
+
}
|
|
3992
|
+
else if (stopLossTriggerPrice !== undefined || takeProfitTriggerPrice !== undefined || isStopLoss || isTakeProfit) {
|
|
3988
3993
|
request['orderFilter'] = 'tpslOrder';
|
|
3989
3994
|
}
|
|
3990
3995
|
}
|
|
@@ -4163,11 +4168,11 @@ export default class bybit extends Exchange {
|
|
|
4163
4168
|
else if (timeInForce === 'ioc') {
|
|
4164
4169
|
request['timeInForce'] = 'ImmediateOrCancel';
|
|
4165
4170
|
}
|
|
4166
|
-
const triggerPrice = this.
|
|
4167
|
-
const stopLossTriggerPrice = this.
|
|
4168
|
-
const takeProfitTriggerPrice = this.
|
|
4169
|
-
const stopLoss = this.
|
|
4170
|
-
const takeProfit = this.
|
|
4171
|
+
const triggerPrice = this.safeValue2(params, 'stopPrice', 'triggerPrice');
|
|
4172
|
+
const stopLossTriggerPrice = this.safeValue(params, 'stopLossPrice', triggerPrice);
|
|
4173
|
+
const takeProfitTriggerPrice = this.safeValue(params, 'takeProfitPrice');
|
|
4174
|
+
const stopLoss = this.safeValue(params, 'stopLoss');
|
|
4175
|
+
const takeProfit = this.safeValue(params, 'takeProfit');
|
|
4171
4176
|
const isStopLossTriggerOrder = stopLossTriggerPrice !== undefined;
|
|
4172
4177
|
const isTakeProfitTriggerOrder = takeProfitTriggerPrice !== undefined;
|
|
4173
4178
|
const isStopLoss = stopLoss !== undefined;
|
|
@@ -4185,10 +4190,12 @@ export default class bybit extends Exchange {
|
|
|
4185
4190
|
}
|
|
4186
4191
|
else if (isStopLoss || isTakeProfit) {
|
|
4187
4192
|
if (isStopLoss) {
|
|
4188
|
-
|
|
4193
|
+
const stopLossTriggerPrice = this.safeValue2(stopLoss, 'triggerPrice', 'stopPrice', stopLoss);
|
|
4194
|
+
request['stopLoss'] = this.priceToPrecision(symbol, stopLossTriggerPrice);
|
|
4189
4195
|
}
|
|
4190
4196
|
if (isTakeProfit) {
|
|
4191
|
-
|
|
4197
|
+
const takeProfitTriggerPrice = this.safeValue2(takeProfit, 'triggerPrice', 'stopPrice', takeProfit);
|
|
4198
|
+
request['takeProfit'] = this.priceToPrecision(symbol, takeProfitTriggerPrice);
|
|
4192
4199
|
}
|
|
4193
4200
|
}
|
|
4194
4201
|
const clientOrderId = this.safeString(params, 'clientOrderId');
|
|
@@ -4268,11 +4275,11 @@ export default class bybit extends Exchange {
|
|
|
4268
4275
|
else if (timeInForce === 'ioc') {
|
|
4269
4276
|
request['timeInForce'] = 'ImmediateOrCancel';
|
|
4270
4277
|
}
|
|
4271
|
-
let triggerPrice = this.
|
|
4272
|
-
const stopLossTriggerPrice = this.
|
|
4273
|
-
const takeProfitTriggerPrice = this.
|
|
4274
|
-
const stopLoss = this.
|
|
4275
|
-
const takeProfit = this.
|
|
4278
|
+
let triggerPrice = this.safeValue2(params, 'triggerPrice', 'stopPrice');
|
|
4279
|
+
const stopLossTriggerPrice = this.safeValue(params, 'stopLossPrice');
|
|
4280
|
+
const takeProfitTriggerPrice = this.safeValue(params, 'takeProfitPrice');
|
|
4281
|
+
const stopLoss = this.safeValue(params, 'stopLoss');
|
|
4282
|
+
const takeProfit = this.safeValue(params, 'takeProfit');
|
|
4276
4283
|
const isStopLossTriggerOrder = stopLossTriggerPrice !== undefined;
|
|
4277
4284
|
const isTakeProfitTriggerOrder = takeProfitTriggerPrice !== undefined;
|
|
4278
4285
|
const isStopLoss = stopLoss !== undefined;
|
|
@@ -4291,10 +4298,12 @@ export default class bybit extends Exchange {
|
|
|
4291
4298
|
}
|
|
4292
4299
|
else if (isStopLoss || isTakeProfit) {
|
|
4293
4300
|
if (isStopLoss) {
|
|
4294
|
-
|
|
4301
|
+
const stopLossTriggerPrice = this.safeValue2(stopLoss, 'triggerPrice', 'stopPrice', stopLoss);
|
|
4302
|
+
request['stopLoss'] = this.priceToPrecision(symbol, stopLossTriggerPrice);
|
|
4295
4303
|
}
|
|
4296
4304
|
if (isTakeProfit) {
|
|
4297
|
-
|
|
4305
|
+
const takeProfitTriggerPrice = this.safeValue2(takeProfit, 'triggerPrice', 'stopPrice', takeProfit);
|
|
4306
|
+
request['takeProfit'] = this.priceToPrecision(symbol, takeProfitTriggerPrice);
|
|
4298
4307
|
}
|
|
4299
4308
|
}
|
|
4300
4309
|
const clientOrderId = this.safeString(params, 'clientOrderId');
|
|
@@ -4371,11 +4380,11 @@ export default class bybit extends Exchange {
|
|
|
4371
4380
|
request['time_in_force'] = 'ImmediateOrCancel';
|
|
4372
4381
|
}
|
|
4373
4382
|
if (market['swap']) {
|
|
4374
|
-
const triggerPrice = this.
|
|
4375
|
-
const stopLossTriggerPrice = this.
|
|
4376
|
-
const takeProfitTriggerPrice = this.
|
|
4377
|
-
const stopLoss = this.
|
|
4378
|
-
const takeProfit = this.
|
|
4383
|
+
const triggerPrice = this.safeValue2(params, 'stopPrice', 'triggerPrice');
|
|
4384
|
+
const stopLossTriggerPrice = this.safeValue(params, 'stopLossPrice', triggerPrice);
|
|
4385
|
+
const takeProfitTriggerPrice = this.safeValue(params, 'takeProfitPrice');
|
|
4386
|
+
const stopLoss = this.safeValue(params, 'stopLoss');
|
|
4387
|
+
const takeProfit = this.safeValue(params, 'takeProfit');
|
|
4379
4388
|
const isStopLossTriggerOrder = stopLossTriggerPrice !== undefined;
|
|
4380
4389
|
const isTakeProfitTriggerOrder = takeProfitTriggerPrice !== undefined;
|
|
4381
4390
|
const isStopLoss = stopLoss !== undefined;
|
|
@@ -4392,10 +4401,12 @@ export default class bybit extends Exchange {
|
|
|
4392
4401
|
}
|
|
4393
4402
|
else if (isStopLoss || isTakeProfit) {
|
|
4394
4403
|
if (isStopLoss) {
|
|
4395
|
-
|
|
4404
|
+
const stopLossTriggerPrice = this.safeValue2(stopLoss, 'triggerPrice', 'stopPrice', stopLoss);
|
|
4405
|
+
request['stopLoss'] = this.priceToPrecision(symbol, stopLossTriggerPrice);
|
|
4396
4406
|
}
|
|
4397
4407
|
if (isTakeProfit) {
|
|
4398
|
-
|
|
4408
|
+
const takeProfitTriggerPrice = this.safeValue2(takeProfit, 'triggerPrice', 'stopPrice', takeProfit);
|
|
4409
|
+
request['takeProfit'] = this.priceToPrecision(symbol, takeProfitTriggerPrice);
|
|
4399
4410
|
}
|
|
4400
4411
|
}
|
|
4401
4412
|
else {
|
|
@@ -4477,11 +4488,11 @@ export default class bybit extends Exchange {
|
|
|
4477
4488
|
if (amount !== undefined) {
|
|
4478
4489
|
request['qty'] = this.amountToPrecision(symbol, amount);
|
|
4479
4490
|
}
|
|
4480
|
-
let triggerPrice = this.
|
|
4481
|
-
const stopLossTriggerPrice = this.
|
|
4482
|
-
const takeProfitTriggerPrice = this.
|
|
4483
|
-
const stopLoss = this.
|
|
4484
|
-
const takeProfit = this.
|
|
4491
|
+
let triggerPrice = this.safeValue2(params, 'triggerPrice', 'stopPrice');
|
|
4492
|
+
const stopLossTriggerPrice = this.safeValue(params, 'stopLossPrice');
|
|
4493
|
+
const takeProfitTriggerPrice = this.safeValue(params, 'takeProfitPrice');
|
|
4494
|
+
const stopLoss = this.safeValue(params, 'stopLoss');
|
|
4495
|
+
const takeProfit = this.safeValue(params, 'takeProfit');
|
|
4485
4496
|
const isStopLossTriggerOrder = stopLossTriggerPrice !== undefined;
|
|
4486
4497
|
const isTakeProfitTriggerOrder = takeProfitTriggerPrice !== undefined;
|
|
4487
4498
|
const isStopLoss = stopLoss !== undefined;
|
|
@@ -4494,10 +4505,12 @@ export default class bybit extends Exchange {
|
|
|
4494
4505
|
}
|
|
4495
4506
|
if (isStopLoss || isTakeProfit) {
|
|
4496
4507
|
if (isStopLoss) {
|
|
4497
|
-
|
|
4508
|
+
const stopLossTriggerPrice = this.safeValue2(stopLoss, 'triggerPrice', 'stopPrice', stopLoss);
|
|
4509
|
+
request['stopLoss'] = this.priceToPrecision(symbol, stopLossTriggerPrice);
|
|
4498
4510
|
}
|
|
4499
4511
|
if (isTakeProfit) {
|
|
4500
|
-
|
|
4512
|
+
const takeProfitTriggerPrice = this.safeValue2(takeProfit, 'triggerPrice', 'stopPrice', takeProfit);
|
|
4513
|
+
request['takeProfit'] = this.priceToPrecision(symbol, takeProfitTriggerPrice);
|
|
4501
4514
|
}
|
|
4502
4515
|
}
|
|
4503
4516
|
const clientOrderId = this.safeString(params, 'clientOrderId');
|
|
@@ -4578,11 +4591,11 @@ export default class bybit extends Exchange {
|
|
|
4578
4591
|
else if (timeInForce === 'ioc') {
|
|
4579
4592
|
request['timeInForce'] = 'ImmediateOrCancel';
|
|
4580
4593
|
}
|
|
4581
|
-
let triggerPrice = this.
|
|
4582
|
-
const stopLossTriggerPrice = this.
|
|
4583
|
-
const takeProfitTriggerPrice = this.
|
|
4584
|
-
const stopLoss = this.
|
|
4585
|
-
const takeProfit = this.
|
|
4594
|
+
let triggerPrice = this.safeValue2(params, 'triggerPrice', 'stopPrice');
|
|
4595
|
+
const stopLossTriggerPrice = this.safeValue(params, 'stopLossPrice');
|
|
4596
|
+
const takeProfitTriggerPrice = this.safeValue(params, 'takeProfitPrice');
|
|
4597
|
+
const stopLoss = this.safeValue(params, 'stopLoss');
|
|
4598
|
+
const takeProfit = this.safeValue(params, 'takeProfit');
|
|
4586
4599
|
const isStopLossTriggerOrder = stopLossTriggerPrice !== undefined;
|
|
4587
4600
|
const isTakeProfitTriggerOrder = takeProfitTriggerPrice !== undefined;
|
|
4588
4601
|
const isStopLoss = stopLoss !== undefined;
|
|
@@ -4595,10 +4608,12 @@ export default class bybit extends Exchange {
|
|
|
4595
4608
|
}
|
|
4596
4609
|
if (isStopLoss || isTakeProfit) {
|
|
4597
4610
|
if (isStopLoss) {
|
|
4598
|
-
|
|
4611
|
+
const stopLossTriggerPrice = this.safeValue2(stopLoss, 'triggerPrice', 'stopPrice', stopLoss);
|
|
4612
|
+
request['stopLoss'] = this.priceToPrecision(symbol, stopLossTriggerPrice);
|
|
4599
4613
|
}
|
|
4600
4614
|
if (isTakeProfit) {
|
|
4601
|
-
|
|
4615
|
+
const takeProfitTriggerPrice = this.safeValue2(takeProfit, 'triggerPrice', 'stopPrice', takeProfit);
|
|
4616
|
+
request['takeProfit'] = this.priceToPrecision(symbol, takeProfitTriggerPrice);
|
|
4602
4617
|
}
|
|
4603
4618
|
}
|
|
4604
4619
|
const clientOrderId = this.safeString(params, 'clientOrderId');
|
|
@@ -4640,11 +4655,11 @@ export default class bybit extends Exchange {
|
|
|
4640
4655
|
if (amount !== undefined) {
|
|
4641
4656
|
request['qty'] = this.amountToPrecision(symbol, amount);
|
|
4642
4657
|
}
|
|
4643
|
-
let triggerPrice = this.
|
|
4644
|
-
const stopLossTriggerPrice = this.
|
|
4645
|
-
const takeProfitTriggerPrice = this.
|
|
4646
|
-
const stopLoss = this.
|
|
4647
|
-
const takeProfit = this.
|
|
4658
|
+
let triggerPrice = this.safeValue2(params, 'triggerPrice', 'stopPrice');
|
|
4659
|
+
const stopLossTriggerPrice = this.safeValue(params, 'stopLossPrice');
|
|
4660
|
+
const takeProfitTriggerPrice = this.safeValue(params, 'takeProfitPrice');
|
|
4661
|
+
const stopLoss = this.safeValue(params, 'stopLoss');
|
|
4662
|
+
const takeProfit = this.safeValue(params, 'takeProfit');
|
|
4648
4663
|
const isStopLossTriggerOrder = stopLossTriggerPrice !== undefined;
|
|
4649
4664
|
const isTakeProfitTriggerOrder = takeProfitTriggerPrice !== undefined;
|
|
4650
4665
|
const isStopLoss = stopLoss !== undefined;
|
|
@@ -4657,10 +4672,12 @@ export default class bybit extends Exchange {
|
|
|
4657
4672
|
}
|
|
4658
4673
|
if (isStopLoss || isTakeProfit) {
|
|
4659
4674
|
if (isStopLoss) {
|
|
4660
|
-
|
|
4675
|
+
const stopLossTriggerPrice = this.safeValue2(stopLoss, 'triggerPrice', 'stopPrice', stopLoss);
|
|
4676
|
+
request['stopLoss'] = this.priceToPrecision(symbol, stopLossTriggerPrice);
|
|
4661
4677
|
}
|
|
4662
4678
|
if (isTakeProfit) {
|
|
4663
|
-
|
|
4679
|
+
const takeProfitTriggerPrice = this.safeValue2(takeProfit, 'triggerPrice', 'stopPrice', takeProfit);
|
|
4680
|
+
request['takeProfit'] = this.priceToPrecision(symbol, takeProfitTriggerPrice);
|
|
4664
4681
|
}
|
|
4665
4682
|
}
|
|
4666
4683
|
const clientOrderId = this.safeString(params, 'clientOrderId');
|
|
@@ -4706,9 +4723,7 @@ export default class bybit extends Exchange {
|
|
|
4706
4723
|
* @param {object} [params] extra parameters specific to the bybit api endpoint
|
|
4707
4724
|
* @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
4708
4725
|
*/
|
|
4709
|
-
|
|
4710
|
-
throw new ArgumentsRequired(this.id + ' editOrder() requires an symbol argument');
|
|
4711
|
-
}
|
|
4726
|
+
this.checkRequiredSymbol('editOrder', symbol);
|
|
4712
4727
|
await this.loadMarkets();
|
|
4713
4728
|
const market = this.market(symbol);
|
|
4714
4729
|
const [enableUnifiedMargin, enableUnifiedAccount] = await this.isUnifiedEnabled();
|
package/js/src/exmo.js
CHANGED
|
@@ -730,17 +730,55 @@ export default class exmo extends Exchange {
|
|
|
730
730
|
// },
|
|
731
731
|
// }
|
|
732
732
|
//
|
|
733
|
+
let marginPairsDict = {};
|
|
734
|
+
if (this.checkRequiredCredentials(false)) {
|
|
735
|
+
const marginPairs = await this.privatePostMarginPairList(params);
|
|
736
|
+
//
|
|
737
|
+
// {
|
|
738
|
+
// "pairs": [
|
|
739
|
+
// {
|
|
740
|
+
// "buy_price": "55978.85",
|
|
741
|
+
// "default_leverage": "3",
|
|
742
|
+
// "is_fair_price": true,
|
|
743
|
+
// "last_trade_price": "55999.23",
|
|
744
|
+
// "liquidation_fee": "2",
|
|
745
|
+
// "liquidation_level": "10",
|
|
746
|
+
// "margin_call_level": "15",
|
|
747
|
+
// "max_leverage": "3",
|
|
748
|
+
// "max_order_price": "150000",
|
|
749
|
+
// "max_order_quantity": "1",
|
|
750
|
+
// "max_position_quantity": "1",
|
|
751
|
+
// "max_price_precision": 2,
|
|
752
|
+
// "min_order_price": "1",
|
|
753
|
+
// "min_order_quantity": "0.00002",
|
|
754
|
+
// "name": "BTC_USD",
|
|
755
|
+
// "position": 1,
|
|
756
|
+
// "sell_price": "55985.51",
|
|
757
|
+
// "ticker_updated": "1619019818936107989",
|
|
758
|
+
// "trade_maker_fee": "0",
|
|
759
|
+
// "trade_taker_fee": "0.05",
|
|
760
|
+
// "updated": "1619008608955599013"
|
|
761
|
+
// }
|
|
762
|
+
// ]
|
|
763
|
+
// }
|
|
764
|
+
//
|
|
765
|
+
const pairs = this.safeValue(marginPairs, 'pairs');
|
|
766
|
+
marginPairsDict = this.indexBy(pairs, 'name');
|
|
767
|
+
}
|
|
733
768
|
const keys = Object.keys(response);
|
|
734
769
|
const result = [];
|
|
735
770
|
for (let i = 0; i < keys.length; i++) {
|
|
736
771
|
const id = keys[i];
|
|
737
772
|
const market = response[id];
|
|
773
|
+
const marginMarket = this.safeValue(marginPairsDict, id);
|
|
738
774
|
const symbol = id.replace('_', '/');
|
|
739
775
|
const [baseId, quoteId] = symbol.split('/');
|
|
740
776
|
const base = this.safeCurrencyCode(baseId);
|
|
741
777
|
const quote = this.safeCurrencyCode(quoteId);
|
|
742
778
|
const takerString = this.safeString(market, 'commission_taker_percent');
|
|
743
779
|
const makerString = this.safeString(market, 'commission_maker_percent');
|
|
780
|
+
const maxQuantity = this.safeString(market, 'max_quantity');
|
|
781
|
+
const marginMaxQuantity = this.safeString(marginMarket, 'max_order_quantity');
|
|
744
782
|
result.push({
|
|
745
783
|
'id': id,
|
|
746
784
|
'symbol': symbol,
|
|
@@ -752,7 +790,7 @@ export default class exmo extends Exchange {
|
|
|
752
790
|
'settleId': undefined,
|
|
753
791
|
'type': 'spot',
|
|
754
792
|
'spot': true,
|
|
755
|
-
'margin':
|
|
793
|
+
'margin': marginMarket !== undefined,
|
|
756
794
|
'swap': false,
|
|
757
795
|
'future': false,
|
|
758
796
|
'option': false,
|
|
@@ -774,11 +812,11 @@ export default class exmo extends Exchange {
|
|
|
774
812
|
'limits': {
|
|
775
813
|
'leverage': {
|
|
776
814
|
'min': undefined,
|
|
777
|
-
'max':
|
|
815
|
+
'max': this.safeNumber(market, 'leverage'),
|
|
778
816
|
},
|
|
779
817
|
'amount': {
|
|
780
818
|
'min': this.safeNumber(market, 'min_quantity'),
|
|
781
|
-
'max': this.
|
|
819
|
+
'max': this.parseNumber(Precise.stringMax(maxQuantity, marginMaxQuantity)),
|
|
782
820
|
},
|
|
783
821
|
'price': {
|
|
784
822
|
'min': this.safeNumber(market, 'min_price'),
|
package/js/src/gate.js
CHANGED
|
@@ -4158,7 +4158,6 @@ export default class gate extends Exchange {
|
|
|
4158
4158
|
let remainingString = this.safeString(order, 'left');
|
|
4159
4159
|
let cost = this.safeString(order, 'filled_total');
|
|
4160
4160
|
const triggerPrice = this.safeNumber(trigger, 'price');
|
|
4161
|
-
let rawStatus = undefined;
|
|
4162
4161
|
let average = this.safeNumber2(order, 'avg_deal_price', 'fill_price');
|
|
4163
4162
|
if (triggerPrice) {
|
|
4164
4163
|
remainingString = amount;
|
|
@@ -4168,11 +4167,8 @@ export default class gate extends Exchange {
|
|
|
4168
4167
|
const isMarketOrder = Precise.stringEquals(price, '0') && (timeInForce === 'IOC');
|
|
4169
4168
|
type = isMarketOrder ? 'market' : 'limit';
|
|
4170
4169
|
side = Precise.stringGt(amount, '0') ? 'buy' : 'sell';
|
|
4171
|
-
rawStatus = this.safeString(order, 'finish_as', 'open');
|
|
4172
|
-
}
|
|
4173
|
-
else {
|
|
4174
|
-
rawStatus = this.safeString(order, 'status');
|
|
4175
4170
|
}
|
|
4171
|
+
const rawStatus = this.safeStringN(order, ['status', 'finish_as', 'open']);
|
|
4176
4172
|
let timestamp = this.safeInteger(order, 'create_time_ms');
|
|
4177
4173
|
if (timestamp === undefined) {
|
|
4178
4174
|
timestamp = this.safeTimestamp2(order, 'create_time', 'ctime');
|
package/js/src/kucoin.js
CHANGED
|
@@ -1082,8 +1082,10 @@ export default class kucoin extends Exchange {
|
|
|
1082
1082
|
const networks = {};
|
|
1083
1083
|
const chains = this.safeValue(entry, 'chains', []);
|
|
1084
1084
|
const extraChainsData = this.indexBy(this.safeValue(additionalDataGrouped, id, []), 'chain');
|
|
1085
|
-
const
|
|
1086
|
-
|
|
1085
|
+
const rawPrecision = this.safeString(entry, 'precision');
|
|
1086
|
+
const precision = this.parseNumber(this.parsePrecision(rawPrecision));
|
|
1087
|
+
const chainsLength = chains.length;
|
|
1088
|
+
for (let j = 0; j < chainsLength; j++) {
|
|
1087
1089
|
const chain = chains[j];
|
|
1088
1090
|
const chainId = this.safeString(chain, 'chain');
|
|
1089
1091
|
const networkCode = this.networkIdToCode(chainId);
|
|
@@ -1124,10 +1126,13 @@ export default class kucoin extends Exchange {
|
|
|
1124
1126
|
},
|
|
1125
1127
|
};
|
|
1126
1128
|
}
|
|
1129
|
+
// kucoin has determined 'fiat' currencies with below logic
|
|
1130
|
+
const isFiat = (rawPrecision === '2') && (chainsLength === 0);
|
|
1127
1131
|
result[code] = {
|
|
1128
1132
|
'id': id,
|
|
1129
1133
|
'name': name,
|
|
1130
1134
|
'code': code,
|
|
1135
|
+
'type': isFiat ? 'fiat' : 'crypto',
|
|
1131
1136
|
'precision': precision,
|
|
1132
1137
|
'info': entry,
|
|
1133
1138
|
'active': (isDepositEnabled || isWithdrawEnabled),
|
package/js/src/latoken.js
CHANGED
|
@@ -433,10 +433,14 @@ export default class latoken extends Exchange {
|
|
|
433
433
|
const code = this.safeCurrencyCode(tag);
|
|
434
434
|
const fee = this.safeNumber(currency, 'fee');
|
|
435
435
|
const currencyType = this.safeString(currency, 'type');
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
436
|
+
let type = undefined;
|
|
437
|
+
if (currencyType === 'CURRENCY_TYPE_ALTERNATIVE') {
|
|
438
|
+
type = 'other';
|
|
439
|
+
}
|
|
440
|
+
else {
|
|
441
|
+
// CURRENCY_TYPE_CRYPTO and CURRENCY_TYPE_IEO are all cryptos
|
|
442
|
+
type = 'crypto';
|
|
443
|
+
}
|
|
440
444
|
const status = this.safeString(currency, 'status');
|
|
441
445
|
const active = (status === 'CURRENCY_STATUS_ACTIVE');
|
|
442
446
|
const name = this.safeString(currency, 'name');
|
package/js/src/lykke.js
CHANGED
|
@@ -226,7 +226,8 @@ export default class lykke extends Exchange {
|
|
|
226
226
|
const id = this.safeString(currency, 'assetId');
|
|
227
227
|
const code = this.safeString(currency, 'symbol');
|
|
228
228
|
const name = this.safeString(currency, 'name');
|
|
229
|
-
const
|
|
229
|
+
const rawType = this.safeString(currency, 'type');
|
|
230
|
+
const type = (rawType === 'erc20Token') ? 'crypto' : 'other';
|
|
230
231
|
const deposit = this.safeValue(currency, 'blockchainDepositEnabled');
|
|
231
232
|
const withdraw = this.safeValue(currency, 'blockchainWithdrawal');
|
|
232
233
|
const isDisabled = this.safeValue(currency, 'isDisabled');
|
package/js/src/ndax.js
CHANGED
|
@@ -362,7 +362,12 @@ export default class ndax extends Exchange {
|
|
|
362
362
|
const currency = response[i];
|
|
363
363
|
const id = this.safeString(currency, 'ProductId');
|
|
364
364
|
const name = this.safeString(currency, 'ProductFullName');
|
|
365
|
-
const
|
|
365
|
+
const ProductType = this.safeString(currency, 'ProductType');
|
|
366
|
+
let type = (ProductType === 'NationalCurrency') ? 'fiat' : 'crypto';
|
|
367
|
+
if (ProductType === 'Unknown') {
|
|
368
|
+
// such currency is just a blanket entry
|
|
369
|
+
type = 'other';
|
|
370
|
+
}
|
|
366
371
|
const code = this.safeCurrencyCode(this.safeString(currency, 'Product'));
|
|
367
372
|
const isDisabled = this.safeValue(currency, 'IsDisabled');
|
|
368
373
|
const active = !isDisabled;
|
package/js/src/pro/gate.js
CHANGED
|
@@ -825,8 +825,11 @@ export default class gate extends gateRest {
|
|
|
825
825
|
parsed['status'] = 'open';
|
|
826
826
|
}
|
|
827
827
|
else if (event === 'finish') {
|
|
828
|
-
const
|
|
829
|
-
|
|
828
|
+
const status = this.safeString(parsed, 'status');
|
|
829
|
+
if (status === undefined) {
|
|
830
|
+
const left = this.safeNumber(info, 'left');
|
|
831
|
+
parsed['status'] = (left === 0) ? 'closed' : 'canceled';
|
|
832
|
+
}
|
|
830
833
|
}
|
|
831
834
|
stored.append(parsed);
|
|
832
835
|
const symbol = parsed['symbol'];
|
package/js/src/yobit.js
CHANGED
package/package.json
CHANGED