ccxt 4.5.22 → 4.5.23
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 +6 -5
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +6 -1
- package/dist/cjs/src/abstract/bullish.js +11 -0
- package/dist/cjs/src/base/Exchange.js +3 -2
- package/dist/cjs/src/base/ws/WsClient.js +15 -0
- package/dist/cjs/src/binance.js +159 -36
- package/dist/cjs/src/bingx.js +2 -1
- package/dist/cjs/src/bitmart.js +1 -0
- package/dist/cjs/src/bullish.js +2919 -0
- package/dist/cjs/src/bybit.js +34 -37
- package/dist/cjs/src/gate.js +2 -2
- package/dist/cjs/src/htx.js +4 -1
- package/dist/cjs/src/hyperliquid.js +115 -12
- package/dist/cjs/src/kucoin.js +22 -3
- package/dist/cjs/src/mexc.js +7 -0
- package/dist/cjs/src/okx.js +117 -63
- package/dist/cjs/src/paradex.js +78 -3
- package/dist/cjs/src/pro/binance.js +131 -29
- package/dist/cjs/src/pro/bullish.js +781 -0
- package/dist/cjs/src/pro/coinbase.js +2 -2
- package/dist/cjs/src/pro/hyperliquid.js +75 -15
- package/dist/cjs/src/pro/upbit.js +28 -82
- package/js/ccxt.d.ts +8 -2
- package/js/ccxt.js +6 -2
- package/js/src/abstract/binance.d.ts +1 -0
- package/js/src/abstract/binancecoinm.d.ts +1 -0
- package/js/src/abstract/binanceus.d.ts +1 -0
- package/js/src/abstract/binanceusdm.d.ts +1 -0
- package/js/src/abstract/bingx.d.ts +1 -0
- package/js/src/abstract/bullish.d.ts +65 -0
- package/js/src/abstract/bullish.js +5 -0
- package/js/src/abstract/kucoin.d.ts +15 -0
- package/js/src/abstract/kucoinfutures.d.ts +15 -0
- package/js/src/abstract/mexc.d.ts +7 -0
- package/js/src/abstract/myokx.d.ts +90 -39
- package/js/src/abstract/okx.d.ts +90 -39
- package/js/src/abstract/okxus.d.ts +90 -39
- package/js/src/base/Exchange.d.ts +1 -1
- package/js/src/base/Exchange.js +3 -2
- package/js/src/base/ws/Client.d.ts +1 -0
- package/js/src/base/ws/WsClient.js +15 -0
- package/js/src/binance.d.ts +14 -5
- package/js/src/binance.js +159 -36
- package/js/src/bingx.js +2 -1
- package/js/src/bitmart.js +1 -0
- package/js/src/bullish.d.ts +446 -0
- package/js/src/bullish.js +2912 -0
- package/js/src/bybit.js +34 -37
- package/js/src/gate.js +2 -2
- package/js/src/htx.js +4 -1
- package/js/src/hyperliquid.d.ts +24 -0
- package/js/src/hyperliquid.js +115 -12
- package/js/src/kucoin.js +22 -3
- package/js/src/mexc.js +7 -0
- package/js/src/okx.js +117 -63
- package/js/src/paradex.d.ts +15 -1
- package/js/src/paradex.js +78 -3
- package/js/src/pro/binance.d.ts +7 -0
- package/js/src/pro/binance.js +131 -29
- package/js/src/pro/bullish.d.ts +108 -0
- package/js/src/pro/bullish.js +774 -0
- package/js/src/pro/coinbase.js +2 -2
- package/js/src/pro/hyperliquid.d.ts +13 -1
- package/js/src/pro/hyperliquid.js +75 -15
- package/js/src/pro/upbit.d.ts +0 -1
- package/js/src/pro/upbit.js +28 -82
- package/package.json +2 -2
package/js/src/binance.js
CHANGED
|
@@ -821,6 +821,7 @@ export default class binance extends Exchange {
|
|
|
821
821
|
'time': 1,
|
|
822
822
|
'exchangeInfo': 1,
|
|
823
823
|
'depth': { 'cost': 2, 'byLimit': [[50, 2], [100, 5], [500, 10], [1000, 20]] },
|
|
824
|
+
'rpiDepth': 20,
|
|
824
825
|
'trades': 5,
|
|
825
826
|
'historicalTrades': 20,
|
|
826
827
|
'aggTrades': 20,
|
|
@@ -898,8 +899,9 @@ export default class binance extends Exchange {
|
|
|
898
899
|
'symbolConfig': 5,
|
|
899
900
|
'accountConfig': 5,
|
|
900
901
|
'convert/orderStatus': 5,
|
|
902
|
+
// conditional orders
|
|
901
903
|
'algoOrder': 1,
|
|
902
|
-
'openAlgoOrders': 1,
|
|
904
|
+
'openAlgoOrders': { 'cost': 1, 'noSymbol': 40 },
|
|
903
905
|
'allAlgoOrders': 5,
|
|
904
906
|
},
|
|
905
907
|
'post': {
|
|
@@ -919,6 +921,7 @@ export default class binance extends Exchange {
|
|
|
919
921
|
'feeBurn': 1,
|
|
920
922
|
'convert/getQuote': 200,
|
|
921
923
|
'convert/acceptQuote': 20,
|
|
924
|
+
// conditional orders
|
|
922
925
|
'algoOrder': 1,
|
|
923
926
|
},
|
|
924
927
|
'put': {
|
|
@@ -931,6 +934,7 @@ export default class binance extends Exchange {
|
|
|
931
934
|
'order': 1,
|
|
932
935
|
'allOpenOrders': 1,
|
|
933
936
|
'listenKey': 1,
|
|
937
|
+
// conditional orders
|
|
934
938
|
'algoOrder': 1,
|
|
935
939
|
'algoOpenOrders': 1,
|
|
936
940
|
},
|
|
@@ -3986,13 +3990,15 @@ export default class binance extends Exchange {
|
|
|
3986
3990
|
* @method
|
|
3987
3991
|
* @name binance#fetchOrderBook
|
|
3988
3992
|
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
3989
|
-
* @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints#order-book
|
|
3990
|
-
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Order-Book
|
|
3991
|
-
* @see https://developers.binance.com/docs/derivatives/
|
|
3992
|
-
* @see https://developers.binance.com/docs/derivatives/
|
|
3993
|
+
* @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints#order-book // spot
|
|
3994
|
+
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Order-Book // swap
|
|
3995
|
+
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Order-Book-RPI // swap rpi
|
|
3996
|
+
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/rest-api/Order-Book // future
|
|
3997
|
+
* @see https://developers.binance.com/docs/derivatives/option/market-data/Order-Book // option
|
|
3993
3998
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
3994
3999
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
3995
4000
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4001
|
+
* @param {boolean} [params.rpi] *future only* set to true to use the RPI endpoint
|
|
3996
4002
|
* @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
|
|
3997
4003
|
*/
|
|
3998
4004
|
async fetchOrderBook(symbol, limit = undefined, params = {}) {
|
|
@@ -4009,7 +4015,16 @@ export default class binance extends Exchange {
|
|
|
4009
4015
|
response = await this.eapiPublicGetDepth(this.extend(request, params));
|
|
4010
4016
|
}
|
|
4011
4017
|
else if (market['linear']) {
|
|
4012
|
-
|
|
4018
|
+
const rpi = this.safeValue(params, 'rpi', false);
|
|
4019
|
+
params = this.omit(params, 'rpi');
|
|
4020
|
+
if (rpi) {
|
|
4021
|
+
// rpi limit only supports 1000
|
|
4022
|
+
request['limit'] = 1000;
|
|
4023
|
+
response = await this.fapiPublicGetRpiDepth(this.extend(request, params));
|
|
4024
|
+
}
|
|
4025
|
+
else {
|
|
4026
|
+
response = await this.fapiPublicGetDepth(this.extend(request, params));
|
|
4027
|
+
}
|
|
4013
4028
|
}
|
|
4014
4029
|
else if (market['inverse']) {
|
|
4015
4030
|
response = await this.dapiPublicGetDepth(this.extend(request, params));
|
|
@@ -5631,7 +5646,10 @@ export default class binance extends Exchange {
|
|
|
5631
5646
|
'NEW': 'open',
|
|
5632
5647
|
'PARTIALLY_FILLED': 'open',
|
|
5633
5648
|
'ACCEPTED': 'open',
|
|
5649
|
+
'TRIGGERING': 'open',
|
|
5634
5650
|
'FILLED': 'closed',
|
|
5651
|
+
'TRIGGERED': 'closed',
|
|
5652
|
+
'FINISHED': 'closed',
|
|
5635
5653
|
'CANCELED': 'canceled',
|
|
5636
5654
|
'CANCELLED': 'canceled',
|
|
5637
5655
|
'PENDING_CANCEL': 'canceling',
|
|
@@ -6124,12 +6142,52 @@ export default class binance extends Exchange {
|
|
|
6124
6142
|
// "priceProtect": false
|
|
6125
6143
|
// }
|
|
6126
6144
|
//
|
|
6145
|
+
// createOrder, fetchOrder, fetchOpenOrders, fetchOrders, cancelOrderWs, createOrderWs: linear swap conditional order
|
|
6146
|
+
//
|
|
6147
|
+
// {
|
|
6148
|
+
// "algoId": 3358,
|
|
6149
|
+
// "clientAlgoId": "yT58zmV3DSzMBQxc5tAJXU",
|
|
6150
|
+
// "algoType": "CONDITIONAL",
|
|
6151
|
+
// "orderType": "STOP",
|
|
6152
|
+
// "symbol": "BTCUSDT",
|
|
6153
|
+
// "side": "BUY",
|
|
6154
|
+
// "positionSide": "BOTH",
|
|
6155
|
+
// "timeInForce": "GTC",
|
|
6156
|
+
// "quantity": "0.002",
|
|
6157
|
+
// "algoStatus": "NEW",
|
|
6158
|
+
// "triggerPrice": "100000.00",
|
|
6159
|
+
// "price": "102000.00",
|
|
6160
|
+
// "icebergQuantity": null,
|
|
6161
|
+
// "selfTradePreventionMode": "EXPIRE_MAKER",
|
|
6162
|
+
// "workingType": "CONTRACT_PRICE",
|
|
6163
|
+
// "priceMatch": "NONE",
|
|
6164
|
+
// "closePosition": false,
|
|
6165
|
+
// "priceProtect": false,
|
|
6166
|
+
// "reduceOnly": false,
|
|
6167
|
+
// "createTime": 1763458576201,
|
|
6168
|
+
// "updateTime": 1763458576201,
|
|
6169
|
+
// "triggerTime": 0,
|
|
6170
|
+
// "goodTillDate": 0
|
|
6171
|
+
// }
|
|
6172
|
+
//
|
|
6173
|
+
// cancelOrder: linear swap conditional
|
|
6174
|
+
//
|
|
6175
|
+
// {
|
|
6176
|
+
// "algoId": 3358,
|
|
6177
|
+
// "clientAlgoId": "yT58zmV3DSzMBQxc5tAJXU",
|
|
6178
|
+
// "code": "200",
|
|
6179
|
+
// "msg": "success"
|
|
6180
|
+
// }
|
|
6181
|
+
//
|
|
6127
6182
|
const code = this.safeString(order, 'code');
|
|
6128
6183
|
if (code !== undefined) {
|
|
6129
6184
|
// cancelOrders/createOrders might have a partial success
|
|
6130
|
-
|
|
6185
|
+
const msg = this.safeString(order, 'msg');
|
|
6186
|
+
if ((code !== '200') && !((msg === 'success') || (msg === 'The operation of cancel all open order is done.'))) {
|
|
6187
|
+
return this.safeOrder({ 'info': order, 'status': 'rejected' }, market);
|
|
6188
|
+
}
|
|
6131
6189
|
}
|
|
6132
|
-
const status = this.parseOrderStatus(this.
|
|
6190
|
+
const status = this.parseOrderStatus(this.safeStringN(order, ['status', 'strategyStatus', 'algoStatus']));
|
|
6133
6191
|
const marketId = this.safeString(order, 'symbol');
|
|
6134
6192
|
const isContract = ('positionSide' in order) || ('cumQuote' in order);
|
|
6135
6193
|
const marketType = isContract ? 'contract' : 'spot';
|
|
@@ -6169,7 +6227,7 @@ export default class binance extends Exchange {
|
|
|
6169
6227
|
if (type === 'limit_maker') {
|
|
6170
6228
|
type = 'limit';
|
|
6171
6229
|
}
|
|
6172
|
-
const stopPriceString = this.
|
|
6230
|
+
const stopPriceString = this.safeString2(order, 'stopPrice', 'triggerPrice');
|
|
6173
6231
|
const triggerPrice = this.parseNumber(this.omitZero(stopPriceString));
|
|
6174
6232
|
const feeCost = this.safeNumber(order, 'fee');
|
|
6175
6233
|
let fee = undefined;
|
|
@@ -6182,8 +6240,8 @@ export default class binance extends Exchange {
|
|
|
6182
6240
|
}
|
|
6183
6241
|
return this.safeOrder({
|
|
6184
6242
|
'info': order,
|
|
6185
|
-
'id': this.
|
|
6186
|
-
'clientOrderId': this.
|
|
6243
|
+
'id': this.safeStringN(order, ['strategyId', 'orderId', 'algoId']),
|
|
6244
|
+
'clientOrderId': this.safeStringN(order, ['clientOrderId', 'newClientStrategyId', 'clientAlgoId']),
|
|
6187
6245
|
'timestamp': timestamp,
|
|
6188
6246
|
'datetime': this.iso8601(timestamp),
|
|
6189
6247
|
'lastTradeTimestamp': lastTradeTimestamp,
|
|
@@ -6304,6 +6362,7 @@ export default class binance extends Exchange {
|
|
|
6304
6362
|
* @see https://developers.binance.com/docs/derivatives/portfolio-margin/trade/New-Margin-Order
|
|
6305
6363
|
* @see https://developers.binance.com/docs/derivatives/portfolio-margin/trade/New-UM-Conditional-Order
|
|
6306
6364
|
* @see https://developers.binance.com/docs/derivatives/portfolio-margin/trade/New-CM-Conditional-Order
|
|
6365
|
+
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/New-Algo-Order
|
|
6307
6366
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
6308
6367
|
* @param {string} type 'market' or 'limit' or 'STOP_LOSS' or 'STOP_LOSS_LIMIT' or 'TAKE_PROFIT' or 'TAKE_PROFIT_LIMIT' or 'STOP'
|
|
6309
6368
|
* @param {string} side 'buy' or 'sell'
|
|
@@ -6372,7 +6431,13 @@ export default class binance extends Exchange {
|
|
|
6372
6431
|
}
|
|
6373
6432
|
}
|
|
6374
6433
|
else {
|
|
6375
|
-
|
|
6434
|
+
if (isConditional) {
|
|
6435
|
+
request['algoType'] = 'CONDITIONAL';
|
|
6436
|
+
response = await this.fapiPrivatePostAlgoOrder(request);
|
|
6437
|
+
}
|
|
6438
|
+
else {
|
|
6439
|
+
response = await this.fapiPrivatePostOrder(request);
|
|
6440
|
+
}
|
|
6376
6441
|
}
|
|
6377
6442
|
}
|
|
6378
6443
|
else if (market['inverse']) {
|
|
@@ -6422,7 +6487,7 @@ export default class binance extends Exchange {
|
|
|
6422
6487
|
*/
|
|
6423
6488
|
const market = this.market(symbol);
|
|
6424
6489
|
const marketType = this.safeString(params, 'type', market['type']);
|
|
6425
|
-
const clientOrderId = this.
|
|
6490
|
+
const clientOrderId = this.safeStringN(params, ['clientAlgoId', 'newClientOrderId', 'clientOrderId']);
|
|
6426
6491
|
const initialUppercaseType = type.toUpperCase();
|
|
6427
6492
|
const isMarketOrder = initialUppercaseType === 'MARKET';
|
|
6428
6493
|
const isLimitOrder = initialUppercaseType === 'LIMIT';
|
|
@@ -6536,7 +6601,10 @@ export default class binance extends Exchange {
|
|
|
6536
6601
|
}
|
|
6537
6602
|
}
|
|
6538
6603
|
}
|
|
6539
|
-
|
|
6604
|
+
let clientOrderIdRequest = isPortfolioMarginConditional ? 'newClientStrategyId' : 'newClientOrderId';
|
|
6605
|
+
if (market['linear'] && market['swap'] && isConditional && !isPortfolioMargin) {
|
|
6606
|
+
clientOrderIdRequest = 'clientAlgoId';
|
|
6607
|
+
}
|
|
6540
6608
|
if (clientOrderId === undefined) {
|
|
6541
6609
|
const broker = this.safeDict(this.options, 'broker', {});
|
|
6542
6610
|
const defaultId = (market['contract']) ? 'x-xcKtGhcu' : 'x-TKT5PX2F';
|
|
@@ -6714,7 +6782,12 @@ export default class binance extends Exchange {
|
|
|
6714
6782
|
}
|
|
6715
6783
|
}
|
|
6716
6784
|
if (stopPrice !== undefined) {
|
|
6717
|
-
|
|
6785
|
+
if (market['linear'] && market['swap'] && !isPortfolioMargin) {
|
|
6786
|
+
request['triggerPrice'] = this.priceToPrecision(symbol, stopPrice);
|
|
6787
|
+
}
|
|
6788
|
+
else {
|
|
6789
|
+
request['stopPrice'] = this.priceToPrecision(symbol, stopPrice);
|
|
6790
|
+
}
|
|
6718
6791
|
}
|
|
6719
6792
|
}
|
|
6720
6793
|
if (timeInForceIsRequired && (this.safeString(params, 'timeInForce') === undefined) && (this.safeString(request, 'timeInForce') === undefined)) {
|
|
@@ -6826,11 +6899,13 @@ export default class binance extends Exchange {
|
|
|
6826
6899
|
* @see https://developers.binance.com/docs/margin_trading/trade/Query-Margin-Account-Order
|
|
6827
6900
|
* @see https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-UM-Order
|
|
6828
6901
|
* @see https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-CM-Order
|
|
6902
|
+
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Query-Algo-Order
|
|
6829
6903
|
* @param {string} id the order id
|
|
6830
6904
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
6831
6905
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6832
6906
|
* @param {string} [params.marginMode] 'cross' or 'isolated', for spot margin trading
|
|
6833
6907
|
* @param {boolean} [params.portfolioMargin] set to true if you would like to fetch an order in a portfolio margin account
|
|
6908
|
+
* @param {boolean} [params.trigger] set to true if you would like to fetch a trigger or conditional order
|
|
6834
6909
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
6835
6910
|
*/
|
|
6836
6911
|
async fetchOrder(id, symbol = undefined, params = {}) {
|
|
@@ -6848,19 +6923,26 @@ export default class binance extends Exchange {
|
|
|
6848
6923
|
const request = {
|
|
6849
6924
|
'symbol': market['id'],
|
|
6850
6925
|
};
|
|
6851
|
-
const
|
|
6926
|
+
const isConditional = this.safeBoolN(params, ['stop', 'trigger', 'conditional']);
|
|
6927
|
+
const clientOrderId = this.safeStringN(params, ['origClientOrderId', 'clientOrderId', 'clientAlgoId']);
|
|
6852
6928
|
if (clientOrderId !== undefined) {
|
|
6853
6929
|
if (market['option']) {
|
|
6854
6930
|
request['clientOrderId'] = clientOrderId;
|
|
6855
6931
|
}
|
|
6932
|
+
else if (market['linear'] && market['swap'] && isConditional && !isPortfolioMargin) {
|
|
6933
|
+
request['clientAlgoId'] = clientOrderId;
|
|
6934
|
+
}
|
|
6856
6935
|
else {
|
|
6857
6936
|
request['origClientOrderId'] = clientOrderId;
|
|
6858
6937
|
}
|
|
6859
6938
|
}
|
|
6939
|
+
else if (market['linear'] && market['swap'] && isConditional && !isPortfolioMargin) {
|
|
6940
|
+
request['algoId'] = id;
|
|
6941
|
+
}
|
|
6860
6942
|
else {
|
|
6861
6943
|
request['orderId'] = id;
|
|
6862
6944
|
}
|
|
6863
|
-
params = this.omit(params, ['type', 'clientOrderId', 'origClientOrderId']);
|
|
6945
|
+
params = this.omit(params, ['type', 'clientOrderId', 'origClientOrderId', 'stop', 'trigger', 'conditional', 'clientAlgoId']);
|
|
6864
6946
|
let response = undefined;
|
|
6865
6947
|
if (market['option']) {
|
|
6866
6948
|
response = await this.eapiPrivateGetOrder(this.extend(request, params));
|
|
@@ -6870,7 +6952,12 @@ export default class binance extends Exchange {
|
|
|
6870
6952
|
response = await this.papiGetUmOrder(this.extend(request, params));
|
|
6871
6953
|
}
|
|
6872
6954
|
else {
|
|
6873
|
-
|
|
6955
|
+
if (isConditional) {
|
|
6956
|
+
response = await this.fapiPrivateGetAlgoOrder(this.extend(request, params));
|
|
6957
|
+
}
|
|
6958
|
+
else {
|
|
6959
|
+
response = await this.fapiPrivateGetOrder(this.extend(request, params));
|
|
6960
|
+
}
|
|
6874
6961
|
}
|
|
6875
6962
|
}
|
|
6876
6963
|
else if (market['inverse']) {
|
|
@@ -6910,6 +6997,7 @@ export default class binance extends Exchange {
|
|
|
6910
6997
|
* @see https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-All-CM-Orders
|
|
6911
6998
|
* @see https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-All-UM-Conditional-Orders
|
|
6912
6999
|
* @see https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-All-CM-Conditional-Orders
|
|
7000
|
+
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Query-All-Algo-Orders
|
|
6913
7001
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
6914
7002
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
6915
7003
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
@@ -6964,7 +7052,12 @@ export default class binance extends Exchange {
|
|
|
6964
7052
|
}
|
|
6965
7053
|
}
|
|
6966
7054
|
else {
|
|
6967
|
-
|
|
7055
|
+
if (isConditional) {
|
|
7056
|
+
response = await this.fapiPrivateGetAllAlgoOrders(this.extend(request, params));
|
|
7057
|
+
}
|
|
7058
|
+
else {
|
|
7059
|
+
response = await this.fapiPrivateGetAllOrders(this.extend(request, params));
|
|
7060
|
+
}
|
|
6968
7061
|
}
|
|
6969
7062
|
}
|
|
6970
7063
|
else if (market['inverse']) {
|
|
@@ -7189,6 +7282,7 @@ export default class binance extends Exchange {
|
|
|
7189
7282
|
* @see https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-All-Current-UM-Open-Conditional-Orders
|
|
7190
7283
|
* @see https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-All-Current-CM-Open-Orders
|
|
7191
7284
|
* @see https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-All-Current-CM-Open-Conditional-Orders
|
|
7285
|
+
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Current-All-Algo-Open-Orders
|
|
7192
7286
|
* @param {string} symbol unified market symbol
|
|
7193
7287
|
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
7194
7288
|
* @param {int} [limit] the maximum number of open orders structures to retrieve
|
|
@@ -7246,7 +7340,12 @@ export default class binance extends Exchange {
|
|
|
7246
7340
|
}
|
|
7247
7341
|
}
|
|
7248
7342
|
else {
|
|
7249
|
-
|
|
7343
|
+
if (isConditional) {
|
|
7344
|
+
response = await this.fapiPrivateGetOpenAlgoOrders(this.extend(request, params));
|
|
7345
|
+
}
|
|
7346
|
+
else {
|
|
7347
|
+
response = await this.fapiPrivateGetOpenOrders(this.extend(request, params));
|
|
7348
|
+
}
|
|
7250
7349
|
}
|
|
7251
7350
|
}
|
|
7252
7351
|
else if (this.isInverse(type, subType)) {
|
|
@@ -7606,6 +7705,7 @@ export default class binance extends Exchange {
|
|
|
7606
7705
|
* @see https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Cancel-UM-Conditional-Order
|
|
7607
7706
|
* @see https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Cancel-CM-Conditional-Order
|
|
7608
7707
|
* @see https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Cancel-Margin-Account-Order
|
|
7708
|
+
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Cancel-Algo-Order
|
|
7609
7709
|
* @param {string} id order id
|
|
7610
7710
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
7611
7711
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -7629,11 +7729,14 @@ export default class binance extends Exchange {
|
|
|
7629
7729
|
const request = {
|
|
7630
7730
|
'symbol': market['id'],
|
|
7631
7731
|
};
|
|
7632
|
-
const clientOrderId = this.safeStringN(params, ['origClientOrderId', 'clientOrderId', 'newClientStrategyId']);
|
|
7732
|
+
const clientOrderId = this.safeStringN(params, ['origClientOrderId', 'clientOrderId', 'newClientStrategyId', 'clientAlgoId']);
|
|
7633
7733
|
if (clientOrderId !== undefined) {
|
|
7634
7734
|
if (market['option']) {
|
|
7635
7735
|
request['clientOrderId'] = clientOrderId;
|
|
7636
7736
|
}
|
|
7737
|
+
else if (market['linear'] && market['swap'] && isConditional && !isPortfolioMargin) {
|
|
7738
|
+
request['clientAlgoId'] = clientOrderId;
|
|
7739
|
+
}
|
|
7637
7740
|
else {
|
|
7638
7741
|
if (isPortfolioMargin && isConditional) {
|
|
7639
7742
|
request['newClientStrategyId'] = clientOrderId;
|
|
@@ -7647,11 +7750,14 @@ export default class binance extends Exchange {
|
|
|
7647
7750
|
if (isPortfolioMargin && isConditional) {
|
|
7648
7751
|
request['strategyId'] = id;
|
|
7649
7752
|
}
|
|
7753
|
+
else if (market['linear'] && market['swap'] && isConditional && !isPortfolioMargin) {
|
|
7754
|
+
request['algoId'] = id;
|
|
7755
|
+
}
|
|
7650
7756
|
else {
|
|
7651
7757
|
request['orderId'] = id;
|
|
7652
7758
|
}
|
|
7653
7759
|
}
|
|
7654
|
-
params = this.omit(params, ['type', 'origClientOrderId', 'clientOrderId', 'newClientStrategyId', 'stop', 'trigger', 'conditional']);
|
|
7760
|
+
params = this.omit(params, ['type', 'origClientOrderId', 'clientOrderId', 'newClientStrategyId', 'stop', 'trigger', 'conditional', 'clientAlgoId']);
|
|
7655
7761
|
let response = undefined;
|
|
7656
7762
|
if (market['option']) {
|
|
7657
7763
|
response = await this.eapiPrivateDeleteOrder(this.extend(request, params));
|
|
@@ -7666,7 +7772,12 @@ export default class binance extends Exchange {
|
|
|
7666
7772
|
}
|
|
7667
7773
|
}
|
|
7668
7774
|
else {
|
|
7669
|
-
|
|
7775
|
+
if (isConditional) {
|
|
7776
|
+
response = await this.fapiPrivateDeleteAlgoOrder(this.extend(request, params));
|
|
7777
|
+
}
|
|
7778
|
+
else {
|
|
7779
|
+
response = await this.fapiPrivateDeleteOrder(this.extend(request, params));
|
|
7780
|
+
}
|
|
7670
7781
|
}
|
|
7671
7782
|
}
|
|
7672
7783
|
else if (market['inverse']) {
|
|
@@ -7712,6 +7823,7 @@ export default class binance extends Exchange {
|
|
|
7712
7823
|
* @see https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Cancel-All-CM-Open-Orders
|
|
7713
7824
|
* @see https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Cancel-All-CM-Open-Conditional-Orders
|
|
7714
7825
|
* @see https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Cancel-Margin-Account-All-Open-Orders-on-a-Symbol
|
|
7826
|
+
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Cancel-All-Algo-Open-Orders
|
|
7715
7827
|
* @param {string} symbol unified market symbol of the market to cancel orders in
|
|
7716
7828
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
7717
7829
|
* @param {string} [params.marginMode] 'cross' or 'isolated', for spot margin trading
|
|
@@ -7767,13 +7879,24 @@ export default class binance extends Exchange {
|
|
|
7767
7879
|
}
|
|
7768
7880
|
}
|
|
7769
7881
|
else {
|
|
7770
|
-
|
|
7771
|
-
|
|
7772
|
-
|
|
7773
|
-
|
|
7774
|
-
|
|
7775
|
-
|
|
7776
|
-
|
|
7882
|
+
if (isConditional) {
|
|
7883
|
+
response = await this.fapiPrivateDeleteAlgoOpenOrders(this.extend(request, params));
|
|
7884
|
+
//
|
|
7885
|
+
// {
|
|
7886
|
+
// "code": 200,
|
|
7887
|
+
// "msg": "The operation of cancel all open order is done."
|
|
7888
|
+
// }
|
|
7889
|
+
//
|
|
7890
|
+
}
|
|
7891
|
+
else {
|
|
7892
|
+
response = await this.fapiPrivateDeleteAllOpenOrders(this.extend(request, params));
|
|
7893
|
+
//
|
|
7894
|
+
// {
|
|
7895
|
+
// "code": 200,
|
|
7896
|
+
// "msg": "The operation of cancel all open order is done."
|
|
7897
|
+
// }
|
|
7898
|
+
//
|
|
7899
|
+
}
|
|
7777
7900
|
}
|
|
7778
7901
|
}
|
|
7779
7902
|
else if (market['inverse']) {
|
|
@@ -10798,7 +10921,7 @@ export default class binance extends Exchange {
|
|
|
10798
10921
|
// }
|
|
10799
10922
|
// ]
|
|
10800
10923
|
//
|
|
10801
|
-
return this.
|
|
10924
|
+
return this.parseOptionPosition(response[0], market);
|
|
10802
10925
|
}
|
|
10803
10926
|
/**
|
|
10804
10927
|
* @method
|
|
@@ -10855,11 +10978,11 @@ export default class binance extends Exchange {
|
|
|
10855
10978
|
//
|
|
10856
10979
|
const result = [];
|
|
10857
10980
|
for (let i = 0; i < response.length; i++) {
|
|
10858
|
-
result.push(this.
|
|
10981
|
+
result.push(this.parseOptionPosition(response[i], market));
|
|
10859
10982
|
}
|
|
10860
10983
|
return this.filterByArrayPositions(result, 'symbol', symbols, false);
|
|
10861
10984
|
}
|
|
10862
|
-
|
|
10985
|
+
parseOptionPosition(position, market = undefined) {
|
|
10863
10986
|
//
|
|
10864
10987
|
// {
|
|
10865
10988
|
// "entryPrice": "27.70000000",
|
|
@@ -12194,13 +12317,13 @@ export default class binance extends Exchange {
|
|
|
12194
12317
|
getExceptionsByUrl(url, exactOrBroad) {
|
|
12195
12318
|
let marketType = undefined;
|
|
12196
12319
|
const hostname = (this.hostname !== undefined) ? this.hostname : 'binance.com';
|
|
12197
|
-
if (url.startsWith('https://api.' + hostname + '/') || url.startsWith('https://testnet.binance.vision')) {
|
|
12320
|
+
if (url.startsWith('https://api.' + hostname + '/') || url.startsWith('https://demo-api') || url.startsWith('https://testnet.binance.vision')) {
|
|
12198
12321
|
marketType = 'spot';
|
|
12199
12322
|
}
|
|
12200
|
-
else if (url.startsWith('https://dapi.' + hostname + '/') || url.startsWith('https://testnet.binancefuture.com/dapi')) {
|
|
12323
|
+
else if (url.startsWith('https://dapi.' + hostname + '/') || url.startsWith('https://demo-dapi') || url.startsWith('https://testnet.binancefuture.com/dapi')) {
|
|
12201
12324
|
marketType = 'inverse';
|
|
12202
12325
|
}
|
|
12203
|
-
else if (url.startsWith('https://fapi.' + hostname + '/') || url.startsWith('https://testnet.binancefuture.com/fapi')) {
|
|
12326
|
+
else if (url.startsWith('https://fapi.' + hostname + '/') || url.startsWith('https://demo-fapi') || url.startsWith('https://testnet.binancefuture.com/fapi')) {
|
|
12204
12327
|
marketType = 'linear';
|
|
12205
12328
|
}
|
|
12206
12329
|
else if (url.startsWith('https://eapi.' + hostname + '/')) {
|
package/js/src/bingx.js
CHANGED
|
@@ -210,6 +210,7 @@ export default class bingx extends Exchange {
|
|
|
210
210
|
'get': {
|
|
211
211
|
'market/depth': 1,
|
|
212
212
|
'market/kline': 1,
|
|
213
|
+
'ticker/price': 1,
|
|
213
214
|
},
|
|
214
215
|
},
|
|
215
216
|
},
|
|
@@ -5436,7 +5437,7 @@ export default class bingx extends Exchange {
|
|
|
5436
5437
|
'3': 'rejected',
|
|
5437
5438
|
'4': 'pending',
|
|
5438
5439
|
'5': 'rejected',
|
|
5439
|
-
'6': '
|
|
5440
|
+
'6': 'pending',
|
|
5440
5441
|
};
|
|
5441
5442
|
return this.safeString(statuses, status, status);
|
|
5442
5443
|
}
|
package/js/src/bitmart.js
CHANGED
|
@@ -521,6 +521,7 @@ export default class bitmart extends Exchange {
|
|
|
521
521
|
'broad': {
|
|
522
522
|
'You contract account available balance not enough': InsufficientFunds,
|
|
523
523
|
'you contract account available balance not enough': InsufficientFunds,
|
|
524
|
+
'This trading pair does not support API trading': BadSymbol, // {"message":"This trading pair does not support API trading","code":51008,"trace":"5d3ebd46-4e7a-4505-b37b-74464f398f01","data":{}}
|
|
524
525
|
},
|
|
525
526
|
},
|
|
526
527
|
'commonCurrencies': {
|