ccxt 4.4.44 → 4.4.45
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.min.js +15 -15
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/binance.js +161 -39
- package/dist/cjs/src/bingx.js +15 -9
- package/dist/cjs/src/bitfinex.js +1 -1
- package/dist/cjs/src/bitget.js +3 -3
- package/dist/cjs/src/bitmart.js +3 -3
- package/dist/cjs/src/bitmex.js +1 -1
- package/dist/cjs/src/blofin.js +22 -0
- package/dist/cjs/src/bybit.js +4 -4
- package/dist/cjs/src/coinbase.js +1 -1
- package/dist/cjs/src/coinex.js +1 -1
- package/dist/cjs/src/cryptocom.js +1 -1
- package/dist/cjs/src/exmo.js +18 -8
- package/dist/cjs/src/gate.js +1 -1
- package/dist/cjs/src/hashkey.js +7 -1
- package/dist/cjs/src/htx.js +2 -2
- package/dist/cjs/src/hyperliquid.js +1 -1
- package/dist/cjs/src/kraken.js +1 -1
- package/dist/cjs/src/krakenfutures.js +1 -1
- package/dist/cjs/src/kucoin.js +1 -1
- package/dist/cjs/src/kucoinfutures.js +2 -3
- package/dist/cjs/src/lykke.js +1 -1
- package/dist/cjs/src/mexc.js +2 -2
- package/dist/cjs/src/myokx.js +8 -0
- package/dist/cjs/src/okx.js +4 -4
- package/dist/cjs/src/onetrading.js +2 -1
- package/dist/cjs/src/pro/binance.js +2 -1
- package/dist/cjs/src/pro/myokx.js +5 -0
- package/dist/cjs/src/whitebit.js +34 -8
- package/dist/cjs/src/woo.js +1 -1
- package/dist/cjs/src/woofipro.js +2 -2
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/blofin.d.ts +22 -0
- package/js/src/binance.d.ts +4 -0
- package/js/src/binance.js +161 -39
- package/js/src/bingx.js +15 -9
- package/js/src/bitfinex.js +1 -1
- package/js/src/bitget.js +3 -3
- package/js/src/bitmart.js +3 -3
- package/js/src/bitmex.js +1 -1
- package/js/src/blofin.js +22 -0
- package/js/src/bybit.js +4 -4
- package/js/src/coinbase.js +1 -1
- package/js/src/coinex.js +1 -1
- package/js/src/cryptocom.js +1 -1
- package/js/src/exmo.d.ts +1 -0
- package/js/src/exmo.js +18 -8
- package/js/src/gate.js +1 -1
- package/js/src/hashkey.js +7 -1
- package/js/src/htx.js +2 -2
- package/js/src/hyperliquid.js +1 -1
- package/js/src/kraken.js +1 -1
- package/js/src/krakenfutures.js +1 -1
- package/js/src/kucoin.js +1 -1
- package/js/src/kucoinfutures.js +2 -3
- package/js/src/lykke.js +1 -1
- package/js/src/mexc.js +2 -2
- package/js/src/myokx.js +8 -0
- package/js/src/okx.js +4 -4
- package/js/src/onetrading.js +2 -1
- package/js/src/pro/binance.js +2 -1
- package/js/src/pro/myokx.js +5 -0
- package/js/src/whitebit.d.ts +2 -1
- package/js/src/whitebit.js +34 -8
- package/js/src/woo.js +1 -1
- package/js/src/woofipro.js +2 -2
- package/package.json +1 -1
package/js/src/binance.js
CHANGED
|
@@ -1622,7 +1622,7 @@ export default class binance extends Exchange {
|
|
|
1622
1622
|
'fetchClosedOrders': {
|
|
1623
1623
|
'marginMode': true,
|
|
1624
1624
|
'limit': 1000,
|
|
1625
|
-
'
|
|
1625
|
+
'daysBack': undefined,
|
|
1626
1626
|
'daysBackCanceled': undefined,
|
|
1627
1627
|
'untilDays': 10000,
|
|
1628
1628
|
'trigger': false,
|
|
@@ -1692,7 +1692,7 @@ export default class binance extends Exchange {
|
|
|
1692
1692
|
'fetchClosedOrders': {
|
|
1693
1693
|
'marginMode': true,
|
|
1694
1694
|
'limit': 1000,
|
|
1695
|
-
'
|
|
1695
|
+
'daysBack': 90,
|
|
1696
1696
|
'daysBackCanceled': 3,
|
|
1697
1697
|
'untilDays': 7,
|
|
1698
1698
|
'trigger': false,
|
|
@@ -2415,22 +2415,72 @@ export default class binance extends Exchange {
|
|
|
2415
2415
|
'portfolioMargin': {
|
|
2416
2416
|
'exact': {
|
|
2417
2417
|
//
|
|
2418
|
-
//
|
|
2418
|
+
// 10xx General Server or Network Issues
|
|
2419
2419
|
//
|
|
2420
|
+
'-1000': OperationFailed,
|
|
2421
|
+
'-1001': ExchangeError,
|
|
2422
|
+
'-1002': PermissionDenied,
|
|
2423
|
+
'-1003': RateLimitExceeded,
|
|
2424
|
+
'-1004': BadRequest,
|
|
2420
2425
|
'-1005': PermissionDenied,
|
|
2426
|
+
'-1006': BadResponse,
|
|
2427
|
+
'-1007': BadResponse,
|
|
2428
|
+
'-1008': OperationFailed,
|
|
2429
|
+
'-1010': ExchangeError,
|
|
2421
2430
|
'-1011': PermissionDenied,
|
|
2431
|
+
'-1013': ExchangeError,
|
|
2432
|
+
'-1014': InvalidOrder,
|
|
2433
|
+
'-1015': InvalidOrder,
|
|
2434
|
+
'-1016': NotSupported,
|
|
2435
|
+
'-1020': NotSupported,
|
|
2436
|
+
'-1021': BadRequest,
|
|
2437
|
+
'-1022': BadRequest,
|
|
2422
2438
|
'-1023': BadRequest,
|
|
2439
|
+
'-1099': OperationFailed,
|
|
2440
|
+
//
|
|
2441
|
+
// 11xx Request Issues
|
|
2442
|
+
//
|
|
2443
|
+
'-1100': BadRequest,
|
|
2444
|
+
'-1101': BadRequest,
|
|
2445
|
+
'-1102': BadRequest,
|
|
2446
|
+
'-1103': BadRequest,
|
|
2447
|
+
'-1104': BadRequest,
|
|
2448
|
+
'-1105': BadRequest,
|
|
2449
|
+
'-1106': BadRequest,
|
|
2450
|
+
'-1108': BadRequest,
|
|
2423
2451
|
'-1109': BadRequest,
|
|
2424
2452
|
'-1110': BadSymbol,
|
|
2453
|
+
'-1111': BadRequest,
|
|
2454
|
+
'-1112': BadRequest,
|
|
2425
2455
|
'-1113': BadRequest,
|
|
2456
|
+
'-1114': BadRequest,
|
|
2457
|
+
'-1115': BadRequest,
|
|
2458
|
+
'-1116': BadRequest,
|
|
2459
|
+
'-1117': BadRequest,
|
|
2460
|
+
'-1118': BadRequest,
|
|
2461
|
+
'-1119': BadRequest,
|
|
2462
|
+
'-1120': BadRequest,
|
|
2463
|
+
'-1121': BadSymbol,
|
|
2464
|
+
'-1125': BadRequest,
|
|
2465
|
+
'-1127': BadRequest,
|
|
2426
2466
|
'-1128': BadRequest,
|
|
2467
|
+
'-1130': BadRequest,
|
|
2468
|
+
'-1131': BadRequest,
|
|
2469
|
+
'-1134': BadRequest,
|
|
2427
2470
|
'-1136': BadRequest,
|
|
2471
|
+
'-1145': BadRequest,
|
|
2472
|
+
'-1151': BadRequest,
|
|
2428
2473
|
//
|
|
2429
|
-
//
|
|
2474
|
+
// 20xx Processing Issues
|
|
2430
2475
|
//
|
|
2431
|
-
'-
|
|
2432
|
-
'-
|
|
2433
|
-
'-
|
|
2476
|
+
'-2010': InvalidOrder,
|
|
2477
|
+
'-2011': OperationRejected,
|
|
2478
|
+
'-2013': BadRequest,
|
|
2479
|
+
'-2014': OperationRejected,
|
|
2480
|
+
'-2015': OperationRejected,
|
|
2481
|
+
'-2016': OperationFailed,
|
|
2482
|
+
'-2018': OperationFailed,
|
|
2483
|
+
'-2019': OperationFailed,
|
|
2434
2484
|
'-2020': OrderNotFillable,
|
|
2435
2485
|
'-2021': OrderImmediatelyFillable,
|
|
2436
2486
|
'-2022': InvalidOrder,
|
|
@@ -2441,12 +2491,67 @@ export default class binance extends Exchange {
|
|
|
2441
2491
|
'-2027': OperationRejected,
|
|
2442
2492
|
'-2028': OperationRejected,
|
|
2443
2493
|
//
|
|
2444
|
-
// 4xxx
|
|
2494
|
+
// 4xxx Filters and other issues
|
|
2445
2495
|
//
|
|
2496
|
+
'-4000': BadRequest,
|
|
2497
|
+
'-4001': BadRequest,
|
|
2498
|
+
'-4002': BadRequest,
|
|
2499
|
+
'-4003': BadRequest,
|
|
2500
|
+
'-4004': BadRequest,
|
|
2501
|
+
'-4005': BadRequest,
|
|
2502
|
+
'-4006': BadRequest,
|
|
2503
|
+
'-4007': BadRequest,
|
|
2504
|
+
'-4008': BadRequest,
|
|
2505
|
+
'-4009': BadRequest,
|
|
2506
|
+
'-4010': BadRequest,
|
|
2507
|
+
'-4011': BadRequest,
|
|
2508
|
+
'-4012': BadRequest,
|
|
2509
|
+
'-4013': BadRequest,
|
|
2510
|
+
'-4014': BadRequest,
|
|
2511
|
+
'-4015': BadRequest,
|
|
2512
|
+
'-4016': BadRequest,
|
|
2513
|
+
'-4017': BadRequest,
|
|
2514
|
+
'-4018': BadRequest,
|
|
2515
|
+
'-4019': BadRequest,
|
|
2516
|
+
'-4020': BadRequest,
|
|
2517
|
+
'-4021': BadRequest,
|
|
2518
|
+
'-4022': BadRequest,
|
|
2519
|
+
'-4023': BadRequest,
|
|
2520
|
+
'-4024': BadRequest,
|
|
2521
|
+
'-4025': BadRequest,
|
|
2522
|
+
'-4026': BadRequest,
|
|
2523
|
+
'-4027': BadRequest,
|
|
2524
|
+
'-4028': BadRequest,
|
|
2525
|
+
'-4029': BadRequest,
|
|
2526
|
+
'-4030': BadRequest,
|
|
2527
|
+
'-4031': BadRequest,
|
|
2528
|
+
'-4032': BadRequest,
|
|
2529
|
+
'-4033': BadRequest,
|
|
2530
|
+
'-4044': BadRequest,
|
|
2531
|
+
'-4045': BadRequest,
|
|
2532
|
+
'-4046': BadRequest,
|
|
2533
|
+
'-4047': BadRequest,
|
|
2534
|
+
'-4048': BadRequest,
|
|
2535
|
+
'-4049': BadRequest,
|
|
2536
|
+
'-4050': BadRequest,
|
|
2537
|
+
'-4051': BadRequest,
|
|
2538
|
+
'-4052': BadRequest,
|
|
2539
|
+
'-4053': BadRequest,
|
|
2540
|
+
'-4054': BadRequest,
|
|
2541
|
+
'-4055': BadRequest,
|
|
2542
|
+
'-4056': PermissionDenied,
|
|
2543
|
+
'-4057': PermissionDenied,
|
|
2544
|
+
'-4058': BadRequest,
|
|
2545
|
+
'-4059': BadRequest,
|
|
2546
|
+
'-4060': BadRequest,
|
|
2547
|
+
'-4061': InvalidOrder,
|
|
2548
|
+
'-4062': BadRequest,
|
|
2446
2549
|
'-4063': BadRequest,
|
|
2447
2550
|
'-4064': BadRequest,
|
|
2448
2551
|
'-4065': BadRequest,
|
|
2449
2552
|
'-4066': BadRequest,
|
|
2553
|
+
'-4067': BadRequest,
|
|
2554
|
+
'-4068': BadRequest,
|
|
2450
2555
|
'-4069': BadRequest,
|
|
2451
2556
|
'-4070': BadRequest,
|
|
2452
2557
|
'-4071': BadRequest,
|
|
@@ -2460,47 +2565,39 @@ export default class binance extends Exchange {
|
|
|
2460
2565
|
'-4079': BadRequest,
|
|
2461
2566
|
'-4080': PermissionDenied,
|
|
2462
2567
|
'-4081': BadRequest,
|
|
2568
|
+
'-4082': BadRequest,
|
|
2569
|
+
'-4083': BadRequest,
|
|
2570
|
+
'-4084': NotSupported,
|
|
2463
2571
|
'-4085': BadRequest,
|
|
2464
2572
|
'-4086': BadRequest,
|
|
2465
2573
|
'-4087': PermissionDenied,
|
|
2466
2574
|
'-4088': PermissionDenied,
|
|
2575
|
+
'-4104': BadRequest,
|
|
2467
2576
|
'-4114': BadRequest,
|
|
2468
2577
|
'-4115': BadRequest,
|
|
2469
2578
|
'-4118': OperationRejected,
|
|
2470
2579
|
'-4131': OperationRejected,
|
|
2471
|
-
'-
|
|
2580
|
+
'-4135': BadRequest,
|
|
2581
|
+
'-4137': BadRequest,
|
|
2582
|
+
'-4138': BadRequest,
|
|
2583
|
+
'-4139': BadRequest,
|
|
2584
|
+
'-4140': OrderImmediatelyFillable,
|
|
2472
2585
|
'-4141': BadRequest,
|
|
2586
|
+
'-4142': OrderImmediatelyFillable,
|
|
2473
2587
|
'-4144': BadSymbol,
|
|
2474
2588
|
'-4161': OperationRejected,
|
|
2475
|
-
'-4164':
|
|
2589
|
+
'-4164': InvalidOrder,
|
|
2476
2590
|
'-4165': BadRequest,
|
|
2477
|
-
'-4183':
|
|
2478
|
-
'-4184':
|
|
2591
|
+
'-4183': InvalidOrder,
|
|
2592
|
+
'-4184': InvalidOrder,
|
|
2593
|
+
'-4408': InvalidOrder,
|
|
2479
2594
|
//
|
|
2480
|
-
// 5xxx
|
|
2595
|
+
// 5xxx Order Execution Issues
|
|
2481
2596
|
//
|
|
2482
2597
|
'-5021': OrderNotFillable,
|
|
2483
2598
|
'-5022': OrderNotFillable,
|
|
2484
|
-
|
|
2485
|
-
//
|
|
2486
|
-
//
|
|
2487
|
-
'-20121': ExchangeError,
|
|
2488
|
-
'-20124': ExchangeError,
|
|
2489
|
-
'-20130': ExchangeError,
|
|
2490
|
-
'-20132': ExchangeError,
|
|
2491
|
-
'-20194': ExchangeError,
|
|
2492
|
-
'-20195': ExchangeError,
|
|
2493
|
-
'-20196': ExchangeError,
|
|
2494
|
-
'-20198': ExchangeError,
|
|
2495
|
-
'-20204': ExchangeError,
|
|
2496
|
-
// 21xxx - PORTFOLIO MARGIN (documented in spot docs)
|
|
2497
|
-
'-21001': BadRequest,
|
|
2498
|
-
'-21002': BadRequest,
|
|
2499
|
-
'-21003': BadResponse,
|
|
2500
|
-
'-21004': OperationRejected,
|
|
2501
|
-
'-21005': InsufficientFunds,
|
|
2502
|
-
'-21006': OperationFailed,
|
|
2503
|
-
'-21007': OperationFailed, // User failed to repay portfolio margin bankruptcy loan since liquidation was in process
|
|
2599
|
+
'-5028': OperationFailed,
|
|
2600
|
+
'-5041': RateLimitExceeded, // Time out for too many requests from this account queueing at the same time.
|
|
2504
2601
|
},
|
|
2505
2602
|
},
|
|
2506
2603
|
'exact': {
|
|
@@ -3604,7 +3701,11 @@ export default class binance extends Exchange {
|
|
|
3604
3701
|
account['total'] = this.safeString(entry, 'crossMarginAsset');
|
|
3605
3702
|
}
|
|
3606
3703
|
else {
|
|
3607
|
-
|
|
3704
|
+
const usedLinear = this.safeString(entry, 'umUnrealizedPNL');
|
|
3705
|
+
const usedInverse = this.safeString(entry, 'cmUnrealizedPNL');
|
|
3706
|
+
const totalUsed = Precise.stringAdd(usedLinear, usedInverse);
|
|
3707
|
+
const totalWalletBalance = this.safeString(entry, 'totalWalletBalance');
|
|
3708
|
+
account['total'] = Precise.stringAdd(totalUsed, totalWalletBalance);
|
|
3608
3709
|
}
|
|
3609
3710
|
result[code] = account;
|
|
3610
3711
|
}
|
|
@@ -5358,10 +5459,10 @@ export default class binance extends Exchange {
|
|
|
5358
5459
|
const request = {
|
|
5359
5460
|
'symbol': market['id'],
|
|
5360
5461
|
'side': side.toUpperCase(),
|
|
5462
|
+
'orderId': id,
|
|
5463
|
+
'quantity': this.amountToPrecision(symbol, amount),
|
|
5361
5464
|
};
|
|
5362
5465
|
const clientOrderId = this.safeStringN(params, ['newClientOrderId', 'clientOrderId', 'origClientOrderId']);
|
|
5363
|
-
request['orderId'] = id;
|
|
5364
|
-
request['quantity'] = this.amountToPrecision(symbol, amount);
|
|
5365
5466
|
if (price !== undefined) {
|
|
5366
5467
|
request['price'] = this.priceToPrecision(symbol, price);
|
|
5367
5468
|
}
|
|
@@ -5377,6 +5478,8 @@ export default class binance extends Exchange {
|
|
|
5377
5478
|
* @description edit a trade order
|
|
5378
5479
|
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Modify-Order
|
|
5379
5480
|
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/Modify-Order
|
|
5481
|
+
* @see https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Modify-UM-Order
|
|
5482
|
+
* @see https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Modify-CM-Order
|
|
5380
5483
|
* @param {string} id cancel order id
|
|
5381
5484
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
5382
5485
|
* @param {string} type 'market' or 'limit'
|
|
@@ -5384,18 +5487,36 @@ export default class binance extends Exchange {
|
|
|
5384
5487
|
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
5385
5488
|
* @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
|
5386
5489
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5490
|
+
* @param {boolean} [params.portfolioMargin] set to true if you would like to edit an order in a portfolio margin account
|
|
5387
5491
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
5388
5492
|
*/
|
|
5389
5493
|
async editContractOrder(id, symbol, type, side, amount, price = undefined, params = {}) {
|
|
5390
5494
|
await this.loadMarkets();
|
|
5391
5495
|
const market = this.market(symbol);
|
|
5496
|
+
let isPortfolioMargin = undefined;
|
|
5497
|
+
[isPortfolioMargin, params] = this.handleOptionAndParams2(params, 'editContractOrder', 'papi', 'portfolioMargin', false);
|
|
5498
|
+
if (market['linear'] || isPortfolioMargin) {
|
|
5499
|
+
if (price === undefined) {
|
|
5500
|
+
throw new ArgumentsRequired(this.id + ' editOrder() requires a price argument for portfolio margin and linear orders');
|
|
5501
|
+
}
|
|
5502
|
+
}
|
|
5392
5503
|
const request = this.editContractOrderRequest(id, symbol, type, side, amount, price, params);
|
|
5393
5504
|
let response = undefined;
|
|
5394
5505
|
if (market['linear']) {
|
|
5395
|
-
|
|
5506
|
+
if (isPortfolioMargin) {
|
|
5507
|
+
response = await this.papiPutUmOrder(this.extend(request, params));
|
|
5508
|
+
}
|
|
5509
|
+
else {
|
|
5510
|
+
response = await this.fapiPrivatePutOrder(this.extend(request, params));
|
|
5511
|
+
}
|
|
5396
5512
|
}
|
|
5397
5513
|
else if (market['inverse']) {
|
|
5398
|
-
|
|
5514
|
+
if (isPortfolioMargin) {
|
|
5515
|
+
response = await this.papiPutCmOrder(this.extend(request, params));
|
|
5516
|
+
}
|
|
5517
|
+
else {
|
|
5518
|
+
response = await this.dapiPrivatePutOrder(this.extend(request, params));
|
|
5519
|
+
}
|
|
5399
5520
|
}
|
|
5400
5521
|
//
|
|
5401
5522
|
// swap and future
|
|
@@ -5440,6 +5561,7 @@ export default class binance extends Exchange {
|
|
|
5440
5561
|
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
5441
5562
|
* @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
|
5442
5563
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5564
|
+
* @param {boolean} [params.portfolioMargin] set to true if you would like to edit an order in a portfolio margin account
|
|
5443
5565
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
5444
5566
|
*/
|
|
5445
5567
|
async editOrder(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
|
|
@@ -11952,7 +12074,7 @@ export default class binance extends Exchange {
|
|
|
11952
12074
|
marketType = 'option';
|
|
11953
12075
|
}
|
|
11954
12076
|
else if (url.startsWith('https://papi.' + hostname + '/')) {
|
|
11955
|
-
marketType = '
|
|
12077
|
+
marketType = 'portfolioMargin';
|
|
11956
12078
|
}
|
|
11957
12079
|
if (marketType !== undefined) {
|
|
11958
12080
|
const exceptionsForMarketType = this.safeDict(this.exceptions, marketType, {});
|
package/js/src/bingx.js
CHANGED
|
@@ -553,7 +553,7 @@ export default class bingx extends Exchange {
|
|
|
553
553
|
'mark': true,
|
|
554
554
|
'index': true,
|
|
555
555
|
},
|
|
556
|
-
'
|
|
556
|
+
'price': true,
|
|
557
557
|
},
|
|
558
558
|
'timeInForce': {
|
|
559
559
|
'IOC': true,
|
|
@@ -600,7 +600,7 @@ export default class bingx extends Exchange {
|
|
|
600
600
|
'fetchClosedOrders': {
|
|
601
601
|
'marginMode': false,
|
|
602
602
|
'limit': 1000,
|
|
603
|
-
'
|
|
603
|
+
'daysBack': undefined,
|
|
604
604
|
'daysBackCanceled': undefined,
|
|
605
605
|
'untilDays': 7,
|
|
606
606
|
'trigger': false,
|
|
@@ -624,7 +624,7 @@ export default class bingx extends Exchange {
|
|
|
624
624
|
'fetchClosedOrders': {
|
|
625
625
|
'marginMode': false,
|
|
626
626
|
'limit': 1000,
|
|
627
|
-
'
|
|
627
|
+
'daysBack': undefined,
|
|
628
628
|
'daysBackCanceled': undefined,
|
|
629
629
|
'untilDays': 7,
|
|
630
630
|
'trigger': false,
|
|
@@ -2740,8 +2740,10 @@ export default class bingx extends Exchange {
|
|
|
2740
2740
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
2741
2741
|
*/
|
|
2742
2742
|
async createMarketOrderWithCost(symbol, side, cost, params = {}) {
|
|
2743
|
-
|
|
2744
|
-
|
|
2743
|
+
const req = {
|
|
2744
|
+
'quoteOrderQty': cost,
|
|
2745
|
+
};
|
|
2746
|
+
return await this.createOrder(symbol, 'market', side, cost, undefined, this.extend(req, params));
|
|
2745
2747
|
}
|
|
2746
2748
|
/**
|
|
2747
2749
|
* @method
|
|
@@ -2753,8 +2755,10 @@ export default class bingx extends Exchange {
|
|
|
2753
2755
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
2754
2756
|
*/
|
|
2755
2757
|
async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
+
const req = {
|
|
2759
|
+
'quoteOrderQty': cost,
|
|
2760
|
+
};
|
|
2761
|
+
return await this.createOrder(symbol, 'market', 'buy', cost, undefined, this.extend(req, params));
|
|
2758
2762
|
}
|
|
2759
2763
|
/**
|
|
2760
2764
|
* @method
|
|
@@ -2766,8 +2770,10 @@ export default class bingx extends Exchange {
|
|
|
2766
2770
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
2767
2771
|
*/
|
|
2768
2772
|
async createMarketSellOrderWithCost(symbol, cost, params = {}) {
|
|
2769
|
-
|
|
2770
|
-
|
|
2773
|
+
const req = {
|
|
2774
|
+
'quoteOrderQty': cost,
|
|
2775
|
+
};
|
|
2776
|
+
return await this.createOrder(symbol, 'market', 'sell', cost, undefined, this.extend(req, params));
|
|
2771
2777
|
}
|
|
2772
2778
|
createOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
|
|
2773
2779
|
/**
|
package/js/src/bitfinex.js
CHANGED
|
@@ -454,7 +454,7 @@ export default class bitfinex extends Exchange {
|
|
|
454
454
|
'fetchClosedOrders': {
|
|
455
455
|
'marginMode': false,
|
|
456
456
|
'limit': undefined,
|
|
457
|
-
'
|
|
457
|
+
'daysBack': undefined,
|
|
458
458
|
'daysBackCanceled': undefined,
|
|
459
459
|
'untilDays': 100000,
|
|
460
460
|
'trigger': false,
|
package/js/src/bitget.js
CHANGED
|
@@ -1463,7 +1463,7 @@ export default class bitget extends Exchange {
|
|
|
1463
1463
|
'mark': false,
|
|
1464
1464
|
'index': false,
|
|
1465
1465
|
},
|
|
1466
|
-
'
|
|
1466
|
+
'price': true,
|
|
1467
1467
|
},
|
|
1468
1468
|
'timeInForce': {
|
|
1469
1469
|
'IOC': true,
|
|
@@ -1505,7 +1505,7 @@ export default class bitget extends Exchange {
|
|
|
1505
1505
|
'fetchClosedOrders': {
|
|
1506
1506
|
'marginMode': true,
|
|
1507
1507
|
'limit': 100,
|
|
1508
|
-
'
|
|
1508
|
+
'daysBack': undefined,
|
|
1509
1509
|
'daysBackCanceled': undefined,
|
|
1510
1510
|
'untilDays': 90,
|
|
1511
1511
|
'trigger': true,
|
|
@@ -1533,7 +1533,7 @@ export default class bitget extends Exchange {
|
|
|
1533
1533
|
'mark': true,
|
|
1534
1534
|
'index': true,
|
|
1535
1535
|
},
|
|
1536
|
-
'
|
|
1536
|
+
'price': false,
|
|
1537
1537
|
},
|
|
1538
1538
|
'timeInForce': {
|
|
1539
1539
|
'IOC': true,
|
package/js/src/bitmart.js
CHANGED
|
@@ -740,7 +740,7 @@ export default class bitmart extends Exchange {
|
|
|
740
740
|
'fetchClosedOrders': {
|
|
741
741
|
'marginMode': true,
|
|
742
742
|
'limit': 200,
|
|
743
|
-
'
|
|
743
|
+
'daysBack': undefined,
|
|
744
744
|
'daysBackCanceled': undefined,
|
|
745
745
|
'untilDays': undefined,
|
|
746
746
|
'trigger': false,
|
|
@@ -769,7 +769,7 @@ export default class bitmart extends Exchange {
|
|
|
769
769
|
'mark': true,
|
|
770
770
|
'index': false,
|
|
771
771
|
},
|
|
772
|
-
'
|
|
772
|
+
'price': false,
|
|
773
773
|
},
|
|
774
774
|
'timeInForce': {
|
|
775
775
|
'IOC': true,
|
|
@@ -807,7 +807,7 @@ export default class bitmart extends Exchange {
|
|
|
807
807
|
'fetchClosedOrders': {
|
|
808
808
|
'marginMode': true,
|
|
809
809
|
'limit': 200,
|
|
810
|
-
'
|
|
810
|
+
'daysBack': undefined,
|
|
811
811
|
'daysBackCanceled': undefined,
|
|
812
812
|
'untilDays': undefined,
|
|
813
813
|
'trigger': false,
|
package/js/src/bitmex.js
CHANGED
|
@@ -335,7 +335,7 @@ export default class bitmex extends Exchange {
|
|
|
335
335
|
'fetchClosedOrders': {
|
|
336
336
|
'marginMode': false,
|
|
337
337
|
'limit': 500,
|
|
338
|
-
'
|
|
338
|
+
'daysBack': undefined,
|
|
339
339
|
'daysBackCanceled': undefined,
|
|
340
340
|
'untilDays': 1000000,
|
|
341
341
|
'trigger': false,
|
package/js/src/blofin.js
CHANGED
|
@@ -198,6 +198,18 @@ export default class blofin extends Exchange {
|
|
|
198
198
|
'trade/orders-tpsl-history': 1,
|
|
199
199
|
'user/query-apikey': 1,
|
|
200
200
|
'affiliate/basic': 1,
|
|
201
|
+
'copytrading/instruments': 1,
|
|
202
|
+
'copytrading/account/balance': 1,
|
|
203
|
+
'copytrading/account/positions-by-order': 1,
|
|
204
|
+
'copytrading/account/positions-details-by-order': 1,
|
|
205
|
+
'copytrading/account/positions-by-contract': 1,
|
|
206
|
+
'copytrading/account/position-mode': 1,
|
|
207
|
+
'copytrading/account/leverage-info': 1,
|
|
208
|
+
'copytrading/trade/orders-pending': 1,
|
|
209
|
+
'copytrading/trade/pending-tpsl-by-contract': 1,
|
|
210
|
+
'copytrading/trade/position-history-by-order': 1,
|
|
211
|
+
'copytrading/trade/orders-history': 1,
|
|
212
|
+
'copytrading/trade/pending-tpsl-by-order': 1,
|
|
201
213
|
},
|
|
202
214
|
'post': {
|
|
203
215
|
'trade/order': 1,
|
|
@@ -209,6 +221,16 @@ export default class blofin extends Exchange {
|
|
|
209
221
|
'trade/cancel-tpsl': 1,
|
|
210
222
|
'trade/close-position': 1,
|
|
211
223
|
'asset/transfer': 1,
|
|
224
|
+
'copytrading/account/set-position-mode': 1,
|
|
225
|
+
'copytrading/account/set-leverage': 1,
|
|
226
|
+
'copytrading/trade/place-order': 1,
|
|
227
|
+
'copytrading/trade/cancel-order': 1,
|
|
228
|
+
'copytrading/trade/place-tpsl-by-contract': 1,
|
|
229
|
+
'copytrading/trade/cancel-tpsl-by-contract': 1,
|
|
230
|
+
'copytrading/trade/place-tpsl-by-order': 1,
|
|
231
|
+
'copytrading/trade/cancel-tpsl-by-order': 1,
|
|
232
|
+
'copytrading/trade/close-position-by-order': 1,
|
|
233
|
+
'copytrading/trade/close-position-by-contract': 1,
|
|
212
234
|
},
|
|
213
235
|
},
|
|
214
236
|
},
|
package/js/src/bybit.js
CHANGED
|
@@ -1101,7 +1101,7 @@ export default class bybit extends Exchange {
|
|
|
1101
1101
|
'mark': true,
|
|
1102
1102
|
'index': true,
|
|
1103
1103
|
},
|
|
1104
|
-
'
|
|
1104
|
+
'price': true,
|
|
1105
1105
|
},
|
|
1106
1106
|
'timeInForce': {
|
|
1107
1107
|
'IOC': true,
|
|
@@ -1141,7 +1141,7 @@ export default class bybit extends Exchange {
|
|
|
1141
1141
|
'fetchClosedOrders': {
|
|
1142
1142
|
'marginMode': false,
|
|
1143
1143
|
'limit': 50,
|
|
1144
|
-
'
|
|
1144
|
+
'daysBack': 365 * 2,
|
|
1145
1145
|
'daysBackCanceled': 1,
|
|
1146
1146
|
'untilDays': 7,
|
|
1147
1147
|
'trigger': true,
|
|
@@ -1158,7 +1158,7 @@ export default class bybit extends Exchange {
|
|
|
1158
1158
|
'triggerDirection': false,
|
|
1159
1159
|
'attachedStopLossTakeProfit': {
|
|
1160
1160
|
'triggerPriceType': undefined,
|
|
1161
|
-
'
|
|
1161
|
+
'price': true,
|
|
1162
1162
|
},
|
|
1163
1163
|
'marketBuyRequiresPrice': true,
|
|
1164
1164
|
},
|
|
@@ -1245,7 +1245,7 @@ export default class bybit extends Exchange {
|
|
|
1245
1245
|
* @returns {any} [enableUnifiedMargin, enableUnifiedAccount]
|
|
1246
1246
|
*/
|
|
1247
1247
|
async isUnifiedEnabled(params = {}) {
|
|
1248
|
-
// The API key of user id must own one of permissions will be allowed to call following API endpoints
|
|
1248
|
+
// The API key of user id must own one of permissions will be allowed to call following API endpoints:
|
|
1249
1249
|
// SUB UID: "Account Transfer"
|
|
1250
1250
|
// MASTER UID: "Account Transfer", "Subaccount Transfer", "Withdrawal"
|
|
1251
1251
|
const enableUnifiedMargin = this.safeBool(this.options, 'enableUnifiedMargin');
|
package/js/src/coinbase.js
CHANGED
|
@@ -431,7 +431,7 @@ export default class coinbase extends Exchange {
|
|
|
431
431
|
'fetchClosedOrders': {
|
|
432
432
|
'marginMode': false,
|
|
433
433
|
'limit': undefined,
|
|
434
|
-
'
|
|
434
|
+
'daysBack': undefined,
|
|
435
435
|
'daysBackCanceled': undefined,
|
|
436
436
|
'untilDays': 10000,
|
|
437
437
|
'trigger': false,
|
package/js/src/coinex.js
CHANGED
|
@@ -552,7 +552,7 @@ export default class coinex extends Exchange {
|
|
|
552
552
|
'fetchClosedOrders': {
|
|
553
553
|
'marginMode': true,
|
|
554
554
|
'limit': 1000,
|
|
555
|
-
'
|
|
555
|
+
'daysBack': undefined,
|
|
556
556
|
'daysBackCanceled': undefined,
|
|
557
557
|
'untilDays': undefined,
|
|
558
558
|
'trigger': true,
|
package/js/src/cryptocom.js
CHANGED
|
@@ -412,7 +412,7 @@ export default class cryptocom extends Exchange {
|
|
|
412
412
|
'fetchClosedOrders': {
|
|
413
413
|
'marginMode': false,
|
|
414
414
|
'limit': 100,
|
|
415
|
-
'
|
|
415
|
+
'daysBack': undefined,
|
|
416
416
|
'daysBackCanceled': undefined,
|
|
417
417
|
'untilDays': 1,
|
|
418
418
|
'trigger': false,
|
package/js/src/exmo.d.ts
CHANGED
|
@@ -94,6 +94,7 @@ export default class exmo extends Exchange {
|
|
|
94
94
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
95
95
|
* @param {int} [limit] the maximum amount of candles to fetch
|
|
96
96
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
97
|
+
* @param {int} [params.until] timestamp in ms of the latest candle to fetch
|
|
97
98
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
98
99
|
*/
|
|
99
100
|
fetchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>;
|
package/js/src/exmo.js
CHANGED
|
@@ -868,39 +868,49 @@ export default class exmo extends Exchange {
|
|
|
868
868
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
869
869
|
* @param {int} [limit] the maximum amount of candles to fetch
|
|
870
870
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
871
|
+
* @param {int} [params.until] timestamp in ms of the latest candle to fetch
|
|
871
872
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
872
873
|
*/
|
|
873
874
|
async fetchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
|
|
874
875
|
await this.loadMarkets();
|
|
875
876
|
const market = this.market(symbol);
|
|
877
|
+
const until = this.safeIntegerProduct(params, 'until', 0.001);
|
|
878
|
+
const untilIsDefined = (until !== undefined);
|
|
876
879
|
const request = {
|
|
877
880
|
'symbol': market['id'],
|
|
878
881
|
'resolution': this.safeString(this.timeframes, timeframe, timeframe),
|
|
879
882
|
};
|
|
880
883
|
const maxLimit = 3000;
|
|
881
884
|
const duration = this.parseTimeframe(timeframe);
|
|
882
|
-
const now = this.milliseconds();
|
|
885
|
+
const now = this.parseToInt(this.milliseconds() / 1000);
|
|
883
886
|
if (since === undefined) {
|
|
887
|
+
const to = untilIsDefined ? Math.min(until, now) : now;
|
|
884
888
|
if (limit === undefined) {
|
|
885
889
|
limit = 1000; // cap default at generous amount
|
|
886
890
|
}
|
|
887
891
|
else {
|
|
888
892
|
limit = Math.min(limit, maxLimit);
|
|
889
893
|
}
|
|
890
|
-
request['from'] =
|
|
891
|
-
request['to'] =
|
|
894
|
+
request['from'] = to - (limit * duration) - 1;
|
|
895
|
+
request['to'] = to;
|
|
892
896
|
}
|
|
893
897
|
else {
|
|
894
898
|
request['from'] = this.parseToInt(since / 1000) - 1;
|
|
895
|
-
if (
|
|
896
|
-
|
|
899
|
+
if (untilIsDefined) {
|
|
900
|
+
request['to'] = Math.min(until, now);
|
|
897
901
|
}
|
|
898
902
|
else {
|
|
899
|
-
|
|
903
|
+
if (limit === undefined) {
|
|
904
|
+
limit = maxLimit;
|
|
905
|
+
}
|
|
906
|
+
else {
|
|
907
|
+
limit = Math.min(limit, maxLimit);
|
|
908
|
+
}
|
|
909
|
+
const to = this.sum(since, limit * duration);
|
|
910
|
+
request['to'] = Math.min(to, now);
|
|
900
911
|
}
|
|
901
|
-
const to = this.sum(since, limit * duration * 1000);
|
|
902
|
-
request['to'] = this.parseToInt(to / 1000);
|
|
903
912
|
}
|
|
913
|
+
params = this.omit(params, 'until');
|
|
904
914
|
const response = await this.publicGetCandlesHistory(this.extend(request, params));
|
|
905
915
|
//
|
|
906
916
|
// {
|
package/js/src/gate.js
CHANGED