ccxt 4.2.21 → 4.2.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/ccxt.browser.js +574 -81
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/bigone.js +1 -0
- package/dist/cjs/src/binance.js +14 -3
- package/dist/cjs/src/bitfinex2.js +89 -0
- package/dist/cjs/src/bitget.js +11 -1
- package/dist/cjs/src/bitrue.js +1 -0
- package/dist/cjs/src/bybit.js +57 -9
- package/dist/cjs/src/coinbasepro.js +1 -0
- package/dist/cjs/src/coinex.js +60 -14
- package/dist/cjs/src/deribit.js +164 -0
- package/dist/cjs/src/okcoin.js +3 -0
- package/dist/cjs/src/okx.js +81 -31
- package/dist/cjs/src/phemex.js +17 -5
- package/dist/cjs/src/poloniex.js +1 -0
- package/dist/cjs/src/pro/bequant.js +6 -1
- package/dist/cjs/src/pro/binance.js +8 -5
- package/dist/cjs/src/pro/binancecoinm.js +6 -1
- package/dist/cjs/src/pro/binanceus.js +6 -1
- package/dist/cjs/src/pro/bitcoincom.js +6 -1
- package/dist/cjs/src/pro/bitget.js +1 -1
- package/dist/cjs/src/pro/bitrue.js +6 -1
- package/dist/cjs/src/pro/hitbtc.js +6 -0
- package/dist/cjs/src/pro/okx.js +23 -5
- package/dist/cjs/src/woo.js +1 -1
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/binance.d.ts +3 -0
- package/js/src/abstract/binancecoinm.d.ts +3 -0
- package/js/src/abstract/binanceus.d.ts +4 -0
- package/js/src/abstract/binanceusdm.d.ts +3 -0
- package/js/src/bigone.js +1 -0
- package/js/src/binance.js +14 -3
- package/js/src/bitfinex2.d.ts +2 -0
- package/js/src/bitfinex2.js +89 -0
- package/js/src/bitget.js +11 -1
- package/js/src/bitrue.js +1 -0
- package/js/src/bybit.d.ts +2 -1
- package/js/src/bybit.js +57 -9
- package/js/src/coinbasepro.js +1 -0
- package/js/src/coinex.d.ts +1 -0
- package/js/src/coinex.js +60 -14
- package/js/src/deribit.d.ts +6 -1
- package/js/src/deribit.js +164 -0
- package/js/src/okcoin.js +3 -0
- package/js/src/okx.js +81 -31
- package/js/src/phemex.js +17 -5
- package/js/src/poloniex.js +1 -0
- package/js/src/pro/bequant.js +6 -1
- package/js/src/pro/binance.js +8 -5
- package/js/src/pro/binancecoinm.js +6 -1
- package/js/src/pro/binanceus.js +6 -1
- package/js/src/pro/bitcoincom.js +6 -1
- package/js/src/pro/bitget.js +1 -1
- package/js/src/pro/bitrue.js +6 -1
- package/js/src/pro/hitbtc.js +6 -0
- package/js/src/pro/okx.js +23 -5
- package/js/src/woo.js +1 -1
- package/jsdoc2md.js +38 -16
- package/package.json +4 -1
- package/skip-tests.json +4 -0
package/dist/ccxt.browser.js
CHANGED
|
@@ -15573,6 +15573,7 @@ class bigone extends _abstract_bigone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
15573
15573
|
'fetchCurrencies': true,
|
|
15574
15574
|
'fetchDepositAddress': true,
|
|
15575
15575
|
'fetchDeposits': true,
|
|
15576
|
+
'fetchFundingRate': false,
|
|
15576
15577
|
'fetchMarkets': true,
|
|
15577
15578
|
'fetchMyTrades': true,
|
|
15578
15579
|
'fetchOHLCV': true,
|
|
@@ -18064,6 +18065,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
18064
18065
|
'convert/exchangeInfo': 50,
|
|
18065
18066
|
'convert/assetInfo': 10,
|
|
18066
18067
|
'convert/orderStatus': 0.6667,
|
|
18068
|
+
'convert/limit/queryOpenOrders': 20.001,
|
|
18067
18069
|
'account/status': 0.1,
|
|
18068
18070
|
'account/apiTradingStatus': 0.1,
|
|
18069
18071
|
'account/apiRestrictions/ipRestriction': 0.1,
|
|
@@ -18335,6 +18337,8 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
18335
18337
|
'loan/vip/repay': 40.002,
|
|
18336
18338
|
'convert/getQuote': 1.3334,
|
|
18337
18339
|
'convert/acceptQuote': 3.3335,
|
|
18340
|
+
'convert/limit/placeOrder': 3.3335,
|
|
18341
|
+
'convert/limit/cancelOrder': 1.3334,
|
|
18338
18342
|
'portfolio/auto-collection': 150,
|
|
18339
18343
|
'portfolio/asset-collection': 6,
|
|
18340
18344
|
'portfolio/bnb-transfer': 150,
|
|
@@ -25721,12 +25725,20 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
25721
25725
|
/**
|
|
25722
25726
|
* @method
|
|
25723
25727
|
* @name binance#fetchPositions
|
|
25728
|
+
* @see https://binance-docs.github.io/apidocs/futures/en/#position-information-v2-user_data
|
|
25729
|
+
* @see https://binance-docs.github.io/apidocs/delivery/en/#position-information-user_data
|
|
25730
|
+
* @see https://binance-docs.github.io/apidocs/futures/en/#account-information-v2-user_data
|
|
25731
|
+
* @see https://binance-docs.github.io/apidocs/delivery/en/#account-information-user_data
|
|
25732
|
+
* @see https://binance-docs.github.io/apidocs/voptions/en/#option-position-information-user_data
|
|
25724
25733
|
* @description fetch all open positions
|
|
25725
|
-
* @param {string[]
|
|
25734
|
+
* @param {string[]} [symbols] list of unified market symbols
|
|
25726
25735
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
25736
|
+
* @param {string} [method] method name to call, "positionRisk", "account" or "option", default is "positionRisk"
|
|
25727
25737
|
* @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
25728
25738
|
*/
|
|
25729
|
-
const
|
|
25739
|
+
const defaultValue = this.safeString(this.options, 'fetchPositions', 'positionRisk');
|
|
25740
|
+
let defaultMethod = undefined;
|
|
25741
|
+
[defaultMethod, params] = this.handleOptionAndParams(params, 'fetchPositions', 'method', defaultValue);
|
|
25730
25742
|
if (defaultMethod === 'positionRisk') {
|
|
25731
25743
|
return await this.fetchPositionsRisk(symbols, params);
|
|
25732
25744
|
}
|
|
@@ -25737,7 +25749,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
25737
25749
|
return await this.fetchOptionPositions(symbols, params);
|
|
25738
25750
|
}
|
|
25739
25751
|
else {
|
|
25740
|
-
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + '.options["fetchPositions"] = "' + defaultMethod + '" is invalid, please choose between "account", "positionRisk" and "option"');
|
|
25752
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + '.options["fetchPositions"]/params["method"] = "' + defaultMethod + '" is invalid, please choose between "account", "positionRisk" and "option"');
|
|
25741
25753
|
}
|
|
25742
25754
|
}
|
|
25743
25755
|
async fetchAccountPositions(symbols = undefined, params = {}) {
|
|
@@ -36677,6 +36689,7 @@ class bitfinex2 extends _abstract_bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
36677
36689
|
'fetchMarkOHLCV': false,
|
|
36678
36690
|
'fetchMyTrades': true,
|
|
36679
36691
|
'fetchOHLCV': true,
|
|
36692
|
+
'fetchOpenInterest': true,
|
|
36680
36693
|
'fetchOpenOrder': true,
|
|
36681
36694
|
'fetchOpenOrders': true,
|
|
36682
36695
|
'fetchOrder': true,
|
|
@@ -39608,6 +39621,94 @@ class bitfinex2 extends _abstract_bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
39608
39621
|
'previousFundingDatetime': undefined,
|
|
39609
39622
|
};
|
|
39610
39623
|
}
|
|
39624
|
+
async fetchOpenInterest(symbol, params = {}) {
|
|
39625
|
+
/**
|
|
39626
|
+
* @method
|
|
39627
|
+
* @name bitfinex2#fetchOpenInterest
|
|
39628
|
+
* @description retrieves the open interest of a contract trading pair
|
|
39629
|
+
* @see https://docs.bitfinex.com/reference/rest-public-derivatives-status
|
|
39630
|
+
* @param {string} symbol unified CCXT market symbol
|
|
39631
|
+
* @param {object} [params] exchange specific parameters
|
|
39632
|
+
* @returns {object} an [open interest structure]{@link https://docs.ccxt.com/#/?id=open-interest-structure}
|
|
39633
|
+
*/
|
|
39634
|
+
await this.loadMarkets();
|
|
39635
|
+
const market = this.market(symbol);
|
|
39636
|
+
const request = {
|
|
39637
|
+
'keys': market['id'],
|
|
39638
|
+
};
|
|
39639
|
+
const response = await this.publicGetStatusDeriv(this.extend(request, params));
|
|
39640
|
+
//
|
|
39641
|
+
// [
|
|
39642
|
+
// [
|
|
39643
|
+
// "tXRPF0:USTF0", // market id
|
|
39644
|
+
// 1706256986000, // millisecond timestamp
|
|
39645
|
+
// null,
|
|
39646
|
+
// 0.512705, // derivative mid price
|
|
39647
|
+
// 0.512395, // underlying spot mid price
|
|
39648
|
+
// null,
|
|
39649
|
+
// 37671483.04, // insurance fund balance
|
|
39650
|
+
// null,
|
|
39651
|
+
// 1706284800000, // timestamp of next funding
|
|
39652
|
+
// 0.00002353, // accrued funding for next period
|
|
39653
|
+
// 317, // next funding step
|
|
39654
|
+
// null,
|
|
39655
|
+
// 0, // current funding
|
|
39656
|
+
// null,
|
|
39657
|
+
// null,
|
|
39658
|
+
// 0.5123016, // mark price
|
|
39659
|
+
// null,
|
|
39660
|
+
// null,
|
|
39661
|
+
// 2233562.03115, // open interest in contracts
|
|
39662
|
+
// null,
|
|
39663
|
+
// null,
|
|
39664
|
+
// null,
|
|
39665
|
+
// 0.0005, // average spread without funding payment
|
|
39666
|
+
// 0.0025 // funding payment cap
|
|
39667
|
+
// ]
|
|
39668
|
+
// ]
|
|
39669
|
+
//
|
|
39670
|
+
return this.parseOpenInterest(response[0], market);
|
|
39671
|
+
}
|
|
39672
|
+
parseOpenInterest(interest, market = undefined) {
|
|
39673
|
+
//
|
|
39674
|
+
// [
|
|
39675
|
+
// "tXRPF0:USTF0", // market id
|
|
39676
|
+
// 1706256986000, // millisecond timestamp
|
|
39677
|
+
// null,
|
|
39678
|
+
// 0.512705, // derivative mid price
|
|
39679
|
+
// 0.512395, // underlying spot mid price
|
|
39680
|
+
// null,
|
|
39681
|
+
// 37671483.04, // insurance fund balance
|
|
39682
|
+
// null,
|
|
39683
|
+
// 1706284800000, // timestamp of next funding
|
|
39684
|
+
// 0.00002353, // accrued funding for next period
|
|
39685
|
+
// 317, // next funding step
|
|
39686
|
+
// null,
|
|
39687
|
+
// 0, // current funding
|
|
39688
|
+
// null,
|
|
39689
|
+
// null,
|
|
39690
|
+
// 0.5123016, // mark price
|
|
39691
|
+
// null,
|
|
39692
|
+
// null,
|
|
39693
|
+
// 2233562.03115, // open interest in contracts
|
|
39694
|
+
// null,
|
|
39695
|
+
// null,
|
|
39696
|
+
// null,
|
|
39697
|
+
// 0.0005, // average spread without funding payment
|
|
39698
|
+
// 0.0025 // funding payment cap
|
|
39699
|
+
// ]
|
|
39700
|
+
//
|
|
39701
|
+
const timestamp = this.safeInteger(interest, 1);
|
|
39702
|
+
const marketId = this.safeString(interest, 0);
|
|
39703
|
+
return this.safeOpenInterest({
|
|
39704
|
+
'symbol': this.safeSymbol(marketId, market, undefined, 'swap'),
|
|
39705
|
+
'openInterestAmount': this.safeNumber(interest, 18),
|
|
39706
|
+
'openInterestValue': undefined,
|
|
39707
|
+
'timestamp': timestamp,
|
|
39708
|
+
'datetime': this.iso8601(timestamp),
|
|
39709
|
+
'info': interest,
|
|
39710
|
+
}, market);
|
|
39711
|
+
}
|
|
39611
39712
|
}
|
|
39612
39713
|
|
|
39613
39714
|
|
|
@@ -41576,15 +41677,21 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
41576
41677
|
'cancelOrders': true,
|
|
41577
41678
|
'closeAllPositions': true,
|
|
41578
41679
|
'closePosition': true,
|
|
41680
|
+
'createDepositAddress': false,
|
|
41579
41681
|
'createMarketBuyOrderWithCost': true,
|
|
41580
41682
|
'createMarketOrderWithCost': false,
|
|
41581
41683
|
'createMarketSellOrderWithCost': false,
|
|
41582
41684
|
'createOrder': true,
|
|
41583
41685
|
'createOrders': true,
|
|
41584
41686
|
'createOrderWithTakeProfitAndStopLoss': true,
|
|
41687
|
+
'createPostOnlyOrder': true,
|
|
41585
41688
|
'createReduceOnlyOrder': false,
|
|
41689
|
+
'createStopLimitOrder': true,
|
|
41586
41690
|
'createStopLossOrder': true,
|
|
41691
|
+
'createStopMarketOrder': true,
|
|
41692
|
+
'createStopOrder': true,
|
|
41587
41693
|
'createTakeProfitOrder': true,
|
|
41694
|
+
'createTrailingAmountOrder': false,
|
|
41588
41695
|
'createTrailingPercentOrder': true,
|
|
41589
41696
|
'createTriggerOrder': true,
|
|
41590
41697
|
'editOrder': true,
|
|
@@ -41602,6 +41709,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
41602
41709
|
'fetchDepositAddress': true,
|
|
41603
41710
|
'fetchDepositAddresses': false,
|
|
41604
41711
|
'fetchDeposits': true,
|
|
41712
|
+
'fetchDepositsWithdrawals': false,
|
|
41605
41713
|
'fetchDepositWithdrawFee': 'emulated',
|
|
41606
41714
|
'fetchDepositWithdrawFees': true,
|
|
41607
41715
|
'fetchFundingHistory': true,
|
|
@@ -41615,7 +41723,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
41615
41723
|
'fetchLeverage': true,
|
|
41616
41724
|
'fetchLeverageTiers': false,
|
|
41617
41725
|
'fetchLiquidations': false,
|
|
41618
|
-
'fetchMarginMode':
|
|
41726
|
+
'fetchMarginMode': false,
|
|
41619
41727
|
'fetchMarketLeverageTiers': true,
|
|
41620
41728
|
'fetchMarkets': true,
|
|
41621
41729
|
'fetchMarkOHLCV': true,
|
|
@@ -41640,8 +41748,10 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
41640
41748
|
'fetchTrades': true,
|
|
41641
41749
|
'fetchTradingFee': true,
|
|
41642
41750
|
'fetchTradingFees': true,
|
|
41751
|
+
'fetchTransactions': false,
|
|
41643
41752
|
'fetchTransfer': false,
|
|
41644
41753
|
'fetchTransfers': true,
|
|
41754
|
+
'fetchWithdrawAddresses': false,
|
|
41645
41755
|
'fetchWithdrawal': false,
|
|
41646
41756
|
'fetchWithdrawals': true,
|
|
41647
41757
|
'reduceMargin': true,
|
|
@@ -41650,6 +41760,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
41650
41760
|
'setLeverage': true,
|
|
41651
41761
|
'setMarginMode': true,
|
|
41652
41762
|
'setPositionMode': true,
|
|
41763
|
+
'signIn': false,
|
|
41653
41764
|
'transfer': true,
|
|
41654
41765
|
'withdraw': true,
|
|
41655
41766
|
},
|
|
@@ -60120,6 +60231,7 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
60120
60231
|
'fetchDepositsWithdrawals': false,
|
|
60121
60232
|
'fetchDepositWithdrawFee': 'emulated',
|
|
60122
60233
|
'fetchDepositWithdrawFees': true,
|
|
60234
|
+
'fetchFundingRate': false,
|
|
60123
60235
|
'fetchIsolatedBorrowRate': false,
|
|
60124
60236
|
'fetchIsolatedBorrowRates': false,
|
|
60125
60237
|
'fetchMarginMode': false,
|
|
@@ -77061,7 +77173,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
77061
77173
|
'closeAllPositions': false,
|
|
77062
77174
|
'closePosition': false,
|
|
77063
77175
|
'createMarketBuyOrderWithCost': true,
|
|
77064
|
-
'createMarketSellOrderWithCost':
|
|
77176
|
+
'createMarketSellOrderWithCost': true,
|
|
77065
77177
|
'createOrder': true,
|
|
77066
77178
|
'createOrders': true,
|
|
77067
77179
|
'createOrderWithTakeProfitAndStopLoss': true,
|
|
@@ -80491,8 +80603,30 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
80491
80603
|
if (!market['spot']) {
|
|
80492
80604
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' createMarketBuyOrderWithCost() supports spot orders only');
|
|
80493
80605
|
}
|
|
80494
|
-
|
|
80495
|
-
|
|
80606
|
+
return await this.createOrder(symbol, 'market', 'buy', cost, 1, params);
|
|
80607
|
+
}
|
|
80608
|
+
async createMarketSellOrderWithCost(symbol, cost, params = {}) {
|
|
80609
|
+
/**
|
|
80610
|
+
* @method
|
|
80611
|
+
* @name bybit#createMarkeSellOrderWithCost
|
|
80612
|
+
* @see https://bybit-exchange.github.io/docs/v5/order/create-order
|
|
80613
|
+
* @description create a market sell order by providing the symbol and cost
|
|
80614
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
80615
|
+
* @param {float} cost how much you want to trade in units of the quote currency
|
|
80616
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
80617
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
80618
|
+
*/
|
|
80619
|
+
await this.loadMarkets();
|
|
80620
|
+
const types = await this.isUnifiedEnabled();
|
|
80621
|
+
const enableUnifiedAccount = types[1];
|
|
80622
|
+
if (!enableUnifiedAccount) {
|
|
80623
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' createMarketSellOrderWithCost() supports UTA accounts only');
|
|
80624
|
+
}
|
|
80625
|
+
const market = this.market(symbol);
|
|
80626
|
+
if (!market['spot']) {
|
|
80627
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' createMarketSellOrderWithCost() supports spot orders only');
|
|
80628
|
+
}
|
|
80629
|
+
return await this.createOrder(symbol, 'market', 'sell', cost, 1, params);
|
|
80496
80630
|
}
|
|
80497
80631
|
async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
|
|
80498
80632
|
/**
|
|
@@ -80536,7 +80670,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
80536
80670
|
}
|
|
80537
80671
|
const trailingAmount = this.safeString2(params, 'trailingAmount', 'trailingStop');
|
|
80538
80672
|
const isTrailingAmountOrder = trailingAmount !== undefined;
|
|
80539
|
-
const orderRequest = this.createOrderRequest(symbol, type, side, amount, price, params);
|
|
80673
|
+
const orderRequest = this.createOrderRequest(symbol, type, side, amount, price, params, enableUnifiedAccount);
|
|
80540
80674
|
let response = undefined;
|
|
80541
80675
|
if (isTrailingAmountOrder) {
|
|
80542
80676
|
response = await this.privatePostV5PositionTradingStop(orderRequest);
|
|
@@ -80559,7 +80693,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
80559
80693
|
const order = this.safeValue(response, 'result', {});
|
|
80560
80694
|
return this.parseOrder(order, market);
|
|
80561
80695
|
}
|
|
80562
|
-
createOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
|
|
80696
|
+
createOrderRequest(symbol, type, side, amount, price = undefined, params = {}, isUTA = true) {
|
|
80563
80697
|
const market = this.market(symbol);
|
|
80564
80698
|
symbol = market['symbol'];
|
|
80565
80699
|
const lowerCaseType = type.toLowerCase();
|
|
@@ -80603,12 +80737,36 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
80603
80737
|
else if (market['option']) {
|
|
80604
80738
|
request['category'] = 'option';
|
|
80605
80739
|
}
|
|
80606
|
-
|
|
80740
|
+
const cost = this.safeString(params, 'cost');
|
|
80741
|
+
params = this.omit(params, 'cost');
|
|
80742
|
+
// if the cost is inferable, let's keep the old logic and ignore marketUnit, to minimize the impact of the changes
|
|
80743
|
+
const isMarketBuyAndCostInferable = (lowerCaseType === 'market') && (side === 'buy') && ((price !== undefined) || (cost !== undefined));
|
|
80744
|
+
if (market['spot'] && (type === 'market') && isUTA && !isMarketBuyAndCostInferable) {
|
|
80745
|
+
// UTA account can specify the cost of the order on both sides
|
|
80746
|
+
if ((cost !== undefined) || (price !== undefined)) {
|
|
80747
|
+
request['marketUnit'] = 'quoteCoin';
|
|
80748
|
+
let orderCost = undefined;
|
|
80749
|
+
if (cost !== undefined) {
|
|
80750
|
+
orderCost = cost;
|
|
80751
|
+
}
|
|
80752
|
+
else {
|
|
80753
|
+
const amountString = this.numberToString(amount);
|
|
80754
|
+
const priceString = this.numberToString(price);
|
|
80755
|
+
const quoteAmount = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringMul(amountString, priceString);
|
|
80756
|
+
orderCost = quoteAmount;
|
|
80757
|
+
}
|
|
80758
|
+
request['qty'] = this.costToPrecision(symbol, orderCost);
|
|
80759
|
+
}
|
|
80760
|
+
else {
|
|
80761
|
+
request['marketUnit'] = 'baseCoin';
|
|
80762
|
+
request['qty'] = this.amountToPrecision(symbol, amount);
|
|
80763
|
+
}
|
|
80764
|
+
}
|
|
80765
|
+
else if (market['spot'] && (type === 'market') && (side === 'buy')) {
|
|
80766
|
+
// classic accounts
|
|
80607
80767
|
// for market buy it requires the amount of quote currency to spend
|
|
80608
80768
|
let createMarketBuyOrderRequiresPrice = true;
|
|
80609
80769
|
[createMarketBuyOrderRequiresPrice, params] = this.handleOptionAndParams(params, 'createOrder', 'createMarketBuyOrderRequiresPrice', true);
|
|
80610
|
-
const cost = this.safeNumber(params, 'cost');
|
|
80611
|
-
params = this.omit(params, 'cost');
|
|
80612
80770
|
if (createMarketBuyOrderRequiresPrice) {
|
|
80613
80771
|
if ((price === undefined) && (cost === undefined)) {
|
|
80614
80772
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.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');
|
|
@@ -80735,6 +80893,8 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
80735
80893
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
80736
80894
|
*/
|
|
80737
80895
|
await this.loadMarkets();
|
|
80896
|
+
const accounts = await this.isUnifiedEnabled();
|
|
80897
|
+
const isUta = accounts[1];
|
|
80738
80898
|
const ordersRequests = [];
|
|
80739
80899
|
const orderSymbols = [];
|
|
80740
80900
|
for (let i = 0; i < orders.length; i++) {
|
|
@@ -80746,7 +80906,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
80746
80906
|
const amount = this.safeValue(rawOrder, 'amount');
|
|
80747
80907
|
const price = this.safeValue(rawOrder, 'price');
|
|
80748
80908
|
const orderParams = this.safeValue(rawOrder, 'params', {});
|
|
80749
|
-
const orderRequest = this.createOrderRequest(marketId, type, side, amount, price, orderParams);
|
|
80909
|
+
const orderRequest = this.createOrderRequest(marketId, type, side, amount, price, orderParams, isUta);
|
|
80750
80910
|
ordersRequests.push(orderRequest);
|
|
80751
80911
|
}
|
|
80752
80912
|
const symbols = this.marketSymbols(orderSymbols, undefined, false, true, true);
|
|
@@ -89812,6 +89972,7 @@ class coinbasepro extends _abstract_coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/
|
|
|
89812
89972
|
'fetchDepositAddress': false,
|
|
89813
89973
|
'fetchDeposits': true,
|
|
89814
89974
|
'fetchDepositsWithdrawals': true,
|
|
89975
|
+
'fetchFundingRate': false,
|
|
89815
89976
|
'fetchLedger': true,
|
|
89816
89977
|
'fetchMarginMode': false,
|
|
89817
89978
|
'fetchMarkets': true,
|
|
@@ -94077,8 +94238,9 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
94077
94238
|
*/
|
|
94078
94239
|
let marketType = undefined;
|
|
94079
94240
|
[marketType, params] = this.handleMarketTypeAndParams('fetchBalance', undefined, params);
|
|
94080
|
-
|
|
94081
|
-
|
|
94241
|
+
let marginMode = undefined;
|
|
94242
|
+
[marginMode, params] = this.handleMarginModeAndParams('fetchBalance', params);
|
|
94243
|
+
marketType = (marginMode !== undefined) ? 'margin' : marketType;
|
|
94082
94244
|
params = this.omit(params, 'margin');
|
|
94083
94245
|
if (marketType === 'margin') {
|
|
94084
94246
|
return await this.fetchMarginBalance(params);
|
|
@@ -94608,8 +94770,9 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
94608
94770
|
}
|
|
94609
94771
|
}
|
|
94610
94772
|
const accountId = this.safeInteger(params, 'account_id');
|
|
94611
|
-
|
|
94612
|
-
|
|
94773
|
+
let marginMode = undefined;
|
|
94774
|
+
[marginMode, params] = this.handleMarginModeAndParams('createOrder', params);
|
|
94775
|
+
if (marginMode !== undefined) {
|
|
94613
94776
|
if (accountId === undefined) {
|
|
94614
94777
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest(this.id + ' createOrder() requires an account_id parameter for margin orders');
|
|
94615
94778
|
}
|
|
@@ -95128,9 +95291,10 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
95128
95291
|
'market': market['id'],
|
|
95129
95292
|
};
|
|
95130
95293
|
const accountId = this.safeInteger(params, 'account_id');
|
|
95131
|
-
|
|
95294
|
+
let marginMode = undefined;
|
|
95295
|
+
[marginMode, params] = this.handleMarginModeAndParams('cancelOrder', params);
|
|
95132
95296
|
const clientOrderId = this.safeString2(params, 'client_id', 'clientOrderId');
|
|
95133
|
-
if (
|
|
95297
|
+
if (marginMode !== undefined) {
|
|
95134
95298
|
if (accountId === undefined) {
|
|
95135
95299
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest(this.id + ' cancelOrder() requires an account_id parameter for margin orders');
|
|
95136
95300
|
}
|
|
@@ -95502,8 +95666,9 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
95502
95666
|
}
|
|
95503
95667
|
const [marketType, query] = this.handleMarketTypeAndParams('fetchOrdersByStatus', market, params);
|
|
95504
95668
|
const accountId = this.safeInteger(params, 'account_id');
|
|
95505
|
-
|
|
95506
|
-
|
|
95669
|
+
let marginMode = undefined;
|
|
95670
|
+
[marginMode, params] = this.handleMarginModeAndParams('fetchOrdersByStatus', params);
|
|
95671
|
+
if (marginMode !== undefined) {
|
|
95507
95672
|
if (accountId === undefined) {
|
|
95508
95673
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest(this.id + ' fetchOpenOrders() and fetchClosedOrders() require an account_id parameter for margin orders');
|
|
95509
95674
|
}
|
|
@@ -95906,8 +96071,9 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
95906
96071
|
}
|
|
95907
96072
|
const swap = (type === 'swap');
|
|
95908
96073
|
const accountId = this.safeInteger(params, 'account_id');
|
|
95909
|
-
|
|
95910
|
-
|
|
96074
|
+
let marginMode = undefined;
|
|
96075
|
+
[marginMode, params] = this.handleMarginModeAndParams('fetchMyTrades', params);
|
|
96076
|
+
if (marginMode !== undefined) {
|
|
95911
96077
|
if (accountId === undefined) {
|
|
95912
96078
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest(this.id + ' fetchMyTrades() requires an account_id parameter for margin trades');
|
|
95913
96079
|
}
|
|
@@ -96009,11 +96175,17 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
96009
96175
|
* @name coinex#fetchPositions
|
|
96010
96176
|
* @description fetch all open positions
|
|
96011
96177
|
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http033_pending_position
|
|
96012
|
-
* @
|
|
96178
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http033-0_finished_position
|
|
96179
|
+
* @param {string[]} [symbols] list of unified market symbols
|
|
96013
96180
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
96181
|
+
* @param {string} [params.method] the method to use 'perpetualPrivateGetPositionPending' or 'perpetualPrivateGetPositionFinished' default is 'perpetualPrivateGetPositionPending'
|
|
96182
|
+
* @param {int} [params.side] *history endpoint only* 0: All, 1: Sell, 2: Buy, default is 0
|
|
96014
96183
|
* @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
96015
96184
|
*/
|
|
96016
96185
|
await this.loadMarkets();
|
|
96186
|
+
let defaultMethod = undefined;
|
|
96187
|
+
[defaultMethod, params] = this.handleOptionAndParams(params, 'fetchPositions', 'method', 'perpetualPrivateGetPositionPending');
|
|
96188
|
+
const isHistory = (defaultMethod === 'perpetualPrivateGetPositionFinished');
|
|
96017
96189
|
symbols = this.marketSymbols(symbols);
|
|
96018
96190
|
const request = {};
|
|
96019
96191
|
let market = undefined;
|
|
@@ -96032,7 +96204,22 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
96032
96204
|
market = this.market(symbol);
|
|
96033
96205
|
request['market'] = market['id'];
|
|
96034
96206
|
}
|
|
96035
|
-
|
|
96207
|
+
else {
|
|
96208
|
+
if (isHistory) {
|
|
96209
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' fetchPositions() requires a symbol argument for closed positions');
|
|
96210
|
+
}
|
|
96211
|
+
}
|
|
96212
|
+
if (isHistory) {
|
|
96213
|
+
request['limit'] = 100;
|
|
96214
|
+
request['side'] = this.safeInteger(params, 'side', 0); // 0: All, 1: Sell, 2: Buy
|
|
96215
|
+
}
|
|
96216
|
+
let response = undefined;
|
|
96217
|
+
if (defaultMethod === 'perpetualPrivateGetPositionPending') {
|
|
96218
|
+
response = await this.perpetualPrivateGetPositionPending(this.extend(request, params));
|
|
96219
|
+
}
|
|
96220
|
+
else {
|
|
96221
|
+
response = await this.perpetualPrivateGetPositionFinished(this.extend(request, params));
|
|
96222
|
+
}
|
|
96036
96223
|
//
|
|
96037
96224
|
// {
|
|
96038
96225
|
// "code": 0,
|
|
@@ -97232,9 +97419,10 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
97232
97419
|
request['limit'] = 100;
|
|
97233
97420
|
}
|
|
97234
97421
|
params = this.omit(params, 'page');
|
|
97235
|
-
|
|
97422
|
+
let marginMode = undefined;
|
|
97423
|
+
[marginMode, params] = this.handleMarginModeAndParams('fetchTransfers', params);
|
|
97236
97424
|
let response = undefined;
|
|
97237
|
-
if (
|
|
97425
|
+
if (marginMode !== undefined) {
|
|
97238
97426
|
response = await this.privateGetMarginTransferHistory(this.extend(request, params));
|
|
97239
97427
|
}
|
|
97240
97428
|
else {
|
|
@@ -97815,6 +98003,25 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
97815
98003
|
}
|
|
97816
98004
|
return depositWithdrawFees;
|
|
97817
98005
|
}
|
|
98006
|
+
handleMarginModeAndParams(methodName, params = {}, defaultValue = undefined) {
|
|
98007
|
+
/**
|
|
98008
|
+
* @ignore
|
|
98009
|
+
* @method
|
|
98010
|
+
* @description marginMode specified by params["marginMode"], this.options["marginMode"], this.options["defaultMarginMode"], params["margin"] = true or this.options["defaultType"] = 'margin'
|
|
98011
|
+
* @param {object} params extra parameters specific to the exchange api endpoint
|
|
98012
|
+
* @returns {Array} the marginMode in lowercase
|
|
98013
|
+
*/
|
|
98014
|
+
const defaultType = this.safeString(this.options, 'defaultType');
|
|
98015
|
+
const isMargin = this.safeValue(params, 'margin', false);
|
|
98016
|
+
let marginMode = undefined;
|
|
98017
|
+
[marginMode, params] = super.handleMarginModeAndParams(methodName, params, defaultValue);
|
|
98018
|
+
if (marginMode === undefined) {
|
|
98019
|
+
if ((defaultType === 'margin') || (isMargin === true)) {
|
|
98020
|
+
marginMode = 'isolated';
|
|
98021
|
+
}
|
|
98022
|
+
}
|
|
98023
|
+
return [marginMode, params];
|
|
98024
|
+
}
|
|
97818
98025
|
nonce() {
|
|
97819
98026
|
return this.milliseconds();
|
|
97820
98027
|
}
|
|
@@ -113668,6 +113875,170 @@ class deribit extends _abstract_deribit_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
113668
113875
|
},
|
|
113669
113876
|
});
|
|
113670
113877
|
}
|
|
113878
|
+
convertExpireDate(date) {
|
|
113879
|
+
// parse YYMMDD to timestamp
|
|
113880
|
+
const year = date.slice(0, 2);
|
|
113881
|
+
const month = date.slice(2, 4);
|
|
113882
|
+
const day = date.slice(4, 6);
|
|
113883
|
+
const reconstructedDate = '20' + year + '-' + month + '-' + day + 'T00:00:00Z';
|
|
113884
|
+
return reconstructedDate;
|
|
113885
|
+
}
|
|
113886
|
+
convertMarketIdExpireDate(date) {
|
|
113887
|
+
// parse 19JAN24 to 240119
|
|
113888
|
+
const monthMappping = {
|
|
113889
|
+
'JAN': '01',
|
|
113890
|
+
'FEB': '02',
|
|
113891
|
+
'MAR': '03',
|
|
113892
|
+
'APR': '04',
|
|
113893
|
+
'MAY': '05',
|
|
113894
|
+
'JUN': '06',
|
|
113895
|
+
'JUL': '07',
|
|
113896
|
+
'AUG': '08',
|
|
113897
|
+
'SEP': '09',
|
|
113898
|
+
'OCT': '10',
|
|
113899
|
+
'NOV': '11',
|
|
113900
|
+
'DEC': '12',
|
|
113901
|
+
};
|
|
113902
|
+
const year = date.slice(0, 2);
|
|
113903
|
+
const monthName = date.slice(2, 5);
|
|
113904
|
+
const month = this.safeString(monthMappping, monthName);
|
|
113905
|
+
const day = date.slice(5, 7);
|
|
113906
|
+
const reconstructedDate = day + month + year;
|
|
113907
|
+
return reconstructedDate;
|
|
113908
|
+
}
|
|
113909
|
+
convertExpireDateToMarketIdDate(date) {
|
|
113910
|
+
// parse 240119 to 19JAN24
|
|
113911
|
+
const year = date.slice(0, 2);
|
|
113912
|
+
const monthRaw = date.slice(2, 4);
|
|
113913
|
+
let month = undefined;
|
|
113914
|
+
const day = date.slice(4, 6);
|
|
113915
|
+
if (monthRaw === '01') {
|
|
113916
|
+
month = 'JAN';
|
|
113917
|
+
}
|
|
113918
|
+
else if (monthRaw === '02') {
|
|
113919
|
+
month = 'FEB';
|
|
113920
|
+
}
|
|
113921
|
+
else if (monthRaw === '03') {
|
|
113922
|
+
month = 'MAR';
|
|
113923
|
+
}
|
|
113924
|
+
else if (monthRaw === '04') {
|
|
113925
|
+
month = 'APR';
|
|
113926
|
+
}
|
|
113927
|
+
else if (monthRaw === '05') {
|
|
113928
|
+
month = 'MAY';
|
|
113929
|
+
}
|
|
113930
|
+
else if (monthRaw === '06') {
|
|
113931
|
+
month = 'JUN';
|
|
113932
|
+
}
|
|
113933
|
+
else if (monthRaw === '07') {
|
|
113934
|
+
month = 'JUL';
|
|
113935
|
+
}
|
|
113936
|
+
else if (monthRaw === '08') {
|
|
113937
|
+
month = 'AUG';
|
|
113938
|
+
}
|
|
113939
|
+
else if (monthRaw === '09') {
|
|
113940
|
+
month = 'SEP';
|
|
113941
|
+
}
|
|
113942
|
+
else if (monthRaw === '10') {
|
|
113943
|
+
month = 'OCT';
|
|
113944
|
+
}
|
|
113945
|
+
else if (monthRaw === '11') {
|
|
113946
|
+
month = 'NOV';
|
|
113947
|
+
}
|
|
113948
|
+
else if (monthRaw === '12') {
|
|
113949
|
+
month = 'DEC';
|
|
113950
|
+
}
|
|
113951
|
+
const reconstructedDate = day + month + year;
|
|
113952
|
+
return reconstructedDate;
|
|
113953
|
+
}
|
|
113954
|
+
createExpiredOptionMarket(symbol) {
|
|
113955
|
+
// support expired option contracts
|
|
113956
|
+
let quote = 'USD';
|
|
113957
|
+
let settle = undefined;
|
|
113958
|
+
const optionParts = symbol.split('-');
|
|
113959
|
+
const symbolBase = symbol.split('/');
|
|
113960
|
+
let base = undefined;
|
|
113961
|
+
let expiry = undefined;
|
|
113962
|
+
if (symbol.indexOf('/') > -1) {
|
|
113963
|
+
base = this.safeString(symbolBase, 0);
|
|
113964
|
+
expiry = this.safeString(optionParts, 1);
|
|
113965
|
+
if (symbol.indexOf('USDC') > -1) {
|
|
113966
|
+
base = base + '_USDC';
|
|
113967
|
+
}
|
|
113968
|
+
}
|
|
113969
|
+
else {
|
|
113970
|
+
base = this.safeString(optionParts, 0);
|
|
113971
|
+
expiry = this.convertMarketIdExpireDate(this.safeString(optionParts, 1));
|
|
113972
|
+
}
|
|
113973
|
+
if (symbol.indexOf('USDC') > -1) {
|
|
113974
|
+
quote = 'USDC';
|
|
113975
|
+
settle = 'USDC';
|
|
113976
|
+
}
|
|
113977
|
+
else {
|
|
113978
|
+
settle = base;
|
|
113979
|
+
}
|
|
113980
|
+
let splitBase = base;
|
|
113981
|
+
if (base.indexOf('_') > -1) {
|
|
113982
|
+
const splitSymbol = base.split('_');
|
|
113983
|
+
splitBase = this.safeString(splitSymbol, 0);
|
|
113984
|
+
}
|
|
113985
|
+
const strike = this.safeString(optionParts, 2);
|
|
113986
|
+
const optionType = this.safeString(optionParts, 3);
|
|
113987
|
+
const datetime = this.convertExpireDate(expiry);
|
|
113988
|
+
const timestamp = this.parse8601(datetime);
|
|
113989
|
+
return {
|
|
113990
|
+
'id': base + '-' + this.convertExpireDateToMarketIdDate(expiry) + '-' + strike + '-' + optionType,
|
|
113991
|
+
'symbol': splitBase + '/' + quote + ':' + settle + '-' + expiry + '-' + strike + '-' + optionType,
|
|
113992
|
+
'base': base,
|
|
113993
|
+
'quote': quote,
|
|
113994
|
+
'settle': settle,
|
|
113995
|
+
'baseId': base,
|
|
113996
|
+
'quoteId': quote,
|
|
113997
|
+
'settleId': settle,
|
|
113998
|
+
'active': false,
|
|
113999
|
+
'type': 'option',
|
|
114000
|
+
'linear': undefined,
|
|
114001
|
+
'inverse': undefined,
|
|
114002
|
+
'spot': false,
|
|
114003
|
+
'swap': false,
|
|
114004
|
+
'future': false,
|
|
114005
|
+
'option': true,
|
|
114006
|
+
'margin': false,
|
|
114007
|
+
'contract': true,
|
|
114008
|
+
'contractSize': undefined,
|
|
114009
|
+
'expiry': timestamp,
|
|
114010
|
+
'expiryDatetime': datetime,
|
|
114011
|
+
'optionType': (optionType === 'C') ? 'call' : 'put',
|
|
114012
|
+
'strike': this.parseNumber(strike),
|
|
114013
|
+
'precision': {
|
|
114014
|
+
'amount': undefined,
|
|
114015
|
+
'price': undefined,
|
|
114016
|
+
},
|
|
114017
|
+
'limits': {
|
|
114018
|
+
'amount': {
|
|
114019
|
+
'min': undefined,
|
|
114020
|
+
'max': undefined,
|
|
114021
|
+
},
|
|
114022
|
+
'price': {
|
|
114023
|
+
'min': undefined,
|
|
114024
|
+
'max': undefined,
|
|
114025
|
+
},
|
|
114026
|
+
'cost': {
|
|
114027
|
+
'min': undefined,
|
|
114028
|
+
'max': undefined,
|
|
114029
|
+
},
|
|
114030
|
+
},
|
|
114031
|
+
'info': undefined,
|
|
114032
|
+
};
|
|
114033
|
+
}
|
|
114034
|
+
safeMarket(marketId = undefined, market = undefined, delimiter = undefined, marketType = undefined) {
|
|
114035
|
+
const isOption = (marketId !== undefined) && ((marketId.endsWith('-C')) || (marketId.endsWith('-P')));
|
|
114036
|
+
if (isOption && !(marketId in this.markets_by_id)) {
|
|
114037
|
+
// handle expired option contracts
|
|
114038
|
+
return this.createExpiredOptionMarket(marketId);
|
|
114039
|
+
}
|
|
114040
|
+
return super.safeMarket(marketId, market, delimiter, marketType);
|
|
114041
|
+
}
|
|
113671
114042
|
async fetchTime(params = {}) {
|
|
113672
114043
|
/**
|
|
113673
114044
|
* @method
|
|
@@ -185601,6 +185972,9 @@ class okcoin extends _abstract_okcoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
185601
185972
|
'fetchCurrencies': true,
|
|
185602
185973
|
'fetchDepositAddress': true,
|
|
185603
185974
|
'fetchDeposits': true,
|
|
185975
|
+
'fetchFundingHistory': false,
|
|
185976
|
+
'fetchFundingRate': false,
|
|
185977
|
+
'fetchFundingRateHistory': false,
|
|
185604
185978
|
'fetchLedger': true,
|
|
185605
185979
|
'fetchMarkets': true,
|
|
185606
185980
|
'fetchMyTrades': true,
|
|
@@ -191594,12 +191968,26 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
191594
191968
|
const request = {
|
|
191595
191969
|
'instId': market['id'],
|
|
191596
191970
|
};
|
|
191971
|
+
let isAlgoOrder = undefined;
|
|
191972
|
+
if ((type === 'trigger') || (type === 'conditional') || (type === 'move_order_stop') || (type === 'oco') || (type === 'iceberg') || (type === 'twap')) {
|
|
191973
|
+
isAlgoOrder = true;
|
|
191974
|
+
}
|
|
191597
191975
|
const clientOrderId = this.safeString2(params, 'clOrdId', 'clientOrderId');
|
|
191598
191976
|
if (clientOrderId !== undefined) {
|
|
191599
|
-
|
|
191977
|
+
if (isAlgoOrder) {
|
|
191978
|
+
request['algoClOrdId'] = clientOrderId;
|
|
191979
|
+
}
|
|
191980
|
+
else {
|
|
191981
|
+
request['clOrdId'] = clientOrderId;
|
|
191982
|
+
}
|
|
191600
191983
|
}
|
|
191601
191984
|
else {
|
|
191602
|
-
|
|
191985
|
+
if (isAlgoOrder) {
|
|
191986
|
+
request['algoId'] = id;
|
|
191987
|
+
}
|
|
191988
|
+
else {
|
|
191989
|
+
request['ordId'] = id;
|
|
191990
|
+
}
|
|
191603
191991
|
}
|
|
191604
191992
|
let stopLossTriggerPrice = this.safeValue2(params, 'stopLossPrice', 'newSlTriggerPx');
|
|
191605
191993
|
let stopLossPrice = this.safeValue(params, 'newSlOrdPx');
|
|
@@ -191611,37 +191999,62 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
191611
191999
|
const takeProfit = this.safeValue(params, 'takeProfit');
|
|
191612
192000
|
const stopLossDefined = (stopLoss !== undefined);
|
|
191613
192001
|
const takeProfitDefined = (takeProfit !== undefined);
|
|
191614
|
-
if (
|
|
191615
|
-
|
|
191616
|
-
|
|
191617
|
-
|
|
191618
|
-
|
|
191619
|
-
|
|
191620
|
-
|
|
191621
|
-
|
|
191622
|
-
|
|
191623
|
-
|
|
191624
|
-
|
|
191625
|
-
|
|
191626
|
-
|
|
191627
|
-
|
|
191628
|
-
|
|
191629
|
-
|
|
191630
|
-
|
|
191631
|
-
|
|
191632
|
-
|
|
191633
|
-
|
|
191634
|
-
|
|
191635
|
-
|
|
191636
|
-
|
|
191637
|
-
|
|
191638
|
-
|
|
192002
|
+
if (isAlgoOrder) {
|
|
192003
|
+
if ((stopLossTriggerPrice === undefined) && (takeProfitTriggerPrice === undefined)) {
|
|
192004
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest(this.id + ' editOrder() requires a stopLossPrice or takeProfitPrice parameter for editing an algo order');
|
|
192005
|
+
}
|
|
192006
|
+
if (stopLossTriggerPrice !== undefined) {
|
|
192007
|
+
if (stopLossPrice === undefined) {
|
|
192008
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest(this.id + ' editOrder() requires a newSlOrdPx parameter for editing an algo order');
|
|
192009
|
+
}
|
|
192010
|
+
request['newSlTriggerPx'] = this.priceToPrecision(symbol, stopLossTriggerPrice);
|
|
192011
|
+
request['newSlOrdPx'] = (type === 'market') ? '-1' : this.priceToPrecision(symbol, stopLossPrice);
|
|
192012
|
+
request['newSlTriggerPxType'] = stopLossTriggerPriceType;
|
|
192013
|
+
}
|
|
192014
|
+
if (takeProfitTriggerPrice !== undefined) {
|
|
192015
|
+
if (takeProfitPrice === undefined) {
|
|
192016
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest(this.id + ' editOrder() requires a newTpOrdPx parameter for editing an algo order');
|
|
192017
|
+
}
|
|
192018
|
+
request['newTpTriggerPx'] = this.priceToPrecision(symbol, takeProfitTriggerPrice);
|
|
192019
|
+
request['newTpOrdPx'] = (type === 'market') ? '-1' : this.priceToPrecision(symbol, takeProfitPrice);
|
|
192020
|
+
request['newTpTriggerPxType'] = takeProfitTriggerPriceType;
|
|
192021
|
+
}
|
|
192022
|
+
}
|
|
192023
|
+
else {
|
|
192024
|
+
if (stopLossTriggerPrice !== undefined) {
|
|
192025
|
+
request['newSlTriggerPx'] = this.priceToPrecision(symbol, stopLossTriggerPrice);
|
|
192026
|
+
request['newSlOrdPx'] = (type === 'market') ? '-1' : this.priceToPrecision(symbol, stopLossPrice);
|
|
192027
|
+
request['newSlTriggerPxType'] = stopLossTriggerPriceType;
|
|
192028
|
+
}
|
|
192029
|
+
if (takeProfitTriggerPrice !== undefined) {
|
|
192030
|
+
request['newTpTriggerPx'] = this.priceToPrecision(symbol, takeProfitTriggerPrice);
|
|
192031
|
+
request['newTpOrdPx'] = (type === 'market') ? '-1' : this.priceToPrecision(symbol, takeProfitPrice);
|
|
192032
|
+
request['newTpTriggerPxType'] = takeProfitTriggerPriceType;
|
|
192033
|
+
}
|
|
192034
|
+
if (stopLossDefined) {
|
|
192035
|
+
stopLossTriggerPrice = this.safeValue(stopLoss, 'triggerPrice');
|
|
192036
|
+
stopLossPrice = this.safeValue(stopLoss, 'price');
|
|
192037
|
+
const stopLossType = this.safeString(stopLoss, 'type');
|
|
192038
|
+
request['newSlTriggerPx'] = this.priceToPrecision(symbol, stopLossTriggerPrice);
|
|
192039
|
+
request['newSlOrdPx'] = (stopLossType === 'market') ? '-1' : this.priceToPrecision(symbol, stopLossPrice);
|
|
192040
|
+
request['newSlTriggerPxType'] = stopLossTriggerPriceType;
|
|
192041
|
+
}
|
|
192042
|
+
if (takeProfitDefined) {
|
|
192043
|
+
takeProfitTriggerPrice = this.safeValue(takeProfit, 'triggerPrice');
|
|
192044
|
+
takeProfitPrice = this.safeValue(takeProfit, 'price');
|
|
192045
|
+
const takeProfitType = this.safeString(takeProfit, 'type');
|
|
192046
|
+
request['newTpTriggerPx'] = this.priceToPrecision(symbol, takeProfitTriggerPrice);
|
|
192047
|
+
request['newTpOrdPx'] = (takeProfitType === 'market') ? '-1' : this.priceToPrecision(symbol, takeProfitPrice);
|
|
192048
|
+
request['newTpTriggerPxType'] = takeProfitTriggerPriceType;
|
|
192049
|
+
}
|
|
191639
192050
|
}
|
|
191640
192051
|
if (amount !== undefined) {
|
|
191641
192052
|
request['newSz'] = this.amountToPrecision(symbol, amount);
|
|
191642
192053
|
}
|
|
191643
|
-
if (
|
|
191644
|
-
|
|
192054
|
+
if (!isAlgoOrder) {
|
|
192055
|
+
if (price !== undefined) {
|
|
192056
|
+
request['newPx'] = this.priceToPrecision(symbol, price);
|
|
192057
|
+
}
|
|
191645
192058
|
}
|
|
191646
192059
|
params = this.omit(params, ['clOrdId', 'clientOrderId', 'takeProfitPrice', 'stopLossPrice', 'stopLoss', 'takeProfit']);
|
|
191647
192060
|
return this.extend(request, params);
|
|
@@ -191651,7 +192064,8 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
191651
192064
|
* @method
|
|
191652
192065
|
* @name okx#editOrder
|
|
191653
192066
|
* @description edit a trade order
|
|
191654
|
-
* @see https://www.okx.com/docs-v5/en/#
|
|
192067
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-amend-order
|
|
192068
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-post-amend-algo-order
|
|
191655
192069
|
* @param {string} id order id
|
|
191656
192070
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
191657
192071
|
* @param {string} type 'market' or 'limit'
|
|
@@ -191679,7 +192093,17 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
191679
192093
|
await this.loadMarkets();
|
|
191680
192094
|
const market = this.market(symbol);
|
|
191681
192095
|
const request = this.editOrderRequest(id, symbol, type, side, amount, price, params);
|
|
191682
|
-
|
|
192096
|
+
let isAlgoOrder = undefined;
|
|
192097
|
+
if ((type === 'trigger') || (type === 'conditional') || (type === 'move_order_stop') || (type === 'oco') || (type === 'iceberg') || (type === 'twap')) {
|
|
192098
|
+
isAlgoOrder = true;
|
|
192099
|
+
}
|
|
192100
|
+
let response = undefined;
|
|
192101
|
+
if (isAlgoOrder) {
|
|
192102
|
+
response = await this.privatePostTradeAmendAlgos(this.extend(request, params));
|
|
192103
|
+
}
|
|
192104
|
+
else {
|
|
192105
|
+
response = await this.privatePostTradeAmendOrder(this.extend(request, params));
|
|
192106
|
+
}
|
|
191683
192107
|
//
|
|
191684
192108
|
// {
|
|
191685
192109
|
// "code": "0",
|
|
@@ -201788,16 +202212,19 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
201788
202212
|
* @method
|
|
201789
202213
|
* @name phemex#fetchBalance
|
|
201790
202214
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
202215
|
+
* @see https://phemex-docs.github.io/#query-wallets
|
|
201791
202216
|
* @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#query-account-positions
|
|
202217
|
+
* @see https://phemex-docs.github.io/#query-trading-account-and-positions
|
|
201792
202218
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
201793
202219
|
* @param {string} [params.type] spot or swap
|
|
202220
|
+
* @param {string} [params.code] *swap only* currency code of the balance to query (USD, USDT, etc), default is USDT
|
|
201794
202221
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
201795
202222
|
*/
|
|
201796
202223
|
await this.loadMarkets();
|
|
201797
202224
|
let type = undefined;
|
|
201798
202225
|
[type, params] = this.handleMarketTypeAndParams('fetchBalance', undefined, params);
|
|
201799
202226
|
const code = this.safeString(params, 'code');
|
|
201800
|
-
params = this.omit(params, ['
|
|
202227
|
+
params = this.omit(params, ['code']);
|
|
201801
202228
|
let response = undefined;
|
|
201802
202229
|
const request = {};
|
|
201803
202230
|
if ((type !== 'spot') && (type !== 'swap')) {
|
|
@@ -201805,7 +202232,7 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
201805
202232
|
}
|
|
201806
202233
|
if (type === 'swap') {
|
|
201807
202234
|
let settle = undefined;
|
|
201808
|
-
[settle, params] = this.handleOptionAndParams(params, 'fetchBalance', 'settle');
|
|
202235
|
+
[settle, params] = this.handleOptionAndParams(params, 'fetchBalance', 'settle', 'USDT');
|
|
201809
202236
|
if (code !== undefined || settle !== undefined) {
|
|
201810
202237
|
let coin = undefined;
|
|
201811
202238
|
if (code !== undefined) {
|
|
@@ -203415,8 +203842,10 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
203415
203842
|
* @description fetch all open positions
|
|
203416
203843
|
* @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#query-trading-account-and-positions
|
|
203417
203844
|
* @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#query-account-positions
|
|
203418
|
-
* @
|
|
203845
|
+
* @see https://phemex-docs.github.io/#query-account-positions-with-unrealized-pnl
|
|
203846
|
+
* @param {string[]} [symbols] list of unified market symbols
|
|
203419
203847
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
203848
|
+
* @param {string} [param.method] *USDT contracts only* 'privateGetGAccountsAccountPositions' or 'privateGetAccountsPositions' default is 'privateGetGAccountsAccountPositions'
|
|
203420
203849
|
* @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
203421
203850
|
*/
|
|
203422
203851
|
await this.loadMarkets();
|
|
@@ -203451,7 +203880,14 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
203451
203880
|
};
|
|
203452
203881
|
let response = undefined;
|
|
203453
203882
|
if (isUSDTSettled) {
|
|
203454
|
-
|
|
203883
|
+
let method = undefined;
|
|
203884
|
+
[method, params] = this.handleOptionAndParams(params, 'fetchPositions', 'method', 'privateGetGAccountsAccountPositions');
|
|
203885
|
+
if (method === 'privateGetGAccountsAccountPositions') {
|
|
203886
|
+
response = await this.privateGetGAccountsAccountPositions(this.extend(request, params));
|
|
203887
|
+
}
|
|
203888
|
+
else {
|
|
203889
|
+
response = await this.privateGetAccountsPositions(this.extend(request, params));
|
|
203890
|
+
}
|
|
203455
203891
|
}
|
|
203456
203892
|
else {
|
|
203457
203893
|
response = await this.privateGetAccountsAccountPositions(this.extend(request, params));
|
|
@@ -203627,7 +204063,7 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
203627
204063
|
const contracts = this.safeString(position, 'size');
|
|
203628
204064
|
const contractSize = this.safeValue(market, 'contractSize');
|
|
203629
204065
|
const contractSizeString = this.numberToString(contractSize);
|
|
203630
|
-
const leverage = this.
|
|
204066
|
+
const leverage = this.parseNumber(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringAbs((this.safeString(position, 'leverage', 'leverageRr'))));
|
|
203631
204067
|
const entryPriceString = this.safeString2(position, 'avgEntryPrice', 'avgEntryPriceRp');
|
|
203632
204068
|
const rawSide = this.safeString(position, 'side');
|
|
203633
204069
|
let side = undefined;
|
|
@@ -204654,6 +205090,7 @@ class poloniex extends _abstract_poloniex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
204654
205090
|
'fetchDepositsWithdrawals': true,
|
|
204655
205091
|
'fetchDepositWithdrawFee': 'emulated',
|
|
204656
205092
|
'fetchDepositWithdrawFees': true,
|
|
205093
|
+
'fetchFundingRate': false,
|
|
204657
205094
|
'fetchMarginMode': false,
|
|
204658
205095
|
'fetchMarkets': true,
|
|
204659
205096
|
'fetchMyTrades': true,
|
|
@@ -210465,12 +210902,18 @@ class ascendex extends _ascendex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] *
|
|
|
210465
210902
|
/* harmony export */ Z: () => (/* binding */ bequant)
|
|
210466
210903
|
/* harmony export */ });
|
|
210467
210904
|
/* harmony import */ var _hitbtc_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5189);
|
|
210905
|
+
/* harmony import */ var _bequant_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2049);
|
|
210468
210906
|
// ---------------------------------------------------------------------------
|
|
210469
210907
|
|
|
210908
|
+
|
|
210470
210909
|
// ---------------------------------------------------------------------------
|
|
210471
210910
|
class bequant extends _hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
210472
210911
|
describe() {
|
|
210473
|
-
|
|
210912
|
+
// eslint-disable-next-line new-cap
|
|
210913
|
+
const restInstance = new _bequant_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z();
|
|
210914
|
+
const restDescribe = restInstance.describe();
|
|
210915
|
+
const extended = this.deepExtend(super.describe(), restDescribe);
|
|
210916
|
+
return this.deepExtend(extended, {
|
|
210474
210917
|
'id': 'bequant',
|
|
210475
210918
|
'name': 'Bequant',
|
|
210476
210919
|
'countries': ['MT'],
|
|
@@ -210554,7 +210997,7 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
210554
210997
|
'ws': {
|
|
210555
210998
|
'spot': 'wss://testnet.binance.vision/ws',
|
|
210556
210999
|
'margin': 'wss://testnet.binance.vision/ws',
|
|
210557
|
-
'future': 'wss://
|
|
211000
|
+
'future': 'wss://fstream.binancefuture.com/ws',
|
|
210558
211001
|
'delivery': 'wss://dstream.binancefuture.com/ws',
|
|
210559
211002
|
'ws': 'wss://testnet.binance.vision/ws-api/v3',
|
|
210560
211003
|
},
|
|
@@ -211496,7 +211939,7 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
211496
211939
|
}
|
|
211497
211940
|
else {
|
|
211498
211941
|
// take the timestamp of the closing price for candlestick streams
|
|
211499
|
-
timestamp = this.
|
|
211942
|
+
timestamp = this.safeInteger2(message, 'C', 'E');
|
|
211500
211943
|
}
|
|
211501
211944
|
const marketId = this.safeString(message, 's');
|
|
211502
211945
|
const symbol = this.safeSymbol(marketId, undefined, undefined, marketType);
|
|
@@ -212487,12 +212930,13 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
212487
212930
|
/**
|
|
212488
212931
|
* @method
|
|
212489
212932
|
* @name binance#watchOrders
|
|
212490
|
-
* @see https://binance-docs.github.io/apidocs/spot/en/#payload-order-update
|
|
212491
212933
|
* @description watches information on multiple orders made by the user
|
|
212492
|
-
* @
|
|
212934
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#payload-order-update
|
|
212935
|
+
* @param {string} symbol unified market symbol of the market the orders were made in
|
|
212493
212936
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
212494
212937
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
212495
212938
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
212939
|
+
* @param {string|undefined} [params.marginMode] 'cross' or 'isolated', for spot margin
|
|
212496
212940
|
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
212497
212941
|
*/
|
|
212498
212942
|
await this.loadMarkets();
|
|
@@ -212515,8 +212959,10 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
212515
212959
|
}
|
|
212516
212960
|
params = this.extend(params, { 'type': type, 'symbol': symbol }); // needed inside authenticate for isolated margin
|
|
212517
212961
|
await this.authenticate(params);
|
|
212962
|
+
let marginMode = undefined;
|
|
212963
|
+
[marginMode, params] = this.handleMarginModeAndParams('watchOrders', params);
|
|
212518
212964
|
let urlType = type;
|
|
212519
|
-
if (type === 'margin') {
|
|
212965
|
+
if ((type === 'margin') || ((type === 'spot') && (marginMode !== undefined))) {
|
|
212520
212966
|
urlType = 'spot'; // spot-margin shares the same stream as regular spot
|
|
212521
212967
|
}
|
|
212522
212968
|
const url = this.urls['api']['ws'][urlType] + '/' + this.options[type]['listenKey'];
|
|
@@ -213318,12 +213764,18 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
213318
213764
|
/* harmony export */ Z: () => (/* binding */ binancecoinm)
|
|
213319
213765
|
/* harmony export */ });
|
|
213320
213766
|
/* harmony import */ var _binance_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8764);
|
|
213767
|
+
/* harmony import */ var _binancecoinm_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9212);
|
|
213321
213768
|
// ---------------------------------------------------------------------------
|
|
213322
213769
|
|
|
213770
|
+
|
|
213323
213771
|
// ---------------------------------------------------------------------------
|
|
213324
213772
|
class binancecoinm extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
213325
213773
|
describe() {
|
|
213326
|
-
|
|
213774
|
+
// eslint-disable-next-line new-cap
|
|
213775
|
+
const restInstance = new _binancecoinm_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z();
|
|
213776
|
+
const restDescribe = restInstance.describe();
|
|
213777
|
+
const extended = this.deepExtend(super.describe(), restDescribe);
|
|
213778
|
+
return this.deepExtend(extended, {
|
|
213327
213779
|
'id': 'binancecoinm',
|
|
213328
213780
|
'name': 'Binance COIN-M',
|
|
213329
213781
|
'urls': {
|
|
@@ -213347,12 +213799,18 @@ class binancecoinm extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
213347
213799
|
/* harmony export */ Z: () => (/* binding */ binanceus)
|
|
213348
213800
|
/* harmony export */ });
|
|
213349
213801
|
/* harmony import */ var _binance_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8764);
|
|
213802
|
+
/* harmony import */ var _binanceus_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2723);
|
|
213350
213803
|
// ---------------------------------------------------------------------------
|
|
213351
213804
|
|
|
213805
|
+
|
|
213352
213806
|
// ---------------------------------------------------------------------------
|
|
213353
213807
|
class binanceus extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
213354
213808
|
describe() {
|
|
213355
|
-
|
|
213809
|
+
// eslint-disable-next-line new-cap
|
|
213810
|
+
const restInstance = new _binanceus_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z();
|
|
213811
|
+
const restDescribe = restInstance.describe();
|
|
213812
|
+
const extended = this.deepExtend(super.describe(), restDescribe);
|
|
213813
|
+
return this.deepExtend(extended, {
|
|
213356
213814
|
'id': 'binanceus',
|
|
213357
213815
|
'name': 'Binance US',
|
|
213358
213816
|
'countries': ['US'],
|
|
@@ -214396,12 +214854,18 @@ class bingx extends _bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
214396
214854
|
/* harmony export */ Z: () => (/* binding */ bitcoincom)
|
|
214397
214855
|
/* harmony export */ });
|
|
214398
214856
|
/* harmony import */ var _hitbtc_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5189);
|
|
214857
|
+
/* harmony import */ var _bequant_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2049);
|
|
214399
214858
|
// ---------------------------------------------------------------------------
|
|
214400
214859
|
|
|
214860
|
+
|
|
214401
214861
|
// ---------------------------------------------------------------------------
|
|
214402
214862
|
class bitcoincom extends _hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
214403
214863
|
describe() {
|
|
214404
|
-
|
|
214864
|
+
// eslint-disable-next-line new-cap
|
|
214865
|
+
const restInstance = new _bequant_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z();
|
|
214866
|
+
const restDescribe = restInstance.describe();
|
|
214867
|
+
const extended = this.deepExtend(super.describe(), restDescribe);
|
|
214868
|
+
return this.deepExtend(extended, {
|
|
214405
214869
|
'id': 'bitcoincom',
|
|
214406
214870
|
'name': 'bitcoin.com',
|
|
214407
214871
|
'countries': ['KN'],
|
|
@@ -217530,7 +217994,7 @@ class bitget extends _bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
217530
217994
|
'price': this.safeString(order, 'price'),
|
|
217531
217995
|
'stopPrice': triggerPrice,
|
|
217532
217996
|
'triggerPrice': triggerPrice,
|
|
217533
|
-
'amount': this.
|
|
217997
|
+
'amount': this.safeString(order, 'baseVolume'),
|
|
217534
217998
|
'cost': this.safeStringN(order, ['notional', 'notionalUsd', 'quoteSize']),
|
|
217535
217999
|
'average': this.omitZero(this.safeString2(order, 'priceAvg', 'fillPrice')),
|
|
217536
218000
|
'filled': this.safeString2(order, 'accBaseVolume', 'baseVolume'),
|
|
@@ -221814,7 +222278,12 @@ class bitrue extends _bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
221814
222278
|
const symbol = market['symbol'];
|
|
221815
222279
|
const timestamp = this.safeInteger(message, 'ts');
|
|
221816
222280
|
const tick = this.safeValue(message, 'tick', {});
|
|
221817
|
-
|
|
222281
|
+
let orderbook = this.safeValue(this.orderbooks, symbol);
|
|
222282
|
+
if (orderbook === undefined) {
|
|
222283
|
+
orderbook = this.orderBook();
|
|
222284
|
+
}
|
|
222285
|
+
const snapshot = this.parseOrderBook(tick, symbol, timestamp, 'buys', 'asks');
|
|
222286
|
+
orderbook.reset(snapshot);
|
|
221818
222287
|
this.orderbooks[symbol] = orderbook;
|
|
221819
222288
|
const messageHash = 'orderbook:' + symbol;
|
|
221820
222289
|
client.resolve(orderbook, messageHash);
|
|
@@ -236456,6 +236925,12 @@ class hitbtc extends _hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
236456
236925
|
'private': 'wss://api.hitbtc.com/api/3/ws/trading',
|
|
236457
236926
|
},
|
|
236458
236927
|
},
|
|
236928
|
+
'test': {
|
|
236929
|
+
'ws': {
|
|
236930
|
+
'public': 'wss://api.demo.hitbtc.com/api/3/ws/public',
|
|
236931
|
+
'private': 'wss://api.demo.hitbtc.com/api/3/ws/trading',
|
|
236932
|
+
},
|
|
236933
|
+
},
|
|
236459
236934
|
},
|
|
236460
236935
|
'options': {
|
|
236461
236936
|
'tradesLimit': 1000,
|
|
@@ -251902,13 +252377,15 @@ class okx extends _okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
251902
252377
|
/**
|
|
251903
252378
|
* @method
|
|
251904
252379
|
* @name okx#watchMyTrades
|
|
251905
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-ws-order-channel
|
|
251906
252380
|
* @description watches information on multiple trades made by the user
|
|
252381
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-ws-order-channel
|
|
251907
252382
|
* @param {string} [symbol] unified market symbol of the market trades were made in
|
|
251908
252383
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
251909
252384
|
* @param {int} [limit] the maximum number of trade structures to retrieve
|
|
251910
252385
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
251911
252386
|
* @param {bool} [params.stop] true if fetching trigger or conditional trades
|
|
252387
|
+
* @param {string} [params.type] 'spot', 'swap', 'future', 'option', 'ANY', 'SPOT', 'MARGIN', 'SWAP', 'FUTURES' or 'OPTION'
|
|
252388
|
+
* @param {string} [params.marginMode] 'cross' or 'isolated', for automatically setting the type to spot margin
|
|
251912
252389
|
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure
|
|
251913
252390
|
*/
|
|
251914
252391
|
// By default, receive order updates from any instrument type
|
|
@@ -251930,7 +252407,14 @@ class okx extends _okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
251930
252407
|
if (type === 'future') {
|
|
251931
252408
|
type = 'futures';
|
|
251932
252409
|
}
|
|
251933
|
-
|
|
252410
|
+
let uppercaseType = type.toUpperCase();
|
|
252411
|
+
let marginMode = undefined;
|
|
252412
|
+
[marginMode, params] = this.handleMarginModeAndParams('watchMyTrades', params);
|
|
252413
|
+
if (uppercaseType === 'SPOT') {
|
|
252414
|
+
if (marginMode !== undefined) {
|
|
252415
|
+
uppercaseType = 'MARGIN';
|
|
252416
|
+
}
|
|
252417
|
+
}
|
|
251934
252418
|
const request = {
|
|
251935
252419
|
'instType': uppercaseType,
|
|
251936
252420
|
};
|
|
@@ -252063,13 +252547,15 @@ class okx extends _okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
252063
252547
|
/**
|
|
252064
252548
|
* @method
|
|
252065
252549
|
* @name okx#watchOrders
|
|
252066
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-ws-order-channel
|
|
252067
252550
|
* @description watches information on multiple orders made by the user
|
|
252068
|
-
* @
|
|
252551
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-ws-order-channel
|
|
252552
|
+
* @param {string} [symbol] unified market symbol of the market the orders were made in
|
|
252069
252553
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
252070
252554
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
252071
252555
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
252072
252556
|
* @param {bool} [params.stop] true if fetching trigger or conditional orders
|
|
252557
|
+
* @param {string} [params.type] 'spot', 'swap', 'future', 'option', 'ANY', 'SPOT', 'MARGIN', 'SWAP', 'FUTURES' or 'OPTION'
|
|
252558
|
+
* @param {string} [params.marginMode] 'cross' or 'isolated', for automatically setting the type to spot margin
|
|
252073
252559
|
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
252074
252560
|
*/
|
|
252075
252561
|
let type = undefined;
|
|
@@ -252088,7 +252574,14 @@ class okx extends _okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
252088
252574
|
if (type === 'future') {
|
|
252089
252575
|
type = 'futures';
|
|
252090
252576
|
}
|
|
252091
|
-
|
|
252577
|
+
let uppercaseType = type.toUpperCase();
|
|
252578
|
+
let marginMode = undefined;
|
|
252579
|
+
[marginMode, params] = this.handleMarginModeAndParams('watchOrders', params);
|
|
252580
|
+
if (uppercaseType === 'SPOT') {
|
|
252581
|
+
if (marginMode !== undefined) {
|
|
252582
|
+
uppercaseType = 'MARGIN';
|
|
252583
|
+
}
|
|
252584
|
+
}
|
|
252092
252585
|
const request = {
|
|
252093
252586
|
'instType': uppercaseType,
|
|
252094
252587
|
};
|
|
@@ -284038,7 +284531,7 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
284038
284531
|
'fetchClosedOrder': false,
|
|
284039
284532
|
'fetchClosedOrders': false,
|
|
284040
284533
|
'fetchCurrencies': true,
|
|
284041
|
-
'fetchDepositAddress':
|
|
284534
|
+
'fetchDepositAddress': true,
|
|
284042
284535
|
'fetchDeposits': true,
|
|
284043
284536
|
'fetchDepositsWithdrawals': true,
|
|
284044
284537
|
'fetchFundingHistory': true,
|
|
@@ -296271,7 +296764,7 @@ SOFTWARE.
|
|
|
296271
296764
|
|
|
296272
296765
|
//-----------------------------------------------------------------------------
|
|
296273
296766
|
// this is updated by vss.js when building
|
|
296274
|
-
const version = '4.2.
|
|
296767
|
+
const version = '4.2.23';
|
|
296275
296768
|
_src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
|
|
296276
296769
|
//-----------------------------------------------------------------------------
|
|
296277
296770
|
|