ccxt 4.2.36 → 4.2.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +3 -2
- package/README.md +5 -5
- package/dist/ccxt.browser.js +495 -198
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/binance.js +147 -65
- package/dist/cjs/src/bitfinex2.js +122 -122
- package/dist/cjs/src/bitmex.js +22 -3
- package/dist/cjs/src/bybit.js +13 -4
- package/dist/cjs/src/pro/gemini.js +190 -3
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/base/types.d.ts +2 -0
- package/js/src/binance.js +147 -65
- package/js/src/bitfinex2.js +122 -122
- package/js/src/bitmex.js +22 -3
- package/js/src/bybit.js +13 -4
- package/js/src/pro/gemini.d.ts +5 -0
- package/js/src/pro/gemini.js +191 -4
- package/package.json +2 -2
package/dist/ccxt.browser.js
CHANGED
|
@@ -23004,7 +23004,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
23004
23004
|
// "msg": "Quantity greater than max quantity."
|
|
23005
23005
|
// }
|
|
23006
23006
|
//
|
|
23007
|
-
// createOrder: portfolio margin linear swap and future
|
|
23007
|
+
// createOrder, fetchOpenOrders: portfolio margin linear swap and future
|
|
23008
23008
|
//
|
|
23009
23009
|
// {
|
|
23010
23010
|
// "symbol": "BTCUSDT",
|
|
@@ -23027,7 +23027,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
23027
23027
|
// "status": "NEW"
|
|
23028
23028
|
// }
|
|
23029
23029
|
//
|
|
23030
|
-
// createOrder: portfolio margin inverse swap and future
|
|
23030
|
+
// createOrder, fetchOpenOrders: portfolio margin inverse swap and future
|
|
23031
23031
|
//
|
|
23032
23032
|
// {
|
|
23033
23033
|
// "symbol": "ETHUSD_PERP",
|
|
@@ -23049,7 +23049,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
23049
23049
|
// "status": "NEW"
|
|
23050
23050
|
// }
|
|
23051
23051
|
//
|
|
23052
|
-
// createOrder: portfolio margin linear swap and future conditional
|
|
23052
|
+
// createOrder, fetchOpenOrders: portfolio margin linear swap and future conditional
|
|
23053
23053
|
//
|
|
23054
23054
|
// {
|
|
23055
23055
|
// "newClientStrategyId": "x-xcKtGhcu27f109953d6e4dc0974006",
|
|
@@ -23072,7 +23072,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
23072
23072
|
// "selfTradePreventionMode": "NONE"
|
|
23073
23073
|
// }
|
|
23074
23074
|
//
|
|
23075
|
-
// createOrder: portfolio margin inverse swap and future conditional
|
|
23075
|
+
// createOrder, fetchOpenOrders: portfolio margin inverse swap and future conditional
|
|
23076
23076
|
//
|
|
23077
23077
|
// {
|
|
23078
23078
|
// "newClientStrategyId": "x-xcKtGhcuc6b86f053bb34933850739",
|
|
@@ -23093,7 +23093,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
23093
23093
|
// "priceProtect": false
|
|
23094
23094
|
// }
|
|
23095
23095
|
//
|
|
23096
|
-
// createOrder: portfolio margin spot margin
|
|
23096
|
+
// createOrder, cancelAllOrders: portfolio margin spot margin
|
|
23097
23097
|
//
|
|
23098
23098
|
// {
|
|
23099
23099
|
// "clientOrderId": "x-R4BD3S82e9ef29d8346440f0b28b86",
|
|
@@ -23112,6 +23112,31 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
23112
23112
|
// "type": "LIMIT"
|
|
23113
23113
|
// }
|
|
23114
23114
|
//
|
|
23115
|
+
// fetchOpenOrders: portfolio margin spot margin
|
|
23116
|
+
//
|
|
23117
|
+
// {
|
|
23118
|
+
// "symbol": "BTCUSDT",
|
|
23119
|
+
// "orderId": 24700763749,
|
|
23120
|
+
// "clientOrderId": "x-R4BD3S826f724c2a4af6425f98c7b6",
|
|
23121
|
+
// "price": "35000.00000000",
|
|
23122
|
+
// "origQty": "0.00100000",
|
|
23123
|
+
// "executedQty": "0.00000000",
|
|
23124
|
+
// "cummulativeQuoteQty": "0.00000000",
|
|
23125
|
+
// "status": "NEW",
|
|
23126
|
+
// "timeInForce": "GTC",
|
|
23127
|
+
// "type": "LIMIT",
|
|
23128
|
+
// "side": "BUY",
|
|
23129
|
+
// "stopPrice": "0.00000000",
|
|
23130
|
+
// "icebergQty": "0.00000000",
|
|
23131
|
+
// "time": 1707199187679,
|
|
23132
|
+
// "updateTime": 1707199187679,
|
|
23133
|
+
// "isWorking": true,
|
|
23134
|
+
// "accountId": 200180970,
|
|
23135
|
+
// "selfTradePreventionMode": "EXPIRE_MAKER",
|
|
23136
|
+
// "preventedMatchId": null,
|
|
23137
|
+
// "preventedQuantity": null
|
|
23138
|
+
// }
|
|
23139
|
+
//
|
|
23115
23140
|
const code = this.safeString(order, 'code');
|
|
23116
23141
|
if (code !== undefined) {
|
|
23117
23142
|
// cancelOrders/createOrders might have a partial success
|
|
@@ -23119,7 +23144,8 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
23119
23144
|
}
|
|
23120
23145
|
const status = this.parseOrderStatus(this.safeString2(order, 'status', 'strategyStatus'));
|
|
23121
23146
|
const marketId = this.safeString(order, 'symbol');
|
|
23122
|
-
const
|
|
23147
|
+
const isContract = ('positionSide' in order) || ('cumQuote' in order);
|
|
23148
|
+
const marketType = isContract ? 'contract' : 'spot';
|
|
23123
23149
|
const symbol = this.safeSymbol(marketId, market, undefined, marketType);
|
|
23124
23150
|
const filled = this.safeString(order, 'executedQty', '0');
|
|
23125
23151
|
const timestamp = this.safeIntegerN(order, ['time', 'createTime', 'workingTime', 'transactTime', 'updateTime']); // order of the keys matters here
|
|
@@ -23426,21 +23452,6 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
23426
23452
|
}
|
|
23427
23453
|
}
|
|
23428
23454
|
}
|
|
23429
|
-
if (!isPortfolioMargin) {
|
|
23430
|
-
const postOnly = this.isPostOnly(isMarketOrder, initialUppercaseType === 'LIMIT_MAKER', params);
|
|
23431
|
-
if (market['spot'] || marketType === 'margin') {
|
|
23432
|
-
// only supported for spot/margin api (all margin markets are spot markets)
|
|
23433
|
-
if (postOnly) {
|
|
23434
|
-
type = 'LIMIT_MAKER';
|
|
23435
|
-
}
|
|
23436
|
-
if (marginMode === 'isolated') {
|
|
23437
|
-
request['isIsolated'] = true;
|
|
23438
|
-
}
|
|
23439
|
-
}
|
|
23440
|
-
if (market['contract'] && postOnly) {
|
|
23441
|
-
request['timeInForce'] = 'GTX';
|
|
23442
|
-
}
|
|
23443
|
-
}
|
|
23444
23455
|
const triggerPrice = this.safeString2(params, 'triggerPrice', 'stopPrice');
|
|
23445
23456
|
const stopLossPrice = this.safeString(params, 'stopLossPrice', triggerPrice); // fallback to stopLoss
|
|
23446
23457
|
const takeProfitPrice = this.safeString(params, 'takeProfitPrice');
|
|
@@ -23517,6 +23528,19 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
23517
23528
|
else {
|
|
23518
23529
|
request[clientOrderIdRequest] = clientOrderId;
|
|
23519
23530
|
}
|
|
23531
|
+
let postOnly = undefined;
|
|
23532
|
+
if (!isPortfolioMargin) {
|
|
23533
|
+
postOnly = this.isPostOnly(isMarketOrder, initialUppercaseType === 'LIMIT_MAKER', params);
|
|
23534
|
+
if (market['spot'] || marketType === 'margin') {
|
|
23535
|
+
// only supported for spot/margin api (all margin markets are spot markets)
|
|
23536
|
+
if (postOnly) {
|
|
23537
|
+
uppercaseType = 'LIMIT_MAKER';
|
|
23538
|
+
}
|
|
23539
|
+
if (marginMode === 'isolated') {
|
|
23540
|
+
request['isIsolated'] = true;
|
|
23541
|
+
}
|
|
23542
|
+
}
|
|
23543
|
+
}
|
|
23520
23544
|
const typeRequest = isPortfolioMarginConditional ? 'strategyType' : 'type';
|
|
23521
23545
|
request[typeRequest] = uppercaseType;
|
|
23522
23546
|
// additional required fields depending on the order type
|
|
@@ -23626,9 +23650,6 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
23626
23650
|
}
|
|
23627
23651
|
request['price'] = this.priceToPrecision(symbol, price);
|
|
23628
23652
|
}
|
|
23629
|
-
if (timeInForceIsRequired) {
|
|
23630
|
-
request['timeInForce'] = this.options['defaultTimeInForce']; // 'GTC' = Good To Cancel (default), 'IOC' = Immediate Or Cancel
|
|
23631
|
-
}
|
|
23632
23653
|
if (stopPriceIsRequired) {
|
|
23633
23654
|
if (market['contract']) {
|
|
23634
23655
|
if (stopPrice === undefined) {
|
|
@@ -23645,20 +23666,11 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
23645
23666
|
request['stopPrice'] = this.priceToPrecision(symbol, stopPrice);
|
|
23646
23667
|
}
|
|
23647
23668
|
}
|
|
23648
|
-
if (
|
|
23649
|
-
|
|
23650
|
-
|
|
23651
|
-
|
|
23652
|
-
|
|
23653
|
-
type = 'LIMIT_MAKER';
|
|
23654
|
-
}
|
|
23655
|
-
if (marginMode === 'isolated') {
|
|
23656
|
-
request['isIsolated'] = true;
|
|
23657
|
-
}
|
|
23658
|
-
}
|
|
23659
|
-
if (market['contract'] && postOnly) {
|
|
23660
|
-
request['timeInForce'] = 'GTX';
|
|
23661
|
-
}
|
|
23669
|
+
if (timeInForceIsRequired && (this.safeString(params, 'timeInForce') === undefined)) {
|
|
23670
|
+
request['timeInForce'] = this.options['defaultTimeInForce']; // 'GTC' = Good To Cancel (default), 'IOC' = Immediate Or Cancel
|
|
23671
|
+
}
|
|
23672
|
+
if (!isPortfolioMargin && market['contract'] && postOnly) {
|
|
23673
|
+
request['timeInForce'] = 'GTX';
|
|
23662
23674
|
}
|
|
23663
23675
|
// remove timeInForce from params because PO is only used by this.isPostOnly and it's not a valid value for Binance
|
|
23664
23676
|
if (this.safeString(params, 'timeInForce') === 'PO') {
|
|
@@ -23930,21 +23942,28 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
23930
23942
|
/**
|
|
23931
23943
|
* @method
|
|
23932
23944
|
* @name binance#fetchOpenOrders
|
|
23945
|
+
* @description fetch all unfilled currently open orders
|
|
23933
23946
|
* @see https://binance-docs.github.io/apidocs/spot/en/#cancel-an-existing-order-and-send-a-new-order-trade
|
|
23934
23947
|
* @see https://binance-docs.github.io/apidocs/futures/en/#current-all-open-orders-user_data
|
|
23935
23948
|
* @see https://binance-docs.github.io/apidocs/delivery/en/#current-all-open-orders-user_data
|
|
23936
23949
|
* @see https://binance-docs.github.io/apidocs/voptions/en/#query-current-open-option-orders-user_data
|
|
23937
|
-
* @description fetch all unfilled currently open orders
|
|
23938
23950
|
* @see https://binance-docs.github.io/apidocs/spot/en/#current-open-orders-user_data
|
|
23939
23951
|
* @see https://binance-docs.github.io/apidocs/futures/en/#current-all-open-orders-user_data
|
|
23940
23952
|
* @see https://binance-docs.github.io/apidocs/delivery/en/#current-all-open-orders-user_data
|
|
23941
23953
|
* @see https://binance-docs.github.io/apidocs/voptions/en/#query-current-open-option-orders-user_data
|
|
23942
23954
|
* @see https://binance-docs.github.io/apidocs/spot/en/#query-margin-account-39-s-open-orders-user_data
|
|
23955
|
+
* @see https://binance-docs.github.io/apidocs/pm/en/#query-all-current-um-open-orders-user_data
|
|
23956
|
+
* @see https://binance-docs.github.io/apidocs/pm/en/#query-all-current-cm-open-orders-user_data
|
|
23957
|
+
* @see https://binance-docs.github.io/apidocs/pm/en/#query-all-current-um-open-conditional-orders-user_data
|
|
23958
|
+
* @see https://binance-docs.github.io/apidocs/pm/en/#query-all-current-cm-open-conditional-orders-user_data
|
|
23959
|
+
* @see https://binance-docs.github.io/apidocs/pm/en/#query-current-margin-open-order-user_data
|
|
23943
23960
|
* @param {string} symbol unified market symbol
|
|
23944
23961
|
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
23945
23962
|
* @param {int} [limit] the maximum number of open orders structures to retrieve
|
|
23946
23963
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
23947
23964
|
* @param {string} [params.marginMode] 'cross' or 'isolated', for spot margin trading
|
|
23965
|
+
* @param {boolean} [params.portfolioMargin] set to true if you would like to fetch open orders in the portfolio margin account
|
|
23966
|
+
* @param {boolean} [params.stop] set to true if you would like to fetch portfolio margin account conditional orders
|
|
23948
23967
|
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
23949
23968
|
*/
|
|
23950
23969
|
await this.loadMarkets();
|
|
@@ -23952,14 +23971,16 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
23952
23971
|
let type = undefined;
|
|
23953
23972
|
const request = {};
|
|
23954
23973
|
let marginMode = undefined;
|
|
23955
|
-
|
|
23956
|
-
|
|
23974
|
+
[marginMode, params] = this.handleMarginModeAndParams('fetchOpenOrders', params);
|
|
23975
|
+
let isPortfolioMargin = undefined;
|
|
23976
|
+
[isPortfolioMargin, params] = this.handleOptionAndParams2(params, 'fetchOpenOrders', 'papi', 'portfolioMargin', false);
|
|
23977
|
+
const isConditional = this.safeBool2(params, 'stop', 'conditional');
|
|
23957
23978
|
if (symbol !== undefined) {
|
|
23958
23979
|
market = this.market(symbol);
|
|
23959
23980
|
request['symbol'] = market['id'];
|
|
23960
23981
|
const defaultType = this.safeString2(this.options, 'fetchOpenOrders', 'defaultType', 'spot');
|
|
23961
23982
|
const marketType = ('type' in market) ? market['type'] : defaultType;
|
|
23962
|
-
type = this.safeString(
|
|
23983
|
+
type = this.safeString(params, 'type', marketType);
|
|
23963
23984
|
}
|
|
23964
23985
|
else if (this.options['warnOnFetchOpenOrdersWithoutSymbol']) {
|
|
23965
23986
|
const symbols = this.symbols;
|
|
@@ -23969,11 +23990,11 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
23969
23990
|
}
|
|
23970
23991
|
else {
|
|
23971
23992
|
const defaultType = this.safeString2(this.options, 'fetchOpenOrders', 'defaultType', 'spot');
|
|
23972
|
-
type = this.safeString(
|
|
23993
|
+
type = this.safeString(params, 'type', defaultType);
|
|
23973
23994
|
}
|
|
23974
23995
|
let subType = undefined;
|
|
23975
|
-
[subType,
|
|
23976
|
-
|
|
23996
|
+
[subType, params] = this.handleSubTypeAndParams('fetchOpenOrders', market, params);
|
|
23997
|
+
params = this.omit(params, ['type', 'stop', 'conditional']);
|
|
23977
23998
|
let response = undefined;
|
|
23978
23999
|
if (type === 'option') {
|
|
23979
24000
|
if (since !== undefined) {
|
|
@@ -23982,25 +24003,50 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
23982
24003
|
if (limit !== undefined) {
|
|
23983
24004
|
request['limit'] = limit;
|
|
23984
24005
|
}
|
|
23985
|
-
response = await this.eapiPrivateGetOpenOrders(this.extend(request,
|
|
24006
|
+
response = await this.eapiPrivateGetOpenOrders(this.extend(request, params));
|
|
23986
24007
|
}
|
|
23987
24008
|
else if (this.isLinear(type, subType)) {
|
|
23988
|
-
|
|
24009
|
+
if (isPortfolioMargin) {
|
|
24010
|
+
if (isConditional) {
|
|
24011
|
+
response = await this.papiGetUmConditionalOpenOrders(this.extend(request, params));
|
|
24012
|
+
}
|
|
24013
|
+
else {
|
|
24014
|
+
response = await this.papiGetUmOpenOrders(this.extend(request, params));
|
|
24015
|
+
}
|
|
24016
|
+
}
|
|
24017
|
+
else {
|
|
24018
|
+
response = await this.fapiPrivateGetOpenOrders(this.extend(request, params));
|
|
24019
|
+
}
|
|
23989
24020
|
}
|
|
23990
24021
|
else if (this.isInverse(type, subType)) {
|
|
23991
|
-
|
|
24022
|
+
if (isPortfolioMargin) {
|
|
24023
|
+
if (isConditional) {
|
|
24024
|
+
response = await this.papiGetCmConditionalOpenOrders(this.extend(request, params));
|
|
24025
|
+
}
|
|
24026
|
+
else {
|
|
24027
|
+
response = await this.papiGetCmOpenOrders(this.extend(request, params));
|
|
24028
|
+
}
|
|
24029
|
+
}
|
|
24030
|
+
else {
|
|
24031
|
+
response = await this.dapiPrivateGetOpenOrders(this.extend(request, params));
|
|
24032
|
+
}
|
|
23992
24033
|
}
|
|
23993
24034
|
else if (type === 'margin' || marginMode !== undefined) {
|
|
23994
|
-
if (
|
|
23995
|
-
|
|
23996
|
-
|
|
23997
|
-
|
|
24035
|
+
if (isPortfolioMargin) {
|
|
24036
|
+
response = await this.papiGetMarginOpenOrders(this.extend(request, params));
|
|
24037
|
+
}
|
|
24038
|
+
else {
|
|
24039
|
+
if (marginMode === 'isolated') {
|
|
24040
|
+
request['isIsolated'] = true;
|
|
24041
|
+
if (symbol === undefined) {
|
|
24042
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' fetchOpenOrders() requires a symbol argument for isolated markets');
|
|
24043
|
+
}
|
|
23998
24044
|
}
|
|
24045
|
+
response = await this.sapiGetMarginOpenOrders(this.extend(request, params));
|
|
23999
24046
|
}
|
|
24000
|
-
response = await this.sapiGetMarginOpenOrders(this.extend(request, requestParams));
|
|
24001
24047
|
}
|
|
24002
24048
|
else {
|
|
24003
|
-
response = await this.privateGetOpenOrders(this.extend(request,
|
|
24049
|
+
response = await this.privateGetOpenOrders(this.extend(request, params));
|
|
24004
24050
|
}
|
|
24005
24051
|
return this.parseOrders(response, market, since, limit);
|
|
24006
24052
|
}
|
|
@@ -24118,46 +24164,82 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
24118
24164
|
/**
|
|
24119
24165
|
* @method
|
|
24120
24166
|
* @name binance#cancelAllOrders
|
|
24167
|
+
* @description cancel all open orders in a market
|
|
24121
24168
|
* @see https://binance-docs.github.io/apidocs/spot/en/#cancel-all-open-orders-on-a-symbol-trade
|
|
24122
24169
|
* @see https://binance-docs.github.io/apidocs/futures/en/#cancel-all-open-orders-trade
|
|
24123
24170
|
* @see https://binance-docs.github.io/apidocs/delivery/en/#cancel-all-open-orders-trade
|
|
24124
24171
|
* @see https://binance-docs.github.io/apidocs/voptions/en/#cancel-all-option-orders-on-specific-symbol-trade
|
|
24125
24172
|
* @see https://binance-docs.github.io/apidocs/spot/en/#margin-account-cancel-order-trade
|
|
24126
|
-
* @
|
|
24173
|
+
* @see https://binance-docs.github.io/apidocs/pm/en/#cancel-all-um-open-orders-trade
|
|
24174
|
+
* @see https://binance-docs.github.io/apidocs/pm/en/#cancel-all-cm-open-orders-trade
|
|
24175
|
+
* @see https://binance-docs.github.io/apidocs/pm/en/#cancel-all-um-open-conditional-orders-trade
|
|
24176
|
+
* @see https://binance-docs.github.io/apidocs/pm/en/#cancel-all-cm-open-conditional-orders-trade
|
|
24177
|
+
* @see https://binance-docs.github.io/apidocs/pm/en/#cancel-margin-account-all-open-orders-on-a-symbol-trade
|
|
24127
24178
|
* @param {string} symbol unified market symbol of the market to cancel orders in
|
|
24128
24179
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
24129
24180
|
* @param {string} [params.marginMode] 'cross' or 'isolated', for spot margin trading
|
|
24181
|
+
* @param {boolean} [params.portfolioMargin] set to true if you would like to cancel orders in a portfolio margin account
|
|
24182
|
+
* @param {boolean} [params.stop] set to true if you would like to cancel portfolio margin account conditional orders
|
|
24130
24183
|
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
24131
24184
|
*/
|
|
24132
24185
|
if (symbol === undefined) {
|
|
24133
|
-
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + '
|
|
24186
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' cancelAllOrders() requires a symbol argument');
|
|
24134
24187
|
}
|
|
24135
24188
|
await this.loadMarkets();
|
|
24136
24189
|
const market = this.market(symbol);
|
|
24137
24190
|
const request = {
|
|
24138
24191
|
'symbol': market['id'],
|
|
24139
24192
|
};
|
|
24193
|
+
let isPortfolioMargin = undefined;
|
|
24194
|
+
[isPortfolioMargin, params] = this.handleOptionAndParams2(params, 'cancelAllOrders', 'papi', 'portfolioMargin', false);
|
|
24195
|
+
const isConditional = this.safeBool2(params, 'stop', 'conditional');
|
|
24140
24196
|
const type = this.safeString(params, 'type', market['type']);
|
|
24141
|
-
params = this.omit(params, ['type']);
|
|
24142
|
-
|
|
24197
|
+
params = this.omit(params, ['type', 'stop', 'conditional']);
|
|
24198
|
+
let marginMode = undefined;
|
|
24199
|
+
[marginMode, params] = this.handleMarginModeAndParams('cancelAllOrders', params);
|
|
24143
24200
|
let response = undefined;
|
|
24144
24201
|
if (market['option']) {
|
|
24145
|
-
response = await this.eapiPrivateDeleteAllOpenOrders(this.extend(request,
|
|
24202
|
+
response = await this.eapiPrivateDeleteAllOpenOrders(this.extend(request, params));
|
|
24146
24203
|
}
|
|
24147
24204
|
else if (market['linear']) {
|
|
24148
|
-
|
|
24205
|
+
if (isPortfolioMargin) {
|
|
24206
|
+
if (isConditional) {
|
|
24207
|
+
response = await this.papiDeleteUmConditionalAllOpenOrders(this.extend(request, params));
|
|
24208
|
+
}
|
|
24209
|
+
else {
|
|
24210
|
+
response = await this.papiDeleteUmAllOpenOrders(this.extend(request, params));
|
|
24211
|
+
}
|
|
24212
|
+
}
|
|
24213
|
+
else {
|
|
24214
|
+
response = await this.fapiPrivateDeleteAllOpenOrders(this.extend(request, params));
|
|
24215
|
+
}
|
|
24149
24216
|
}
|
|
24150
24217
|
else if (market['inverse']) {
|
|
24151
|
-
|
|
24218
|
+
if (isPortfolioMargin) {
|
|
24219
|
+
if (isConditional) {
|
|
24220
|
+
response = await this.papiDeleteCmConditionalAllOpenOrders(this.extend(request, params));
|
|
24221
|
+
}
|
|
24222
|
+
else {
|
|
24223
|
+
response = await this.papiDeleteCmAllOpenOrders(this.extend(request, params));
|
|
24224
|
+
}
|
|
24225
|
+
}
|
|
24226
|
+
else {
|
|
24227
|
+
response = await this.dapiPrivateDeleteAllOpenOrders(this.extend(request, params));
|
|
24228
|
+
}
|
|
24152
24229
|
}
|
|
24153
24230
|
else if ((type === 'margin') || (marginMode !== undefined)) {
|
|
24154
|
-
if (
|
|
24155
|
-
|
|
24231
|
+
if (isPortfolioMargin) {
|
|
24232
|
+
response = await this.papiDeleteMarginAllOpenOrders(this.extend(request, params));
|
|
24233
|
+
}
|
|
24234
|
+
else {
|
|
24235
|
+
if (marginMode === 'isolated') {
|
|
24236
|
+
request['isIsolated'] = true;
|
|
24237
|
+
}
|
|
24238
|
+
response = await this.sapiDeleteMarginOpenOrders(this.extend(request, params));
|
|
24156
24239
|
}
|
|
24157
|
-
response = await this.sapiDeleteMarginOpenOrders(this.extend(request, query));
|
|
24158
24240
|
}
|
|
24159
24241
|
else {
|
|
24160
|
-
response = await this.privateDeleteOpenOrders(this.extend(request,
|
|
24242
|
+
response = await this.privateDeleteOpenOrders(this.extend(request, params));
|
|
24161
24243
|
}
|
|
24162
24244
|
if (Array.isArray(response)) {
|
|
24163
24245
|
return this.parseOrders(response, market);
|
|
@@ -38072,149 +38154,149 @@ class bitfinex2 extends _abstract_bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
38072
38154
|
'api': {
|
|
38073
38155
|
'public': {
|
|
38074
38156
|
'get': {
|
|
38075
|
-
'conf/{config}': 2.
|
|
38076
|
-
'conf/pub:{action}:{object}': 2.
|
|
38077
|
-
'conf/pub:{action}:{object}:{detail}': 2.
|
|
38078
|
-
'conf/pub:map:{object}': 2.
|
|
38079
|
-
'conf/pub:map:{object}:{detail}': 2.
|
|
38080
|
-
'conf/pub:map:currency:{detail}': 2.
|
|
38081
|
-
'conf/pub:map:currency:sym': 2.
|
|
38082
|
-
'conf/pub:map:currency:label': 2.
|
|
38083
|
-
'conf/pub:map:currency:unit': 2.
|
|
38084
|
-
'conf/pub:map:currency:undl': 2.
|
|
38085
|
-
'conf/pub:map:currency:pool': 2.
|
|
38086
|
-
'conf/pub:map:currency:explorer': 2.
|
|
38087
|
-
'conf/pub:map:currency:tx:fee': 2.
|
|
38088
|
-
'conf/pub:map:tx:method': 2.
|
|
38089
|
-
'conf/pub:list:{object}': 2.
|
|
38090
|
-
'conf/pub:list:{object}:{detail}': 2.
|
|
38091
|
-
'conf/pub:list:currency': 2.
|
|
38092
|
-
'conf/pub:list:pair:exchange': 2.
|
|
38093
|
-
'conf/pub:list:pair:margin': 2.
|
|
38094
|
-
'conf/pub:list:pair:futures': 2.
|
|
38095
|
-
'conf/pub:list:competitions': 2.
|
|
38096
|
-
'conf/pub:info:{object}': 2.
|
|
38097
|
-
'conf/pub:info:{object}:{detail}': 2.
|
|
38098
|
-
'conf/pub:info:pair': 2.
|
|
38099
|
-
'conf/pub:info:pair:futures': 2.
|
|
38100
|
-
'conf/pub:info:tx:status': 2.
|
|
38101
|
-
'conf/pub:fees': 2.
|
|
38157
|
+
'conf/{config}': 2.7,
|
|
38158
|
+
'conf/pub:{action}:{object}': 2.7,
|
|
38159
|
+
'conf/pub:{action}:{object}:{detail}': 2.7,
|
|
38160
|
+
'conf/pub:map:{object}': 2.7,
|
|
38161
|
+
'conf/pub:map:{object}:{detail}': 2.7,
|
|
38162
|
+
'conf/pub:map:currency:{detail}': 2.7,
|
|
38163
|
+
'conf/pub:map:currency:sym': 2.7,
|
|
38164
|
+
'conf/pub:map:currency:label': 2.7,
|
|
38165
|
+
'conf/pub:map:currency:unit': 2.7,
|
|
38166
|
+
'conf/pub:map:currency:undl': 2.7,
|
|
38167
|
+
'conf/pub:map:currency:pool': 2.7,
|
|
38168
|
+
'conf/pub:map:currency:explorer': 2.7,
|
|
38169
|
+
'conf/pub:map:currency:tx:fee': 2.7,
|
|
38170
|
+
'conf/pub:map:tx:method': 2.7,
|
|
38171
|
+
'conf/pub:list:{object}': 2.7,
|
|
38172
|
+
'conf/pub:list:{object}:{detail}': 2.7,
|
|
38173
|
+
'conf/pub:list:currency': 2.7,
|
|
38174
|
+
'conf/pub:list:pair:exchange': 2.7,
|
|
38175
|
+
'conf/pub:list:pair:margin': 2.7,
|
|
38176
|
+
'conf/pub:list:pair:futures': 2.7,
|
|
38177
|
+
'conf/pub:list:competitions': 2.7,
|
|
38178
|
+
'conf/pub:info:{object}': 2.7,
|
|
38179
|
+
'conf/pub:info:{object}:{detail}': 2.7,
|
|
38180
|
+
'conf/pub:info:pair': 2.7,
|
|
38181
|
+
'conf/pub:info:pair:futures': 2.7,
|
|
38182
|
+
'conf/pub:info:tx:status': 2.7,
|
|
38183
|
+
'conf/pub:fees': 2.7,
|
|
38102
38184
|
'platform/status': 8,
|
|
38103
|
-
'tickers': 2.
|
|
38104
|
-
'ticker/{symbol}': 2.
|
|
38105
|
-
'tickers/hist': 2.
|
|
38106
|
-
'trades/{symbol}/hist': 2.
|
|
38185
|
+
'tickers': 2.7,
|
|
38186
|
+
'ticker/{symbol}': 2.7,
|
|
38187
|
+
'tickers/hist': 2.7,
|
|
38188
|
+
'trades/{symbol}/hist': 2.7,
|
|
38107
38189
|
'book/{symbol}/{precision}': 1,
|
|
38108
38190
|
'book/{symbol}/P0': 1,
|
|
38109
38191
|
'book/{symbol}/P1': 1,
|
|
38110
38192
|
'book/{symbol}/P2': 1,
|
|
38111
38193
|
'book/{symbol}/P3': 1,
|
|
38112
38194
|
'book/{symbol}/R0': 1,
|
|
38113
|
-
'stats1/{key}:{size}:{symbol}:{side}/{section}': 2.
|
|
38114
|
-
'stats1/{key}:{size}:{symbol}:{side}/last': 2.
|
|
38115
|
-
'stats1/{key}:{size}:{symbol}:{side}/hist': 2.
|
|
38116
|
-
'stats1/{key}:{size}:{symbol}/{section}': 2.
|
|
38117
|
-
'stats1/{key}:{size}:{symbol}/last': 2.
|
|
38118
|
-
'stats1/{key}:{size}:{symbol}/hist': 2.
|
|
38119
|
-
'stats1/{key}:{size}:{symbol}:long/last': 2.
|
|
38120
|
-
'stats1/{key}:{size}:{symbol}:long/hist': 2.
|
|
38121
|
-
'stats1/{key}:{size}:{symbol}:short/last': 2.
|
|
38122
|
-
'stats1/{key}:{size}:{symbol}:short/hist': 2.
|
|
38123
|
-
'candles/trade:{timeframe}:{symbol}:{period}/{section}': 2.
|
|
38124
|
-
'candles/trade:{timeframe}:{symbol}/{section}': 2.
|
|
38125
|
-
'candles/trade:{timeframe}:{symbol}/last': 2.
|
|
38126
|
-
'candles/trade:{timeframe}:{symbol}/hist': 2.
|
|
38127
|
-
'status/{type}': 2.
|
|
38128
|
-
'status/deriv': 2.
|
|
38129
|
-
'status/deriv/{symbol}/hist': 2.
|
|
38195
|
+
'stats1/{key}:{size}:{symbol}:{side}/{section}': 2.7,
|
|
38196
|
+
'stats1/{key}:{size}:{symbol}:{side}/last': 2.7,
|
|
38197
|
+
'stats1/{key}:{size}:{symbol}:{side}/hist': 2.7,
|
|
38198
|
+
'stats1/{key}:{size}:{symbol}/{section}': 2.7,
|
|
38199
|
+
'stats1/{key}:{size}:{symbol}/last': 2.7,
|
|
38200
|
+
'stats1/{key}:{size}:{symbol}/hist': 2.7,
|
|
38201
|
+
'stats1/{key}:{size}:{symbol}:long/last': 2.7,
|
|
38202
|
+
'stats1/{key}:{size}:{symbol}:long/hist': 2.7,
|
|
38203
|
+
'stats1/{key}:{size}:{symbol}:short/last': 2.7,
|
|
38204
|
+
'stats1/{key}:{size}:{symbol}:short/hist': 2.7,
|
|
38205
|
+
'candles/trade:{timeframe}:{symbol}:{period}/{section}': 2.7,
|
|
38206
|
+
'candles/trade:{timeframe}:{symbol}/{section}': 2.7,
|
|
38207
|
+
'candles/trade:{timeframe}:{symbol}/last': 2.7,
|
|
38208
|
+
'candles/trade:{timeframe}:{symbol}/hist': 2.7,
|
|
38209
|
+
'status/{type}': 2.7,
|
|
38210
|
+
'status/deriv': 2.7,
|
|
38211
|
+
'status/deriv/{symbol}/hist': 2.7,
|
|
38130
38212
|
'liquidations/hist': 80,
|
|
38131
|
-
'rankings/{key}:{timeframe}:{symbol}/{section}': 2.
|
|
38132
|
-
'rankings/{key}:{timeframe}:{symbol}/hist': 2.
|
|
38133
|
-
'pulse/hist': 2.
|
|
38134
|
-
'pulse/profile/{nickname}': 2.
|
|
38213
|
+
'rankings/{key}:{timeframe}:{symbol}/{section}': 2.7,
|
|
38214
|
+
'rankings/{key}:{timeframe}:{symbol}/hist': 2.7,
|
|
38215
|
+
'pulse/hist': 2.7,
|
|
38216
|
+
'pulse/profile/{nickname}': 2.7,
|
|
38135
38217
|
'funding/stats/{symbol}/hist': 10, // ratelimit not in docs
|
|
38136
38218
|
},
|
|
38137
38219
|
'post': {
|
|
38138
|
-
'calc/trade/avg': 2.
|
|
38139
|
-
'calc/fx': 2.
|
|
38220
|
+
'calc/trade/avg': 2.7,
|
|
38221
|
+
'calc/fx': 2.7,
|
|
38140
38222
|
},
|
|
38141
38223
|
},
|
|
38142
38224
|
'private': {
|
|
38143
38225
|
'post': {
|
|
38144
38226
|
// 'auth/r/orders/{symbol}/new', // outdated
|
|
38145
38227
|
// 'auth/r/stats/perf:{timeframe}/hist', // outdated
|
|
38146
|
-
'auth/r/wallets': 2.
|
|
38147
|
-
'auth/r/wallets/hist': 2.
|
|
38148
|
-
'auth/r/orders': 2.
|
|
38149
|
-
'auth/r/orders/{symbol}': 2.
|
|
38150
|
-
'auth/w/order/submit': 2.
|
|
38151
|
-
'auth/w/order/update': 2.
|
|
38152
|
-
'auth/w/order/cancel': 2.
|
|
38153
|
-
'auth/w/order/multi': 2.
|
|
38154
|
-
'auth/w/order/cancel/multi': 2.
|
|
38155
|
-
'auth/r/orders/{symbol}/hist': 2.
|
|
38156
|
-
'auth/r/orders/hist': 2.
|
|
38157
|
-
'auth/r/order/{symbol}:{id}/trades': 2.
|
|
38158
|
-
'auth/r/trades/{symbol}/hist': 2.
|
|
38159
|
-
'auth/r/trades/hist': 2.
|
|
38160
|
-
'auth/r/ledgers/{currency}/hist': 2.
|
|
38161
|
-
'auth/r/ledgers/hist': 2.
|
|
38162
|
-
'auth/r/info/margin/{key}': 2.
|
|
38163
|
-
'auth/r/info/margin/base': 2.
|
|
38164
|
-
'auth/r/info/margin/sym_all': 2.
|
|
38165
|
-
'auth/r/positions': 2.
|
|
38166
|
-
'auth/w/position/claim': 2.
|
|
38167
|
-
'auth/w/position/increase:': 2.
|
|
38168
|
-
'auth/r/position/increase/info': 2.
|
|
38169
|
-
'auth/r/positions/hist': 2.
|
|
38170
|
-
'auth/r/positions/audit': 2.
|
|
38171
|
-
'auth/r/positions/snap': 2.
|
|
38172
|
-
'auth/w/deriv/collateral/set': 2.
|
|
38173
|
-
'auth/w/deriv/collateral/limits': 2.
|
|
38174
|
-
'auth/r/funding/offers': 2.
|
|
38175
|
-
'auth/r/funding/offers/{symbol}': 2.
|
|
38176
|
-
'auth/w/funding/offer/submit': 2.
|
|
38177
|
-
'auth/w/funding/offer/cancel': 2.
|
|
38178
|
-
'auth/w/funding/offer/cancel/all': 2.
|
|
38179
|
-
'auth/w/funding/close': 2.
|
|
38180
|
-
'auth/w/funding/auto': 2.
|
|
38181
|
-
'auth/w/funding/keep': 2.
|
|
38182
|
-
'auth/r/funding/offers/{symbol}/hist': 2.
|
|
38183
|
-
'auth/r/funding/offers/hist': 2.
|
|
38184
|
-
'auth/r/funding/loans': 2.
|
|
38185
|
-
'auth/r/funding/loans/hist': 2.
|
|
38186
|
-
'auth/r/funding/loans/{symbol}': 2.
|
|
38187
|
-
'auth/r/funding/loans/{symbol}/hist': 2.
|
|
38188
|
-
'auth/r/funding/credits': 2.
|
|
38189
|
-
'auth/r/funding/credits/hist': 2.
|
|
38190
|
-
'auth/r/funding/credits/{symbol}': 2.
|
|
38191
|
-
'auth/r/funding/credits/{symbol}/hist': 2.
|
|
38192
|
-
'auth/r/funding/trades/{symbol}/hist': 2.
|
|
38193
|
-
'auth/r/funding/trades/hist': 2.
|
|
38194
|
-
'auth/r/info/funding/{key}': 2.
|
|
38195
|
-
'auth/r/info/user': 2.
|
|
38196
|
-
'auth/r/summary': 2.
|
|
38197
|
-
'auth/r/logins/hist': 2.
|
|
38198
|
-
'auth/r/permissions': 2.
|
|
38199
|
-
'auth/w/token': 2.
|
|
38200
|
-
'auth/r/audit/hist': 2.
|
|
38201
|
-
'auth/w/transfer': 2.
|
|
38228
|
+
'auth/r/wallets': 2.7,
|
|
38229
|
+
'auth/r/wallets/hist': 2.7,
|
|
38230
|
+
'auth/r/orders': 2.7,
|
|
38231
|
+
'auth/r/orders/{symbol}': 2.7,
|
|
38232
|
+
'auth/w/order/submit': 2.7,
|
|
38233
|
+
'auth/w/order/update': 2.7,
|
|
38234
|
+
'auth/w/order/cancel': 2.7,
|
|
38235
|
+
'auth/w/order/multi': 2.7,
|
|
38236
|
+
'auth/w/order/cancel/multi': 2.7,
|
|
38237
|
+
'auth/r/orders/{symbol}/hist': 2.7,
|
|
38238
|
+
'auth/r/orders/hist': 2.7,
|
|
38239
|
+
'auth/r/order/{symbol}:{id}/trades': 2.7,
|
|
38240
|
+
'auth/r/trades/{symbol}/hist': 2.7,
|
|
38241
|
+
'auth/r/trades/hist': 2.7,
|
|
38242
|
+
'auth/r/ledgers/{currency}/hist': 2.7,
|
|
38243
|
+
'auth/r/ledgers/hist': 2.7,
|
|
38244
|
+
'auth/r/info/margin/{key}': 2.7,
|
|
38245
|
+
'auth/r/info/margin/base': 2.7,
|
|
38246
|
+
'auth/r/info/margin/sym_all': 2.7,
|
|
38247
|
+
'auth/r/positions': 2.7,
|
|
38248
|
+
'auth/w/position/claim': 2.7,
|
|
38249
|
+
'auth/w/position/increase:': 2.7,
|
|
38250
|
+
'auth/r/position/increase/info': 2.7,
|
|
38251
|
+
'auth/r/positions/hist': 2.7,
|
|
38252
|
+
'auth/r/positions/audit': 2.7,
|
|
38253
|
+
'auth/r/positions/snap': 2.7,
|
|
38254
|
+
'auth/w/deriv/collateral/set': 2.7,
|
|
38255
|
+
'auth/w/deriv/collateral/limits': 2.7,
|
|
38256
|
+
'auth/r/funding/offers': 2.7,
|
|
38257
|
+
'auth/r/funding/offers/{symbol}': 2.7,
|
|
38258
|
+
'auth/w/funding/offer/submit': 2.7,
|
|
38259
|
+
'auth/w/funding/offer/cancel': 2.7,
|
|
38260
|
+
'auth/w/funding/offer/cancel/all': 2.7,
|
|
38261
|
+
'auth/w/funding/close': 2.7,
|
|
38262
|
+
'auth/w/funding/auto': 2.7,
|
|
38263
|
+
'auth/w/funding/keep': 2.7,
|
|
38264
|
+
'auth/r/funding/offers/{symbol}/hist': 2.7,
|
|
38265
|
+
'auth/r/funding/offers/hist': 2.7,
|
|
38266
|
+
'auth/r/funding/loans': 2.7,
|
|
38267
|
+
'auth/r/funding/loans/hist': 2.7,
|
|
38268
|
+
'auth/r/funding/loans/{symbol}': 2.7,
|
|
38269
|
+
'auth/r/funding/loans/{symbol}/hist': 2.7,
|
|
38270
|
+
'auth/r/funding/credits': 2.7,
|
|
38271
|
+
'auth/r/funding/credits/hist': 2.7,
|
|
38272
|
+
'auth/r/funding/credits/{symbol}': 2.7,
|
|
38273
|
+
'auth/r/funding/credits/{symbol}/hist': 2.7,
|
|
38274
|
+
'auth/r/funding/trades/{symbol}/hist': 2.7,
|
|
38275
|
+
'auth/r/funding/trades/hist': 2.7,
|
|
38276
|
+
'auth/r/info/funding/{key}': 2.7,
|
|
38277
|
+
'auth/r/info/user': 2.7,
|
|
38278
|
+
'auth/r/summary': 2.7,
|
|
38279
|
+
'auth/r/logins/hist': 2.7,
|
|
38280
|
+
'auth/r/permissions': 2.7,
|
|
38281
|
+
'auth/w/token': 2.7,
|
|
38282
|
+
'auth/r/audit/hist': 2.7,
|
|
38283
|
+
'auth/w/transfer': 2.7,
|
|
38202
38284
|
'auth/w/deposit/address': 24,
|
|
38203
38285
|
'auth/w/deposit/invoice': 24,
|
|
38204
38286
|
'auth/w/withdraw': 24,
|
|
38205
|
-
'auth/r/movements/{currency}/hist': 2.
|
|
38206
|
-
'auth/r/movements/hist': 2.
|
|
38207
|
-
'auth/r/alerts': 5.
|
|
38208
|
-
'auth/w/alert/set': 2.
|
|
38209
|
-
'auth/w/alert/price:{symbol}:{price}/del': 2.
|
|
38210
|
-
'auth/w/alert/{type}:{symbol}:{price}/del': 2.
|
|
38211
|
-
'auth/calc/order/avail': 2.
|
|
38212
|
-
'auth/w/settings/set': 2.
|
|
38213
|
-
'auth/r/settings': 2.
|
|
38214
|
-
'auth/w/settings/del': 2.
|
|
38215
|
-
'auth/r/pulse/hist': 2.
|
|
38287
|
+
'auth/r/movements/{currency}/hist': 2.7,
|
|
38288
|
+
'auth/r/movements/hist': 2.7,
|
|
38289
|
+
'auth/r/alerts': 5.34,
|
|
38290
|
+
'auth/w/alert/set': 2.7,
|
|
38291
|
+
'auth/w/alert/price:{symbol}:{price}/del': 2.7,
|
|
38292
|
+
'auth/w/alert/{type}:{symbol}:{price}/del': 2.7,
|
|
38293
|
+
'auth/calc/order/avail': 2.7,
|
|
38294
|
+
'auth/w/settings/set': 2.7,
|
|
38295
|
+
'auth/r/settings': 2.7,
|
|
38296
|
+
'auth/w/settings/del': 2.7,
|
|
38297
|
+
'auth/r/pulse/hist': 2.7,
|
|
38216
38298
|
'auth/w/pulse/add': 16,
|
|
38217
|
-
'auth/w/pulse/del': 2.
|
|
38299
|
+
'auth/w/pulse/del': 2.7,
|
|
38218
38300
|
},
|
|
38219
38301
|
},
|
|
38220
38302
|
},
|
|
@@ -57768,6 +57850,7 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
57768
57850
|
* @method
|
|
57769
57851
|
* @name bitmex#fetchCurrencies
|
|
57770
57852
|
* @description fetches all available currencies on an exchange
|
|
57853
|
+
* @see https://www.bitmex.com/api/explorer/#!/Wallet/Wallet_getAssetsConfig
|
|
57771
57854
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
57772
57855
|
* @returns {object} an associative dictionary of currencies
|
|
57773
57856
|
*/
|
|
@@ -58253,6 +58336,7 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
58253
58336
|
* @method
|
|
58254
58337
|
* @name bitmex#fetchBalance
|
|
58255
58338
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
58339
|
+
* @see https://www.bitmex.com/api/explorer/#!/User/User_getMargin
|
|
58256
58340
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
58257
58341
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
58258
58342
|
*/
|
|
@@ -58315,6 +58399,7 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
58315
58399
|
* @method
|
|
58316
58400
|
* @name bitmex#fetchOrderBook
|
|
58317
58401
|
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
58402
|
+
* @see https://www.bitmex.com/api/explorer/#!/OrderBook/OrderBook_getL2
|
|
58318
58403
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
58319
58404
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
58320
58405
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -58358,6 +58443,7 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
58358
58443
|
* @method
|
|
58359
58444
|
* @name bitmex#fetchOrder
|
|
58360
58445
|
* @description fetches information on an order made by the user
|
|
58446
|
+
* @see https://www.bitmex.com/api/explorer/#!/Order/Order_getOrders
|
|
58361
58447
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
58362
58448
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
58363
58449
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
@@ -58426,6 +58512,7 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
58426
58512
|
* @method
|
|
58427
58513
|
* @name bitmex#fetchOpenOrders
|
|
58428
58514
|
* @description fetch all unfilled currently open orders
|
|
58515
|
+
* @see https://www.bitmex.com/api/explorer/#!/Order/Order_getOrders
|
|
58429
58516
|
* @param {string} symbol unified market symbol
|
|
58430
58517
|
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
58431
58518
|
* @param {int} [limit] the maximum number of open orders structures to retrieve
|
|
@@ -58444,6 +58531,7 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
58444
58531
|
* @method
|
|
58445
58532
|
* @name bitmex#fetchClosedOrders
|
|
58446
58533
|
* @description fetches information on multiple closed orders made by the user
|
|
58534
|
+
* @see https://www.bitmex.com/api/explorer/#!/Order/Order_getOrders
|
|
58447
58535
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
58448
58536
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
58449
58537
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
@@ -58458,8 +58546,8 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
58458
58546
|
/**
|
|
58459
58547
|
* @method
|
|
58460
58548
|
* @name bitmex#fetchMyTrades
|
|
58461
|
-
* @see https://www.bitmex.com/api/explorer/#!/Execution/Execution_getTradeHistory
|
|
58462
58549
|
* @description fetch all trades made by the user
|
|
58550
|
+
* @see https://www.bitmex.com/api/explorer/#!/Execution/Execution_getTradeHistory
|
|
58463
58551
|
* @param {string} symbol unified market symbol
|
|
58464
58552
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
58465
58553
|
* @param {int} [limit] the maximum number of trades structures to retrieve
|
|
@@ -58668,6 +58756,7 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
58668
58756
|
* @method
|
|
58669
58757
|
* @name bitmex#fetchLedger
|
|
58670
58758
|
* @description fetch the history of changes, actions done by the user or operations that altered balance of the user
|
|
58759
|
+
* @see https://www.bitmex.com/api/explorer/#!/User/User_getWalletHistory
|
|
58671
58760
|
* @param {string} code unified currency code, default is undefined
|
|
58672
58761
|
* @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
|
|
58673
58762
|
* @param {int} [limit] max number of ledger entrys to return, default is undefined
|
|
@@ -58719,6 +58808,7 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
58719
58808
|
* @method
|
|
58720
58809
|
* @name bitmex#fetchDepositsWithdrawals
|
|
58721
58810
|
* @description fetch history of deposits and withdrawals
|
|
58811
|
+
* @see https://www.bitmex.com/api/explorer/#!/User/User_getWalletHistory
|
|
58722
58812
|
* @param {string} [code] unified currency code for the currency of the deposit/withdrawals, default is undefined
|
|
58723
58813
|
* @param {int} [since] timestamp in ms of the earliest deposit/withdrawal, default is undefined
|
|
58724
58814
|
* @param {int} [limit] max number of deposit/withdrawals to return, default is undefined
|
|
@@ -58837,6 +58927,7 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
58837
58927
|
* @method
|
|
58838
58928
|
* @name bitmex#fetchTicker
|
|
58839
58929
|
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
58930
|
+
* @see https://www.bitmex.com/api/explorer/#!/Instrument/Instrument_get
|
|
58840
58931
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
58841
58932
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
58842
58933
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -58858,6 +58949,7 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
58858
58949
|
* @method
|
|
58859
58950
|
* @name bitmex#fetchTickers
|
|
58860
58951
|
* @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
|
58952
|
+
* @see https://www.bitmex.com/api/explorer/#!/Instrument/Instrument_getActiveAndIndices
|
|
58861
58953
|
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
58862
58954
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
58863
58955
|
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -58940,8 +59032,8 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
58940
59032
|
/**
|
|
58941
59033
|
* @method
|
|
58942
59034
|
* @name bitmex#fetchOHLCV
|
|
58943
|
-
* @see https://www.bitmex.com/api/explorer/#!/Trade/Trade_getBucketed
|
|
58944
59035
|
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
59036
|
+
* @see https://www.bitmex.com/api/explorer/#!/Trade/Trade_getBucketed
|
|
58945
59037
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
58946
59038
|
* @param {string} timeframe the length of time each candle represents
|
|
58947
59039
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
@@ -59256,8 +59348,8 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
59256
59348
|
/**
|
|
59257
59349
|
* @method
|
|
59258
59350
|
* @name bitmex#fetchTrades
|
|
59259
|
-
* @see https://www.bitmex.com/api/explorer/#!/Trade/Trade_get
|
|
59260
59351
|
* @description get the list of most recent trades for a particular symbol
|
|
59352
|
+
* @see https://www.bitmex.com/api/explorer/#!/Trade/Trade_get
|
|
59261
59353
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
59262
59354
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
59263
59355
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
@@ -59478,6 +59570,7 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
59478
59570
|
* @method
|
|
59479
59571
|
* @name bitmex#cancelOrder
|
|
59480
59572
|
* @description cancels an open order
|
|
59573
|
+
* @see https://www.bitmex.com/api/explorer/#!/Order/Order_cancel
|
|
59481
59574
|
* @param {string} id order id
|
|
59482
59575
|
* @param {string} symbol not used by bitmex cancelOrder ()
|
|
59483
59576
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -59509,6 +59602,7 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
59509
59602
|
* @method
|
|
59510
59603
|
* @name bitmex#cancelOrders
|
|
59511
59604
|
* @description cancel multiple orders
|
|
59605
|
+
* @see https://www.bitmex.com/api/explorer/#!/Order/Order_cancel
|
|
59512
59606
|
* @param {string[]} ids order ids
|
|
59513
59607
|
* @param {string} symbol not used by bitmex cancelOrders ()
|
|
59514
59608
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -59534,6 +59628,7 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
59534
59628
|
* @method
|
|
59535
59629
|
* @name bitmex#cancelAllOrders
|
|
59536
59630
|
* @description cancel all open orders
|
|
59631
|
+
* @see https://www.bitmex.com/api/explorer/#!/Order/Order_cancelAll
|
|
59537
59632
|
* @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
|
|
59538
59633
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
59539
59634
|
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
@@ -59592,6 +59687,7 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
59592
59687
|
* @method
|
|
59593
59688
|
* @name bitmex#fetchPositions
|
|
59594
59689
|
* @description fetch all open positions
|
|
59690
|
+
* @see https://www.bitmex.com/api/explorer/#!/Position/Position_get
|
|
59595
59691
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
59596
59692
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
59597
59693
|
* @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
@@ -59850,6 +59946,7 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
59850
59946
|
* @method
|
|
59851
59947
|
* @name bitmex#withdraw
|
|
59852
59948
|
* @description make a withdrawal
|
|
59949
|
+
* @see https://www.bitmex.com/api/explorer/#!/User/User_requestWithdrawal
|
|
59853
59950
|
* @param {string} code unified currency code
|
|
59854
59951
|
* @param {float} amount the amount to withdraw
|
|
59855
59952
|
* @param {string} address the address to withdraw to
|
|
@@ -59897,6 +59994,7 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
59897
59994
|
* @method
|
|
59898
59995
|
* @name bitmex#fetchFundingRates
|
|
59899
59996
|
* @description fetch the funding rate for multiple markets
|
|
59997
|
+
* @see https://www.bitmex.com/api/explorer/#!/Instrument/Instrument_getActiveAndIndices
|
|
59900
59998
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
59901
59999
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
59902
60000
|
* @returns {object} a dictionary of [funding rates structures]{@link https://docs.ccxt.com/#/?id=funding-rates-structure}, indexe by market symbols
|
|
@@ -59948,6 +60046,7 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
59948
60046
|
* @method
|
|
59949
60047
|
* @name bitmex#fetchFundingRateHistory
|
|
59950
60048
|
* @description Fetches the history of funding rates
|
|
60049
|
+
* @see https://www.bitmex.com/api/explorer/#!/Funding/Funding_get
|
|
59951
60050
|
* @param {string} symbol unified symbol of the market to fetch the funding rate history for
|
|
59952
60051
|
* @param {int} [since] timestamp in ms of the earliest funding rate to fetch
|
|
59953
60052
|
* @param {int} [limit] the maximum amount of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-history-structure} to fetch
|
|
@@ -60031,6 +60130,7 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
60031
60130
|
* @method
|
|
60032
60131
|
* @name bitmex#setLeverage
|
|
60033
60132
|
* @description set the level of leverage for a market
|
|
60133
|
+
* @see https://www.bitmex.com/api/explorer/#!/Position/Position_updateLeverage
|
|
60034
60134
|
* @param {float} leverage the rate of leverage
|
|
60035
60135
|
* @param {string} symbol unified market symbol
|
|
60036
60136
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -60058,6 +60158,7 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
60058
60158
|
* @method
|
|
60059
60159
|
* @name bitmex#setMarginMode
|
|
60060
60160
|
* @description set margin mode to 'cross' or 'isolated'
|
|
60161
|
+
* @see https://www.bitmex.com/api/explorer/#!/Position/Position_isolateMargin
|
|
60061
60162
|
* @param {string} marginMode 'cross' or 'isolated'
|
|
60062
60163
|
* @param {string} symbol unified market symbol
|
|
60063
60164
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -82830,10 +82931,22 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
82830
82931
|
if (isStopLoss) {
|
|
82831
82932
|
const slTriggerPrice = this.safeValue2(stopLoss, 'triggerPrice', 'stopPrice', stopLoss);
|
|
82832
82933
|
request['stopLoss'] = this.priceToPrecision(symbol, slTriggerPrice);
|
|
82934
|
+
const slLimitPrice = this.safeValue(stopLoss, 'price');
|
|
82935
|
+
if (slLimitPrice !== undefined) {
|
|
82936
|
+
request['tpslMode'] = 'Partial';
|
|
82937
|
+
request['slOrderType'] = 'Limit';
|
|
82938
|
+
request['slLimitPrice'] = this.priceToPrecision(symbol, slLimitPrice);
|
|
82939
|
+
}
|
|
82833
82940
|
}
|
|
82834
82941
|
if (isTakeProfit) {
|
|
82835
82942
|
const tpTriggerPrice = this.safeValue2(takeProfit, 'triggerPrice', 'stopPrice', takeProfit);
|
|
82836
82943
|
request['takeProfit'] = this.priceToPrecision(symbol, tpTriggerPrice);
|
|
82944
|
+
const tpLimitPrice = this.safeValue(takeProfit, 'price');
|
|
82945
|
+
if (tpLimitPrice !== undefined) {
|
|
82946
|
+
request['tpslMode'] = 'Partial';
|
|
82947
|
+
request['tpOrderType'] = 'Limit';
|
|
82948
|
+
request['tpLimitPrice'] = this.priceToPrecision(symbol, tpLimitPrice);
|
|
82949
|
+
}
|
|
82837
82950
|
}
|
|
82838
82951
|
}
|
|
82839
82952
|
if (market['spot']) {
|
|
@@ -85115,9 +85228,6 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
85115
85228
|
if (timestamp === undefined) {
|
|
85116
85229
|
timestamp = this.safeIntegerN(position, ['updatedTime', 'updatedAt']);
|
|
85117
85230
|
}
|
|
85118
|
-
// default to cross of USDC margined positions
|
|
85119
|
-
const tradeMode = this.safeInteger(position, 'tradeMode', 0);
|
|
85120
|
-
const marginMode = tradeMode ? 'isolated' : 'cross';
|
|
85121
85231
|
let collateralString = this.safeString(position, 'positionBalance');
|
|
85122
85232
|
const entryPrice = this.omitZero(this.safeString2(position, 'entryPrice', 'avgPrice'));
|
|
85123
85233
|
const liquidationPrice = this.omitZero(this.safeString(position, 'liqPrice'));
|
|
@@ -85181,7 +85291,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
85181
85291
|
'markPrice': this.safeNumber(position, 'markPrice'),
|
|
85182
85292
|
'lastPrice': undefined,
|
|
85183
85293
|
'collateral': this.parseNumber(collateralString),
|
|
85184
|
-
'marginMode':
|
|
85294
|
+
'marginMode': undefined,
|
|
85185
85295
|
'side': side,
|
|
85186
85296
|
'percentage': undefined,
|
|
85187
85297
|
'stopLossPrice': this.safeNumber2(position, 'stop_loss', 'stopLoss'),
|
|
@@ -240618,9 +240728,11 @@ class gemini extends _gemini_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
240618
240728
|
'watchTicker': false,
|
|
240619
240729
|
'watchTickers': false,
|
|
240620
240730
|
'watchTrades': true,
|
|
240731
|
+
'watchTradesForSymbols': true,
|
|
240621
240732
|
'watchMyTrades': false,
|
|
240622
240733
|
'watchOrders': true,
|
|
240623
240734
|
'watchOrderBook': true,
|
|
240735
|
+
'watchOrderBookForSymbols': true,
|
|
240624
240736
|
'watchOHLCV': true,
|
|
240625
240737
|
},
|
|
240626
240738
|
'hostname': 'api.gemini.com',
|
|
@@ -240669,7 +240781,29 @@ class gemini extends _gemini_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
240669
240781
|
}
|
|
240670
240782
|
return this.filterBySinceLimit(trades, since, limit, 'timestamp', true);
|
|
240671
240783
|
}
|
|
240784
|
+
async watchTradesForSymbols(symbols, since = undefined, limit = undefined, params = {}) {
|
|
240785
|
+
/**
|
|
240786
|
+
* @method
|
|
240787
|
+
* @name gemini#watchTradesForSymbols
|
|
240788
|
+
* @see https://docs.gemini.com/websocket-api/#multi-market-data
|
|
240789
|
+
* @description get the list of most recent trades for a list of symbols
|
|
240790
|
+
* @param {string[]} symbols unified symbol of the market to fetch trades for
|
|
240791
|
+
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
240792
|
+
* @param {int} [limit] the maximum amount of trades to fetch
|
|
240793
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
240794
|
+
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
240795
|
+
*/
|
|
240796
|
+
const trades = await this.helperForWatchMultipleConstruct('trades', symbols, params);
|
|
240797
|
+
if (this.newUpdates) {
|
|
240798
|
+
const first = this.safeList(trades, 0);
|
|
240799
|
+
const tradeSymbol = this.safeString(first, 'symbol');
|
|
240800
|
+
limit = trades.getLimit(tradeSymbol, limit);
|
|
240801
|
+
}
|
|
240802
|
+
return this.filterBySinceLimit(trades, since, limit, 'timestamp', true);
|
|
240803
|
+
}
|
|
240672
240804
|
parseWsTrade(trade, market = undefined) {
|
|
240805
|
+
//
|
|
240806
|
+
// regular v2 trade
|
|
240673
240807
|
//
|
|
240674
240808
|
// {
|
|
240675
240809
|
// "type": "trade",
|
|
@@ -240681,11 +240815,31 @@ class gemini extends _gemini_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
240681
240815
|
// "side": "buy"
|
|
240682
240816
|
// }
|
|
240683
240817
|
//
|
|
240818
|
+
// multi data trade
|
|
240819
|
+
//
|
|
240820
|
+
// {
|
|
240821
|
+
// "type": "trade",
|
|
240822
|
+
// "symbol": "ETHUSD",
|
|
240823
|
+
// "tid": "1683002242170204", // this is not TS, but somewhat ID
|
|
240824
|
+
// "price": "2299.24",
|
|
240825
|
+
// "amount": "0.002662",
|
|
240826
|
+
// "makerSide": "bid"
|
|
240827
|
+
// }
|
|
240828
|
+
//
|
|
240684
240829
|
const timestamp = this.safeInteger(trade, 'timestamp');
|
|
240685
|
-
const id = this.
|
|
240830
|
+
const id = this.safeString2(trade, 'event_id', 'tid');
|
|
240686
240831
|
const priceString = this.safeString(trade, 'price');
|
|
240687
|
-
const amountString = this.
|
|
240688
|
-
|
|
240832
|
+
const amountString = this.safeString2(trade, 'quantity', 'amount');
|
|
240833
|
+
let side = this.safeStringLower(trade, 'side');
|
|
240834
|
+
if (side === undefined) {
|
|
240835
|
+
const marketSide = this.safeStringLower(trade, 'makerSide');
|
|
240836
|
+
if (marketSide === 'bid') {
|
|
240837
|
+
side = 'sell';
|
|
240838
|
+
}
|
|
240839
|
+
else if (marketSide === 'ask') {
|
|
240840
|
+
side = 'buy';
|
|
240841
|
+
}
|
|
240842
|
+
}
|
|
240689
240843
|
const marketId = this.safeStringLower(trade, 'symbol');
|
|
240690
240844
|
const symbol = this.safeSymbol(marketId, market);
|
|
240691
240845
|
return this.safeTrade({
|
|
@@ -240785,6 +240939,34 @@ class gemini extends _gemini_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
240785
240939
|
client.resolve(stored, messageHash);
|
|
240786
240940
|
}
|
|
240787
240941
|
}
|
|
240942
|
+
handleTradesForMultidata(client, trades, timestamp) {
|
|
240943
|
+
if (trades !== undefined) {
|
|
240944
|
+
const tradesLimit = this.safeInteger(this.options, 'tradesLimit', 1000);
|
|
240945
|
+
const storesForSymbols = {};
|
|
240946
|
+
for (let i = 0; i < trades.length; i++) {
|
|
240947
|
+
const marketId = trades[i]['symbol'];
|
|
240948
|
+
const market = this.safeMarket(marketId.toLowerCase());
|
|
240949
|
+
const symbol = market['symbol'];
|
|
240950
|
+
const trade = this.parseWsTrade(trades[i], market);
|
|
240951
|
+
trade['timestamp'] = timestamp;
|
|
240952
|
+
trade['datetime'] = this.iso8601(timestamp);
|
|
240953
|
+
let stored = this.safeValue(this.trades, symbol);
|
|
240954
|
+
if (stored === undefined) {
|
|
240955
|
+
stored = new _base_ws_Cache_js__WEBPACK_IMPORTED_MODULE_1__/* .ArrayCache */ .ZL(tradesLimit);
|
|
240956
|
+
this.trades[symbol] = stored;
|
|
240957
|
+
}
|
|
240958
|
+
stored.append(trade);
|
|
240959
|
+
storesForSymbols[symbol] = stored;
|
|
240960
|
+
}
|
|
240961
|
+
const symbols = Object.keys(storesForSymbols);
|
|
240962
|
+
for (let i = 0; i < symbols.length; i++) {
|
|
240963
|
+
const symbol = symbols[i];
|
|
240964
|
+
const stored = storesForSymbols[symbol];
|
|
240965
|
+
const messageHash = 'trades:' + symbol;
|
|
240966
|
+
client.resolve(stored, messageHash);
|
|
240967
|
+
}
|
|
240968
|
+
}
|
|
240969
|
+
}
|
|
240788
240970
|
async watchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
|
|
240789
240971
|
/**
|
|
240790
240972
|
* @method
|
|
@@ -240930,6 +241112,93 @@ class gemini extends _gemini_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
240930
241112
|
this.orderbooks[symbol] = orderbook;
|
|
240931
241113
|
client.resolve(orderbook, messageHash);
|
|
240932
241114
|
}
|
|
241115
|
+
async watchOrderBookForSymbols(symbols, limit = undefined, params = {}) {
|
|
241116
|
+
/**
|
|
241117
|
+
* @method
|
|
241118
|
+
* @name gemini#watchOrderBookForSymbols
|
|
241119
|
+
* @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
241120
|
+
* @see https://docs.gemini.com/websocket-api/#multi-market-data
|
|
241121
|
+
* @param {string[]} symbols unified array of symbols
|
|
241122
|
+
* @param {int} [limit] the maximum amount of order book entries to return
|
|
241123
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
241124
|
+
* @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
|
|
241125
|
+
*/
|
|
241126
|
+
const orderbook = await this.helperForWatchMultipleConstruct('orderbook', symbols, params);
|
|
241127
|
+
return orderbook.limit();
|
|
241128
|
+
}
|
|
241129
|
+
async helperForWatchMultipleConstruct(itemHashName, symbols, params = {}) {
|
|
241130
|
+
await this.loadMarkets();
|
|
241131
|
+
symbols = this.marketSymbols(symbols, undefined, false, true, true);
|
|
241132
|
+
const firstMarket = this.market(symbols[0]);
|
|
241133
|
+
if (!firstMarket['spot'] && !firstMarket['linear']) {
|
|
241134
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' watchMultiple supports only spot or linear-swap symbols');
|
|
241135
|
+
}
|
|
241136
|
+
const messageHashes = [];
|
|
241137
|
+
const marketIds = [];
|
|
241138
|
+
for (let i = 0; i < symbols.length; i++) {
|
|
241139
|
+
const symbol = symbols[i];
|
|
241140
|
+
const messageHash = itemHashName + ':' + symbol;
|
|
241141
|
+
messageHashes.push(messageHash);
|
|
241142
|
+
const market = this.market(symbol);
|
|
241143
|
+
marketIds.push(market['id']);
|
|
241144
|
+
}
|
|
241145
|
+
const queryStr = marketIds.join(',');
|
|
241146
|
+
let url = this.urls['api']['ws'] + '/v1/multimarketdata?symbols=' + queryStr + '&heartbeat=true&';
|
|
241147
|
+
if (itemHashName === 'orderbook') {
|
|
241148
|
+
url += 'trades=false&bids=true&offers=true';
|
|
241149
|
+
}
|
|
241150
|
+
else if (itemHashName === 'trades') {
|
|
241151
|
+
url += 'trades=true&bids=false&offers=false';
|
|
241152
|
+
}
|
|
241153
|
+
return await this.watchMultiple(url, messageHashes, undefined);
|
|
241154
|
+
}
|
|
241155
|
+
handleOrderBookForMultidata(client, rawOrderBookChanges, timestamp, nonce) {
|
|
241156
|
+
//
|
|
241157
|
+
// rawOrderBookChanges
|
|
241158
|
+
//
|
|
241159
|
+
// [
|
|
241160
|
+
// {
|
|
241161
|
+
// delta: "4105123935484.817624",
|
|
241162
|
+
// price: "0.000000001",
|
|
241163
|
+
// reason: "initial", // initial|cancel|place
|
|
241164
|
+
// remaining: "4105123935484.817624",
|
|
241165
|
+
// side: "bid", // bid|ask
|
|
241166
|
+
// symbol: "SHIBUSD",
|
|
241167
|
+
// type: "change", // seems always change
|
|
241168
|
+
// },
|
|
241169
|
+
// ...
|
|
241170
|
+
//
|
|
241171
|
+
const marketId = rawOrderBookChanges[0]['symbol'];
|
|
241172
|
+
const market = this.safeMarket(marketId.toLowerCase());
|
|
241173
|
+
const symbol = market['symbol'];
|
|
241174
|
+
const messageHash = 'orderbook:' + symbol;
|
|
241175
|
+
let orderbook = this.safeDict(this.orderbooks, symbol);
|
|
241176
|
+
if (orderbook === undefined) {
|
|
241177
|
+
orderbook = this.orderBook();
|
|
241178
|
+
}
|
|
241179
|
+
const bids = orderbook['bids'];
|
|
241180
|
+
const asks = orderbook['asks'];
|
|
241181
|
+
for (let i = 0; i < rawOrderBookChanges.length; i++) {
|
|
241182
|
+
const entry = rawOrderBookChanges[i];
|
|
241183
|
+
const price = this.safeNumber(entry, 'price');
|
|
241184
|
+
const size = this.safeNumber(entry, 'remaining');
|
|
241185
|
+
const rawSide = this.safeString(entry, 'side');
|
|
241186
|
+
if (rawSide === 'bid') {
|
|
241187
|
+
bids.store(price, size);
|
|
241188
|
+
}
|
|
241189
|
+
else {
|
|
241190
|
+
asks.store(price, size);
|
|
241191
|
+
}
|
|
241192
|
+
}
|
|
241193
|
+
orderbook['bids'] = bids;
|
|
241194
|
+
orderbook['asks'] = asks;
|
|
241195
|
+
orderbook['symbol'] = symbol;
|
|
241196
|
+
orderbook['nonce'] = nonce;
|
|
241197
|
+
orderbook['timestamp'] = timestamp;
|
|
241198
|
+
orderbook['datetime'] = this.iso8601(timestamp);
|
|
241199
|
+
this.orderbooks[symbol] = orderbook;
|
|
241200
|
+
client.resolve(orderbook, messageHash);
|
|
241201
|
+
}
|
|
240933
241202
|
handleL2Updates(client, message) {
|
|
240934
241203
|
//
|
|
240935
241204
|
// {
|
|
@@ -241010,6 +241279,7 @@ class gemini extends _gemini_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
241010
241279
|
// "socket_sequence": 7
|
|
241011
241280
|
// }
|
|
241012
241281
|
//
|
|
241282
|
+
client.lastPong = this.milliseconds();
|
|
241013
241283
|
return message;
|
|
241014
241284
|
}
|
|
241015
241285
|
handleSubscription(client, message) {
|
|
@@ -241212,6 +241482,33 @@ class gemini extends _gemini_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
241212
241482
|
if (method !== undefined) {
|
|
241213
241483
|
method.call(this, client, message);
|
|
241214
241484
|
}
|
|
241485
|
+
// handle multimarketdata
|
|
241486
|
+
if (type === 'update') {
|
|
241487
|
+
const ts = this.safeInteger(message, 'timestampms', this.milliseconds());
|
|
241488
|
+
const eventId = this.safeInteger(message, 'eventId');
|
|
241489
|
+
const events = this.safeList(message, 'events');
|
|
241490
|
+
const orderBookItems = [];
|
|
241491
|
+
const collectedEventsOfTrades = [];
|
|
241492
|
+
for (let i = 0; i < events.length; i++) {
|
|
241493
|
+
const event = events[i];
|
|
241494
|
+
const eventType = this.safeString(event, 'type');
|
|
241495
|
+
const isOrderBook = (eventType === 'change') && ('side' in event) && this.inArray(event['side'], ['ask', 'bid']);
|
|
241496
|
+
if (isOrderBook) {
|
|
241497
|
+
orderBookItems.push(event);
|
|
241498
|
+
}
|
|
241499
|
+
else if (eventType === 'trade') {
|
|
241500
|
+
collectedEventsOfTrades.push(events[i]);
|
|
241501
|
+
}
|
|
241502
|
+
}
|
|
241503
|
+
const lengthOb = orderBookItems.length;
|
|
241504
|
+
if (lengthOb > 0) {
|
|
241505
|
+
this.handleOrderBookForMultidata(client, orderBookItems, ts, eventId);
|
|
241506
|
+
}
|
|
241507
|
+
const lengthTrades = collectedEventsOfTrades.length;
|
|
241508
|
+
if (lengthTrades > 0) {
|
|
241509
|
+
this.handleTradesForMultidata(client, collectedEventsOfTrades, ts);
|
|
241510
|
+
}
|
|
241511
|
+
}
|
|
241215
241512
|
}
|
|
241216
241513
|
async authenticate(params = {}) {
|
|
241217
241514
|
const url = this.safeString(params, 'url');
|
|
@@ -301655,7 +301952,7 @@ SOFTWARE.
|
|
|
301655
301952
|
|
|
301656
301953
|
//-----------------------------------------------------------------------------
|
|
301657
301954
|
// this is updated by vss.js when building
|
|
301658
|
-
const version = '4.2.
|
|
301955
|
+
const version = '4.2.37';
|
|
301659
301956
|
_src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
|
|
301660
301957
|
//-----------------------------------------------------------------------------
|
|
301661
301958
|
|