ccxt 4.2.20 → 4.2.22
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 +1405 -274
- package/dist/ccxt.browser.min.js +6 -6
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +37 -4
- package/dist/cjs/src/base/ws/WsClient.js +3 -1
- package/dist/cjs/src/bigone.js +1 -0
- package/dist/cjs/src/binance.js +14 -3
- package/dist/cjs/src/bitget.js +12 -2
- package/dist/cjs/src/bitrue.js +1 -0
- package/dist/cjs/src/bitvavo.js +271 -172
- package/dist/cjs/src/blockchaincom.js +3 -1
- package/dist/cjs/src/bybit.js +57 -9
- package/dist/cjs/src/coinbasepro.js +1 -0
- package/dist/cjs/src/coinex.js +37 -12
- package/dist/cjs/src/deribit.js +164 -0
- package/dist/cjs/src/gate.js +32 -1
- package/dist/cjs/src/novadax.js +26 -22
- package/dist/cjs/src/okcoin.js +3 -0
- package/dist/cjs/src/phemex.js +7 -3
- package/dist/cjs/src/poloniex.js +1 -0
- package/dist/cjs/src/pro/bequant.js +6 -1
- package/dist/cjs/src/pro/binance.js +7 -4
- 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/bitopro.js +7 -3
- package/dist/cjs/src/pro/bitrue.js +6 -1
- package/dist/cjs/src/pro/bitvavo.js +668 -22
- package/dist/cjs/src/pro/lbank.js +1 -1
- package/dist/cjs/src/pro/okx.js +13 -3
- 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/abstract/gate.d.ts +1 -0
- package/js/src/abstract/gateio.d.ts +1 -0
- package/js/src/abstract/novadax.d.ts +5 -1
- package/js/src/abstract/phemex.d.ts +1 -0
- package/js/src/base/Exchange.d.ts +12 -1
- package/js/src/base/Exchange.js +37 -4
- package/js/src/base/ws/WsClient.js +3 -2
- package/js/src/bigone.js +1 -0
- package/js/src/binance.js +14 -3
- package/js/src/bitget.js +12 -2
- package/js/src/bitrue.js +1 -0
- package/js/src/bitvavo.d.ts +14 -2
- package/js/src/bitvavo.js +271 -172
- package/js/src/blockchaincom.js +3 -1
- 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 +37 -12
- package/js/src/deribit.d.ts +6 -1
- package/js/src/deribit.js +164 -0
- package/js/src/gate.d.ts +1 -0
- package/js/src/gate.js +32 -1
- package/js/src/novadax.js +26 -22
- package/js/src/okcoin.js +3 -0
- package/js/src/phemex.js +7 -3
- package/js/src/poloniex.js +1 -0
- package/js/src/pro/bequant.js +6 -1
- package/js/src/pro/binance.js +7 -4
- 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/bitopro.js +7 -3
- package/js/src/pro/bitrue.js +6 -1
- package/js/src/pro/bitvavo.d.ts +35 -2
- package/js/src/pro/bitvavo.js +669 -23
- package/js/src/pro/lbank.js +1 -1
- package/js/src/pro/okx.js +13 -3
- 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
|
@@ -7394,11 +7394,13 @@ class Exchange {
|
|
|
7394
7394
|
'fetchCrossBorrowRate': undefined,
|
|
7395
7395
|
'fetchCrossBorrowRates': undefined,
|
|
7396
7396
|
'fetchCurrencies': 'emulated',
|
|
7397
|
+
'fetchCurrenciesWs': 'emulated',
|
|
7397
7398
|
'fetchDeposit': undefined,
|
|
7398
7399
|
'fetchDepositAddress': undefined,
|
|
7399
7400
|
'fetchDepositAddresses': undefined,
|
|
7400
7401
|
'fetchDepositAddressesByNetwork': undefined,
|
|
7401
7402
|
'fetchDeposits': undefined,
|
|
7403
|
+
'fetchDepositsWs': undefined,
|
|
7402
7404
|
'fetchDepositsWithdrawals': undefined,
|
|
7403
7405
|
'fetchTransactionFee': undefined,
|
|
7404
7406
|
'fetchTransactionFees': undefined,
|
|
@@ -7416,9 +7418,11 @@ class Exchange {
|
|
|
7416
7418
|
'fetchLeverageTiers': undefined,
|
|
7417
7419
|
'fetchMarketLeverageTiers': undefined,
|
|
7418
7420
|
'fetchMarkets': true,
|
|
7421
|
+
'fetchMarketsWs': undefined,
|
|
7419
7422
|
'fetchMarkOHLCV': undefined,
|
|
7420
7423
|
'fetchMyTrades': undefined,
|
|
7421
7424
|
'fetchOHLCV': undefined,
|
|
7425
|
+
'fetchOHLCVWs': undefined,
|
|
7422
7426
|
'fetchOpenInterest': undefined,
|
|
7423
7427
|
'fetchOpenInterestHistory': undefined,
|
|
7424
7428
|
'fetchOpenOrder': undefined,
|
|
@@ -7441,12 +7445,14 @@ class Exchange {
|
|
|
7441
7445
|
'fetchTrades': true,
|
|
7442
7446
|
'fetchTradingFee': undefined,
|
|
7443
7447
|
'fetchTradingFees': undefined,
|
|
7448
|
+
'fetchTradingFeesWs': undefined,
|
|
7444
7449
|
'fetchTradingLimits': undefined,
|
|
7445
7450
|
'fetchTransactions': undefined,
|
|
7446
7451
|
'fetchTransfers': undefined,
|
|
7447
7452
|
'fetchWithdrawAddresses': undefined,
|
|
7448
7453
|
'fetchWithdrawal': undefined,
|
|
7449
7454
|
'fetchWithdrawals': undefined,
|
|
7455
|
+
'fetchWithdrawalsWs': undefined,
|
|
7450
7456
|
'reduceMargin': undefined,
|
|
7451
7457
|
'setLeverage': undefined,
|
|
7452
7458
|
'setMargin': undefined,
|
|
@@ -7966,6 +7972,13 @@ class Exchange {
|
|
|
7966
7972
|
// and may be changed for consistency later
|
|
7967
7973
|
return new Promise((resolve, reject) => resolve(this.currencies));
|
|
7968
7974
|
}
|
|
7975
|
+
fetchCurrenciesWs(params = {}) {
|
|
7976
|
+
// markets are returned as a list
|
|
7977
|
+
// currencies are returned as a dict
|
|
7978
|
+
// this is for historical reasons
|
|
7979
|
+
// and may be changed for consistency later
|
|
7980
|
+
return new Promise((resolve, reject) => resolve(this.currencies));
|
|
7981
|
+
}
|
|
7969
7982
|
fetchMarkets(params = {}) {
|
|
7970
7983
|
// markets are returned as a list
|
|
7971
7984
|
// currencies are returned as a dict
|
|
@@ -7973,6 +7986,13 @@ class Exchange {
|
|
|
7973
7986
|
// and may be changed for consistency later
|
|
7974
7987
|
return new Promise((resolve, reject) => resolve(Object.values(this.markets)));
|
|
7975
7988
|
}
|
|
7989
|
+
fetchMarketsWs(params = {}) {
|
|
7990
|
+
// markets are returned as a list
|
|
7991
|
+
// currencies are returned as a dict
|
|
7992
|
+
// this is for historical reasons
|
|
7993
|
+
// and may be changed for consistency later
|
|
7994
|
+
return new Promise((resolve, reject) => resolve(Object.values(this.markets)));
|
|
7995
|
+
}
|
|
7976
7996
|
checkRequiredDependencies() {
|
|
7977
7997
|
return;
|
|
7978
7998
|
}
|
|
@@ -9753,6 +9773,13 @@ class Exchange {
|
|
|
9753
9773
|
}
|
|
9754
9774
|
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchOHLCV() is not supported yet' + message);
|
|
9755
9775
|
}
|
|
9776
|
+
async fetchOHLCVWs(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
|
|
9777
|
+
let message = '';
|
|
9778
|
+
if (this.has['fetchTradesWs']) {
|
|
9779
|
+
message = '. If you want to build OHLCV candles from trade executions data, visit https://github.com/ccxt/ccxt/tree/master/examples/ and see "build-ohlcv-bars" file';
|
|
9780
|
+
}
|
|
9781
|
+
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchOHLCVWs() is not supported yet. Try using fetchOHLCV instead.' + message);
|
|
9782
|
+
}
|
|
9756
9783
|
async watchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
|
|
9757
9784
|
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' watchOHLCV() is not supported yet');
|
|
9758
9785
|
}
|
|
@@ -10112,7 +10139,7 @@ class Exchange {
|
|
|
10112
10139
|
for (let i = 0; i < response.length; i++) {
|
|
10113
10140
|
const item = response[i];
|
|
10114
10141
|
const id = this.safeString(item, marketIdKey);
|
|
10115
|
-
const market = this.safeMarket(id, undefined, undefined,
|
|
10142
|
+
const market = this.safeMarket(id, undefined, undefined, 'swap');
|
|
10116
10143
|
const symbol = market['symbol'];
|
|
10117
10144
|
const contract = this.safeValue(market, 'contract', false);
|
|
10118
10145
|
if (contract && ((symbols === undefined) || this.inArray(symbol, symbols))) {
|
|
@@ -11106,9 +11133,6 @@ class Exchange {
|
|
|
11106
11133
|
async watchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
11107
11134
|
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' watchMyTrades() is not supported yet');
|
|
11108
11135
|
}
|
|
11109
|
-
async fetchOHLCVWs(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
|
|
11110
|
-
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchOHLCVWs() is not supported yet');
|
|
11111
|
-
}
|
|
11112
11136
|
async fetchGreeks(symbol, params = {}) {
|
|
11113
11137
|
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchGreeks() is not supported yet');
|
|
11114
11138
|
}
|
|
@@ -11128,9 +11152,15 @@ class Exchange {
|
|
|
11128
11152
|
async fetchDeposits(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
11129
11153
|
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchDeposits() is not supported yet');
|
|
11130
11154
|
}
|
|
11155
|
+
async fetchDepositsWs(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
11156
|
+
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchDepositsWs() is not supported yet');
|
|
11157
|
+
}
|
|
11131
11158
|
async fetchWithdrawals(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
11132
11159
|
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchWithdrawals() is not supported yet');
|
|
11133
11160
|
}
|
|
11161
|
+
async fetchWithdrawalsWs(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
11162
|
+
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchWithdrawalsWs() is not supported yet');
|
|
11163
|
+
}
|
|
11134
11164
|
async fetchOpenInterest(symbol, params = {}) {
|
|
11135
11165
|
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchOpenInterest() is not supported yet');
|
|
11136
11166
|
}
|
|
@@ -11610,6 +11640,9 @@ class Exchange {
|
|
|
11610
11640
|
async fetchTradingFees(params = {}) {
|
|
11611
11641
|
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchTradingFees() is not supported yet');
|
|
11612
11642
|
}
|
|
11643
|
+
async fetchTradingFeesWs(params = {}) {
|
|
11644
|
+
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchTradingFeesWs() is not supported yet');
|
|
11645
|
+
}
|
|
11613
11646
|
async fetchTradingFee(symbol, params = {}) {
|
|
11614
11647
|
if (!this.has['fetchTradingFees']) {
|
|
11615
11648
|
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchTradingFee() is not supported yet');
|
|
@@ -15378,16 +15411,18 @@ class IndexedBids extends IndexedOrderBookSide {
|
|
|
15378
15411
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
15379
15412
|
/* harmony export */ Z: () => (/* binding */ WsClient)
|
|
15380
15413
|
/* harmony export */ });
|
|
15414
|
+
/* harmony import */ var ws__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7026);
|
|
15415
|
+
/* harmony import */ var ws__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(ws__WEBPACK_IMPORTED_MODULE_0__);
|
|
15381
15416
|
/* harmony import */ var _Client_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2897);
|
|
15382
15417
|
/* harmony import */ var _base_functions_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9125);
|
|
15383
15418
|
/* harmony import */ var _base_functions_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(1621);
|
|
15384
|
-
/* harmony import */ var ws__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7026);
|
|
15385
|
-
/* harmony import */ var ws__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(ws__WEBPACK_IMPORTED_MODULE_0__);
|
|
15386
15419
|
/* harmony import */ var _Future_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(2367);
|
|
15420
|
+
// eslint-disable-next-line no-shadow
|
|
15387
15421
|
|
|
15388
15422
|
|
|
15389
15423
|
|
|
15390
15424
|
|
|
15425
|
+
// eslint-disable-next-line no-restricted-globals
|
|
15391
15426
|
const WebSocketPlatform = _base_functions_js__WEBPACK_IMPORTED_MODULE_1__/* .isNode */ .UG ? (ws__WEBPACK_IMPORTED_MODULE_0___default()) : self.WebSocket;
|
|
15392
15427
|
class WsClient extends _Client_js__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z {
|
|
15393
15428
|
createConnection() {
|
|
@@ -15441,7 +15476,6 @@ class WsClient extends _Client_js__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */
|
|
|
15441
15476
|
return this.disconnected;
|
|
15442
15477
|
}
|
|
15443
15478
|
}
|
|
15444
|
-
;
|
|
15445
15479
|
|
|
15446
15480
|
|
|
15447
15481
|
/***/ }),
|
|
@@ -15539,6 +15573,7 @@ class bigone extends _abstract_bigone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
15539
15573
|
'fetchCurrencies': true,
|
|
15540
15574
|
'fetchDepositAddress': true,
|
|
15541
15575
|
'fetchDeposits': true,
|
|
15576
|
+
'fetchFundingRate': false,
|
|
15542
15577
|
'fetchMarkets': true,
|
|
15543
15578
|
'fetchMyTrades': true,
|
|
15544
15579
|
'fetchOHLCV': true,
|
|
@@ -18030,6 +18065,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
18030
18065
|
'convert/exchangeInfo': 50,
|
|
18031
18066
|
'convert/assetInfo': 10,
|
|
18032
18067
|
'convert/orderStatus': 0.6667,
|
|
18068
|
+
'convert/limit/queryOpenOrders': 20.001,
|
|
18033
18069
|
'account/status': 0.1,
|
|
18034
18070
|
'account/apiTradingStatus': 0.1,
|
|
18035
18071
|
'account/apiRestrictions/ipRestriction': 0.1,
|
|
@@ -18301,6 +18337,8 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
18301
18337
|
'loan/vip/repay': 40.002,
|
|
18302
18338
|
'convert/getQuote': 1.3334,
|
|
18303
18339
|
'convert/acceptQuote': 3.3335,
|
|
18340
|
+
'convert/limit/placeOrder': 3.3335,
|
|
18341
|
+
'convert/limit/cancelOrder': 1.3334,
|
|
18304
18342
|
'portfolio/auto-collection': 150,
|
|
18305
18343
|
'portfolio/asset-collection': 6,
|
|
18306
18344
|
'portfolio/bnb-transfer': 150,
|
|
@@ -25687,12 +25725,20 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
25687
25725
|
/**
|
|
25688
25726
|
* @method
|
|
25689
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
|
|
25690
25733
|
* @description fetch all open positions
|
|
25691
|
-
* @param {string[]
|
|
25734
|
+
* @param {string[]} [symbols] list of unified market symbols
|
|
25692
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"
|
|
25693
25737
|
* @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
25694
25738
|
*/
|
|
25695
|
-
const
|
|
25739
|
+
const defaultValue = this.safeString(this.options, 'fetchPositions', 'positionRisk');
|
|
25740
|
+
let defaultMethod = undefined;
|
|
25741
|
+
[defaultMethod, params] = this.handleOptionAndParams(params, 'fetchPositions', 'method', defaultValue);
|
|
25696
25742
|
if (defaultMethod === 'positionRisk') {
|
|
25697
25743
|
return await this.fetchPositionsRisk(symbols, params);
|
|
25698
25744
|
}
|
|
@@ -25703,7 +25749,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
25703
25749
|
return await this.fetchOptionPositions(symbols, params);
|
|
25704
25750
|
}
|
|
25705
25751
|
else {
|
|
25706
|
-
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"');
|
|
25707
25753
|
}
|
|
25708
25754
|
}
|
|
25709
25755
|
async fetchAccountPositions(symbols = undefined, params = {}) {
|
|
@@ -41542,6 +41588,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
41542
41588
|
'cancelOrders': true,
|
|
41543
41589
|
'closeAllPositions': true,
|
|
41544
41590
|
'closePosition': true,
|
|
41591
|
+
'createDepositAddress': false,
|
|
41545
41592
|
'createMarketBuyOrderWithCost': true,
|
|
41546
41593
|
'createMarketOrderWithCost': false,
|
|
41547
41594
|
'createMarketSellOrderWithCost': false,
|
|
@@ -41551,16 +41598,21 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
41551
41598
|
'createReduceOnlyOrder': false,
|
|
41552
41599
|
'createStopLossOrder': true,
|
|
41553
41600
|
'createTakeProfitOrder': true,
|
|
41601
|
+
'createPostOnlyOrder': true,
|
|
41602
|
+
'createStopOrder': true,
|
|
41603
|
+
'createStopLimitOrder': true,
|
|
41604
|
+
'createStopMarketOrder': true,
|
|
41554
41605
|
'createTrailingPercentOrder': true,
|
|
41555
41606
|
'createTriggerOrder': true,
|
|
41607
|
+
'signIn': false,
|
|
41556
41608
|
'editOrder': true,
|
|
41557
41609
|
'fetchAccounts': false,
|
|
41558
41610
|
'fetchBalance': true,
|
|
41559
41611
|
'fetchBorrowInterest': true,
|
|
41560
41612
|
'fetchBorrowRateHistories': false,
|
|
41561
41613
|
'fetchBorrowRateHistory': false,
|
|
41562
|
-
'fetchCanceledOrders': true,
|
|
41563
41614
|
'fetchCanceledAndClosedOrders': true,
|
|
41615
|
+
'fetchCanceledOrders': true,
|
|
41564
41616
|
'fetchClosedOrders': true,
|
|
41565
41617
|
'fetchCrossBorrowRate': true,
|
|
41566
41618
|
'fetchCrossBorrowRates': false,
|
|
@@ -41570,7 +41622,10 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
41570
41622
|
'fetchDeposits': true,
|
|
41571
41623
|
'fetchDepositWithdrawFee': 'emulated',
|
|
41572
41624
|
'fetchDepositWithdrawFees': true,
|
|
41625
|
+
'fetchDepositsWithdrawals': false,
|
|
41573
41626
|
'fetchFundingHistory': true,
|
|
41627
|
+
'fetchWithdrawAddresses': false,
|
|
41628
|
+
'fetchTransactions': false,
|
|
41574
41629
|
'fetchFundingRate': true,
|
|
41575
41630
|
'fetchFundingRateHistory': true,
|
|
41576
41631
|
'fetchFundingRates': false,
|
|
@@ -41581,7 +41636,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
41581
41636
|
'fetchLeverage': true,
|
|
41582
41637
|
'fetchLeverageTiers': false,
|
|
41583
41638
|
'fetchLiquidations': false,
|
|
41584
|
-
'fetchMarginMode':
|
|
41639
|
+
'fetchMarginMode': false,
|
|
41585
41640
|
'fetchMarketLeverageTiers': true,
|
|
41586
41641
|
'fetchMarkets': true,
|
|
41587
41642
|
'fetchMarkOHLCV': true,
|
|
@@ -41594,6 +41649,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
41594
41649
|
'fetchOrder': true,
|
|
41595
41650
|
'fetchOrderBook': true,
|
|
41596
41651
|
'fetchOrders': false,
|
|
41652
|
+
'createTrailingAmountOrder': false,
|
|
41597
41653
|
'fetchOrderTrades': false,
|
|
41598
41654
|
'fetchPosition': true,
|
|
41599
41655
|
'fetchPositionMode': false,
|
|
@@ -60086,6 +60142,7 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
60086
60142
|
'fetchDepositsWithdrawals': false,
|
|
60087
60143
|
'fetchDepositWithdrawFee': 'emulated',
|
|
60088
60144
|
'fetchDepositWithdrawFees': true,
|
|
60145
|
+
'fetchFundingRate': false,
|
|
60089
60146
|
'fetchIsolatedBorrowRate': false,
|
|
60090
60147
|
'fetchIsolatedBorrowRates': false,
|
|
60091
60148
|
'fetchMarginMode': false,
|
|
@@ -69894,6 +69951,7 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
69894
69951
|
/**
|
|
69895
69952
|
* @method
|
|
69896
69953
|
* @name bitvavo#fetchMarkets
|
|
69954
|
+
* @see https://docs.bitvavo.com/#tag/General/paths/~1markets/get
|
|
69897
69955
|
* @description retrieves data on all markets for bitvavo
|
|
69898
69956
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
69899
69957
|
* @returns {object[]} an array of objects representing market data
|
|
@@ -69913,12 +69971,15 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
69913
69971
|
// }
|
|
69914
69972
|
// ]
|
|
69915
69973
|
//
|
|
69974
|
+
return this.parseMarkets(response);
|
|
69975
|
+
}
|
|
69976
|
+
parseMarkets(markets) {
|
|
69916
69977
|
const currencies = this.currencies;
|
|
69917
69978
|
const currenciesById = this.indexBy(currencies, 'id');
|
|
69918
69979
|
const result = [];
|
|
69919
69980
|
const fees = this.fees;
|
|
69920
|
-
for (let i = 0; i <
|
|
69921
|
-
const market =
|
|
69981
|
+
for (let i = 0; i < markets.length; i++) {
|
|
69982
|
+
const market = markets[i];
|
|
69922
69983
|
const id = this.safeString(market, 'market');
|
|
69923
69984
|
const baseId = this.safeString(market, 'base');
|
|
69924
69985
|
const quoteId = this.safeString(market, 'quote');
|
|
@@ -69985,11 +70046,48 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
69985
70046
|
/**
|
|
69986
70047
|
* @method
|
|
69987
70048
|
* @name bitvavo#fetchCurrencies
|
|
70049
|
+
* @see https://docs.bitvavo.com/#tag/General/paths/~1assets/get
|
|
69988
70050
|
* @description fetches all available currencies on an exchange
|
|
69989
70051
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
69990
70052
|
* @returns {object} an associative dictionary of currencies
|
|
69991
70053
|
*/
|
|
69992
70054
|
const response = await this.publicGetAssets(params);
|
|
70055
|
+
//
|
|
70056
|
+
// [
|
|
70057
|
+
// {
|
|
70058
|
+
// "symbol": "USDT",
|
|
70059
|
+
// "displayTicker": "USDT",
|
|
70060
|
+
// "name": "Tether",
|
|
70061
|
+
// "slug": "tether",
|
|
70062
|
+
// "popularity": -1,
|
|
70063
|
+
// "decimals": 6,
|
|
70064
|
+
// "depositFee": "0",
|
|
70065
|
+
// "depositConfirmations": 64,
|
|
70066
|
+
// "depositStatus": "OK",
|
|
70067
|
+
// "withdrawalFee": "3.2",
|
|
70068
|
+
// "withdrawalMinAmount": "3.2",
|
|
70069
|
+
// "withdrawalStatus": "OK",
|
|
70070
|
+
// "networks": [
|
|
70071
|
+
// "ETH"
|
|
70072
|
+
// ],
|
|
70073
|
+
// "light": {
|
|
70074
|
+
// "color": "#009393",
|
|
70075
|
+
// "icon": { "hash": "4ad7c699", "svg": "https://...", "webp16": "https://...", "webp32": "https://...", "webp64": "https://...", "webp128": "https://...", "webp256": "https://...", "png16": "https://...", "png32": "https://...", "png64": "https://...", "png128": "https://...", "png256": "https://..."
|
|
70076
|
+
// }
|
|
70077
|
+
// },
|
|
70078
|
+
// "dark": {
|
|
70079
|
+
// "color": "#009393",
|
|
70080
|
+
// "icon": { "hash": "4ad7c699", "svg": "https://...", "webp16": "https://...", "webp32": "https://...", "webp64": "https://...", "webp128": "https://...", "webp256": "https://...", "png16": "https://...", "png32": "https://...", "png64": "https://...", "png128": "https://...", "png256": "https://..."
|
|
70081
|
+
// }
|
|
70082
|
+
// },
|
|
70083
|
+
// "visibility": "PUBLIC",
|
|
70084
|
+
// "message": ""
|
|
70085
|
+
// },
|
|
70086
|
+
// ]
|
|
70087
|
+
//
|
|
70088
|
+
return this.parseCurrencies(response);
|
|
70089
|
+
}
|
|
70090
|
+
parseCurrencies(currencies) {
|
|
69993
70091
|
//
|
|
69994
70092
|
// [
|
|
69995
70093
|
// {
|
|
@@ -70024,8 +70122,8 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
70024
70122
|
// ]
|
|
70025
70123
|
//
|
|
70026
70124
|
const result = {};
|
|
70027
|
-
for (let i = 0; i <
|
|
70028
|
-
const currency =
|
|
70125
|
+
for (let i = 0; i < currencies.length; i++) {
|
|
70126
|
+
const currency = currencies[i];
|
|
70029
70127
|
const id = this.safeString(currency, 'symbol');
|
|
70030
70128
|
const code = this.safeCurrencyCode(id);
|
|
70031
70129
|
const networks = {};
|
|
@@ -70354,6 +70452,7 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
70354
70452
|
/**
|
|
70355
70453
|
* @method
|
|
70356
70454
|
* @name bitvavo#fetchTradingFees
|
|
70455
|
+
* @see https://docs.bitvavo.com/#tag/Account/paths/~1account/get
|
|
70357
70456
|
* @description fetch the trading fees for multiple markets
|
|
70358
70457
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
70359
70458
|
* @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
|
|
@@ -70369,14 +70468,26 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
70369
70468
|
// }
|
|
70370
70469
|
// }
|
|
70371
70470
|
//
|
|
70372
|
-
|
|
70373
|
-
|
|
70374
|
-
|
|
70471
|
+
return this.parseTradingFees(response);
|
|
70472
|
+
}
|
|
70473
|
+
parseTradingFees(fees, market = undefined) {
|
|
70474
|
+
//
|
|
70475
|
+
// {
|
|
70476
|
+
// "fees": {
|
|
70477
|
+
// "taker": "0.0025",
|
|
70478
|
+
// "maker": "0.0015",
|
|
70479
|
+
// "volume": "10000.00"
|
|
70480
|
+
// }
|
|
70481
|
+
// }
|
|
70482
|
+
//
|
|
70483
|
+
const feesValue = this.safeValue(fees, 'fees');
|
|
70484
|
+
const maker = this.safeNumber(feesValue, 'maker');
|
|
70485
|
+
const taker = this.safeNumber(feesValue, 'taker');
|
|
70375
70486
|
const result = {};
|
|
70376
70487
|
for (let i = 0; i < this.symbols.length; i++) {
|
|
70377
70488
|
const symbol = this.symbols[i];
|
|
70378
70489
|
result[symbol] = {
|
|
70379
|
-
'info':
|
|
70490
|
+
'info': fees,
|
|
70380
70491
|
'symbol': symbol,
|
|
70381
70492
|
'maker': maker,
|
|
70382
70493
|
'taker': taker,
|
|
@@ -70446,6 +70557,30 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
70446
70557
|
this.safeNumber(ohlcv, 5),
|
|
70447
70558
|
];
|
|
70448
70559
|
}
|
|
70560
|
+
fetchOHLCVRequest(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
|
|
70561
|
+
const market = this.market(symbol);
|
|
70562
|
+
let request = {
|
|
70563
|
+
'market': market['id'],
|
|
70564
|
+
'interval': this.safeString(this.timeframes, timeframe, timeframe),
|
|
70565
|
+
// "limit": 1440, // default 1440, max 1440
|
|
70566
|
+
// "start": since,
|
|
70567
|
+
// "end": this.milliseconds (),
|
|
70568
|
+
};
|
|
70569
|
+
if (since !== undefined) {
|
|
70570
|
+
// https://github.com/ccxt/ccxt/issues/9227
|
|
70571
|
+
const duration = this.parseTimeframe(timeframe);
|
|
70572
|
+
request['start'] = since;
|
|
70573
|
+
if (limit === undefined) {
|
|
70574
|
+
limit = 1440;
|
|
70575
|
+
}
|
|
70576
|
+
request['end'] = this.sum(since, limit * duration * 1000);
|
|
70577
|
+
}
|
|
70578
|
+
[request, params] = this.handleUntilOption('end', request, params);
|
|
70579
|
+
if (limit !== undefined) {
|
|
70580
|
+
request['limit'] = limit; // default 1440, max 1440
|
|
70581
|
+
}
|
|
70582
|
+
return this.extend(request, params);
|
|
70583
|
+
}
|
|
70449
70584
|
async fetchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
|
|
70450
70585
|
/**
|
|
70451
70586
|
* @method
|
|
@@ -70468,27 +70603,8 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
70468
70603
|
if (paginate) {
|
|
70469
70604
|
return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 1440);
|
|
70470
70605
|
}
|
|
70471
|
-
|
|
70472
|
-
|
|
70473
|
-
'interval': this.safeString(this.timeframes, timeframe, timeframe),
|
|
70474
|
-
// "limit": 1440, // default 1440, max 1440
|
|
70475
|
-
// "start": since,
|
|
70476
|
-
// "end": this.milliseconds (),
|
|
70477
|
-
};
|
|
70478
|
-
if (since !== undefined) {
|
|
70479
|
-
// https://github.com/ccxt/ccxt/issues/9227
|
|
70480
|
-
const duration = this.parseTimeframe(timeframe);
|
|
70481
|
-
request['start'] = since;
|
|
70482
|
-
if (limit === undefined) {
|
|
70483
|
-
limit = 1440;
|
|
70484
|
-
}
|
|
70485
|
-
request['end'] = this.sum(since, limit * duration * 1000);
|
|
70486
|
-
}
|
|
70487
|
-
[request, params] = this.handleUntilOption('end', request, params);
|
|
70488
|
-
if (limit !== undefined) {
|
|
70489
|
-
request['limit'] = limit; // default 1440, max 1440
|
|
70490
|
-
}
|
|
70491
|
-
const response = await this.publicGetMarketCandles(this.extend(request, params));
|
|
70606
|
+
const request = this.fetchOHLCVRequest(symbol, timeframe, since, limit, params);
|
|
70607
|
+
const response = await this.publicGetMarketCandles(request);
|
|
70492
70608
|
//
|
|
70493
70609
|
// [
|
|
70494
70610
|
// [1590383700000,"8088.5","8088.5","8088.5","8088.5","0.04788623"],
|
|
@@ -70519,6 +70635,7 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
70519
70635
|
/**
|
|
70520
70636
|
* @method
|
|
70521
70637
|
* @name bitvavo#fetchBalance
|
|
70638
|
+
* @see https://docs.bitvavo.com/#tag/Account/paths/~1balance/get
|
|
70522
70639
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
70523
70640
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
70524
70641
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
@@ -70568,33 +70685,7 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
70568
70685
|
'info': response,
|
|
70569
70686
|
};
|
|
70570
70687
|
}
|
|
70571
|
-
|
|
70572
|
-
/**
|
|
70573
|
-
* @method
|
|
70574
|
-
* @name bitvavo#createOrder
|
|
70575
|
-
* @description create a trade order
|
|
70576
|
-
* @see https://docs.bitvavo.com/#tag/Trading-endpoints/paths/~1order/post
|
|
70577
|
-
* @param {string} symbol unified symbol of the market to create an order in
|
|
70578
|
-
* @param {string} type 'market' or 'limit'
|
|
70579
|
-
* @param {string} side 'buy' or 'sell'
|
|
70580
|
-
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
70581
|
-
* @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
70582
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
70583
|
-
* @param {string} [params.timeInForce] "GTC", "IOC", or "PO"
|
|
70584
|
-
* @param {float} [params.stopPrice] The price at which a trigger order is triggered at
|
|
70585
|
-
* @param {float} [params.triggerPrice] The price at which a trigger order is triggered at
|
|
70586
|
-
* @param {bool} [params.postOnly] If true, the order will only be posted to the order book and not executed immediately
|
|
70587
|
-
* @param {float} [params.stopLossPrice] The price at which a stop loss order is triggered at
|
|
70588
|
-
* @param {float} [params.takeProfitPrice] The price at which a take profit order is triggered at
|
|
70589
|
-
* @param {string} [params.triggerType] "price"
|
|
70590
|
-
* @param {string} [params.triggerReference] "lastTrade", "bestBid", "bestAsk", "midPrice" Only for stop orders: Use this to determine which parameter will trigger the order
|
|
70591
|
-
* @param {string} [params.selfTradePrevention] "decrementAndCancel", "cancelOldest", "cancelNewest", "cancelBoth"
|
|
70592
|
-
* @param {bool} [params.disableMarketProtection] don't cancel if the next fill price is 10% worse than the best fill price
|
|
70593
|
-
* @param {bool} [params.responseRequired] Set this to 'false' when only an acknowledgement of success or failure is required, this is faster.
|
|
70594
|
-
* @param {string} [params.clientOrderId] An ID supplied by the client that must be unique among all open orders for the same market
|
|
70595
|
-
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
70596
|
-
*/
|
|
70597
|
-
await this.loadMarkets();
|
|
70688
|
+
createOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
|
|
70598
70689
|
const market = this.market(symbol);
|
|
70599
70690
|
const request = {
|
|
70600
70691
|
'market': market['id'],
|
|
@@ -70658,7 +70749,37 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
70658
70749
|
if (postOnly) {
|
|
70659
70750
|
request['postOnly'] = true;
|
|
70660
70751
|
}
|
|
70661
|
-
|
|
70752
|
+
return this.extend(request, params);
|
|
70753
|
+
}
|
|
70754
|
+
async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
|
|
70755
|
+
/**
|
|
70756
|
+
* @method
|
|
70757
|
+
* @name bitvavo#createOrder
|
|
70758
|
+
* @description create a trade order
|
|
70759
|
+
* @see https://docs.bitvavo.com/#tag/Orders/paths/~1order/post
|
|
70760
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
70761
|
+
* @param {string} type 'market' or 'limit'
|
|
70762
|
+
* @param {string} side 'buy' or 'sell'
|
|
70763
|
+
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
70764
|
+
* @param {float} price the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
70765
|
+
* @param {object} [params] extra parameters specific to the bitvavo api endpoint
|
|
70766
|
+
* @param {string} [params.timeInForce] "GTC", "IOC", or "PO"
|
|
70767
|
+
* @param {float} [params.stopPrice] The price at which a trigger order is triggered at
|
|
70768
|
+
* @param {float} [params.triggerPrice] The price at which a trigger order is triggered at
|
|
70769
|
+
* @param {bool} [params.postOnly] If true, the order will only be posted to the order book and not executed immediately
|
|
70770
|
+
* @param {float} [params.stopLossPrice] The price at which a stop loss order is triggered at
|
|
70771
|
+
* @param {float} [params.takeProfitPrice] The price at which a take profit order is triggered at
|
|
70772
|
+
* @param {string} [params.triggerType] "price"
|
|
70773
|
+
* @param {string} [params.triggerReference] "lastTrade", "bestBid", "bestAsk", "midPrice" Only for stop orders: Use this to determine which parameter will trigger the order
|
|
70774
|
+
* @param {string} [params.selfTradePrevention] "decrementAndCancel", "cancelOldest", "cancelNewest", "cancelBoth"
|
|
70775
|
+
* @param {bool} [params.disableMarketProtection] don't cancel if the next fill price is 10% worse than the best fill price
|
|
70776
|
+
* @param {bool} [params.responseRequired] Set this to 'false' when only an acknowledgement of success or failure is required, this is faster.
|
|
70777
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
70778
|
+
*/
|
|
70779
|
+
await this.loadMarkets();
|
|
70780
|
+
const market = this.market(symbol);
|
|
70781
|
+
const request = this.createOrderRequest(symbol, type, side, amount, price, params);
|
|
70782
|
+
const response = await this.privatePostOrder(request);
|
|
70662
70783
|
//
|
|
70663
70784
|
// {
|
|
70664
70785
|
// "orderId":"dec6a640-5b4c-45bc-8d22-3b41c6716630",
|
|
@@ -70701,29 +70822,61 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
70701
70822
|
//
|
|
70702
70823
|
return this.parseOrder(response, market);
|
|
70703
70824
|
}
|
|
70825
|
+
editOrderRequest(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
|
|
70826
|
+
let request = {};
|
|
70827
|
+
const market = this.market(symbol);
|
|
70828
|
+
const amountRemaining = this.safeNumber(params, 'amountRemaining');
|
|
70829
|
+
const triggerPrice = this.safeStringN(params, ['triggerPrice', 'stopPrice', 'triggerAmount']);
|
|
70830
|
+
params = this.omit(params, ['amountRemaining', 'triggerPrice', 'stopPrice', 'triggerAmount']);
|
|
70831
|
+
if (price !== undefined) {
|
|
70832
|
+
request['price'] = this.priceToPrecision(symbol, price);
|
|
70833
|
+
}
|
|
70834
|
+
if (amount !== undefined) {
|
|
70835
|
+
request['amount'] = this.amountToPrecision(symbol, amount);
|
|
70836
|
+
}
|
|
70837
|
+
if (amountRemaining !== undefined) {
|
|
70838
|
+
request['amountRemaining'] = this.amountToPrecision(symbol, amountRemaining);
|
|
70839
|
+
}
|
|
70840
|
+
if (triggerPrice !== undefined) {
|
|
70841
|
+
request['triggerAmount'] = this.priceToPrecision(symbol, triggerPrice);
|
|
70842
|
+
}
|
|
70843
|
+
request = this.extend(request, params);
|
|
70844
|
+
if (this.isEmpty(request)) {
|
|
70845
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' editOrder() requires an amount argument, or a price argument, or non-empty params');
|
|
70846
|
+
}
|
|
70847
|
+
const clientOrderId = this.safeString(params, 'clientOrderId');
|
|
70848
|
+
if (clientOrderId === undefined) {
|
|
70849
|
+
request['orderId'] = id;
|
|
70850
|
+
}
|
|
70851
|
+
request['market'] = market['id'];
|
|
70852
|
+
return request;
|
|
70853
|
+
}
|
|
70704
70854
|
async editOrder(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
|
|
70705
70855
|
/**
|
|
70706
70856
|
* @method
|
|
70707
70857
|
* @name bitvavo#editOrder
|
|
70708
70858
|
* @description edit a trade order
|
|
70709
|
-
* @see https://docs.bitvavo.com/#tag/
|
|
70859
|
+
* @see https://docs.bitvavo.com/#tag/Orders/paths/~1order/put
|
|
70860
|
+
* @param {string} id cancel order id
|
|
70710
70861
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
70711
70862
|
* @param {string} type 'market' or 'limit'
|
|
70712
70863
|
* @param {string} side 'buy' or 'sell'
|
|
70713
|
-
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
70714
|
-
* @param {float} [price] the price at which the order is to be fullfilled, in units of the
|
|
70715
|
-
* @param {object} [params] extra parameters specific to the
|
|
70716
|
-
* @param {string} [params.timeInForce] "GTC", "IOC", or "PO"
|
|
70717
|
-
* @param {bool} [params.postOnly] If true, the order will only be posted to the order book and not executed immediately
|
|
70718
|
-
* @param {float} [params.stopPrice] The price at which a trigger order is triggered at
|
|
70719
|
-
* @param {float} [params.triggerPrice] The price at which a trigger order is triggered at
|
|
70720
|
-
* @param {string} [params.selfTradePrevention] "decrementAndCancel", "cancelOldest", "cancelNewest", "cancelBoth"
|
|
70721
|
-
* @param {bool} [params.responseRequired] Set this to 'false' when only an acknowledgement of success or failure is required, this is faster.
|
|
70722
|
-
* @param {string} [params.clientOrderId] An ID supplied by the client
|
|
70864
|
+
* @param {float} [amount] how much of currency you want to trade in units of base currency
|
|
70865
|
+
* @param {float} [price] the price at which the order is to be fullfilled, in units of the base currency, ignored in market orders
|
|
70866
|
+
* @param {object} [params] extra parameters specific to the bitvavo api endpoint
|
|
70723
70867
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
70724
70868
|
*/
|
|
70725
70869
|
await this.loadMarkets();
|
|
70726
70870
|
const market = this.market(symbol);
|
|
70871
|
+
const request = this.editOrderRequest(id, symbol, type, side, amount, price, params);
|
|
70872
|
+
const response = await this.privatePutOrder(request);
|
|
70873
|
+
return this.parseOrder(response, market);
|
|
70874
|
+
}
|
|
70875
|
+
cancelOrderRequest(id, symbol = undefined, params = {}) {
|
|
70876
|
+
if (symbol === undefined) {
|
|
70877
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' cancelOrder() requires a symbol argument');
|
|
70878
|
+
}
|
|
70879
|
+
const market = this.market(symbol);
|
|
70727
70880
|
const request = {
|
|
70728
70881
|
'market': market['id'],
|
|
70729
70882
|
};
|
|
@@ -70731,35 +70884,13 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
70731
70884
|
if (clientOrderId === undefined) {
|
|
70732
70885
|
request['orderId'] = id;
|
|
70733
70886
|
}
|
|
70734
|
-
|
|
70735
|
-
const triggerPrice = this.safeStringN(params, ['triggerPrice', 'stopPrice', 'triggerAmount']);
|
|
70736
|
-
params = this.omit(params, ['amountRemaining', 'triggerPrice', 'stopPrice', 'triggerAmount']);
|
|
70737
|
-
let updateRequest = {};
|
|
70738
|
-
if (price !== undefined) {
|
|
70739
|
-
updateRequest['price'] = this.priceToPrecision(symbol, price);
|
|
70740
|
-
}
|
|
70741
|
-
if (amount !== undefined) {
|
|
70742
|
-
updateRequest['amount'] = this.amountToPrecision(symbol, amount);
|
|
70743
|
-
}
|
|
70744
|
-
if (amountRemaining !== undefined) {
|
|
70745
|
-
updateRequest['amountRemaining'] = this.amountToPrecision(symbol, amountRemaining);
|
|
70746
|
-
}
|
|
70747
|
-
if (triggerPrice !== undefined) {
|
|
70748
|
-
updateRequest['triggerAmount'] = this.priceToPrecision(symbol, triggerPrice);
|
|
70749
|
-
}
|
|
70750
|
-
updateRequest = this.extend(updateRequest, params);
|
|
70751
|
-
if (Object.keys(updateRequest).length) {
|
|
70752
|
-
const response = await this.privatePutOrder(this.extend(request, updateRequest));
|
|
70753
|
-
return this.parseOrder(response, market);
|
|
70754
|
-
}
|
|
70755
|
-
else {
|
|
70756
|
-
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' editOrder() requires an amount argument, or a price argument, or non-empty params');
|
|
70757
|
-
}
|
|
70887
|
+
return this.extend(request, params);
|
|
70758
70888
|
}
|
|
70759
70889
|
async cancelOrder(id, symbol = undefined, params = {}) {
|
|
70760
70890
|
/**
|
|
70761
70891
|
* @method
|
|
70762
70892
|
* @name bitvavo#cancelOrder
|
|
70893
|
+
* @see https://docs.bitvavo.com/#tag/Orders/paths/~1order/delete
|
|
70763
70894
|
* @description cancels an open order
|
|
70764
70895
|
* @see https://docs.bitvavo.com/#tag/Trading-endpoints/paths/~1order/delete
|
|
70765
70896
|
* @param {string} id order id
|
|
@@ -70767,19 +70898,10 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
70767
70898
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
70768
70899
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
70769
70900
|
*/
|
|
70770
|
-
if (symbol === undefined) {
|
|
70771
|
-
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' cancelOrder() requires a symbol argument');
|
|
70772
|
-
}
|
|
70773
70901
|
await this.loadMarkets();
|
|
70774
70902
|
const market = this.market(symbol);
|
|
70775
|
-
const request =
|
|
70776
|
-
|
|
70777
|
-
};
|
|
70778
|
-
const clientOrderId = this.safeString(params, 'clientOrderId');
|
|
70779
|
-
if (clientOrderId === undefined) {
|
|
70780
|
-
request['orderId'] = id;
|
|
70781
|
-
}
|
|
70782
|
-
const response = await this.privateDeleteOrder(this.extend(request, params));
|
|
70903
|
+
const request = this.cancelOrderRequest(id, symbol, params);
|
|
70904
|
+
const response = await this.privateDeleteOrder(request);
|
|
70783
70905
|
//
|
|
70784
70906
|
// {
|
|
70785
70907
|
// "orderId": "2e7ce7fc-44e2-4d80-a4a7-d079c4750b61"
|
|
@@ -70791,6 +70913,7 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
70791
70913
|
/**
|
|
70792
70914
|
* @method
|
|
70793
70915
|
* @name bitvavo#cancelAllOrders
|
|
70916
|
+
* @see https://docs.bitvavo.com/#tag/Orders/paths/~1orders/delete
|
|
70794
70917
|
* @description cancel all open orders
|
|
70795
70918
|
* @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
|
|
70796
70919
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -70872,6 +70995,25 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
70872
70995
|
//
|
|
70873
70996
|
return this.parseOrder(response, market);
|
|
70874
70997
|
}
|
|
70998
|
+
fetchOrdersRequest(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
70999
|
+
const market = this.market(symbol);
|
|
71000
|
+
let request = {
|
|
71001
|
+
'market': market['id'],
|
|
71002
|
+
// "limit": 500,
|
|
71003
|
+
// "start": since,
|
|
71004
|
+
// "end": this.milliseconds (),
|
|
71005
|
+
// "orderIdFrom": "af76d6ce-9f7c-4006-b715-bb5d430652d0",
|
|
71006
|
+
// "orderIdTo": "af76d6ce-9f7c-4006-b715-bb5d430652d0",
|
|
71007
|
+
};
|
|
71008
|
+
if (since !== undefined) {
|
|
71009
|
+
request['start'] = since;
|
|
71010
|
+
}
|
|
71011
|
+
if (limit !== undefined) {
|
|
71012
|
+
request['limit'] = limit; // default 500, max 1000
|
|
71013
|
+
}
|
|
71014
|
+
[request, params] = this.handleUntilOption('end', request, params);
|
|
71015
|
+
return this.extend(request, params);
|
|
71016
|
+
}
|
|
70875
71017
|
async fetchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
70876
71018
|
/**
|
|
70877
71019
|
* @method
|
|
@@ -70896,22 +71038,8 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
70896
71038
|
return await this.fetchPaginatedCallDynamic('fetchOrders', symbol, since, limit, params);
|
|
70897
71039
|
}
|
|
70898
71040
|
const market = this.market(symbol);
|
|
70899
|
-
|
|
70900
|
-
|
|
70901
|
-
// "limit": 500,
|
|
70902
|
-
// "start": since,
|
|
70903
|
-
// "end": this.milliseconds (),
|
|
70904
|
-
// "orderIdFrom": "af76d6ce-9f7c-4006-b715-bb5d430652d0",
|
|
70905
|
-
// "orderIdTo": "af76d6ce-9f7c-4006-b715-bb5d430652d0",
|
|
70906
|
-
};
|
|
70907
|
-
if (since !== undefined) {
|
|
70908
|
-
request['start'] = since;
|
|
70909
|
-
}
|
|
70910
|
-
if (limit !== undefined) {
|
|
70911
|
-
request['limit'] = limit; // default 500, max 1000
|
|
70912
|
-
}
|
|
70913
|
-
[request, params] = this.handleUntilOption('end', request, params);
|
|
70914
|
-
const response = await this.privateGetOrders(this.extend(request, params));
|
|
71041
|
+
const request = this.fetchOrdersRequest(symbol, since, limit, params);
|
|
71042
|
+
const response = await this.privateGetOrders(request);
|
|
70915
71043
|
//
|
|
70916
71044
|
// [
|
|
70917
71045
|
// {
|
|
@@ -71131,6 +71259,25 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
71131
71259
|
'trades': rawTrades,
|
|
71132
71260
|
}, market);
|
|
71133
71261
|
}
|
|
71262
|
+
fetchMyTradesRequest(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
71263
|
+
const market = this.market(symbol);
|
|
71264
|
+
let request = {
|
|
71265
|
+
'market': market['id'],
|
|
71266
|
+
// "limit": 500,
|
|
71267
|
+
// "start": since,
|
|
71268
|
+
// "end": this.milliseconds (),
|
|
71269
|
+
// "tradeIdFrom": "af76d6ce-9f7c-4006-b715-bb5d430652d0",
|
|
71270
|
+
// "tradeIdTo": "af76d6ce-9f7c-4006-b715-bb5d430652d0",
|
|
71271
|
+
};
|
|
71272
|
+
if (since !== undefined) {
|
|
71273
|
+
request['start'] = since;
|
|
71274
|
+
}
|
|
71275
|
+
if (limit !== undefined) {
|
|
71276
|
+
request['limit'] = limit; // default 500, max 1000
|
|
71277
|
+
}
|
|
71278
|
+
[request, params] = this.handleUntilOption('end', request, params);
|
|
71279
|
+
return this.extend(request, params);
|
|
71280
|
+
}
|
|
71134
71281
|
async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
71135
71282
|
/**
|
|
71136
71283
|
* @method
|
|
@@ -71155,22 +71302,8 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
71155
71302
|
return await this.fetchPaginatedCallDynamic('fetchMyTrades', symbol, since, limit, params);
|
|
71156
71303
|
}
|
|
71157
71304
|
const market = this.market(symbol);
|
|
71158
|
-
|
|
71159
|
-
|
|
71160
|
-
// "limit": 500,
|
|
71161
|
-
// "start": since,
|
|
71162
|
-
// "end": this.milliseconds (),
|
|
71163
|
-
// "tradeIdFrom": "af76d6ce-9f7c-4006-b715-bb5d430652d0",
|
|
71164
|
-
// "tradeIdTo": "af76d6ce-9f7c-4006-b715-bb5d430652d0",
|
|
71165
|
-
};
|
|
71166
|
-
if (since !== undefined) {
|
|
71167
|
-
request['start'] = since;
|
|
71168
|
-
}
|
|
71169
|
-
if (limit !== undefined) {
|
|
71170
|
-
request['limit'] = limit; // default 500, max 1000
|
|
71171
|
-
}
|
|
71172
|
-
[request, params] = this.handleUntilOption('end', request, params);
|
|
71173
|
-
const response = await this.privateGetTrades(this.extend(request, params));
|
|
71305
|
+
const request = this.fetchMyTradesRequest(symbol, since, limit, params);
|
|
71306
|
+
const response = await this.privateGetTrades(request);
|
|
71174
71307
|
//
|
|
71175
71308
|
// [
|
|
71176
71309
|
// {
|
|
@@ -71190,6 +71323,20 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
71190
71323
|
//
|
|
71191
71324
|
return this.parseTrades(response, market, since, limit);
|
|
71192
71325
|
}
|
|
71326
|
+
withdrawRequest(code, amount, address, tag = undefined, params = {}) {
|
|
71327
|
+
const currency = this.currency(code);
|
|
71328
|
+
const request = {
|
|
71329
|
+
'symbol': currency['id'],
|
|
71330
|
+
'amount': this.currencyToPrecision(code, amount),
|
|
71331
|
+
'address': address, // address or IBAN
|
|
71332
|
+
// 'internal': false, // transfer to another Bitvavo user address, no fees
|
|
71333
|
+
// 'addWithdrawalFee': false, // true = add the fee on top, otherwise the fee is subtracted from the amount
|
|
71334
|
+
};
|
|
71335
|
+
if (tag !== undefined) {
|
|
71336
|
+
request['paymentId'] = tag;
|
|
71337
|
+
}
|
|
71338
|
+
return this.extend(request, params);
|
|
71339
|
+
}
|
|
71193
71340
|
async withdraw(code, amount, address, tag = undefined, params = {}) {
|
|
71194
71341
|
/**
|
|
71195
71342
|
* @method
|
|
@@ -71206,17 +71353,8 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
71206
71353
|
this.checkAddress(address);
|
|
71207
71354
|
await this.loadMarkets();
|
|
71208
71355
|
const currency = this.currency(code);
|
|
71209
|
-
const request =
|
|
71210
|
-
|
|
71211
|
-
'amount': this.currencyToPrecision(code, amount),
|
|
71212
|
-
'address': address, // address or IBAN
|
|
71213
|
-
// "internal": false, // transfer to another Bitvavo user address, no fees
|
|
71214
|
-
// "addWithdrawalFee": false, // true = add the fee on top, otherwise the fee is subtracted from the amount
|
|
71215
|
-
};
|
|
71216
|
-
if (tag !== undefined) {
|
|
71217
|
-
request['paymentId'] = tag;
|
|
71218
|
-
}
|
|
71219
|
-
const response = await this.privatePostWithdrawal(this.extend(request, params));
|
|
71356
|
+
const request = this.withdrawRequest(code, amount, address, tag, params);
|
|
71357
|
+
const response = await this.privatePostWithdrawal(request);
|
|
71220
71358
|
//
|
|
71221
71359
|
// {
|
|
71222
71360
|
// "success": true,
|
|
@@ -71226,18 +71364,7 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
71226
71364
|
//
|
|
71227
71365
|
return this.parseTransaction(response, currency);
|
|
71228
71366
|
}
|
|
71229
|
-
|
|
71230
|
-
/**
|
|
71231
|
-
* @method
|
|
71232
|
-
* @name bitvavo#fetchWithdrawals
|
|
71233
|
-
* @description fetch all withdrawals made from an account
|
|
71234
|
-
* @param {string} code unified currency code
|
|
71235
|
-
* @param {int} [since] the earliest time in ms to fetch withdrawals for
|
|
71236
|
-
* @param {int} [limit] the maximum number of withdrawals structures to retrieve
|
|
71237
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
71238
|
-
* @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
71239
|
-
*/
|
|
71240
|
-
await this.loadMarkets();
|
|
71367
|
+
fetchWithdrawalsRequest(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
71241
71368
|
const request = {
|
|
71242
71369
|
// 'symbol': currency['id'],
|
|
71243
71370
|
// 'limit': 500, // default 500, max 1000
|
|
@@ -71255,7 +71382,27 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
71255
71382
|
if (limit !== undefined) {
|
|
71256
71383
|
request['limit'] = limit; // default 500, max 1000
|
|
71257
71384
|
}
|
|
71258
|
-
|
|
71385
|
+
return this.extend(request, params);
|
|
71386
|
+
}
|
|
71387
|
+
async fetchWithdrawals(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
71388
|
+
/**
|
|
71389
|
+
* @method
|
|
71390
|
+
* @name bitvavo#fetchWithdrawals
|
|
71391
|
+
* @see https://docs.bitvavo.com/#tag/Account/paths/~1withdrawalHistory/get
|
|
71392
|
+
* @description fetch all withdrawals made from an account
|
|
71393
|
+
* @param {string} code unified currency code
|
|
71394
|
+
* @param {int} [since] the earliest time in ms to fetch withdrawals for
|
|
71395
|
+
* @param {int} [limit] the maximum number of withdrawals structures to retrieve
|
|
71396
|
+
* @param {object} [params] extra parameters specific to the bitvavo api endpoint
|
|
71397
|
+
* @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
71398
|
+
*/
|
|
71399
|
+
await this.loadMarkets();
|
|
71400
|
+
const request = this.fetchWithdrawalsRequest(code, since, limit, params);
|
|
71401
|
+
let currency = undefined;
|
|
71402
|
+
if (code !== undefined) {
|
|
71403
|
+
currency = this.currency(code);
|
|
71404
|
+
}
|
|
71405
|
+
const response = await this.privateGetWithdrawalHistory(request);
|
|
71259
71406
|
//
|
|
71260
71407
|
// [
|
|
71261
71408
|
// {
|
|
@@ -71272,18 +71419,7 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
71272
71419
|
//
|
|
71273
71420
|
return this.parseTransactions(response, currency, since, limit, { 'type': 'withdrawal' });
|
|
71274
71421
|
}
|
|
71275
|
-
|
|
71276
|
-
/**
|
|
71277
|
-
* @method
|
|
71278
|
-
* @name bitvavo#fetchDeposits
|
|
71279
|
-
* @description fetch all deposits made to an account
|
|
71280
|
-
* @param {string} code unified currency code
|
|
71281
|
-
* @param {int} [since] the earliest time in ms to fetch deposits for
|
|
71282
|
-
* @param {int} [limit] the maximum number of deposits structures to retrieve
|
|
71283
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
71284
|
-
* @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
71285
|
-
*/
|
|
71286
|
-
await this.loadMarkets();
|
|
71422
|
+
fetchDepositsRequest(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
71287
71423
|
const request = {
|
|
71288
71424
|
// 'symbol': currency['id'],
|
|
71289
71425
|
// 'limit': 500, // default 500, max 1000
|
|
@@ -71301,7 +71437,27 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
71301
71437
|
if (limit !== undefined) {
|
|
71302
71438
|
request['limit'] = limit; // default 500, max 1000
|
|
71303
71439
|
}
|
|
71304
|
-
|
|
71440
|
+
return this.extend(request, params);
|
|
71441
|
+
}
|
|
71442
|
+
async fetchDeposits(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
71443
|
+
/**
|
|
71444
|
+
* @method
|
|
71445
|
+
* @name bitvavo#fetchDeposits
|
|
71446
|
+
* @see https://docs.bitvavo.com/#tag/Account/paths/~1depositHistory/get
|
|
71447
|
+
* @description fetch all deposits made to an account
|
|
71448
|
+
* @param {string} code unified currency code
|
|
71449
|
+
* @param {int} [since] the earliest time in ms to fetch deposits for
|
|
71450
|
+
* @param {int} [limit] the maximum number of deposits structures to retrieve
|
|
71451
|
+
* @param {object} [params] extra parameters specific to the bitvavo api endpoint
|
|
71452
|
+
* @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
71453
|
+
*/
|
|
71454
|
+
await this.loadMarkets();
|
|
71455
|
+
const request = this.fetchDepositsRequest(code, since, limit, params);
|
|
71456
|
+
let currency = undefined;
|
|
71457
|
+
if (code !== undefined) {
|
|
71458
|
+
currency = this.currency(code);
|
|
71459
|
+
}
|
|
71460
|
+
const response = await this.privateGetDepositHistory(request);
|
|
71305
71461
|
//
|
|
71306
71462
|
// [
|
|
71307
71463
|
// {
|
|
@@ -72831,8 +72987,10 @@ class blockchaincom extends _abstract_blockchaincom_js__WEBPACK_IMPORTED_MODULE_
|
|
|
72831
72987
|
let tag = undefined;
|
|
72832
72988
|
let address = undefined;
|
|
72833
72989
|
if (rawAddress !== undefined) {
|
|
72990
|
+
const addressParts = rawAddress.split(';');
|
|
72834
72991
|
// if a tag or memo is used it is separated by a colon in the 'address' value
|
|
72835
|
-
|
|
72992
|
+
tag = this.safeString(addressParts, 0);
|
|
72993
|
+
address = this.safeString(addressParts, 1);
|
|
72836
72994
|
}
|
|
72837
72995
|
const result = { 'info': response };
|
|
72838
72996
|
result['currency'] = currency['code'];
|
|
@@ -76926,7 +77084,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
76926
77084
|
'closeAllPositions': false,
|
|
76927
77085
|
'closePosition': false,
|
|
76928
77086
|
'createMarketBuyOrderWithCost': true,
|
|
76929
|
-
'createMarketSellOrderWithCost':
|
|
77087
|
+
'createMarketSellOrderWithCost': true,
|
|
76930
77088
|
'createOrder': true,
|
|
76931
77089
|
'createOrders': true,
|
|
76932
77090
|
'createOrderWithTakeProfitAndStopLoss': true,
|
|
@@ -80356,8 +80514,30 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
80356
80514
|
if (!market['spot']) {
|
|
80357
80515
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' createMarketBuyOrderWithCost() supports spot orders only');
|
|
80358
80516
|
}
|
|
80359
|
-
|
|
80360
|
-
|
|
80517
|
+
return await this.createOrder(symbol, 'market', 'buy', cost, 1, params);
|
|
80518
|
+
}
|
|
80519
|
+
async createMarketSellOrderWithCost(symbol, cost, params = {}) {
|
|
80520
|
+
/**
|
|
80521
|
+
* @method
|
|
80522
|
+
* @name bybit#createMarkeSellOrderWithCost
|
|
80523
|
+
* @see https://bybit-exchange.github.io/docs/v5/order/create-order
|
|
80524
|
+
* @description create a market sell order by providing the symbol and cost
|
|
80525
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
80526
|
+
* @param {float} cost how much you want to trade in units of the quote currency
|
|
80527
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
80528
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
80529
|
+
*/
|
|
80530
|
+
await this.loadMarkets();
|
|
80531
|
+
const types = await this.isUnifiedEnabled();
|
|
80532
|
+
const enableUnifiedAccount = types[1];
|
|
80533
|
+
if (!enableUnifiedAccount) {
|
|
80534
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' createMarketSellOrderWithCost() supports UTA accounts only');
|
|
80535
|
+
}
|
|
80536
|
+
const market = this.market(symbol);
|
|
80537
|
+
if (!market['spot']) {
|
|
80538
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' createMarketSellOrderWithCost() supports spot orders only');
|
|
80539
|
+
}
|
|
80540
|
+
return await this.createOrder(symbol, 'market', 'sell', cost, 1, params);
|
|
80361
80541
|
}
|
|
80362
80542
|
async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
|
|
80363
80543
|
/**
|
|
@@ -80401,7 +80581,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
80401
80581
|
}
|
|
80402
80582
|
const trailingAmount = this.safeString2(params, 'trailingAmount', 'trailingStop');
|
|
80403
80583
|
const isTrailingAmountOrder = trailingAmount !== undefined;
|
|
80404
|
-
const orderRequest = this.createOrderRequest(symbol, type, side, amount, price, params);
|
|
80584
|
+
const orderRequest = this.createOrderRequest(symbol, type, side, amount, price, params, enableUnifiedAccount);
|
|
80405
80585
|
let response = undefined;
|
|
80406
80586
|
if (isTrailingAmountOrder) {
|
|
80407
80587
|
response = await this.privatePostV5PositionTradingStop(orderRequest);
|
|
@@ -80424,7 +80604,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
80424
80604
|
const order = this.safeValue(response, 'result', {});
|
|
80425
80605
|
return this.parseOrder(order, market);
|
|
80426
80606
|
}
|
|
80427
|
-
createOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
|
|
80607
|
+
createOrderRequest(symbol, type, side, amount, price = undefined, params = {}, isUTA = true) {
|
|
80428
80608
|
const market = this.market(symbol);
|
|
80429
80609
|
symbol = market['symbol'];
|
|
80430
80610
|
const lowerCaseType = type.toLowerCase();
|
|
@@ -80468,12 +80648,36 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
80468
80648
|
else if (market['option']) {
|
|
80469
80649
|
request['category'] = 'option';
|
|
80470
80650
|
}
|
|
80471
|
-
|
|
80651
|
+
const cost = this.safeString(params, 'cost');
|
|
80652
|
+
params = this.omit(params, 'cost');
|
|
80653
|
+
// if the cost is inferable, let's keep the old logic and ignore marketUnit, to minimize the impact of the changes
|
|
80654
|
+
const isMarketBuyAndCostInferable = (lowerCaseType === 'market') && (side === 'buy') && ((price !== undefined) || (cost !== undefined));
|
|
80655
|
+
if (market['spot'] && (type === 'market') && isUTA && !isMarketBuyAndCostInferable) {
|
|
80656
|
+
// UTA account can specify the cost of the order on both sides
|
|
80657
|
+
if ((cost !== undefined) || (price !== undefined)) {
|
|
80658
|
+
request['marketUnit'] = 'quoteCoin';
|
|
80659
|
+
let orderCost = undefined;
|
|
80660
|
+
if (cost !== undefined) {
|
|
80661
|
+
orderCost = cost;
|
|
80662
|
+
}
|
|
80663
|
+
else {
|
|
80664
|
+
const amountString = this.numberToString(amount);
|
|
80665
|
+
const priceString = this.numberToString(price);
|
|
80666
|
+
const quoteAmount = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringMul(amountString, priceString);
|
|
80667
|
+
orderCost = quoteAmount;
|
|
80668
|
+
}
|
|
80669
|
+
request['qty'] = this.costToPrecision(symbol, orderCost);
|
|
80670
|
+
}
|
|
80671
|
+
else {
|
|
80672
|
+
request['marketUnit'] = 'baseCoin';
|
|
80673
|
+
request['qty'] = this.amountToPrecision(symbol, amount);
|
|
80674
|
+
}
|
|
80675
|
+
}
|
|
80676
|
+
else if (market['spot'] && (type === 'market') && (side === 'buy')) {
|
|
80677
|
+
// classic accounts
|
|
80472
80678
|
// for market buy it requires the amount of quote currency to spend
|
|
80473
80679
|
let createMarketBuyOrderRequiresPrice = true;
|
|
80474
80680
|
[createMarketBuyOrderRequiresPrice, params] = this.handleOptionAndParams(params, 'createOrder', 'createMarketBuyOrderRequiresPrice', true);
|
|
80475
|
-
const cost = this.safeNumber(params, 'cost');
|
|
80476
|
-
params = this.omit(params, 'cost');
|
|
80477
80681
|
if (createMarketBuyOrderRequiresPrice) {
|
|
80478
80682
|
if ((price === undefined) && (cost === undefined)) {
|
|
80479
80683
|
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');
|
|
@@ -80600,6 +80804,8 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
80600
80804
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
80601
80805
|
*/
|
|
80602
80806
|
await this.loadMarkets();
|
|
80807
|
+
const accounts = await this.isUnifiedEnabled();
|
|
80808
|
+
const isUta = accounts[1];
|
|
80603
80809
|
const ordersRequests = [];
|
|
80604
80810
|
const orderSymbols = [];
|
|
80605
80811
|
for (let i = 0; i < orders.length; i++) {
|
|
@@ -80611,7 +80817,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
80611
80817
|
const amount = this.safeValue(rawOrder, 'amount');
|
|
80612
80818
|
const price = this.safeValue(rawOrder, 'price');
|
|
80613
80819
|
const orderParams = this.safeValue(rawOrder, 'params', {});
|
|
80614
|
-
const orderRequest = this.createOrderRequest(marketId, type, side, amount, price, orderParams);
|
|
80820
|
+
const orderRequest = this.createOrderRequest(marketId, type, side, amount, price, orderParams, isUta);
|
|
80615
80821
|
ordersRequests.push(orderRequest);
|
|
80616
80822
|
}
|
|
80617
80823
|
const symbols = this.marketSymbols(orderSymbols, undefined, false, true, true);
|
|
@@ -89678,6 +89884,7 @@ class coinbasepro extends _abstract_coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/
|
|
|
89678
89884
|
'fetchDeposits': true,
|
|
89679
89885
|
'fetchDepositsWithdrawals': true,
|
|
89680
89886
|
'fetchLedger': true,
|
|
89887
|
+
'fetchFundingRate': false,
|
|
89681
89888
|
'fetchMarginMode': false,
|
|
89682
89889
|
'fetchMarkets': true,
|
|
89683
89890
|
'fetchMyTrades': true,
|
|
@@ -93942,8 +94149,9 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
93942
94149
|
*/
|
|
93943
94150
|
let marketType = undefined;
|
|
93944
94151
|
[marketType, params] = this.handleMarketTypeAndParams('fetchBalance', undefined, params);
|
|
93945
|
-
|
|
93946
|
-
|
|
94152
|
+
let marginMode = undefined;
|
|
94153
|
+
[marginMode, params] = this.handleMarginModeAndParams('fetchBalance', params);
|
|
94154
|
+
marketType = (marginMode !== undefined) ? 'margin' : marketType;
|
|
93947
94155
|
params = this.omit(params, 'margin');
|
|
93948
94156
|
if (marketType === 'margin') {
|
|
93949
94157
|
return await this.fetchMarginBalance(params);
|
|
@@ -94473,8 +94681,9 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
94473
94681
|
}
|
|
94474
94682
|
}
|
|
94475
94683
|
const accountId = this.safeInteger(params, 'account_id');
|
|
94476
|
-
|
|
94477
|
-
|
|
94684
|
+
let marginMode = undefined;
|
|
94685
|
+
[marginMode, params] = this.handleMarginModeAndParams('createOrder', params);
|
|
94686
|
+
if (marginMode !== undefined) {
|
|
94478
94687
|
if (accountId === undefined) {
|
|
94479
94688
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest(this.id + ' createOrder() requires an account_id parameter for margin orders');
|
|
94480
94689
|
}
|
|
@@ -94993,9 +95202,10 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
94993
95202
|
'market': market['id'],
|
|
94994
95203
|
};
|
|
94995
95204
|
const accountId = this.safeInteger(params, 'account_id');
|
|
94996
|
-
|
|
95205
|
+
let marginMode = undefined;
|
|
95206
|
+
[marginMode, params] = this.handleMarginModeAndParams('cancelOrder', params);
|
|
94997
95207
|
const clientOrderId = this.safeString2(params, 'client_id', 'clientOrderId');
|
|
94998
|
-
if (
|
|
95208
|
+
if (marginMode !== undefined) {
|
|
94999
95209
|
if (accountId === undefined) {
|
|
95000
95210
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest(this.id + ' cancelOrder() requires an account_id parameter for margin orders');
|
|
95001
95211
|
}
|
|
@@ -95367,8 +95577,9 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
95367
95577
|
}
|
|
95368
95578
|
const [marketType, query] = this.handleMarketTypeAndParams('fetchOrdersByStatus', market, params);
|
|
95369
95579
|
const accountId = this.safeInteger(params, 'account_id');
|
|
95370
|
-
|
|
95371
|
-
|
|
95580
|
+
let marginMode = undefined;
|
|
95581
|
+
[marginMode, params] = this.handleMarginModeAndParams('fetchOrdersByStatus', params);
|
|
95582
|
+
if (marginMode !== undefined) {
|
|
95372
95583
|
if (accountId === undefined) {
|
|
95373
95584
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest(this.id + ' fetchOpenOrders() and fetchClosedOrders() require an account_id parameter for margin orders');
|
|
95374
95585
|
}
|
|
@@ -95771,8 +95982,9 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
95771
95982
|
}
|
|
95772
95983
|
const swap = (type === 'swap');
|
|
95773
95984
|
const accountId = this.safeInteger(params, 'account_id');
|
|
95774
|
-
|
|
95775
|
-
|
|
95985
|
+
let marginMode = undefined;
|
|
95986
|
+
[marginMode, params] = this.handleMarginModeAndParams('fetchMyTrades', params);
|
|
95987
|
+
if (marginMode !== undefined) {
|
|
95776
95988
|
if (accountId === undefined) {
|
|
95777
95989
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest(this.id + ' fetchMyTrades() requires an account_id parameter for margin trades');
|
|
95778
95990
|
}
|
|
@@ -97097,9 +97309,10 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
97097
97309
|
request['limit'] = 100;
|
|
97098
97310
|
}
|
|
97099
97311
|
params = this.omit(params, 'page');
|
|
97100
|
-
|
|
97312
|
+
let marginMode = undefined;
|
|
97313
|
+
[marginMode, params] = this.handleMarginModeAndParams('fetchTransfers', params);
|
|
97101
97314
|
let response = undefined;
|
|
97102
|
-
if (
|
|
97315
|
+
if (marginMode !== undefined) {
|
|
97103
97316
|
response = await this.privateGetMarginTransferHistory(this.extend(request, params));
|
|
97104
97317
|
}
|
|
97105
97318
|
else {
|
|
@@ -97680,6 +97893,25 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
97680
97893
|
}
|
|
97681
97894
|
return depositWithdrawFees;
|
|
97682
97895
|
}
|
|
97896
|
+
handleMarginModeAndParams(methodName, params = {}, defaultValue = undefined) {
|
|
97897
|
+
/**
|
|
97898
|
+
* @ignore
|
|
97899
|
+
* @method
|
|
97900
|
+
* @description marginMode specified by params["marginMode"], this.options["marginMode"], this.options["defaultMarginMode"], params["margin"] = true or this.options["defaultType"] = 'margin'
|
|
97901
|
+
* @param {object} params extra parameters specific to the exchange api endpoint
|
|
97902
|
+
* @returns {Array} the marginMode in lowercase
|
|
97903
|
+
*/
|
|
97904
|
+
const defaultType = this.safeString(this.options, 'defaultType');
|
|
97905
|
+
const isMargin = this.safeValue(params, 'margin', false);
|
|
97906
|
+
let marginMode = undefined;
|
|
97907
|
+
[marginMode, params] = super.handleMarginModeAndParams(methodName, params, defaultValue);
|
|
97908
|
+
if (marginMode === undefined) {
|
|
97909
|
+
if ((defaultType === 'margin') || (isMargin === true)) {
|
|
97910
|
+
marginMode = 'isolated';
|
|
97911
|
+
}
|
|
97912
|
+
}
|
|
97913
|
+
return [marginMode, params];
|
|
97914
|
+
}
|
|
97683
97915
|
nonce() {
|
|
97684
97916
|
return this.milliseconds();
|
|
97685
97917
|
}
|
|
@@ -113533,6 +113765,170 @@ class deribit extends _abstract_deribit_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
113533
113765
|
},
|
|
113534
113766
|
});
|
|
113535
113767
|
}
|
|
113768
|
+
convertExpireDate(date) {
|
|
113769
|
+
// parse YYMMDD to timestamp
|
|
113770
|
+
const year = date.slice(0, 2);
|
|
113771
|
+
const month = date.slice(2, 4);
|
|
113772
|
+
const day = date.slice(4, 6);
|
|
113773
|
+
const reconstructedDate = '20' + year + '-' + month + '-' + day + 'T00:00:00Z';
|
|
113774
|
+
return reconstructedDate;
|
|
113775
|
+
}
|
|
113776
|
+
convertMarketIdExpireDate(date) {
|
|
113777
|
+
// parse 19JAN24 to 240119
|
|
113778
|
+
const monthMappping = {
|
|
113779
|
+
'JAN': '01',
|
|
113780
|
+
'FEB': '02',
|
|
113781
|
+
'MAR': '03',
|
|
113782
|
+
'APR': '04',
|
|
113783
|
+
'MAY': '05',
|
|
113784
|
+
'JUN': '06',
|
|
113785
|
+
'JUL': '07',
|
|
113786
|
+
'AUG': '08',
|
|
113787
|
+
'SEP': '09',
|
|
113788
|
+
'OCT': '10',
|
|
113789
|
+
'NOV': '11',
|
|
113790
|
+
'DEC': '12',
|
|
113791
|
+
};
|
|
113792
|
+
const year = date.slice(0, 2);
|
|
113793
|
+
const monthName = date.slice(2, 5);
|
|
113794
|
+
const month = this.safeString(monthMappping, monthName);
|
|
113795
|
+
const day = date.slice(5, 7);
|
|
113796
|
+
const reconstructedDate = day + month + year;
|
|
113797
|
+
return reconstructedDate;
|
|
113798
|
+
}
|
|
113799
|
+
convertExpireDateToMarketIdDate(date) {
|
|
113800
|
+
// parse 240119 to 19JAN24
|
|
113801
|
+
const year = date.slice(0, 2);
|
|
113802
|
+
const monthRaw = date.slice(2, 4);
|
|
113803
|
+
let month = undefined;
|
|
113804
|
+
const day = date.slice(4, 6);
|
|
113805
|
+
if (monthRaw === '01') {
|
|
113806
|
+
month = 'JAN';
|
|
113807
|
+
}
|
|
113808
|
+
else if (monthRaw === '02') {
|
|
113809
|
+
month = 'FEB';
|
|
113810
|
+
}
|
|
113811
|
+
else if (monthRaw === '03') {
|
|
113812
|
+
month = 'MAR';
|
|
113813
|
+
}
|
|
113814
|
+
else if (monthRaw === '04') {
|
|
113815
|
+
month = 'APR';
|
|
113816
|
+
}
|
|
113817
|
+
else if (monthRaw === '05') {
|
|
113818
|
+
month = 'MAY';
|
|
113819
|
+
}
|
|
113820
|
+
else if (monthRaw === '06') {
|
|
113821
|
+
month = 'JUN';
|
|
113822
|
+
}
|
|
113823
|
+
else if (monthRaw === '07') {
|
|
113824
|
+
month = 'JUL';
|
|
113825
|
+
}
|
|
113826
|
+
else if (monthRaw === '08') {
|
|
113827
|
+
month = 'AUG';
|
|
113828
|
+
}
|
|
113829
|
+
else if (monthRaw === '09') {
|
|
113830
|
+
month = 'SEP';
|
|
113831
|
+
}
|
|
113832
|
+
else if (monthRaw === '10') {
|
|
113833
|
+
month = 'OCT';
|
|
113834
|
+
}
|
|
113835
|
+
else if (monthRaw === '11') {
|
|
113836
|
+
month = 'NOV';
|
|
113837
|
+
}
|
|
113838
|
+
else if (monthRaw === '12') {
|
|
113839
|
+
month = 'DEC';
|
|
113840
|
+
}
|
|
113841
|
+
const reconstructedDate = day + month + year;
|
|
113842
|
+
return reconstructedDate;
|
|
113843
|
+
}
|
|
113844
|
+
createExpiredOptionMarket(symbol) {
|
|
113845
|
+
// support expired option contracts
|
|
113846
|
+
let quote = 'USD';
|
|
113847
|
+
let settle = undefined;
|
|
113848
|
+
const optionParts = symbol.split('-');
|
|
113849
|
+
const symbolBase = symbol.split('/');
|
|
113850
|
+
let base = undefined;
|
|
113851
|
+
let expiry = undefined;
|
|
113852
|
+
if (symbol.indexOf('/') > -1) {
|
|
113853
|
+
base = this.safeString(symbolBase, 0);
|
|
113854
|
+
expiry = this.safeString(optionParts, 1);
|
|
113855
|
+
if (symbol.indexOf('USDC') > -1) {
|
|
113856
|
+
base = base + '_USDC';
|
|
113857
|
+
}
|
|
113858
|
+
}
|
|
113859
|
+
else {
|
|
113860
|
+
base = this.safeString(optionParts, 0);
|
|
113861
|
+
expiry = this.convertMarketIdExpireDate(this.safeString(optionParts, 1));
|
|
113862
|
+
}
|
|
113863
|
+
if (symbol.indexOf('USDC') > -1) {
|
|
113864
|
+
quote = 'USDC';
|
|
113865
|
+
settle = 'USDC';
|
|
113866
|
+
}
|
|
113867
|
+
else {
|
|
113868
|
+
settle = base;
|
|
113869
|
+
}
|
|
113870
|
+
let splitBase = base;
|
|
113871
|
+
if (base.indexOf('_') > -1) {
|
|
113872
|
+
const splitSymbol = base.split('_');
|
|
113873
|
+
splitBase = this.safeString(splitSymbol, 0);
|
|
113874
|
+
}
|
|
113875
|
+
const strike = this.safeString(optionParts, 2);
|
|
113876
|
+
const optionType = this.safeString(optionParts, 3);
|
|
113877
|
+
const datetime = this.convertExpireDate(expiry);
|
|
113878
|
+
const timestamp = this.parse8601(datetime);
|
|
113879
|
+
return {
|
|
113880
|
+
'id': base + '-' + this.convertExpireDateToMarketIdDate(expiry) + '-' + strike + '-' + optionType,
|
|
113881
|
+
'symbol': splitBase + '/' + quote + ':' + settle + '-' + expiry + '-' + strike + '-' + optionType,
|
|
113882
|
+
'base': base,
|
|
113883
|
+
'quote': quote,
|
|
113884
|
+
'settle': settle,
|
|
113885
|
+
'baseId': base,
|
|
113886
|
+
'quoteId': quote,
|
|
113887
|
+
'settleId': settle,
|
|
113888
|
+
'active': false,
|
|
113889
|
+
'type': 'option',
|
|
113890
|
+
'linear': undefined,
|
|
113891
|
+
'inverse': undefined,
|
|
113892
|
+
'spot': false,
|
|
113893
|
+
'swap': false,
|
|
113894
|
+
'future': false,
|
|
113895
|
+
'option': true,
|
|
113896
|
+
'margin': false,
|
|
113897
|
+
'contract': true,
|
|
113898
|
+
'contractSize': undefined,
|
|
113899
|
+
'expiry': timestamp,
|
|
113900
|
+
'expiryDatetime': datetime,
|
|
113901
|
+
'optionType': (optionType === 'C') ? 'call' : 'put',
|
|
113902
|
+
'strike': this.parseNumber(strike),
|
|
113903
|
+
'precision': {
|
|
113904
|
+
'amount': undefined,
|
|
113905
|
+
'price': undefined,
|
|
113906
|
+
},
|
|
113907
|
+
'limits': {
|
|
113908
|
+
'amount': {
|
|
113909
|
+
'min': undefined,
|
|
113910
|
+
'max': undefined,
|
|
113911
|
+
},
|
|
113912
|
+
'price': {
|
|
113913
|
+
'min': undefined,
|
|
113914
|
+
'max': undefined,
|
|
113915
|
+
},
|
|
113916
|
+
'cost': {
|
|
113917
|
+
'min': undefined,
|
|
113918
|
+
'max': undefined,
|
|
113919
|
+
},
|
|
113920
|
+
},
|
|
113921
|
+
'info': undefined,
|
|
113922
|
+
};
|
|
113923
|
+
}
|
|
113924
|
+
safeMarket(marketId = undefined, market = undefined, delimiter = undefined, marketType = undefined) {
|
|
113925
|
+
const isOption = (marketId !== undefined) && ((marketId.endsWith('-C')) || (marketId.endsWith('-P')));
|
|
113926
|
+
if (isOption && !(marketId in this.markets_by_id)) {
|
|
113927
|
+
// handle expired option contracts
|
|
113928
|
+
return this.createExpiredOptionMarket(marketId);
|
|
113929
|
+
}
|
|
113930
|
+
return super.safeMarket(marketId, market, delimiter, marketType);
|
|
113931
|
+
}
|
|
113536
113932
|
async fetchTime(params = {}) {
|
|
113537
113933
|
/**
|
|
113538
113934
|
* @method
|
|
@@ -124027,6 +124423,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
124027
124423
|
'multi_collateral/currency_quota': 20 / 15,
|
|
124028
124424
|
'multi_collateral/currencies': 20 / 15,
|
|
124029
124425
|
'multi_collateral/ltv': 20 / 15,
|
|
124426
|
+
'multi_collateral/fixed_rate': 20 / 15,
|
|
124030
124427
|
},
|
|
124031
124428
|
'post': {
|
|
124032
124429
|
'collateral/orders': 20 / 15,
|
|
@@ -129056,7 +129453,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
129056
129453
|
* @description retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes
|
|
129057
129454
|
* @see https://www.gate.io/docs/developers/apiv4/en/#list-all-futures-contracts
|
|
129058
129455
|
* @see https://www.gate.io/docs/developers/apiv4/en/#list-all-futures-contracts-2
|
|
129059
|
-
* @param {string[]
|
|
129456
|
+
* @param {string[]} [symbols] list of unified market symbols
|
|
129060
129457
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
129061
129458
|
* @returns {object} a dictionary of [leverage tiers structures]{@link https://docs.ccxt.com/#/?id=leverage-tiers-structure}, indexed by market symbols
|
|
129062
129459
|
*/
|
|
@@ -129201,6 +129598,33 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
129201
129598
|
//
|
|
129202
129599
|
return this.parseMarketLeverageTiers(response, market);
|
|
129203
129600
|
}
|
|
129601
|
+
parseEmulatedLeverageTiers(info, market = undefined) {
|
|
129602
|
+
const maintenanceMarginUnit = this.safeString(info, 'maintenance_rate'); // '0.005',
|
|
129603
|
+
const leverageMax = this.safeString(info, 'leverage_max'); // '100',
|
|
129604
|
+
const riskLimitStep = this.safeString(info, 'risk_limit_step'); // '1000000',
|
|
129605
|
+
const riskLimitMax = this.safeString(info, 'risk_limit_max'); // '16000000',
|
|
129606
|
+
const initialMarginUnit = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringDiv('1', leverageMax);
|
|
129607
|
+
let maintenanceMarginRate = maintenanceMarginUnit;
|
|
129608
|
+
let initialMarginRatio = initialMarginUnit;
|
|
129609
|
+
let floor = '0';
|
|
129610
|
+
const tiers = [];
|
|
129611
|
+
while (_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringLt(floor, riskLimitMax)) {
|
|
129612
|
+
const cap = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringAdd(floor, riskLimitStep);
|
|
129613
|
+
tiers.push({
|
|
129614
|
+
'tier': this.parseNumber(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringDiv(cap, riskLimitStep)),
|
|
129615
|
+
'currency': this.safeString(market, 'settle'),
|
|
129616
|
+
'minNotional': this.parseNumber(floor),
|
|
129617
|
+
'maxNotional': this.parseNumber(cap),
|
|
129618
|
+
'maintenanceMarginRate': this.parseNumber(maintenanceMarginRate),
|
|
129619
|
+
'maxLeverage': this.parseNumber(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringDiv('1', initialMarginRatio)),
|
|
129620
|
+
'info': info,
|
|
129621
|
+
});
|
|
129622
|
+
maintenanceMarginRate = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringAdd(maintenanceMarginRate, maintenanceMarginUnit);
|
|
129623
|
+
initialMarginRatio = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringAdd(initialMarginRatio, initialMarginUnit);
|
|
129624
|
+
floor = cap;
|
|
129625
|
+
}
|
|
129626
|
+
return tiers;
|
|
129627
|
+
}
|
|
129204
129628
|
parseMarketLeverageTiers(info, market = undefined) {
|
|
129205
129629
|
//
|
|
129206
129630
|
// [
|
|
@@ -129213,6 +129637,9 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
129213
129637
|
// }
|
|
129214
129638
|
// ]
|
|
129215
129639
|
//
|
|
129640
|
+
if (!Array.isArray(info)) {
|
|
129641
|
+
return this.parseEmulatedLeverageTiers(info, market);
|
|
129642
|
+
}
|
|
129216
129643
|
let minNotional = 0;
|
|
129217
129644
|
const tiers = [];
|
|
129218
129645
|
for (let i = 0; i < info.length; i++) {
|
|
@@ -182864,9 +183291,9 @@ class novadax extends _abstract_novadax_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
182864
183291
|
'id': 'novadax',
|
|
182865
183292
|
'name': 'NovaDAX',
|
|
182866
183293
|
'countries': ['BR'],
|
|
182867
|
-
//
|
|
182868
|
-
//
|
|
182869
|
-
'rateLimit':
|
|
183294
|
+
// 6000 weight per min => 100 weight per second => min weight = 1
|
|
183295
|
+
// 100 requests per second => ( 1000ms / 100 ) = 10 ms between requests on average
|
|
183296
|
+
'rateLimit': 10,
|
|
182870
183297
|
'version': 'v1',
|
|
182871
183298
|
// new metainfo interface
|
|
182872
183299
|
'has': {
|
|
@@ -182964,33 +183391,37 @@ class novadax extends _abstract_novadax_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
182964
183391
|
'api': {
|
|
182965
183392
|
'public': {
|
|
182966
183393
|
'get': {
|
|
182967
|
-
'common/symbol': 1
|
|
182968
|
-
'common/symbols': 1
|
|
182969
|
-
'common/timestamp': 1
|
|
182970
|
-
'market/tickers':
|
|
182971
|
-
'market/ticker': 1
|
|
182972
|
-
'market/depth': 1
|
|
182973
|
-
'market/trades':
|
|
182974
|
-
'market/kline/history':
|
|
183394
|
+
'common/symbol': 1,
|
|
183395
|
+
'common/symbols': 1,
|
|
183396
|
+
'common/timestamp': 1,
|
|
183397
|
+
'market/tickers': 5,
|
|
183398
|
+
'market/ticker': 1,
|
|
183399
|
+
'market/depth': 1,
|
|
183400
|
+
'market/trades': 5,
|
|
183401
|
+
'market/kline/history': 5,
|
|
182975
183402
|
},
|
|
182976
183403
|
},
|
|
182977
183404
|
'private': {
|
|
182978
183405
|
'get': {
|
|
182979
|
-
'orders/get':
|
|
182980
|
-
'orders/list':
|
|
183406
|
+
'orders/get': 1,
|
|
183407
|
+
'orders/list': 10,
|
|
182981
183408
|
'orders/fill': 3,
|
|
182982
|
-
'orders/fills':
|
|
182983
|
-
'account/getBalance':
|
|
182984
|
-
'account/subs':
|
|
182985
|
-
'account/subs/balance':
|
|
182986
|
-
'account/subs/transfer/record':
|
|
183409
|
+
'orders/fills': 10,
|
|
183410
|
+
'account/getBalance': 1,
|
|
183411
|
+
'account/subs': 1,
|
|
183412
|
+
'account/subs/balance': 1,
|
|
183413
|
+
'account/subs/transfer/record': 10,
|
|
182987
183414
|
'wallet/query/deposit-withdraw': 3,
|
|
182988
183415
|
},
|
|
182989
183416
|
'post': {
|
|
182990
|
-
'orders/create':
|
|
182991
|
-
'orders/
|
|
182992
|
-
'
|
|
182993
|
-
'
|
|
183417
|
+
'orders/create': 5,
|
|
183418
|
+
'orders/batch-create': 50,
|
|
183419
|
+
'orders/cancel': 1,
|
|
183420
|
+
'orders/batch-cancel': 10,
|
|
183421
|
+
'orders/cancel-by-symbol': 10,
|
|
183422
|
+
'account/subs/transfer': 5,
|
|
183423
|
+
'wallet/withdraw/coin': 3,
|
|
183424
|
+
'account/withdraw/coin': 3, // not found in doc
|
|
182994
183425
|
},
|
|
182995
183426
|
},
|
|
182996
183427
|
},
|
|
@@ -185431,6 +185862,9 @@ class okcoin extends _abstract_okcoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
185431
185862
|
'fetchCurrencies': true,
|
|
185432
185863
|
'fetchDepositAddress': true,
|
|
185433
185864
|
'fetchDeposits': true,
|
|
185865
|
+
'fetchFundingHistory': false,
|
|
185866
|
+
'fetchFundingRate': false,
|
|
185867
|
+
'fetchFundingRateHistory': false,
|
|
185434
185868
|
'fetchLedger': true,
|
|
185435
185869
|
'fetchMarkets': true,
|
|
185436
185870
|
'fetchMyTrades': true,
|
|
@@ -199893,6 +200327,7 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
199893
200327
|
'api-data/g-futures/trades': 5,
|
|
199894
200328
|
'api-data/futures/trading-fees': 5,
|
|
199895
200329
|
'api-data/g-futures/trading-fees': 5,
|
|
200330
|
+
'api-data/futures/v2/tradeAccountDetail': 5,
|
|
199896
200331
|
'g-orders/activeList': 1,
|
|
199897
200332
|
'orders/activeList': 1,
|
|
199898
200333
|
'exchange/order/list': 5,
|
|
@@ -201617,16 +202052,19 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
201617
202052
|
* @method
|
|
201618
202053
|
* @name phemex#fetchBalance
|
|
201619
202054
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
202055
|
+
* @see https://phemex-docs.github.io/#query-wallets
|
|
201620
202056
|
* @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#query-account-positions
|
|
202057
|
+
* @see https://phemex-docs.github.io/#query-trading-account-and-positions
|
|
201621
202058
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
201622
202059
|
* @param {string} [params.type] spot or swap
|
|
202060
|
+
* @param {string} [params.code] *swap only* currency code of the balance to query (USD, USDT, etc), default is USDT
|
|
201623
202061
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
201624
202062
|
*/
|
|
201625
202063
|
await this.loadMarkets();
|
|
201626
202064
|
let type = undefined;
|
|
201627
202065
|
[type, params] = this.handleMarketTypeAndParams('fetchBalance', undefined, params);
|
|
201628
202066
|
const code = this.safeString(params, 'code');
|
|
201629
|
-
params = this.omit(params, ['
|
|
202067
|
+
params = this.omit(params, ['code']);
|
|
201630
202068
|
let response = undefined;
|
|
201631
202069
|
const request = {};
|
|
201632
202070
|
if ((type !== 'spot') && (type !== 'swap')) {
|
|
@@ -201634,7 +202072,7 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
201634
202072
|
}
|
|
201635
202073
|
if (type === 'swap') {
|
|
201636
202074
|
let settle = undefined;
|
|
201637
|
-
[settle, params] = this.handleOptionAndParams(params, 'fetchBalance', 'settle');
|
|
202075
|
+
[settle, params] = this.handleOptionAndParams(params, 'fetchBalance', 'settle', 'USDT');
|
|
201638
202076
|
if (code !== undefined || settle !== undefined) {
|
|
201639
202077
|
let coin = undefined;
|
|
201640
202078
|
if (code !== undefined) {
|
|
@@ -202470,7 +202908,7 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
202470
202908
|
}
|
|
202471
202909
|
else if (amount !== undefined) {
|
|
202472
202910
|
if (isUSDTSettled) {
|
|
202473
|
-
request['
|
|
202911
|
+
request['orderQtyRq'] = this.amountToPrecision(market['symbol'], amount);
|
|
202474
202912
|
}
|
|
202475
202913
|
else {
|
|
202476
202914
|
request['baseQtyEV'] = this.toEv(amount, market);
|
|
@@ -204493,6 +204931,7 @@ class poloniex extends _abstract_poloniex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
204493
204931
|
'fetchOrder': true,
|
|
204494
204932
|
'fetchOrderBook': true,
|
|
204495
204933
|
'fetchOrderBooks': false,
|
|
204934
|
+
'fetchFundingRate': false,
|
|
204496
204935
|
'fetchOrderTrades': true,
|
|
204497
204936
|
'fetchPosition': false,
|
|
204498
204937
|
'fetchPositionMode': false,
|
|
@@ -210294,12 +210733,18 @@ class ascendex extends _ascendex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] *
|
|
|
210294
210733
|
/* harmony export */ Z: () => (/* binding */ bequant)
|
|
210295
210734
|
/* harmony export */ });
|
|
210296
210735
|
/* harmony import */ var _hitbtc_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5189);
|
|
210736
|
+
/* harmony import */ var _bequant_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2049);
|
|
210297
210737
|
// ---------------------------------------------------------------------------
|
|
210298
210738
|
|
|
210739
|
+
|
|
210299
210740
|
// ---------------------------------------------------------------------------
|
|
210300
210741
|
class bequant extends _hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
210301
210742
|
describe() {
|
|
210302
|
-
|
|
210743
|
+
// eslint-disable-next-line new-cap
|
|
210744
|
+
const restInstance = new _bequant_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z();
|
|
210745
|
+
const restDescribe = restInstance.describe();
|
|
210746
|
+
const extended = this.deepExtend(super.describe(), restDescribe);
|
|
210747
|
+
return this.deepExtend(extended, {
|
|
210303
210748
|
'id': 'bequant',
|
|
210304
210749
|
'name': 'Bequant',
|
|
210305
210750
|
'countries': ['MT'],
|
|
@@ -210383,7 +210828,7 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
210383
210828
|
'ws': {
|
|
210384
210829
|
'spot': 'wss://testnet.binance.vision/ws',
|
|
210385
210830
|
'margin': 'wss://testnet.binance.vision/ws',
|
|
210386
|
-
'future': 'wss://
|
|
210831
|
+
'future': 'wss://fstream.binancefuture.com/ws',
|
|
210387
210832
|
'delivery': 'wss://dstream.binancefuture.com/ws',
|
|
210388
210833
|
'ws': 'wss://testnet.binance.vision/ws-api/v3',
|
|
210389
210834
|
},
|
|
@@ -212316,12 +212761,13 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
212316
212761
|
/**
|
|
212317
212762
|
* @method
|
|
212318
212763
|
* @name binance#watchOrders
|
|
212319
|
-
* @see https://binance-docs.github.io/apidocs/spot/en/#payload-order-update
|
|
212320
212764
|
* @description watches information on multiple orders made by the user
|
|
212321
|
-
* @
|
|
212765
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#payload-order-update
|
|
212766
|
+
* @param {string} symbol unified market symbol of the market the orders were made in
|
|
212322
212767
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
212323
212768
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
212324
212769
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
212770
|
+
* @param {string|undefined} [params.marginMode] 'cross' or 'isolated', for spot margin
|
|
212325
212771
|
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
212326
212772
|
*/
|
|
212327
212773
|
await this.loadMarkets();
|
|
@@ -212344,8 +212790,10 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
212344
212790
|
}
|
|
212345
212791
|
params = this.extend(params, { 'type': type, 'symbol': symbol }); // needed inside authenticate for isolated margin
|
|
212346
212792
|
await this.authenticate(params);
|
|
212793
|
+
let marginMode = undefined;
|
|
212794
|
+
[marginMode, params] = this.handleMarginModeAndParams('watchOrders', params);
|
|
212347
212795
|
let urlType = type;
|
|
212348
|
-
if (type === 'margin') {
|
|
212796
|
+
if ((type === 'margin') || ((type === 'spot') && (marginMode !== undefined))) {
|
|
212349
212797
|
urlType = 'spot'; // spot-margin shares the same stream as regular spot
|
|
212350
212798
|
}
|
|
212351
212799
|
const url = this.urls['api']['ws'][urlType] + '/' + this.options[type]['listenKey'];
|
|
@@ -213147,12 +213595,18 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
213147
213595
|
/* harmony export */ Z: () => (/* binding */ binancecoinm)
|
|
213148
213596
|
/* harmony export */ });
|
|
213149
213597
|
/* harmony import */ var _binance_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8764);
|
|
213598
|
+
/* harmony import */ var _binancecoinm_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9212);
|
|
213150
213599
|
// ---------------------------------------------------------------------------
|
|
213151
213600
|
|
|
213601
|
+
|
|
213152
213602
|
// ---------------------------------------------------------------------------
|
|
213153
213603
|
class binancecoinm extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
213154
213604
|
describe() {
|
|
213155
|
-
|
|
213605
|
+
// eslint-disable-next-line new-cap
|
|
213606
|
+
const restInstance = new _binancecoinm_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z();
|
|
213607
|
+
const restDescribe = restInstance.describe();
|
|
213608
|
+
const extended = this.deepExtend(super.describe(), restDescribe);
|
|
213609
|
+
return this.deepExtend(extended, {
|
|
213156
213610
|
'id': 'binancecoinm',
|
|
213157
213611
|
'name': 'Binance COIN-M',
|
|
213158
213612
|
'urls': {
|
|
@@ -213176,12 +213630,18 @@ class binancecoinm extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
213176
213630
|
/* harmony export */ Z: () => (/* binding */ binanceus)
|
|
213177
213631
|
/* harmony export */ });
|
|
213178
213632
|
/* harmony import */ var _binance_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8764);
|
|
213633
|
+
/* harmony import */ var _binanceus_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2723);
|
|
213179
213634
|
// ---------------------------------------------------------------------------
|
|
213180
213635
|
|
|
213636
|
+
|
|
213181
213637
|
// ---------------------------------------------------------------------------
|
|
213182
213638
|
class binanceus extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
213183
213639
|
describe() {
|
|
213184
|
-
|
|
213640
|
+
// eslint-disable-next-line new-cap
|
|
213641
|
+
const restInstance = new _binanceus_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z();
|
|
213642
|
+
const restDescribe = restInstance.describe();
|
|
213643
|
+
const extended = this.deepExtend(super.describe(), restDescribe);
|
|
213644
|
+
return this.deepExtend(extended, {
|
|
213185
213645
|
'id': 'binanceus',
|
|
213186
213646
|
'name': 'Binance US',
|
|
213187
213647
|
'countries': ['US'],
|
|
@@ -214225,12 +214685,18 @@ class bingx extends _bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
214225
214685
|
/* harmony export */ Z: () => (/* binding */ bitcoincom)
|
|
214226
214686
|
/* harmony export */ });
|
|
214227
214687
|
/* harmony import */ var _hitbtc_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5189);
|
|
214688
|
+
/* harmony import */ var _bequant_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2049);
|
|
214228
214689
|
// ---------------------------------------------------------------------------
|
|
214229
214690
|
|
|
214691
|
+
|
|
214230
214692
|
// ---------------------------------------------------------------------------
|
|
214231
214693
|
class bitcoincom extends _hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
214232
214694
|
describe() {
|
|
214233
|
-
|
|
214695
|
+
// eslint-disable-next-line new-cap
|
|
214696
|
+
const restInstance = new _bequant_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z();
|
|
214697
|
+
const restDescribe = restInstance.describe();
|
|
214698
|
+
const extended = this.deepExtend(super.describe(), restDescribe);
|
|
214699
|
+
return this.deepExtend(extended, {
|
|
214234
214700
|
'id': 'bitcoincom',
|
|
214235
214701
|
'name': 'bitcoin.com',
|
|
214236
214702
|
'countries': ['KN'],
|
|
@@ -217359,7 +217825,7 @@ class bitget extends _bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
217359
217825
|
'price': this.safeString(order, 'price'),
|
|
217360
217826
|
'stopPrice': triggerPrice,
|
|
217361
217827
|
'triggerPrice': triggerPrice,
|
|
217362
|
-
'amount': this.
|
|
217828
|
+
'amount': this.safeString(order, 'baseVolume'),
|
|
217363
217829
|
'cost': this.safeStringN(order, ['notional', 'notionalUsd', 'quoteSize']),
|
|
217364
217830
|
'average': this.omitZero(this.safeString2(order, 'priceAvg', 'fillPrice')),
|
|
217365
217831
|
'filled': this.safeString2(order, 'accBaseVolume', 'baseVolume'),
|
|
@@ -220960,8 +221426,8 @@ class bitopro extends _bitopro_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
220960
221426
|
},
|
|
220961
221427
|
'urls': {
|
|
220962
221428
|
'ws': {
|
|
220963
|
-
'public': 'wss://stream.bitopro.com:
|
|
220964
|
-
'private': 'wss://stream.bitopro.com:
|
|
221429
|
+
'public': 'wss://stream.bitopro.com:443/ws/v1/pub',
|
|
221430
|
+
'private': 'wss://stream.bitopro.com:443/ws/v1/pub/auth',
|
|
220965
221431
|
},
|
|
220966
221432
|
},
|
|
220967
221433
|
'requiredCredentials': {
|
|
@@ -220990,6 +221456,7 @@ class bitopro extends _bitopro_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
220990
221456
|
* @method
|
|
220991
221457
|
* @name bitopro#watchOrderBook
|
|
220992
221458
|
* @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
221459
|
+
* @see https://github.com/bitoex/bitopro-offical-api-docs/blob/master/ws/public/order_book_stream.md
|
|
220993
221460
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
220994
221461
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
220995
221462
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -221055,6 +221522,7 @@ class bitopro extends _bitopro_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
221055
221522
|
* @method
|
|
221056
221523
|
* @name bitopro#watchTrades
|
|
221057
221524
|
* @description get the list of most recent trades for a particular symbol
|
|
221525
|
+
* @see https://github.com/bitoex/bitopro-offical-api-docs/blob/master/ws/public/trade_stream.md
|
|
221058
221526
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
221059
221527
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
221060
221528
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
@@ -221114,6 +221582,7 @@ class bitopro extends _bitopro_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
221114
221582
|
* @method
|
|
221115
221583
|
* @name bitopro#watchTicker
|
|
221116
221584
|
* @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
221585
|
+
* @see https://github.com/bitoex/bitopro-offical-api-docs/blob/master/ws/public/ticker_stream.md
|
|
221117
221586
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
221118
221587
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
221119
221588
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -221167,7 +221636,7 @@ class bitopro extends _bitopro_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
221167
221636
|
'identity': this.login,
|
|
221168
221637
|
});
|
|
221169
221638
|
const payload = this.stringToBase64(rawData);
|
|
221170
|
-
const signature = this.hmac(payload, this.encode(this.secret), _static_dependencies_noble_hashes_sha512_js__WEBPACK_IMPORTED_MODULE_3__/* .sha384 */ .iC);
|
|
221639
|
+
const signature = this.hmac(this.encode(payload), this.encode(this.secret), _static_dependencies_noble_hashes_sha512_js__WEBPACK_IMPORTED_MODULE_3__/* .sha384 */ .iC);
|
|
221171
221640
|
const defaultOptions = {
|
|
221172
221641
|
'ws': {
|
|
221173
221642
|
'options': {
|
|
@@ -221193,6 +221662,7 @@ class bitopro extends _bitopro_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
221193
221662
|
* @method
|
|
221194
221663
|
* @name bitopro#watchBalance
|
|
221195
221664
|
* @description watch balance and get the amount of funds available for trading or funds locked in orders
|
|
221665
|
+
* @see https://github.com/bitoex/bitopro-offical-api-docs/blob/master/ws/private/user_balance_stream.md
|
|
221196
221666
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
221197
221667
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
221198
221668
|
*/
|
|
@@ -221639,7 +222109,12 @@ class bitrue extends _bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
221639
222109
|
const symbol = market['symbol'];
|
|
221640
222110
|
const timestamp = this.safeInteger(message, 'ts');
|
|
221641
222111
|
const tick = this.safeValue(message, 'tick', {});
|
|
221642
|
-
|
|
222112
|
+
let orderbook = this.safeValue(this.orderbooks, symbol);
|
|
222113
|
+
if (orderbook === undefined) {
|
|
222114
|
+
orderbook = this.orderBook();
|
|
222115
|
+
}
|
|
222116
|
+
const snapshot = this.parseOrderBook(tick, symbol, timestamp, 'buys', 'asks');
|
|
222117
|
+
orderbook.reset(snapshot);
|
|
221643
222118
|
this.orderbooks[symbol] = orderbook;
|
|
221644
222119
|
const messageHash = 'orderbook:' + symbol;
|
|
221645
222120
|
client.resolve(orderbook, messageHash);
|
|
@@ -222331,21 +222806,38 @@ class bitvavo extends _bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
222331
222806
|
return this.deepExtend(super.describe(), {
|
|
222332
222807
|
'has': {
|
|
222333
222808
|
'ws': true,
|
|
222334
|
-
'createOrderWs': false,
|
|
222335
|
-
'editOrderWs': false,
|
|
222336
|
-
'fetchOpenOrdersWs': false,
|
|
222337
|
-
'fetchOrderWs': false,
|
|
222338
|
-
'cancelOrderWs': false,
|
|
222339
222809
|
'cancelOrdersWs': false,
|
|
222340
|
-
'cancelAllOrdersWs': false,
|
|
222341
222810
|
'fetchTradesWs': false,
|
|
222342
|
-
'fetchBalanceWs': false,
|
|
222343
222811
|
'watchOrderBook': true,
|
|
222344
222812
|
'watchTrades': true,
|
|
222345
222813
|
'watchTicker': true,
|
|
222346
222814
|
'watchOHLCV': true,
|
|
222347
222815
|
'watchOrders': true,
|
|
222348
222816
|
'watchMyTrades': true,
|
|
222817
|
+
'cancelAllOrdersWs': true,
|
|
222818
|
+
'cancelOrderWs': true,
|
|
222819
|
+
'createOrderWs': true,
|
|
222820
|
+
'createStopLimitOrderWs': true,
|
|
222821
|
+
'createStopMarketOrderWs': true,
|
|
222822
|
+
'createStopOrderWs': true,
|
|
222823
|
+
'editOrderWs': true,
|
|
222824
|
+
'fetchBalanceWs': true,
|
|
222825
|
+
'fetchCurrenciesWS': true,
|
|
222826
|
+
'fetchDepositAddressWs': true,
|
|
222827
|
+
'fetchDepositsWs': true,
|
|
222828
|
+
'fetchDepositWithdrawFeesWs': true,
|
|
222829
|
+
'fetchMyTradesWs': true,
|
|
222830
|
+
'fetchOHLCVWs': true,
|
|
222831
|
+
'fetchOpenOrdersWs': true,
|
|
222832
|
+
'fetchOrderWs': true,
|
|
222833
|
+
'fetchOrderBookWs': true,
|
|
222834
|
+
'fetchOrdersWs': true,
|
|
222835
|
+
'fetchTickerWs': true,
|
|
222836
|
+
'fetchTickersWs': true,
|
|
222837
|
+
'fetchTimeWs': true,
|
|
222838
|
+
'fetchTradingFeesWs': true,
|
|
222839
|
+
'fetchWithdrawalsWs': true,
|
|
222840
|
+
'withdrawWs': true,
|
|
222349
222841
|
},
|
|
222350
222842
|
'urls': {
|
|
222351
222843
|
'api': {
|
|
@@ -222353,6 +222845,7 @@ class bitvavo extends _bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
222353
222845
|
},
|
|
222354
222846
|
},
|
|
222355
222847
|
'options': {
|
|
222848
|
+
'supressMultipleWsRequestsError': false,
|
|
222356
222849
|
'tradesLimit': 1000,
|
|
222357
222850
|
'ordersLimit': 1000,
|
|
222358
222851
|
'OHLCVLimit': 1000,
|
|
@@ -222508,6 +223001,22 @@ class bitvavo extends _bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
222508
223001
|
}
|
|
222509
223002
|
return this.filterBySinceLimit(ohlcv, since, limit, 0, true);
|
|
222510
223003
|
}
|
|
223004
|
+
handleFetchOHLCV(client, message) {
|
|
223005
|
+
//
|
|
223006
|
+
// {
|
|
223007
|
+
// action: 'getCandles',
|
|
223008
|
+
// response: [
|
|
223009
|
+
// [1690325820000, '26453', '26453', '26436', '26447', '0.01626246'],
|
|
223010
|
+
// [1690325760000, '26454', '26454', '26453', '26453', '0.00037707']
|
|
223011
|
+
// ]
|
|
223012
|
+
// }
|
|
223013
|
+
//
|
|
223014
|
+
const action = this.safeString(message, 'action');
|
|
223015
|
+
const response = this.safeValue(message, 'response');
|
|
223016
|
+
const ohlcv = this.parseOHLCVs(response, undefined, undefined, undefined);
|
|
223017
|
+
const messageHash = this.buildMessageHash(action);
|
|
223018
|
+
client.resolve(ohlcv, messageHash);
|
|
223019
|
+
}
|
|
222511
223020
|
handleOHLCV(client, message) {
|
|
222512
223021
|
//
|
|
222513
223022
|
// {
|
|
@@ -222813,6 +223322,584 @@ class bitvavo extends _bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
222813
223322
|
}
|
|
222814
223323
|
return this.filterBySymbolSinceLimit(trades, symbol, since, limit, true);
|
|
222815
223324
|
}
|
|
223325
|
+
async createOrderWs(symbol, type, side, amount, price = undefined, params = {}) {
|
|
223326
|
+
/**
|
|
223327
|
+
* @method
|
|
223328
|
+
* @name bitvavo#createOrderWs
|
|
223329
|
+
* @description create a trade order
|
|
223330
|
+
* @see https://docs.bitvavo.com/#tag/Orders/paths/~1order/post
|
|
223331
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
223332
|
+
* @param {string} type 'market' or 'limit'
|
|
223333
|
+
* @param {string} side 'buy' or 'sell'
|
|
223334
|
+
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
223335
|
+
* @param {float} price the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
223336
|
+
* @param {object} [params] extra parameters specific to the bitvavo api endpoint
|
|
223337
|
+
* @param {string} [params.timeInForce] "GTC", "IOC", or "PO"
|
|
223338
|
+
* @param {float} [params.stopPrice] The price at which a trigger order is triggered at
|
|
223339
|
+
* @param {float} [params.triggerPrice] The price at which a trigger order is triggered at
|
|
223340
|
+
* @param {bool} [params.postOnly] If true, the order will only be posted to the order book and not executed immediately
|
|
223341
|
+
* @param {float} [params.stopLossPrice] The price at which a stop loss order is triggered at
|
|
223342
|
+
* @param {float} [params.takeProfitPrice] The price at which a take profit order is triggered at
|
|
223343
|
+
* @param {string} [params.triggerType] "price"
|
|
223344
|
+
* @param {string} [params.triggerReference] "lastTrade", "bestBid", "bestAsk", "midPrice" Only for stop orders: Use this to determine which parameter will trigger the order
|
|
223345
|
+
* @param {string} [params.selfTradePrevention] "decrementAndCancel", "cancelOldest", "cancelNewest", "cancelBoth"
|
|
223346
|
+
* @param {bool} [params.disableMarketProtection] don't cancel if the next fill price is 10% worse than the best fill price
|
|
223347
|
+
* @param {bool} [params.responseRequired] Set this to 'false' when only an acknowledgement of success or failure is required, this is faster.
|
|
223348
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
223349
|
+
*/
|
|
223350
|
+
await this.loadMarkets();
|
|
223351
|
+
await this.authenticate();
|
|
223352
|
+
const request = this.createOrderRequest(symbol, type, side, amount, price, params);
|
|
223353
|
+
return await this.watchRequest('privateCreateOrder', request);
|
|
223354
|
+
}
|
|
223355
|
+
async editOrderWs(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
|
|
223356
|
+
/**
|
|
223357
|
+
* @method
|
|
223358
|
+
* @name bitvavo#editOrderWs
|
|
223359
|
+
* @description edit a trade order
|
|
223360
|
+
* @see https://docs.bitvavo.com/#tag/Orders/paths/~1order/put
|
|
223361
|
+
* @param {string} id cancel order id
|
|
223362
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
223363
|
+
* @param {string} type 'market' or 'limit'
|
|
223364
|
+
* @param {string} side 'buy' or 'sell'
|
|
223365
|
+
* @param {float} [amount] how much of currency you want to trade in units of base currency
|
|
223366
|
+
* @param {float} [price] the price at which the order is to be fullfilled, in units of the base currency, ignored in market orders
|
|
223367
|
+
* @param {object} [params] extra parameters specific to the bitvavo api endpoint
|
|
223368
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
223369
|
+
*/
|
|
223370
|
+
await this.loadMarkets();
|
|
223371
|
+
await this.authenticate();
|
|
223372
|
+
const request = this.editOrderRequest(id, symbol, type, side, amount, price, params);
|
|
223373
|
+
return await this.watchRequest('privateUpdateOrder', request);
|
|
223374
|
+
}
|
|
223375
|
+
async cancelOrderWs(id, symbol = undefined, params = {}) {
|
|
223376
|
+
/**
|
|
223377
|
+
* @method
|
|
223378
|
+
* @name bitvavo#cancelOrderWs
|
|
223379
|
+
* @see https://docs.bitvavo.com/#tag/Orders/paths/~1order/delete
|
|
223380
|
+
* @description cancels an open order
|
|
223381
|
+
* @param {string} id order id
|
|
223382
|
+
* @param {string} symbol unified symbol of the market the order was made in
|
|
223383
|
+
* @param {object} [params] extra parameters specific to the bitvavo api endpoint
|
|
223384
|
+
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
223385
|
+
*/
|
|
223386
|
+
await this.loadMarkets();
|
|
223387
|
+
await this.authenticate();
|
|
223388
|
+
const request = this.cancelOrderRequest(id, symbol, params);
|
|
223389
|
+
return await this.watchRequest('privateCancelOrder', request);
|
|
223390
|
+
}
|
|
223391
|
+
async cancelAllOrdersWs(symbol = undefined, params = {}) {
|
|
223392
|
+
/**
|
|
223393
|
+
* @method
|
|
223394
|
+
* @name bitvavo#cancelAllOrdersWs
|
|
223395
|
+
* @see https://docs.bitvavo.com/#tag/Orders/paths/~1orders/delete
|
|
223396
|
+
* @description cancel all open orders
|
|
223397
|
+
* @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
|
|
223398
|
+
* @param {object} [params] extra parameters specific to the bitvavo api endpoint
|
|
223399
|
+
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
223400
|
+
*/
|
|
223401
|
+
await this.loadMarkets();
|
|
223402
|
+
await this.authenticate();
|
|
223403
|
+
const request = {};
|
|
223404
|
+
let market = undefined;
|
|
223405
|
+
if (symbol !== undefined) {
|
|
223406
|
+
market = this.market(symbol);
|
|
223407
|
+
request['market'] = market['id'];
|
|
223408
|
+
}
|
|
223409
|
+
return await this.watchRequest('privateCancelOrders', this.extend(request, params));
|
|
223410
|
+
}
|
|
223411
|
+
handleMultipleOrders(client, message) {
|
|
223412
|
+
//
|
|
223413
|
+
// {
|
|
223414
|
+
// action: 'privateCancelOrders',
|
|
223415
|
+
// response: [{
|
|
223416
|
+
// orderId: 'd71df826-1130-478a-8741-d219128675b0'
|
|
223417
|
+
// }]
|
|
223418
|
+
// }
|
|
223419
|
+
//
|
|
223420
|
+
const action = this.safeString(message, 'action');
|
|
223421
|
+
const response = this.safeValue(message, 'response');
|
|
223422
|
+
const firstRawOrder = this.safeValue(response, 0, {});
|
|
223423
|
+
const marketId = this.safeString(firstRawOrder, 'market');
|
|
223424
|
+
const orders = this.parseOrders(response);
|
|
223425
|
+
let messageHash = this.buildMessageHash(action, { 'market': marketId });
|
|
223426
|
+
client.resolve(orders, messageHash);
|
|
223427
|
+
messageHash = this.buildMessageHash(action, message);
|
|
223428
|
+
client.resolve(orders, messageHash);
|
|
223429
|
+
}
|
|
223430
|
+
async fetchOrderWs(id, symbol = undefined, params = {}) {
|
|
223431
|
+
/**
|
|
223432
|
+
* @method
|
|
223433
|
+
* @name bitvavo#fetchOrderWs
|
|
223434
|
+
* @see https://docs.bitvavo.com/#tag/General/paths/~1assets/get
|
|
223435
|
+
* @description fetches information on an order made by the user
|
|
223436
|
+
* @param {string} symbol unified symbol of the market the order was made in
|
|
223437
|
+
* @param {object} [params] extra parameters specific to the bitvavo api endpoint
|
|
223438
|
+
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
223439
|
+
*/
|
|
223440
|
+
if (symbol === undefined) {
|
|
223441
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' fetchOrder() requires a symbol argument');
|
|
223442
|
+
}
|
|
223443
|
+
await this.loadMarkets();
|
|
223444
|
+
await this.authenticate();
|
|
223445
|
+
const market = this.market(symbol);
|
|
223446
|
+
const request = {
|
|
223447
|
+
'orderId': id,
|
|
223448
|
+
'market': market['id'],
|
|
223449
|
+
};
|
|
223450
|
+
return await this.watchRequest('privateGetOrder', this.extend(request, params));
|
|
223451
|
+
}
|
|
223452
|
+
async fetchOrdersWs(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
223453
|
+
/**
|
|
223454
|
+
* @method
|
|
223455
|
+
* @name bitvavo#fetchOrdersWs
|
|
223456
|
+
* @see https://docs.bitvavo.com/#tag/Orders/paths/~1orders/get
|
|
223457
|
+
* @description fetches information on multiple orders made by the user
|
|
223458
|
+
* @param {string} symbol unified market symbol of the market orders were made in
|
|
223459
|
+
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
223460
|
+
* @param {int} [limit] the maximum number of orde structures to retrieve
|
|
223461
|
+
* @param {object} [params] extra parameters specific to the bitvavo api endpoint
|
|
223462
|
+
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
223463
|
+
*/
|
|
223464
|
+
if (symbol === undefined) {
|
|
223465
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' fetchOrdersWs() requires a symbol argument');
|
|
223466
|
+
}
|
|
223467
|
+
await this.loadMarkets();
|
|
223468
|
+
await this.authenticate();
|
|
223469
|
+
const request = this.fetchOrdersRequest(symbol, since, limit, params);
|
|
223470
|
+
const orders = await this.watchRequest('privateGetOrders', request);
|
|
223471
|
+
return this.filterBySymbolSinceLimit(orders, symbol, since, limit);
|
|
223472
|
+
}
|
|
223473
|
+
async watchRequest(action, request) {
|
|
223474
|
+
request['action'] = action;
|
|
223475
|
+
const messageHash = this.buildMessageHash(action, request);
|
|
223476
|
+
this.checkMessageHashDoesNotExist(messageHash);
|
|
223477
|
+
const url = this.urls['api']['ws'];
|
|
223478
|
+
return await this.watch(url, messageHash, request, messageHash);
|
|
223479
|
+
}
|
|
223480
|
+
async fetchOpenOrdersWs(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
223481
|
+
/**
|
|
223482
|
+
* @method
|
|
223483
|
+
* @name bitvavo#fetchOpenOrdersWs
|
|
223484
|
+
* @description fetch all unfilled currently open orders
|
|
223485
|
+
* @param {string} symbol unified market symbol
|
|
223486
|
+
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
223487
|
+
* @param {int} [limit] the maximum number of open orders structures to retrieve
|
|
223488
|
+
* @param {object} [params] extra parameters specific to the bitvavo api endpoint
|
|
223489
|
+
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
223490
|
+
*/
|
|
223491
|
+
await this.loadMarkets();
|
|
223492
|
+
await this.authenticate();
|
|
223493
|
+
const request = {
|
|
223494
|
+
// 'market': market['id'], // rate limit 25 without a market, 1 with market specified
|
|
223495
|
+
};
|
|
223496
|
+
let market = undefined;
|
|
223497
|
+
if (symbol !== undefined) {
|
|
223498
|
+
market = this.market(symbol);
|
|
223499
|
+
request['market'] = market['id'];
|
|
223500
|
+
}
|
|
223501
|
+
const orders = await this.watchRequest('privateGetOrdersOpen', this.extend(request, params));
|
|
223502
|
+
return this.filterBySymbolSinceLimit(orders, symbol, since, limit);
|
|
223503
|
+
}
|
|
223504
|
+
async fetchMyTradesWs(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
223505
|
+
/**
|
|
223506
|
+
* @method
|
|
223507
|
+
* @name bitvavo#fetchMyTradesWs
|
|
223508
|
+
* @see https://docs.bitvavo.com/#tag/Trades
|
|
223509
|
+
* @description fetch all trades made by the user
|
|
223510
|
+
* @param {string} symbol unified market symbol
|
|
223511
|
+
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
223512
|
+
* @param {int} [limit] the maximum number of trades structures to retrieve
|
|
223513
|
+
* @param {object} [params] extra parameters specific to the bitvavo api endpoint
|
|
223514
|
+
* @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
|
|
223515
|
+
*/
|
|
223516
|
+
if (symbol === undefined) {
|
|
223517
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' fetchMyTradesWs() requires a symbol argument');
|
|
223518
|
+
}
|
|
223519
|
+
await this.loadMarkets();
|
|
223520
|
+
await this.authenticate();
|
|
223521
|
+
const request = this.fetchMyTradesRequest(symbol, since, limit, params);
|
|
223522
|
+
const myTrades = await this.watchRequest('privateGetTrades', request);
|
|
223523
|
+
return this.filterBySymbolSinceLimit(myTrades, symbol, since, limit);
|
|
223524
|
+
}
|
|
223525
|
+
handleMyTrades(client, message) {
|
|
223526
|
+
//
|
|
223527
|
+
// {
|
|
223528
|
+
// action: 'privateGetTrades',
|
|
223529
|
+
// response: [
|
|
223530
|
+
// {
|
|
223531
|
+
// "id": "108c3633-0276-4480-a902-17a01829deae",
|
|
223532
|
+
// "orderId": "1d671998-3d44-4df4-965f-0d48bd129a1b",
|
|
223533
|
+
// "timestamp": 1542967486256,
|
|
223534
|
+
// "market": "BTC-EUR",
|
|
223535
|
+
// "side": "buy",
|
|
223536
|
+
// "amount": "0.005",
|
|
223537
|
+
// "price": "5000.1",
|
|
223538
|
+
// "taker": true,
|
|
223539
|
+
// "fee": "0.03",
|
|
223540
|
+
// "feeCurrency": "EUR",
|
|
223541
|
+
// "settled": true
|
|
223542
|
+
// }
|
|
223543
|
+
// ]
|
|
223544
|
+
// }
|
|
223545
|
+
//
|
|
223546
|
+
//
|
|
223547
|
+
const action = this.safeString(message, 'action');
|
|
223548
|
+
const response = this.safeValue(message, 'response');
|
|
223549
|
+
const firstRawTrade = this.safeValue(response, 0, {});
|
|
223550
|
+
const marketId = this.safeString(firstRawTrade, 'market');
|
|
223551
|
+
const trades = this.parseTrades(response, undefined, undefined, undefined);
|
|
223552
|
+
const messageHash = this.buildMessageHash(action, { 'market': marketId });
|
|
223553
|
+
client.resolve(trades, messageHash);
|
|
223554
|
+
}
|
|
223555
|
+
async withdrawWs(code, amount, address, tag = undefined, params = {}) {
|
|
223556
|
+
/**
|
|
223557
|
+
* @method
|
|
223558
|
+
* @name bitvavo#withdrawWs
|
|
223559
|
+
* @description make a withdrawal
|
|
223560
|
+
* @param {string} code unified currency code
|
|
223561
|
+
* @param {float} amount the amount to withdraw
|
|
223562
|
+
* @param {string} address the address to withdraw to
|
|
223563
|
+
* @param {string} tag
|
|
223564
|
+
* @param {object} [params] extra parameters specific to the bitvavo api endpoint
|
|
223565
|
+
* @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
223566
|
+
*/
|
|
223567
|
+
[tag, params] = this.handleWithdrawTagAndParams(tag, params);
|
|
223568
|
+
this.checkAddress(address);
|
|
223569
|
+
await this.loadMarkets();
|
|
223570
|
+
await this.authenticate();
|
|
223571
|
+
const request = this.withdrawRequest(code, amount, address, tag, params);
|
|
223572
|
+
return await this.watchRequest('privateWithdrawAssets', request);
|
|
223573
|
+
}
|
|
223574
|
+
handleWithdraw(client, message) {
|
|
223575
|
+
//
|
|
223576
|
+
// {
|
|
223577
|
+
// action: 'privateWithdrawAssets',
|
|
223578
|
+
// response: {
|
|
223579
|
+
// "success": true,
|
|
223580
|
+
// "symbol": "BTC",
|
|
223581
|
+
// "amount": "1.5"
|
|
223582
|
+
// }
|
|
223583
|
+
// }
|
|
223584
|
+
//
|
|
223585
|
+
const action = this.safeString(message, 'action');
|
|
223586
|
+
const messageHash = this.buildMessageHash(action, message);
|
|
223587
|
+
const response = this.safeValue(message, 'response');
|
|
223588
|
+
const withdraw = this.parseTransaction(response);
|
|
223589
|
+
client.resolve(withdraw, messageHash);
|
|
223590
|
+
}
|
|
223591
|
+
async fetchWithdrawalsWs(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
223592
|
+
/**
|
|
223593
|
+
* @method
|
|
223594
|
+
* @name bitvavo#fetchWithdrawalsWs
|
|
223595
|
+
* @see https://docs.bitvavo.com/#tag/Account/paths/~1withdrawalHistory/get
|
|
223596
|
+
* @description fetch all withdrawals made from an account
|
|
223597
|
+
* @param {string} code unified currency code
|
|
223598
|
+
* @param {int} [since] the earliest time in ms to fetch withdrawals for
|
|
223599
|
+
* @param {int} [limit] the maximum number of withdrawals structures to retrieve
|
|
223600
|
+
* @param {object} [params] extra parameters specific to the bitvavo api endpoint
|
|
223601
|
+
* @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
223602
|
+
*/
|
|
223603
|
+
await this.loadMarkets();
|
|
223604
|
+
await this.authenticate();
|
|
223605
|
+
const request = this.fetchWithdrawalsRequest(code, since, limit, params);
|
|
223606
|
+
const withdraws = await this.watchRequest('privateGetWithdrawalHistory', request);
|
|
223607
|
+
return this.filterByCurrencySinceLimit(withdraws, code, since, limit);
|
|
223608
|
+
}
|
|
223609
|
+
handleWithdraws(client, message) {
|
|
223610
|
+
//
|
|
223611
|
+
// {
|
|
223612
|
+
// action: 'privateGetWithdrawalHistory',
|
|
223613
|
+
// response: [{
|
|
223614
|
+
// timestamp: 1689792085000,
|
|
223615
|
+
// symbol: 'BTC',
|
|
223616
|
+
// amount: '0.0009',
|
|
223617
|
+
// fee: '0',
|
|
223618
|
+
// status: 'completed',
|
|
223619
|
+
// txId: '7dbadc658d7d59c129de1332c55ee8e08d0ab74432faae03b417b9809c819d1f'
|
|
223620
|
+
// },
|
|
223621
|
+
// ...
|
|
223622
|
+
// ]
|
|
223623
|
+
// }
|
|
223624
|
+
//
|
|
223625
|
+
const action = this.safeString(message, 'action');
|
|
223626
|
+
const messageHash = this.buildMessageHash(action, message);
|
|
223627
|
+
const response = this.safeValue(message, 'response');
|
|
223628
|
+
const withdrawals = this.parseTransactions(response, undefined, undefined, undefined, { 'type': 'withdrawal' });
|
|
223629
|
+
client.resolve(withdrawals, messageHash);
|
|
223630
|
+
}
|
|
223631
|
+
async fetchOHLCVWs(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
|
|
223632
|
+
/**
|
|
223633
|
+
* @method
|
|
223634
|
+
* @name bitvavo#fetchOHLCVWs
|
|
223635
|
+
* @see https://docs.bitvavo.com/#tag/Market-Data/paths/~1{market}~1candles/get
|
|
223636
|
+
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
223637
|
+
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
223638
|
+
* @param {string} timeframe the length of time each candle represents
|
|
223639
|
+
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
223640
|
+
* @param {int} [limit] the maximum amount of candles to fetch
|
|
223641
|
+
* @param {object} [params] extra parameters specific to the bitvavo api endpoint
|
|
223642
|
+
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
223643
|
+
*/
|
|
223644
|
+
await this.loadMarkets();
|
|
223645
|
+
const request = this.fetchOHLCVRequest(symbol, timeframe, since, limit, params);
|
|
223646
|
+
const action = 'getCandles';
|
|
223647
|
+
const ohlcv = await this.watchRequest(action, request);
|
|
223648
|
+
return this.filterBySinceLimit(ohlcv, since, limit, 0, true);
|
|
223649
|
+
}
|
|
223650
|
+
async fetchDepositsWs(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
223651
|
+
/**
|
|
223652
|
+
* @method
|
|
223653
|
+
* @name bitvavo#fetchDepositsWs
|
|
223654
|
+
* @see https://docs.bitvavo.com/#tag/Account/paths/~1depositHistory/get
|
|
223655
|
+
* @description fetch all deposits made to an account
|
|
223656
|
+
* @param {string} code unified currency code
|
|
223657
|
+
* @param {int} [since] the earliest time in ms to fetch deposits for
|
|
223658
|
+
* @param {int} [limit] the maximum number of deposits structures to retrieve
|
|
223659
|
+
* @param {object} [params] extra parameters specific to the bitvavo api endpoint
|
|
223660
|
+
* @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
223661
|
+
*/
|
|
223662
|
+
await this.loadMarkets();
|
|
223663
|
+
await this.authenticate();
|
|
223664
|
+
const request = this.fetchDepositsRequest(code, since, limit, params);
|
|
223665
|
+
const deposits = await this.watchRequest('privateGetDepositHistory', request);
|
|
223666
|
+
return this.filterByCurrencySinceLimit(deposits, code, since, limit);
|
|
223667
|
+
}
|
|
223668
|
+
handleDeposits(client, message) {
|
|
223669
|
+
//
|
|
223670
|
+
// {
|
|
223671
|
+
// action: 'privateGetDepositHistory',
|
|
223672
|
+
// response: [{
|
|
223673
|
+
// timestamp: 1689792085000,
|
|
223674
|
+
// symbol: 'BTC',
|
|
223675
|
+
// amount: '0.0009',
|
|
223676
|
+
// fee: '0',
|
|
223677
|
+
// status: 'completed',
|
|
223678
|
+
// txId: '7dbadc658d7d59c129de1332c55ee8e08d0ab74432faae03b417b9809c819d1f'
|
|
223679
|
+
// },
|
|
223680
|
+
// ...
|
|
223681
|
+
// ]
|
|
223682
|
+
// }
|
|
223683
|
+
//
|
|
223684
|
+
const action = this.safeString(message, 'action');
|
|
223685
|
+
const messageHash = this.buildMessageHash(action, message);
|
|
223686
|
+
const response = this.safeValue(message, 'response');
|
|
223687
|
+
const deposits = this.parseTransactions(response, undefined, undefined, undefined, { 'type': 'deposit' });
|
|
223688
|
+
client.resolve(deposits, messageHash);
|
|
223689
|
+
}
|
|
223690
|
+
async fetchTradingFeesWs(params = {}) {
|
|
223691
|
+
/**
|
|
223692
|
+
* @method
|
|
223693
|
+
* @name bitvavo#fetchTradingFeesWs
|
|
223694
|
+
* @see https://docs.bitvavo.com/#tag/Account/paths/~1account/get
|
|
223695
|
+
* @description fetch the trading fees for multiple markets
|
|
223696
|
+
* @param {object} [params] extra parameters specific to the bitvavo api endpoint
|
|
223697
|
+
* @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
|
|
223698
|
+
*/
|
|
223699
|
+
await this.loadMarkets();
|
|
223700
|
+
await this.authenticate();
|
|
223701
|
+
return await this.watchRequest('privateGetAccount', params);
|
|
223702
|
+
}
|
|
223703
|
+
async fetchMarketsWs(params = {}) {
|
|
223704
|
+
/**
|
|
223705
|
+
* @method
|
|
223706
|
+
* @name bitvavo#fetchMarketsWs
|
|
223707
|
+
* @see https://docs.bitvavo.com/#tag/General/paths/~1markets/get
|
|
223708
|
+
* @description retrieves data on all markets for bitvavo
|
|
223709
|
+
* @param {object} [params] extra parameters specific to the exchange api endpoint
|
|
223710
|
+
* @returns {object[]} an array of objects representing market data
|
|
223711
|
+
*/
|
|
223712
|
+
return await this.watchRequest('getMarkets', params);
|
|
223713
|
+
}
|
|
223714
|
+
async fetchCurrenciesWs(params = {}) {
|
|
223715
|
+
/**
|
|
223716
|
+
* @method
|
|
223717
|
+
* @name bitvavo#fetchCurrenciesWs
|
|
223718
|
+
* @see https://docs.bitvavo.com/#tag/General/paths/~1assets/get
|
|
223719
|
+
* @description fetches all available currencies on an exchange
|
|
223720
|
+
* @param {object} [params] extra parameters specific to the bitvavo api endpoint
|
|
223721
|
+
* @returns {object} an associative dictionary of currencies
|
|
223722
|
+
*/
|
|
223723
|
+
await this.loadMarkets();
|
|
223724
|
+
return await this.watchRequest('getAssets', params);
|
|
223725
|
+
}
|
|
223726
|
+
handleFetchCurrencies(client, message) {
|
|
223727
|
+
//
|
|
223728
|
+
// {
|
|
223729
|
+
// action: 'getAssets',
|
|
223730
|
+
// response: [{
|
|
223731
|
+
// symbol: '1INCH',
|
|
223732
|
+
// name: '1inch',
|
|
223733
|
+
// decimals: 8,
|
|
223734
|
+
// depositFee: '0',
|
|
223735
|
+
// depositConfirmations: 64,
|
|
223736
|
+
// depositStatus: 'OK',
|
|
223737
|
+
// withdrawalFee: '13',
|
|
223738
|
+
// withdrawalMinAmount: '13',
|
|
223739
|
+
// withdrawalStatus: 'OK',
|
|
223740
|
+
// networks: [Array],
|
|
223741
|
+
// message: ''
|
|
223742
|
+
// },
|
|
223743
|
+
// ...
|
|
223744
|
+
// ]
|
|
223745
|
+
// }
|
|
223746
|
+
//
|
|
223747
|
+
const action = this.safeString(message, 'action');
|
|
223748
|
+
const messageHash = this.buildMessageHash(action, message);
|
|
223749
|
+
const response = this.safeValue(message, 'response');
|
|
223750
|
+
const currencies = this.parseCurrencies(response);
|
|
223751
|
+
client.resolve(currencies, messageHash);
|
|
223752
|
+
}
|
|
223753
|
+
handleTradingFees(client, message) {
|
|
223754
|
+
//
|
|
223755
|
+
// {
|
|
223756
|
+
// action: 'privateGetAccount',
|
|
223757
|
+
// response: {
|
|
223758
|
+
// fees: {
|
|
223759
|
+
// taker: '0.0025',
|
|
223760
|
+
// maker: '0.0015',
|
|
223761
|
+
// volume: '1693.74'
|
|
223762
|
+
// }
|
|
223763
|
+
// }
|
|
223764
|
+
// }
|
|
223765
|
+
//
|
|
223766
|
+
const action = this.safeString(message, 'action');
|
|
223767
|
+
const messageHash = this.buildMessageHash(action, message);
|
|
223768
|
+
const response = this.safeValue(message, 'response');
|
|
223769
|
+
const fees = this.parseTradingFees(response);
|
|
223770
|
+
client.resolve(fees, messageHash);
|
|
223771
|
+
}
|
|
223772
|
+
async fetchBalanceWs(params = {}) {
|
|
223773
|
+
/**
|
|
223774
|
+
* @method
|
|
223775
|
+
* @name bitvavo#fetchBalanceWs
|
|
223776
|
+
* @see https://docs.bitvavo.com/#tag/Account/paths/~1balance/get
|
|
223777
|
+
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
223778
|
+
* @param {object} [params] extra parameters specific to the bitvavo api endpoint
|
|
223779
|
+
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/en/latest/manual.html?#balance-structure}
|
|
223780
|
+
*/
|
|
223781
|
+
await this.loadMarkets();
|
|
223782
|
+
await this.authenticate();
|
|
223783
|
+
return await this.watchRequest('privateGetBalance', params);
|
|
223784
|
+
}
|
|
223785
|
+
handleFetchBalance(client, message) {
|
|
223786
|
+
//
|
|
223787
|
+
// {
|
|
223788
|
+
// action: 'privateGetBalance',
|
|
223789
|
+
// response: [{
|
|
223790
|
+
// symbol: 'ADA',
|
|
223791
|
+
// available: '0',
|
|
223792
|
+
// inOrder: '0'
|
|
223793
|
+
// },
|
|
223794
|
+
// ...
|
|
223795
|
+
// ]
|
|
223796
|
+
// }
|
|
223797
|
+
//
|
|
223798
|
+
const action = this.safeString(message, 'action', 'privateGetBalance');
|
|
223799
|
+
const messageHash = this.buildMessageHash(action, message);
|
|
223800
|
+
const response = this.safeValue(message, 'response', []);
|
|
223801
|
+
const balance = this.parseBalance(response);
|
|
223802
|
+
client.resolve(balance, messageHash);
|
|
223803
|
+
}
|
|
223804
|
+
handleSingleOrder(client, message) {
|
|
223805
|
+
//
|
|
223806
|
+
// {
|
|
223807
|
+
// action: 'privateCreateOrder',
|
|
223808
|
+
// response: {
|
|
223809
|
+
// orderId: 'd71df826-1130-478a-8741-d219128675b0',
|
|
223810
|
+
// market: 'BTC-EUR',
|
|
223811
|
+
// created: 1689792749748,
|
|
223812
|
+
// updated: 1689792749748,
|
|
223813
|
+
// status: 'new',
|
|
223814
|
+
// side: 'sell',
|
|
223815
|
+
// orderType: 'limit',
|
|
223816
|
+
// amount: '0.0002',
|
|
223817
|
+
// amountRemaining: '0.0002',
|
|
223818
|
+
// price: '37000',
|
|
223819
|
+
// onHold: '0.0002',
|
|
223820
|
+
// onHoldCurrency: 'BTC',
|
|
223821
|
+
// filledAmount: '0',
|
|
223822
|
+
// filledAmountQuote: '0',
|
|
223823
|
+
// feePaid: '0',
|
|
223824
|
+
// feeCurrency: 'EUR',
|
|
223825
|
+
// fills: [],
|
|
223826
|
+
// selfTradePrevention: 'decrementAndCancel',
|
|
223827
|
+
// visible: true,
|
|
223828
|
+
// timeInForce: 'GTC',
|
|
223829
|
+
// postOnly: false
|
|
223830
|
+
// }
|
|
223831
|
+
// }
|
|
223832
|
+
//
|
|
223833
|
+
const action = this.safeString(message, 'action');
|
|
223834
|
+
const response = this.safeValue(message, 'response', {});
|
|
223835
|
+
const order = this.parseOrder(response);
|
|
223836
|
+
const messageHash = this.buildMessageHash(action, response);
|
|
223837
|
+
client.resolve(order, messageHash);
|
|
223838
|
+
}
|
|
223839
|
+
handleMarkets(client, message) {
|
|
223840
|
+
//
|
|
223841
|
+
// {
|
|
223842
|
+
// action: 'getMarkets',
|
|
223843
|
+
// response: [{
|
|
223844
|
+
// market: '1INCH-EUR',
|
|
223845
|
+
// status: 'trading',
|
|
223846
|
+
// base: '1INCH',
|
|
223847
|
+
// quote: 'EUR',
|
|
223848
|
+
// pricePrecision: 5,
|
|
223849
|
+
// minOrderInBaseAsset: '2',
|
|
223850
|
+
// minOrderInQuoteAsset: '5',
|
|
223851
|
+
// maxOrderInBaseAsset: '1000000000',
|
|
223852
|
+
// maxOrderInQuoteAsset: '1000000000',
|
|
223853
|
+
// orderTypes: [Array]
|
|
223854
|
+
// },
|
|
223855
|
+
// ...
|
|
223856
|
+
// ]
|
|
223857
|
+
// }
|
|
223858
|
+
//
|
|
223859
|
+
const action = this.safeString(message, 'action');
|
|
223860
|
+
const response = this.safeValue(message, 'response', {});
|
|
223861
|
+
const markets = this.parseMarkets(response);
|
|
223862
|
+
const messageHash = this.buildMessageHash(action, response);
|
|
223863
|
+
client.resolve(markets, messageHash);
|
|
223864
|
+
}
|
|
223865
|
+
buildMessageHash(action, params = {}) {
|
|
223866
|
+
const methods = {
|
|
223867
|
+
'privateCreateOrder': this.actionAndMarketMessageHash,
|
|
223868
|
+
'privateUpdateOrder': this.actionAndOrderIdMessageHash,
|
|
223869
|
+
'privateCancelOrder': this.actionAndOrderIdMessageHash,
|
|
223870
|
+
'privateGetOrder': this.actionAndOrderIdMessageHash,
|
|
223871
|
+
'privateGetTrades': this.actionAndMarketMessageHash,
|
|
223872
|
+
};
|
|
223873
|
+
const method = this.safeValue(methods, action);
|
|
223874
|
+
let messageHash = action;
|
|
223875
|
+
if (method !== undefined) {
|
|
223876
|
+
messageHash = method.call(this, action, params);
|
|
223877
|
+
}
|
|
223878
|
+
return messageHash;
|
|
223879
|
+
}
|
|
223880
|
+
checkMessageHashDoesNotExist(messageHash) {
|
|
223881
|
+
const supressMultipleWsRequestsError = this.safeValue(this.options, 'supressMultipleWsRequestsError', false);
|
|
223882
|
+
if (!supressMultipleWsRequestsError) {
|
|
223883
|
+
const client = this.safeValue(this.clients, this.urls['api']['ws']);
|
|
223884
|
+
if (client !== undefined) {
|
|
223885
|
+
const future = this.safeValue(client.futures, messageHash);
|
|
223886
|
+
if (future !== undefined) {
|
|
223887
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError(this.id + ' a similar request with messageHash ' + messageHash + ' is already pending, you must wait for a response, or turn off this error by setting supressMultipleWsRequestsError in the options to true');
|
|
223888
|
+
}
|
|
223889
|
+
}
|
|
223890
|
+
}
|
|
223891
|
+
}
|
|
223892
|
+
actionAndMarketMessageHash(action, params = {}) {
|
|
223893
|
+
const symbol = this.safeString(params, 'market', '');
|
|
223894
|
+
return action + symbol;
|
|
223895
|
+
}
|
|
223896
|
+
actionAndOrderIdMessageHash(action, params = {}) {
|
|
223897
|
+
const orderId = this.safeString(params, 'orderId');
|
|
223898
|
+
if (orderId === undefined) {
|
|
223899
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError(this.id + ' privateUpdateOrderMessageHash requires a orderId parameter');
|
|
223900
|
+
}
|
|
223901
|
+
return action + orderId;
|
|
223902
|
+
}
|
|
222816
223903
|
handleOrder(client, message) {
|
|
222817
223904
|
//
|
|
222818
223905
|
// {
|
|
@@ -222946,6 +224033,31 @@ class bitvavo extends _bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
222946
224033
|
}
|
|
222947
224034
|
}
|
|
222948
224035
|
}
|
|
224036
|
+
handleErrorMessage(client, message) {
|
|
224037
|
+
//
|
|
224038
|
+
// {
|
|
224039
|
+
// action: 'privateCreateOrder',
|
|
224040
|
+
// market: 'BTC-EUR',
|
|
224041
|
+
// errorCode: 217,
|
|
224042
|
+
// error: 'Minimum order size in quote currency is 5 EUR or 0.001 BTC.'
|
|
224043
|
+
// }
|
|
224044
|
+
//
|
|
224045
|
+
const error = this.safeString(message, 'error');
|
|
224046
|
+
const code = this.safeInteger(error, 'errorCode');
|
|
224047
|
+
const action = this.safeString(message, 'action');
|
|
224048
|
+
const messageHash = this.buildMessageHash(action, message);
|
|
224049
|
+
let rejected = false;
|
|
224050
|
+
try {
|
|
224051
|
+
this.handleErrors(code, error, client.url, undefined, undefined, error, message, undefined, undefined);
|
|
224052
|
+
}
|
|
224053
|
+
catch (e) {
|
|
224054
|
+
rejected = true;
|
|
224055
|
+
client.reject(e, messageHash);
|
|
224056
|
+
}
|
|
224057
|
+
if (!rejected) {
|
|
224058
|
+
client.reject(message, messageHash);
|
|
224059
|
+
}
|
|
224060
|
+
}
|
|
222949
224061
|
handleMessage(client, message) {
|
|
222950
224062
|
//
|
|
222951
224063
|
// {
|
|
@@ -222955,7 +224067,6 @@ class bitvavo extends _bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
222955
224067
|
// }
|
|
222956
224068
|
// }
|
|
222957
224069
|
//
|
|
222958
|
-
//
|
|
222959
224070
|
// {
|
|
222960
224071
|
// "event": "book",
|
|
222961
224072
|
// "market": "BTC-EUR",
|
|
@@ -222991,6 +224102,10 @@ class bitvavo extends _bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
222991
224102
|
// "authenticated": true
|
|
222992
224103
|
// }
|
|
222993
224104
|
//
|
|
224105
|
+
const error = this.safeString(message, 'error');
|
|
224106
|
+
if (error !== undefined) {
|
|
224107
|
+
this.handleErrorMessage(client, message);
|
|
224108
|
+
}
|
|
222994
224109
|
const methods = {
|
|
222995
224110
|
'subscribed': this.handleSubscriptionStatus,
|
|
222996
224111
|
'book': this.handleOrderBook,
|
|
@@ -223001,21 +224116,27 @@ class bitvavo extends _bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
223001
224116
|
'authenticate': this.handleAuthenticationMessage,
|
|
223002
224117
|
'order': this.handleOrder,
|
|
223003
224118
|
'fill': this.handleMyTrade,
|
|
223004
|
-
|
|
223005
|
-
|
|
223006
|
-
|
|
223007
|
-
|
|
223008
|
-
|
|
223009
|
-
|
|
223010
|
-
|
|
223011
|
-
|
|
223012
|
-
|
|
223013
|
-
|
|
223014
|
-
|
|
223015
|
-
|
|
223016
|
-
|
|
223017
|
-
|
|
223018
|
-
|
|
224119
|
+
'privateCreateOrder': this.handleSingleOrder,
|
|
224120
|
+
'privateUpdateOrder': this.handleSingleOrder,
|
|
224121
|
+
'privateGetBalance': this.handleFetchBalance,
|
|
224122
|
+
'privateCancelOrders': this.handleMultipleOrders,
|
|
224123
|
+
'privateGetOrders': this.handleMultipleOrders,
|
|
224124
|
+
'privateGetOrder': this.handleSingleOrder,
|
|
224125
|
+
'privateCancelOrder': this.handleSingleOrder,
|
|
224126
|
+
'privateGetOrdersOpen': this.handleMultipleOrders,
|
|
224127
|
+
'privateGetAccount': this.handleTradingFees,
|
|
224128
|
+
'privateGetDepositHistory': this.handleDeposits,
|
|
224129
|
+
'privateGetWithdrawalHistory': this.handleWithdraws,
|
|
224130
|
+
'privateWithdrawAssets': this.handleWithdraw,
|
|
224131
|
+
'privateGetTrades': this.handleMyTrades,
|
|
224132
|
+
'getAssets': this.handleFetchCurrencies,
|
|
224133
|
+
'getCandles': this.handleFetchOHLCV,
|
|
224134
|
+
'getMarkets': this.handleMarkets,
|
|
224135
|
+
};
|
|
224136
|
+
const event = this.safeString2(message, 'event', 'action');
|
|
224137
|
+
const method = this.safeValue(methods, event);
|
|
224138
|
+
if (method !== undefined) {
|
|
224139
|
+
method.call(this, client, message);
|
|
223019
224140
|
}
|
|
223020
224141
|
}
|
|
223021
224142
|
}
|
|
@@ -247194,7 +248315,7 @@ class lbank extends _lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
247194
248315
|
};
|
|
247195
248316
|
const request = this.deepExtend(subscribe, params);
|
|
247196
248317
|
const orderbook = await this.watch(url, messageHash, request, messageHash);
|
|
247197
|
-
return orderbook.limit(
|
|
248318
|
+
return orderbook.limit();
|
|
247198
248319
|
}
|
|
247199
248320
|
async watchOrderBook(symbol, limit = undefined, params = {}) {
|
|
247200
248321
|
/**
|
|
@@ -251242,17 +252363,20 @@ class okx extends _okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
251242
252363
|
/**
|
|
251243
252364
|
* @method
|
|
251244
252365
|
* @name okx#watchOrders
|
|
251245
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-ws-order-channel
|
|
251246
252366
|
* @description watches information on multiple orders made by the user
|
|
251247
|
-
* @
|
|
252367
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-ws-order-channel
|
|
252368
|
+
* @param {string} [symbol] unified market symbol of the market the orders were made in
|
|
251248
252369
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
251249
252370
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
251250
252371
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
251251
252372
|
* @param {bool} [params.stop] true if fetching trigger or conditional orders
|
|
252373
|
+
* @param {string} [params.type] 'spot', 'swap', 'future', 'option', 'ANY', 'SPOT', 'MARGIN', 'SWAP', 'FUTURES' or 'OPTION'
|
|
252374
|
+
* @param {string} [params.marginMode] 'cross' or 'isolated', for automatically setting the type to spot margin
|
|
251252
252375
|
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
251253
252376
|
*/
|
|
251254
252377
|
let type = undefined;
|
|
251255
252378
|
// By default, receive order updates from any instrument type
|
|
252379
|
+
[type, params] = this.handleOptionAndParams(params, 'watchOrders', 'defaultType');
|
|
251256
252380
|
[type, params] = this.handleOptionAndParams(params, 'watchOrders', 'type', 'ANY');
|
|
251257
252381
|
const isStop = this.safeValue2(params, 'stop', 'trigger', false);
|
|
251258
252382
|
params = this.omit(params, ['stop', 'trigger']);
|
|
@@ -251267,7 +252391,14 @@ class okx extends _okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
251267
252391
|
if (type === 'future') {
|
|
251268
252392
|
type = 'futures';
|
|
251269
252393
|
}
|
|
251270
|
-
|
|
252394
|
+
let uppercaseType = type.toUpperCase();
|
|
252395
|
+
let marginMode = undefined;
|
|
252396
|
+
[marginMode, params] = this.handleMarginModeAndParams('watchOrders', params);
|
|
252397
|
+
if (uppercaseType === 'SPOT') {
|
|
252398
|
+
if (marginMode !== undefined) {
|
|
252399
|
+
uppercaseType = 'MARGIN';
|
|
252400
|
+
}
|
|
252401
|
+
}
|
|
251271
252402
|
const request = {
|
|
251272
252403
|
'instType': uppercaseType,
|
|
251273
252404
|
};
|
|
@@ -283217,7 +284348,7 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
283217
284348
|
'fetchClosedOrder': false,
|
|
283218
284349
|
'fetchClosedOrders': false,
|
|
283219
284350
|
'fetchCurrencies': true,
|
|
283220
|
-
'fetchDepositAddress':
|
|
284351
|
+
'fetchDepositAddress': true,
|
|
283221
284352
|
'fetchDeposits': true,
|
|
283222
284353
|
'fetchDepositsWithdrawals': true,
|
|
283223
284354
|
'fetchFundingHistory': true,
|
|
@@ -295450,7 +296581,7 @@ SOFTWARE.
|
|
|
295450
296581
|
|
|
295451
296582
|
//-----------------------------------------------------------------------------
|
|
295452
296583
|
// this is updated by vss.js when building
|
|
295453
|
-
const version = '4.2.
|
|
296584
|
+
const version = '4.2.22';
|
|
295454
296585
|
_src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
|
|
295455
296586
|
//-----------------------------------------------------------------------------
|
|
295456
296587
|
|