ccxt 4.3.35 → 4.3.37
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 +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/bingx.js +63 -33
- package/dist/cjs/src/bit2c.js +2 -1
- package/dist/cjs/src/bitbank.js +46 -1
- package/dist/cjs/src/bitget.js +11 -4
- package/dist/cjs/src/bitmart.js +2 -2
- package/dist/cjs/src/htx.js +78 -3
- package/dist/cjs/src/kraken.js +5 -5
- package/dist/cjs/src/paymium.js +4 -1
- package/dist/cjs/src/pro/binance.js +4 -4
- package/dist/cjs/src/pro/bingx.js +10 -4
- package/dist/cjs/src/pro/bitfinex2.js +5 -5
- package/dist/cjs/src/pro/bitmart.js +9 -5
- package/dist/cjs/src/pro/bybit.js +6 -6
- package/dist/cjs/src/pro/htx.js +5 -6
- package/dist/cjs/src/pro/okx.js +3 -4
- package/dist/cjs/src/pro/woo.js +4 -4
- package/dist/cjs/src/whitebit.js +24 -3
- package/dist/cjs/src/woofipro.js +3 -1
- package/dist/cjs/src/zaif.js +30 -2
- package/dist/cjs/src/zonda.js +6 -0
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bitbay.d.ts +6 -0
- package/js/src/abstract/zonda.d.ts +6 -0
- package/js/src/bingx.d.ts +2 -2
- package/js/src/bingx.js +63 -33
- package/js/src/bit2c.d.ts +1 -1
- package/js/src/bit2c.js +2 -1
- package/js/src/bitbank.d.ts +1 -1
- package/js/src/bitbank.js +46 -1
- package/js/src/bitget.js +11 -4
- package/js/src/bitmart.js +2 -2
- package/js/src/htx.d.ts +1 -0
- package/js/src/htx.js +78 -3
- package/js/src/kraken.js +5 -5
- package/js/src/paymium.d.ts +1 -1
- package/js/src/paymium.js +4 -1
- package/js/src/pro/binance.js +4 -4
- package/js/src/pro/bingx.js +10 -4
- package/js/src/pro/bitfinex2.js +5 -5
- package/js/src/pro/bitmart.js +10 -6
- package/js/src/pro/bybit.js +6 -6
- package/js/src/pro/htx.js +5 -6
- package/js/src/pro/okx.js +3 -4
- package/js/src/pro/woo.js +4 -4
- package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +1 -1
- package/js/src/whitebit.d.ts +2 -2
- package/js/src/whitebit.js +24 -3
- package/js/src/woofipro.js +3 -1
- package/js/src/zaif.d.ts +1 -1
- package/js/src/zaif.js +30 -2
- package/js/src/zonda.js +6 -0
- package/package.json +1 -1
package/dist/cjs/ccxt.js
CHANGED
|
@@ -185,7 +185,7 @@ var woofipro$1 = require('./src/pro/woofipro.js');
|
|
|
185
185
|
|
|
186
186
|
//-----------------------------------------------------------------------------
|
|
187
187
|
// this is updated by vss.js when building
|
|
188
|
-
const version = '4.3.
|
|
188
|
+
const version = '4.3.37';
|
|
189
189
|
Exchange["default"].ccxtVersion = version;
|
|
190
190
|
const exchanges = {
|
|
191
191
|
'ace': ace,
|
package/dist/cjs/src/bingx.js
CHANGED
|
@@ -1036,7 +1036,7 @@ class bingx extends bingx$1 {
|
|
|
1036
1036
|
time = undefined;
|
|
1037
1037
|
}
|
|
1038
1038
|
const cost = this.safeString(trade, 'quoteQty');
|
|
1039
|
-
const type = (cost === undefined) ? 'spot' : 'swap';
|
|
1039
|
+
// const type = (cost === undefined) ? 'spot' : 'swap'; this is not reliable
|
|
1040
1040
|
const currencyId = this.safeStringN(trade, ['currency', 'N', 'commissionAsset']);
|
|
1041
1041
|
const currencyCode = this.safeCurrencyCode(currencyId);
|
|
1042
1042
|
const m = this.safeBool(trade, 'm');
|
|
@@ -1073,7 +1073,7 @@ class bingx extends bingx$1 {
|
|
|
1073
1073
|
'info': trade,
|
|
1074
1074
|
'timestamp': time,
|
|
1075
1075
|
'datetime': this.iso8601(time),
|
|
1076
|
-
'symbol': this.safeSymbol(marketId, market, '-'
|
|
1076
|
+
'symbol': this.safeSymbol(marketId, market, '-'),
|
|
1077
1077
|
'order': this.safeString2(trade, 'orderId', 'i'),
|
|
1078
1078
|
'type': this.safeStringLower(trade, 'o'),
|
|
1079
1079
|
'side': this.parseOrderSide(side),
|
|
@@ -2733,7 +2733,9 @@ class bingx extends bingx$1 {
|
|
|
2733
2733
|
else {
|
|
2734
2734
|
throw new errors.BadRequest(this.id + ' cancelAllOrders is only supported for spot and swap markets.');
|
|
2735
2735
|
}
|
|
2736
|
-
|
|
2736
|
+
const data = this.safeDict(response, 'data', {});
|
|
2737
|
+
const orders = this.safeList2(data, 'success', 'orders', []);
|
|
2738
|
+
return this.parseOrders(orders);
|
|
2737
2739
|
}
|
|
2738
2740
|
async cancelOrders(ids, symbol = undefined, params = {}) {
|
|
2739
2741
|
/**
|
|
@@ -2774,6 +2776,32 @@ class bingx extends bingx$1 {
|
|
|
2774
2776
|
const spotReqKey = areClientOrderIds ? 'clientOrderIDs' : 'orderIds';
|
|
2775
2777
|
request[spotReqKey] = parsedIds.join(',');
|
|
2776
2778
|
response = await this.spotV1PrivatePostTradeCancelOrders(this.extend(request, params));
|
|
2779
|
+
//
|
|
2780
|
+
// {
|
|
2781
|
+
// "code": 0,
|
|
2782
|
+
// "msg": "",
|
|
2783
|
+
// "debugMsg": "",
|
|
2784
|
+
// "data": {
|
|
2785
|
+
// "orders": [
|
|
2786
|
+
// {
|
|
2787
|
+
// "symbol": "SOL-USDT",
|
|
2788
|
+
// "orderId": 1795970045910614016,
|
|
2789
|
+
// "transactTime": 1717027601111,
|
|
2790
|
+
// "price": "180.25",
|
|
2791
|
+
// "stopPrice": "0",
|
|
2792
|
+
// "origQty": "0.03",
|
|
2793
|
+
// "executedQty": "0",
|
|
2794
|
+
// "cummulativeQuoteQty": "0",
|
|
2795
|
+
// "status": "CANCELED",
|
|
2796
|
+
// "type": "LIMIT",
|
|
2797
|
+
// "side": "SELL",
|
|
2798
|
+
// "clientOrderID": ""
|
|
2799
|
+
// },
|
|
2800
|
+
// ...
|
|
2801
|
+
// ]
|
|
2802
|
+
// }
|
|
2803
|
+
// }
|
|
2804
|
+
//
|
|
2777
2805
|
}
|
|
2778
2806
|
else {
|
|
2779
2807
|
if (areClientOrderIds) {
|
|
@@ -2783,37 +2811,39 @@ class bingx extends bingx$1 {
|
|
|
2783
2811
|
request['orderIdList'] = parsedIds;
|
|
2784
2812
|
}
|
|
2785
2813
|
response = await this.swapV2PrivateDeleteTradeBatchOrders(this.extend(request, params));
|
|
2814
|
+
//
|
|
2815
|
+
// {
|
|
2816
|
+
// "code": 0,
|
|
2817
|
+
// "msg": "",
|
|
2818
|
+
// "data": {
|
|
2819
|
+
// "success": [
|
|
2820
|
+
// {
|
|
2821
|
+
// "symbol": "LINK-USDT",
|
|
2822
|
+
// "orderId": 1597783850786750464,
|
|
2823
|
+
// "side": "BUY",
|
|
2824
|
+
// "positionSide": "LONG",
|
|
2825
|
+
// "type": "TRIGGER_MARKET",
|
|
2826
|
+
// "origQty": "5.0",
|
|
2827
|
+
// "price": "5.5710",
|
|
2828
|
+
// "executedQty": "0.0",
|
|
2829
|
+
// "avgPrice": "0.0000",
|
|
2830
|
+
// "cumQuote": "0",
|
|
2831
|
+
// "stopPrice": "5.0000",
|
|
2832
|
+
// "profit": "0.0000",
|
|
2833
|
+
// "commission": "0.000000",
|
|
2834
|
+
// "status": "CANCELLED",
|
|
2835
|
+
// "time": 1669776330000,
|
|
2836
|
+
// "updateTime": 1672370837000
|
|
2837
|
+
// }
|
|
2838
|
+
// ],
|
|
2839
|
+
// "failed": null
|
|
2840
|
+
// }
|
|
2841
|
+
// }
|
|
2842
|
+
//
|
|
2786
2843
|
}
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
// "msg": "",
|
|
2791
|
-
// "data": {
|
|
2792
|
-
// "success": [
|
|
2793
|
-
// {
|
|
2794
|
-
// "symbol": "LINK-USDT",
|
|
2795
|
-
// "orderId": 1597783850786750464,
|
|
2796
|
-
// "side": "BUY",
|
|
2797
|
-
// "positionSide": "LONG",
|
|
2798
|
-
// "type": "TRIGGER_MARKET",
|
|
2799
|
-
// "origQty": "5.0",
|
|
2800
|
-
// "price": "5.5710",
|
|
2801
|
-
// "executedQty": "0.0",
|
|
2802
|
-
// "avgPrice": "0.0000",
|
|
2803
|
-
// "cumQuote": "0",
|
|
2804
|
-
// "stopPrice": "5.0000",
|
|
2805
|
-
// "profit": "0.0000",
|
|
2806
|
-
// "commission": "0.000000",
|
|
2807
|
-
// "status": "CANCELLED",
|
|
2808
|
-
// "time": 1669776330000,
|
|
2809
|
-
// "updateTime": 1672370837000
|
|
2810
|
-
// }
|
|
2811
|
-
// ],
|
|
2812
|
-
// "failed": null
|
|
2813
|
-
// }
|
|
2814
|
-
// }
|
|
2815
|
-
//
|
|
2816
|
-
return response;
|
|
2844
|
+
const data = this.safeDict(response, 'data', {});
|
|
2845
|
+
const success = this.safeList2(data, 'success', 'orders', []);
|
|
2846
|
+
return this.parseOrders(success);
|
|
2817
2847
|
}
|
|
2818
2848
|
async cancelAllOrdersAfter(timeout, params = {}) {
|
|
2819
2849
|
/**
|
package/dist/cjs/src/bit2c.js
CHANGED
|
@@ -464,7 +464,8 @@ class bit2c extends bit2c$1 {
|
|
|
464
464
|
const request = {
|
|
465
465
|
'id': id,
|
|
466
466
|
};
|
|
467
|
-
|
|
467
|
+
const response = await this.privatePostOrderCancelOrder(this.extend(request, params));
|
|
468
|
+
return this.parseOrder(response);
|
|
468
469
|
}
|
|
469
470
|
async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
470
471
|
/**
|
package/dist/cjs/src/bitbank.js
CHANGED
|
@@ -685,8 +685,31 @@ class bitbank extends bitbank$1 {
|
|
|
685
685
|
'pair': market['id'],
|
|
686
686
|
};
|
|
687
687
|
const response = await this.privatePostUserSpotCancelOrder(this.extend(request, params));
|
|
688
|
+
//
|
|
689
|
+
// {
|
|
690
|
+
// "success": 1,
|
|
691
|
+
// "data": {
|
|
692
|
+
// "order_id": 0,
|
|
693
|
+
// "pair": "string",
|
|
694
|
+
// "side": "string",
|
|
695
|
+
// "type": "string",
|
|
696
|
+
// "start_amount": "string",
|
|
697
|
+
// "remaining_amount": "string",
|
|
698
|
+
// "executed_amount": "string",
|
|
699
|
+
// "price": "string",
|
|
700
|
+
// "post_only": false,
|
|
701
|
+
// "average_price": "string",
|
|
702
|
+
// "ordered_at": 0,
|
|
703
|
+
// "expire_at": 0,
|
|
704
|
+
// "canceled_at": 0,
|
|
705
|
+
// "triggered_at": 0,
|
|
706
|
+
// "trigger_price": "string",
|
|
707
|
+
// "status": "string"
|
|
708
|
+
// }
|
|
709
|
+
// }
|
|
710
|
+
//
|
|
688
711
|
const data = this.safeValue(response, 'data');
|
|
689
|
-
return data;
|
|
712
|
+
return this.parseOrder(data);
|
|
690
713
|
}
|
|
691
714
|
async fetchOrder(id, symbol = undefined, params = {}) {
|
|
692
715
|
/**
|
|
@@ -705,6 +728,28 @@ class bitbank extends bitbank$1 {
|
|
|
705
728
|
'pair': market['id'],
|
|
706
729
|
};
|
|
707
730
|
const response = await this.privateGetUserSpotOrder(this.extend(request, params));
|
|
731
|
+
//
|
|
732
|
+
// {
|
|
733
|
+
// "success": 1,
|
|
734
|
+
// "data": {
|
|
735
|
+
// "order_id": 0,
|
|
736
|
+
// "pair": "string",
|
|
737
|
+
// "side": "string",
|
|
738
|
+
// "type": "string",
|
|
739
|
+
// "start_amount": "string",
|
|
740
|
+
// "remaining_amount": "string",
|
|
741
|
+
// "executed_amount": "string",
|
|
742
|
+
// "price": "string",
|
|
743
|
+
// "post_only": false,
|
|
744
|
+
// "average_price": "string",
|
|
745
|
+
// "ordered_at": 0,
|
|
746
|
+
// "expire_at": 0,
|
|
747
|
+
// "triggered_at": 0,
|
|
748
|
+
// "triger_price": "string",
|
|
749
|
+
// "status": "string"
|
|
750
|
+
// }
|
|
751
|
+
// }
|
|
752
|
+
//
|
|
708
753
|
const data = this.safeDict(response, 'data');
|
|
709
754
|
return this.parseOrder(data, market);
|
|
710
755
|
}
|
package/dist/cjs/src/bitget.js
CHANGED
|
@@ -1228,6 +1228,7 @@ class bitget extends bitget$1 {
|
|
|
1228
1228
|
'40712': errors.InsufficientFunds,
|
|
1229
1229
|
'40713': errors.ExchangeError,
|
|
1230
1230
|
'40714': errors.ExchangeError,
|
|
1231
|
+
'40762': errors.InsufficientFunds,
|
|
1231
1232
|
'40768': errors.OrderNotFound,
|
|
1232
1233
|
'41114': errors.OnMaintenance,
|
|
1233
1234
|
'43011': errors.InvalidOrder,
|
|
@@ -4343,11 +4344,17 @@ class bitget extends bitget$1 {
|
|
|
4343
4344
|
}
|
|
4344
4345
|
const marginModeRequest = (marginMode === 'cross') ? 'crossed' : 'isolated';
|
|
4345
4346
|
request['marginMode'] = marginModeRequest;
|
|
4346
|
-
|
|
4347
|
-
params = this.
|
|
4347
|
+
let hedged = undefined;
|
|
4348
|
+
[hedged, params] = this.handleParamBool(params, 'hedged', false);
|
|
4349
|
+
// backward compatibility for `oneWayMode`
|
|
4350
|
+
let oneWayMode = undefined;
|
|
4351
|
+
[oneWayMode, params] = this.handleParamBool(params, 'oneWayMode');
|
|
4352
|
+
if (oneWayMode !== undefined) {
|
|
4353
|
+
hedged = !oneWayMode;
|
|
4354
|
+
}
|
|
4348
4355
|
let requestSide = side;
|
|
4349
4356
|
if (reduceOnly) {
|
|
4350
|
-
if (
|
|
4357
|
+
if (!hedged) {
|
|
4351
4358
|
request['reduceOnly'] = 'YES';
|
|
4352
4359
|
}
|
|
4353
4360
|
else {
|
|
@@ -4357,7 +4364,7 @@ class bitget extends bitget$1 {
|
|
|
4357
4364
|
}
|
|
4358
4365
|
}
|
|
4359
4366
|
else {
|
|
4360
|
-
if (
|
|
4367
|
+
if (hedged) {
|
|
4361
4368
|
request['tradeSide'] = 'Open';
|
|
4362
4369
|
}
|
|
4363
4370
|
}
|
package/dist/cjs/src/bitmart.js
CHANGED
|
@@ -1182,9 +1182,9 @@ class bitmart extends bitmart$1 {
|
|
|
1182
1182
|
market = this.safeMarket(marketId, market);
|
|
1183
1183
|
const symbol = market['symbol'];
|
|
1184
1184
|
const last = this.safeString2(ticker, 'close_24h', 'last_price');
|
|
1185
|
-
let percentage =
|
|
1185
|
+
let percentage = this.safeString(ticker, 'price_change_percent_24h');
|
|
1186
1186
|
if (percentage === undefined) {
|
|
1187
|
-
percentage = Precise["default"].
|
|
1187
|
+
percentage = Precise["default"].stringMul(this.safeString(ticker, 'fluctuation'), '100');
|
|
1188
1188
|
}
|
|
1189
1189
|
let baseVolume = this.safeString(ticker, 'base_volume_24h');
|
|
1190
1190
|
let quoteVolume = this.safeString(ticker, 'quote_volume_24h');
|
package/dist/cjs/src/htx.js
CHANGED
|
@@ -38,6 +38,8 @@ class htx extends htx$1 {
|
|
|
38
38
|
'cancelAllOrdersAfter': true,
|
|
39
39
|
'cancelOrder': true,
|
|
40
40
|
'cancelOrders': true,
|
|
41
|
+
'closeAllPositions': false,
|
|
42
|
+
'closePosition': true,
|
|
41
43
|
'createDepositAddress': undefined,
|
|
42
44
|
'createMarketBuyOrderWithCost': true,
|
|
43
45
|
'createMarketOrderWithCost': false,
|
|
@@ -5386,7 +5388,7 @@ class htx extends htx$1 {
|
|
|
5386
5388
|
* @param {float} [params.stopLossPrice] *contract only* the price a stop-loss order is triggered at
|
|
5387
5389
|
* @param {float} [params.takeProfitPrice] *contract only* the price a take-profit order is triggered at
|
|
5388
5390
|
* @param {string} [params.operator] *spot and margin only* gte or lte, trigger price condition
|
|
5389
|
-
* @param {string} [params.offset] *contract only* '
|
|
5391
|
+
* @param {string} [params.offset] *contract only* 'both' (linear only), 'open', or 'close', required in hedge mode and for inverse markets
|
|
5390
5392
|
* @param {bool} [params.postOnly] *contract only* true or false
|
|
5391
5393
|
* @param {int} [params.leverRate] *contract only* required for all contract orders except tpsl, leverage greater than 20x requires prior approval of high-leverage agreement
|
|
5392
5394
|
* @param {string} [params.timeInForce] supports 'IOC' and 'FOK'
|
|
@@ -5449,6 +5451,10 @@ class htx extends htx$1 {
|
|
|
5449
5451
|
}
|
|
5450
5452
|
}
|
|
5451
5453
|
else if (market['inverse']) {
|
|
5454
|
+
const offset = this.safeString(params, 'offset');
|
|
5455
|
+
if (offset === undefined) {
|
|
5456
|
+
throw new errors.ArgumentsRequired(this.id + ' createOrder () requires an extra parameter params["offset"] to be set to "open" or "close" when placing orders in inverse markets');
|
|
5457
|
+
}
|
|
5452
5458
|
if (market['swap']) {
|
|
5453
5459
|
if (isStop) {
|
|
5454
5460
|
response = await this.contractPrivatePostSwapApiV1SwapTriggerOrder(contractRequest);
|
|
@@ -7595,14 +7601,20 @@ class htx extends htx$1 {
|
|
|
7595
7601
|
* @description fetch all open positions
|
|
7596
7602
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
7597
7603
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
7604
|
+
* @param {string} [params.subType] 'linear' or 'inverse'
|
|
7605
|
+
* @param {string} [params.type] *inverse only* 'future', or 'swap'
|
|
7606
|
+
* @param {string} [params.marginMode] *linear only* 'cross' or 'isolated'
|
|
7598
7607
|
* @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
7599
7608
|
*/
|
|
7600
7609
|
await this.loadMarkets();
|
|
7601
7610
|
symbols = this.marketSymbols(symbols);
|
|
7602
7611
|
let market = undefined;
|
|
7603
7612
|
if (symbols !== undefined) {
|
|
7604
|
-
const
|
|
7605
|
-
|
|
7613
|
+
const symbolsLength = symbols.length;
|
|
7614
|
+
if (symbolsLength > 0) {
|
|
7615
|
+
const first = this.safeString(symbols, 0);
|
|
7616
|
+
market = this.market(first);
|
|
7617
|
+
}
|
|
7606
7618
|
}
|
|
7607
7619
|
let marginMode = undefined;
|
|
7608
7620
|
[marginMode, params] = this.handleMarginModeAndParams('fetchPositions', params, 'cross');
|
|
@@ -9143,6 +9155,69 @@ class htx extends htx$1 {
|
|
|
9143
9155
|
'datetime': this.iso8601(timestamp),
|
|
9144
9156
|
});
|
|
9145
9157
|
}
|
|
9158
|
+
async closePosition(symbol, side = undefined, params = {}) {
|
|
9159
|
+
/**
|
|
9160
|
+
* @method
|
|
9161
|
+
* @name htx#closePositions
|
|
9162
|
+
* @description closes open positions for a contract market, requires 'amount' in params, unlike other exchanges
|
|
9163
|
+
* @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#isolated-place-lightning-close-order // USDT-M (isolated)
|
|
9164
|
+
* @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#cross-place-lightning-close-position // USDT-M (cross)
|
|
9165
|
+
* @see https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#place-lightning-close-order // Coin-M swap
|
|
9166
|
+
* @see https://huobiapi.github.io/docs/dm/v1/en/#place-flash-close-order // Coin-M futures
|
|
9167
|
+
* @param {string} symbol unified CCXT market symbol
|
|
9168
|
+
* @param {string} side 'buy' or 'sell', the side of the closing order, opposite side as position side
|
|
9169
|
+
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
9170
|
+
* @param {string} [params.clientOrderId] client needs to provide unique API and have to maintain the API themselves afterwards. [1, 9223372036854775807]
|
|
9171
|
+
* @param {object} [params.marginMode] 'cross' or 'isolated', required for linear markets
|
|
9172
|
+
*
|
|
9173
|
+
* EXCHANGE SPECIFIC PARAMETERS
|
|
9174
|
+
* @param {number} [params.amount] order quantity
|
|
9175
|
+
* @param {string} [params.order_price_type] 'lightning' by default, 'lightning_fok': lightning fok type, 'lightning_ioc': lightning ioc type 'market' by default, 'market': market order type, 'lightning_fok': lightning
|
|
9176
|
+
* @returns {object} [an order structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
9177
|
+
*/
|
|
9178
|
+
await this.loadMarkets();
|
|
9179
|
+
const market = this.market(symbol);
|
|
9180
|
+
const clientOrderId = this.safeString(params, 'clientOrderId');
|
|
9181
|
+
if (!market['contract']) {
|
|
9182
|
+
throw new errors.BadRequest(this.id + ' closePosition() symbol supports contract markets only');
|
|
9183
|
+
}
|
|
9184
|
+
this.checkRequiredArgument('closePosition', side, 'side');
|
|
9185
|
+
const request = {
|
|
9186
|
+
'contract_code': market['id'],
|
|
9187
|
+
'direction': side,
|
|
9188
|
+
};
|
|
9189
|
+
if (clientOrderId !== undefined) {
|
|
9190
|
+
request['client_order_id'] = clientOrderId;
|
|
9191
|
+
}
|
|
9192
|
+
if (market['inverse']) {
|
|
9193
|
+
const amount = this.safeString2(params, 'volume', 'amount');
|
|
9194
|
+
if (amount === undefined) {
|
|
9195
|
+
throw new errors.ArgumentsRequired(this.id + ' closePosition () requires an extra argument params["amount"] for inverse markets');
|
|
9196
|
+
}
|
|
9197
|
+
request['volume'] = this.amountToPrecision(symbol, amount);
|
|
9198
|
+
}
|
|
9199
|
+
params = this.omit(params, ['clientOrderId', 'volume', 'amount']);
|
|
9200
|
+
let response = undefined;
|
|
9201
|
+
if (market['inverse']) { // Coin-M
|
|
9202
|
+
if (market['swap']) {
|
|
9203
|
+
response = await this.contractPrivatePostSwapApiV1SwapLightningClosePosition(this.extend(request, params));
|
|
9204
|
+
}
|
|
9205
|
+
else { // future
|
|
9206
|
+
response = await this.contractPrivatePostApiV1LightningClosePosition(this.extend(request, params));
|
|
9207
|
+
}
|
|
9208
|
+
}
|
|
9209
|
+
else { // USDT-M
|
|
9210
|
+
let marginMode = undefined;
|
|
9211
|
+
[marginMode, params] = this.handleMarginModeAndParams('closePosition', params, 'cross');
|
|
9212
|
+
if (marginMode === 'cross') {
|
|
9213
|
+
response = await this.contractPrivatePostLinearSwapApiV1SwapCrossLightningClosePosition(this.extend(request, params));
|
|
9214
|
+
}
|
|
9215
|
+
else { // isolated
|
|
9216
|
+
response = await this.contractPrivatePostLinearSwapApiV1SwapLightningClosePosition(this.extend(request, params));
|
|
9217
|
+
}
|
|
9218
|
+
}
|
|
9219
|
+
return this.parseOrder(response, market);
|
|
9220
|
+
}
|
|
9146
9221
|
async setPositionMode(hedged, symbol = undefined, params = {}) {
|
|
9147
9222
|
/**
|
|
9148
9223
|
* @method
|
package/dist/cjs/src/kraken.js
CHANGED
|
@@ -161,13 +161,13 @@ class kraken extends kraken$1 {
|
|
|
161
161
|
// rate-limits explained in comment in the top of this file
|
|
162
162
|
'Assets': 1,
|
|
163
163
|
'AssetPairs': 1,
|
|
164
|
-
'Depth': 1,
|
|
165
|
-
'OHLC': 1,
|
|
164
|
+
'Depth': 1.2,
|
|
165
|
+
'OHLC': 1.2,
|
|
166
166
|
'Spread': 1,
|
|
167
167
|
'SystemStatus': 1,
|
|
168
168
|
'Ticker': 1,
|
|
169
169
|
'Time': 1,
|
|
170
|
-
'Trades': 1,
|
|
170
|
+
'Trades': 1.2,
|
|
171
171
|
},
|
|
172
172
|
},
|
|
173
173
|
'private': {
|
|
@@ -758,8 +758,8 @@ class kraken extends kraken$1 {
|
|
|
758
758
|
return {
|
|
759
759
|
'info': response,
|
|
760
760
|
'symbol': market['symbol'],
|
|
761
|
-
'maker': this.
|
|
762
|
-
'taker': this.
|
|
761
|
+
'maker': this.parseNumber(Precise["default"].stringDiv(this.safeString(symbolMakerFee, 'fee'), '100')),
|
|
762
|
+
'taker': this.parseNumber(Precise["default"].stringDiv(this.safeString(symbolTakerFee, 'fee'), '100')),
|
|
763
763
|
'percentage': true,
|
|
764
764
|
'tierBased': true,
|
|
765
765
|
};
|
package/dist/cjs/src/paymium.js
CHANGED
|
@@ -426,7 +426,10 @@ class paymium extends paymium$1 {
|
|
|
426
426
|
const request = {
|
|
427
427
|
'uuid': id,
|
|
428
428
|
};
|
|
429
|
-
|
|
429
|
+
const response = await this.privateDeleteUserOrdersUuidCancel(this.extend(request, params));
|
|
430
|
+
return this.safeOrder({
|
|
431
|
+
'info': response,
|
|
432
|
+
});
|
|
430
433
|
}
|
|
431
434
|
async transfer(code, amount, fromAccount, toAccount, params = {}) {
|
|
432
435
|
/**
|
|
@@ -723,11 +723,11 @@ class binance extends binance$1 {
|
|
|
723
723
|
// todo: this is a synch blocking call - make it async
|
|
724
724
|
// default 100, max 1000, valid limits 5, 10, 20, 50, 100, 500, 1000
|
|
725
725
|
const snapshot = await this.fetchRestOrderBookSafe(symbol, limit, params);
|
|
726
|
-
|
|
727
|
-
if (orderbook === undefined) {
|
|
726
|
+
if (this.safeValue(this.orderbooks, symbol) === undefined) {
|
|
728
727
|
// if the orderbook is dropped before the snapshot is received
|
|
729
728
|
return;
|
|
730
729
|
}
|
|
730
|
+
const orderbook = this.orderbooks[symbol];
|
|
731
731
|
orderbook.reset(snapshot);
|
|
732
732
|
// unroll the accumulated deltas
|
|
733
733
|
const messages = orderbook.cache;
|
|
@@ -813,8 +813,7 @@ class binance extends binance$1 {
|
|
|
813
813
|
const symbol = market['symbol'];
|
|
814
814
|
const name = 'depth';
|
|
815
815
|
const messageHash = market['lowercaseId'] + '@' + name;
|
|
816
|
-
|
|
817
|
-
if (orderbook === undefined) {
|
|
816
|
+
if (!(symbol in this.orderbooks)) {
|
|
818
817
|
//
|
|
819
818
|
// https://github.com/ccxt/ccxt/issues/6672
|
|
820
819
|
//
|
|
@@ -825,6 +824,7 @@ class binance extends binance$1 {
|
|
|
825
824
|
//
|
|
826
825
|
return;
|
|
827
826
|
}
|
|
827
|
+
const orderbook = this.orderbooks[symbol];
|
|
828
828
|
const nonce = this.safeInteger(orderbook, 'nonce');
|
|
829
829
|
if (nonce === undefined) {
|
|
830
830
|
// 2. Buffer the events you receive from the stream.
|
|
@@ -988,14 +988,17 @@ class bingx extends bingx$1 {
|
|
|
988
988
|
// }
|
|
989
989
|
//
|
|
990
990
|
const isSpot = ('dataType' in message);
|
|
991
|
-
const result = this.
|
|
991
|
+
const result = this.safeDict2(message, 'data', 'o', {});
|
|
992
992
|
let cachedTrades = this.myTrades;
|
|
993
993
|
if (cachedTrades === undefined) {
|
|
994
994
|
const limit = this.safeInteger(this.options, 'tradesLimit', 1000);
|
|
995
995
|
cachedTrades = new Cache.ArrayCacheBySymbolById(limit);
|
|
996
996
|
this.myTrades = cachedTrades;
|
|
997
997
|
}
|
|
998
|
-
const
|
|
998
|
+
const type = isSpot ? 'spot' : 'swap';
|
|
999
|
+
const marketId = this.safeString(result, 's');
|
|
1000
|
+
const market = this.safeMarket(marketId, undefined, '-', type);
|
|
1001
|
+
const parsed = this.parseTrade(result, market);
|
|
999
1002
|
const symbol = parsed['symbol'];
|
|
1000
1003
|
const spotHash = 'spot:mytrades';
|
|
1001
1004
|
const swapHash = 'swap:mytrades';
|
|
@@ -1041,10 +1044,13 @@ class bingx extends bingx$1 {
|
|
|
1041
1044
|
// }
|
|
1042
1045
|
// }
|
|
1043
1046
|
//
|
|
1044
|
-
const a = this.
|
|
1045
|
-
const data = this.
|
|
1047
|
+
const a = this.safeDict(message, 'a', {});
|
|
1048
|
+
const data = this.safeList(a, 'B', []);
|
|
1046
1049
|
const timestamp = this.safeInteger2(message, 'T', 'E');
|
|
1047
1050
|
const type = ('P' in a) ? 'swap' : 'spot';
|
|
1051
|
+
if (!(type in this.balance)) {
|
|
1052
|
+
this.balance[type] = {};
|
|
1053
|
+
}
|
|
1048
1054
|
this.balance[type]['info'] = data;
|
|
1049
1055
|
this.balance[type]['timestamp'] = timestamp;
|
|
1050
1056
|
this.balance[type]['datetime'] = this.iso8601(timestamp);
|
|
@@ -577,8 +577,7 @@ class bitfinex2 extends bitfinex2$1 {
|
|
|
577
577
|
const prec = this.safeString(subscription, 'prec', 'P0');
|
|
578
578
|
const isRaw = (prec === 'R0');
|
|
579
579
|
// if it is an initial snapshot
|
|
580
|
-
|
|
581
|
-
if (orderbook === undefined) {
|
|
580
|
+
if (!(symbol in this.orderbooks)) {
|
|
582
581
|
const limit = this.safeInteger(subscription, 'len');
|
|
583
582
|
if (isRaw) {
|
|
584
583
|
// raw order books
|
|
@@ -588,7 +587,7 @@ class bitfinex2 extends bitfinex2$1 {
|
|
|
588
587
|
// P0, P1, P2, P3, P4
|
|
589
588
|
this.orderbooks[symbol] = this.countedOrderBook({}, limit);
|
|
590
589
|
}
|
|
591
|
-
orderbook = this.orderbooks[symbol];
|
|
590
|
+
const orderbook = this.orderbooks[symbol];
|
|
592
591
|
if (isRaw) {
|
|
593
592
|
const deltas = message[1];
|
|
594
593
|
for (let i = 0; i < deltas.length; i++) {
|
|
@@ -599,7 +598,7 @@ class bitfinex2 extends bitfinex2$1 {
|
|
|
599
598
|
const bookside = orderbook[side];
|
|
600
599
|
const idString = this.safeString(delta, 0);
|
|
601
600
|
const price = this.safeFloat(delta, 1);
|
|
602
|
-
bookside.
|
|
601
|
+
bookside.storeArray([price, size, idString]);
|
|
603
602
|
}
|
|
604
603
|
}
|
|
605
604
|
else {
|
|
@@ -612,13 +611,14 @@ class bitfinex2 extends bitfinex2$1 {
|
|
|
612
611
|
const size = (amount < 0) ? -amount : amount;
|
|
613
612
|
const side = (amount < 0) ? 'asks' : 'bids';
|
|
614
613
|
const bookside = orderbook[side];
|
|
615
|
-
bookside.
|
|
614
|
+
bookside.storeArray([price, size, counter]);
|
|
616
615
|
}
|
|
617
616
|
}
|
|
618
617
|
orderbook['symbol'] = symbol;
|
|
619
618
|
client.resolve(orderbook, messageHash);
|
|
620
619
|
}
|
|
621
620
|
else {
|
|
621
|
+
const orderbook = this.orderbooks[symbol];
|
|
622
622
|
const deltas = message[1];
|
|
623
623
|
const orderbookItem = this.orderbooks[symbol];
|
|
624
624
|
if (isRaw) {
|
|
@@ -355,9 +355,9 @@ class bitmart extends bitmart$1 {
|
|
|
355
355
|
/**
|
|
356
356
|
* @method
|
|
357
357
|
* @name bitmart#watchOrders
|
|
358
|
-
* @see https://developer-pro.bitmart.com/en/spot/#private-order-channel
|
|
359
|
-
* @see https://developer-pro.bitmart.com/en/futures/#private-order-channel
|
|
360
358
|
* @description watches information on multiple orders made by the user
|
|
359
|
+
* @see https://developer-pro.bitmart.com/en/spot/#private-order-progress
|
|
360
|
+
* @see https://developer-pro.bitmart.com/en/futures/#private-order-channel
|
|
361
361
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
362
362
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
363
363
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
@@ -377,12 +377,16 @@ class bitmart extends bitmart$1 {
|
|
|
377
377
|
await this.authenticate(type, params);
|
|
378
378
|
let request = undefined;
|
|
379
379
|
if (type === 'spot') {
|
|
380
|
-
|
|
381
|
-
|
|
380
|
+
let argsRequest = 'spot/user/order:';
|
|
381
|
+
if (symbol !== undefined) {
|
|
382
|
+
argsRequest += market['id'];
|
|
383
|
+
}
|
|
384
|
+
else {
|
|
385
|
+
argsRequest = 'spot/user/orders:ALL_SYMBOLS';
|
|
382
386
|
}
|
|
383
387
|
request = {
|
|
384
388
|
'op': 'subscribe',
|
|
385
|
-
'args': [
|
|
389
|
+
'args': [argsRequest],
|
|
386
390
|
};
|
|
387
391
|
}
|
|
388
392
|
else {
|
|
@@ -707,23 +707,23 @@ class bybit extends bybit$1 {
|
|
|
707
707
|
const isSpot = client.url.indexOf('spot') >= 0;
|
|
708
708
|
const type = this.safeString(message, 'type');
|
|
709
709
|
const isSnapshot = (type === 'snapshot');
|
|
710
|
-
const data = this.
|
|
710
|
+
const data = this.safeDict(message, 'data', {});
|
|
711
711
|
const marketId = this.safeString(data, 's');
|
|
712
712
|
const marketType = isSpot ? 'spot' : 'contract';
|
|
713
713
|
const market = this.safeMarket(marketId, undefined, undefined, marketType);
|
|
714
714
|
const symbol = market['symbol'];
|
|
715
715
|
const timestamp = this.safeInteger(message, 'ts');
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
orderbook = this.orderBook();
|
|
716
|
+
if (!(symbol in this.orderbooks)) {
|
|
717
|
+
this.orderbooks[symbol] = this.orderBook();
|
|
719
718
|
}
|
|
719
|
+
const orderbook = this.orderbooks[symbol];
|
|
720
720
|
if (isSnapshot) {
|
|
721
721
|
const snapshot = this.parseOrderBook(data, symbol, timestamp, 'b', 'a');
|
|
722
722
|
orderbook.reset(snapshot);
|
|
723
723
|
}
|
|
724
724
|
else {
|
|
725
|
-
const asks = this.
|
|
726
|
-
const bids = this.
|
|
725
|
+
const asks = this.safeList(data, 'a', []);
|
|
726
|
+
const bids = this.safeList(data, 'b', []);
|
|
727
727
|
this.handleDeltas(orderbook['asks'], asks);
|
|
728
728
|
this.handleDeltas(orderbook['bids'], bids);
|
|
729
729
|
orderbook['timestamp'] = timestamp;
|
package/dist/cjs/src/pro/htx.js
CHANGED
|
@@ -629,20 +629,19 @@ class htx extends htx$1 {
|
|
|
629
629
|
// }
|
|
630
630
|
//
|
|
631
631
|
const messageHash = this.safeString(message, 'ch');
|
|
632
|
-
const tick = this.
|
|
632
|
+
const tick = this.safeDict(message, 'tick');
|
|
633
633
|
const event = this.safeString(tick, 'event');
|
|
634
|
-
const ch = this.
|
|
634
|
+
const ch = this.safeString(message, 'ch');
|
|
635
635
|
const parts = ch.split('.');
|
|
636
636
|
const marketId = this.safeString(parts, 1);
|
|
637
637
|
const symbol = this.safeSymbol(marketId);
|
|
638
|
-
|
|
639
|
-
if (orderbook === undefined) {
|
|
638
|
+
if (!(symbol in this.orderbooks)) {
|
|
640
639
|
const size = this.safeString(parts, 3);
|
|
641
640
|
const sizeParts = size.split('_');
|
|
642
641
|
const limit = this.safeInteger(sizeParts, 1);
|
|
643
|
-
|
|
644
|
-
this.orderbooks[symbol] = orderbook;
|
|
642
|
+
this.orderbooks[symbol] = this.orderBook({}, limit);
|
|
645
643
|
}
|
|
644
|
+
const orderbook = this.orderbooks[symbol];
|
|
646
645
|
if ((event === undefined) && (orderbook['nonce'] === undefined)) {
|
|
647
646
|
orderbook.cache.push(message);
|
|
648
647
|
}
|