ccxt 4.1.81 → 4.1.83
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 +4 -4
- package/dist/ccxt.browser.js +488 -154
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +1 -1
- package/dist/cjs/src/bingx.js +1 -1
- package/dist/cjs/src/bitget.js +1 -1
- package/dist/cjs/src/bybit.js +1 -1
- package/dist/cjs/src/cex.js +30 -12
- package/dist/cjs/src/coinex.js +191 -71
- package/dist/cjs/src/cryptocom.js +47 -0
- package/dist/cjs/src/htx.js +12 -10
- package/dist/cjs/src/lbank.js +70 -38
- package/dist/cjs/src/okx.js +122 -7
- package/dist/cjs/src/pro/binance.js +1 -1
- package/dist/cjs/src/pro/bingx.js +1 -1
- package/dist/cjs/src/pro/bitget.js +1 -1
- package/dist/cjs/src/pro/bybit.js +1 -1
- package/dist/cjs/src/pro/cex.js +1 -1
- package/dist/cjs/src/pro/coinbasepro.js +1 -1
- package/dist/cjs/src/pro/cryptocom.js +1 -1
- package/dist/cjs/src/pro/gate.js +1 -1
- package/dist/cjs/src/pro/kucoin.js +1 -1
- package/dist/cjs/src/pro/kucoinfutures.js +1 -1
- package/dist/cjs/src/pro/okx.js +1 -1
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/base/Exchange.d.ts +1 -1
- package/js/src/base/Exchange.js +1 -1
- package/js/src/bingx.js +1 -1
- package/js/src/bitget.js +1 -1
- package/js/src/bybit.js +1 -1
- package/js/src/cex.js +30 -12
- package/js/src/coinex.js +191 -71
- package/js/src/cryptocom.d.ts +1 -0
- package/js/src/cryptocom.js +47 -0
- package/js/src/htx.js +12 -10
- package/js/src/lbank.d.ts +1 -0
- package/js/src/lbank.js +71 -39
- package/js/src/okx.d.ts +1 -0
- package/js/src/okx.js +122 -7
- package/js/src/pro/binance.js +1 -1
- package/js/src/pro/bingx.js +1 -1
- package/js/src/pro/bitget.js +1 -1
- package/js/src/pro/bybit.js +1 -1
- package/js/src/pro/cex.js +1 -1
- package/js/src/pro/coinbasepro.js +1 -1
- package/js/src/pro/cryptocom.js +1 -1
- package/js/src/pro/gate.js +1 -1
- package/js/src/pro/kucoin.js +1 -1
- package/js/src/pro/kucoinfutures.js +1 -1
- package/js/src/pro/okx.js +1 -1
- package/package.json +1 -1
package/dist/ccxt.browser.js
CHANGED
|
@@ -10683,7 +10683,7 @@ class Exchange {
|
|
|
10683
10683
|
async fetchFundingHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
10684
10684
|
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchFundingHistory() is not supported yet');
|
|
10685
10685
|
}
|
|
10686
|
-
async closePosition(symbol, side = undefined,
|
|
10686
|
+
async closePosition(symbol, side = undefined, params = {}) {
|
|
10687
10687
|
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' closePositions() is not supported yet');
|
|
10688
10688
|
}
|
|
10689
10689
|
async closeAllPositions(params = {}) {
|
|
@@ -30279,7 +30279,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
30279
30279
|
* @see https://bitgetlimited.github.io/apidoc/en/mix/#close-all-position
|
|
30280
30280
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
30281
30281
|
* @param {string} [params.recvWindow] request valid time window value
|
|
30282
|
-
* @returns {[
|
|
30282
|
+
* @returns {object[]} [A list of position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
30283
30283
|
*/
|
|
30284
30284
|
await this.loadMarkets();
|
|
30285
30285
|
const defaultRecvWindow = this.safeInteger(this.options, 'recvWindow');
|
|
@@ -47223,7 +47223,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
47223
47223
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
47224
47224
|
* @param {string} [params.subType] 'linear' or 'inverse'
|
|
47225
47225
|
* @param {string} [params.settle] *required and only valid when params.subType === "linear"* 'USDT' or 'USDC'
|
|
47226
|
-
* @returns {[
|
|
47226
|
+
* @returns {object[]} [A list of position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
47227
47227
|
*/
|
|
47228
47228
|
await this.loadMarkets();
|
|
47229
47229
|
let subType = undefined;
|
|
@@ -79201,7 +79201,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
79201
79201
|
* @see https://bybit-exchange.github.io/docs/v5/account/wallet-balance
|
|
79202
79202
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
79203
79203
|
* @param {string} [params.type] wallet type, ['spot', 'swap', 'fund']
|
|
79204
|
-
* @returns {object} a [balance structure]{@link https://docs.ccxt.com
|
|
79204
|
+
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
79205
79205
|
*/
|
|
79206
79206
|
await this.loadMarkets();
|
|
79207
79207
|
const request = {};
|
|
@@ -83818,6 +83818,9 @@ class cex extends _abstract_cex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
83818
83818
|
'cancelOrder': true,
|
|
83819
83819
|
'cancelOrders': false,
|
|
83820
83820
|
'createDepositAddress': false,
|
|
83821
|
+
'createMarketBuyOrderWithCost': true,
|
|
83822
|
+
'createMarketOrderWithCost': false,
|
|
83823
|
+
'createMarketSellOrderWithCost': false,
|
|
83821
83824
|
'createOrder': true,
|
|
83822
83825
|
'createStopLimitOrder': false,
|
|
83823
83826
|
'createStopMarketOrder': false,
|
|
@@ -84536,31 +84539,46 @@ class cex extends _abstract_cex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
84536
84539
|
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
84537
84540
|
* @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
84538
84541
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
84542
|
+
* @param {float} [params.cost] the quote quantity that can be used as an alternative for the amount for market buy orders
|
|
84539
84543
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
84540
84544
|
*/
|
|
84545
|
+
await this.loadMarkets();
|
|
84546
|
+
const market = this.market(symbol);
|
|
84547
|
+
const request = {
|
|
84548
|
+
'pair': market['id'],
|
|
84549
|
+
'type': side,
|
|
84550
|
+
};
|
|
84541
84551
|
// for market buy it requires the amount of quote currency to spend
|
|
84542
84552
|
if ((type === 'market') && (side === 'buy')) {
|
|
84543
|
-
|
|
84553
|
+
let quoteAmount = undefined;
|
|
84554
|
+
let createMarketBuyOrderRequiresPrice = true;
|
|
84555
|
+
[createMarketBuyOrderRequiresPrice, params] = this.handleOptionAndParams(params, 'createOrder', 'createMarketBuyOrderRequiresPrice', true);
|
|
84556
|
+
const cost = this.safeString(params, 'cost');
|
|
84557
|
+
params = this.omit(params, 'cost');
|
|
84558
|
+
if (cost !== undefined) {
|
|
84559
|
+
quoteAmount = this.costToPrecision(symbol, cost);
|
|
84560
|
+
}
|
|
84561
|
+
else if (createMarketBuyOrderRequiresPrice) {
|
|
84544
84562
|
if (price === undefined) {
|
|
84545
|
-
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder(this.id +
|
|
84563
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder(this.id + ' createOrder() requires the price argument for market buy orders to calculate the total cost to spend (amount * price), alternatively set the createMarketBuyOrderRequiresPrice option or param to false and pass the cost to spend in the amount argument');
|
|
84546
84564
|
}
|
|
84547
84565
|
else {
|
|
84548
84566
|
const amountString = this.numberToString(amount);
|
|
84549
84567
|
const priceString = this.numberToString(price);
|
|
84550
|
-
const
|
|
84551
|
-
|
|
84568
|
+
const costRequest = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringMul(amountString, priceString);
|
|
84569
|
+
quoteAmount = this.costToPrecision(symbol, costRequest);
|
|
84552
84570
|
}
|
|
84553
84571
|
}
|
|
84572
|
+
else {
|
|
84573
|
+
quoteAmount = this.costToPrecision(symbol, amount);
|
|
84574
|
+
}
|
|
84575
|
+
request['amount'] = quoteAmount;
|
|
84576
|
+
}
|
|
84577
|
+
else {
|
|
84578
|
+
request['amount'] = this.amountToPrecision(symbol, amount);
|
|
84554
84579
|
}
|
|
84555
|
-
await this.loadMarkets();
|
|
84556
|
-
const market = this.market(symbol);
|
|
84557
|
-
const request = {
|
|
84558
|
-
'pair': market['id'],
|
|
84559
|
-
'type': side,
|
|
84560
|
-
'amount': amount,
|
|
84561
|
-
};
|
|
84562
84580
|
if (type === 'limit') {
|
|
84563
|
-
request['price'] = price;
|
|
84581
|
+
request['price'] = this.numberToString(price);
|
|
84564
84582
|
}
|
|
84565
84583
|
else {
|
|
84566
84584
|
request['order_type'] = type;
|
|
@@ -91979,6 +91997,8 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
91979
91997
|
* @method
|
|
91980
91998
|
* @name coinex#fetchMarkets
|
|
91981
91999
|
* @description retrieves data on all markets for coinex
|
|
92000
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot001_market002_all_market_info
|
|
92001
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http006_market_list
|
|
91982
92002
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
91983
92003
|
* @returns {object[]} an array of objects representing market data
|
|
91984
92004
|
*/
|
|
@@ -92250,6 +92270,8 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
92250
92270
|
* @method
|
|
92251
92271
|
* @name coinex#fetchTicker
|
|
92252
92272
|
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
92273
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot001_market007_single_market_ticker
|
|
92274
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http008_market_ticker
|
|
92253
92275
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
92254
92276
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
92255
92277
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -92259,8 +92281,13 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
92259
92281
|
const request = {
|
|
92260
92282
|
'market': market['id'],
|
|
92261
92283
|
};
|
|
92262
|
-
|
|
92263
|
-
|
|
92284
|
+
let response = undefined;
|
|
92285
|
+
if (market['swap']) {
|
|
92286
|
+
response = await this.perpetualPublicGetMarketTicker(this.extend(request, params));
|
|
92287
|
+
}
|
|
92288
|
+
else {
|
|
92289
|
+
response = await this.publicGetMarketTicker(this.extend(request, params));
|
|
92290
|
+
}
|
|
92264
92291
|
//
|
|
92265
92292
|
// Spot
|
|
92266
92293
|
//
|
|
@@ -92336,8 +92363,13 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
92336
92363
|
market = this.market(symbol);
|
|
92337
92364
|
}
|
|
92338
92365
|
const [marketType, query] = this.handleMarketTypeAndParams('fetchTickers', market, params);
|
|
92339
|
-
|
|
92340
|
-
|
|
92366
|
+
let response = undefined;
|
|
92367
|
+
if (marketType === 'swap') {
|
|
92368
|
+
response = await this.perpetualPublicGetMarketTickerAll(query);
|
|
92369
|
+
}
|
|
92370
|
+
else {
|
|
92371
|
+
response = await this.publicGetMarketTickerAll();
|
|
92372
|
+
}
|
|
92341
92373
|
//
|
|
92342
92374
|
// Spot
|
|
92343
92375
|
//
|
|
@@ -92419,6 +92451,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
92419
92451
|
* @method
|
|
92420
92452
|
* @name coinex#fetchTime
|
|
92421
92453
|
* @description fetches the current integer timestamp in milliseconds from the exchange server
|
|
92454
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http005_system_time
|
|
92422
92455
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
92423
92456
|
* @returns {int} the current integer timestamp in milliseconds from the exchange server
|
|
92424
92457
|
*/
|
|
@@ -92437,6 +92470,8 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
92437
92470
|
* @method
|
|
92438
92471
|
* @name coinex#fetchOrderBook
|
|
92439
92472
|
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
92473
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot001_market004_market_depth
|
|
92474
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http010_market_depth
|
|
92440
92475
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
92441
92476
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
92442
92477
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -92452,8 +92487,13 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
92452
92487
|
'merge': '0',
|
|
92453
92488
|
'limit': limit.toString(),
|
|
92454
92489
|
};
|
|
92455
|
-
|
|
92456
|
-
|
|
92490
|
+
let response = undefined;
|
|
92491
|
+
if (market['swap']) {
|
|
92492
|
+
response = await this.perpetualPublicGetMarketDepth(this.extend(request, params));
|
|
92493
|
+
}
|
|
92494
|
+
else {
|
|
92495
|
+
response = await this.publicGetMarketDepth(this.extend(request, params));
|
|
92496
|
+
}
|
|
92457
92497
|
//
|
|
92458
92498
|
// Spot
|
|
92459
92499
|
//
|
|
@@ -92633,6 +92673,8 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
92633
92673
|
* @method
|
|
92634
92674
|
* @name coinex#fetchTrades
|
|
92635
92675
|
* @description get the list of most recent trades for a particular symbol
|
|
92676
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot001_market005_market_deals
|
|
92677
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http011_market_deals
|
|
92636
92678
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
92637
92679
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
92638
92680
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
@@ -92648,8 +92690,13 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
92648
92690
|
if (limit !== undefined) {
|
|
92649
92691
|
request['limit'] = limit;
|
|
92650
92692
|
}
|
|
92651
|
-
|
|
92652
|
-
|
|
92693
|
+
let response = undefined;
|
|
92694
|
+
if (market['swap']) {
|
|
92695
|
+
response = await this.perpetualPublicGetMarketDeals(this.extend(request, params));
|
|
92696
|
+
}
|
|
92697
|
+
else {
|
|
92698
|
+
response = await this.publicGetMarketDeals(this.extend(request, params));
|
|
92699
|
+
}
|
|
92653
92700
|
//
|
|
92654
92701
|
// Spot and Swap
|
|
92655
92702
|
//
|
|
@@ -92675,6 +92722,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
92675
92722
|
* @method
|
|
92676
92723
|
* @name coinex#fetchTradingFee
|
|
92677
92724
|
* @description fetch the trading fees for a market
|
|
92725
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot001_market003_single_market_info
|
|
92678
92726
|
* @param {string} symbol unified market symbol
|
|
92679
92727
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
92680
92728
|
* @returns {object} a [fee structure]{@link https://docs.ccxt.com/#/?id=fee-structure}
|
|
@@ -92709,6 +92757,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
92709
92757
|
* @method
|
|
92710
92758
|
* @name coinex#fetchTradingFees
|
|
92711
92759
|
* @description fetch the trading fees for multiple markets
|
|
92760
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot001_market002_all_market_info
|
|
92712
92761
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
92713
92762
|
* @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
|
|
92714
92763
|
*/
|
|
@@ -92781,6 +92830,8 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
92781
92830
|
* @method
|
|
92782
92831
|
* @name coinex#fetchOHLCV
|
|
92783
92832
|
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
92833
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot001_market006_market_kline
|
|
92834
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http012_market_kline
|
|
92784
92835
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
92785
92836
|
* @param {string} timeframe the length of time each candle represents
|
|
92786
92837
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
@@ -92797,8 +92848,13 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
92797
92848
|
if (limit !== undefined) {
|
|
92798
92849
|
request['limit'] = limit;
|
|
92799
92850
|
}
|
|
92800
|
-
|
|
92801
|
-
|
|
92851
|
+
let response = undefined;
|
|
92852
|
+
if (market['swap']) {
|
|
92853
|
+
response = await this.perpetualPublicGetMarketKline(this.extend(request, params));
|
|
92854
|
+
}
|
|
92855
|
+
else {
|
|
92856
|
+
response = await this.publicGetMarketKline(this.extend(request, params));
|
|
92857
|
+
}
|
|
92802
92858
|
//
|
|
92803
92859
|
// Spot
|
|
92804
92860
|
//
|
|
@@ -94046,6 +94102,10 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
94046
94102
|
* @method
|
|
94047
94103
|
* @name coinex#cancelOrder
|
|
94048
94104
|
* @description cancels an open order
|
|
94105
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade018_cancle_stop_pending_order
|
|
94106
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade015_cancel_order
|
|
94107
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http023_cancel_stop_order
|
|
94108
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http021_cancel_order
|
|
94049
94109
|
* @param {string} id order id
|
|
94050
94110
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
94051
94111
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -94063,15 +94123,6 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
94063
94123
|
};
|
|
94064
94124
|
const idRequest = swap ? 'order_id' : 'id';
|
|
94065
94125
|
request[idRequest] = id;
|
|
94066
|
-
let method = swap ? 'perpetualPrivatePostOrderCancel' : 'privateDeleteOrderPending';
|
|
94067
|
-
if (stop) {
|
|
94068
|
-
if (swap) {
|
|
94069
|
-
method = 'perpetualPrivatePostOrderCancelStop';
|
|
94070
|
-
}
|
|
94071
|
-
else {
|
|
94072
|
-
method = 'privateDeleteOrderStopPendingId';
|
|
94073
|
-
}
|
|
94074
|
-
}
|
|
94075
94126
|
const accountId = this.safeInteger(params, 'account_id');
|
|
94076
94127
|
const defaultType = this.safeString(this.options, 'defaultType');
|
|
94077
94128
|
if (defaultType === 'margin') {
|
|
@@ -94081,7 +94132,23 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
94081
94132
|
request['account_id'] = accountId;
|
|
94082
94133
|
}
|
|
94083
94134
|
const query = this.omit(params, ['stop', 'account_id']);
|
|
94084
|
-
|
|
94135
|
+
let response = undefined;
|
|
94136
|
+
if (stop) {
|
|
94137
|
+
if (swap) {
|
|
94138
|
+
response = await this.perpetualPrivatePostOrderCancelStop(this.extend(request, query));
|
|
94139
|
+
}
|
|
94140
|
+
else {
|
|
94141
|
+
response = await this.privateDeleteOrderStopPendingId(this.extend(request, query));
|
|
94142
|
+
}
|
|
94143
|
+
}
|
|
94144
|
+
else {
|
|
94145
|
+
if (swap) {
|
|
94146
|
+
response = await this.perpetualPrivatePostOrderCancel(this.extend(request, query));
|
|
94147
|
+
}
|
|
94148
|
+
else {
|
|
94149
|
+
response = await this.privateDeleteOrderPending(this.extend(request, query));
|
|
94150
|
+
}
|
|
94151
|
+
}
|
|
94085
94152
|
//
|
|
94086
94153
|
// Spot and Margin
|
|
94087
94154
|
//
|
|
@@ -94196,6 +94263,10 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
94196
94263
|
* @method
|
|
94197
94264
|
* @name coinex#cancelAllOrders
|
|
94198
94265
|
* @description cancel all open orders in a market
|
|
94266
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade018_cancle_stop_pending_order
|
|
94267
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade015_cancel_order
|
|
94268
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http024_cancel_stop_all
|
|
94269
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http022_cancel_all
|
|
94199
94270
|
* @param {string} symbol unified market symbol of the market to cancel orders in
|
|
94200
94271
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
94201
94272
|
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
@@ -94214,22 +94285,25 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
94214
94285
|
};
|
|
94215
94286
|
const swap = market['swap'];
|
|
94216
94287
|
const stop = this.safeValue(params, 'stop');
|
|
94217
|
-
|
|
94288
|
+
params = this.omit(params, ['stop', 'account_id']);
|
|
94289
|
+
let response = undefined;
|
|
94218
94290
|
if (swap) {
|
|
94219
|
-
method = 'perpetualPrivatePostOrderCancelAll';
|
|
94220
94291
|
if (stop) {
|
|
94221
|
-
|
|
94292
|
+
response = await this.perpetualPrivatePostOrderCancelStopAll(this.extend(request, params));
|
|
94293
|
+
}
|
|
94294
|
+
else {
|
|
94295
|
+
response = await this.perpetualPrivatePostOrderCancelAll(this.extend(request, params));
|
|
94222
94296
|
}
|
|
94223
94297
|
}
|
|
94224
94298
|
else {
|
|
94225
|
-
|
|
94299
|
+
request['account_id'] = accountId;
|
|
94226
94300
|
if (stop) {
|
|
94227
|
-
|
|
94301
|
+
response = await this.privateDeleteOrderStopPending(this.extend(request, params));
|
|
94302
|
+
}
|
|
94303
|
+
else {
|
|
94304
|
+
response = await this.privateDeleteOrderPending(this.extend(request, params));
|
|
94228
94305
|
}
|
|
94229
|
-
request['account_id'] = accountId;
|
|
94230
94306
|
}
|
|
94231
|
-
params = this.omit(params, ['stop', 'account_id']);
|
|
94232
|
-
const response = await this[method](this.extend(request, params));
|
|
94233
94307
|
//
|
|
94234
94308
|
// Spot and Margin
|
|
94235
94309
|
//
|
|
@@ -94246,6 +94320,9 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
94246
94320
|
* @method
|
|
94247
94321
|
* @name coinex#fetchOrder
|
|
94248
94322
|
* @description fetches information on an order made by the user
|
|
94323
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http028_stop_status
|
|
94324
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http026_order_status
|
|
94325
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade007_order_status
|
|
94249
94326
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
94250
94327
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
94251
94328
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
@@ -94257,6 +94334,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
94257
94334
|
const market = this.market(symbol);
|
|
94258
94335
|
const swap = market['swap'];
|
|
94259
94336
|
const stop = this.safeValue(params, 'stop');
|
|
94337
|
+
params = this.omit(params, 'stop');
|
|
94260
94338
|
const request = {
|
|
94261
94339
|
'market': market['id'],
|
|
94262
94340
|
// 'id': id, // SPOT
|
|
@@ -94264,15 +94342,18 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
94264
94342
|
};
|
|
94265
94343
|
const idRequest = swap ? 'order_id' : 'id';
|
|
94266
94344
|
request[idRequest] = id;
|
|
94267
|
-
let
|
|
94345
|
+
let response = undefined;
|
|
94268
94346
|
if (swap) {
|
|
94269
|
-
|
|
94347
|
+
if (stop) {
|
|
94348
|
+
response = await this.perpetualPrivateGetOrderStopStatus(this.extend(request, params));
|
|
94349
|
+
}
|
|
94350
|
+
else {
|
|
94351
|
+
response = await this.perpetualPrivateGetOrderStatus(this.extend(request, params));
|
|
94352
|
+
}
|
|
94270
94353
|
}
|
|
94271
94354
|
else {
|
|
94272
|
-
|
|
94355
|
+
response = await this.privateGetOrderStatus(this.extend(request, params));
|
|
94273
94356
|
}
|
|
94274
|
-
params = this.omit(params, 'stop');
|
|
94275
|
-
const response = await this[method](this.extend(request, params));
|
|
94276
94357
|
//
|
|
94277
94358
|
// Spot
|
|
94278
94359
|
//
|
|
@@ -94392,15 +94473,20 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
94392
94473
|
request['market'] = market['id'];
|
|
94393
94474
|
}
|
|
94394
94475
|
const [marketType, query] = this.handleMarketTypeAndParams('fetchOrdersByStatus', market, params);
|
|
94395
|
-
|
|
94476
|
+
const accountId = this.safeInteger(params, 'account_id');
|
|
94477
|
+
const defaultType = this.safeString(this.options, 'defaultType');
|
|
94478
|
+
if (defaultType === 'margin') {
|
|
94479
|
+
if (accountId === undefined) {
|
|
94480
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest(this.id + ' fetchOpenOrders() and fetchClosedOrders() require an account_id parameter for margin orders');
|
|
94481
|
+
}
|
|
94482
|
+
request['account_id'] = accountId;
|
|
94483
|
+
}
|
|
94484
|
+
params = this.omit(query, 'account_id');
|
|
94485
|
+
let response = undefined;
|
|
94396
94486
|
if (marketType === 'swap') {
|
|
94397
94487
|
if (symbol === undefined) {
|
|
94398
94488
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' fetchOrdersByStatus() requires a symbol argument for swap markets');
|
|
94399
94489
|
}
|
|
94400
|
-
method = 'perpetualPrivateGetOrder' + this.capitalize(status);
|
|
94401
|
-
if (stop) {
|
|
94402
|
-
method = 'perpetualPrivateGetOrderStopPending';
|
|
94403
|
-
}
|
|
94404
94490
|
if (side !== undefined) {
|
|
94405
94491
|
request['side'] = side;
|
|
94406
94492
|
}
|
|
@@ -94408,24 +94494,37 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
94408
94494
|
request['side'] = 0;
|
|
94409
94495
|
}
|
|
94410
94496
|
request['offset'] = 0;
|
|
94411
|
-
}
|
|
94412
|
-
else {
|
|
94413
|
-
method = 'privateGetOrder' + this.capitalize(status);
|
|
94414
94497
|
if (stop) {
|
|
94415
|
-
|
|
94498
|
+
response = await this.perpetualPrivateGetOrderStopPending(this.extend(request, params));
|
|
94499
|
+
}
|
|
94500
|
+
else {
|
|
94501
|
+
if (status === 'finished') {
|
|
94502
|
+
response = await this.perpetualPrivateGetOrderFinished(this.extend(request, params));
|
|
94503
|
+
}
|
|
94504
|
+
else if (status === 'pending') {
|
|
94505
|
+
response = await this.perpetualPrivateGetOrderPending(this.extend(request, params));
|
|
94506
|
+
}
|
|
94416
94507
|
}
|
|
94417
|
-
request['page'] = 1;
|
|
94418
94508
|
}
|
|
94419
|
-
|
|
94420
|
-
|
|
94421
|
-
|
|
94422
|
-
|
|
94423
|
-
|
|
94509
|
+
else {
|
|
94510
|
+
request['page'] = 1;
|
|
94511
|
+
if (status === 'finished') {
|
|
94512
|
+
if (stop) {
|
|
94513
|
+
response = await this.privateGetOrderStopFinished(this.extend(request, params));
|
|
94514
|
+
}
|
|
94515
|
+
else {
|
|
94516
|
+
response = await this.privateGetOrderFinished(this.extend(request, params));
|
|
94517
|
+
}
|
|
94518
|
+
}
|
|
94519
|
+
else if (status === 'pending') {
|
|
94520
|
+
if (stop) {
|
|
94521
|
+
response = await this.privateGetOrderStopPending(this.extend(request, params));
|
|
94522
|
+
}
|
|
94523
|
+
else {
|
|
94524
|
+
response = await this.privateGetOrderPending(this.extend(request, params));
|
|
94525
|
+
}
|
|
94424
94526
|
}
|
|
94425
|
-
request['account_id'] = accountId;
|
|
94426
94527
|
}
|
|
94427
|
-
params = this.omit(query, 'account_id');
|
|
94428
|
-
const response = await this[method](this.extend(request, params));
|
|
94429
94528
|
//
|
|
94430
94529
|
// Spot and Margin
|
|
94431
94530
|
//
|
|
@@ -94586,6 +94685,10 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
94586
94685
|
* @method
|
|
94587
94686
|
* @name coinex#fetchOpenOrders
|
|
94588
94687
|
* @description fetch all unfilled currently open orders
|
|
94688
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http027_query_pending_stop
|
|
94689
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http025_query_pending
|
|
94690
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade013_stop_pending_order
|
|
94691
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade011_pending_order
|
|
94589
94692
|
* @param {string} symbol unified market symbol
|
|
94590
94693
|
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
94591
94694
|
* @param {int} [limit] the maximum number of open orders structures to retrieve
|
|
@@ -94599,6 +94702,9 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
94599
94702
|
* @method
|
|
94600
94703
|
* @name coinex#fetchClosedOrders
|
|
94601
94704
|
* @description fetches information on multiple closed orders made by the user
|
|
94705
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http029_query_finished
|
|
94706
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade010_stop_finished_order
|
|
94707
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade012_finished_order
|
|
94602
94708
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
94603
94709
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
94604
94710
|
* @param {int} [limit] the maximum number of orde structures to retrieve
|
|
@@ -94612,6 +94718,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
94612
94718
|
* @method
|
|
94613
94719
|
* @name coinex#createDepositAddress
|
|
94614
94720
|
* @description create a currency deposit address
|
|
94721
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account019_update_deposit_address
|
|
94615
94722
|
* @param {string} code unified currency code of the currency for the deposit address
|
|
94616
94723
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
94617
94724
|
* @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
|
|
@@ -94644,6 +94751,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
94644
94751
|
* @method
|
|
94645
94752
|
* @name coinex#fetchDepositAddress
|
|
94646
94753
|
* @description fetch the deposit address for a currency associated with this account
|
|
94754
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account020_query_deposit_address
|
|
94647
94755
|
* @param {string} code unified currency code
|
|
94648
94756
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
94649
94757
|
* @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
|
|
@@ -94738,6 +94846,8 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
94738
94846
|
* @method
|
|
94739
94847
|
* @name coinex#fetchMyTrades
|
|
94740
94848
|
* @description fetch all trades made by the user
|
|
94849
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http013_user_deals
|
|
94850
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade014_user_deals
|
|
94741
94851
|
* @param {string} symbol unified market symbol
|
|
94742
94852
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
94743
94853
|
* @param {int} [limit] the maximum number of trades structures to retrieve
|
|
@@ -94767,9 +94877,17 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
94767
94877
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' fetchMyTrades() requires a symbol argument for non-spot markets');
|
|
94768
94878
|
}
|
|
94769
94879
|
const swap = (type === 'swap');
|
|
94770
|
-
|
|
94880
|
+
const accountId = this.safeInteger(params, 'account_id');
|
|
94881
|
+
const defaultType = this.safeString(this.options, 'defaultType');
|
|
94882
|
+
if (defaultType === 'margin') {
|
|
94883
|
+
if (accountId === undefined) {
|
|
94884
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest(this.id + ' fetchMyTrades() requires an account_id parameter for margin trades');
|
|
94885
|
+
}
|
|
94886
|
+
request['account_id'] = accountId;
|
|
94887
|
+
params = this.omit(params, 'account_id');
|
|
94888
|
+
}
|
|
94889
|
+
let response = undefined;
|
|
94771
94890
|
if (swap) {
|
|
94772
|
-
method = 'perpetualPublicGetMarketUserDeals';
|
|
94773
94891
|
const side = this.safeInteger(params, 'side');
|
|
94774
94892
|
if (side === undefined) {
|
|
94775
94893
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' fetchMyTrades() requires a side parameter for swap markets');
|
|
@@ -94779,21 +94897,12 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
94779
94897
|
}
|
|
94780
94898
|
request['side'] = side;
|
|
94781
94899
|
params = this.omit(params, 'side');
|
|
94900
|
+
response = await this.perpetualPublicGetMarketUserDeals(this.extend(request, params));
|
|
94782
94901
|
}
|
|
94783
94902
|
else {
|
|
94784
|
-
method = 'privateGetOrderUserDeals';
|
|
94785
94903
|
request['page'] = 1;
|
|
94904
|
+
response = await this.privateGetOrderUserDeals(this.extend(request, params));
|
|
94786
94905
|
}
|
|
94787
|
-
const accountId = this.safeInteger(params, 'account_id');
|
|
94788
|
-
const defaultType = this.safeString(this.options, 'defaultType');
|
|
94789
|
-
if (defaultType === 'margin') {
|
|
94790
|
-
if (accountId === undefined) {
|
|
94791
|
-
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest(this.id + ' fetchMyTrades() requires an account_id parameter for margin trades');
|
|
94792
|
-
}
|
|
94793
|
-
request['account_id'] = accountId;
|
|
94794
|
-
params = this.omit(params, 'account_id');
|
|
94795
|
-
}
|
|
94796
|
-
const response = await this[method](this.extend(request, params));
|
|
94797
94906
|
//
|
|
94798
94907
|
// Spot and Margin
|
|
94799
94908
|
//
|
|
@@ -94876,6 +94985,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
94876
94985
|
* @method
|
|
94877
94986
|
* @name coinex#fetchPositions
|
|
94878
94987
|
* @description fetch all open positions
|
|
94988
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http033_pending_position
|
|
94879
94989
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
94880
94990
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
94881
94991
|
* @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
@@ -94971,6 +95081,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
94971
95081
|
* @method
|
|
94972
95082
|
* @name coinex#fetchPosition
|
|
94973
95083
|
* @description fetch data on a single open contract trade position
|
|
95084
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http033_pending_position
|
|
94974
95085
|
* @param {string} symbol unified market symbol of the market the position is held in, default is undefined
|
|
94975
95086
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
94976
95087
|
* @returns {object} a [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
@@ -95153,6 +95264,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
95153
95264
|
* @method
|
|
95154
95265
|
* @name coinex#setMarginMode
|
|
95155
95266
|
* @description set margin mode to 'cross' or 'isolated'
|
|
95267
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http014_adjust_leverage
|
|
95156
95268
|
* @param {string} marginMode 'cross' or 'isolated'
|
|
95157
95269
|
* @param {string} symbol unified market symbol
|
|
95158
95270
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -95242,6 +95354,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
95242
95354
|
* @method
|
|
95243
95355
|
* @name coinex#fetchLeverageTiers
|
|
95244
95356
|
* @description retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes
|
|
95357
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http007_market_limit
|
|
95245
95358
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
95246
95359
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
95247
95360
|
* @returns {object} a dictionary of [leverage tiers structures]{@link https://docs.ccxt.com/#/?id=leverage-tiers-structure}, indexed by market symbols
|
|
@@ -95406,6 +95519,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
95406
95519
|
* @method
|
|
95407
95520
|
* @name coinex#addMargin
|
|
95408
95521
|
* @description add margin
|
|
95522
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http032_adjust_position_margin
|
|
95409
95523
|
* @param {string} symbol unified market symbol
|
|
95410
95524
|
* @param {float} amount amount of margin to add
|
|
95411
95525
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -95418,6 +95532,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
95418
95532
|
* @method
|
|
95419
95533
|
* @name coinex#reduceMargin
|
|
95420
95534
|
* @description remove margin from a position
|
|
95535
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http032_adjust_position_margin
|
|
95421
95536
|
* @param {string} symbol unified market symbol
|
|
95422
95537
|
* @param {float} amount the amount of margin to remove
|
|
95423
95538
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -95430,6 +95545,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
95430
95545
|
* @method
|
|
95431
95546
|
* @name coinex#fetchFundingHistory
|
|
95432
95547
|
* @description fetch the history of funding payments paid and received on this account
|
|
95548
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http034_funding_position
|
|
95433
95549
|
* @param {string} symbol unified market symbol
|
|
95434
95550
|
* @param {int} [since] the earliest time in ms to fetch funding history for
|
|
95435
95551
|
* @param {int} [limit] the maximum number of funding history structures to retrieve
|
|
@@ -95505,6 +95621,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
95505
95621
|
* @method
|
|
95506
95622
|
* @name coinex#fetchFundingRate
|
|
95507
95623
|
* @description fetch the current funding rate
|
|
95624
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http008_market_ticker
|
|
95508
95625
|
* @param {string} symbol unified market symbol
|
|
95509
95626
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
95510
95627
|
* @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
@@ -95613,6 +95730,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
95613
95730
|
* @method
|
|
95614
95731
|
* @name coinex#fetchFundingRates
|
|
95615
95732
|
* @description fetch the current funding rates
|
|
95733
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http009_market_ticker_all
|
|
95616
95734
|
* @param {string[]} symbols unified market symbols
|
|
95617
95735
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
95618
95736
|
* @returns {object[]} an array of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
@@ -95939,6 +96057,8 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
95939
96057
|
* @method
|
|
95940
96058
|
* @name coinex#transfer
|
|
95941
96059
|
* @description transfer currency internally between wallets on the same account
|
|
96060
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account014_balance_contract_transfer
|
|
96061
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account013_margin_transfer
|
|
95942
96062
|
* @param {string} code unified currency code
|
|
95943
96063
|
* @param {float} amount amount to transfer
|
|
95944
96064
|
* @param {string} fromAccount account to transfer from
|
|
@@ -95953,12 +96073,14 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
95953
96073
|
'amount': amountToPrecision,
|
|
95954
96074
|
'coin_type': currency['id'],
|
|
95955
96075
|
};
|
|
95956
|
-
let
|
|
96076
|
+
let response = undefined;
|
|
95957
96077
|
if ((fromAccount === 'spot') && (toAccount === 'swap')) {
|
|
95958
96078
|
request['transfer_side'] = 'in'; // 'in' spot to swap, 'out' swap to spot
|
|
96079
|
+
response = await this.privatePostContractBalanceTransfer(this.extend(request, params));
|
|
95959
96080
|
}
|
|
95960
96081
|
else if ((fromAccount === 'swap') && (toAccount === 'spot')) {
|
|
95961
96082
|
request['transfer_side'] = 'out'; // 'in' spot to swap, 'out' swap to spot
|
|
96083
|
+
response = await this.privatePostContractBalanceTransfer(this.extend(request, params));
|
|
95962
96084
|
}
|
|
95963
96085
|
else {
|
|
95964
96086
|
const accountsById = this.safeValue(this.options, 'accountsById', {});
|
|
@@ -95968,9 +96090,8 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
95968
96090
|
// spot is 0, use fetchBalance() to find the margin account id
|
|
95969
96091
|
request['from_account'] = parseInt(fromId);
|
|
95970
96092
|
request['to_account'] = parseInt(toId);
|
|
95971
|
-
|
|
96093
|
+
response = await this.privatePostMarginTransfer(this.extend(request, params));
|
|
95972
96094
|
}
|
|
95973
|
-
const response = await this[method](this.extend(request, params));
|
|
95974
96095
|
//
|
|
95975
96096
|
// {"code": 0, "data": null, "message": "Success"}
|
|
95976
96097
|
//
|
|
@@ -96052,6 +96173,8 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
96052
96173
|
* @method
|
|
96053
96174
|
* @name coinex#fetchTransfers
|
|
96054
96175
|
* @description fetch a history of internal transfers made on an account
|
|
96176
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account025_margin_transfer_history
|
|
96177
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account024_contract_transfer_history
|
|
96055
96178
|
* @param {string} code unified currency code of the currency transferred
|
|
96056
96179
|
* @param {int} [since] the earliest time in ms to fetch transfers for
|
|
96057
96180
|
* @param {int} [limit] the maximum number of transfers structures to retrieve
|
|
@@ -96062,7 +96185,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
96062
96185
|
let currency = undefined;
|
|
96063
96186
|
const request = {
|
|
96064
96187
|
'page': 1,
|
|
96065
|
-
'limit': limit,
|
|
96188
|
+
// 'limit': limit,
|
|
96066
96189
|
// 'asset': 'USDT',
|
|
96067
96190
|
// 'start_time': since,
|
|
96068
96191
|
// 'end_time': 1515806440,
|
|
@@ -96073,16 +96196,27 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
96073
96196
|
request['page'] = page;
|
|
96074
96197
|
}
|
|
96075
96198
|
if (code !== undefined) {
|
|
96076
|
-
currency = this.
|
|
96199
|
+
currency = this.currency(code);
|
|
96077
96200
|
request['asset'] = currency['id'];
|
|
96078
96201
|
}
|
|
96079
96202
|
if (since !== undefined) {
|
|
96080
96203
|
request['start_time'] = since;
|
|
96081
96204
|
}
|
|
96205
|
+
if (limit !== undefined) {
|
|
96206
|
+
request['limit'] = limit;
|
|
96207
|
+
}
|
|
96208
|
+
else {
|
|
96209
|
+
request['limit'] = 100;
|
|
96210
|
+
}
|
|
96082
96211
|
params = this.omit(params, 'page');
|
|
96083
96212
|
const defaultType = this.safeString(this.options, 'defaultType');
|
|
96084
|
-
|
|
96085
|
-
|
|
96213
|
+
let response = undefined;
|
|
96214
|
+
if (defaultType === 'margin') {
|
|
96215
|
+
response = await this.privateGetMarginTransferHistory(this.extend(request, params));
|
|
96216
|
+
}
|
|
96217
|
+
else {
|
|
96218
|
+
response = await this.privateGetContractTransferHistory(this.extend(request, params));
|
|
96219
|
+
}
|
|
96086
96220
|
//
|
|
96087
96221
|
// Swap
|
|
96088
96222
|
//
|
|
@@ -96136,6 +96270,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
96136
96270
|
* @method
|
|
96137
96271
|
* @name coinex#fetchWithdrawals
|
|
96138
96272
|
* @description fetch all withdrawals made from an account
|
|
96273
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account026_withdraw_list
|
|
96139
96274
|
* @param {string} code unified currency code
|
|
96140
96275
|
* @param {int} [since] the earliest time in ms to fetch withdrawals for
|
|
96141
96276
|
* @param {int} [limit] the maximum number of withdrawals structures to retrieve
|
|
@@ -96202,6 +96337,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
96202
96337
|
* @method
|
|
96203
96338
|
* @name coinex#fetchDeposits
|
|
96204
96339
|
* @description fetch all deposits made to an account
|
|
96340
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account009_deposit_list
|
|
96205
96341
|
* @param {string} code unified currency code
|
|
96206
96342
|
* @param {int} [since] the earliest time in ms to fetch deposits for
|
|
96207
96343
|
* @param {int} [limit] the maximum number of deposits structures to retrieve
|
|
@@ -96301,6 +96437,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
96301
96437
|
* @method
|
|
96302
96438
|
* @name coinex#fetchIsolatedBorrowRate
|
|
96303
96439
|
* @description fetch the rate of interest to borrow a currency for margin trading
|
|
96440
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account007_margin_account_settings
|
|
96304
96441
|
* @param {string} symbol unified symbol of the market to fetch the borrow rate for
|
|
96305
96442
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
96306
96443
|
* @returns {object} an [isolated borrow rate structure]{@link https://docs.ccxt.com/#/?id=isolated-borrow-rate-structure}
|
|
@@ -96339,6 +96476,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
96339
96476
|
* @method
|
|
96340
96477
|
* @name coinex#fetchIsolatedBorrowRates
|
|
96341
96478
|
* @description fetch the borrow interest rates of all currencies
|
|
96479
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account007_margin_account_settings
|
|
96342
96480
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
96343
96481
|
* @returns {object} a list of [isolated borrow rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#isolated-borrow-rate-structure}
|
|
96344
96482
|
*/
|
|
@@ -103585,6 +103723,8 @@ class cryptocom extends _abstract_cryptocom_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
103585
103723
|
'cancelAllOrders': true,
|
|
103586
103724
|
'cancelOrder': true,
|
|
103587
103725
|
'cancelOrders': true,
|
|
103726
|
+
'closeAllPositions': false,
|
|
103727
|
+
'closePosition': true,
|
|
103588
103728
|
'createOrder': true,
|
|
103589
103729
|
'createOrders': true,
|
|
103590
103730
|
'fetchAccounts': true,
|
|
@@ -106440,6 +106580,51 @@ class cryptocom extends _abstract_cryptocom_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
106440
106580
|
}
|
|
106441
106581
|
return returnString;
|
|
106442
106582
|
}
|
|
106583
|
+
async closePosition(symbol, side = undefined, params = {}) {
|
|
106584
|
+
/**
|
|
106585
|
+
* @method
|
|
106586
|
+
* @name cryptocom#closePositions
|
|
106587
|
+
* @description closes open positions for a market
|
|
106588
|
+
* @see https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-close-position
|
|
106589
|
+
* @param {string} symbol Unified CCXT market symbol
|
|
106590
|
+
* @param {string} [marginMode] not used by cryptocom.closePositions
|
|
106591
|
+
* @param {string} [side] not used by cryptocom.closePositions
|
|
106592
|
+
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
106593
|
+
*
|
|
106594
|
+
* EXCHANGE SPECIFIC PARAMETERS
|
|
106595
|
+
* @param {string} [params.type] LIMIT or MARKET
|
|
106596
|
+
* @param {number} [params.price] for limit orders only
|
|
106597
|
+
* @returns {object[]} [A list of position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
106598
|
+
*/
|
|
106599
|
+
await this.loadMarkets();
|
|
106600
|
+
const market = this.market(symbol);
|
|
106601
|
+
const request = {
|
|
106602
|
+
'instrument_name': market['id'],
|
|
106603
|
+
'type': 'MARKET',
|
|
106604
|
+
};
|
|
106605
|
+
const type = this.safeStringUpper(params, 'type');
|
|
106606
|
+
const price = this.safeString(params, 'price');
|
|
106607
|
+
if (type !== undefined) {
|
|
106608
|
+
request['type'] = type;
|
|
106609
|
+
}
|
|
106610
|
+
if (price !== undefined) {
|
|
106611
|
+
request['price'] = this.priceToPrecision(market['symbol'], price);
|
|
106612
|
+
}
|
|
106613
|
+
const response = await this.v1PrivatePostPrivateClosePosition(this.extend(request, params));
|
|
106614
|
+
//
|
|
106615
|
+
// {
|
|
106616
|
+
// "id" : 1700830813298,
|
|
106617
|
+
// "method" : "private/close-position",
|
|
106618
|
+
// "code" : 0,
|
|
106619
|
+
// "result" : {
|
|
106620
|
+
// "client_oid" : "179a909d-5614-655b-0d0e-9e85c9a25c85",
|
|
106621
|
+
// "order_id" : "6142909897021751347"
|
|
106622
|
+
// }
|
|
106623
|
+
// }
|
|
106624
|
+
//
|
|
106625
|
+
const result = this.safeValue(response, 'result');
|
|
106626
|
+
return this.parseOrder(result, market);
|
|
106627
|
+
}
|
|
106443
106628
|
sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
106444
106629
|
const type = this.safeString(api, 0);
|
|
106445
106630
|
const access = this.safeString(api, 1);
|
|
@@ -139794,14 +139979,16 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
139794
139979
|
// "margin_mode": "cross",
|
|
139795
139980
|
// "margin_account": "USDT",
|
|
139796
139981
|
// "margin_asset": "USDT",
|
|
139797
|
-
// "margin_balance":
|
|
139798
|
-
// "
|
|
139799
|
-
// "
|
|
139800
|
-
// "
|
|
139801
|
-
// "
|
|
139802
|
-
// "
|
|
139803
|
-
// "
|
|
139804
|
-
// "
|
|
139982
|
+
// "margin_balance": 49.874186030200000000,
|
|
139983
|
+
// "money_in": 50,
|
|
139984
|
+
// "money_out": 0,
|
|
139985
|
+
// "margin_static": 49.872786030200000000,
|
|
139986
|
+
// "margin_position": 6.180000000000000000,
|
|
139987
|
+
// "margin_frozen": 6.000000000000000000,
|
|
139988
|
+
// "profit_unreal": 0.001400000000000000,
|
|
139989
|
+
// "withdraw_available": 37.6927860302,
|
|
139990
|
+
// "risk_rate": 271.984050521072796934,
|
|
139991
|
+
// "new_risk_rate": 0.001858676950514399,
|
|
139805
139992
|
// "contract_detail": [
|
|
139806
139993
|
// {
|
|
139807
139994
|
// "symbol": "MANA",
|
|
@@ -139908,8 +140095,8 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
139908
140095
|
}
|
|
139909
140096
|
else {
|
|
139910
140097
|
const account = this.account();
|
|
139911
|
-
account['free'] = this.safeString(first, '
|
|
139912
|
-
account['
|
|
140098
|
+
account['free'] = this.safeString(first, 'withdraw_available');
|
|
140099
|
+
account['total'] = this.safeString(first, 'margin_balance');
|
|
139913
140100
|
const currencyId = this.safeString2(first, 'margin_asset', 'symbol');
|
|
139914
140101
|
const code = this.safeCurrencyCode(currencyId);
|
|
139915
140102
|
result[code] = account;
|
|
@@ -166538,6 +166725,9 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
166538
166725
|
'addMargin': false,
|
|
166539
166726
|
'cancelAllOrders': true,
|
|
166540
166727
|
'cancelOrder': true,
|
|
166728
|
+
'createMarketBuyOrderWithCost': true,
|
|
166729
|
+
'createMarketOrderWithCost': false,
|
|
166730
|
+
'createMarketSellOrderWithCost': false,
|
|
166541
166731
|
'createOrder': true,
|
|
166542
166732
|
'createReduceOnlyOrder': false,
|
|
166543
166733
|
'createStopLimitOrder': false,
|
|
@@ -166608,10 +166798,10 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
166608
166798
|
'contract': 'https://lbkperp.lbank.com',
|
|
166609
166799
|
},
|
|
166610
166800
|
'api2': 'https://api.lbkex.com',
|
|
166611
|
-
'www': 'https://www.lbank.
|
|
166612
|
-
'doc': 'https://www.lbank.
|
|
166613
|
-
'fees': 'https://
|
|
166614
|
-
'referral': 'https://www.lbank.
|
|
166801
|
+
'www': 'https://www.lbank.com',
|
|
166802
|
+
'doc': 'https://www.lbank.com/en-US/docs/index.html',
|
|
166803
|
+
'fees': 'https://support.lbank.site/hc/en-gb/articles/900000535703-Trading-Fees-From-14-00-on-April-7-2020-UTC-8-',
|
|
166804
|
+
'referral': 'https://www.lbank.com/login/?icode=7QCY',
|
|
166615
166805
|
},
|
|
166616
166806
|
'api': {
|
|
166617
166807
|
'spot': {
|
|
@@ -166799,7 +166989,7 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
166799
166989
|
* @method
|
|
166800
166990
|
* @name lbank2#fetchTime
|
|
166801
166991
|
* @description fetches the current integer timestamp in milliseconds from the exchange server
|
|
166802
|
-
* @see https://www.lbank.
|
|
166992
|
+
* @see https://www.lbank.com/en-US/docs/index.html#get-timestamp
|
|
166803
166993
|
* @see https://www.lbank.com/en-US/docs/contract.html#get-the-current-time
|
|
166804
166994
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
166805
166995
|
* @returns {int} the current integer timestamp in milliseconds from the exchange server
|
|
@@ -167094,7 +167284,7 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
167094
167284
|
* @method
|
|
167095
167285
|
* @name lbank2#fetchTicker
|
|
167096
167286
|
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
167097
|
-
* @see https://www.lbank.
|
|
167287
|
+
* @see https://www.lbank.com/en-US/docs/index.html#query-current-market-data-new
|
|
167098
167288
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
167099
167289
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
167100
167290
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -167139,7 +167329,7 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
167139
167329
|
* @method
|
|
167140
167330
|
* @name lbank2#fetchTickers
|
|
167141
167331
|
* @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
|
167142
|
-
* @see https://www.lbank.
|
|
167332
|
+
* @see https://www.lbank.com/en-US/docs/index.html#query-current-market-data-new
|
|
167143
167333
|
* @see https://www.lbank.com/en-US/docs/contract.html#query-contract-market-list
|
|
167144
167334
|
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
167145
167335
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -167219,7 +167409,7 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
167219
167409
|
* @method
|
|
167220
167410
|
* @name lbank2#fetchOrderBook
|
|
167221
167411
|
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
167222
|
-
* @see https://www.lbank.
|
|
167412
|
+
* @see https://www.lbank.com/en-US/docs/index.html#query-market-depth
|
|
167223
167413
|
* @see https://www.lbank.com/en-US/docs/contract.html#get-handicap
|
|
167224
167414
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
167225
167415
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
@@ -167408,8 +167598,8 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
167408
167598
|
* @method
|
|
167409
167599
|
* @name lbank2#fetchTrades
|
|
167410
167600
|
* @description get the list of most recent trades for a particular symbol
|
|
167411
|
-
* @see https://www.lbank.
|
|
167412
|
-
* @see https://www.lbank.
|
|
167601
|
+
* @see https://www.lbank.com/en-US/docs/index.html#query-historical-transactions
|
|
167602
|
+
* @see https://www.lbank.com/en-US/docs/index.html#recent-transactions-list
|
|
167413
167603
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
167414
167604
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
167415
167605
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
@@ -167481,7 +167671,7 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
167481
167671
|
* @method
|
|
167482
167672
|
* @name lbank2#fetchOHLCV
|
|
167483
167673
|
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
167484
|
-
* @see https://www.lbank.
|
|
167674
|
+
* @see https://www.lbank.com/en-US/docs/index.html#query-k-bar-data
|
|
167485
167675
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
167486
167676
|
* @param {string} timeframe the length of time each candle represents
|
|
167487
167677
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
@@ -167666,9 +167856,9 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
167666
167856
|
* @method
|
|
167667
167857
|
* @name lbank2#fetchBalance
|
|
167668
167858
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
167669
|
-
* @see https://www.lbank.
|
|
167670
|
-
* @see https://www.lbank.
|
|
167671
|
-
* @see https://www.lbank.
|
|
167859
|
+
* @see https://www.lbank.com/en-US/docs/index.html#asset-information
|
|
167860
|
+
* @see https://www.lbank.com/en-US/docs/index.html#account-information
|
|
167861
|
+
* @see https://www.lbank.com/en-US/docs/index.html#get-all-coins-information
|
|
167672
167862
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
167673
167863
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
167674
167864
|
*/
|
|
@@ -167733,7 +167923,7 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
167733
167923
|
* @method
|
|
167734
167924
|
* @name lbank2#fetchTradingFee
|
|
167735
167925
|
* @description fetch the trading fees for a market
|
|
167736
|
-
* @see https://www.lbank.
|
|
167926
|
+
* @see https://www.lbank.com/en-US/docs/index.html#transaction-fee-rate-query
|
|
167737
167927
|
* @param {string} symbol unified market symbol
|
|
167738
167928
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
167739
167929
|
* @returns {object} a [fee structure]{@link https://docs.ccxt.com/#/?id=fee-structure}
|
|
@@ -167747,7 +167937,7 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
167747
167937
|
* @method
|
|
167748
167938
|
* @name lbank2#fetchTradingFees
|
|
167749
167939
|
* @description fetch the trading fees for multiple markets
|
|
167750
|
-
* @see https://www.lbank.
|
|
167940
|
+
* @see https://www.lbank.com/en-US/docs/index.html#transaction-fee-rate-query
|
|
167751
167941
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
167752
167942
|
* @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
|
|
167753
167943
|
*/
|
|
@@ -167763,13 +167953,33 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
167763
167953
|
}
|
|
167764
167954
|
return result;
|
|
167765
167955
|
}
|
|
167956
|
+
async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
|
|
167957
|
+
/**
|
|
167958
|
+
* @method
|
|
167959
|
+
* @name lbank#createMarketBuyOrderWithCost
|
|
167960
|
+
* @description create a market buy order by providing the symbol and cost
|
|
167961
|
+
* @see https://www.lbank.com/en-US/docs/index.html#place-order
|
|
167962
|
+
* @see https://www.lbank.com/en-US/docs/index.html#place-an-order
|
|
167963
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
167964
|
+
* @param {float} cost how much you want to trade in units of the quote currency
|
|
167965
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
167966
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
167967
|
+
*/
|
|
167968
|
+
await this.loadMarkets();
|
|
167969
|
+
const market = this.market(symbol);
|
|
167970
|
+
if (!market['spot']) {
|
|
167971
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' createMarketBuyOrderWithCost() supports spot orders only');
|
|
167972
|
+
}
|
|
167973
|
+
params['createMarketBuyOrderRequiresPrice'] = false;
|
|
167974
|
+
return await this.createOrder(symbol, 'market', 'buy', cost, undefined, params);
|
|
167975
|
+
}
|
|
167766
167976
|
async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
|
|
167767
167977
|
/**
|
|
167768
167978
|
* @method
|
|
167769
167979
|
* @name lbank2#createOrder
|
|
167770
167980
|
* @description create a trade order
|
|
167771
|
-
* @see https://www.lbank.
|
|
167772
|
-
* @see https://www.lbank.
|
|
167981
|
+
* @see https://www.lbank.com/en-US/docs/index.html#place-order
|
|
167982
|
+
* @see https://www.lbank.com/en-US/docs/index.html#place-an-order
|
|
167773
167983
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
167774
167984
|
* @param {string} type 'market' or 'limit'
|
|
167775
167985
|
* @param {string} side 'buy' or 'sell'
|
|
@@ -167814,21 +168024,30 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
167814
168024
|
}
|
|
167815
168025
|
else if (side === 'buy') {
|
|
167816
168026
|
request['type'] = side + '_' + 'market';
|
|
167817
|
-
|
|
168027
|
+
let quoteAmount = undefined;
|
|
168028
|
+
let createMarketBuyOrderRequiresPrice = true;
|
|
168029
|
+
[createMarketBuyOrderRequiresPrice, params] = this.handleOptionAndParams(params, 'createOrder', 'createMarketBuyOrderRequiresPrice', true);
|
|
168030
|
+
const cost = this.safeNumber(params, 'cost');
|
|
168031
|
+
params = this.omit(params, 'cost');
|
|
168032
|
+
if (cost !== undefined) {
|
|
168033
|
+
quoteAmount = this.costToPrecision(symbol, cost);
|
|
168034
|
+
}
|
|
168035
|
+
else if (createMarketBuyOrderRequiresPrice) {
|
|
167818
168036
|
if (price === undefined) {
|
|
167819
|
-
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder(this.id +
|
|
168037
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder(this.id + ' createOrder() requires the price argument for market buy orders to calculate the total cost to spend (amount * price), alternatively set the createMarketBuyOrderRequiresPrice option or param to false and pass the cost to spend in the amount argument');
|
|
167820
168038
|
}
|
|
167821
168039
|
else {
|
|
167822
168040
|
const amountString = this.numberToString(amount);
|
|
167823
168041
|
const priceString = this.numberToString(price);
|
|
167824
|
-
const
|
|
167825
|
-
|
|
167826
|
-
request['price'] = this.priceToPrecision(symbol, cost);
|
|
168042
|
+
const costRequest = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringMul(amountString, priceString);
|
|
168043
|
+
quoteAmount = this.costToPrecision(symbol, costRequest);
|
|
167827
168044
|
}
|
|
167828
168045
|
}
|
|
167829
168046
|
else {
|
|
167830
|
-
|
|
168047
|
+
quoteAmount = this.costToPrecision(symbol, amount);
|
|
167831
168048
|
}
|
|
168049
|
+
// market buys require filling the price param instead of the amount param, for market buys the price is treated as the cost by lbank
|
|
168050
|
+
request['price'] = quoteAmount;
|
|
167832
168051
|
}
|
|
167833
168052
|
}
|
|
167834
168053
|
if (clientOrderId !== undefined) {
|
|
@@ -168000,8 +168219,8 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
168000
168219
|
* @method
|
|
168001
168220
|
* @name lbank2#fetchOrder
|
|
168002
168221
|
* @description fetches information on an order made by the user
|
|
168003
|
-
* @see https://www.lbank.
|
|
168004
|
-
* @see https://www.lbank.
|
|
168222
|
+
* @see https://www.lbank.com/en-US/docs/index.html#query-order
|
|
168223
|
+
* @see https://www.lbank.com/en-US/docs/index.html#query-order-new
|
|
168005
168224
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
168006
168225
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
168007
168226
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
@@ -168104,7 +168323,7 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
168104
168323
|
* @method
|
|
168105
168324
|
* @name lbank2#fetchMyTrades
|
|
168106
168325
|
* @description fetch all trades made by the user
|
|
168107
|
-
* @see https://www.lbank.
|
|
168326
|
+
* @see https://www.lbank.com/en-US/docs/index.html#past-transaction-details
|
|
168108
168327
|
* @param {string} symbol unified market symbol
|
|
168109
168328
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
168110
168329
|
* @param {int} [limit] the maximum number of trade structures to retrieve
|
|
@@ -168163,7 +168382,7 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
168163
168382
|
* @method
|
|
168164
168383
|
* @name lbank2#fetchOrders
|
|
168165
168384
|
* @description fetches information on multiple orders made by the user
|
|
168166
|
-
* @see https://www.lbank.
|
|
168385
|
+
* @see https://www.lbank.com/en-US/docs/index.html#query-all-orders
|
|
168167
168386
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
168168
168387
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
168169
168388
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
@@ -168223,7 +168442,7 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
168223
168442
|
* @method
|
|
168224
168443
|
* @name lbank2#fetchOpenOrders
|
|
168225
168444
|
* @description fetch all unfilled currently open orders
|
|
168226
|
-
* @see https://www.lbank.
|
|
168445
|
+
* @see https://www.lbank.com/en-US/docs/index.html#current-pending-order
|
|
168227
168446
|
* @param {string} symbol unified market symbol
|
|
168228
168447
|
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
168229
168448
|
* @param {int} [limit] the maximum number of open order structures to retrieve
|
|
@@ -168280,7 +168499,7 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
168280
168499
|
* @method
|
|
168281
168500
|
* @name lbank2#cancelOrder
|
|
168282
168501
|
* @description cancels an open order
|
|
168283
|
-
* @see https://www.lbank.
|
|
168502
|
+
* @see https://www.lbank.com/en-US/docs/index.html#cancel-order-new
|
|
168284
168503
|
* @param {string} id order id
|
|
168285
168504
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
168286
168505
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -168322,7 +168541,7 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
168322
168541
|
* @method
|
|
168323
168542
|
* @name lbank2#cancelAllOrders
|
|
168324
168543
|
* @description cancel all open orders in a market
|
|
168325
|
-
* @see https://www.lbank.
|
|
168544
|
+
* @see https://www.lbank.com/en-US/docs/index.html#cancel-all-pending-orders-for-a-single-trading-pair
|
|
168326
168545
|
* @param {string} symbol unified market symbol of the market to cancel orders in
|
|
168327
168546
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
168328
168547
|
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
@@ -168369,8 +168588,8 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
168369
168588
|
* @method
|
|
168370
168589
|
* @name lbank2#fetchDepositAddress
|
|
168371
168590
|
* @description fetch the deposit address for a currency associated with this account
|
|
168372
|
-
* @see https://www.lbank.
|
|
168373
|
-
* @see https://www.lbank.
|
|
168591
|
+
* @see https://www.lbank.com/en-US/docs/index.html#get-deposit-address
|
|
168592
|
+
* @see https://www.lbank.com/en-US/docs/index.html#the-user-obtains-the-deposit-address
|
|
168374
168593
|
* @param {string} code unified currency code
|
|
168375
168594
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
168376
168595
|
* @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
|
|
@@ -168468,7 +168687,7 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
168468
168687
|
* @method
|
|
168469
168688
|
* @name lbank2#withdraw
|
|
168470
168689
|
* @description make a withdrawal
|
|
168471
|
-
* @see https://www.lbank.
|
|
168690
|
+
* @see https://www.lbank.com/en-US/docs/index.html#withdrawal
|
|
168472
168691
|
* @param {string} code unified currency code
|
|
168473
168692
|
* @param {float} amount the amount to withdraw
|
|
168474
168693
|
* @param {string} address the address to withdraw to
|
|
@@ -168634,7 +168853,7 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
168634
168853
|
* @method
|
|
168635
168854
|
* @name lbank2#fetchDeposits
|
|
168636
168855
|
* @description fetch all deposits made to an account
|
|
168637
|
-
* @see https://www.lbank.
|
|
168856
|
+
* @see https://www.lbank.com/en-US/docs/index.html#get-recharge-history
|
|
168638
168857
|
* @param {string} code unified currency code
|
|
168639
168858
|
* @param {int} [since] the earliest time in ms to fetch deposits for
|
|
168640
168859
|
* @param {int} [limit] the maximum number of deposits structures to retrieve
|
|
@@ -168687,7 +168906,7 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
168687
168906
|
* @method
|
|
168688
168907
|
* @name lbank2#fetchWithdrawals
|
|
168689
168908
|
* @description fetch all withdrawals made from an account
|
|
168690
|
-
* @see https://www.lbank.
|
|
168909
|
+
* @see https://www.lbank.com/en-US/docs/index.html#get-withdrawal-history
|
|
168691
168910
|
* @param {string} code unified currency code
|
|
168692
168911
|
* @param {int} [since] the earliest time in ms to fetch withdrawals for
|
|
168693
168912
|
* @param {int} [limit] the maximum number of withdrawals structures to retrieve
|
|
@@ -168890,8 +169109,8 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
168890
169109
|
* @method
|
|
168891
169110
|
* @name lbank2#fetchDepositWithdrawFees
|
|
168892
169111
|
* @description when using private endpoint, only returns information for currencies with non-zero balance, use public method by specifying this.options['fetchDepositWithdrawFees']['method'] = 'fetchPublicDepositWithdrawFees'
|
|
168893
|
-
* @see https://www.lbank.
|
|
168894
|
-
* @see https://www.lbank.
|
|
169112
|
+
* @see https://www.lbank.com/en-US/docs/index.html#get-all-coins-information
|
|
169113
|
+
* @see https://www.lbank.com/en-US/docs/index.html#withdrawal-configurations
|
|
168895
169114
|
* @param {string[]|undefined} codes array of unified currency codes
|
|
168896
169115
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
168897
169116
|
* @returns {object} a list of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure}
|
|
@@ -186021,6 +186240,8 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
186021
186240
|
'cancelAllOrders': false,
|
|
186022
186241
|
'cancelOrder': true,
|
|
186023
186242
|
'cancelOrders': true,
|
|
186243
|
+
'closeAllPositions': false,
|
|
186244
|
+
'closePosition': true,
|
|
186024
186245
|
'createDepositAddress': false,
|
|
186025
186246
|
'createMarketBuyOrderWithCost': true,
|
|
186026
186247
|
'createMarketSellOrderWithCost': true,
|
|
@@ -189121,7 +189342,13 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
189121
189342
|
});
|
|
189122
189343
|
}
|
|
189123
189344
|
}
|
|
189124
|
-
|
|
189345
|
+
let response = undefined;
|
|
189346
|
+
if (method === 'privatePostTradeCancelAlgos') {
|
|
189347
|
+
response = await this.privatePostTradeCancelAlgos(request); // * dont extend with params, otherwise ARRAY will be turned into OBJECT
|
|
189348
|
+
}
|
|
189349
|
+
else {
|
|
189350
|
+
response = await this.privatePostTradeCancelBatchOrders(request); // * dont extend with params, otherwise ARRAY will be turned into OBJECT
|
|
189351
|
+
}
|
|
189125
189352
|
//
|
|
189126
189353
|
// {
|
|
189127
189354
|
// "code": "0",
|
|
@@ -189420,7 +189647,13 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
189420
189647
|
}
|
|
189421
189648
|
}
|
|
189422
189649
|
const query = this.omit(params, ['method', 'clOrdId', 'clientOrderId', 'stop']);
|
|
189423
|
-
|
|
189650
|
+
let response = undefined;
|
|
189651
|
+
if (method === 'privateGetTradeOrderAlgo') {
|
|
189652
|
+
response = await this.privateGetTradeOrderAlgo(this.extend(request, query));
|
|
189653
|
+
}
|
|
189654
|
+
else {
|
|
189655
|
+
response = await this.privateGetTradeOrder(this.extend(request, query));
|
|
189656
|
+
}
|
|
189424
189657
|
//
|
|
189425
189658
|
// Spot and Swap
|
|
189426
189659
|
//
|
|
@@ -189579,7 +189812,13 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
189579
189812
|
}
|
|
189580
189813
|
}
|
|
189581
189814
|
const query = this.omit(params, ['method', 'stop']);
|
|
189582
|
-
|
|
189815
|
+
let response = undefined;
|
|
189816
|
+
if (method === 'privateGetTradeOrdersAlgoPending') {
|
|
189817
|
+
response = await this.privateGetTradeOrdersAlgoPending(this.extend(request, query));
|
|
189818
|
+
}
|
|
189819
|
+
else {
|
|
189820
|
+
response = await this.privateGetTradeOrdersPending(this.extend(request, query));
|
|
189821
|
+
}
|
|
189583
189822
|
//
|
|
189584
189823
|
// {
|
|
189585
189824
|
// "code": "0",
|
|
@@ -189751,7 +189990,13 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
189751
189990
|
}
|
|
189752
189991
|
}
|
|
189753
189992
|
const send = this.omit(query, ['method', 'stop', 'ordType']);
|
|
189754
|
-
|
|
189993
|
+
let response = undefined;
|
|
189994
|
+
if (method === 'privateGetTradeOrdersAlgoHistory') {
|
|
189995
|
+
response = await this.privateGetTradeOrdersAlgoHistory(this.extend(request, send));
|
|
189996
|
+
}
|
|
189997
|
+
else {
|
|
189998
|
+
response = await this.privateGetTradeOrdersHistory(this.extend(request, send));
|
|
189999
|
+
}
|
|
189755
190000
|
//
|
|
189756
190001
|
// {
|
|
189757
190002
|
// "code": "0",
|
|
@@ -189928,7 +190173,13 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
189928
190173
|
request['state'] = 'filled';
|
|
189929
190174
|
}
|
|
189930
190175
|
const send = this.omit(query, ['method', 'stop']);
|
|
189931
|
-
|
|
190176
|
+
let response = undefined;
|
|
190177
|
+
if (method === 'privateGetTradeOrdersAlgoHistory') {
|
|
190178
|
+
response = await this.privateGetTradeOrdersAlgoHistory(this.extend(request, send));
|
|
190179
|
+
}
|
|
190180
|
+
else {
|
|
190181
|
+
response = await this.privateGetTradeOrdersHistory(this.extend(request, send));
|
|
190182
|
+
}
|
|
189932
190183
|
//
|
|
189933
190184
|
// {
|
|
189934
190185
|
// "code": "0",
|
|
@@ -190181,7 +190432,16 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
190181
190432
|
request['ccy'] = currency['id'];
|
|
190182
190433
|
}
|
|
190183
190434
|
[request, params] = this.handleUntilOption('end', request, params);
|
|
190184
|
-
|
|
190435
|
+
let response = undefined;
|
|
190436
|
+
if (method === 'privateGetAccountBillsArchive') {
|
|
190437
|
+
response = await this.privateGetAccountBillsArchive(this.extend(request, query));
|
|
190438
|
+
}
|
|
190439
|
+
else if (method === 'privateGetAssetBills') {
|
|
190440
|
+
response = await this.privateGetAssetBills(this.extend(request, query));
|
|
190441
|
+
}
|
|
190442
|
+
else {
|
|
190443
|
+
response = await this.privateGetAccountBills(this.extend(request, query));
|
|
190444
|
+
}
|
|
190185
190445
|
//
|
|
190186
190446
|
// privateGetAccountBills, privateGetAccountBillsArchive
|
|
190187
190447
|
//
|
|
@@ -191093,7 +191353,13 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
191093
191353
|
}
|
|
191094
191354
|
const fetchPositionsOptions = this.safeValue(this.options, 'fetchPositions', {});
|
|
191095
191355
|
const method = this.safeString(fetchPositionsOptions, 'method', 'privateGetAccountPositions');
|
|
191096
|
-
|
|
191356
|
+
let response = undefined;
|
|
191357
|
+
if (method === 'privateGetAccountPositionsHistory') {
|
|
191358
|
+
response = await this.privateGetAccountPositionsHistory(this.extend(request, params));
|
|
191359
|
+
}
|
|
191360
|
+
else {
|
|
191361
|
+
response = await this.privateGetAccountPositions(this.extend(request, params));
|
|
191362
|
+
}
|
|
191097
191363
|
//
|
|
191098
191364
|
// {
|
|
191099
191365
|
// "code": "0",
|
|
@@ -193106,6 +193372,74 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
193106
193372
|
'info': greeks,
|
|
193107
193373
|
};
|
|
193108
193374
|
}
|
|
193375
|
+
async closePosition(symbol, side = undefined, params = {}) {
|
|
193376
|
+
/**
|
|
193377
|
+
* @method
|
|
193378
|
+
* @name okx#closePosition
|
|
193379
|
+
* @description closes open positions for a market
|
|
193380
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-close-positions
|
|
193381
|
+
* @param {string} symbol Unified CCXT market symbol
|
|
193382
|
+
* @param {string} [side] 'buy' or 'sell', leave as undefined in net mode
|
|
193383
|
+
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
193384
|
+
* @param {string} [params.clientOrderId] a unique identifier for the order
|
|
193385
|
+
* @param {string} [params.marginMode] 'cross' or 'isolated', default is 'cross;
|
|
193386
|
+
* @param {string} [params.code] *required in the case of closing cross MARGIN position for Single-currency margin* margin currency
|
|
193387
|
+
*
|
|
193388
|
+
* EXCHANGE SPECIFIC PARAMETERS
|
|
193389
|
+
* @param {boolean} [params.autoCxl] whether any pending orders for closing out needs to be automatically canceled when close position via a market order. false or true, the default is false
|
|
193390
|
+
* @param {string} [params.tag] order tag a combination of case-sensitive alphanumerics, all numbers, or all letters of up to 16 characters
|
|
193391
|
+
* @returns {[object]} [A list of position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
193392
|
+
*/
|
|
193393
|
+
await this.loadMarkets();
|
|
193394
|
+
const market = this.market(symbol);
|
|
193395
|
+
const clientOrderId = this.safeString(params, 'clientOrderId');
|
|
193396
|
+
const code = this.safeString(params, 'code');
|
|
193397
|
+
let marginMode = undefined;
|
|
193398
|
+
[marginMode, params] = this.handleMarginModeAndParams('closePosition', params, 'cross');
|
|
193399
|
+
const request = {
|
|
193400
|
+
'instId': market['id'],
|
|
193401
|
+
'mgnMode': marginMode,
|
|
193402
|
+
};
|
|
193403
|
+
if (side !== undefined) {
|
|
193404
|
+
if ((side === 'buy')) {
|
|
193405
|
+
request['posSide'] = 'long';
|
|
193406
|
+
}
|
|
193407
|
+
else if (side === 'sell') {
|
|
193408
|
+
request['posSide'] = 'short';
|
|
193409
|
+
}
|
|
193410
|
+
else {
|
|
193411
|
+
request['posSide'] = side;
|
|
193412
|
+
}
|
|
193413
|
+
}
|
|
193414
|
+
if (clientOrderId !== undefined) {
|
|
193415
|
+
request['clOrdId'] = clientOrderId;
|
|
193416
|
+
}
|
|
193417
|
+
if (code !== undefined) {
|
|
193418
|
+
const currency = this.currency(code);
|
|
193419
|
+
request['ccy'] = currency['id'];
|
|
193420
|
+
}
|
|
193421
|
+
const response = await this.privatePostTradeClosePosition(this.extend(request, params));
|
|
193422
|
+
//
|
|
193423
|
+
// {
|
|
193424
|
+
// "code": "1",
|
|
193425
|
+
// "data": [
|
|
193426
|
+
// {
|
|
193427
|
+
// "clOrdId":"e847386590ce4dBCe903bbc394dc88bf",
|
|
193428
|
+
// "ordId":"",
|
|
193429
|
+
// "sCode":"51000",
|
|
193430
|
+
// "sMsg":"Parameter posSide error ",
|
|
193431
|
+
// "tag":"e847386590ce4dBC"
|
|
193432
|
+
// }
|
|
193433
|
+
// ],
|
|
193434
|
+
// "inTime": "1701877077101064",
|
|
193435
|
+
// "msg": "All operations failed",
|
|
193436
|
+
// "outTime": "1701877077102579"
|
|
193437
|
+
// }
|
|
193438
|
+
//
|
|
193439
|
+
const data = this.safeValue(response, 'data');
|
|
193440
|
+
const order = this.safeValue(data, 0);
|
|
193441
|
+
return this.parseOrder(order, market);
|
|
193442
|
+
}
|
|
193109
193443
|
handleErrors(httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody) {
|
|
193110
193444
|
if (!response) {
|
|
193111
193445
|
return undefined; // fallback to default error handler
|
|
@@ -205895,7 +206229,7 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
205895
206229
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
205896
206230
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
205897
206231
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
205898
|
-
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com
|
|
206232
|
+
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
205899
206233
|
*/
|
|
205900
206234
|
await this.loadMarkets();
|
|
205901
206235
|
symbols = this.marketSymbols(symbols, undefined, false, true, true);
|
|
@@ -208996,7 +209330,7 @@ class bingx extends _bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
208996
209330
|
* @see https://bingx-api.github.io/docs/#/swapV2/socket/account.html#Account%20balance%20and%20position%20update%20push
|
|
208997
209331
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
208998
209332
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
208999
|
-
* @returns {object} a [balance structure]{@link https://docs.ccxt.com
|
|
209333
|
+
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
209000
209334
|
*/
|
|
209001
209335
|
await this.loadMarkets();
|
|
209002
209336
|
await this.authenticate();
|
|
@@ -211927,7 +212261,7 @@ class bitget extends _bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
211927
212261
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
211928
212262
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
211929
212263
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
211930
|
-
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com
|
|
212264
|
+
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
211931
212265
|
*/
|
|
211932
212266
|
const symbolsLength = symbols.length;
|
|
211933
212267
|
if (symbolsLength === 0) {
|
|
@@ -220934,7 +221268,7 @@ class bybit extends _bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
220934
221268
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
220935
221269
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
220936
221270
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
220937
|
-
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com
|
|
221271
|
+
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
220938
221272
|
*/
|
|
220939
221273
|
await this.loadMarkets();
|
|
220940
221274
|
symbols = this.marketSymbols(symbols);
|
|
@@ -222575,7 +222909,7 @@ class cex extends _cex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
222575
222909
|
* @see https://docs.cex.io/#ws-api-get-balance
|
|
222576
222910
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
222577
222911
|
* @param {object} [params] extra parameters specific to the cex api endpoint
|
|
222578
|
-
* @returns {object} a [balance structure]{@link https://docs.ccxt.com
|
|
222912
|
+
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
222579
222913
|
*/
|
|
222580
222914
|
await this.loadMarkets();
|
|
222581
222915
|
await this.authenticate();
|
|
@@ -224459,7 +224793,7 @@ class coinbasepro extends _coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/* ["defau
|
|
|
224459
224793
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
224460
224794
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
224461
224795
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
224462
|
-
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com
|
|
224796
|
+
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
224463
224797
|
*/
|
|
224464
224798
|
const symbolsLength = symbols.length;
|
|
224465
224799
|
if (symbolsLength === 0) {
|
|
@@ -226559,7 +226893,7 @@ class cryptocom extends _cryptocom_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
226559
226893
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
226560
226894
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
226561
226895
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
226562
|
-
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com
|
|
226896
|
+
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
226563
226897
|
*/
|
|
226564
226898
|
await this.loadMarkets();
|
|
226565
226899
|
symbols = this.marketSymbols(symbols);
|
|
@@ -229824,7 +230158,7 @@ class gate extends _gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
229824
230158
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
229825
230159
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
229826
230160
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
229827
|
-
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com
|
|
230161
|
+
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
229828
230162
|
*/
|
|
229829
230163
|
await this.loadMarkets();
|
|
229830
230164
|
symbols = this.marketSymbols(symbols);
|
|
@@ -240602,7 +240936,7 @@ class kucoin extends _kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
240602
240936
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
240603
240937
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
240604
240938
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
240605
|
-
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com
|
|
240939
|
+
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
240606
240940
|
*/
|
|
240607
240941
|
const symbolsLength = symbols.length;
|
|
240608
240942
|
if (symbolsLength === 0) {
|
|
@@ -241691,7 +242025,7 @@ class kucoinfutures extends _kucoinfutures_js__WEBPACK_IMPORTED_MODULE_0__/* ["d
|
|
|
241691
242025
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
241692
242026
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
241693
242027
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
241694
|
-
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com
|
|
242028
|
+
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
241695
242029
|
*/
|
|
241696
242030
|
const symbolsLength = symbols.length;
|
|
241697
242031
|
if (symbolsLength === 0) {
|
|
@@ -245289,7 +245623,7 @@ class okx extends _okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
245289
245623
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
245290
245624
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
245291
245625
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
245292
|
-
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com
|
|
245626
|
+
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
245293
245627
|
*/
|
|
245294
245628
|
const symbolsLength = symbols.length;
|
|
245295
245629
|
if (symbolsLength === 0) {
|
|
@@ -288633,7 +288967,7 @@ SOFTWARE.
|
|
|
288633
288967
|
|
|
288634
288968
|
//-----------------------------------------------------------------------------
|
|
288635
288969
|
// this is updated by vss.js when building
|
|
288636
|
-
const version = '4.1.
|
|
288970
|
+
const version = '4.1.83';
|
|
288637
288971
|
_src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
|
|
288638
288972
|
//-----------------------------------------------------------------------------
|
|
288639
288973
|
|