ccxt 4.4.32 → 4.4.34
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 +8 -7
- package/dist/ccxt.browser.min.js +6 -6
- package/dist/cjs/ccxt.js +4 -1
- package/dist/cjs/src/abstract/ellipx.js +9 -0
- package/dist/cjs/src/alpaca.js +2 -0
- package/dist/cjs/src/base/Exchange.js +116 -1
- package/dist/cjs/src/binance.js +164 -6
- package/dist/cjs/src/bingx.js +156 -9
- package/dist/cjs/src/bitbank.js +5 -0
- package/dist/cjs/src/bitbns.js +2 -0
- package/dist/cjs/src/bitfinex2.js +2 -1
- package/dist/cjs/src/bitget.js +177 -44
- package/dist/cjs/src/bitmex.js +2 -0
- package/dist/cjs/src/bitopro.js +3 -0
- package/dist/cjs/src/bitrue.js +1 -0
- package/dist/cjs/src/btcmarkets.js +2 -0
- package/dist/cjs/src/bybit.js +148 -13
- package/dist/cjs/src/cex.js +16 -6
- package/dist/cjs/src/coinbase.js +5 -24
- package/dist/cjs/src/coinbaseexchange.js +2 -1
- package/dist/cjs/src/coinex.js +2 -0
- package/dist/cjs/src/coinone.js +7 -7
- package/dist/cjs/src/coinsph.js +7 -7
- package/dist/cjs/src/coinspot.js +39 -39
- package/dist/cjs/src/cryptocom.js +36 -34
- package/dist/cjs/src/ellipx.js +1871 -0
- package/dist/cjs/src/gate.js +2 -1
- package/dist/cjs/src/hyperliquid.js +16 -2
- package/dist/cjs/src/kraken.js +1 -0
- package/dist/cjs/src/krakenfutures.js +3 -1
- package/dist/cjs/src/kucoinfutures.js +1 -1
- package/dist/cjs/src/lbank.js +1 -0
- package/dist/cjs/src/okcoin.js +2 -0
- package/dist/cjs/src/okx.js +104 -9
- package/dist/cjs/src/onetrading.js +14 -1
- package/dist/cjs/src/paradex.js +2 -0
- package/dist/cjs/src/phemex.js +35 -7
- package/dist/cjs/src/poloniex.js +3 -1
- package/dist/cjs/src/poloniexfutures.js +3 -1
- package/dist/cjs/src/pro/idex.js +5 -0
- package/dist/cjs/src/pro/okx.js +11 -1
- package/dist/cjs/src/pro/probit.js +4 -2
- package/dist/cjs/src/pro/woo.js +15 -15
- package/dist/cjs/src/vertex.js +2 -0
- package/dist/cjs/src/woo.js +69 -69
- package/examples/js/cli.js +1 -1
- package/js/ccxt.d.ts +5 -2
- package/js/ccxt.js +4 -2
- package/js/src/abstract/bingx.d.ts +16 -0
- package/js/src/abstract/bitbank.d.ts +5 -0
- package/js/src/abstract/bitfinex2.d.ts +1 -0
- package/js/src/abstract/coinbaseexchange.d.ts +1 -0
- package/js/src/abstract/ellipx.d.ts +28 -0
- package/js/src/abstract/ellipx.js +11 -0
- package/js/src/abstract/kraken.d.ts +1 -0
- package/js/src/alpaca.js +2 -0
- package/js/src/base/Exchange.d.ts +11 -0
- package/js/src/base/Exchange.js +116 -1
- package/js/src/binance.js +164 -6
- package/js/src/bingx.d.ts +3 -1
- package/js/src/bingx.js +156 -9
- package/js/src/bitbank.js +5 -0
- package/js/src/bitbns.js +2 -0
- package/js/src/bitfinex2.js +2 -1
- package/js/src/bitget.d.ts +4 -4
- package/js/src/bitget.js +177 -44
- package/js/src/bitmex.js +2 -0
- package/js/src/bitopro.d.ts +1 -0
- package/js/src/bitopro.js +3 -0
- package/js/src/bitrue.js +1 -0
- package/js/src/btcmarkets.d.ts +1 -0
- package/js/src/btcmarkets.js +2 -0
- package/js/src/bybit.d.ts +3 -2
- package/js/src/bybit.js +149 -14
- package/js/src/cex.d.ts +1 -0
- package/js/src/cex.js +17 -7
- package/js/src/coinbase.d.ts +2 -1
- package/js/src/coinbase.js +5 -24
- package/js/src/coinbaseexchange.js +2 -1
- package/js/src/coinex.js +2 -0
- package/js/src/coinone.js +7 -7
- package/js/src/coinsph.js +7 -7
- package/js/src/coinspot.js +39 -39
- package/js/src/cryptocom.d.ts +1 -1
- package/js/src/cryptocom.js +36 -34
- package/js/src/ellipx.d.ts +236 -0
- package/js/src/ellipx.js +1874 -0
- package/js/src/gate.d.ts +2 -2
- package/js/src/gate.js +2 -1
- package/js/src/hyperliquid.d.ts +2 -1
- package/js/src/hyperliquid.js +16 -2
- package/js/src/kraken.js +1 -0
- package/js/src/krakenfutures.js +3 -1
- package/js/src/kucoinfutures.d.ts +1 -1
- package/js/src/kucoinfutures.js +1 -1
- package/js/src/lbank.js +1 -0
- package/js/src/okcoin.js +2 -0
- package/js/src/okx.d.ts +1 -1
- package/js/src/okx.js +104 -9
- package/js/src/onetrading.d.ts +5 -0
- package/js/src/onetrading.js +15 -2
- package/js/src/paradex.js +2 -0
- package/js/src/phemex.d.ts +4 -0
- package/js/src/phemex.js +35 -7
- package/js/src/poloniex.d.ts +1 -1
- package/js/src/poloniex.js +3 -1
- package/js/src/poloniexfutures.d.ts +1 -1
- package/js/src/poloniexfutures.js +3 -1
- package/js/src/pro/idex.d.ts +5 -0
- package/js/src/pro/idex.js +5 -0
- package/js/src/pro/okx.js +11 -1
- package/js/src/pro/probit.js +4 -2
- package/js/src/pro/woo.d.ts +11 -11
- package/js/src/pro/woo.js +15 -15
- package/js/src/vertex.js +2 -0
- package/js/src/woo.d.ts +60 -60
- package/js/src/woo.js +69 -69
- package/package.json +3 -3
package/js/src/bitget.js
CHANGED
|
@@ -1442,6 +1442,141 @@ export default class bitget extends Exchange {
|
|
|
1442
1442
|
},
|
|
1443
1443
|
'defaultTimeInForce': 'GTC', // 'GTC' = Good To Cancel (default), 'IOC' = Immediate Or Cancel
|
|
1444
1444
|
},
|
|
1445
|
+
'features': {
|
|
1446
|
+
'spot': {
|
|
1447
|
+
'sandbox': true,
|
|
1448
|
+
'createOrder': {
|
|
1449
|
+
'marginMode': true,
|
|
1450
|
+
'triggerPrice': true,
|
|
1451
|
+
'triggerPriceType': {
|
|
1452
|
+
'last': true,
|
|
1453
|
+
'mark': true,
|
|
1454
|
+
'index': false, // not on spot
|
|
1455
|
+
},
|
|
1456
|
+
'triggerDirection': false,
|
|
1457
|
+
'stopLossPrice': true,
|
|
1458
|
+
'takeProfitPrice': true,
|
|
1459
|
+
'attachedStopLossTakeProfit': {
|
|
1460
|
+
'triggerPriceType': {
|
|
1461
|
+
'last': false,
|
|
1462
|
+
'mark': false,
|
|
1463
|
+
'index': false,
|
|
1464
|
+
},
|
|
1465
|
+
'limitPrice': true,
|
|
1466
|
+
},
|
|
1467
|
+
'timeInForce': {
|
|
1468
|
+
'GTC': true,
|
|
1469
|
+
'IOC': true,
|
|
1470
|
+
'FOK': true,
|
|
1471
|
+
'PO': true,
|
|
1472
|
+
'GTD': false,
|
|
1473
|
+
},
|
|
1474
|
+
'hedged': false,
|
|
1475
|
+
'trailing': false,
|
|
1476
|
+
'marketBuyRequiresPrice': true,
|
|
1477
|
+
'marketBuyByCost': true,
|
|
1478
|
+
// exchange-supported features
|
|
1479
|
+
// 'selfTradePrevention': true,
|
|
1480
|
+
// 'twap': false,
|
|
1481
|
+
// 'iceberg': false,
|
|
1482
|
+
// 'oco': false,
|
|
1483
|
+
},
|
|
1484
|
+
'createOrders': {
|
|
1485
|
+
'max': 50,
|
|
1486
|
+
},
|
|
1487
|
+
'fetchMyTrades': {
|
|
1488
|
+
'marginMode': true,
|
|
1489
|
+
'limit': 100,
|
|
1490
|
+
'daysBack': undefined,
|
|
1491
|
+
'untilDays': 90,
|
|
1492
|
+
},
|
|
1493
|
+
'fetchOrder': {
|
|
1494
|
+
'marginMode': false,
|
|
1495
|
+
'trigger': false,
|
|
1496
|
+
'trailing': false,
|
|
1497
|
+
},
|
|
1498
|
+
'fetchOpenOrders': {
|
|
1499
|
+
'marginMode': true,
|
|
1500
|
+
'limit': 100,
|
|
1501
|
+
'trigger': true,
|
|
1502
|
+
'trailing': false,
|
|
1503
|
+
},
|
|
1504
|
+
'fetchOrders': undefined,
|
|
1505
|
+
'fetchClosedOrders': {
|
|
1506
|
+
'marginMode': true,
|
|
1507
|
+
'limit': 100,
|
|
1508
|
+
'daysBackClosed': undefined,
|
|
1509
|
+
'daysBackCanceled': undefined,
|
|
1510
|
+
'untilDays': 90,
|
|
1511
|
+
'trigger': true,
|
|
1512
|
+
'trailing': false,
|
|
1513
|
+
},
|
|
1514
|
+
'fetchOHLCV': {
|
|
1515
|
+
'limit': 1000, // variable timespans for recent endpoint, 200 for historical
|
|
1516
|
+
},
|
|
1517
|
+
},
|
|
1518
|
+
'forPerps': {
|
|
1519
|
+
'extends': 'spot',
|
|
1520
|
+
'createOrder': {
|
|
1521
|
+
'triggerPrice': true,
|
|
1522
|
+
'triggerPriceType': {
|
|
1523
|
+
'last': true,
|
|
1524
|
+
'mark': true,
|
|
1525
|
+
'index': false, // not on spot
|
|
1526
|
+
},
|
|
1527
|
+
'triggerDirection': false,
|
|
1528
|
+
'stopLossPrice': true,
|
|
1529
|
+
'takeProfitPrice': true,
|
|
1530
|
+
'attachedStopLossTakeProfit': {
|
|
1531
|
+
'triggerPriceType': {
|
|
1532
|
+
'last': true,
|
|
1533
|
+
'mark': true,
|
|
1534
|
+
'index': true,
|
|
1535
|
+
},
|
|
1536
|
+
'limitPrice': false,
|
|
1537
|
+
},
|
|
1538
|
+
'timeInForce': {
|
|
1539
|
+
'GTC': true,
|
|
1540
|
+
'IOC': true,
|
|
1541
|
+
'FOK': true,
|
|
1542
|
+
'PO': true,
|
|
1543
|
+
'GTD': false,
|
|
1544
|
+
},
|
|
1545
|
+
'hedged': true,
|
|
1546
|
+
'trailing': true,
|
|
1547
|
+
'marketBuyRequiresPrice': false,
|
|
1548
|
+
'marketBuyByCost': false,
|
|
1549
|
+
// exchange-supported features
|
|
1550
|
+
// 'selfTradePrevention': true,
|
|
1551
|
+
// 'trailing': true,
|
|
1552
|
+
// 'twap': false,
|
|
1553
|
+
// 'iceberg': false,
|
|
1554
|
+
// 'oco': false,
|
|
1555
|
+
},
|
|
1556
|
+
'fetchMyTrades': {
|
|
1557
|
+
'untilDays': 7,
|
|
1558
|
+
},
|
|
1559
|
+
'fetchClosedOrders': {
|
|
1560
|
+
'trailing': true,
|
|
1561
|
+
},
|
|
1562
|
+
},
|
|
1563
|
+
'swap': {
|
|
1564
|
+
'linear': {
|
|
1565
|
+
'extends': 'forPerps',
|
|
1566
|
+
},
|
|
1567
|
+
'inverse': {
|
|
1568
|
+
'extends': 'forPerps',
|
|
1569
|
+
},
|
|
1570
|
+
},
|
|
1571
|
+
'future': {
|
|
1572
|
+
'linear': {
|
|
1573
|
+
'extends': 'forPerps',
|
|
1574
|
+
},
|
|
1575
|
+
'inverse': {
|
|
1576
|
+
'extends': 'forPerps',
|
|
1577
|
+
},
|
|
1578
|
+
},
|
|
1579
|
+
},
|
|
1445
1580
|
});
|
|
1446
1581
|
}
|
|
1447
1582
|
setSandboxMode(enabled) {
|
|
@@ -4278,7 +4413,7 @@ export default class bitget extends Exchange {
|
|
|
4278
4413
|
if (type === 'limit') {
|
|
4279
4414
|
request['price'] = this.priceToPrecision(symbol, price);
|
|
4280
4415
|
}
|
|
4281
|
-
const
|
|
4416
|
+
const triggerPriceType = this.safeString2(params, 'triggerPriceType', 'triggerType', 'mark_price');
|
|
4282
4417
|
const reduceOnly = this.safeBool(params, 'reduceOnly', false);
|
|
4283
4418
|
const clientOrderId = this.safeString2(params, 'clientOid', 'clientOrderId');
|
|
4284
4419
|
const exchangeSpecificTifParam = this.safeString2(params, 'force', 'timeInForce');
|
|
@@ -4309,7 +4444,7 @@ export default class bitget extends Exchange {
|
|
|
4309
4444
|
request['clientOid'] = clientOrderId;
|
|
4310
4445
|
}
|
|
4311
4446
|
if (isTriggerOrder || isStopLossOrTakeProfitTrigger || isTrailingPercentOrder) {
|
|
4312
|
-
request['triggerType'] =
|
|
4447
|
+
request['triggerType'] = triggerPriceType;
|
|
4313
4448
|
}
|
|
4314
4449
|
if (isTrailingPercentOrder) {
|
|
4315
4450
|
if (!isMarketOrder) {
|
|
@@ -4455,7 +4590,7 @@ export default class bitget extends Exchange {
|
|
|
4455
4590
|
}
|
|
4456
4591
|
if (triggerPrice !== undefined) {
|
|
4457
4592
|
request['planType'] = planType;
|
|
4458
|
-
request['triggerType'] =
|
|
4593
|
+
request['triggerType'] = triggerPriceType;
|
|
4459
4594
|
request['triggerPrice'] = this.priceToPrecision(symbol, triggerPrice);
|
|
4460
4595
|
if (price !== undefined) {
|
|
4461
4596
|
request['executePrice'] = this.priceToPrecision(symbol, price);
|
|
@@ -4772,7 +4907,7 @@ export default class bitget extends Exchange {
|
|
|
4772
4907
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
4773
4908
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4774
4909
|
* @param {string} [params.marginMode] 'isolated' or 'cross' for spot margin trading
|
|
4775
|
-
* @param {boolean} [params.
|
|
4910
|
+
* @param {boolean} [params.trigger] set to true for canceling trigger orders
|
|
4776
4911
|
* @param {string} [params.planType] *swap only* either profit_plan, loss_plan, normal_plan, pos_profit, pos_loss, moving_plan or track_plan
|
|
4777
4912
|
* @param {boolean} [params.trailing] set to true if you want to cancel a trailing order
|
|
4778
4913
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
@@ -4796,19 +4931,19 @@ export default class bitget extends Exchange {
|
|
|
4796
4931
|
[marginMode, params] = this.handleMarginModeAndParams('cancelOrder', params);
|
|
4797
4932
|
const request = {};
|
|
4798
4933
|
const trailing = this.safeValue(params, 'trailing');
|
|
4799
|
-
const
|
|
4934
|
+
const trigger = this.safeValue2(params, 'stop', 'trigger');
|
|
4800
4935
|
params = this.omit(params, ['stop', 'trigger', 'trailing']);
|
|
4801
|
-
if (!(market['spot'] &&
|
|
4936
|
+
if (!(market['spot'] && trigger)) {
|
|
4802
4937
|
request['symbol'] = market['id'];
|
|
4803
4938
|
}
|
|
4804
|
-
if (!((market['swap'] || market['future']) &&
|
|
4939
|
+
if (!((market['swap'] || market['future']) && trigger)) {
|
|
4805
4940
|
request['orderId'] = id;
|
|
4806
4941
|
}
|
|
4807
4942
|
if ((market['swap']) || (market['future'])) {
|
|
4808
4943
|
let productType = undefined;
|
|
4809
4944
|
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
4810
4945
|
request['productType'] = productType;
|
|
4811
|
-
if (
|
|
4946
|
+
if (trigger || trailing) {
|
|
4812
4947
|
const orderIdList = [];
|
|
4813
4948
|
const orderId = {
|
|
4814
4949
|
'orderId': id,
|
|
@@ -4821,7 +4956,7 @@ export default class bitget extends Exchange {
|
|
|
4821
4956
|
request['planType'] = planType;
|
|
4822
4957
|
response = await this.privateMixPostV2MixOrderCancelPlanOrder(this.extend(request, params));
|
|
4823
4958
|
}
|
|
4824
|
-
else if (
|
|
4959
|
+
else if (trigger) {
|
|
4825
4960
|
response = await this.privateMixPostV2MixOrderCancelPlanOrder(this.extend(request, params));
|
|
4826
4961
|
}
|
|
4827
4962
|
else {
|
|
@@ -4838,7 +4973,7 @@ export default class bitget extends Exchange {
|
|
|
4838
4973
|
}
|
|
4839
4974
|
}
|
|
4840
4975
|
else {
|
|
4841
|
-
if (
|
|
4976
|
+
if (trigger) {
|
|
4842
4977
|
response = await this.privateSpotPostV2SpotTradeCancelPlanOrder(this.extend(request, params));
|
|
4843
4978
|
}
|
|
4844
4979
|
else {
|
|
@@ -4892,7 +5027,7 @@ export default class bitget extends Exchange {
|
|
|
4892
5027
|
//
|
|
4893
5028
|
const data = this.safeValue(response, 'data', {});
|
|
4894
5029
|
let order = undefined;
|
|
4895
|
-
if ((market['swap'] || market['future']) &&
|
|
5030
|
+
if ((market['swap'] || market['future']) && trigger) {
|
|
4896
5031
|
const orderInfo = this.safeValue(data, 'successList', []);
|
|
4897
5032
|
order = orderInfo[0];
|
|
4898
5033
|
}
|
|
@@ -4914,7 +5049,7 @@ export default class bitget extends Exchange {
|
|
|
4914
5049
|
* @param {string} symbol unified market symbol, default is undefined
|
|
4915
5050
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4916
5051
|
* @param {string} [params.marginMode] 'isolated' or 'cross' for spot margin trading
|
|
4917
|
-
* @param {boolean} [params.
|
|
5052
|
+
* @param {boolean} [params.trigger] *contract only* set to true for canceling trigger orders
|
|
4918
5053
|
* @returns {object} an array of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4919
5054
|
*/
|
|
4920
5055
|
async cancelOrders(ids, symbol = undefined, params = {}) {
|
|
@@ -4933,7 +5068,7 @@ export default class bitget extends Exchange {
|
|
|
4933
5068
|
}
|
|
4934
5069
|
let marginMode = undefined;
|
|
4935
5070
|
[marginMode, params] = this.handleMarginModeAndParams('cancelOrders', params);
|
|
4936
|
-
const
|
|
5071
|
+
const trigger = this.safeValue2(params, 'stop', 'trigger');
|
|
4937
5072
|
params = this.omit(params, ['stop', 'trigger']);
|
|
4938
5073
|
const orderIdList = [];
|
|
4939
5074
|
for (let i = 0; i < ids.length; i++) {
|
|
@@ -4970,7 +5105,7 @@ export default class bitget extends Exchange {
|
|
|
4970
5105
|
let productType = undefined;
|
|
4971
5106
|
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
4972
5107
|
request['productType'] = productType;
|
|
4973
|
-
if (
|
|
5108
|
+
if (trigger) {
|
|
4974
5109
|
response = await this.privateMixPostV2MixOrderCancelPlanOrder(this.extend(request, params));
|
|
4975
5110
|
}
|
|
4976
5111
|
else {
|
|
@@ -5009,7 +5144,7 @@ export default class bitget extends Exchange {
|
|
|
5009
5144
|
* @param {string} symbol unified market symbol
|
|
5010
5145
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5011
5146
|
* @param {string} [params.marginMode] 'isolated' or 'cross' for spot margin trading
|
|
5012
|
-
* @param {boolean} [params.
|
|
5147
|
+
* @param {boolean} [params.trigger] *contract only* set to true for canceling trigger orders
|
|
5013
5148
|
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
5014
5149
|
*/
|
|
5015
5150
|
async cancelAllOrders(symbol = undefined, params = {}) {
|
|
@@ -5031,7 +5166,7 @@ export default class bitget extends Exchange {
|
|
|
5031
5166
|
const request = {
|
|
5032
5167
|
'symbol': market['id'],
|
|
5033
5168
|
};
|
|
5034
|
-
const
|
|
5169
|
+
const trigger = this.safeBool2(params, 'stop', 'trigger');
|
|
5035
5170
|
params = this.omit(params, ['stop', 'trigger']);
|
|
5036
5171
|
let response = undefined;
|
|
5037
5172
|
if (market['spot']) {
|
|
@@ -5060,7 +5195,7 @@ export default class bitget extends Exchange {
|
|
|
5060
5195
|
//
|
|
5061
5196
|
}
|
|
5062
5197
|
else {
|
|
5063
|
-
if (
|
|
5198
|
+
if (trigger) {
|
|
5064
5199
|
const stopRequest = {
|
|
5065
5200
|
'symbolList': [market['id']],
|
|
5066
5201
|
};
|
|
@@ -5096,7 +5231,7 @@ export default class bitget extends Exchange {
|
|
|
5096
5231
|
let productType = undefined;
|
|
5097
5232
|
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
5098
5233
|
request['productType'] = productType;
|
|
5099
|
-
if (
|
|
5234
|
+
if (trigger) {
|
|
5100
5235
|
response = await this.privateMixPostV2MixOrderCancelPlanOrder(this.extend(request, params));
|
|
5101
5236
|
}
|
|
5102
5237
|
else {
|
|
@@ -5263,7 +5398,7 @@ export default class bitget extends Exchange {
|
|
|
5263
5398
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5264
5399
|
* @param {int} [params.until] the latest time in ms to fetch orders for
|
|
5265
5400
|
* @param {string} [params.planType] *contract stop only* 'normal_plan': average trigger order, 'profit_loss': opened tp/sl orders, 'track_plan': trailing stop order, default is 'normal_plan'
|
|
5266
|
-
* @param {boolean} [params.
|
|
5401
|
+
* @param {boolean} [params.trigger] set to true for fetching trigger orders
|
|
5267
5402
|
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
5268
5403
|
* @param {string} [params.isPlan] *swap only* 'plan' for stop orders and 'profit_loss' for tp/sl orders, default is 'plan'
|
|
5269
5404
|
* @param {boolean} [params.trailing] set to true if you want to fetch trailing orders
|
|
@@ -5310,9 +5445,9 @@ export default class bitget extends Exchange {
|
|
|
5310
5445
|
}
|
|
5311
5446
|
let response = undefined;
|
|
5312
5447
|
const trailing = this.safeBool(params, 'trailing');
|
|
5313
|
-
const
|
|
5448
|
+
const trigger = this.safeBool2(params, 'stop', 'trigger');
|
|
5314
5449
|
const planTypeDefined = this.safeString(params, 'planType') !== undefined;
|
|
5315
|
-
const
|
|
5450
|
+
const isTrigger = (trigger || planTypeDefined);
|
|
5316
5451
|
params = this.omit(params, ['stop', 'trigger', 'trailing']);
|
|
5317
5452
|
[request, params] = this.handleUntilOption('endTime', request, params);
|
|
5318
5453
|
if (since !== undefined) {
|
|
@@ -5344,7 +5479,7 @@ export default class bitget extends Exchange {
|
|
|
5344
5479
|
}
|
|
5345
5480
|
}
|
|
5346
5481
|
else {
|
|
5347
|
-
if (
|
|
5482
|
+
if (trigger) {
|
|
5348
5483
|
response = await this.privateSpotGetV2SpotTradeCurrentPlanOrder(this.extend(request, query));
|
|
5349
5484
|
}
|
|
5350
5485
|
else {
|
|
@@ -5361,7 +5496,7 @@ export default class bitget extends Exchange {
|
|
|
5361
5496
|
request['planType'] = planType;
|
|
5362
5497
|
response = await this.privateMixGetV2MixOrderOrdersPlanPending(this.extend(request, query));
|
|
5363
5498
|
}
|
|
5364
|
-
else if (
|
|
5499
|
+
else if (isTrigger) {
|
|
5365
5500
|
const planType = this.safeString(query, 'planType', 'normal_plan');
|
|
5366
5501
|
request['planType'] = planType;
|
|
5367
5502
|
response = await this.privateMixGetV2MixOrderOrdersPlanPending(this.extend(request, query));
|
|
@@ -5547,7 +5682,7 @@ export default class bitget extends Exchange {
|
|
|
5547
5682
|
//
|
|
5548
5683
|
const data = this.safeValue(response, 'data');
|
|
5549
5684
|
if (type === 'spot') {
|
|
5550
|
-
if ((marginMode !== undefined) ||
|
|
5685
|
+
if ((marginMode !== undefined) || trigger) {
|
|
5551
5686
|
const resultList = this.safeList(data, 'orderList', []);
|
|
5552
5687
|
return this.parseOrders(resultList, market, since, limit);
|
|
5553
5688
|
}
|
|
@@ -5661,7 +5796,7 @@ export default class bitget extends Exchange {
|
|
|
5661
5796
|
}
|
|
5662
5797
|
let response = undefined;
|
|
5663
5798
|
const trailing = this.safeValue(params, 'trailing');
|
|
5664
|
-
const
|
|
5799
|
+
const trigger = this.safeBool2(params, 'stop', 'trigger');
|
|
5665
5800
|
params = this.omit(params, ['stop', 'trigger', 'trailing']);
|
|
5666
5801
|
[request, params] = this.handleUntilOption('endTime', request, params);
|
|
5667
5802
|
if (since !== undefined) {
|
|
@@ -5691,25 +5826,23 @@ export default class bitget extends Exchange {
|
|
|
5691
5826
|
response = await this.privateMarginGetV2MarginCrossedHistoryOrders(this.extend(request, params));
|
|
5692
5827
|
}
|
|
5693
5828
|
}
|
|
5694
|
-
else {
|
|
5695
|
-
if (
|
|
5696
|
-
|
|
5697
|
-
throw new ArgumentsRequired(this.id + ' fetchCanceledAndClosedOrders() requires a symbol argument');
|
|
5698
|
-
}
|
|
5699
|
-
const endTime = this.safeIntegerN(params, ['endTime', 'until']);
|
|
5700
|
-
params = this.omit(params, ['until']);
|
|
5701
|
-
if (since === undefined) {
|
|
5702
|
-
since = now - 7776000000;
|
|
5703
|
-
request['startTime'] = since;
|
|
5704
|
-
}
|
|
5705
|
-
if (endTime === undefined) {
|
|
5706
|
-
request['endTime'] = now;
|
|
5707
|
-
}
|
|
5708
|
-
response = await this.privateSpotGetV2SpotTradeHistoryPlanOrder(this.extend(request, params));
|
|
5829
|
+
else if (trigger) {
|
|
5830
|
+
if (symbol === undefined) {
|
|
5831
|
+
throw new ArgumentsRequired(this.id + ' fetchCanceledAndClosedOrders() requires a symbol argument');
|
|
5709
5832
|
}
|
|
5710
|
-
|
|
5711
|
-
|
|
5833
|
+
const endTime = this.safeIntegerN(params, ['endTime', 'until']);
|
|
5834
|
+
params = this.omit(params, ['until']);
|
|
5835
|
+
if (since === undefined) {
|
|
5836
|
+
since = now - 7776000000;
|
|
5837
|
+
request['startTime'] = since;
|
|
5838
|
+
}
|
|
5839
|
+
if (endTime === undefined) {
|
|
5840
|
+
request['endTime'] = now;
|
|
5712
5841
|
}
|
|
5842
|
+
response = await this.privateSpotGetV2SpotTradeHistoryPlanOrder(this.extend(request, params));
|
|
5843
|
+
}
|
|
5844
|
+
else {
|
|
5845
|
+
response = await this.privateSpotGetV2SpotTradeHistoryOrders(this.extend(request, params));
|
|
5713
5846
|
}
|
|
5714
5847
|
}
|
|
5715
5848
|
else {
|
|
@@ -5721,7 +5854,7 @@ export default class bitget extends Exchange {
|
|
|
5721
5854
|
request['planType'] = planType;
|
|
5722
5855
|
response = await this.privateMixGetV2MixOrderOrdersPlanHistory(this.extend(request, params));
|
|
5723
5856
|
}
|
|
5724
|
-
else if (
|
|
5857
|
+
else if (trigger) {
|
|
5725
5858
|
const planType = this.safeString(params, 'planType', 'normal_plan');
|
|
5726
5859
|
request['planType'] = planType;
|
|
5727
5860
|
response = await this.privateMixGetV2MixOrderOrdersPlanHistory(this.extend(request, params));
|
|
@@ -5910,7 +6043,7 @@ export default class bitget extends Exchange {
|
|
|
5910
6043
|
//
|
|
5911
6044
|
const data = this.safeValue(response, 'data', {});
|
|
5912
6045
|
if (marketType === 'spot') {
|
|
5913
|
-
if ((marginMode !== undefined) ||
|
|
6046
|
+
if ((marginMode !== undefined) || trigger) {
|
|
5914
6047
|
return this.parseOrders(this.safeValue(data, 'orderList', []), market, since, limit);
|
|
5915
6048
|
}
|
|
5916
6049
|
}
|
package/js/src/bitmex.js
CHANGED
|
@@ -47,7 +47,9 @@ export default class bitmex extends Exchange {
|
|
|
47
47
|
'closePosition': true,
|
|
48
48
|
'createOrder': true,
|
|
49
49
|
'createReduceOnlyOrder': true,
|
|
50
|
+
'createStopOrder': true,
|
|
50
51
|
'createTrailingAmountOrder': true,
|
|
52
|
+
'createTriggerOrder': true,
|
|
51
53
|
'editOrder': true,
|
|
52
54
|
'fetchBalance': true,
|
|
53
55
|
'fetchClosedOrders': true,
|
package/js/src/bitopro.d.ts
CHANGED
|
@@ -117,6 +117,7 @@ export default class bitopro extends Exchange {
|
|
|
117
117
|
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
118
118
|
* @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
|
119
119
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
120
|
+
* @param {object} [params.triggerPrice] the price at which a trigger order is triggered at
|
|
120
121
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
121
122
|
*/
|
|
122
123
|
createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
|
package/js/src/bitopro.js
CHANGED
|
@@ -37,6 +37,8 @@ export default class bitopro extends Exchange {
|
|
|
37
37
|
'closeAllPositions': false,
|
|
38
38
|
'closePosition': false,
|
|
39
39
|
'createOrder': true,
|
|
40
|
+
'createStopOrder': true,
|
|
41
|
+
'createTriggerOrder': true,
|
|
40
42
|
'editOrder': false,
|
|
41
43
|
'fetchBalance': true,
|
|
42
44
|
'fetchBorrowRateHistories': false,
|
|
@@ -1005,6 +1007,7 @@ export default class bitopro extends Exchange {
|
|
|
1005
1007
|
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
1006
1008
|
* @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
|
1007
1009
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1010
|
+
* @param {object} [params.triggerPrice] the price at which a trigger order is triggered at
|
|
1008
1011
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1009
1012
|
*/
|
|
1010
1013
|
async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
|
package/js/src/bitrue.js
CHANGED
|
@@ -514,6 +514,7 @@ export default class bitrue extends Exchange {
|
|
|
514
514
|
'-4051': InsufficientFunds, // {"code":-4051,"msg":"Isolated balance insufficient."}
|
|
515
515
|
},
|
|
516
516
|
'broad': {
|
|
517
|
+
'Insufficient account balance': InsufficientFunds,
|
|
517
518
|
'has no operation privilege': PermissionDenied,
|
|
518
519
|
'MAX_POSITION': InvalidOrder, // {"code":-2010,"msg":"Filter failure: MAX_POSITION"}
|
|
519
520
|
},
|
package/js/src/btcmarkets.d.ts
CHANGED
|
@@ -136,6 +136,7 @@ export default class btcmarkets extends Exchange {
|
|
|
136
136
|
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
137
137
|
* @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
|
138
138
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
139
|
+
* @param {float} [params.triggerPrice] the price at which a trigger order is triggered at
|
|
139
140
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
140
141
|
*/
|
|
141
142
|
createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
|
package/js/src/btcmarkets.js
CHANGED
|
@@ -38,6 +38,7 @@ export default class btcmarkets extends Exchange {
|
|
|
38
38
|
'createDepositAddress': false,
|
|
39
39
|
'createOrder': true,
|
|
40
40
|
'createReduceOnlyOrder': false,
|
|
41
|
+
'createTriggerOrder': true,
|
|
41
42
|
'fetchBalance': true,
|
|
42
43
|
'fetchBorrowRateHistories': false,
|
|
43
44
|
'fetchBorrowRateHistory': false,
|
|
@@ -795,6 +796,7 @@ export default class btcmarkets extends Exchange {
|
|
|
795
796
|
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
796
797
|
* @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
|
797
798
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
799
|
+
* @param {float} [params.triggerPrice] the price at which a trigger order is triggered at
|
|
798
800
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
799
801
|
*/
|
|
800
802
|
async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
|
package/js/src/bybit.d.ts
CHANGED
|
@@ -8,14 +8,14 @@ export default class bybit extends Exchange {
|
|
|
8
8
|
describe(): any;
|
|
9
9
|
enableDemoTrading(enable: boolean): void;
|
|
10
10
|
nonce(): number;
|
|
11
|
-
addPaginationCursorToResult(response: any): any;
|
|
11
|
+
addPaginationCursorToResult(response: any): any[];
|
|
12
12
|
/**
|
|
13
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
14
13
|
* @method
|
|
15
14
|
* @name bybit#isUnifiedEnabled
|
|
16
15
|
* @see https://bybit-exchange.github.io/docs/v5/user/apikey-info#http-request
|
|
17
16
|
* @see https://bybit-exchange.github.io/docs/v5/account/account-info
|
|
18
17
|
* @description returns [enableUnifiedMargin, enableUnifiedAccount] so the user can check if unified account is enabled
|
|
18
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
19
19
|
* @returns {any} [enableUnifiedMargin, enableUnifiedAccount]
|
|
20
20
|
*/
|
|
21
21
|
isUnifiedEnabled(params?: {}): Promise<any[]>;
|
|
@@ -83,6 +83,7 @@ export default class bybit extends Exchange {
|
|
|
83
83
|
* @param {string[]} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
84
84
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
85
85
|
* @param {string} [params.subType] *contract only* 'linear', 'inverse'
|
|
86
|
+
* @param {string} [params.baseCoin] *option only* base coin, default is 'BTC'
|
|
86
87
|
* @returns {object} an array of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
87
88
|
*/
|
|
88
89
|
fetchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
|