ccxt 4.1.69 → 4.1.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/ccxt.browser.js +702 -207
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/binance.js +1 -0
- package/dist/cjs/src/coinbase.js +3 -0
- package/dist/cjs/src/coinex.js +388 -63
- package/dist/cjs/src/gate.js +297 -134
- package/dist/cjs/src/pro/binance.js +13 -10
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- 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/coinbase.d.ts +3 -0
- package/js/src/binance.js +1 -0
- package/js/src/coinbase.js +3 -0
- package/js/src/coinex.d.ts +4 -1
- package/js/src/coinex.js +388 -63
- package/js/src/gate.js +297 -134
- package/js/src/pro/binance.js +13 -10
- package/package.json +1 -1
- package/skip-tests.json +3 -1
package/dist/ccxt.browser.js
CHANGED
|
@@ -17497,6 +17497,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
17497
17497
|
'sapiV2': {
|
|
17498
17498
|
'get': {
|
|
17499
17499
|
'sub-account/futures/account': 0.1,
|
|
17500
|
+
'sub-account/futures/accountSummary': 1,
|
|
17500
17501
|
'sub-account/futures/positionRisk': 0.1,
|
|
17501
17502
|
},
|
|
17502
17503
|
'post': {
|
|
@@ -85288,12 +85289,15 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
85288
85289
|
'brokerage/transaction_summary',
|
|
85289
85290
|
'brokerage/product_book',
|
|
85290
85291
|
'brokerage/best_bid_ask',
|
|
85292
|
+
'brokerage/convert/trade/{trade_id}',
|
|
85291
85293
|
],
|
|
85292
85294
|
'post': [
|
|
85293
85295
|
'brokerage/orders',
|
|
85294
85296
|
'brokerage/orders/batch_cancel',
|
|
85295
85297
|
'brokerage/orders/edit',
|
|
85296
85298
|
'brokerage/orders/edit_preview',
|
|
85299
|
+
'brokerage/convert/quote',
|
|
85300
|
+
'brokerage/convert/trade/{trade_id}',
|
|
85297
85301
|
],
|
|
85298
85302
|
},
|
|
85299
85303
|
},
|
|
@@ -91132,8 +91136,10 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
91132
91136
|
'borrowIsolatedMargin': true,
|
|
91133
91137
|
'cancelAllOrders': true,
|
|
91134
91138
|
'cancelOrder': true,
|
|
91139
|
+
'cancelOrders': true,
|
|
91135
91140
|
'createDepositAddress': true,
|
|
91136
91141
|
'createOrder': true,
|
|
91142
|
+
'createOrders': true,
|
|
91137
91143
|
'createReduceOnlyOrder': true,
|
|
91138
91144
|
'editOrder': true,
|
|
91139
91145
|
'fetchBalance': true,
|
|
@@ -92624,6 +92630,8 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
92624
92630
|
}
|
|
92625
92631
|
parseOrderStatus(status) {
|
|
92626
92632
|
const statuses = {
|
|
92633
|
+
'rejected': 'rejected',
|
|
92634
|
+
'open': 'open',
|
|
92627
92635
|
'not_deal': 'open',
|
|
92628
92636
|
'part_deal': 'open',
|
|
92629
92637
|
'done': 'closed',
|
|
@@ -92657,7 +92665,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
92657
92665
|
// "client_id": "",
|
|
92658
92666
|
// }
|
|
92659
92667
|
//
|
|
92660
|
-
// Spot and Margin createOrder, cancelOrder, fetchOrder
|
|
92668
|
+
// Spot and Margin createOrder, createOrders, cancelOrder, cancelOrders, fetchOrder
|
|
92661
92669
|
//
|
|
92662
92670
|
// {
|
|
92663
92671
|
// "amount":"1.5",
|
|
@@ -92856,13 +92864,50 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
92856
92864
|
// "user_id": 3620173
|
|
92857
92865
|
// }
|
|
92858
92866
|
//
|
|
92867
|
+
// swap: cancelOrders
|
|
92868
|
+
//
|
|
92869
|
+
// {
|
|
92870
|
+
// "amount": "0.0005",
|
|
92871
|
+
// "client_id": "x-167673045-b0cee0c584718b65",
|
|
92872
|
+
// "create_time": 1701233683.294231,
|
|
92873
|
+
// "deal_asset_fee": "0.00000000000000000000",
|
|
92874
|
+
// "deal_fee": "0.00000000000000000000",
|
|
92875
|
+
// "deal_profit": "0.00000000000000000000",
|
|
92876
|
+
// "deal_stock": "0.00000000000000000000",
|
|
92877
|
+
// "effect_type": 1,
|
|
92878
|
+
// "fee_asset": "",
|
|
92879
|
+
// "fee_discount": "0.00000000000000000000",
|
|
92880
|
+
// "last_deal_amount": "0.00000000000000000000",
|
|
92881
|
+
// "last_deal_id": 0,
|
|
92882
|
+
// "last_deal_price": "0.00000000000000000000",
|
|
92883
|
+
// "last_deal_role": 0,
|
|
92884
|
+
// "last_deal_time": 0,
|
|
92885
|
+
// "last_deal_type": 0,
|
|
92886
|
+
// "left": "0.0005",
|
|
92887
|
+
// "leverage": "3",
|
|
92888
|
+
// "maker_fee": "0.00030",
|
|
92889
|
+
// "market": "BTCUSDT",
|
|
92890
|
+
// "option": 0,
|
|
92891
|
+
// "order_id": 115940476323,
|
|
92892
|
+
// "position_id": 0,
|
|
92893
|
+
// "position_type": 2,
|
|
92894
|
+
// "price": "25000.00",
|
|
92895
|
+
// "side": 2,
|
|
92896
|
+
// "source": "api.v1",
|
|
92897
|
+
// "stop_id": 0,
|
|
92898
|
+
// "stop_loss_price": "0.00000000000000000000",
|
|
92899
|
+
// "stop_loss_type": 0,
|
|
92900
|
+
// "take_profit_price": "0.00000000000000000000",
|
|
92901
|
+
// "take_profit_type": 0,
|
|
92902
|
+
// "taker_fee": "0.00050",
|
|
92903
|
+
// "target": 0,
|
|
92904
|
+
// "type": 1,
|
|
92905
|
+
// "update_time": 1701233721.718884,
|
|
92906
|
+
// "user_id": 3620173
|
|
92907
|
+
// }
|
|
92908
|
+
//
|
|
92909
|
+
const rawStatus = this.safeString(order, 'status');
|
|
92859
92910
|
const timestamp = this.safeTimestamp(order, 'create_time');
|
|
92860
|
-
const priceString = this.safeString(order, 'price');
|
|
92861
|
-
const costString = this.safeString(order, 'deal_money');
|
|
92862
|
-
const amountString = this.safeString(order, 'amount');
|
|
92863
|
-
const filledString = this.safeString(order, 'deal_amount');
|
|
92864
|
-
const averageString = this.safeString(order, 'avg_price');
|
|
92865
|
-
const remainingString = this.safeString(order, 'left');
|
|
92866
92911
|
const marketId = this.safeString(order, 'market');
|
|
92867
92912
|
const defaultType = this.safeString(this.options, 'defaultType');
|
|
92868
92913
|
const orderType = ('source' in order) ? 'swap' : defaultType;
|
|
@@ -92872,7 +92917,6 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
92872
92917
|
if (feeCurrency === undefined) {
|
|
92873
92918
|
feeCurrency = market['quote'];
|
|
92874
92919
|
}
|
|
92875
|
-
const status = this.parseOrderStatus(this.safeString(order, 'status'));
|
|
92876
92920
|
const rawSide = this.safeInteger(order, 'side');
|
|
92877
92921
|
let side = undefined;
|
|
92878
92922
|
if (rawSide === 1) {
|
|
@@ -92908,21 +92952,23 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
92908
92952
|
'datetime': this.iso8601(timestamp),
|
|
92909
92953
|
'timestamp': timestamp,
|
|
92910
92954
|
'lastTradeTimestamp': this.safeTimestamp(order, 'update_time'),
|
|
92911
|
-
'status':
|
|
92955
|
+
'status': this.parseOrderStatus(rawStatus),
|
|
92912
92956
|
'symbol': market['symbol'],
|
|
92913
92957
|
'type': type,
|
|
92914
92958
|
'timeInForce': undefined,
|
|
92915
92959
|
'postOnly': undefined,
|
|
92916
92960
|
'reduceOnly': undefined,
|
|
92917
92961
|
'side': side,
|
|
92918
|
-
'price':
|
|
92962
|
+
'price': this.safeString(order, 'price'),
|
|
92919
92963
|
'stopPrice': this.safeString(order, 'stop_price'),
|
|
92920
92964
|
'triggerPrice': this.safeString(order, 'stop_price'),
|
|
92921
|
-
'
|
|
92922
|
-
'
|
|
92923
|
-
'
|
|
92924
|
-
'
|
|
92925
|
-
'
|
|
92965
|
+
'takeProfitPrice': this.safeNumber(order, 'take_profit_price'),
|
|
92966
|
+
'stopLossPrice': this.safeNumber(order, 'stop_loss_price'),
|
|
92967
|
+
'cost': this.safeString(order, 'deal_money'),
|
|
92968
|
+
'average': this.safeString(order, 'avg_price'),
|
|
92969
|
+
'amount': this.safeString(order, 'amount'),
|
|
92970
|
+
'filled': this.safeString(order, 'deal_amount'),
|
|
92971
|
+
'remaining': this.safeString(order, 'left'),
|
|
92926
92972
|
'trades': undefined,
|
|
92927
92973
|
'fee': {
|
|
92928
92974
|
'currency': feeCurrency,
|
|
@@ -92931,34 +92977,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
92931
92977
|
'info': order,
|
|
92932
92978
|
}, market);
|
|
92933
92979
|
}
|
|
92934
|
-
|
|
92935
|
-
/**
|
|
92936
|
-
* @method
|
|
92937
|
-
* @name coinex#createOrder
|
|
92938
|
-
* @description create a trade order
|
|
92939
|
-
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http017_put_limit
|
|
92940
|
-
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http018_put_market
|
|
92941
|
-
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http019_put_limit_stop
|
|
92942
|
-
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http020_put_market_stop
|
|
92943
|
-
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http031_market_close
|
|
92944
|
-
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http030_limit_close
|
|
92945
|
-
* @param {string} symbol unified symbol of the market to create an order in
|
|
92946
|
-
* @param {string} type 'market' or 'limit'
|
|
92947
|
-
* @param {string} side 'buy' or 'sell'
|
|
92948
|
-
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
92949
|
-
* @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
92950
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
92951
|
-
* @param {float} triggerPrice price at which to triger stop orders
|
|
92952
|
-
* @param {float} stopPrice price at which to triger stop orders
|
|
92953
|
-
* @param {float} stopLossPrice price at which to trigger stop-loss orders
|
|
92954
|
-
* @param {float} takeProfitPrice price at which to trigger take-profit orders
|
|
92955
|
-
* @param {string} [params.timeInForce] "GTC", "IOC", "FOK", "PO"
|
|
92956
|
-
* @param {bool} params.postOnly
|
|
92957
|
-
* @param {bool} params.reduceOnly
|
|
92958
|
-
* @param {bool} [params.position_id] *required for reduce only orders* the position id to reduce
|
|
92959
|
-
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
92960
|
-
*/
|
|
92961
|
-
await this.loadMarkets();
|
|
92980
|
+
createOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
|
|
92962
92981
|
const market = this.market(symbol);
|
|
92963
92982
|
const swap = market['swap'];
|
|
92964
92983
|
const clientOrderId = this.safeString2(params, 'client_id', 'clientOrderId');
|
|
@@ -92972,14 +92991,13 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
92972
92991
|
const timeInForceRaw = this.safeString(params, 'timeInForce'); // Spot: IOC, FOK, PO, GTC, ... NORMAL (default), MAKER_ONLY
|
|
92973
92992
|
const reduceOnly = this.safeValue(params, 'reduceOnly');
|
|
92974
92993
|
if (reduceOnly) {
|
|
92975
|
-
if (market['
|
|
92994
|
+
if (!market['swap']) {
|
|
92976
92995
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder(this.id + ' createOrder() does not support reduceOnly for ' + market['type'] + ' orders, reduceOnly orders are supported for swap markets only');
|
|
92977
92996
|
}
|
|
92978
92997
|
if (positionId === undefined) {
|
|
92979
92998
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' createOrder() requires a position_id/positionId parameter for reduceOnly orders');
|
|
92980
92999
|
}
|
|
92981
93000
|
}
|
|
92982
|
-
let method = undefined;
|
|
92983
93001
|
const request = {
|
|
92984
93002
|
'market': market['id'],
|
|
92985
93003
|
};
|
|
@@ -92999,16 +93017,13 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
92999
93017
|
}
|
|
93000
93018
|
request['position_id'] = positionId;
|
|
93001
93019
|
if (stopLossPrice) {
|
|
93002
|
-
method = 'perpetualPrivatePostPositionStopLoss';
|
|
93003
93020
|
request['stop_loss_price'] = this.priceToPrecision(symbol, stopLossPrice);
|
|
93004
93021
|
}
|
|
93005
93022
|
else if (takeProfitPrice) {
|
|
93006
|
-
method = 'perpetualPrivatePostPositionTakeProfit';
|
|
93007
93023
|
request['take_profit_price'] = this.priceToPrecision(symbol, takeProfitPrice);
|
|
93008
93024
|
}
|
|
93009
93025
|
}
|
|
93010
93026
|
else {
|
|
93011
|
-
method = 'perpetualPrivatePostOrderPut' + this.capitalize(type);
|
|
93012
93027
|
const requestSide = (side === 'buy') ? 2 : 1;
|
|
93013
93028
|
if (stopPrice !== undefined) {
|
|
93014
93029
|
request['stop_price'] = this.priceToPrecision(symbol, stopPrice);
|
|
@@ -93016,12 +93031,8 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
93016
93031
|
request['amount'] = this.amountToPrecision(symbol, amount);
|
|
93017
93032
|
request['side'] = requestSide;
|
|
93018
93033
|
if (type === 'limit') {
|
|
93019
|
-
method = 'perpetualPrivatePostOrderPutStopLimit';
|
|
93020
93034
|
request['price'] = this.priceToPrecision(symbol, price);
|
|
93021
93035
|
}
|
|
93022
|
-
else if (type === 'market') {
|
|
93023
|
-
method = 'perpetualPrivatePostOrderPutStopMarket';
|
|
93024
|
-
}
|
|
93025
93036
|
request['amount'] = this.amountToPrecision(symbol, amount);
|
|
93026
93037
|
}
|
|
93027
93038
|
let timeInForce = undefined;
|
|
@@ -93044,7 +93055,6 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
93044
93055
|
}
|
|
93045
93056
|
if (type === 'limit' && stopPrice === undefined) {
|
|
93046
93057
|
if (reduceOnly) {
|
|
93047
|
-
method = 'perpetualPrivatePostOrderCloseLimit';
|
|
93048
93058
|
request['position_id'] = positionId;
|
|
93049
93059
|
}
|
|
93050
93060
|
else {
|
|
@@ -93055,7 +93065,6 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
93055
93065
|
}
|
|
93056
93066
|
else if (type === 'market' && stopPrice === undefined) {
|
|
93057
93067
|
if (reduceOnly) {
|
|
93058
|
-
method = 'perpetualPrivatePostOrderCloseMarket';
|
|
93059
93068
|
request['position_id'] = positionId;
|
|
93060
93069
|
}
|
|
93061
93070
|
else {
|
|
@@ -93066,7 +93075,6 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
93066
93075
|
}
|
|
93067
93076
|
}
|
|
93068
93077
|
else {
|
|
93069
|
-
method = 'privatePostOrder' + this.capitalize(type);
|
|
93070
93078
|
request['type'] = side;
|
|
93071
93079
|
if ((type === 'market') && (side === 'buy')) {
|
|
93072
93080
|
if (this.options['createMarketBuyOrderRequiresPrice']) {
|
|
@@ -93093,12 +93101,6 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
93093
93101
|
}
|
|
93094
93102
|
if (stopPrice !== undefined) {
|
|
93095
93103
|
request['stop_price'] = this.priceToPrecision(symbol, stopPrice);
|
|
93096
|
-
if (type === 'limit') {
|
|
93097
|
-
method = 'privatePostOrderStopLimit';
|
|
93098
|
-
}
|
|
93099
|
-
else if (type === 'market') {
|
|
93100
|
-
method = 'privatePostOrderStopMarket';
|
|
93101
|
-
}
|
|
93102
93104
|
}
|
|
93103
93105
|
if ((type !== 'market') || (stopPrice !== undefined)) {
|
|
93104
93106
|
// following options cannot be applied to vanilla market orders (but can be applied to stop-market orders)
|
|
@@ -93126,7 +93128,100 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
93126
93128
|
request['account_id'] = accountId;
|
|
93127
93129
|
}
|
|
93128
93130
|
params = this.omit(params, ['reduceOnly', 'positionId', 'timeInForce', 'postOnly', 'stopPrice', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice']);
|
|
93129
|
-
|
|
93131
|
+
return this.extend(request, params);
|
|
93132
|
+
}
|
|
93133
|
+
async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
|
|
93134
|
+
/**
|
|
93135
|
+
* @method
|
|
93136
|
+
* @name coinex#createOrder
|
|
93137
|
+
* @description create a trade order
|
|
93138
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http017_put_limit
|
|
93139
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http018_put_market
|
|
93140
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http019_put_limit_stop
|
|
93141
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http020_put_market_stop
|
|
93142
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http031_market_close
|
|
93143
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http030_limit_close
|
|
93144
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
93145
|
+
* @param {string} type 'market' or 'limit'
|
|
93146
|
+
* @param {string} side 'buy' or 'sell'
|
|
93147
|
+
* @param {float} amount how much you want to trade in units of the base currency
|
|
93148
|
+
* @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
93149
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
93150
|
+
* @param {float} [params.triggerPrice] price to trigger stop orders
|
|
93151
|
+
* @param {float} [params.stopLossPrice] price to trigger stop loss orders
|
|
93152
|
+
* @param {float} [params.takeProfitPrice] price to trigger take profit orders
|
|
93153
|
+
* @param {string} [params.timeInForce] 'GTC', 'IOC', 'FOK', 'PO'
|
|
93154
|
+
* @param {boolean} [params.postOnly] set to true if you wish to make a post only order
|
|
93155
|
+
* @param {boolean} [params.reduceOnly] *contract only* indicates if this order is to reduce the size of a position
|
|
93156
|
+
* @param {int} [params.position_id] *required for reduce only orders* the position id to reduce
|
|
93157
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
93158
|
+
*/
|
|
93159
|
+
await this.loadMarkets();
|
|
93160
|
+
const market = this.market(symbol);
|
|
93161
|
+
const reduceOnly = this.safeValue(params, 'reduceOnly');
|
|
93162
|
+
const triggerPrice = this.safeNumber2(params, 'stopPrice', 'triggerPrice');
|
|
93163
|
+
const stopLossTriggerPrice = this.safeNumber(params, 'stopLossPrice');
|
|
93164
|
+
const takeProfitTriggerPrice = this.safeNumber(params, 'takeProfitPrice');
|
|
93165
|
+
const isTriggerOrder = triggerPrice !== undefined;
|
|
93166
|
+
const isStopLossTriggerOrder = stopLossTriggerPrice !== undefined;
|
|
93167
|
+
const isTakeProfitTriggerOrder = takeProfitTriggerPrice !== undefined;
|
|
93168
|
+
const isStopLossOrTakeProfitTrigger = isStopLossTriggerOrder || isTakeProfitTriggerOrder;
|
|
93169
|
+
const request = this.createOrderRequest(symbol, type, side, amount, price, params);
|
|
93170
|
+
let response = undefined;
|
|
93171
|
+
if (market['spot']) {
|
|
93172
|
+
if (isTriggerOrder) {
|
|
93173
|
+
if (type === 'limit') {
|
|
93174
|
+
response = await this.privatePostOrderStopLimit(request);
|
|
93175
|
+
}
|
|
93176
|
+
else {
|
|
93177
|
+
response = await this.privatePostOrderStopMarket(request);
|
|
93178
|
+
}
|
|
93179
|
+
}
|
|
93180
|
+
else {
|
|
93181
|
+
if (type === 'limit') {
|
|
93182
|
+
response = await this.privatePostOrderLimit(request);
|
|
93183
|
+
}
|
|
93184
|
+
else {
|
|
93185
|
+
response = await this.privatePostOrderMarket(request);
|
|
93186
|
+
}
|
|
93187
|
+
}
|
|
93188
|
+
}
|
|
93189
|
+
else {
|
|
93190
|
+
if (isTriggerOrder) {
|
|
93191
|
+
if (type === 'limit') {
|
|
93192
|
+
response = await this.perpetualPrivatePostOrderPutStopLimit(request);
|
|
93193
|
+
}
|
|
93194
|
+
else {
|
|
93195
|
+
response = await this.perpetualPrivatePostOrderPutStopMarket(request);
|
|
93196
|
+
}
|
|
93197
|
+
}
|
|
93198
|
+
else if (isStopLossOrTakeProfitTrigger) {
|
|
93199
|
+
if (isStopLossTriggerOrder) {
|
|
93200
|
+
response = await this.perpetualPrivatePostPositionStopLoss(request);
|
|
93201
|
+
}
|
|
93202
|
+
else if (isTakeProfitTriggerOrder) {
|
|
93203
|
+
response = await this.perpetualPrivatePostPositionTakeProfit(request);
|
|
93204
|
+
}
|
|
93205
|
+
}
|
|
93206
|
+
else {
|
|
93207
|
+
if (reduceOnly) {
|
|
93208
|
+
if (type === 'limit') {
|
|
93209
|
+
response = await this.perpetualPrivatePostOrderCloseLimit(request);
|
|
93210
|
+
}
|
|
93211
|
+
else {
|
|
93212
|
+
response = await this.perpetualPrivatePostOrderCloseMarket(request);
|
|
93213
|
+
}
|
|
93214
|
+
}
|
|
93215
|
+
else {
|
|
93216
|
+
if (type === 'limit') {
|
|
93217
|
+
response = await this.perpetualPrivatePostOrderPutLimit(request);
|
|
93218
|
+
}
|
|
93219
|
+
else {
|
|
93220
|
+
response = await this.perpetualPrivatePostOrderPutMarket(request);
|
|
93221
|
+
}
|
|
93222
|
+
}
|
|
93223
|
+
}
|
|
93224
|
+
}
|
|
93130
93225
|
//
|
|
93131
93226
|
// Spot and Margin
|
|
93132
93227
|
//
|
|
@@ -93204,9 +93299,243 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
93204
93299
|
//
|
|
93205
93300
|
// {"code":0,"data":{"status":"success"},"message":"OK"}
|
|
93206
93301
|
//
|
|
93207
|
-
const data = this.safeValue(response, 'data');
|
|
93302
|
+
const data = this.safeValue(response, 'data', {});
|
|
93208
93303
|
return this.parseOrder(data, market);
|
|
93209
93304
|
}
|
|
93305
|
+
async createOrders(orders, params = {}) {
|
|
93306
|
+
/**
|
|
93307
|
+
* @method
|
|
93308
|
+
* @name coinex#createOrders
|
|
93309
|
+
* @description create a list of trade orders (all orders should be of the same symbol)
|
|
93310
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade002_batch_limit_orders
|
|
93311
|
+
* @param {array} orders list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
|
|
93312
|
+
* @param {object} [params] extra parameters specific to the api endpoint
|
|
93313
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
93314
|
+
*/
|
|
93315
|
+
await this.loadMarkets();
|
|
93316
|
+
const ordersRequests = [];
|
|
93317
|
+
let symbol = undefined;
|
|
93318
|
+
for (let i = 0; i < orders.length; i++) {
|
|
93319
|
+
const rawOrder = orders[i];
|
|
93320
|
+
const marketId = this.safeString(rawOrder, 'symbol');
|
|
93321
|
+
if (symbol === undefined) {
|
|
93322
|
+
symbol = marketId;
|
|
93323
|
+
}
|
|
93324
|
+
else {
|
|
93325
|
+
if (symbol !== marketId) {
|
|
93326
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest(this.id + ' createOrders() requires all orders to have the same symbol');
|
|
93327
|
+
}
|
|
93328
|
+
}
|
|
93329
|
+
const type = this.safeString(rawOrder, 'type');
|
|
93330
|
+
const side = this.safeString(rawOrder, 'side');
|
|
93331
|
+
const amount = this.safeValue(rawOrder, 'amount');
|
|
93332
|
+
const price = this.safeValue(rawOrder, 'price');
|
|
93333
|
+
const orderParams = this.safeValue(rawOrder, 'params', {});
|
|
93334
|
+
if (type !== 'limit') {
|
|
93335
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' createOrders() does not support ' + type + ' orders, only limit orders are accepted');
|
|
93336
|
+
}
|
|
93337
|
+
const orderRequest = this.createOrderRequest(marketId, type, side, amount, price, orderParams);
|
|
93338
|
+
ordersRequests.push(orderRequest);
|
|
93339
|
+
}
|
|
93340
|
+
const market = this.market(symbol);
|
|
93341
|
+
if (!market['spot']) {
|
|
93342
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' createOrders() does not support ' + market['type'] + ' orders, only spot orders are accepted');
|
|
93343
|
+
}
|
|
93344
|
+
const request = {
|
|
93345
|
+
'market': market['id'],
|
|
93346
|
+
'batch_orders': this.json(ordersRequests),
|
|
93347
|
+
};
|
|
93348
|
+
const response = await this.privatePostOrderLimitBatch(request);
|
|
93349
|
+
//
|
|
93350
|
+
// {
|
|
93351
|
+
// "code": 0,
|
|
93352
|
+
// "data": [
|
|
93353
|
+
// {
|
|
93354
|
+
// "code": 0,
|
|
93355
|
+
// "data": {
|
|
93356
|
+
// "amount": "0.0005",
|
|
93357
|
+
// "asset_fee": "0",
|
|
93358
|
+
// "avg_price": "0.00",
|
|
93359
|
+
// "client_id": "x-167673045-d34bfb41242d8fd1",
|
|
93360
|
+
// "create_time": 1701229157,
|
|
93361
|
+
// "deal_amount": "0",
|
|
93362
|
+
// "deal_fee": "0",
|
|
93363
|
+
// "deal_money": "0",
|
|
93364
|
+
// "fee_asset": null,
|
|
93365
|
+
// "fee_discount": "1",
|
|
93366
|
+
// "finished_time": null,
|
|
93367
|
+
// "id": 107745856676,
|
|
93368
|
+
// "left": "0.0005",
|
|
93369
|
+
// "maker_fee_rate": "0.002",
|
|
93370
|
+
// "market": "BTCUSDT",
|
|
93371
|
+
// "money_fee": "0",
|
|
93372
|
+
// "order_type": "limit",
|
|
93373
|
+
// "price": "23000",
|
|
93374
|
+
// "source_id": "",
|
|
93375
|
+
// "status": "not_deal",
|
|
93376
|
+
// "stock_fee": "0",
|
|
93377
|
+
// "taker_fee_rate": "0.002",
|
|
93378
|
+
// "type": "buy"
|
|
93379
|
+
// },
|
|
93380
|
+
// "message": "OK"
|
|
93381
|
+
// },
|
|
93382
|
+
// ],
|
|
93383
|
+
// "message": "Success"
|
|
93384
|
+
// }
|
|
93385
|
+
//
|
|
93386
|
+
const data = this.safeValue(response, 'data', []);
|
|
93387
|
+
const results = [];
|
|
93388
|
+
for (let i = 0; i < data.length; i++) {
|
|
93389
|
+
const entry = data[i];
|
|
93390
|
+
let status = undefined;
|
|
93391
|
+
const code = this.safeInteger(entry, 'code');
|
|
93392
|
+
if (code !== undefined) {
|
|
93393
|
+
if (code !== 0) {
|
|
93394
|
+
status = 'rejected';
|
|
93395
|
+
}
|
|
93396
|
+
else {
|
|
93397
|
+
status = 'open';
|
|
93398
|
+
}
|
|
93399
|
+
}
|
|
93400
|
+
const item = this.safeValue(entry, 'data', {});
|
|
93401
|
+
item['status'] = status;
|
|
93402
|
+
const order = this.parseOrder(item, market);
|
|
93403
|
+
results.push(order);
|
|
93404
|
+
}
|
|
93405
|
+
return results;
|
|
93406
|
+
}
|
|
93407
|
+
async cancelOrders(ids, symbol = undefined, params = {}) {
|
|
93408
|
+
/**
|
|
93409
|
+
* @method
|
|
93410
|
+
* @name coinex#cancelOrders
|
|
93411
|
+
* @description cancel multiple orders
|
|
93412
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade016_batch_cancel_order
|
|
93413
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http021-0_cancel_order_batch
|
|
93414
|
+
* @param {string[]} ids order ids
|
|
93415
|
+
* @param {string} symbol unified market symbol
|
|
93416
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
93417
|
+
* @returns {object} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
93418
|
+
*/
|
|
93419
|
+
if (symbol === undefined) {
|
|
93420
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' cancelOrders() requires a symbol argument');
|
|
93421
|
+
}
|
|
93422
|
+
await this.loadMarkets();
|
|
93423
|
+
const market = this.market(symbol);
|
|
93424
|
+
const request = {
|
|
93425
|
+
'market': market['id'],
|
|
93426
|
+
};
|
|
93427
|
+
const idsString = ids.join(',');
|
|
93428
|
+
let response = undefined;
|
|
93429
|
+
if (market['spot']) {
|
|
93430
|
+
request['batch_ids'] = idsString;
|
|
93431
|
+
response = await this.privateDeleteOrderPendingBatch(this.extend(request, params));
|
|
93432
|
+
}
|
|
93433
|
+
else {
|
|
93434
|
+
request['order_ids'] = idsString;
|
|
93435
|
+
response = await this.perpetualPrivatePostOrderCancelBatch(this.extend(request, params));
|
|
93436
|
+
}
|
|
93437
|
+
//
|
|
93438
|
+
// spot
|
|
93439
|
+
//
|
|
93440
|
+
// {
|
|
93441
|
+
// "code": 0,
|
|
93442
|
+
// "data": [
|
|
93443
|
+
// {
|
|
93444
|
+
// "code": 0,
|
|
93445
|
+
// "data": {
|
|
93446
|
+
// "account_id": 0,
|
|
93447
|
+
// "amount": "0.0005",
|
|
93448
|
+
// "asset_fee": "0",
|
|
93449
|
+
// "avg_price": "0.00",
|
|
93450
|
+
// "client_id": "x-167673045-d4e03c38f4d19b4e",
|
|
93451
|
+
// "create_time": 1701229157,
|
|
93452
|
+
// "deal_amount": "0",
|
|
93453
|
+
// "deal_fee": "0",
|
|
93454
|
+
// "deal_money": "0",
|
|
93455
|
+
// "fee_asset": null,
|
|
93456
|
+
// "fee_discount": "1",
|
|
93457
|
+
// "finished_time": 0,
|
|
93458
|
+
// "id": 107745856682,
|
|
93459
|
+
// "left": "0",
|
|
93460
|
+
// "maker_fee_rate": "0.002",
|
|
93461
|
+
// "market": "BTCUSDT",
|
|
93462
|
+
// "money_fee": "0",
|
|
93463
|
+
// "order_type": "limit",
|
|
93464
|
+
// "price": "22000",
|
|
93465
|
+
// "status": "not_deal",
|
|
93466
|
+
// "stock_fee": "0",
|
|
93467
|
+
// "taker_fee_rate": "0.002",
|
|
93468
|
+
// "type": "buy"
|
|
93469
|
+
// },
|
|
93470
|
+
// "message": ""
|
|
93471
|
+
// },
|
|
93472
|
+
// ],
|
|
93473
|
+
// "message": "Success"
|
|
93474
|
+
// }
|
|
93475
|
+
//
|
|
93476
|
+
// swap
|
|
93477
|
+
//
|
|
93478
|
+
// {
|
|
93479
|
+
// "code": 0,
|
|
93480
|
+
// "data": [
|
|
93481
|
+
// {
|
|
93482
|
+
// "code": 0,
|
|
93483
|
+
// "message": "",
|
|
93484
|
+
// "order": {
|
|
93485
|
+
// "amount": "0.0005",
|
|
93486
|
+
// "client_id": "x-167673045-b0cee0c584718b65",
|
|
93487
|
+
// "create_time": 1701233683.294231,
|
|
93488
|
+
// "deal_asset_fee": "0.00000000000000000000",
|
|
93489
|
+
// "deal_fee": "0.00000000000000000000",
|
|
93490
|
+
// "deal_profit": "0.00000000000000000000",
|
|
93491
|
+
// "deal_stock": "0.00000000000000000000",
|
|
93492
|
+
// "effect_type": 1,
|
|
93493
|
+
// "fee_asset": "",
|
|
93494
|
+
// "fee_discount": "0.00000000000000000000",
|
|
93495
|
+
// "last_deal_amount": "0.00000000000000000000",
|
|
93496
|
+
// "last_deal_id": 0,
|
|
93497
|
+
// "last_deal_price": "0.00000000000000000000",
|
|
93498
|
+
// "last_deal_role": 0,
|
|
93499
|
+
// "last_deal_time": 0,
|
|
93500
|
+
// "last_deal_type": 0,
|
|
93501
|
+
// "left": "0.0005",
|
|
93502
|
+
// "leverage": "3",
|
|
93503
|
+
// "maker_fee": "0.00030",
|
|
93504
|
+
// "market": "BTCUSDT",
|
|
93505
|
+
// "option": 0,
|
|
93506
|
+
// "order_id": 115940476323,
|
|
93507
|
+
// "position_id": 0,
|
|
93508
|
+
// "position_type": 2,
|
|
93509
|
+
// "price": "25000.00",
|
|
93510
|
+
// "side": 2,
|
|
93511
|
+
// "source": "api.v1",
|
|
93512
|
+
// "stop_id": 0,
|
|
93513
|
+
// "stop_loss_price": "0.00000000000000000000",
|
|
93514
|
+
// "stop_loss_type": 0,
|
|
93515
|
+
// "take_profit_price": "0.00000000000000000000",
|
|
93516
|
+
// "take_profit_type": 0,
|
|
93517
|
+
// "taker_fee": "0.00050",
|
|
93518
|
+
// "target": 0,
|
|
93519
|
+
// "type": 1,
|
|
93520
|
+
// "update_time": 1701233721.718884,
|
|
93521
|
+
// "user_id": 3620173
|
|
93522
|
+
// }
|
|
93523
|
+
// },
|
|
93524
|
+
// ],
|
|
93525
|
+
// "message": "OK"
|
|
93526
|
+
// }
|
|
93527
|
+
//
|
|
93528
|
+
const data = this.safeValue(response, 'data', []);
|
|
93529
|
+
const results = [];
|
|
93530
|
+
for (let i = 0; i < data.length; i++) {
|
|
93531
|
+
const entry = data[i];
|
|
93532
|
+
const dataRequest = market['spot'] ? 'data' : 'order';
|
|
93533
|
+
const item = this.safeValue(entry, dataRequest, {});
|
|
93534
|
+
const order = this.parseOrder(item, market);
|
|
93535
|
+
results.push(order);
|
|
93536
|
+
}
|
|
93537
|
+
return results;
|
|
93538
|
+
}
|
|
93210
93539
|
async editOrder(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
|
|
93211
93540
|
/**
|
|
93212
93541
|
* @method
|
|
@@ -123644,11 +123973,16 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
123644
123973
|
if (limit !== undefined) {
|
|
123645
123974
|
request['limit'] = limit;
|
|
123646
123975
|
}
|
|
123647
|
-
|
|
123648
|
-
|
|
123649
|
-
|
|
123650
|
-
}
|
|
123651
|
-
|
|
123976
|
+
let response = undefined;
|
|
123977
|
+
if (type === 'swap') {
|
|
123978
|
+
response = await this.privateFuturesGetSettleAccountBook(this.extend(request, requestParams));
|
|
123979
|
+
}
|
|
123980
|
+
else if (type === 'future') {
|
|
123981
|
+
response = await this.privateDeliveryGetSettleAccountBook(this.extend(request, requestParams));
|
|
123982
|
+
}
|
|
123983
|
+
else {
|
|
123984
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchFundingHistory() only support swap & future market type');
|
|
123985
|
+
}
|
|
123652
123986
|
//
|
|
123653
123987
|
// [
|
|
123654
123988
|
// {
|
|
@@ -123721,18 +124055,26 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
123721
124055
|
// };
|
|
123722
124056
|
//
|
|
123723
124057
|
const [request, query] = this.prepareRequest(market, market['type'], params);
|
|
123724
|
-
const method = this.getSupportedMapping(market['type'], {
|
|
123725
|
-
'spot': 'publicSpotGetOrderBook',
|
|
123726
|
-
'margin': 'publicSpotGetOrderBook',
|
|
123727
|
-
'swap': 'publicFuturesGetSettleOrderBook',
|
|
123728
|
-
'future': 'publicDeliveryGetSettleOrderBook',
|
|
123729
|
-
'option': 'publicOptionsGetOrderBook',
|
|
123730
|
-
});
|
|
123731
124058
|
if (limit !== undefined) {
|
|
123732
124059
|
request['limit'] = limit; // default 10, max 100
|
|
123733
124060
|
}
|
|
123734
124061
|
request['with_id'] = true;
|
|
123735
|
-
|
|
124062
|
+
let response = undefined;
|
|
124063
|
+
if (market['spot'] || market['margin']) {
|
|
124064
|
+
response = await this.publicSpotGetOrderBook(this.extend(request, query));
|
|
124065
|
+
}
|
|
124066
|
+
else if (market['swap']) {
|
|
124067
|
+
response = await this.publicFuturesGetSettleOrderBook(this.extend(request, query));
|
|
124068
|
+
}
|
|
124069
|
+
else if (market['future']) {
|
|
124070
|
+
response = await this.publicDeliveryGetSettleOrderBook(this.extend(request, query));
|
|
124071
|
+
}
|
|
124072
|
+
else if (market['option']) {
|
|
124073
|
+
response = await this.publicOptionsGetOrderBook(this.extend(request, query));
|
|
124074
|
+
}
|
|
124075
|
+
else {
|
|
124076
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchOrderBook() not support this market type');
|
|
124077
|
+
}
|
|
123736
124078
|
//
|
|
123737
124079
|
// spot
|
|
123738
124080
|
//
|
|
@@ -123824,19 +124166,25 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
123824
124166
|
await this.loadMarkets();
|
|
123825
124167
|
const market = this.market(symbol);
|
|
123826
124168
|
const [request, query] = this.prepareRequest(market, undefined, params);
|
|
123827
|
-
|
|
123828
|
-
|
|
123829
|
-
|
|
123830
|
-
|
|
123831
|
-
|
|
123832
|
-
|
|
123833
|
-
}
|
|
123834
|
-
if (market['
|
|
124169
|
+
let response = undefined;
|
|
124170
|
+
if (market['spot'] || market['margin']) {
|
|
124171
|
+
response = await this.publicSpotGetTickers(this.extend(request, query));
|
|
124172
|
+
}
|
|
124173
|
+
else if (market['swap']) {
|
|
124174
|
+
response = await this.publicFuturesGetSettleTickers(this.extend(request, query));
|
|
124175
|
+
}
|
|
124176
|
+
else if (market['future']) {
|
|
124177
|
+
response = await this.publicDeliveryGetSettleTickers(this.extend(request, query));
|
|
124178
|
+
}
|
|
124179
|
+
else if (market['option']) {
|
|
123835
124180
|
const marketId = market['id'];
|
|
123836
124181
|
const optionParts = marketId.split('-');
|
|
123837
124182
|
request['underlying'] = this.safeString(optionParts, 0);
|
|
124183
|
+
response = await this.publicOptionsGetTickers(this.extend(request, query));
|
|
124184
|
+
}
|
|
124185
|
+
else {
|
|
124186
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchTicker() not support this market type');
|
|
123838
124187
|
}
|
|
123839
|
-
const response = await this[method](this.extend(request, query));
|
|
123840
124188
|
let ticker = undefined;
|
|
123841
124189
|
if (market['option']) {
|
|
123842
124190
|
for (let i = 0; i < response.length; i++) {
|
|
@@ -123986,20 +124334,26 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
123986
124334
|
}
|
|
123987
124335
|
const [type, query] = this.handleMarketTypeAndParams('fetchTickers', market, params);
|
|
123988
124336
|
const [request, requestParams] = this.prepareRequest(undefined, type, query);
|
|
123989
|
-
|
|
123990
|
-
|
|
123991
|
-
|
|
123992
|
-
|
|
123993
|
-
|
|
123994
|
-
|
|
123995
|
-
}
|
|
123996
|
-
if (type === '
|
|
124337
|
+
let response = undefined;
|
|
124338
|
+
if (type === 'spot' || type === 'margin') {
|
|
124339
|
+
response = await this.publicSpotGetTickers(this.extend(request, requestParams));
|
|
124340
|
+
}
|
|
124341
|
+
else if (type === 'swap') {
|
|
124342
|
+
response = await this.publicFuturesGetSettleTickers(this.extend(request, requestParams));
|
|
124343
|
+
}
|
|
124344
|
+
else if (type === 'future') {
|
|
124345
|
+
response = await this.publicDeliveryGetSettleTickers(this.extend(request, requestParams));
|
|
124346
|
+
}
|
|
124347
|
+
else if (type === 'option') {
|
|
123997
124348
|
this.checkRequiredArgument('fetchTickers', symbols, 'symbols');
|
|
123998
124349
|
const marketId = market['id'];
|
|
123999
124350
|
const optionParts = marketId.split('-');
|
|
124000
124351
|
request['underlying'] = this.safeString(optionParts, 0);
|
|
124352
|
+
response = await this.publicOptionsGetTickers(this.extend(request, requestParams));
|
|
124353
|
+
}
|
|
124354
|
+
else {
|
|
124355
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchTickers() not support this market type');
|
|
124001
124356
|
}
|
|
124002
|
-
const response = await this[method](this.extend(request, requestParams));
|
|
124003
124357
|
return this.parseTickers(response, symbols);
|
|
124004
124358
|
}
|
|
124005
124359
|
parseBalanceHelper(entry) {
|
|
@@ -124030,18 +124384,36 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
124030
124384
|
const market = this.market(symbol);
|
|
124031
124385
|
request['currency_pair'] = market['id'];
|
|
124032
124386
|
}
|
|
124033
|
-
|
|
124034
|
-
|
|
124035
|
-
|
|
124036
|
-
|
|
124037
|
-
|
|
124038
|
-
|
|
124039
|
-
|
|
124040
|
-
|
|
124041
|
-
'
|
|
124042
|
-
|
|
124043
|
-
|
|
124044
|
-
|
|
124387
|
+
let response = undefined;
|
|
124388
|
+
if (type === 'spot') {
|
|
124389
|
+
if (marginMode === 'spot') {
|
|
124390
|
+
response = await this.privateSpotGetAccounts(this.extend(request, requestQuery));
|
|
124391
|
+
}
|
|
124392
|
+
else if (marginMode === 'margin') {
|
|
124393
|
+
response = await this.privateMarginGetAccounts(this.extend(request, requestQuery));
|
|
124394
|
+
}
|
|
124395
|
+
else if (marginMode === 'cross_margin') {
|
|
124396
|
+
response = await this.privateMarginGetCrossAccounts(this.extend(request, requestQuery));
|
|
124397
|
+
}
|
|
124398
|
+
else {
|
|
124399
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchBalance() not support this marginMode');
|
|
124400
|
+
}
|
|
124401
|
+
}
|
|
124402
|
+
else if (type === 'funding') {
|
|
124403
|
+
response = await this.privateMarginGetFundingAccounts(this.extend(request, requestQuery));
|
|
124404
|
+
}
|
|
124405
|
+
else if (type === 'swap') {
|
|
124406
|
+
response = await this.privateFuturesGetSettleAccounts(this.extend(request, requestQuery));
|
|
124407
|
+
}
|
|
124408
|
+
else if (type === 'future') {
|
|
124409
|
+
response = await this.privateDeliveryGetSettleAccounts(this.extend(request, requestQuery));
|
|
124410
|
+
}
|
|
124411
|
+
else if (type === 'option') {
|
|
124412
|
+
response = await this.privateOptionsGetAccounts(this.extend(request, requestQuery));
|
|
124413
|
+
}
|
|
124414
|
+
else {
|
|
124415
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchBalance() not support this market type');
|
|
124416
|
+
}
|
|
124045
124417
|
const contract = ((type === 'swap') || (type === 'future') || (type === 'option'));
|
|
124046
124418
|
if (contract) {
|
|
124047
124419
|
response = [response];
|
|
@@ -124261,23 +124633,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
124261
124633
|
let request = {};
|
|
124262
124634
|
[request, params] = this.prepareRequest(market, undefined, params);
|
|
124263
124635
|
request['interval'] = this.safeString(this.timeframes, timeframe, timeframe);
|
|
124264
|
-
let method = 'publicSpotGetCandlesticks';
|
|
124265
124636
|
let maxLimit = 1000;
|
|
124266
|
-
if (market['contract']) {
|
|
124267
|
-
maxLimit = 1999;
|
|
124268
|
-
if (market['future']) {
|
|
124269
|
-
method = 'publicDeliveryGetSettleCandlesticks';
|
|
124270
|
-
}
|
|
124271
|
-
else if (market['swap']) {
|
|
124272
|
-
method = 'publicFuturesGetSettleCandlesticks';
|
|
124273
|
-
}
|
|
124274
|
-
const isMark = (price === 'mark');
|
|
124275
|
-
const isIndex = (price === 'index');
|
|
124276
|
-
if (isMark || isIndex) {
|
|
124277
|
-
request['contract'] = price + '_' + market['id'];
|
|
124278
|
-
params = this.omit(params, 'price');
|
|
124279
|
-
}
|
|
124280
|
-
}
|
|
124281
124637
|
limit = (limit === undefined) ? maxLimit : Math.min(limit, maxLimit);
|
|
124282
124638
|
let until = this.safeInteger(params, 'until');
|
|
124283
124639
|
if (until !== undefined) {
|
|
@@ -124304,7 +124660,25 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
124304
124660
|
}
|
|
124305
124661
|
request['limit'] = limit;
|
|
124306
124662
|
}
|
|
124307
|
-
|
|
124663
|
+
let response = undefined;
|
|
124664
|
+
if (market['contract']) {
|
|
124665
|
+
maxLimit = 1999;
|
|
124666
|
+
const isMark = (price === 'mark');
|
|
124667
|
+
const isIndex = (price === 'index');
|
|
124668
|
+
if (isMark || isIndex) {
|
|
124669
|
+
request['contract'] = price + '_' + market['id'];
|
|
124670
|
+
params = this.omit(params, 'price');
|
|
124671
|
+
}
|
|
124672
|
+
if (market['future']) {
|
|
124673
|
+
response = await this.publicDeliveryGetSettleCandlesticks(this.extend(request, params));
|
|
124674
|
+
}
|
|
124675
|
+
else if (market['swap']) {
|
|
124676
|
+
response = await this.publicFuturesGetSettleCandlesticks(this.extend(request, params));
|
|
124677
|
+
}
|
|
124678
|
+
}
|
|
124679
|
+
else {
|
|
124680
|
+
response = await this.publicSpotGetCandlesticks(this.extend(request, params));
|
|
124681
|
+
}
|
|
124308
124682
|
return this.parseOHLCVs(response, market, timeframe, since, limit);
|
|
124309
124683
|
}
|
|
124310
124684
|
async fetchOptionOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
|
|
@@ -124341,8 +124715,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
124341
124715
|
if (limit !== undefined) {
|
|
124342
124716
|
request['limit'] = limit;
|
|
124343
124717
|
}
|
|
124344
|
-
const
|
|
124345
|
-
const response = await this[method](this.extend(request, query));
|
|
124718
|
+
const response = await this.publicFuturesGetSettleFundingRate(this.extend(request, query));
|
|
124346
124719
|
//
|
|
124347
124720
|
// {
|
|
124348
124721
|
// "r": "0.00063521",
|
|
@@ -124457,13 +124830,6 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
124457
124830
|
// };
|
|
124458
124831
|
//
|
|
124459
124832
|
const [request, query] = this.prepareRequest(market, undefined, params);
|
|
124460
|
-
const method = this.getSupportedMapping(market['type'], {
|
|
124461
|
-
'spot': 'publicSpotGetTrades',
|
|
124462
|
-
'margin': 'publicSpotGetTrades',
|
|
124463
|
-
'swap': 'publicFuturesGetSettleTrades',
|
|
124464
|
-
'future': 'publicDeliveryGetSettleTrades',
|
|
124465
|
-
'option': 'publicOptionsGetTrades',
|
|
124466
|
-
});
|
|
124467
124833
|
const until = this.safeInteger2(params, 'to', 'until');
|
|
124468
124834
|
if (until !== undefined) {
|
|
124469
124835
|
params = this.omit(params, ['until']);
|
|
@@ -124475,7 +124841,22 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
124475
124841
|
if (since !== undefined && (market['contract'])) {
|
|
124476
124842
|
request['from'] = this.parseToInt(since / 1000);
|
|
124477
124843
|
}
|
|
124478
|
-
|
|
124844
|
+
let response = undefined;
|
|
124845
|
+
if (market['type'] === 'spot' || market['type'] === 'margin') {
|
|
124846
|
+
response = await this.publicSpotGetTrades(this.extend(request, query));
|
|
124847
|
+
}
|
|
124848
|
+
else if (market['swap']) {
|
|
124849
|
+
response = await this.publicFuturesGetSettleTrades(this.extend(request, query));
|
|
124850
|
+
}
|
|
124851
|
+
else if (market['future']) {
|
|
124852
|
+
response = await this.publicDeliveryGetSettleTrades(this.extend(request, query));
|
|
124853
|
+
}
|
|
124854
|
+
else if (market['type'] === 'option') {
|
|
124855
|
+
response = await this.publicOptionsGetTrades(this.extend(request, query));
|
|
124856
|
+
}
|
|
124857
|
+
else {
|
|
124858
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchTrades() not support this market type.');
|
|
124859
|
+
}
|
|
124479
124860
|
//
|
|
124480
124861
|
// spot
|
|
124481
124862
|
//
|
|
@@ -124621,14 +125002,22 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
124621
125002
|
if (until !== undefined) {
|
|
124622
125003
|
request['to'] = this.parseToInt(until / 1000);
|
|
124623
125004
|
}
|
|
124624
|
-
|
|
124625
|
-
|
|
124626
|
-
|
|
124627
|
-
|
|
124628
|
-
|
|
124629
|
-
|
|
124630
|
-
}
|
|
124631
|
-
|
|
125005
|
+
let response = undefined;
|
|
125006
|
+
if (type === 'spot' || type === 'margin') {
|
|
125007
|
+
response = await this.privateSpotGetMyTrades(this.extend(request, params));
|
|
125008
|
+
}
|
|
125009
|
+
else if (type === 'swap') {
|
|
125010
|
+
response = await this.privateFuturesGetSettleMyTradesTimerange(this.extend(request, params));
|
|
125011
|
+
}
|
|
125012
|
+
else if (type === 'future') {
|
|
125013
|
+
response = await this.privateDeliveryGetSettleMyTrades(this.extend(request, params));
|
|
125014
|
+
}
|
|
125015
|
+
else if (type === 'option') {
|
|
125016
|
+
response = await this.privateOptionsGetMyTrades(this.extend(request, params));
|
|
125017
|
+
}
|
|
125018
|
+
else {
|
|
125019
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchMyTrades() not support this market type.');
|
|
125020
|
+
}
|
|
124632
125021
|
//
|
|
124633
125022
|
// spot
|
|
124634
125023
|
//
|
|
@@ -125879,15 +126268,37 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
125879
126268
|
const contract = (type === 'swap') || (type === 'future') || (type === 'option');
|
|
125880
126269
|
const [request, requestParams] = contract ? this.prepareRequest(market, type, query) : this.spotOrderPrepareRequest(market, stop, query);
|
|
125881
126270
|
request['order_id'] = orderId;
|
|
125882
|
-
|
|
125883
|
-
|
|
125884
|
-
|
|
125885
|
-
|
|
125886
|
-
|
|
125887
|
-
|
|
125888
|
-
|
|
125889
|
-
|
|
125890
|
-
|
|
126271
|
+
let response = undefined;
|
|
126272
|
+
if (type === 'spot' || type === 'margin') {
|
|
126273
|
+
if (stop) {
|
|
126274
|
+
response = await this.privateSpotGetPriceOrdersOrderId(this.extend(request, requestParams));
|
|
126275
|
+
}
|
|
126276
|
+
else {
|
|
126277
|
+
response = await this.privateSpotGetOrdersOrderId(this.extend(request, requestParams));
|
|
126278
|
+
}
|
|
126279
|
+
}
|
|
126280
|
+
else if (type === 'swap') {
|
|
126281
|
+
if (stop) {
|
|
126282
|
+
response = await this.privateFuturesGetSettlePriceOrdersOrderId(this.extend(request, requestParams));
|
|
126283
|
+
}
|
|
126284
|
+
else {
|
|
126285
|
+
response = await this.privateFuturesGetSettleOrdersOrderId(this.extend(request, requestParams));
|
|
126286
|
+
}
|
|
126287
|
+
}
|
|
126288
|
+
else if (type === 'future') {
|
|
126289
|
+
if (stop) {
|
|
126290
|
+
response = await this.privateDeliveryGetSettlePriceOrdersOrderId(this.extend(request, requestParams));
|
|
126291
|
+
}
|
|
126292
|
+
else {
|
|
126293
|
+
response = await this.privateDeliveryGetSettleOrdersOrderId(this.extend(request, requestParams));
|
|
126294
|
+
}
|
|
126295
|
+
}
|
|
126296
|
+
else if (type === 'option') {
|
|
126297
|
+
response = await this.privateOptionsGetOrdersOrderId(this.extend(request, requestParams));
|
|
126298
|
+
}
|
|
126299
|
+
else {
|
|
126300
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchOrder() not support this market type');
|
|
126301
|
+
}
|
|
125891
126302
|
return this.parseOrder(response, market);
|
|
125892
126303
|
}
|
|
125893
126304
|
async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
@@ -125952,19 +126363,41 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
125952
126363
|
if (since !== undefined && spot) {
|
|
125953
126364
|
request['from'] = this.parseToInt(since / 1000);
|
|
125954
126365
|
}
|
|
125955
|
-
let methodTail = stop ? 'PriceOrders' : 'Orders';
|
|
125956
126366
|
const openSpotOrders = spot && (status === 'open') && !stop;
|
|
125957
|
-
|
|
125958
|
-
|
|
126367
|
+
let response = undefined;
|
|
126368
|
+
if (type === 'spot' || type === 'margin') {
|
|
126369
|
+
if (openSpotOrders) {
|
|
126370
|
+
response = await this.privateSpotGetOpenOrders(this.extend(request, requestParams));
|
|
126371
|
+
}
|
|
126372
|
+
else if (stop) {
|
|
126373
|
+
response = await this.privateSpotGetPriceOrders(this.extend(request, requestParams));
|
|
126374
|
+
}
|
|
126375
|
+
else {
|
|
126376
|
+
response = await this.privateSpotGetOrders(this.extend(request, requestParams));
|
|
126377
|
+
}
|
|
126378
|
+
}
|
|
126379
|
+
else if (type === 'swap') {
|
|
126380
|
+
if (stop) {
|
|
126381
|
+
response = await this.privateFuturesGetSettlePriceOrders(this.extend(request, requestParams));
|
|
126382
|
+
}
|
|
126383
|
+
else {
|
|
126384
|
+
response = await this.privateFuturesGetSettleOrders(this.extend(request, requestParams));
|
|
126385
|
+
}
|
|
126386
|
+
}
|
|
126387
|
+
else if (type === 'future') {
|
|
126388
|
+
if (stop) {
|
|
126389
|
+
response = await this.privateDeliveryGetSettlePriceOrders(this.extend(request, requestParams));
|
|
126390
|
+
}
|
|
126391
|
+
else {
|
|
126392
|
+
response = await this.privateDeliveryGetSettleOrders(this.extend(request, requestParams));
|
|
126393
|
+
}
|
|
126394
|
+
}
|
|
126395
|
+
else if (type === 'option') {
|
|
126396
|
+
response = await this.privateOptionsGetOrders(this.extend(request, requestParams));
|
|
126397
|
+
}
|
|
126398
|
+
else {
|
|
126399
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchOrders() not support this market type');
|
|
125959
126400
|
}
|
|
125960
|
-
const method = this.getSupportedMapping(type, {
|
|
125961
|
-
'spot': 'privateSpotGet' + methodTail,
|
|
125962
|
-
'margin': 'privateSpotGet' + methodTail,
|
|
125963
|
-
'swap': 'privateFuturesGetSettle' + methodTail,
|
|
125964
|
-
'future': 'privateDeliveryGetSettle' + methodTail,
|
|
125965
|
-
'option': 'privateOptionsGetOrders',
|
|
125966
|
-
});
|
|
125967
|
-
const response = await this[method](this.extend(request, requestParams));
|
|
125968
126401
|
//
|
|
125969
126402
|
// spot open orders
|
|
125970
126403
|
//
|
|
@@ -126144,15 +126577,37 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
126144
126577
|
const [type, query] = this.handleMarketTypeAndParams('cancelOrder', market, params);
|
|
126145
126578
|
const [request, requestParams] = (type === 'spot' || type === 'margin') ? this.spotOrderPrepareRequest(market, stop, query) : this.prepareRequest(market, type, query);
|
|
126146
126579
|
request['order_id'] = id;
|
|
126147
|
-
|
|
126148
|
-
|
|
126149
|
-
|
|
126150
|
-
|
|
126151
|
-
|
|
126152
|
-
|
|
126153
|
-
|
|
126154
|
-
|
|
126155
|
-
|
|
126580
|
+
let response = undefined;
|
|
126581
|
+
if (type === 'spot' || type === 'margin') {
|
|
126582
|
+
if (stop) {
|
|
126583
|
+
response = await this.privateSpotDeletePriceOrdersOrderId(this.extend(request, requestParams));
|
|
126584
|
+
}
|
|
126585
|
+
else {
|
|
126586
|
+
response = await this.privateSpotDeleteOrdersOrderId(this.extend(request, requestParams));
|
|
126587
|
+
}
|
|
126588
|
+
}
|
|
126589
|
+
else if (type === 'swap') {
|
|
126590
|
+
if (stop) {
|
|
126591
|
+
response = await this.privateFuturesDeleteSettlePriceOrdersOrderId(this.extend(request, requestParams));
|
|
126592
|
+
}
|
|
126593
|
+
else {
|
|
126594
|
+
response = await this.privateFuturesDeleteSettleOrdersOrderId(this.extend(request, requestParams));
|
|
126595
|
+
}
|
|
126596
|
+
}
|
|
126597
|
+
else if (type === 'future') {
|
|
126598
|
+
if (stop) {
|
|
126599
|
+
response = await this.privateDeliveryDeleteSettlePriceOrdersOrderId(this.extend(request, requestParams));
|
|
126600
|
+
}
|
|
126601
|
+
else {
|
|
126602
|
+
response = await this.privateDeliveryDeleteSettleOrdersOrderId(this.extend(request, requestParams));
|
|
126603
|
+
}
|
|
126604
|
+
}
|
|
126605
|
+
else if (type === 'option') {
|
|
126606
|
+
response = await this.privateOptionsDeleteOrdersOrderId(this.extend(request, requestParams));
|
|
126607
|
+
}
|
|
126608
|
+
else {
|
|
126609
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' cancelOrder() not support this market type');
|
|
126610
|
+
}
|
|
126156
126611
|
//
|
|
126157
126612
|
// spot
|
|
126158
126613
|
//
|
|
@@ -126255,15 +126710,37 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
126255
126710
|
params = this.omit(params, 'stop');
|
|
126256
126711
|
const [type, query] = this.handleMarketTypeAndParams('cancelAllOrders', market, params);
|
|
126257
126712
|
const [request, requestParams] = (type === 'spot') ? this.multiOrderSpotPrepareRequest(market, stop, query) : this.prepareRequest(market, type, query);
|
|
126258
|
-
|
|
126259
|
-
|
|
126260
|
-
|
|
126261
|
-
|
|
126262
|
-
|
|
126263
|
-
|
|
126264
|
-
|
|
126265
|
-
|
|
126266
|
-
|
|
126713
|
+
let response = undefined;
|
|
126714
|
+
if (type === 'spot' || type === 'margin') {
|
|
126715
|
+
if (stop) {
|
|
126716
|
+
response = await this.privateSpotDeletePriceOrders(this.extend(request, requestParams));
|
|
126717
|
+
}
|
|
126718
|
+
else {
|
|
126719
|
+
response = await this.privateSpotDeleteOrders(this.extend(request, requestParams));
|
|
126720
|
+
}
|
|
126721
|
+
}
|
|
126722
|
+
else if (type === 'swap') {
|
|
126723
|
+
if (stop) {
|
|
126724
|
+
response = await this.privateFuturesDeleteSettlePriceOrders(this.extend(request, requestParams));
|
|
126725
|
+
}
|
|
126726
|
+
else {
|
|
126727
|
+
response = await this.privateFuturesDeleteSettleOrders(this.extend(request, requestParams));
|
|
126728
|
+
}
|
|
126729
|
+
}
|
|
126730
|
+
else if (type === 'future') {
|
|
126731
|
+
if (stop) {
|
|
126732
|
+
response = await this.privateDeliveryDeleteSettlePriceOrders(this.extend(request, requestParams));
|
|
126733
|
+
}
|
|
126734
|
+
else {
|
|
126735
|
+
response = await this.privateDeliveryDeleteSettleOrders(this.extend(request, requestParams));
|
|
126736
|
+
}
|
|
126737
|
+
}
|
|
126738
|
+
else if (type === 'option') {
|
|
126739
|
+
response = await this.privateOptionsDeleteOrders(this.extend(request, requestParams));
|
|
126740
|
+
}
|
|
126741
|
+
else {
|
|
126742
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' cancelAllOrders() not support this market type');
|
|
126743
|
+
}
|
|
126267
126744
|
//
|
|
126268
126745
|
// [
|
|
126269
126746
|
// {
|
|
@@ -126393,10 +126870,6 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
126393
126870
|
}
|
|
126394
126871
|
await this.loadMarkets();
|
|
126395
126872
|
const market = this.market(symbol);
|
|
126396
|
-
const method = this.getSupportedMapping(market['type'], {
|
|
126397
|
-
'swap': 'privateFuturesPostSettlePositionsContractLeverage',
|
|
126398
|
-
'future': 'privateDeliveryPostSettlePositionsContractLeverage',
|
|
126399
|
-
});
|
|
126400
126873
|
const [request, query] = this.prepareRequest(market, undefined, params);
|
|
126401
126874
|
const defaultMarginMode = this.safeString2(this.options, 'marginMode', 'defaultMarginMode');
|
|
126402
126875
|
const crossLeverageLimit = this.safeString(query, 'cross_leverage_limit');
|
|
@@ -126412,7 +126885,16 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
126412
126885
|
else {
|
|
126413
126886
|
request['leverage'] = leverage.toString();
|
|
126414
126887
|
}
|
|
126415
|
-
|
|
126888
|
+
let response = undefined;
|
|
126889
|
+
if (market['swap']) {
|
|
126890
|
+
response = await this.privateFuturesPostSettlePositionsContractLeverage(this.extend(request, query));
|
|
126891
|
+
}
|
|
126892
|
+
else if (market['future']) {
|
|
126893
|
+
response = await this.privateDeliveryPostSettlePositionsContractLeverage(this.extend(request, query));
|
|
126894
|
+
}
|
|
126895
|
+
else {
|
|
126896
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' setLeverage() not support this market type');
|
|
126897
|
+
}
|
|
126416
126898
|
//
|
|
126417
126899
|
// {
|
|
126418
126900
|
// "value": "0",
|
|
@@ -126573,10 +127055,10 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
126573
127055
|
[request, params] = this.prepareRequest(market, market['type'], params);
|
|
126574
127056
|
const extendedRequest = this.extend(request, params);
|
|
126575
127057
|
let response = undefined;
|
|
126576
|
-
if (market['
|
|
127058
|
+
if (market['swap']) {
|
|
126577
127059
|
response = await this.privateFuturesGetSettlePositionsContract(extendedRequest);
|
|
126578
127060
|
}
|
|
126579
|
-
else if (market['
|
|
127061
|
+
else if (market['future']) {
|
|
126580
127062
|
response = await this.privateDeliveryGetSettlePositionsContract(extendedRequest);
|
|
126581
127063
|
}
|
|
126582
127064
|
else if (market['type'] === 'option') {
|
|
@@ -126756,11 +127238,16 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
126756
127238
|
if (type !== 'future' && type !== 'swap') {
|
|
126757
127239
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest(this.id + ' fetchLeverageTiers only supports swap and future');
|
|
126758
127240
|
}
|
|
126759
|
-
|
|
126760
|
-
|
|
126761
|
-
|
|
126762
|
-
}
|
|
126763
|
-
|
|
127241
|
+
let response = undefined;
|
|
127242
|
+
if (type === 'swap') {
|
|
127243
|
+
response = await this.publicFuturesGetSettleContracts(this.extend(request, requestParams));
|
|
127244
|
+
}
|
|
127245
|
+
else if (type === 'future') {
|
|
127246
|
+
response = await this.publicDeliveryGetSettleContracts(this.extend(request, requestParams));
|
|
127247
|
+
}
|
|
127248
|
+
else {
|
|
127249
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchLeverageTiers() not support this market type');
|
|
127250
|
+
}
|
|
126764
127251
|
//
|
|
126765
127252
|
// Perpetual swap
|
|
126766
127253
|
//
|
|
@@ -127266,11 +127753,16 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
127266
127753
|
const market = this.market(symbol);
|
|
127267
127754
|
const [request, query] = this.prepareRequest(market, undefined, params);
|
|
127268
127755
|
request['change'] = this.numberToString(amount);
|
|
127269
|
-
|
|
127270
|
-
|
|
127271
|
-
|
|
127272
|
-
}
|
|
127273
|
-
|
|
127756
|
+
let response = undefined;
|
|
127757
|
+
if (market['swap']) {
|
|
127758
|
+
response = await this.privateFuturesPostSettlePositionsContractMargin(this.extend(request, query));
|
|
127759
|
+
}
|
|
127760
|
+
else if (market['future']) {
|
|
127761
|
+
response = await this.privateDeliveryPostSettlePositionsContractMargin(this.extend(request, query));
|
|
127762
|
+
}
|
|
127763
|
+
else {
|
|
127764
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' modifyMarginHelper() not support this market type');
|
|
127765
|
+
}
|
|
127274
127766
|
return this.parseMarginModification(response, market);
|
|
127275
127767
|
}
|
|
127276
127768
|
parseMarginModification(data, market = undefined) {
|
|
@@ -204154,8 +204646,8 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
204154
204646
|
},
|
|
204155
204647
|
'api': {
|
|
204156
204648
|
'ws': {
|
|
204157
|
-
'spot': 'wss://stream.binance.com
|
|
204158
|
-
'margin': 'wss://stream.binance.com
|
|
204649
|
+
'spot': 'wss://stream.binance.com/ws',
|
|
204650
|
+
'margin': 'wss://stream.binance.com/ws',
|
|
204159
204651
|
'future': 'wss://fstream.binance.com/ws',
|
|
204160
204652
|
'delivery': 'wss://dstream.binance.com/ws',
|
|
204161
204653
|
'ws': 'wss://ws-api.binance.com:443/ws-api/v3',
|
|
@@ -205410,20 +205902,23 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
205410
205902
|
return;
|
|
205411
205903
|
}
|
|
205412
205904
|
let method = 'publicPutUserDataStream';
|
|
205905
|
+
const request = {};
|
|
205906
|
+
const symbol = this.safeString(params, 'symbol');
|
|
205907
|
+
const sendParams = this.omit(params, ['type', 'symbol']);
|
|
205413
205908
|
if (type === 'future') {
|
|
205414
205909
|
method = 'fapiPrivatePutListenKey';
|
|
205415
205910
|
}
|
|
205416
205911
|
else if (type === 'delivery') {
|
|
205417
205912
|
method = 'dapiPrivatePutListenKey';
|
|
205418
205913
|
}
|
|
205419
|
-
else
|
|
205420
|
-
|
|
205914
|
+
else {
|
|
205915
|
+
request['listenKey'] = listenKey;
|
|
205916
|
+
if (type === 'margin') {
|
|
205917
|
+
request['symbol'] = symbol;
|
|
205918
|
+
method = 'sapiPutUserDataStream';
|
|
205919
|
+
}
|
|
205421
205920
|
}
|
|
205422
|
-
const request = {
|
|
205423
|
-
'listenKey': listenKey,
|
|
205424
|
-
};
|
|
205425
205921
|
const time = this.milliseconds();
|
|
205426
|
-
const sendParams = this.omit(params, 'type');
|
|
205427
205922
|
try {
|
|
205428
205923
|
await this[method](this.extend(request, sendParams));
|
|
205429
205924
|
}
|
|
@@ -206177,9 +206672,7 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
206177
206672
|
market = this.market(symbol);
|
|
206178
206673
|
symbol = market['symbol'];
|
|
206179
206674
|
messageHash += ':' + symbol;
|
|
206180
|
-
params = this.extend(params, { 'type': market['type'], 'symbol': symbol }); // needed inside authenticate for isolated margin
|
|
206181
206675
|
}
|
|
206182
|
-
await this.authenticate(params);
|
|
206183
206676
|
let type = undefined;
|
|
206184
206677
|
[type, params] = this.handleMarketTypeAndParams('watchOrders', market, params);
|
|
206185
206678
|
let subType = undefined;
|
|
@@ -206190,6 +206683,8 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
206190
206683
|
else if (this.isInverse(type, subType)) {
|
|
206191
206684
|
type = 'delivery';
|
|
206192
206685
|
}
|
|
206686
|
+
params = this.extend(params, { 'type': type, 'symbol': symbol }); // needed inside authenticate for isolated margin
|
|
206687
|
+
await this.authenticate(params);
|
|
206193
206688
|
let urlType = type;
|
|
206194
206689
|
if (type === 'margin') {
|
|
206195
206690
|
urlType = 'spot'; // spot-margin shares the same stream as regular spot
|
|
@@ -287985,7 +288480,7 @@ SOFTWARE.
|
|
|
287985
288480
|
|
|
287986
288481
|
//-----------------------------------------------------------------------------
|
|
287987
288482
|
// this is updated by vss.js when building
|
|
287988
|
-
const version = '4.1.
|
|
288483
|
+
const version = '4.1.71';
|
|
287989
288484
|
_src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
|
|
287990
288485
|
//-----------------------------------------------------------------------------
|
|
287991
288486
|
|