ccxt 4.2.35 → 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 +880 -329
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +3 -3
- package/dist/cjs/src/base/ws/Client.js +5 -2
- package/dist/cjs/src/binance.js +395 -115
- package/dist/cjs/src/bitfinex.js +21 -0
- package/dist/cjs/src/bitfinex2.js +122 -122
- package/dist/cjs/src/bitget.js +28 -39
- package/dist/cjs/src/bithumb.js +14 -0
- package/dist/cjs/src/bitmex.js +22 -3
- package/dist/cjs/src/bybit.js +13 -4
- package/dist/cjs/src/pro/binance.js +2 -2
- package/dist/cjs/src/pro/gemini.js +190 -3
- package/dist/cjs/src/woo.js +64 -35
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/base/Exchange.d.ts +1 -0
- package/js/src/base/Exchange.js +3 -3
- package/js/src/base/types.d.ts +2 -0
- package/js/src/base/ws/Client.js +5 -2
- package/js/src/binance.js +395 -115
- package/js/src/bitfinex.js +21 -0
- package/js/src/bitfinex2.js +122 -122
- package/js/src/bitget.js +28 -39
- package/js/src/bithumb.js +14 -0
- package/js/src/bitmex.js +22 -3
- package/js/src/bybit.js +13 -4
- package/js/src/pro/binance.js +2 -2
- package/js/src/pro/gemini.d.ts +5 -0
- package/js/src/pro/gemini.js +191 -4
- package/js/src/woo.js +64 -35
- package/package.json +2 -2
package/dist/ccxt.browser.js
CHANGED
|
@@ -8080,9 +8080,9 @@ class Exchange {
|
|
|
8080
8080
|
}
|
|
8081
8081
|
handleMessage(client, message) { } // stub to override
|
|
8082
8082
|
// ping (client) {} // stub to override
|
|
8083
|
-
|
|
8084
|
-
|
|
8085
|
-
|
|
8083
|
+
ping(client) {
|
|
8084
|
+
return undefined;
|
|
8085
|
+
}
|
|
8086
8086
|
client(url) {
|
|
8087
8087
|
this.clients = this.clients || {};
|
|
8088
8088
|
if (!this.clients[url]) {
|
|
@@ -14964,9 +14964,12 @@ class Client {
|
|
|
14964
14964
|
this.onError(new _base_errors_js__WEBPACK_IMPORTED_MODULE_3__.RequestTimeout('Connection to ' + this.url + ' timed out due to a ping-pong keepalive missing on time'));
|
|
14965
14965
|
}
|
|
14966
14966
|
else {
|
|
14967
|
+
let message;
|
|
14967
14968
|
if (this.ping) {
|
|
14968
|
-
this.
|
|
14969
|
-
|
|
14969
|
+
message = this.ping(this);
|
|
14970
|
+
}
|
|
14971
|
+
if (message) {
|
|
14972
|
+
this.send(message).catch((error) => {
|
|
14970
14973
|
this.onError(error);
|
|
14971
14974
|
});
|
|
14972
14975
|
}
|
|
@@ -22688,7 +22691,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
22688
22691
|
}
|
|
22689
22692
|
request['price'] = this.priceToPrecision(symbol, price);
|
|
22690
22693
|
}
|
|
22691
|
-
if (timeInForceIsRequired) {
|
|
22694
|
+
if (timeInForceIsRequired && (this.safeString(params, 'timeInForce') === undefined)) {
|
|
22692
22695
|
request['timeInForce'] = this.options['defaultTimeInForce']; // 'GTC' = Good To Cancel (default), 'IOC' = Immediate Or Cancel
|
|
22693
22696
|
}
|
|
22694
22697
|
if (stopPriceIsRequired) {
|
|
@@ -22993,20 +22996,156 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
22993
22996
|
// "lastTrade": {"id":"69","time":"1676084430567","price":"24.9","qty":"1.00"},
|
|
22994
22997
|
// "mmp": false
|
|
22995
22998
|
// }
|
|
22996
|
-
//
|
|
22999
|
+
//
|
|
22997
23000
|
// cancelOrders/createOrders
|
|
22998
|
-
//
|
|
22999
|
-
//
|
|
23000
|
-
//
|
|
23001
|
+
//
|
|
23002
|
+
// {
|
|
23003
|
+
// "code": -4005,
|
|
23004
|
+
// "msg": "Quantity greater than max quantity."
|
|
23005
|
+
// }
|
|
23006
|
+
//
|
|
23007
|
+
// createOrder, fetchOpenOrders: portfolio margin linear swap and future
|
|
23008
|
+
//
|
|
23009
|
+
// {
|
|
23010
|
+
// "symbol": "BTCUSDT",
|
|
23011
|
+
// "side": "BUY",
|
|
23012
|
+
// "executedQty": "0.000",
|
|
23013
|
+
// "orderId": 258649539704,
|
|
23014
|
+
// "goodTillDate": 0,
|
|
23015
|
+
// "avgPrice": "0",
|
|
23016
|
+
// "origQty": "0.010",
|
|
23017
|
+
// "clientOrderId": "x-xcKtGhcu02573c6f15e544e990057b",
|
|
23018
|
+
// "positionSide": "BOTH",
|
|
23019
|
+
// "cumQty": "0.000",
|
|
23020
|
+
// "updateTime": 1707110415436,
|
|
23021
|
+
// "type": "LIMIT",
|
|
23022
|
+
// "reduceOnly": false,
|
|
23023
|
+
// "price": "35000.00",
|
|
23024
|
+
// "cumQuote": "0.00000",
|
|
23025
|
+
// "selfTradePreventionMode": "NONE",
|
|
23026
|
+
// "timeInForce": "GTC",
|
|
23027
|
+
// "status": "NEW"
|
|
23028
|
+
// }
|
|
23029
|
+
//
|
|
23030
|
+
// createOrder, fetchOpenOrders: portfolio margin inverse swap and future
|
|
23031
|
+
//
|
|
23032
|
+
// {
|
|
23033
|
+
// "symbol": "ETHUSD_PERP",
|
|
23034
|
+
// "side": "BUY",
|
|
23035
|
+
// "cumBase": "0",
|
|
23036
|
+
// "executedQty": "0",
|
|
23037
|
+
// "orderId": 71275227732,
|
|
23038
|
+
// "avgPrice": "0.00",
|
|
23039
|
+
// "origQty": "1",
|
|
23040
|
+
// "clientOrderId": "x-xcKtGhcuca5af3acfb5044198c5398",
|
|
23041
|
+
// "positionSide": "BOTH",
|
|
23042
|
+
// "cumQty": "0",
|
|
23043
|
+
// "updateTime": 1707110994334,
|
|
23044
|
+
// "type": "LIMIT",
|
|
23045
|
+
// "pair": "ETHUSD",
|
|
23046
|
+
// "reduceOnly": false,
|
|
23047
|
+
// "price": "2000",
|
|
23048
|
+
// "timeInForce": "GTC",
|
|
23049
|
+
// "status": "NEW"
|
|
23050
|
+
// }
|
|
23051
|
+
//
|
|
23052
|
+
// createOrder, fetchOpenOrders: portfolio margin linear swap and future conditional
|
|
23053
|
+
//
|
|
23054
|
+
// {
|
|
23055
|
+
// "newClientStrategyId": "x-xcKtGhcu27f109953d6e4dc0974006",
|
|
23056
|
+
// "strategyId": 3645916,
|
|
23057
|
+
// "strategyStatus": "NEW",
|
|
23058
|
+
// "strategyType": "STOP",
|
|
23059
|
+
// "origQty": "0.010",
|
|
23060
|
+
// "price": "35000.00",
|
|
23061
|
+
// "reduceOnly": false,
|
|
23062
|
+
// "side": "BUY",
|
|
23063
|
+
// "positionSide": "BOTH",
|
|
23064
|
+
// "stopPrice": "45000.00",
|
|
23065
|
+
// "symbol": "BTCUSDT",
|
|
23066
|
+
// "timeInForce": "GTC",
|
|
23067
|
+
// "bookTime": 1707112625879,
|
|
23068
|
+
// "updateTime": 1707112625879,
|
|
23069
|
+
// "workingType": "CONTRACT_PRICE",
|
|
23070
|
+
// "priceProtect": false,
|
|
23071
|
+
// "goodTillDate": 0,
|
|
23072
|
+
// "selfTradePreventionMode": "NONE"
|
|
23073
|
+
// }
|
|
23074
|
+
//
|
|
23075
|
+
// createOrder, fetchOpenOrders: portfolio margin inverse swap and future conditional
|
|
23076
|
+
//
|
|
23077
|
+
// {
|
|
23078
|
+
// "newClientStrategyId": "x-xcKtGhcuc6b86f053bb34933850739",
|
|
23079
|
+
// "strategyId": 1423462,
|
|
23080
|
+
// "strategyStatus": "NEW",
|
|
23081
|
+
// "strategyType": "STOP",
|
|
23082
|
+
// "origQty": "1",
|
|
23083
|
+
// "price": "2000",
|
|
23084
|
+
// "reduceOnly": false,
|
|
23085
|
+
// "side": "BUY",
|
|
23086
|
+
// "positionSide": "BOTH",
|
|
23087
|
+
// "stopPrice": "3000",
|
|
23088
|
+
// "symbol": "ETHUSD_PERP",
|
|
23089
|
+
// "timeInForce": "GTC",
|
|
23090
|
+
// "bookTime": 1707113098840,
|
|
23091
|
+
// "updateTime": 1707113098840,
|
|
23092
|
+
// "workingType": "CONTRACT_PRICE",
|
|
23093
|
+
// "priceProtect": false
|
|
23094
|
+
// }
|
|
23095
|
+
//
|
|
23096
|
+
// createOrder, cancelAllOrders: portfolio margin spot margin
|
|
23097
|
+
//
|
|
23098
|
+
// {
|
|
23099
|
+
// "clientOrderId": "x-R4BD3S82e9ef29d8346440f0b28b86",
|
|
23100
|
+
// "cummulativeQuoteQty": "0.00000000",
|
|
23101
|
+
// "executedQty": "0.00000000",
|
|
23102
|
+
// "fills": [],
|
|
23103
|
+
// "orderId": 24684460474,
|
|
23104
|
+
// "origQty": "0.00100000",
|
|
23105
|
+
// "price": "35000.00000000",
|
|
23106
|
+
// "selfTradePreventionMode": "EXPIRE_MAKER",
|
|
23107
|
+
// "side": "BUY",
|
|
23108
|
+
// "status": "NEW",
|
|
23109
|
+
// "symbol": "BTCUSDT",
|
|
23110
|
+
// "timeInForce": "GTC",
|
|
23111
|
+
// "transactTime": 1707113538870,
|
|
23112
|
+
// "type": "LIMIT"
|
|
23113
|
+
// }
|
|
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
|
+
// }
|
|
23001
23139
|
//
|
|
23002
23140
|
const code = this.safeString(order, 'code');
|
|
23003
23141
|
if (code !== undefined) {
|
|
23004
23142
|
// cancelOrders/createOrders might have a partial success
|
|
23005
23143
|
return this.safeOrder({ 'info': order, 'status': 'rejected' }, market);
|
|
23006
23144
|
}
|
|
23007
|
-
const status = this.parseOrderStatus(this.
|
|
23145
|
+
const status = this.parseOrderStatus(this.safeString2(order, 'status', 'strategyStatus'));
|
|
23008
23146
|
const marketId = this.safeString(order, 'symbol');
|
|
23009
|
-
const
|
|
23147
|
+
const isContract = ('positionSide' in order) || ('cumQuote' in order);
|
|
23148
|
+
const marketType = isContract ? 'contract' : 'spot';
|
|
23010
23149
|
const symbol = this.safeSymbol(marketId, market, undefined, marketType);
|
|
23011
23150
|
const filled = this.safeString(order, 'executedQty', '0');
|
|
23012
23151
|
const timestamp = this.safeIntegerN(order, ['time', 'createTime', 'workingTime', 'transactTime', 'updateTime']); // order of the keys matters here
|
|
@@ -23031,11 +23170,9 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
23031
23170
|
// Note this is not the actual cost, since Binance futures uses leverage to calculate margins.
|
|
23032
23171
|
let cost = this.safeString2(order, 'cummulativeQuoteQty', 'cumQuote');
|
|
23033
23172
|
cost = this.safeString(order, 'cumBase', cost);
|
|
23034
|
-
const id = this.safeString(order, 'orderId');
|
|
23035
23173
|
let type = this.safeStringLower(order, 'type');
|
|
23036
23174
|
const side = this.safeStringLower(order, 'side');
|
|
23037
23175
|
const fills = this.safeValue(order, 'fills', []);
|
|
23038
|
-
const clientOrderId = this.safeString(order, 'clientOrderId');
|
|
23039
23176
|
let timeInForce = this.safeString(order, 'timeInForce');
|
|
23040
23177
|
if (timeInForce === 'GTX') {
|
|
23041
23178
|
// GTX means "Good Till Crossing" and is an equivalent way of saying Post Only
|
|
@@ -23058,8 +23195,8 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
23058
23195
|
}
|
|
23059
23196
|
return this.safeOrder({
|
|
23060
23197
|
'info': order,
|
|
23061
|
-
'id':
|
|
23062
|
-
'clientOrderId': clientOrderId,
|
|
23198
|
+
'id': this.safeString2(order, 'orderId', 'strategyId'),
|
|
23199
|
+
'clientOrderId': this.safeString2(order, 'clientOrderId', 'newClientStrategyId'),
|
|
23063
23200
|
'timestamp': timestamp,
|
|
23064
23201
|
'datetime': this.iso8601(timestamp),
|
|
23065
23202
|
'lastTradeTimestamp': lastTradeTimestamp,
|
|
@@ -23173,50 +23310,105 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
23173
23310
|
* @see https://binance-docs.github.io/apidocs/voptions/en/#new-order-trade
|
|
23174
23311
|
* @see https://binance-docs.github.io/apidocs/spot/en/#new-order-using-sor-trade
|
|
23175
23312
|
* @see https://binance-docs.github.io/apidocs/spot/en/#test-new-order-using-sor-trade
|
|
23313
|
+
* @see https://binance-docs.github.io/apidocs/pm/en/#new-um-order-trade
|
|
23314
|
+
* @see https://binance-docs.github.io/apidocs/pm/en/#new-cm-order-trade
|
|
23315
|
+
* @see https://binance-docs.github.io/apidocs/pm/en/#new-margin-order-trade
|
|
23316
|
+
* @see https://binance-docs.github.io/apidocs/pm/en/#new-um-conditional-order-trade
|
|
23317
|
+
* @see https://binance-docs.github.io/apidocs/pm/en/#new-cm-conditional-order-trade
|
|
23176
23318
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
23177
23319
|
* @param {string} type 'market' or 'limit' or 'STOP_LOSS' or 'STOP_LOSS_LIMIT' or 'TAKE_PROFIT' or 'TAKE_PROFIT_LIMIT' or 'STOP'
|
|
23178
23320
|
* @param {string} side 'buy' or 'sell'
|
|
23179
|
-
* @param {float} amount how much of
|
|
23180
|
-
* @param {float} [price] the price
|
|
23321
|
+
* @param {float} amount how much of you want to trade in units of the base currency
|
|
23322
|
+
* @param {float} [price] the price that the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
23181
23323
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
23324
|
+
* @param {string} [params.reduceOnly] for swap and future reduceOnly is a string 'true' or 'false' that cant be sent with close position set to true or in hedge mode. For spot margin and option reduceOnly is a boolean.
|
|
23182
23325
|
* @param {string} [params.marginMode] 'cross' or 'isolated', for spot margin trading
|
|
23183
23326
|
* @param {boolean} [params.sor] *spot only* whether to use SOR (Smart Order Routing) or not, default is false
|
|
23184
23327
|
* @param {boolean} [params.test] *spot only* whether to use the test endpoint or not, default is false
|
|
23185
23328
|
* @param {float} [params.trailingPercent] the percent to trail away from the current market price
|
|
23186
23329
|
* @param {float} [params.trailingTriggerPrice] the price to trigger a trailing order, default uses the price argument
|
|
23330
|
+
* @param {float} [params.triggerPrice] the price that a trigger order is triggered at
|
|
23331
|
+
* @param {float} [params.stopLossPrice] the price that a stop loss order is triggered at
|
|
23332
|
+
* @param {float} [params.takeProfitPrice] the price that a take profit order is triggered at
|
|
23333
|
+
* @param {boolean} [params.portfolioMargin] set to true if you would like to create an order in a portfolio margin account
|
|
23187
23334
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
23188
23335
|
*/
|
|
23189
23336
|
await this.loadMarkets();
|
|
23190
23337
|
const market = this.market(symbol);
|
|
23191
23338
|
const marketType = this.safeString(params, 'type', market['type']);
|
|
23192
|
-
|
|
23193
|
-
|
|
23194
|
-
|
|
23339
|
+
let marginMode = undefined;
|
|
23340
|
+
[marginMode, params] = this.handleMarginModeAndParams('createOrder', params);
|
|
23341
|
+
let isPortfolioMargin = undefined;
|
|
23342
|
+
[isPortfolioMargin, params] = this.handleOptionAndParams2(params, 'createOrder', 'papi', 'portfolioMargin', false);
|
|
23343
|
+
const triggerPrice = this.safeString2(params, 'triggerPrice', 'stopPrice');
|
|
23344
|
+
const stopLossPrice = this.safeString(params, 'stopLossPrice');
|
|
23345
|
+
const takeProfitPrice = this.safeString(params, 'takeProfitPrice');
|
|
23346
|
+
const trailingPercent = this.safeString2(params, 'trailingPercent', 'callbackRate');
|
|
23347
|
+
const isTrailingPercentOrder = trailingPercent !== undefined;
|
|
23348
|
+
const isStopLoss = stopLossPrice !== undefined;
|
|
23349
|
+
const isTakeProfit = takeProfitPrice !== undefined;
|
|
23350
|
+
const isConditional = (triggerPrice !== undefined) || isTrailingPercentOrder || isStopLoss || isTakeProfit;
|
|
23351
|
+
const sor = this.safeBool2(params, 'sor', 'SOR', false);
|
|
23352
|
+
const test = this.safeBool(params, 'test', false);
|
|
23353
|
+
params = this.omit(params, ['sor', 'SOR', 'test']);
|
|
23354
|
+
if (isPortfolioMargin) {
|
|
23355
|
+
params['portfolioMargin'] = isPortfolioMargin;
|
|
23356
|
+
}
|
|
23195
23357
|
const request = this.createOrderRequest(symbol, type, side, amount, price, params);
|
|
23196
|
-
let
|
|
23197
|
-
if (
|
|
23198
|
-
|
|
23358
|
+
let response = undefined;
|
|
23359
|
+
if (market['option']) {
|
|
23360
|
+
response = await this.eapiPrivatePostOrder(request);
|
|
23361
|
+
}
|
|
23362
|
+
else if (sor) {
|
|
23363
|
+
if (test) {
|
|
23364
|
+
response = await this.privatePostSorOrderTest(request);
|
|
23365
|
+
}
|
|
23366
|
+
else {
|
|
23367
|
+
response = await this.privatePostSorOrder(request);
|
|
23368
|
+
}
|
|
23199
23369
|
}
|
|
23200
23370
|
else if (market['linear']) {
|
|
23201
|
-
|
|
23371
|
+
if (isPortfolioMargin) {
|
|
23372
|
+
if (isConditional) {
|
|
23373
|
+
response = await this.papiPostUmConditionalOrder(request);
|
|
23374
|
+
}
|
|
23375
|
+
else {
|
|
23376
|
+
response = await this.papiPostUmOrder(request);
|
|
23377
|
+
}
|
|
23378
|
+
}
|
|
23379
|
+
else {
|
|
23380
|
+
response = await this.fapiPrivatePostOrder(request);
|
|
23381
|
+
}
|
|
23202
23382
|
}
|
|
23203
23383
|
else if (market['inverse']) {
|
|
23204
|
-
|
|
23384
|
+
if (isPortfolioMargin) {
|
|
23385
|
+
if (isConditional) {
|
|
23386
|
+
response = await this.papiPostCmConditionalOrder(request);
|
|
23387
|
+
}
|
|
23388
|
+
else {
|
|
23389
|
+
response = await this.papiPostCmOrder(request);
|
|
23390
|
+
}
|
|
23391
|
+
}
|
|
23392
|
+
else {
|
|
23393
|
+
response = await this.dapiPrivatePostOrder(request);
|
|
23394
|
+
}
|
|
23205
23395
|
}
|
|
23206
23396
|
else if (marketType === 'margin' || marginMode !== undefined) {
|
|
23207
|
-
|
|
23208
|
-
|
|
23209
|
-
|
|
23210
|
-
|
|
23397
|
+
if (isPortfolioMargin) {
|
|
23398
|
+
response = await this.papiPostMarginOrder(request);
|
|
23399
|
+
}
|
|
23400
|
+
else {
|
|
23401
|
+
response = await this.sapiPostMarginOrder(request);
|
|
23402
|
+
}
|
|
23211
23403
|
}
|
|
23212
|
-
|
|
23213
|
-
if (market['spot'] || marketType === 'margin') {
|
|
23214
|
-
const test = this.safeBool(query, 'test', false);
|
|
23404
|
+
else {
|
|
23215
23405
|
if (test) {
|
|
23216
|
-
|
|
23406
|
+
response = await this.privatePostOrderTest(request);
|
|
23407
|
+
}
|
|
23408
|
+
else {
|
|
23409
|
+
response = await this.privatePostOrder(request);
|
|
23217
23410
|
}
|
|
23218
23411
|
}
|
|
23219
|
-
const response = await this[method](request);
|
|
23220
23412
|
return this.parseOrder(response, market);
|
|
23221
23413
|
}
|
|
23222
23414
|
createOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
|
|
@@ -23224,16 +23416,13 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
23224
23416
|
* @method
|
|
23225
23417
|
* @ignore
|
|
23226
23418
|
* @name binance#createOrderRequest
|
|
23227
|
-
* @description helper function to build request
|
|
23419
|
+
* @description helper function to build the request
|
|
23228
23420
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
23229
|
-
* @param {string} type 'market' or 'limit'
|
|
23421
|
+
* @param {string} type 'market' or 'limit'
|
|
23230
23422
|
* @param {string} side 'buy' or 'sell'
|
|
23231
|
-
* @param {float} amount how much
|
|
23232
|
-
* @param {float
|
|
23233
|
-
* @param {object} params extra parameters specific to the exchange API endpoint
|
|
23234
|
-
* @param {string|undefined} params.marginMode 'cross' or 'isolated', for spot margin trading
|
|
23235
|
-
* @param {float} [params.trailingPercent] the percent to trail away from the current market price
|
|
23236
|
-
* @param {float} [params.trailingTriggerPrice] the price to trigger a trailing order, default uses the price argument
|
|
23423
|
+
* @param {float} amount how much you want to trade in units of the base currency
|
|
23424
|
+
* @param {float} [price] the price that the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
23425
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
23237
23426
|
* @returns {object} request to be sent to the exchange
|
|
23238
23427
|
*/
|
|
23239
23428
|
const market = this.market(symbol);
|
|
@@ -23242,35 +23431,39 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
23242
23431
|
const initialUppercaseType = type.toUpperCase();
|
|
23243
23432
|
const isMarketOrder = initialUppercaseType === 'MARKET';
|
|
23244
23433
|
const isLimitOrder = initialUppercaseType === 'LIMIT';
|
|
23245
|
-
const postOnly = this.isPostOnly(isMarketOrder, initialUppercaseType === 'LIMIT_MAKER', params);
|
|
23246
|
-
const triggerPrice = this.safeValue2(params, 'triggerPrice', 'stopPrice');
|
|
23247
|
-
const stopLossPrice = this.safeValue(params, 'stopLossPrice', triggerPrice); // fallback to stopLoss
|
|
23248
|
-
const takeProfitPrice = this.safeValue(params, 'takeProfitPrice');
|
|
23249
|
-
const trailingDelta = this.safeValue(params, 'trailingDelta');
|
|
23250
|
-
const trailingTriggerPrice = this.safeString2(params, 'trailingTriggerPrice', 'activationPrice', this.numberToString(price));
|
|
23251
|
-
const trailingPercent = this.safeString2(params, 'trailingPercent', 'callbackRate');
|
|
23252
|
-
const isTrailingPercentOrder = trailingPercent !== undefined;
|
|
23253
|
-
const isStopLoss = stopLossPrice !== undefined || trailingDelta !== undefined;
|
|
23254
|
-
const isTakeProfit = takeProfitPrice !== undefined;
|
|
23255
|
-
params = this.omit(params, ['type', 'newClientOrderId', 'clientOrderId', 'postOnly', 'stopLossPrice', 'takeProfitPrice', 'stopPrice', 'triggerPrice', 'trailingTriggerPrice', 'trailingPercent']);
|
|
23256
|
-
const [marginMode, query] = this.handleMarginModeAndParams('createOrder', params);
|
|
23257
23434
|
const request = {
|
|
23258
23435
|
'symbol': market['id'],
|
|
23259
23436
|
'side': side.toUpperCase(),
|
|
23260
23437
|
};
|
|
23261
|
-
|
|
23262
|
-
|
|
23263
|
-
|
|
23264
|
-
|
|
23438
|
+
let isPortfolioMargin = undefined;
|
|
23439
|
+
[isPortfolioMargin, params] = this.handleOptionAndParams2(params, 'createOrder', 'papi', 'portfolioMargin', false);
|
|
23440
|
+
let marginMode = undefined;
|
|
23441
|
+
[marginMode, params] = this.handleMarginModeAndParams('createOrder', params);
|
|
23442
|
+
if ((marketType === 'margin') || (marginMode !== undefined) || market['option']) {
|
|
23443
|
+
// for swap and future reduceOnly is a string that cant be sent with close position set to true or in hedge mode
|
|
23444
|
+
const reduceOnly = this.safeBool(params, 'reduceOnly', false);
|
|
23445
|
+
params = this.omit(params, 'reduceOnly');
|
|
23446
|
+
if (market['option']) {
|
|
23447
|
+
request['reduceOnly'] = reduceOnly;
|
|
23265
23448
|
}
|
|
23266
|
-
|
|
23267
|
-
|
|
23268
|
-
|
|
23269
|
-
|
|
23270
|
-
request['sideEffectType'] = 'AUTO_REPAY';
|
|
23271
|
-
params = this.omit(params, 'reduceOnly');
|
|
23449
|
+
else {
|
|
23450
|
+
if (reduceOnly) {
|
|
23451
|
+
request['sideEffectType'] = 'AUTO_REPAY';
|
|
23452
|
+
}
|
|
23272
23453
|
}
|
|
23273
23454
|
}
|
|
23455
|
+
const triggerPrice = this.safeString2(params, 'triggerPrice', 'stopPrice');
|
|
23456
|
+
const stopLossPrice = this.safeString(params, 'stopLossPrice', triggerPrice); // fallback to stopLoss
|
|
23457
|
+
const takeProfitPrice = this.safeString(params, 'takeProfitPrice');
|
|
23458
|
+
const trailingDelta = this.safeString(params, 'trailingDelta');
|
|
23459
|
+
const trailingTriggerPrice = this.safeString2(params, 'trailingTriggerPrice', 'activationPrice', this.numberToString(price));
|
|
23460
|
+
const trailingPercent = this.safeString2(params, 'trailingPercent', 'callbackRate');
|
|
23461
|
+
const isTrailingPercentOrder = trailingPercent !== undefined;
|
|
23462
|
+
const isStopLoss = stopLossPrice !== undefined || trailingDelta !== undefined;
|
|
23463
|
+
const isTakeProfit = takeProfitPrice !== undefined;
|
|
23464
|
+
const isTriggerOrder = triggerPrice !== undefined;
|
|
23465
|
+
const isConditional = isTriggerOrder || isTrailingPercentOrder || isStopLoss || isTakeProfit;
|
|
23466
|
+
const isPortfolioMarginConditional = (isPortfolioMargin && isConditional);
|
|
23274
23467
|
let uppercaseType = type.toUpperCase();
|
|
23275
23468
|
let stopPrice = undefined;
|
|
23276
23469
|
if (isTrailingPercentOrder) {
|
|
@@ -23300,24 +23493,14 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
23300
23493
|
uppercaseType = market['contract'] ? 'TAKE_PROFIT' : 'TAKE_PROFIT_LIMIT';
|
|
23301
23494
|
}
|
|
23302
23495
|
}
|
|
23303
|
-
if (marginMode === 'isolated') {
|
|
23304
|
-
request['isIsolated'] = true;
|
|
23305
|
-
}
|
|
23306
|
-
if (clientOrderId === undefined) {
|
|
23307
|
-
const broker = this.safeValue(this.options, 'broker', {});
|
|
23308
|
-
const defaultId = (market['contract']) ? 'x-xcKtGhcu' : 'x-R4BD3S82';
|
|
23309
|
-
const brokerId = this.safeString(broker, marketType, defaultId);
|
|
23310
|
-
request['newClientOrderId'] = brokerId + this.uuid22();
|
|
23311
|
-
}
|
|
23312
|
-
else {
|
|
23313
|
-
request['newClientOrderId'] = clientOrderId;
|
|
23314
|
-
}
|
|
23315
23496
|
if ((marketType === 'spot') || (marketType === 'margin')) {
|
|
23316
|
-
request['newOrderRespType'] = this.
|
|
23497
|
+
request['newOrderRespType'] = this.safeString(this.options['newOrderRespType'], type, 'RESULT'); // 'ACK' for order id, 'RESULT' for full order or 'FULL' for order with fills
|
|
23317
23498
|
}
|
|
23318
23499
|
else {
|
|
23319
23500
|
// swap, futures and options
|
|
23320
|
-
|
|
23501
|
+
if (!isPortfolioMargin) {
|
|
23502
|
+
request['newOrderRespType'] = 'RESULT'; // "ACK", "RESULT", default "ACK"
|
|
23503
|
+
}
|
|
23321
23504
|
}
|
|
23322
23505
|
if (market['option']) {
|
|
23323
23506
|
if (type === 'market') {
|
|
@@ -23325,7 +23508,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
23325
23508
|
}
|
|
23326
23509
|
}
|
|
23327
23510
|
else {
|
|
23328
|
-
const validOrderTypes = this.
|
|
23511
|
+
const validOrderTypes = this.safeList(market['info'], 'orderTypes');
|
|
23329
23512
|
if (!this.inArray(uppercaseType, validOrderTypes)) {
|
|
23330
23513
|
if (initialUppercaseType !== uppercaseType) {
|
|
23331
23514
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder(this.id + ' stopPrice parameter is not allowed for ' + symbol + ' ' + type + ' orders');
|
|
@@ -23335,7 +23518,31 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
23335
23518
|
}
|
|
23336
23519
|
}
|
|
23337
23520
|
}
|
|
23338
|
-
|
|
23521
|
+
const clientOrderIdRequest = isPortfolioMarginConditional ? 'newClientStrategyId' : 'newClientOrderId';
|
|
23522
|
+
if (clientOrderId === undefined) {
|
|
23523
|
+
const broker = this.safeDict(this.options, 'broker', {});
|
|
23524
|
+
const defaultId = (market['contract']) ? 'x-xcKtGhcu' : 'x-R4BD3S82';
|
|
23525
|
+
const brokerId = this.safeString(broker, marketType, defaultId);
|
|
23526
|
+
request[clientOrderIdRequest] = brokerId + this.uuid22();
|
|
23527
|
+
}
|
|
23528
|
+
else {
|
|
23529
|
+
request[clientOrderIdRequest] = clientOrderId;
|
|
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
|
+
}
|
|
23544
|
+
const typeRequest = isPortfolioMarginConditional ? 'strategyType' : 'type';
|
|
23545
|
+
request[typeRequest] = uppercaseType;
|
|
23339
23546
|
// additional required fields depending on the order type
|
|
23340
23547
|
let timeInForceIsRequired = false;
|
|
23341
23548
|
let priceIsRequired = false;
|
|
@@ -23363,9 +23570,9 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
23363
23570
|
//
|
|
23364
23571
|
if (uppercaseType === 'MARKET') {
|
|
23365
23572
|
if (market['spot']) {
|
|
23366
|
-
const quoteOrderQty = this.
|
|
23573
|
+
const quoteOrderQty = this.safeBool(this.options, 'quoteOrderQty', true);
|
|
23367
23574
|
if (quoteOrderQty) {
|
|
23368
|
-
const quoteOrderQtyNew = this.
|
|
23575
|
+
const quoteOrderQtyNew = this.safeString2(params, 'quoteOrderQty', 'cost');
|
|
23369
23576
|
const precision = market['precision']['price'];
|
|
23370
23577
|
if (quoteOrderQtyNew !== undefined) {
|
|
23371
23578
|
request['quoteOrderQty'] = this.decimalToPrecision(quoteOrderQtyNew, _base_functions_number_js__WEBPACK_IMPORTED_MODULE_1__/* .TRUNCATE */ .tk, precision, this.precisionMode);
|
|
@@ -23416,7 +23623,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
23416
23623
|
priceIsRequired = true;
|
|
23417
23624
|
}
|
|
23418
23625
|
else if ((uppercaseType === 'STOP_MARKET') || (uppercaseType === 'TAKE_PROFIT_MARKET')) {
|
|
23419
|
-
const closePosition = this.
|
|
23626
|
+
const closePosition = this.safeBool(params, 'closePosition');
|
|
23420
23627
|
if (closePosition === undefined) {
|
|
23421
23628
|
quantityIsRequired = true;
|
|
23422
23629
|
}
|
|
@@ -23429,7 +23636,13 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
23429
23636
|
}
|
|
23430
23637
|
}
|
|
23431
23638
|
if (quantityIsRequired) {
|
|
23432
|
-
|
|
23639
|
+
// portfolio margin has a different amount precision
|
|
23640
|
+
if (isPortfolioMargin) {
|
|
23641
|
+
request['quantity'] = this.parseToNumeric(amount);
|
|
23642
|
+
}
|
|
23643
|
+
else {
|
|
23644
|
+
request['quantity'] = this.amountToPrecision(symbol, amount);
|
|
23645
|
+
}
|
|
23433
23646
|
}
|
|
23434
23647
|
if (priceIsRequired) {
|
|
23435
23648
|
if (price === undefined) {
|
|
@@ -23437,12 +23650,6 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
23437
23650
|
}
|
|
23438
23651
|
request['price'] = this.priceToPrecision(symbol, price);
|
|
23439
23652
|
}
|
|
23440
|
-
if (timeInForceIsRequired) {
|
|
23441
|
-
request['timeInForce'] = this.options['defaultTimeInForce']; // 'GTC' = Good To Cancel (default), 'IOC' = Immediate Or Cancel
|
|
23442
|
-
}
|
|
23443
|
-
if (market['contract'] && postOnly) {
|
|
23444
|
-
request['timeInForce'] = 'GTX';
|
|
23445
|
-
}
|
|
23446
23653
|
if (stopPriceIsRequired) {
|
|
23447
23654
|
if (market['contract']) {
|
|
23448
23655
|
if (stopPrice === undefined) {
|
|
@@ -23459,11 +23666,17 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
23459
23666
|
request['stopPrice'] = this.priceToPrecision(symbol, stopPrice);
|
|
23460
23667
|
}
|
|
23461
23668
|
}
|
|
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';
|
|
23674
|
+
}
|
|
23462
23675
|
// remove timeInForce from params because PO is only used by this.isPostOnly and it's not a valid value for Binance
|
|
23463
23676
|
if (this.safeString(params, 'timeInForce') === 'PO') {
|
|
23464
|
-
params = this.omit(params,
|
|
23677
|
+
params = this.omit(params, 'timeInForce');
|
|
23465
23678
|
}
|
|
23466
|
-
const requestParams = this.omit(params, ['
|
|
23679
|
+
const requestParams = this.omit(params, ['type', 'newClientOrderId', 'clientOrderId', 'postOnly', 'stopLossPrice', 'takeProfitPrice', 'stopPrice', 'triggerPrice', 'trailingTriggerPrice', 'trailingPercent', 'quoteOrderQty', 'cost', 'test']);
|
|
23467
23680
|
return this.extend(request, requestParams);
|
|
23468
23681
|
}
|
|
23469
23682
|
async createMarketOrderWithCost(symbol, side, cost, params = {}) {
|
|
@@ -23729,21 +23942,28 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
23729
23942
|
/**
|
|
23730
23943
|
* @method
|
|
23731
23944
|
* @name binance#fetchOpenOrders
|
|
23945
|
+
* @description fetch all unfilled currently open orders
|
|
23732
23946
|
* @see https://binance-docs.github.io/apidocs/spot/en/#cancel-an-existing-order-and-send-a-new-order-trade
|
|
23733
23947
|
* @see https://binance-docs.github.io/apidocs/futures/en/#current-all-open-orders-user_data
|
|
23734
23948
|
* @see https://binance-docs.github.io/apidocs/delivery/en/#current-all-open-orders-user_data
|
|
23735
23949
|
* @see https://binance-docs.github.io/apidocs/voptions/en/#query-current-open-option-orders-user_data
|
|
23736
|
-
* @description fetch all unfilled currently open orders
|
|
23737
23950
|
* @see https://binance-docs.github.io/apidocs/spot/en/#current-open-orders-user_data
|
|
23738
23951
|
* @see https://binance-docs.github.io/apidocs/futures/en/#current-all-open-orders-user_data
|
|
23739
23952
|
* @see https://binance-docs.github.io/apidocs/delivery/en/#current-all-open-orders-user_data
|
|
23740
23953
|
* @see https://binance-docs.github.io/apidocs/voptions/en/#query-current-open-option-orders-user_data
|
|
23741
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
|
|
23742
23960
|
* @param {string} symbol unified market symbol
|
|
23743
23961
|
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
23744
23962
|
* @param {int} [limit] the maximum number of open orders structures to retrieve
|
|
23745
23963
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
23746
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
|
|
23747
23967
|
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
23748
23968
|
*/
|
|
23749
23969
|
await this.loadMarkets();
|
|
@@ -23751,14 +23971,16 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
23751
23971
|
let type = undefined;
|
|
23752
23972
|
const request = {};
|
|
23753
23973
|
let marginMode = undefined;
|
|
23754
|
-
|
|
23755
|
-
|
|
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');
|
|
23756
23978
|
if (symbol !== undefined) {
|
|
23757
23979
|
market = this.market(symbol);
|
|
23758
23980
|
request['symbol'] = market['id'];
|
|
23759
23981
|
const defaultType = this.safeString2(this.options, 'fetchOpenOrders', 'defaultType', 'spot');
|
|
23760
23982
|
const marketType = ('type' in market) ? market['type'] : defaultType;
|
|
23761
|
-
type = this.safeString(
|
|
23983
|
+
type = this.safeString(params, 'type', marketType);
|
|
23762
23984
|
}
|
|
23763
23985
|
else if (this.options['warnOnFetchOpenOrdersWithoutSymbol']) {
|
|
23764
23986
|
const symbols = this.symbols;
|
|
@@ -23768,11 +23990,11 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
23768
23990
|
}
|
|
23769
23991
|
else {
|
|
23770
23992
|
const defaultType = this.safeString2(this.options, 'fetchOpenOrders', 'defaultType', 'spot');
|
|
23771
|
-
type = this.safeString(
|
|
23993
|
+
type = this.safeString(params, 'type', defaultType);
|
|
23772
23994
|
}
|
|
23773
23995
|
let subType = undefined;
|
|
23774
|
-
[subType,
|
|
23775
|
-
|
|
23996
|
+
[subType, params] = this.handleSubTypeAndParams('fetchOpenOrders', market, params);
|
|
23997
|
+
params = this.omit(params, ['type', 'stop', 'conditional']);
|
|
23776
23998
|
let response = undefined;
|
|
23777
23999
|
if (type === 'option') {
|
|
23778
24000
|
if (since !== undefined) {
|
|
@@ -23781,25 +24003,50 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
23781
24003
|
if (limit !== undefined) {
|
|
23782
24004
|
request['limit'] = limit;
|
|
23783
24005
|
}
|
|
23784
|
-
response = await this.eapiPrivateGetOpenOrders(this.extend(request,
|
|
24006
|
+
response = await this.eapiPrivateGetOpenOrders(this.extend(request, params));
|
|
23785
24007
|
}
|
|
23786
24008
|
else if (this.isLinear(type, subType)) {
|
|
23787
|
-
|
|
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
|
+
}
|
|
23788
24020
|
}
|
|
23789
24021
|
else if (this.isInverse(type, subType)) {
|
|
23790
|
-
|
|
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
|
+
}
|
|
23791
24033
|
}
|
|
23792
24034
|
else if (type === 'margin' || marginMode !== undefined) {
|
|
23793
|
-
if (
|
|
23794
|
-
|
|
23795
|
-
|
|
23796
|
-
|
|
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
|
+
}
|
|
23797
24044
|
}
|
|
24045
|
+
response = await this.sapiGetMarginOpenOrders(this.extend(request, params));
|
|
23798
24046
|
}
|
|
23799
|
-
response = await this.sapiGetMarginOpenOrders(this.extend(request, requestParams));
|
|
23800
24047
|
}
|
|
23801
24048
|
else {
|
|
23802
|
-
response = await this.privateGetOpenOrders(this.extend(request,
|
|
24049
|
+
response = await this.privateGetOpenOrders(this.extend(request, params));
|
|
23803
24050
|
}
|
|
23804
24051
|
return this.parseOrders(response, market, since, limit);
|
|
23805
24052
|
}
|
|
@@ -23917,46 +24164,82 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
23917
24164
|
/**
|
|
23918
24165
|
* @method
|
|
23919
24166
|
* @name binance#cancelAllOrders
|
|
24167
|
+
* @description cancel all open orders in a market
|
|
23920
24168
|
* @see https://binance-docs.github.io/apidocs/spot/en/#cancel-all-open-orders-on-a-symbol-trade
|
|
23921
24169
|
* @see https://binance-docs.github.io/apidocs/futures/en/#cancel-all-open-orders-trade
|
|
23922
24170
|
* @see https://binance-docs.github.io/apidocs/delivery/en/#cancel-all-open-orders-trade
|
|
23923
24171
|
* @see https://binance-docs.github.io/apidocs/voptions/en/#cancel-all-option-orders-on-specific-symbol-trade
|
|
23924
24172
|
* @see https://binance-docs.github.io/apidocs/spot/en/#margin-account-cancel-order-trade
|
|
23925
|
-
* @
|
|
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
|
|
23926
24178
|
* @param {string} symbol unified market symbol of the market to cancel orders in
|
|
23927
24179
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
23928
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
|
|
23929
24183
|
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
23930
24184
|
*/
|
|
23931
24185
|
if (symbol === undefined) {
|
|
23932
|
-
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');
|
|
23933
24187
|
}
|
|
23934
24188
|
await this.loadMarkets();
|
|
23935
24189
|
const market = this.market(symbol);
|
|
23936
24190
|
const request = {
|
|
23937
24191
|
'symbol': market['id'],
|
|
23938
24192
|
};
|
|
24193
|
+
let isPortfolioMargin = undefined;
|
|
24194
|
+
[isPortfolioMargin, params] = this.handleOptionAndParams2(params, 'cancelAllOrders', 'papi', 'portfolioMargin', false);
|
|
24195
|
+
const isConditional = this.safeBool2(params, 'stop', 'conditional');
|
|
23939
24196
|
const type = this.safeString(params, 'type', market['type']);
|
|
23940
|
-
params = this.omit(params, ['type']);
|
|
23941
|
-
|
|
24197
|
+
params = this.omit(params, ['type', 'stop', 'conditional']);
|
|
24198
|
+
let marginMode = undefined;
|
|
24199
|
+
[marginMode, params] = this.handleMarginModeAndParams('cancelAllOrders', params);
|
|
23942
24200
|
let response = undefined;
|
|
23943
24201
|
if (market['option']) {
|
|
23944
|
-
response = await this.eapiPrivateDeleteAllOpenOrders(this.extend(request,
|
|
24202
|
+
response = await this.eapiPrivateDeleteAllOpenOrders(this.extend(request, params));
|
|
23945
24203
|
}
|
|
23946
24204
|
else if (market['linear']) {
|
|
23947
|
-
|
|
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
|
+
}
|
|
23948
24216
|
}
|
|
23949
24217
|
else if (market['inverse']) {
|
|
23950
|
-
|
|
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
|
+
}
|
|
23951
24229
|
}
|
|
23952
24230
|
else if ((type === 'margin') || (marginMode !== undefined)) {
|
|
23953
|
-
if (
|
|
23954
|
-
|
|
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));
|
|
23955
24239
|
}
|
|
23956
|
-
response = await this.sapiDeleteMarginOpenOrders(this.extend(request, query));
|
|
23957
24240
|
}
|
|
23958
24241
|
else {
|
|
23959
|
-
response = await this.privateDeleteOpenOrders(this.extend(request,
|
|
24242
|
+
response = await this.privateDeleteOpenOrders(this.extend(request, params));
|
|
23960
24243
|
}
|
|
23961
24244
|
if (Array.isArray(response)) {
|
|
23962
24245
|
return this.parseOrders(response, market);
|
|
@@ -36511,6 +36794,7 @@ class bitfinex extends _abstract_bitfinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
36511
36794
|
* @method
|
|
36512
36795
|
* @name bitfinex#fetchTradingFees
|
|
36513
36796
|
* @description fetch the trading fees for multiple markets
|
|
36797
|
+
* @see https://docs.bitfinex.com/v1/reference/rest-auth-summary
|
|
36514
36798
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
36515
36799
|
* @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
|
|
36516
36800
|
*/
|
|
@@ -36593,6 +36877,8 @@ class bitfinex extends _abstract_bitfinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
36593
36877
|
* @method
|
|
36594
36878
|
* @name bitfinex#fetchMarkets
|
|
36595
36879
|
* @description retrieves data on all markets for bitfinex
|
|
36880
|
+
* @see https://docs.bitfinex.com/v1/reference/rest-public-symbols
|
|
36881
|
+
* @see https://docs.bitfinex.com/v1/reference/rest-public-symbol-details
|
|
36596
36882
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
36597
36883
|
* @returns {object[]} an array of objects representing market data
|
|
36598
36884
|
*/
|
|
@@ -36717,6 +37003,7 @@ class bitfinex extends _abstract_bitfinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
36717
37003
|
* @method
|
|
36718
37004
|
* @name bitfinex#fetchBalance
|
|
36719
37005
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
37006
|
+
* @see https://docs.bitfinex.com/v1/reference/rest-auth-wallet-balances
|
|
36720
37007
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
36721
37008
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
36722
37009
|
*/
|
|
@@ -36774,6 +37061,7 @@ class bitfinex extends _abstract_bitfinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
36774
37061
|
* @method
|
|
36775
37062
|
* @name bitfinex#transfer
|
|
36776
37063
|
* @description transfer currency internally between wallets on the same account
|
|
37064
|
+
* @see https://docs.bitfinex.com/v1/reference/rest-auth-transfer-between-wallets
|
|
36777
37065
|
* @param {string} code unified currency code
|
|
36778
37066
|
* @param {float} amount amount to transfer
|
|
36779
37067
|
* @param {string} fromAccount account to transfer from
|
|
@@ -36859,6 +37147,7 @@ class bitfinex extends _abstract_bitfinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
36859
37147
|
* @method
|
|
36860
37148
|
* @name bitfinex#fetchOrderBook
|
|
36861
37149
|
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
37150
|
+
* @see https://docs.bitfinex.com/v1/reference/rest-public-orderbook
|
|
36862
37151
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
36863
37152
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
36864
37153
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -36901,6 +37190,7 @@ class bitfinex extends _abstract_bitfinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
36901
37190
|
* @method
|
|
36902
37191
|
* @name bitfinex#fetchTicker
|
|
36903
37192
|
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
37193
|
+
* @see https://docs.bitfinex.com/v1/reference/rest-public-ticker
|
|
36904
37194
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
36905
37195
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
36906
37196
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -37017,6 +37307,7 @@ class bitfinex extends _abstract_bitfinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
37017
37307
|
* @method
|
|
37018
37308
|
* @name bitfinex#fetchTrades
|
|
37019
37309
|
* @description get the list of most recent trades for a particular symbol
|
|
37310
|
+
* @see https://docs.bitfinex.com/v1/reference/rest-public-trades
|
|
37020
37311
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
37021
37312
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
37022
37313
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
@@ -37052,6 +37343,7 @@ class bitfinex extends _abstract_bitfinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
37052
37343
|
* @method
|
|
37053
37344
|
* @name bitfinex#fetchMyTrades
|
|
37054
37345
|
* @description fetch all trades made by the user
|
|
37346
|
+
* @see https://docs.bitfinex.com/v1/reference/rest-auth-past-trades
|
|
37055
37347
|
* @param {string} symbol unified market symbol
|
|
37056
37348
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
37057
37349
|
* @param {int} [limit] the maximum number of trades structures to retrieve
|
|
@@ -37080,6 +37372,7 @@ class bitfinex extends _abstract_bitfinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
37080
37372
|
* @method
|
|
37081
37373
|
* @name bitfinex#createOrder
|
|
37082
37374
|
* @description create a trade order
|
|
37375
|
+
* @see https://docs.bitfinex.com/v1/reference/rest-auth-new-order
|
|
37083
37376
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
37084
37377
|
* @param {string} type 'market' or 'limit'
|
|
37085
37378
|
* @param {string} side 'buy' or 'sell'
|
|
@@ -37147,6 +37440,7 @@ class bitfinex extends _abstract_bitfinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
37147
37440
|
* @method
|
|
37148
37441
|
* @name bitfinex#cancelOrder
|
|
37149
37442
|
* @description cancels an open order
|
|
37443
|
+
* @see https://docs.bitfinex.com/v1/reference/rest-auth-cancel-order
|
|
37150
37444
|
* @param {string} id order id
|
|
37151
37445
|
* @param {string} symbol not used by bitfinex cancelOrder ()
|
|
37152
37446
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -37163,6 +37457,7 @@ class bitfinex extends _abstract_bitfinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
37163
37457
|
* @method
|
|
37164
37458
|
* @name bitfinex#cancelAllOrders
|
|
37165
37459
|
* @description cancel all open orders
|
|
37460
|
+
* @see https://docs.bitfinex.com/v1/reference/rest-auth-cancel-all-orders
|
|
37166
37461
|
* @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
|
|
37167
37462
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
37168
37463
|
* @returns {object} response from exchange
|
|
@@ -37247,6 +37542,7 @@ class bitfinex extends _abstract_bitfinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
37247
37542
|
* @method
|
|
37248
37543
|
* @name bitfinex#fetchOpenOrders
|
|
37249
37544
|
* @description fetch all unfilled currently open orders
|
|
37545
|
+
* @see https://docs.bitfinex.com/v1/reference/rest-auth-active-orders
|
|
37250
37546
|
* @param {string} symbol unified market symbol
|
|
37251
37547
|
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
37252
37548
|
* @param {int} [limit] the maximum number of open orders structures to retrieve
|
|
@@ -37271,6 +37567,7 @@ class bitfinex extends _abstract_bitfinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
37271
37567
|
* @method
|
|
37272
37568
|
* @name bitfinex#fetchClosedOrders
|
|
37273
37569
|
* @description fetches information on multiple closed orders made by the user
|
|
37570
|
+
* @see https://docs.bitfinex.com/v1/reference/rest-auth-orders-history
|
|
37274
37571
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
37275
37572
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
37276
37573
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
@@ -37296,6 +37593,7 @@ class bitfinex extends _abstract_bitfinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
37296
37593
|
* @method
|
|
37297
37594
|
* @name bitfinex#fetchOrder
|
|
37298
37595
|
* @description fetches information on an order made by the user
|
|
37596
|
+
* @see https://docs.bitfinex.com/v1/reference/rest-auth-order-status
|
|
37299
37597
|
* @param {string} symbol not used by bitfinex fetchOrder
|
|
37300
37598
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
37301
37599
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
@@ -37332,6 +37630,7 @@ class bitfinex extends _abstract_bitfinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
37332
37630
|
* @method
|
|
37333
37631
|
* @name bitfinex#fetchOHLCV
|
|
37334
37632
|
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
37633
|
+
* @see https://docs.bitfinex.com/reference/rest-public-candles#aggregate-funding-currency-candles
|
|
37335
37634
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
37336
37635
|
* @param {string} timeframe the length of time each candle represents
|
|
37337
37636
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
@@ -37376,6 +37675,7 @@ class bitfinex extends _abstract_bitfinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
37376
37675
|
* @method
|
|
37377
37676
|
* @name bitfinex#createDepositAddress
|
|
37378
37677
|
* @description create a currency deposit address
|
|
37678
|
+
* @see https://docs.bitfinex.com/v1/reference/rest-auth-deposit
|
|
37379
37679
|
* @param {string} code unified currency code of the currency for the deposit address
|
|
37380
37680
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
37381
37681
|
* @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
|
|
@@ -37391,6 +37691,7 @@ class bitfinex extends _abstract_bitfinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
37391
37691
|
* @method
|
|
37392
37692
|
* @name bitfinex#fetchDepositAddress
|
|
37393
37693
|
* @description fetch the deposit address for a currency associated with this account
|
|
37694
|
+
* @see https://docs.bitfinex.com/v1/reference/rest-auth-deposit
|
|
37394
37695
|
* @param {string} code unified currency code
|
|
37395
37696
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
37396
37697
|
* @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
|
|
@@ -37424,6 +37725,7 @@ class bitfinex extends _abstract_bitfinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
37424
37725
|
* @method
|
|
37425
37726
|
* @name bitfinex#fetchDepositsWithdrawals
|
|
37426
37727
|
* @description fetch history of deposits and withdrawals
|
|
37728
|
+
* @see https://docs.bitfinex.com/v1/reference/rest-auth-deposit-withdrawal-history
|
|
37427
37729
|
* @param {string} code unified currency code for the currency of the deposit/withdrawals
|
|
37428
37730
|
* @param {int} [since] timestamp in ms of the earliest deposit/withdrawal, default is undefined
|
|
37429
37731
|
* @param {int} [limit] max number of deposit/withdrawals to return, default is undefined
|
|
@@ -37560,6 +37862,7 @@ class bitfinex extends _abstract_bitfinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
37560
37862
|
* @method
|
|
37561
37863
|
* @name bitfinex#withdraw
|
|
37562
37864
|
* @description make a withdrawal
|
|
37865
|
+
* @see https://docs.bitfinex.com/v1/reference/rest-auth-withdrawal
|
|
37563
37866
|
* @param {string} code unified currency code
|
|
37564
37867
|
* @param {float} amount the amount to withdraw
|
|
37565
37868
|
* @param {string} address the address to withdraw to
|
|
@@ -37610,6 +37913,7 @@ class bitfinex extends _abstract_bitfinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
37610
37913
|
* @method
|
|
37611
37914
|
* @name bitfinex#fetchPositions
|
|
37612
37915
|
* @description fetch all open positions
|
|
37916
|
+
* @see https://docs.bitfinex.com/v1/reference/rest-auth-active-positions
|
|
37613
37917
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
37614
37918
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
37615
37919
|
* @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
@@ -37850,149 +38154,149 @@ class bitfinex2 extends _abstract_bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
37850
38154
|
'api': {
|
|
37851
38155
|
'public': {
|
|
37852
38156
|
'get': {
|
|
37853
|
-
'conf/{config}': 2.
|
|
37854
|
-
'conf/pub:{action}:{object}': 2.
|
|
37855
|
-
'conf/pub:{action}:{object}:{detail}': 2.
|
|
37856
|
-
'conf/pub:map:{object}': 2.
|
|
37857
|
-
'conf/pub:map:{object}:{detail}': 2.
|
|
37858
|
-
'conf/pub:map:currency:{detail}': 2.
|
|
37859
|
-
'conf/pub:map:currency:sym': 2.
|
|
37860
|
-
'conf/pub:map:currency:label': 2.
|
|
37861
|
-
'conf/pub:map:currency:unit': 2.
|
|
37862
|
-
'conf/pub:map:currency:undl': 2.
|
|
37863
|
-
'conf/pub:map:currency:pool': 2.
|
|
37864
|
-
'conf/pub:map:currency:explorer': 2.
|
|
37865
|
-
'conf/pub:map:currency:tx:fee': 2.
|
|
37866
|
-
'conf/pub:map:tx:method': 2.
|
|
37867
|
-
'conf/pub:list:{object}': 2.
|
|
37868
|
-
'conf/pub:list:{object}:{detail}': 2.
|
|
37869
|
-
'conf/pub:list:currency': 2.
|
|
37870
|
-
'conf/pub:list:pair:exchange': 2.
|
|
37871
|
-
'conf/pub:list:pair:margin': 2.
|
|
37872
|
-
'conf/pub:list:pair:futures': 2.
|
|
37873
|
-
'conf/pub:list:competitions': 2.
|
|
37874
|
-
'conf/pub:info:{object}': 2.
|
|
37875
|
-
'conf/pub:info:{object}:{detail}': 2.
|
|
37876
|
-
'conf/pub:info:pair': 2.
|
|
37877
|
-
'conf/pub:info:pair:futures': 2.
|
|
37878
|
-
'conf/pub:info:tx:status': 2.
|
|
37879
|
-
'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,
|
|
37880
38184
|
'platform/status': 8,
|
|
37881
|
-
'tickers': 2.
|
|
37882
|
-
'ticker/{symbol}': 2.
|
|
37883
|
-
'tickers/hist': 2.
|
|
37884
|
-
'trades/{symbol}/hist': 2.
|
|
38185
|
+
'tickers': 2.7,
|
|
38186
|
+
'ticker/{symbol}': 2.7,
|
|
38187
|
+
'tickers/hist': 2.7,
|
|
38188
|
+
'trades/{symbol}/hist': 2.7,
|
|
37885
38189
|
'book/{symbol}/{precision}': 1,
|
|
37886
38190
|
'book/{symbol}/P0': 1,
|
|
37887
38191
|
'book/{symbol}/P1': 1,
|
|
37888
38192
|
'book/{symbol}/P2': 1,
|
|
37889
38193
|
'book/{symbol}/P3': 1,
|
|
37890
38194
|
'book/{symbol}/R0': 1,
|
|
37891
|
-
'stats1/{key}:{size}:{symbol}:{side}/{section}': 2.
|
|
37892
|
-
'stats1/{key}:{size}:{symbol}:{side}/last': 2.
|
|
37893
|
-
'stats1/{key}:{size}:{symbol}:{side}/hist': 2.
|
|
37894
|
-
'stats1/{key}:{size}:{symbol}/{section}': 2.
|
|
37895
|
-
'stats1/{key}:{size}:{symbol}/last': 2.
|
|
37896
|
-
'stats1/{key}:{size}:{symbol}/hist': 2.
|
|
37897
|
-
'stats1/{key}:{size}:{symbol}:long/last': 2.
|
|
37898
|
-
'stats1/{key}:{size}:{symbol}:long/hist': 2.
|
|
37899
|
-
'stats1/{key}:{size}:{symbol}:short/last': 2.
|
|
37900
|
-
'stats1/{key}:{size}:{symbol}:short/hist': 2.
|
|
37901
|
-
'candles/trade:{timeframe}:{symbol}:{period}/{section}': 2.
|
|
37902
|
-
'candles/trade:{timeframe}:{symbol}/{section}': 2.
|
|
37903
|
-
'candles/trade:{timeframe}:{symbol}/last': 2.
|
|
37904
|
-
'candles/trade:{timeframe}:{symbol}/hist': 2.
|
|
37905
|
-
'status/{type}': 2.
|
|
37906
|
-
'status/deriv': 2.
|
|
37907
|
-
'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,
|
|
37908
38212
|
'liquidations/hist': 80,
|
|
37909
|
-
'rankings/{key}:{timeframe}:{symbol}/{section}': 2.
|
|
37910
|
-
'rankings/{key}:{timeframe}:{symbol}/hist': 2.
|
|
37911
|
-
'pulse/hist': 2.
|
|
37912
|
-
'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,
|
|
37913
38217
|
'funding/stats/{symbol}/hist': 10, // ratelimit not in docs
|
|
37914
38218
|
},
|
|
37915
38219
|
'post': {
|
|
37916
|
-
'calc/trade/avg': 2.
|
|
37917
|
-
'calc/fx': 2.
|
|
38220
|
+
'calc/trade/avg': 2.7,
|
|
38221
|
+
'calc/fx': 2.7,
|
|
37918
38222
|
},
|
|
37919
38223
|
},
|
|
37920
38224
|
'private': {
|
|
37921
38225
|
'post': {
|
|
37922
38226
|
// 'auth/r/orders/{symbol}/new', // outdated
|
|
37923
38227
|
// 'auth/r/stats/perf:{timeframe}/hist', // outdated
|
|
37924
|
-
'auth/r/wallets': 2.
|
|
37925
|
-
'auth/r/wallets/hist': 2.
|
|
37926
|
-
'auth/r/orders': 2.
|
|
37927
|
-
'auth/r/orders/{symbol}': 2.
|
|
37928
|
-
'auth/w/order/submit': 2.
|
|
37929
|
-
'auth/w/order/update': 2.
|
|
37930
|
-
'auth/w/order/cancel': 2.
|
|
37931
|
-
'auth/w/order/multi': 2.
|
|
37932
|
-
'auth/w/order/cancel/multi': 2.
|
|
37933
|
-
'auth/r/orders/{symbol}/hist': 2.
|
|
37934
|
-
'auth/r/orders/hist': 2.
|
|
37935
|
-
'auth/r/order/{symbol}:{id}/trades': 2.
|
|
37936
|
-
'auth/r/trades/{symbol}/hist': 2.
|
|
37937
|
-
'auth/r/trades/hist': 2.
|
|
37938
|
-
'auth/r/ledgers/{currency}/hist': 2.
|
|
37939
|
-
'auth/r/ledgers/hist': 2.
|
|
37940
|
-
'auth/r/info/margin/{key}': 2.
|
|
37941
|
-
'auth/r/info/margin/base': 2.
|
|
37942
|
-
'auth/r/info/margin/sym_all': 2.
|
|
37943
|
-
'auth/r/positions': 2.
|
|
37944
|
-
'auth/w/position/claim': 2.
|
|
37945
|
-
'auth/w/position/increase:': 2.
|
|
37946
|
-
'auth/r/position/increase/info': 2.
|
|
37947
|
-
'auth/r/positions/hist': 2.
|
|
37948
|
-
'auth/r/positions/audit': 2.
|
|
37949
|
-
'auth/r/positions/snap': 2.
|
|
37950
|
-
'auth/w/deriv/collateral/set': 2.
|
|
37951
|
-
'auth/w/deriv/collateral/limits': 2.
|
|
37952
|
-
'auth/r/funding/offers': 2.
|
|
37953
|
-
'auth/r/funding/offers/{symbol}': 2.
|
|
37954
|
-
'auth/w/funding/offer/submit': 2.
|
|
37955
|
-
'auth/w/funding/offer/cancel': 2.
|
|
37956
|
-
'auth/w/funding/offer/cancel/all': 2.
|
|
37957
|
-
'auth/w/funding/close': 2.
|
|
37958
|
-
'auth/w/funding/auto': 2.
|
|
37959
|
-
'auth/w/funding/keep': 2.
|
|
37960
|
-
'auth/r/funding/offers/{symbol}/hist': 2.
|
|
37961
|
-
'auth/r/funding/offers/hist': 2.
|
|
37962
|
-
'auth/r/funding/loans': 2.
|
|
37963
|
-
'auth/r/funding/loans/hist': 2.
|
|
37964
|
-
'auth/r/funding/loans/{symbol}': 2.
|
|
37965
|
-
'auth/r/funding/loans/{symbol}/hist': 2.
|
|
37966
|
-
'auth/r/funding/credits': 2.
|
|
37967
|
-
'auth/r/funding/credits/hist': 2.
|
|
37968
|
-
'auth/r/funding/credits/{symbol}': 2.
|
|
37969
|
-
'auth/r/funding/credits/{symbol}/hist': 2.
|
|
37970
|
-
'auth/r/funding/trades/{symbol}/hist': 2.
|
|
37971
|
-
'auth/r/funding/trades/hist': 2.
|
|
37972
|
-
'auth/r/info/funding/{key}': 2.
|
|
37973
|
-
'auth/r/info/user': 2.
|
|
37974
|
-
'auth/r/summary': 2.
|
|
37975
|
-
'auth/r/logins/hist': 2.
|
|
37976
|
-
'auth/r/permissions': 2.
|
|
37977
|
-
'auth/w/token': 2.
|
|
37978
|
-
'auth/r/audit/hist': 2.
|
|
37979
|
-
'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,
|
|
37980
38284
|
'auth/w/deposit/address': 24,
|
|
37981
38285
|
'auth/w/deposit/invoice': 24,
|
|
37982
38286
|
'auth/w/withdraw': 24,
|
|
37983
|
-
'auth/r/movements/{currency}/hist': 2.
|
|
37984
|
-
'auth/r/movements/hist': 2.
|
|
37985
|
-
'auth/r/alerts': 5.
|
|
37986
|
-
'auth/w/alert/set': 2.
|
|
37987
|
-
'auth/w/alert/price:{symbol}:{price}/del': 2.
|
|
37988
|
-
'auth/w/alert/{type}:{symbol}:{price}/del': 2.
|
|
37989
|
-
'auth/calc/order/avail': 2.
|
|
37990
|
-
'auth/w/settings/set': 2.
|
|
37991
|
-
'auth/r/settings': 2.
|
|
37992
|
-
'auth/w/settings/del': 2.
|
|
37993
|
-
'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,
|
|
37994
38298
|
'auth/w/pulse/add': 16,
|
|
37995
|
-
'auth/w/pulse/del': 2.
|
|
38299
|
+
'auth/w/pulse/del': 2.7,
|
|
37996
38300
|
},
|
|
37997
38301
|
},
|
|
37998
38302
|
},
|
|
@@ -46638,6 +46942,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
46638
46942
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
46639
46943
|
* @param {int} [params.until] timestamp in ms of the latest candle to fetch
|
|
46640
46944
|
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
46945
|
+
* @param {string} [params.price] *swap only* "mark" (to fetch mark price candles) or "index" (to fetch index price candles)
|
|
46641
46946
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
46642
46947
|
*/
|
|
46643
46948
|
await this.loadMarkets();
|
|
@@ -46667,68 +46972,56 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
46667
46972
|
if (limit !== undefined) {
|
|
46668
46973
|
request['limit'] = limit;
|
|
46669
46974
|
}
|
|
46670
|
-
|
|
46671
|
-
|
|
46672
|
-
|
|
46673
|
-
|
|
46674
|
-
|
|
46675
|
-
|
|
46676
|
-
if (since !== undefined) {
|
|
46677
|
-
request['startTime'] = since;
|
|
46678
|
-
}
|
|
46679
|
-
if (until !== undefined) {
|
|
46680
|
-
request['endTime'] = until;
|
|
46975
|
+
if (since !== undefined) {
|
|
46976
|
+
request['startTime'] = since;
|
|
46977
|
+
}
|
|
46978
|
+
if (since !== undefined) {
|
|
46979
|
+
if (limit === undefined) {
|
|
46980
|
+
limit = 100; // exchange default
|
|
46681
46981
|
}
|
|
46982
|
+
const duration = this.parseTimeframe(timeframe) * 1000;
|
|
46983
|
+
request['endTime'] = this.sum(since, duration * (limit + 1)) - 1; // limit + 1)) - 1 is needed for when since is not the exact timestamp of a candle
|
|
46984
|
+
}
|
|
46985
|
+
else if (until !== undefined) {
|
|
46986
|
+
request['endTime'] = until;
|
|
46987
|
+
}
|
|
46988
|
+
else {
|
|
46989
|
+
request['endTime'] = this.milliseconds();
|
|
46682
46990
|
}
|
|
46683
46991
|
let response = undefined;
|
|
46992
|
+
const thirtyOneDaysAgo = this.milliseconds() - 2678400000;
|
|
46684
46993
|
if (market['spot']) {
|
|
46685
|
-
if (
|
|
46686
|
-
response = await this.publicSpotGetV2SpotMarketCandles(this.extend(request, params));
|
|
46687
|
-
}
|
|
46688
|
-
else if (method === 'publicSpotGetV2SpotMarketHistoryCandles') {
|
|
46689
|
-
if (since !== undefined) {
|
|
46690
|
-
if (limit === undefined) {
|
|
46691
|
-
limit = 100; // exchange default
|
|
46692
|
-
}
|
|
46693
|
-
const duration = this.parseTimeframe(timeframe) * 1000;
|
|
46694
|
-
request['endTime'] = this.sum(since, duration * limit);
|
|
46695
|
-
}
|
|
46696
|
-
else if (until !== undefined) {
|
|
46697
|
-
request['endTime'] = until;
|
|
46698
|
-
}
|
|
46699
|
-
else {
|
|
46700
|
-
request['endTime'] = this.milliseconds();
|
|
46701
|
-
}
|
|
46994
|
+
if ((since !== undefined) && (since < thirtyOneDaysAgo)) {
|
|
46702
46995
|
response = await this.publicSpotGetV2SpotMarketHistoryCandles(this.extend(request, params));
|
|
46703
46996
|
}
|
|
46997
|
+
else {
|
|
46998
|
+
response = await this.publicSpotGetV2SpotMarketCandles(this.extend(request, params));
|
|
46999
|
+
}
|
|
46704
47000
|
}
|
|
46705
47001
|
else {
|
|
46706
|
-
const swapOptions = this.safeValue(options, 'swap', {});
|
|
46707
|
-
const defaultSwapMethod = this.safeString(swapOptions, 'method', 'publicMixGetV2MixMarketCandles');
|
|
46708
|
-
const swapMethod = this.safeString(params, 'method', defaultSwapMethod);
|
|
46709
47002
|
const priceType = this.safeString(params, 'price');
|
|
46710
|
-
params = this.omit(params, ['
|
|
47003
|
+
params = this.omit(params, ['price']);
|
|
46711
47004
|
let productType = undefined;
|
|
46712
47005
|
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
46713
47006
|
request['productType'] = productType;
|
|
46714
|
-
if (
|
|
47007
|
+
if (priceType === 'mark') {
|
|
46715
47008
|
response = await this.publicMixGetV2MixMarketHistoryMarkCandles(this.extend(request, params));
|
|
46716
47009
|
}
|
|
46717
|
-
else if (
|
|
47010
|
+
else if (priceType === 'index') {
|
|
46718
47011
|
response = await this.publicMixGetV2MixMarketHistoryIndexCandles(this.extend(request, params));
|
|
46719
47012
|
}
|
|
46720
|
-
else if (
|
|
46721
|
-
response = await this.publicMixGetV2MixMarketCandles(this.extend(request, params));
|
|
46722
|
-
}
|
|
46723
|
-
else if (swapMethod === 'publicMixGetV2MixMarketHistoryCandles') {
|
|
47013
|
+
else if ((since !== undefined) && (since < thirtyOneDaysAgo)) {
|
|
46724
47014
|
response = await this.publicMixGetV2MixMarketHistoryCandles(this.extend(request, params));
|
|
46725
47015
|
}
|
|
47016
|
+
else {
|
|
47017
|
+
response = await this.publicMixGetV2MixMarketCandles(this.extend(request, params));
|
|
47018
|
+
}
|
|
46726
47019
|
}
|
|
46727
47020
|
if (response === '') {
|
|
46728
47021
|
return []; // happens when a new token is listed
|
|
46729
47022
|
}
|
|
46730
47023
|
// [ ["1645911960000","39406","39407","39374.5","39379","35.526","1399132.341"] ]
|
|
46731
|
-
const data = this.
|
|
47024
|
+
const data = this.safeList(response, 'data', response);
|
|
46732
47025
|
return this.parseOHLCVs(data, market, timeframe, since, limit);
|
|
46733
47026
|
}
|
|
46734
47027
|
async fetchBalance(params = {}) {
|
|
@@ -51885,6 +52178,7 @@ class bithumb extends _abstract_bithumb_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
51885
52178
|
* @method
|
|
51886
52179
|
* @name bithumb#fetchMarkets
|
|
51887
52180
|
* @description retrieves data on all markets for bithumb
|
|
52181
|
+
* @see https://apidocs.bithumb.com/reference/%ED%98%84%EC%9E%AC%EA%B0%80-%EC%A0%95%EB%B3%B4-%EC%A1%B0%ED%9A%8C-all
|
|
51888
52182
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
51889
52183
|
* @returns {object[]} an array of objects representing market data
|
|
51890
52184
|
*/
|
|
@@ -51987,6 +52281,7 @@ class bithumb extends _abstract_bithumb_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
51987
52281
|
* @method
|
|
51988
52282
|
* @name bithumb#fetchBalance
|
|
51989
52283
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
52284
|
+
* @see https://apidocs.bithumb.com/reference/%EB%B3%B4%EC%9C%A0%EC%9E%90%EC%82%B0-%EC%A1%B0%ED%9A%8C
|
|
51990
52285
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
51991
52286
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
51992
52287
|
*/
|
|
@@ -52002,6 +52297,7 @@ class bithumb extends _abstract_bithumb_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
52002
52297
|
* @method
|
|
52003
52298
|
* @name bithumb#fetchOrderBook
|
|
52004
52299
|
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
52300
|
+
* @see https://apidocs.bithumb.com/reference/%ED%98%B8%EA%B0%80-%EC%A0%95%EB%B3%B4-%EC%A1%B0%ED%9A%8C
|
|
52005
52301
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
52006
52302
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
52007
52303
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -52094,6 +52390,7 @@ class bithumb extends _abstract_bithumb_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
52094
52390
|
* @method
|
|
52095
52391
|
* @name bithumb#fetchTickers
|
|
52096
52392
|
* @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
|
52393
|
+
* @see https://apidocs.bithumb.com/reference/%ED%98%84%EC%9E%AC%EA%B0%80-%EC%A0%95%EB%B3%B4-%EC%A1%B0%ED%9A%8C-all
|
|
52097
52394
|
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
52098
52395
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
52099
52396
|
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -52151,6 +52448,7 @@ class bithumb extends _abstract_bithumb_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
52151
52448
|
* @method
|
|
52152
52449
|
* @name bithumb#fetchTicker
|
|
52153
52450
|
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
52451
|
+
* @see https://apidocs.bithumb.com/reference/%ED%98%84%EC%9E%AC%EA%B0%80-%EC%A0%95%EB%B3%B4-%EC%A1%B0%ED%9A%8C
|
|
52154
52452
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
52155
52453
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
52156
52454
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -52209,6 +52507,7 @@ class bithumb extends _abstract_bithumb_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
52209
52507
|
* @method
|
|
52210
52508
|
* @name bithumb#fetchOHLCV
|
|
52211
52509
|
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
52510
|
+
* @see https://apidocs.bithumb.com/reference/candlestick-rest-api
|
|
52212
52511
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
52213
52512
|
* @param {string} timeframe the length of time each candle represents
|
|
52214
52513
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
@@ -52333,6 +52632,7 @@ class bithumb extends _abstract_bithumb_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
52333
52632
|
* @method
|
|
52334
52633
|
* @name bithumb#fetchTrades
|
|
52335
52634
|
* @description get the list of most recent trades for a particular symbol
|
|
52635
|
+
* @see https://apidocs.bithumb.com/reference/%EC%B5%9C%EA%B7%BC-%EC%B2%B4%EA%B2%B0-%EB%82%B4%EC%97%AD
|
|
52336
52636
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
52337
52637
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
52338
52638
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
@@ -52371,6 +52671,9 @@ class bithumb extends _abstract_bithumb_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
52371
52671
|
* @method
|
|
52372
52672
|
* @name bithumb#createOrder
|
|
52373
52673
|
* @description create a trade order
|
|
52674
|
+
* @see https://apidocs.bithumb.com/reference/%EC%A7%80%EC%A0%95%EA%B0%80-%EC%A3%BC%EB%AC%B8%ED%95%98%EA%B8%B0
|
|
52675
|
+
* @see https://apidocs.bithumb.com/reference/%EC%8B%9C%EC%9E%A5%EA%B0%80-%EB%A7%A4%EC%88%98%ED%95%98%EA%B8%B0
|
|
52676
|
+
* @see https://apidocs.bithumb.com/reference/%EC%8B%9C%EC%9E%A5%EA%B0%80-%EB%A7%A4%EB%8F%84%ED%95%98%EA%B8%B0
|
|
52374
52677
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
52375
52678
|
* @param {string} type 'market' or 'limit'
|
|
52376
52679
|
* @param {string} side 'buy' or 'sell'
|
|
@@ -52412,6 +52715,7 @@ class bithumb extends _abstract_bithumb_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
52412
52715
|
* @method
|
|
52413
52716
|
* @name bithumb#fetchOrder
|
|
52414
52717
|
* @description fetches information on an order made by the user
|
|
52718
|
+
* @see https://apidocs.bithumb.com/reference/%EA%B1%B0%EB%9E%98-%EC%A3%BC%EB%AC%B8%EB%82%B4%EC%97%AD-%EC%83%81%EC%84%B8-%EC%A1%B0%ED%9A%8C
|
|
52415
52719
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
52416
52720
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
52417
52721
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
@@ -52570,6 +52874,7 @@ class bithumb extends _abstract_bithumb_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
52570
52874
|
* @method
|
|
52571
52875
|
* @name bithumb#fetchOpenOrders
|
|
52572
52876
|
* @description fetch all unfilled currently open orders
|
|
52877
|
+
* @see https://apidocs.bithumb.com/reference/%EA%B1%B0%EB%9E%98-%EC%A3%BC%EB%AC%B8%EB%82%B4%EC%97%AD-%EC%A1%B0%ED%9A%8C
|
|
52573
52878
|
* @param {string} symbol unified market symbol
|
|
52574
52879
|
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
52575
52880
|
* @param {int} [limit] the maximum number of open order structures to retrieve
|
|
@@ -52618,6 +52923,7 @@ class bithumb extends _abstract_bithumb_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
52618
52923
|
* @method
|
|
52619
52924
|
* @name bithumb#cancelOrder
|
|
52620
52925
|
* @description cancels an open order
|
|
52926
|
+
* @see https://apidocs.bithumb.com/reference/%EC%A3%BC%EB%AC%B8-%EC%B7%A8%EC%86%8C%ED%95%98%EA%B8%B0
|
|
52621
52927
|
* @param {string} id order id
|
|
52622
52928
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
52623
52929
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -52653,6 +52959,7 @@ class bithumb extends _abstract_bithumb_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
52653
52959
|
* @method
|
|
52654
52960
|
* @name bithumb#withdraw
|
|
52655
52961
|
* @description make a withdrawal
|
|
52962
|
+
* @see https://apidocs.bithumb.com/reference/%EC%BD%94%EC%9D%B8-%EC%B6%9C%EA%B8%88%ED%95%98%EA%B8%B0-%EA%B0%9C%EC%9D%B8
|
|
52656
52963
|
* @param {string} code unified currency code
|
|
52657
52964
|
* @param {float} amount the amount to withdraw
|
|
52658
52965
|
* @param {string} address the address to withdraw to
|
|
@@ -57543,6 +57850,7 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
57543
57850
|
* @method
|
|
57544
57851
|
* @name bitmex#fetchCurrencies
|
|
57545
57852
|
* @description fetches all available currencies on an exchange
|
|
57853
|
+
* @see https://www.bitmex.com/api/explorer/#!/Wallet/Wallet_getAssetsConfig
|
|
57546
57854
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
57547
57855
|
* @returns {object} an associative dictionary of currencies
|
|
57548
57856
|
*/
|
|
@@ -58028,6 +58336,7 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
58028
58336
|
* @method
|
|
58029
58337
|
* @name bitmex#fetchBalance
|
|
58030
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
|
|
58031
58340
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
58032
58341
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
58033
58342
|
*/
|
|
@@ -58090,6 +58399,7 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
58090
58399
|
* @method
|
|
58091
58400
|
* @name bitmex#fetchOrderBook
|
|
58092
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
|
|
58093
58403
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
58094
58404
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
58095
58405
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -58133,6 +58443,7 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
58133
58443
|
* @method
|
|
58134
58444
|
* @name bitmex#fetchOrder
|
|
58135
58445
|
* @description fetches information on an order made by the user
|
|
58446
|
+
* @see https://www.bitmex.com/api/explorer/#!/Order/Order_getOrders
|
|
58136
58447
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
58137
58448
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
58138
58449
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
@@ -58201,6 +58512,7 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
58201
58512
|
* @method
|
|
58202
58513
|
* @name bitmex#fetchOpenOrders
|
|
58203
58514
|
* @description fetch all unfilled currently open orders
|
|
58515
|
+
* @see https://www.bitmex.com/api/explorer/#!/Order/Order_getOrders
|
|
58204
58516
|
* @param {string} symbol unified market symbol
|
|
58205
58517
|
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
58206
58518
|
* @param {int} [limit] the maximum number of open orders structures to retrieve
|
|
@@ -58219,6 +58531,7 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
58219
58531
|
* @method
|
|
58220
58532
|
* @name bitmex#fetchClosedOrders
|
|
58221
58533
|
* @description fetches information on multiple closed orders made by the user
|
|
58534
|
+
* @see https://www.bitmex.com/api/explorer/#!/Order/Order_getOrders
|
|
58222
58535
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
58223
58536
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
58224
58537
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
@@ -58233,8 +58546,8 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
58233
58546
|
/**
|
|
58234
58547
|
* @method
|
|
58235
58548
|
* @name bitmex#fetchMyTrades
|
|
58236
|
-
* @see https://www.bitmex.com/api/explorer/#!/Execution/Execution_getTradeHistory
|
|
58237
58549
|
* @description fetch all trades made by the user
|
|
58550
|
+
* @see https://www.bitmex.com/api/explorer/#!/Execution/Execution_getTradeHistory
|
|
58238
58551
|
* @param {string} symbol unified market symbol
|
|
58239
58552
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
58240
58553
|
* @param {int} [limit] the maximum number of trades structures to retrieve
|
|
@@ -58443,6 +58756,7 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
58443
58756
|
* @method
|
|
58444
58757
|
* @name bitmex#fetchLedger
|
|
58445
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
|
|
58446
58760
|
* @param {string} code unified currency code, default is undefined
|
|
58447
58761
|
* @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
|
|
58448
58762
|
* @param {int} [limit] max number of ledger entrys to return, default is undefined
|
|
@@ -58494,6 +58808,7 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
58494
58808
|
* @method
|
|
58495
58809
|
* @name bitmex#fetchDepositsWithdrawals
|
|
58496
58810
|
* @description fetch history of deposits and withdrawals
|
|
58811
|
+
* @see https://www.bitmex.com/api/explorer/#!/User/User_getWalletHistory
|
|
58497
58812
|
* @param {string} [code] unified currency code for the currency of the deposit/withdrawals, default is undefined
|
|
58498
58813
|
* @param {int} [since] timestamp in ms of the earliest deposit/withdrawal, default is undefined
|
|
58499
58814
|
* @param {int} [limit] max number of deposit/withdrawals to return, default is undefined
|
|
@@ -58612,6 +58927,7 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
58612
58927
|
* @method
|
|
58613
58928
|
* @name bitmex#fetchTicker
|
|
58614
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
|
|
58615
58931
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
58616
58932
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
58617
58933
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -58633,6 +58949,7 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
58633
58949
|
* @method
|
|
58634
58950
|
* @name bitmex#fetchTickers
|
|
58635
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
|
|
58636
58953
|
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
58637
58954
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
58638
58955
|
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -58715,8 +59032,8 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
58715
59032
|
/**
|
|
58716
59033
|
* @method
|
|
58717
59034
|
* @name bitmex#fetchOHLCV
|
|
58718
|
-
* @see https://www.bitmex.com/api/explorer/#!/Trade/Trade_getBucketed
|
|
58719
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
|
|
58720
59037
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
58721
59038
|
* @param {string} timeframe the length of time each candle represents
|
|
58722
59039
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
@@ -59031,8 +59348,8 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
59031
59348
|
/**
|
|
59032
59349
|
* @method
|
|
59033
59350
|
* @name bitmex#fetchTrades
|
|
59034
|
-
* @see https://www.bitmex.com/api/explorer/#!/Trade/Trade_get
|
|
59035
59351
|
* @description get the list of most recent trades for a particular symbol
|
|
59352
|
+
* @see https://www.bitmex.com/api/explorer/#!/Trade/Trade_get
|
|
59036
59353
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
59037
59354
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
59038
59355
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
@@ -59253,6 +59570,7 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
59253
59570
|
* @method
|
|
59254
59571
|
* @name bitmex#cancelOrder
|
|
59255
59572
|
* @description cancels an open order
|
|
59573
|
+
* @see https://www.bitmex.com/api/explorer/#!/Order/Order_cancel
|
|
59256
59574
|
* @param {string} id order id
|
|
59257
59575
|
* @param {string} symbol not used by bitmex cancelOrder ()
|
|
59258
59576
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -59284,6 +59602,7 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
59284
59602
|
* @method
|
|
59285
59603
|
* @name bitmex#cancelOrders
|
|
59286
59604
|
* @description cancel multiple orders
|
|
59605
|
+
* @see https://www.bitmex.com/api/explorer/#!/Order/Order_cancel
|
|
59287
59606
|
* @param {string[]} ids order ids
|
|
59288
59607
|
* @param {string} symbol not used by bitmex cancelOrders ()
|
|
59289
59608
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -59309,6 +59628,7 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
59309
59628
|
* @method
|
|
59310
59629
|
* @name bitmex#cancelAllOrders
|
|
59311
59630
|
* @description cancel all open orders
|
|
59631
|
+
* @see https://www.bitmex.com/api/explorer/#!/Order/Order_cancelAll
|
|
59312
59632
|
* @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
|
|
59313
59633
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
59314
59634
|
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
@@ -59367,6 +59687,7 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
59367
59687
|
* @method
|
|
59368
59688
|
* @name bitmex#fetchPositions
|
|
59369
59689
|
* @description fetch all open positions
|
|
59690
|
+
* @see https://www.bitmex.com/api/explorer/#!/Position/Position_get
|
|
59370
59691
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
59371
59692
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
59372
59693
|
* @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
@@ -59625,6 +59946,7 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
59625
59946
|
* @method
|
|
59626
59947
|
* @name bitmex#withdraw
|
|
59627
59948
|
* @description make a withdrawal
|
|
59949
|
+
* @see https://www.bitmex.com/api/explorer/#!/User/User_requestWithdrawal
|
|
59628
59950
|
* @param {string} code unified currency code
|
|
59629
59951
|
* @param {float} amount the amount to withdraw
|
|
59630
59952
|
* @param {string} address the address to withdraw to
|
|
@@ -59672,6 +59994,7 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
59672
59994
|
* @method
|
|
59673
59995
|
* @name bitmex#fetchFundingRates
|
|
59674
59996
|
* @description fetch the funding rate for multiple markets
|
|
59997
|
+
* @see https://www.bitmex.com/api/explorer/#!/Instrument/Instrument_getActiveAndIndices
|
|
59675
59998
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
59676
59999
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
59677
60000
|
* @returns {object} a dictionary of [funding rates structures]{@link https://docs.ccxt.com/#/?id=funding-rates-structure}, indexe by market symbols
|
|
@@ -59723,6 +60046,7 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
59723
60046
|
* @method
|
|
59724
60047
|
* @name bitmex#fetchFundingRateHistory
|
|
59725
60048
|
* @description Fetches the history of funding rates
|
|
60049
|
+
* @see https://www.bitmex.com/api/explorer/#!/Funding/Funding_get
|
|
59726
60050
|
* @param {string} symbol unified symbol of the market to fetch the funding rate history for
|
|
59727
60051
|
* @param {int} [since] timestamp in ms of the earliest funding rate to fetch
|
|
59728
60052
|
* @param {int} [limit] the maximum amount of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-history-structure} to fetch
|
|
@@ -59806,6 +60130,7 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
59806
60130
|
* @method
|
|
59807
60131
|
* @name bitmex#setLeverage
|
|
59808
60132
|
* @description set the level of leverage for a market
|
|
60133
|
+
* @see https://www.bitmex.com/api/explorer/#!/Position/Position_updateLeverage
|
|
59809
60134
|
* @param {float} leverage the rate of leverage
|
|
59810
60135
|
* @param {string} symbol unified market symbol
|
|
59811
60136
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -59833,6 +60158,7 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
59833
60158
|
* @method
|
|
59834
60159
|
* @name bitmex#setMarginMode
|
|
59835
60160
|
* @description set margin mode to 'cross' or 'isolated'
|
|
60161
|
+
* @see https://www.bitmex.com/api/explorer/#!/Position/Position_isolateMargin
|
|
59836
60162
|
* @param {string} marginMode 'cross' or 'isolated'
|
|
59837
60163
|
* @param {string} symbol unified market symbol
|
|
59838
60164
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -82605,10 +82931,22 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
82605
82931
|
if (isStopLoss) {
|
|
82606
82932
|
const slTriggerPrice = this.safeValue2(stopLoss, 'triggerPrice', 'stopPrice', stopLoss);
|
|
82607
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
|
+
}
|
|
82608
82940
|
}
|
|
82609
82941
|
if (isTakeProfit) {
|
|
82610
82942
|
const tpTriggerPrice = this.safeValue2(takeProfit, 'triggerPrice', 'stopPrice', takeProfit);
|
|
82611
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
|
+
}
|
|
82612
82950
|
}
|
|
82613
82951
|
}
|
|
82614
82952
|
if (market['spot']) {
|
|
@@ -84890,9 +85228,6 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
84890
85228
|
if (timestamp === undefined) {
|
|
84891
85229
|
timestamp = this.safeIntegerN(position, ['updatedTime', 'updatedAt']);
|
|
84892
85230
|
}
|
|
84893
|
-
// default to cross of USDC margined positions
|
|
84894
|
-
const tradeMode = this.safeInteger(position, 'tradeMode', 0);
|
|
84895
|
-
const marginMode = tradeMode ? 'isolated' : 'cross';
|
|
84896
85231
|
let collateralString = this.safeString(position, 'positionBalance');
|
|
84897
85232
|
const entryPrice = this.omitZero(this.safeString2(position, 'entryPrice', 'avgPrice'));
|
|
84898
85233
|
const liquidationPrice = this.omitZero(this.safeString(position, 'liqPrice'));
|
|
@@ -84956,7 +85291,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
84956
85291
|
'markPrice': this.safeNumber(position, 'markPrice'),
|
|
84957
85292
|
'lastPrice': undefined,
|
|
84958
85293
|
'collateral': this.parseNumber(collateralString),
|
|
84959
|
-
'marginMode':
|
|
85294
|
+
'marginMode': undefined,
|
|
84960
85295
|
'side': side,
|
|
84961
85296
|
'percentage': undefined,
|
|
84962
85297
|
'stopLossPrice': this.safeNumber2(position, 'stop_loss', 'stopLoss'),
|
|
@@ -214808,8 +215143,8 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
214808
215143
|
},
|
|
214809
215144
|
'api': {
|
|
214810
215145
|
'ws': {
|
|
214811
|
-
'spot': 'wss://stream.binance.com/ws',
|
|
214812
|
-
'margin': 'wss://stream.binance.com/ws',
|
|
215146
|
+
'spot': 'wss://stream.binance.com:9443/ws',
|
|
215147
|
+
'margin': 'wss://stream.binance.com:9443/ws',
|
|
214813
215148
|
'future': 'wss://fstream.binance.com/ws',
|
|
214814
215149
|
'delivery': 'wss://dstream.binance.com/ws',
|
|
214815
215150
|
'ws': 'wss://ws-api.binance.com:443/ws-api/v3',
|
|
@@ -240393,9 +240728,11 @@ class gemini extends _gemini_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
240393
240728
|
'watchTicker': false,
|
|
240394
240729
|
'watchTickers': false,
|
|
240395
240730
|
'watchTrades': true,
|
|
240731
|
+
'watchTradesForSymbols': true,
|
|
240396
240732
|
'watchMyTrades': false,
|
|
240397
240733
|
'watchOrders': true,
|
|
240398
240734
|
'watchOrderBook': true,
|
|
240735
|
+
'watchOrderBookForSymbols': true,
|
|
240399
240736
|
'watchOHLCV': true,
|
|
240400
240737
|
},
|
|
240401
240738
|
'hostname': 'api.gemini.com',
|
|
@@ -240444,7 +240781,29 @@ class gemini extends _gemini_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
240444
240781
|
}
|
|
240445
240782
|
return this.filterBySinceLimit(trades, since, limit, 'timestamp', true);
|
|
240446
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
|
+
}
|
|
240447
240804
|
parseWsTrade(trade, market = undefined) {
|
|
240805
|
+
//
|
|
240806
|
+
// regular v2 trade
|
|
240448
240807
|
//
|
|
240449
240808
|
// {
|
|
240450
240809
|
// "type": "trade",
|
|
@@ -240456,11 +240815,31 @@ class gemini extends _gemini_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
240456
240815
|
// "side": "buy"
|
|
240457
240816
|
// }
|
|
240458
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
|
+
//
|
|
240459
240829
|
const timestamp = this.safeInteger(trade, 'timestamp');
|
|
240460
|
-
const id = this.
|
|
240830
|
+
const id = this.safeString2(trade, 'event_id', 'tid');
|
|
240461
240831
|
const priceString = this.safeString(trade, 'price');
|
|
240462
|
-
const amountString = this.
|
|
240463
|
-
|
|
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
|
+
}
|
|
240464
240843
|
const marketId = this.safeStringLower(trade, 'symbol');
|
|
240465
240844
|
const symbol = this.safeSymbol(marketId, market);
|
|
240466
240845
|
return this.safeTrade({
|
|
@@ -240560,6 +240939,34 @@ class gemini extends _gemini_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
240560
240939
|
client.resolve(stored, messageHash);
|
|
240561
240940
|
}
|
|
240562
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
|
+
}
|
|
240563
240970
|
async watchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
|
|
240564
240971
|
/**
|
|
240565
240972
|
* @method
|
|
@@ -240705,6 +241112,93 @@ class gemini extends _gemini_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
240705
241112
|
this.orderbooks[symbol] = orderbook;
|
|
240706
241113
|
client.resolve(orderbook, messageHash);
|
|
240707
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
|
+
}
|
|
240708
241202
|
handleL2Updates(client, message) {
|
|
240709
241203
|
//
|
|
240710
241204
|
// {
|
|
@@ -240785,6 +241279,7 @@ class gemini extends _gemini_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
240785
241279
|
// "socket_sequence": 7
|
|
240786
241280
|
// }
|
|
240787
241281
|
//
|
|
241282
|
+
client.lastPong = this.milliseconds();
|
|
240788
241283
|
return message;
|
|
240789
241284
|
}
|
|
240790
241285
|
handleSubscription(client, message) {
|
|
@@ -240987,6 +241482,33 @@ class gemini extends _gemini_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
240987
241482
|
if (method !== undefined) {
|
|
240988
241483
|
method.call(this, client, message);
|
|
240989
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
|
+
}
|
|
240990
241512
|
}
|
|
240991
241513
|
async authenticate(params = {}) {
|
|
240992
241514
|
const url = this.safeString(params, 'url');
|
|
@@ -290611,11 +291133,12 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
290611
291133
|
* @method
|
|
290612
291134
|
* @name woo#fetchOHLCV
|
|
290613
291135
|
* @see https://docs.woo.org/#kline-public
|
|
291136
|
+
* @see https://docs.woo.org/#kline-historical-data-public
|
|
290614
291137
|
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
290615
291138
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
290616
291139
|
* @param {string} timeframe the length of time each candle represents
|
|
290617
291140
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
290618
|
-
* @param {int} [limit]
|
|
291141
|
+
* @param {int} [limit] max=1000, max=100 when since is defined and is less than (now - (999 * (timeframe in ms)))
|
|
290619
291142
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
290620
291143
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
290621
291144
|
*/
|
|
@@ -290625,42 +291148,70 @@ class woo extends _abstract_woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
290625
291148
|
'symbol': market['id'],
|
|
290626
291149
|
'type': this.safeString(this.timeframes, timeframe, timeframe),
|
|
290627
291150
|
};
|
|
290628
|
-
|
|
291151
|
+
let useHistEndpoint = since !== undefined;
|
|
291152
|
+
if ((limit !== undefined) && (since !== undefined)) {
|
|
291153
|
+
const oneThousandCandles = this.parseTimeframe(timeframe) * 1000 * 999; // 999 because there will be delay between this and the request, causing the latest candle to be excluded sometimes
|
|
291154
|
+
const startWithLimit = this.milliseconds() - oneThousandCandles;
|
|
291155
|
+
useHistEndpoint = since < startWithLimit;
|
|
291156
|
+
}
|
|
291157
|
+
if (useHistEndpoint) {
|
|
291158
|
+
request['start_time'] = since;
|
|
291159
|
+
}
|
|
291160
|
+
else if (limit !== undefined) { // the hist endpoint does not accept limit
|
|
290629
291161
|
request['limit'] = Math.min(limit, 1000);
|
|
290630
291162
|
}
|
|
290631
|
-
|
|
290632
|
-
|
|
290633
|
-
|
|
290634
|
-
|
|
290635
|
-
|
|
290636
|
-
|
|
290637
|
-
|
|
290638
|
-
|
|
290639
|
-
|
|
290640
|
-
|
|
290641
|
-
|
|
290642
|
-
|
|
290643
|
-
|
|
290644
|
-
|
|
290645
|
-
|
|
290646
|
-
|
|
290647
|
-
|
|
290648
|
-
|
|
290649
|
-
|
|
290650
|
-
|
|
290651
|
-
|
|
290652
|
-
|
|
290653
|
-
|
|
290654
|
-
|
|
290655
|
-
|
|
290656
|
-
|
|
290657
|
-
|
|
290658
|
-
|
|
290659
|
-
|
|
290660
|
-
|
|
290661
|
-
|
|
290662
|
-
|
|
290663
|
-
|
|
291163
|
+
let response = undefined;
|
|
291164
|
+
if (!useHistEndpoint) {
|
|
291165
|
+
response = await this.v1PublicGetKline(this.extend(request, params));
|
|
291166
|
+
//
|
|
291167
|
+
// {
|
|
291168
|
+
// "success": true,
|
|
291169
|
+
// "rows": [
|
|
291170
|
+
// {
|
|
291171
|
+
// "open": "0.94238",
|
|
291172
|
+
// "close": "0.94271",
|
|
291173
|
+
// "low": "0.94238",
|
|
291174
|
+
// "high": "0.94296",
|
|
291175
|
+
// "volume": "73.55",
|
|
291176
|
+
// "amount": "69.32040520",
|
|
291177
|
+
// "symbol": "SPOT_WOO_USDT",
|
|
291178
|
+
// "type": "1m",
|
|
291179
|
+
// "start_timestamp": "1641584700000",
|
|
291180
|
+
// "end_timestamp": "1641584760000"
|
|
291181
|
+
// },
|
|
291182
|
+
// ...
|
|
291183
|
+
// ]
|
|
291184
|
+
// }
|
|
291185
|
+
//
|
|
291186
|
+
}
|
|
291187
|
+
else {
|
|
291188
|
+
response = await this.v1PubGetHistKline(this.extend(request, params));
|
|
291189
|
+
response = this.safeDict(response, 'data');
|
|
291190
|
+
//
|
|
291191
|
+
// {
|
|
291192
|
+
// "success": true,
|
|
291193
|
+
// "data": {
|
|
291194
|
+
// "rows": [
|
|
291195
|
+
// {
|
|
291196
|
+
// "symbol": "SPOT_BTC_USDT",
|
|
291197
|
+
// "open": 44181.40000000,
|
|
291198
|
+
// "close": 44174.29000000,
|
|
291199
|
+
// "high": 44193.44000000,
|
|
291200
|
+
// "low": 44148.34000000,
|
|
291201
|
+
// "volume": 110.11930100,
|
|
291202
|
+
// "amount": 4863796.24318878,
|
|
291203
|
+
// "type": "1m",
|
|
291204
|
+
// "start_timestamp": 1704153600000,
|
|
291205
|
+
// "end_timestamp": 1704153660000
|
|
291206
|
+
// },
|
|
291207
|
+
// ...
|
|
291208
|
+
// ]
|
|
291209
|
+
// }
|
|
291210
|
+
// }
|
|
291211
|
+
//
|
|
291212
|
+
}
|
|
291213
|
+
const rows = this.safeValue(response, 'rows', []);
|
|
291214
|
+
return this.parseOHLCVs(rows, market, timeframe, since, limit);
|
|
290664
291215
|
}
|
|
290665
291216
|
parseOHLCV(ohlcv, market = undefined) {
|
|
290666
291217
|
// example response in fetchOHLCV
|
|
@@ -301401,7 +301952,7 @@ SOFTWARE.
|
|
|
301401
301952
|
|
|
301402
301953
|
//-----------------------------------------------------------------------------
|
|
301403
301954
|
// this is updated by vss.js when building
|
|
301404
|
-
const version = '4.2.
|
|
301955
|
+
const version = '4.2.37';
|
|
301405
301956
|
_src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
|
|
301406
301957
|
//-----------------------------------------------------------------------------
|
|
301407
301958
|
|