ccxt 4.1.28 → 4.1.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/ccxt.browser.js +586 -62
- package/dist/ccxt.browser.min.js +9 -9
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/ws/Future.js +6 -2
- package/dist/cjs/src/bitget.js +286 -17
- package/dist/cjs/src/bitopro.js +5 -4
- package/dist/cjs/src/bitrue.js +33 -18
- package/dist/cjs/src/bybit.js +4 -0
- package/dist/cjs/src/cryptocom.js +32 -0
- package/dist/cjs/src/gate.js +58 -10
- package/dist/cjs/src/huobi.js +0 -1
- package/dist/cjs/src/huobijp.js +0 -1
- package/dist/cjs/src/krakenfutures.js +58 -4
- package/dist/cjs/src/mexc.js +95 -4
- package/dist/cjs/src/okx.js +1 -0
- package/dist/cjs/src/phemex.js +3 -0
- package/dist/cjs/src/pro/huobi.js +4 -0
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bybit.d.ts +1 -0
- package/js/src/abstract/okex.d.ts +1 -0
- package/js/src/abstract/okex5.d.ts +1 -0
- package/js/src/abstract/okx.d.ts +1 -0
- package/js/src/base/ws/Future.js +6 -2
- package/js/src/bitget.d.ts +12 -0
- package/js/src/bitget.js +286 -17
- package/js/src/bitopro.js +5 -4
- package/js/src/bitrue.js +33 -18
- package/js/src/bybit.js +4 -0
- package/js/src/cryptocom.d.ts +1 -0
- package/js/src/cryptocom.js +32 -0
- package/js/src/gate.js +58 -10
- package/js/src/huobi.js +0 -1
- package/js/src/huobijp.js +0 -1
- package/js/src/krakenfutures.d.ts +1 -1
- package/js/src/krakenfutures.js +58 -4
- package/js/src/mexc.d.ts +3 -1
- package/js/src/mexc.js +95 -4
- package/js/src/okx.js +1 -0
- package/js/src/phemex.js +3 -0
- package/js/src/pro/huobi.js +4 -0
- package/package.json +1 -1
package/dist/ccxt.browser.js
CHANGED
|
@@ -13647,11 +13647,15 @@ function createFuture() {
|
|
|
13647
13647
|
});
|
|
13648
13648
|
p.resolve = function _resolve() {
|
|
13649
13649
|
// eslint-disable-next-line prefer-rest-params
|
|
13650
|
-
|
|
13650
|
+
setTimeout(() => {
|
|
13651
|
+
resolve.apply(this, arguments);
|
|
13652
|
+
});
|
|
13651
13653
|
};
|
|
13652
13654
|
p.reject = function _reject() {
|
|
13653
13655
|
// eslint-disable-next-line prefer-rest-params
|
|
13654
|
-
|
|
13656
|
+
setTimeout(() => {
|
|
13657
|
+
reject.apply(this, arguments);
|
|
13658
|
+
});
|
|
13655
13659
|
};
|
|
13656
13660
|
return p;
|
|
13657
13661
|
}
|
|
@@ -38823,7 +38827,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
38823
38827
|
'has': {
|
|
38824
38828
|
'CORS': undefined,
|
|
38825
38829
|
'spot': true,
|
|
38826
|
-
'margin':
|
|
38830
|
+
'margin': true,
|
|
38827
38831
|
'swap': true,
|
|
38828
38832
|
'future': true,
|
|
38829
38833
|
'option': false,
|
|
@@ -38838,6 +38842,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
38838
38842
|
'editOrder': true,
|
|
38839
38843
|
'fetchAccounts': false,
|
|
38840
38844
|
'fetchBalance': true,
|
|
38845
|
+
'fetchBorrowInterest': true,
|
|
38841
38846
|
'fetchBorrowRate': true,
|
|
38842
38847
|
'fetchBorrowRateHistories': false,
|
|
38843
38848
|
'fetchBorrowRateHistory': false,
|
|
@@ -40289,20 +40294,47 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
40289
40294
|
* @name bitget#fetchMarketLeverageTiers
|
|
40290
40295
|
* @description retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes for a single market
|
|
40291
40296
|
* @see https://bitgetlimited.github.io/apidoc/en/mix/#get-position-tier
|
|
40297
|
+
* @see https://bitgetlimited.github.io/apidoc/en/margin/#get-isolated-tier-data
|
|
40298
|
+
* @see https://bitgetlimited.github.io/apidoc/en/margin/#get-cross-tier-data
|
|
40292
40299
|
* @param {string} symbol unified market symbol
|
|
40293
40300
|
* @param {object} [params] extra parameters specific to the bitget api endpoint
|
|
40301
|
+
* @param {string} [params.marginMode] for spot margin 'cross' or 'isolated', default is 'isolated'
|
|
40302
|
+
* @param {string} [params.code] required for cross spot margin
|
|
40294
40303
|
* @returns {object} a [leverage tiers structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#leverage-tiers-structure}
|
|
40295
40304
|
*/
|
|
40296
40305
|
await this.loadMarkets();
|
|
40297
40306
|
const request = {};
|
|
40298
|
-
|
|
40299
|
-
|
|
40300
|
-
|
|
40307
|
+
const market = this.market(symbol);
|
|
40308
|
+
let type = undefined;
|
|
40309
|
+
[type, params] = this.handleMarketTypeAndParams('fetchMarketLeverageTiers', market, params);
|
|
40310
|
+
let response = undefined;
|
|
40311
|
+
let marginMode = undefined;
|
|
40312
|
+
[marginMode, params] = this.handleMarginModeAndParams('fetchMarketLeverageTiers', params, 'isolated');
|
|
40313
|
+
if ((type === 'swap') || (type === 'future')) {
|
|
40314
|
+
const marketId = market['id'];
|
|
40315
|
+
const parts = marketId.split('_');
|
|
40316
|
+
const productType = this.safeStringUpper(parts, 1);
|
|
40317
|
+
request['symbol'] = marketId;
|
|
40318
|
+
request['productType'] = productType;
|
|
40319
|
+
response = await this.publicMixGetMarketQueryPositionLever(this.extend(request, params));
|
|
40320
|
+
}
|
|
40321
|
+
else if (marginMode === 'isolated') {
|
|
40322
|
+
request['symbol'] = market['info']['symbolName'];
|
|
40323
|
+
response = await this.publicMarginGetIsolatedPublicTierData(this.extend(request, params));
|
|
40324
|
+
}
|
|
40325
|
+
else if (marginMode === 'cross') {
|
|
40326
|
+
const code = this.safeString(params, 'code');
|
|
40327
|
+
this.checkRequiredArgument('fetchMarketLeverageTiers', code, 'code');
|
|
40328
|
+
params = this.omit(params, 'code');
|
|
40329
|
+
const currency = this.currency(code);
|
|
40330
|
+
request['coin'] = currency['code'];
|
|
40331
|
+
response = await this.publicMarginGetCrossPublicTierData(this.extend(request, params));
|
|
40332
|
+
}
|
|
40333
|
+
else {
|
|
40301
40334
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest(this.id + ' fetchMarketLeverageTiers() symbol does not support market ' + symbol);
|
|
40302
40335
|
}
|
|
40303
|
-
|
|
40304
|
-
|
|
40305
|
-
const response = await this.publicMixGetMarketQueryPositionLever(this.extend(request, params));
|
|
40336
|
+
//
|
|
40337
|
+
// swap and future
|
|
40306
40338
|
//
|
|
40307
40339
|
// {
|
|
40308
40340
|
// "code":"00000",
|
|
@@ -40319,10 +40351,50 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
40319
40351
|
// "requestTime":1627292076687
|
|
40320
40352
|
// }
|
|
40321
40353
|
//
|
|
40322
|
-
|
|
40354
|
+
// isolated
|
|
40355
|
+
//
|
|
40356
|
+
// {
|
|
40357
|
+
// "code": "00000",
|
|
40358
|
+
// "msg": "success",
|
|
40359
|
+
// "requestTime": 1698352496622,
|
|
40360
|
+
// "data": [
|
|
40361
|
+
// {
|
|
40362
|
+
// "tier": "1",
|
|
40363
|
+
// "symbol": "BTCUSDT",
|
|
40364
|
+
// "leverage": "10",
|
|
40365
|
+
// "baseCoin": "BTC",
|
|
40366
|
+
// "quoteCoin": "USDT",
|
|
40367
|
+
// "baseMaxBorrowableAmount": "3",
|
|
40368
|
+
// "quoteMaxBorrowableAmount": "30000",
|
|
40369
|
+
// "maintainMarginRate": "0.05",
|
|
40370
|
+
// "initRate": "0.1111"
|
|
40371
|
+
// },
|
|
40372
|
+
// ]
|
|
40373
|
+
// }
|
|
40374
|
+
//
|
|
40375
|
+
// cross
|
|
40376
|
+
//
|
|
40377
|
+
// {
|
|
40378
|
+
// "code": "00000",
|
|
40379
|
+
// "msg": "success",
|
|
40380
|
+
// "requestTime": 1698352997077,
|
|
40381
|
+
// "data": [
|
|
40382
|
+
// {
|
|
40383
|
+
// "tier": "1",
|
|
40384
|
+
// "leverage": "3",
|
|
40385
|
+
// "coin": "BTC",
|
|
40386
|
+
// "maxBorrowableAmount": "26",
|
|
40387
|
+
// "maintainMarginRate": "0.1"
|
|
40388
|
+
// }
|
|
40389
|
+
// ]
|
|
40390
|
+
// }
|
|
40391
|
+
//
|
|
40392
|
+
const result = this.safeValue(response, 'data', []);
|
|
40323
40393
|
return this.parseMarketLeverageTiers(result, market);
|
|
40324
40394
|
}
|
|
40325
40395
|
parseMarketLeverageTiers(info, market = undefined) {
|
|
40396
|
+
//
|
|
40397
|
+
// swap and future
|
|
40326
40398
|
//
|
|
40327
40399
|
// [
|
|
40328
40400
|
// {
|
|
@@ -40332,22 +40404,57 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
40332
40404
|
// "leverage": 125,
|
|
40333
40405
|
// "keepMarginRate": "0.004"
|
|
40334
40406
|
// }
|
|
40335
|
-
// ]
|
|
40407
|
+
// ]
|
|
40408
|
+
//
|
|
40409
|
+
// isolated
|
|
40410
|
+
//
|
|
40411
|
+
// [
|
|
40412
|
+
// {
|
|
40413
|
+
// "tier": "1",
|
|
40414
|
+
// "symbol": "BTCUSDT",
|
|
40415
|
+
// "leverage": "10",
|
|
40416
|
+
// "baseCoin": "BTC",
|
|
40417
|
+
// "quoteCoin": "USDT",
|
|
40418
|
+
// "baseMaxBorrowableAmount": "3",
|
|
40419
|
+
// "quoteMaxBorrowableAmount": "30000",
|
|
40420
|
+
// "maintainMarginRate": "0.05",
|
|
40421
|
+
// "initRate": "0.1111"
|
|
40422
|
+
// }
|
|
40423
|
+
// ]
|
|
40424
|
+
//
|
|
40425
|
+
// cross
|
|
40426
|
+
//
|
|
40427
|
+
// [
|
|
40428
|
+
// {
|
|
40429
|
+
// "tier": "1",
|
|
40430
|
+
// "leverage": "3",
|
|
40431
|
+
// "coin": "BTC",
|
|
40432
|
+
// "maxBorrowableAmount": "26",
|
|
40433
|
+
// "maintainMarginRate": "0.1"
|
|
40434
|
+
// }
|
|
40435
|
+
// ]
|
|
40336
40436
|
//
|
|
40337
40437
|
const tiers = [];
|
|
40438
|
+
let minNotional = 0;
|
|
40338
40439
|
for (let i = 0; i < info.length; i++) {
|
|
40339
40440
|
const item = info[i];
|
|
40340
|
-
const
|
|
40341
|
-
|
|
40441
|
+
const minimumNotional = this.safeNumber(item, 'startUnit');
|
|
40442
|
+
if (minimumNotional !== undefined) {
|
|
40443
|
+
minNotional = minimumNotional;
|
|
40444
|
+
}
|
|
40445
|
+
const maxNotional = this.safeNumberN(item, ['endUnit', 'maxBorrowableAmount', 'baseMaxBorrowableAmount']);
|
|
40446
|
+
const marginCurrency = this.safeString2(item, 'coin', 'baseCoin');
|
|
40447
|
+
const currencyId = (marginCurrency !== undefined) ? marginCurrency : market['base'];
|
|
40342
40448
|
tiers.push({
|
|
40343
|
-
'tier': this.
|
|
40344
|
-
'currency':
|
|
40449
|
+
'tier': this.safeInteger2(item, 'level', 'tier'),
|
|
40450
|
+
'currency': this.safeCurrencyCode(currencyId),
|
|
40345
40451
|
'minNotional': minNotional,
|
|
40346
40452
|
'maxNotional': maxNotional,
|
|
40347
|
-
'maintenanceMarginRate': this.
|
|
40453
|
+
'maintenanceMarginRate': this.safeNumber2(item, 'keepMarginRate', 'maintainMarginRate'),
|
|
40348
40454
|
'maxLeverage': this.safeNumber(item, 'leverage'),
|
|
40349
40455
|
'info': item,
|
|
40350
40456
|
});
|
|
40457
|
+
minNotional = maxNotional;
|
|
40351
40458
|
}
|
|
40352
40459
|
return tiers;
|
|
40353
40460
|
}
|
|
@@ -42129,12 +42236,16 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
42129
42236
|
* @description create a list of trade orders (all orders should be of the same symbol)
|
|
42130
42237
|
* @see https://bitgetlimited.github.io/apidoc/en/spot/#batch-order
|
|
42131
42238
|
* @see https://bitgetlimited.github.io/apidoc/en/mix/#batch-order
|
|
42239
|
+
* @see https://bitgetlimited.github.io/apidoc/en/margin/#isolated-batch-order
|
|
42240
|
+
* @see https://bitgetlimited.github.io/apidoc/en/margin/#cross-batch-order
|
|
42132
42241
|
* @param {array} orders list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
|
|
42242
|
+
* @param {object} [params] extra parameters specific to the api endpoint
|
|
42133
42243
|
* @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
42134
42244
|
*/
|
|
42135
42245
|
await this.loadMarkets();
|
|
42136
42246
|
const ordersRequests = [];
|
|
42137
42247
|
let symbol = undefined;
|
|
42248
|
+
let marginMode = undefined;
|
|
42138
42249
|
for (let i = 0; i < orders.length; i++) {
|
|
42139
42250
|
const rawOrder = orders[i];
|
|
42140
42251
|
const marketId = this.safeString(rawOrder, 'symbol');
|
|
@@ -42151,23 +42262,44 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
42151
42262
|
const amount = this.safeValue(rawOrder, 'amount');
|
|
42152
42263
|
const price = this.safeValue(rawOrder, 'price');
|
|
42153
42264
|
const orderParams = this.safeValue(rawOrder, 'params', {});
|
|
42265
|
+
const marginResult = this.handleMarginModeAndParams('createOrders', params);
|
|
42266
|
+
const currentMarginMode = marginResult[0];
|
|
42267
|
+
if (currentMarginMode !== undefined) {
|
|
42268
|
+
if (marginMode === undefined) {
|
|
42269
|
+
marginMode = currentMarginMode;
|
|
42270
|
+
}
|
|
42271
|
+
else {
|
|
42272
|
+
if (marginMode !== currentMarginMode) {
|
|
42273
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest(this.id + ' createOrders() requires all orders to have the same margin mode (isolated or cross)');
|
|
42274
|
+
}
|
|
42275
|
+
}
|
|
42276
|
+
}
|
|
42154
42277
|
const orderRequest = this.createOrderRequest(marketId, type, side, amount, price, orderParams);
|
|
42155
42278
|
ordersRequests.push(orderRequest);
|
|
42156
42279
|
}
|
|
42157
42280
|
const market = this.market(symbol);
|
|
42281
|
+
const symbolRequest = (marginMode !== undefined) ? (market['info']['symbolName']) : (market['id']);
|
|
42158
42282
|
const request = {
|
|
42159
|
-
'symbol':
|
|
42283
|
+
'symbol': symbolRequest,
|
|
42160
42284
|
};
|
|
42161
42285
|
let response = undefined;
|
|
42162
42286
|
if (market['spot']) {
|
|
42163
42287
|
request['orderList'] = ordersRequests;
|
|
42164
|
-
response = await this.privateSpotPostTradeBatchOrders(request);
|
|
42165
42288
|
}
|
|
42166
|
-
|
|
42289
|
+
if ((market['swap']) || (market['future'])) {
|
|
42167
42290
|
request['orderDataList'] = ordersRequests;
|
|
42168
42291
|
request['marginCoin'] = market['settleId'];
|
|
42169
42292
|
response = await this.privateMixPostOrderBatchOrders(request);
|
|
42170
42293
|
}
|
|
42294
|
+
else if (marginMode === 'isolated') {
|
|
42295
|
+
response = await this.privateMarginPostIsolatedOrderBatchPlaceOrder(request);
|
|
42296
|
+
}
|
|
42297
|
+
else if (marginMode === 'cross') {
|
|
42298
|
+
response = await this.privateMarginPostCrossOrderBatchPlaceOrder(request);
|
|
42299
|
+
}
|
|
42300
|
+
else {
|
|
42301
|
+
response = await this.privateSpotPostTradeBatchOrders(request);
|
|
42302
|
+
}
|
|
42171
42303
|
//
|
|
42172
42304
|
// {
|
|
42173
42305
|
// "code": "00000",
|
|
@@ -45172,6 +45304,147 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
45172
45304
|
'info': info,
|
|
45173
45305
|
};
|
|
45174
45306
|
}
|
|
45307
|
+
async fetchBorrowInterest(code = undefined, symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
45308
|
+
/**
|
|
45309
|
+
* @method
|
|
45310
|
+
* @name bitget#fetchBorrowInterest
|
|
45311
|
+
* @description fetch the interest owed by the user for borrowing currency for margin trading
|
|
45312
|
+
* @see https://bitgetlimited.github.io/apidoc/en/margin/#get-isolated-interest-records
|
|
45313
|
+
* @see https://bitgetlimited.github.io/apidoc/en/margin/#get-cross-interest-records
|
|
45314
|
+
* @param {string} [code] unified currency code
|
|
45315
|
+
* @param {string} [symbol] unified market symbol when fetching interest in isolated markets
|
|
45316
|
+
* @param {int} [since] the earliest time in ms to fetch borrow interest for
|
|
45317
|
+
* @param {int} [limit] the maximum number of structures to retrieve
|
|
45318
|
+
* @param {object} [params] extra parameters specific to the bitget api endpoint
|
|
45319
|
+
* @returns {object[]} a list of [borrow interest structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#borrow-interest-structure}
|
|
45320
|
+
*/
|
|
45321
|
+
await this.loadMarkets();
|
|
45322
|
+
let market = undefined;
|
|
45323
|
+
if (symbol !== undefined) {
|
|
45324
|
+
market = this.market(symbol);
|
|
45325
|
+
}
|
|
45326
|
+
const request = {};
|
|
45327
|
+
let currency = undefined;
|
|
45328
|
+
if (code !== undefined) {
|
|
45329
|
+
currency = this.currency(code);
|
|
45330
|
+
request['coin'] = currency['id'];
|
|
45331
|
+
}
|
|
45332
|
+
if (since !== undefined) {
|
|
45333
|
+
request['startTime'] = since;
|
|
45334
|
+
}
|
|
45335
|
+
else {
|
|
45336
|
+
request['startTime'] = this.milliseconds() - 7776000000;
|
|
45337
|
+
}
|
|
45338
|
+
if (limit !== undefined) {
|
|
45339
|
+
request['pageSize'] = limit;
|
|
45340
|
+
}
|
|
45341
|
+
let response = undefined;
|
|
45342
|
+
let marginMode = undefined;
|
|
45343
|
+
[marginMode, params] = this.handleMarginModeAndParams('fetchBorrowInterest', params, 'cross');
|
|
45344
|
+
if (marginMode === 'isolated') {
|
|
45345
|
+
this.checkRequiredSymbol('fetchBorrowInterest', symbol);
|
|
45346
|
+
request['symbol'] = market['info']['symbolName'];
|
|
45347
|
+
response = await this.privateMarginGetIsolatedInterestList(this.extend(request, params));
|
|
45348
|
+
}
|
|
45349
|
+
else if (marginMode === 'cross') {
|
|
45350
|
+
response = await this.privateMarginGetCrossInterestList(this.extend(request, params));
|
|
45351
|
+
}
|
|
45352
|
+
//
|
|
45353
|
+
// isolated
|
|
45354
|
+
//
|
|
45355
|
+
// {
|
|
45356
|
+
// "code": "00000",
|
|
45357
|
+
// "msg": "success",
|
|
45358
|
+
// "requestTime": 1698282523888,
|
|
45359
|
+
// "data": {
|
|
45360
|
+
// "resultList": [
|
|
45361
|
+
// {
|
|
45362
|
+
// "interestId": "1100560904468705284",
|
|
45363
|
+
// "interestCoin": "USDT",
|
|
45364
|
+
// "interestRate": "0.000126279",
|
|
45365
|
+
// "loanCoin": "USDT",
|
|
45366
|
+
// "amount": "0.00000298",
|
|
45367
|
+
// "type": "scheduled",
|
|
45368
|
+
// "symbol": "BTCUSDT",
|
|
45369
|
+
// "ctime": "1698120000000"
|
|
45370
|
+
// },
|
|
45371
|
+
// ],
|
|
45372
|
+
// "maxId": "1100560904468705284",
|
|
45373
|
+
// "minId": "1096915487398965249"
|
|
45374
|
+
// }
|
|
45375
|
+
// }
|
|
45376
|
+
//
|
|
45377
|
+
// cross
|
|
45378
|
+
//
|
|
45379
|
+
// {
|
|
45380
|
+
// "code": "00000",
|
|
45381
|
+
// "msg": "success",
|
|
45382
|
+
// "requestTime": 1698282552126,
|
|
45383
|
+
// "data": {
|
|
45384
|
+
// "resultList": [
|
|
45385
|
+
// {
|
|
45386
|
+
// "interestId": "1099126154352799744",
|
|
45387
|
+
// "interestCoin": "USDT",
|
|
45388
|
+
// "interestRate": "0.000126279",
|
|
45389
|
+
// "loanCoin": "USDT",
|
|
45390
|
+
// "amount": "0.00002631",
|
|
45391
|
+
// "type": "scheduled",
|
|
45392
|
+
// "ctime": "1697778000000"
|
|
45393
|
+
// },
|
|
45394
|
+
// ],
|
|
45395
|
+
// "maxId": "1099126154352799744",
|
|
45396
|
+
// "minId": "1096917004629716993"
|
|
45397
|
+
// }
|
|
45398
|
+
// }
|
|
45399
|
+
//
|
|
45400
|
+
const data = this.safeValue(response, 'data', {});
|
|
45401
|
+
const rows = this.safeValue(data, 'resultList', []);
|
|
45402
|
+
const interest = this.parseBorrowInterests(rows, market);
|
|
45403
|
+
return this.filterByCurrencySinceLimit(interest, code, since, limit);
|
|
45404
|
+
}
|
|
45405
|
+
parseBorrowInterest(info, market = undefined) {
|
|
45406
|
+
//
|
|
45407
|
+
// isolated
|
|
45408
|
+
//
|
|
45409
|
+
// {
|
|
45410
|
+
// "interestId": "1100560904468705284",
|
|
45411
|
+
// "interestCoin": "USDT",
|
|
45412
|
+
// "interestRate": "0.000126279",
|
|
45413
|
+
// "loanCoin": "USDT",
|
|
45414
|
+
// "amount": "0.00000298",
|
|
45415
|
+
// "type": "scheduled",
|
|
45416
|
+
// "symbol": "BTCUSDT",
|
|
45417
|
+
// "ctime": "1698120000000"
|
|
45418
|
+
// }
|
|
45419
|
+
//
|
|
45420
|
+
// cross
|
|
45421
|
+
//
|
|
45422
|
+
// {
|
|
45423
|
+
// "interestId": "1099126154352799744",
|
|
45424
|
+
// "interestCoin": "USDT",
|
|
45425
|
+
// "interestRate": "0.000126279",
|
|
45426
|
+
// "loanCoin": "USDT",
|
|
45427
|
+
// "amount": "0.00002631",
|
|
45428
|
+
// "type": "scheduled",
|
|
45429
|
+
// "ctime": "1697778000000"
|
|
45430
|
+
// }
|
|
45431
|
+
//
|
|
45432
|
+
const marketId = this.safeString(info, 'symbol');
|
|
45433
|
+
market = this.safeMarket(marketId, market);
|
|
45434
|
+
const marginMode = (marketId !== undefined) ? 'isolated' : 'cross';
|
|
45435
|
+
const timestamp = this.safeInteger(info, 'ctime');
|
|
45436
|
+
return {
|
|
45437
|
+
'symbol': this.safeString(market, 'symbol'),
|
|
45438
|
+
'marginMode': marginMode,
|
|
45439
|
+
'currency': this.safeCurrencyCode(this.safeString(info, 'interestCoin')),
|
|
45440
|
+
'interest': this.safeNumber(info, 'amount'),
|
|
45441
|
+
'interestRate': this.safeNumber(info, 'interestRate'),
|
|
45442
|
+
'amountBorrowed': undefined,
|
|
45443
|
+
'timestamp': timestamp,
|
|
45444
|
+
'datetime': this.iso8601(timestamp),
|
|
45445
|
+
'info': info,
|
|
45446
|
+
};
|
|
45447
|
+
}
|
|
45175
45448
|
handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
|
|
45176
45449
|
if (!response) {
|
|
45177
45450
|
return undefined; // fallback to default error handler
|
|
@@ -54425,14 +54698,15 @@ class bitopro extends _abstract_bitopro_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
54425
54698
|
const request = {
|
|
54426
54699
|
// 'pair': market['id'], // optional
|
|
54427
54700
|
};
|
|
54428
|
-
|
|
54429
|
-
let method = this.safeString(this.options, 'privateDeleteOrdersPair', 'privateDeleteOrdersAll');
|
|
54701
|
+
let response = undefined;
|
|
54430
54702
|
if (symbol !== undefined) {
|
|
54431
54703
|
const market = this.market(symbol);
|
|
54432
54704
|
request['pair'] = market['id'];
|
|
54433
|
-
|
|
54705
|
+
response = await this.privateDeleteOrdersPair(this.extend(request, params));
|
|
54706
|
+
}
|
|
54707
|
+
else {
|
|
54708
|
+
response = await this.privateDeleteOrdersAll(this.extend(request, params));
|
|
54434
54709
|
}
|
|
54435
|
-
const response = await this[method](this.extend(request, params));
|
|
54436
54710
|
const result = this.safeValue(response, 'data', {});
|
|
54437
54711
|
//
|
|
54438
54712
|
// {
|
|
@@ -57838,6 +58112,16 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
57838
58112
|
return orderbook;
|
|
57839
58113
|
}
|
|
57840
58114
|
parseTicker(ticker, market = undefined) {
|
|
58115
|
+
//
|
|
58116
|
+
// fetchBidsAsks
|
|
58117
|
+
//
|
|
58118
|
+
// {
|
|
58119
|
+
// "symbol": "LTCBTC",
|
|
58120
|
+
// "bidPrice": "4.00000000",
|
|
58121
|
+
// "bidQty": "431.00000000",
|
|
58122
|
+
// "askPrice": "4.00000200",
|
|
58123
|
+
// "askQty": "9.00000000"
|
|
58124
|
+
// }
|
|
57841
58125
|
//
|
|
57842
58126
|
// fetchTicker
|
|
57843
58127
|
//
|
|
@@ -57862,10 +58146,10 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
57862
58146
|
'datetime': undefined,
|
|
57863
58147
|
'high': this.safeString(ticker, 'high24hr'),
|
|
57864
58148
|
'low': this.safeString(ticker, 'low24hr'),
|
|
57865
|
-
'bid': this.
|
|
57866
|
-
'bidVolume':
|
|
57867
|
-
'ask': this.
|
|
57868
|
-
'askVolume':
|
|
58149
|
+
'bid': this.safeString2(ticker, 'highestBid', 'bidPrice'),
|
|
58150
|
+
'bidVolume': this.safeString(ticker, 'bidQty'),
|
|
58151
|
+
'ask': this.safeString2(ticker, 'lowestAsk', 'askPrice'),
|
|
58152
|
+
'askVolume': this.safeString(ticker, 'askQty'),
|
|
57869
58153
|
'vwap': undefined,
|
|
57870
58154
|
'open': undefined,
|
|
57871
58155
|
'close': last,
|
|
@@ -57993,26 +58277,31 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
57993
58277
|
* @method
|
|
57994
58278
|
* @name bitrue#fetchBidsAsks
|
|
57995
58279
|
* @description fetches the bid and ask price and volume for multiple markets
|
|
58280
|
+
* @see https://github.com/Bitrue-exchange/Spot-official-api-docs#symbol-order-book-ticker
|
|
57996
58281
|
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the bids and asks for, all markets are returned if not assigned
|
|
57997
58282
|
* @param {object} [params] extra parameters specific to the bitrue api endpoint
|
|
57998
58283
|
* @returns {object} a dictionary of [ticker structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#ticker-structure}
|
|
57999
58284
|
*/
|
|
58000
58285
|
await this.loadMarkets();
|
|
58001
|
-
|
|
58002
|
-
|
|
58003
|
-
const
|
|
58004
|
-
|
|
58005
|
-
|
|
58006
|
-
|
|
58007
|
-
|
|
58008
|
-
else if (type === 'delivery') {
|
|
58009
|
-
method = 'dapiPublicGetTickerBookTicker';
|
|
58010
|
-
}
|
|
58011
|
-
else {
|
|
58012
|
-
method = 'publicGetTickerBookTicker';
|
|
58286
|
+
symbols = this.marketSymbols(symbols);
|
|
58287
|
+
let market = undefined;
|
|
58288
|
+
const request = {};
|
|
58289
|
+
if (symbols !== undefined) {
|
|
58290
|
+
const first = this.safeString(symbols, 0);
|
|
58291
|
+
market = this.market(first);
|
|
58292
|
+
request['symbol'] = market['id'];
|
|
58013
58293
|
}
|
|
58014
|
-
const response = await this
|
|
58015
|
-
|
|
58294
|
+
const response = await this.v1PublicGetTickerBookTicker(this.extend(request, params));
|
|
58295
|
+
// {
|
|
58296
|
+
// "symbol": "LTCBTC",
|
|
58297
|
+
// "bidPrice": "4.00000000",
|
|
58298
|
+
// "bidQty": "431.00000000",
|
|
58299
|
+
// "askPrice": "4.00000200",
|
|
58300
|
+
// "askQty": "9.00000000"
|
|
58301
|
+
// }
|
|
58302
|
+
const data = {};
|
|
58303
|
+
data[market['id']] = response;
|
|
58304
|
+
return this.parseTickers(data, symbols);
|
|
58016
58305
|
}
|
|
58017
58306
|
async fetchTickers(symbols = undefined, params = {}) {
|
|
58018
58307
|
/**
|
|
@@ -74231,6 +74520,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
74231
74520
|
'v5/position/trading-stop': 5,
|
|
74232
74521
|
'v5/position/set-auto-add-margin': 2.5,
|
|
74233
74522
|
'v5/position/add-margin': 2.5,
|
|
74523
|
+
'v5/position/confirm-pending-mmr': 2.5,
|
|
74234
74524
|
// account
|
|
74235
74525
|
'v5/account/upgrade-to-uta': 2.5,
|
|
74236
74526
|
'v5/account/set-margin-mode': 2.5,
|
|
@@ -76804,8 +77094,11 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
76804
77094
|
// "time": 1672125441042
|
|
76805
77095
|
// }
|
|
76806
77096
|
//
|
|
77097
|
+
const timestamp = this.safeInteger(response, 'time');
|
|
76807
77098
|
const result = {
|
|
76808
77099
|
'info': response,
|
|
77100
|
+
'timestamp': timestamp,
|
|
77101
|
+
'datetime': this.iso8601(timestamp),
|
|
76809
77102
|
};
|
|
76810
77103
|
const responseResult = this.safeValue(response, 'result', {});
|
|
76811
77104
|
const currencyList = this.safeValueN(responseResult, ['loanAccountList', 'list', 'balance']);
|
|
@@ -99082,6 +99375,7 @@ class cryptocom extends _abstract_cryptocom_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
99082
99375
|
'borrowMargin': true,
|
|
99083
99376
|
'cancelAllOrders': true,
|
|
99084
99377
|
'cancelOrder': true,
|
|
99378
|
+
'cancelOrders': true,
|
|
99085
99379
|
'createOrder': true,
|
|
99086
99380
|
'createOrders': true,
|
|
99087
99381
|
'fetchAccounts': true,
|
|
@@ -100476,6 +100770,37 @@ class cryptocom extends _abstract_cryptocom_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
100476
100770
|
const result = this.safeValue(response, 'result', {});
|
|
100477
100771
|
return this.parseOrder(result, market);
|
|
100478
100772
|
}
|
|
100773
|
+
async cancelOrders(ids, symbol = undefined, params = {}) {
|
|
100774
|
+
/**
|
|
100775
|
+
* @method
|
|
100776
|
+
* @name cryptocom#cancelOrders
|
|
100777
|
+
* @description cancel multiple orders
|
|
100778
|
+
* @see https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-cancel-order-list-list
|
|
100779
|
+
* @param {string[]} ids order ids
|
|
100780
|
+
* @param {string} symbol unified market symbol
|
|
100781
|
+
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
100782
|
+
* @returns {object} an list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
100783
|
+
*/
|
|
100784
|
+
this.checkRequiredSymbol('cancelOrders', symbol);
|
|
100785
|
+
await this.loadMarkets();
|
|
100786
|
+
const market = this.market(symbol);
|
|
100787
|
+
const orderRequests = [];
|
|
100788
|
+
for (let i = 0; i < ids.length; i++) {
|
|
100789
|
+
const id = ids[i];
|
|
100790
|
+
const order = {
|
|
100791
|
+
'instrument_name': market['id'],
|
|
100792
|
+
'order_id': id.toString(),
|
|
100793
|
+
};
|
|
100794
|
+
orderRequests.push(order);
|
|
100795
|
+
}
|
|
100796
|
+
const request = {
|
|
100797
|
+
'contingency_type': 'LIST',
|
|
100798
|
+
'order_list': orderRequests,
|
|
100799
|
+
};
|
|
100800
|
+
const response = await this.v1PrivatePostPrivateCancelOrderList(this.extend(request, params));
|
|
100801
|
+
const result = this.safeValue(response, 'result', []);
|
|
100802
|
+
return this.parseOrders(result, market, undefined, undefined, params);
|
|
100803
|
+
}
|
|
100479
100804
|
async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
100480
100805
|
/**
|
|
100481
100806
|
* @method
|
|
@@ -118706,6 +119031,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
118706
119031
|
* @method
|
|
118707
119032
|
* @name gate#fetchCurrencies
|
|
118708
119033
|
* @description fetches all available currencies on an exchange
|
|
119034
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#list-all-currencies-details
|
|
118709
119035
|
* @param {object} [params] extra parameters specific to the gate api endpoint
|
|
118710
119036
|
* @returns {object} an associative dictionary of currencies
|
|
118711
119037
|
*/
|
|
@@ -118816,6 +119142,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
118816
119142
|
* @method
|
|
118817
119143
|
* @name gate#fetchFundingRate
|
|
118818
119144
|
* @description fetch the current funding rate
|
|
119145
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#get-a-single-contract
|
|
118819
119146
|
* @param {string} symbol unified market symbol
|
|
118820
119147
|
* @param {object} [params] extra parameters specific to the gate api endpoint
|
|
118821
119148
|
* @returns {object} a [funding rate structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-structure}
|
|
@@ -118878,6 +119205,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
118878
119205
|
* @method
|
|
118879
119206
|
* @name gate#fetchFundingRates
|
|
118880
119207
|
* @description fetch the funding rate for multiple markets
|
|
119208
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#list-all-futures-contracts
|
|
118881
119209
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
118882
119210
|
* @param {object} [params] extra parameters specific to the gate api endpoint
|
|
118883
119211
|
* @returns {object} a dictionary of [funding rates structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rates-structure}, indexe by market symbols
|
|
@@ -119344,6 +119672,8 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
119344
119672
|
* @method
|
|
119345
119673
|
* @name gate#fetchFundingHistory
|
|
119346
119674
|
* @description fetch the history of funding payments paid and received on this account
|
|
119675
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#query-account-book-2
|
|
119676
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#query-account-book-3
|
|
119347
119677
|
* @param {string} symbol unified market symbol
|
|
119348
119678
|
* @param {int} [since] the earliest time in ms to fetch funding history for
|
|
119349
119679
|
* @param {int} [limit] the maximum number of funding history structures to retrieve
|
|
@@ -120044,6 +120374,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
120044
120374
|
* @method
|
|
120045
120375
|
* @name gate#fetchFundingRateHistory
|
|
120046
120376
|
* @description fetches historical funding rate prices
|
|
120377
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#funding-rate-history
|
|
120047
120378
|
* @param {string} symbol unified symbol of the market to fetch the funding rate history for
|
|
120048
120379
|
* @param {int} [since] timestamp in ms of the earliest funding rate to fetch
|
|
120049
120380
|
* @param {int} [limit] the maximum amount of [funding rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-history-structure} to fetch
|
|
@@ -120137,6 +120468,10 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
120137
120468
|
* @method
|
|
120138
120469
|
* @name gate#fetchTrades
|
|
120139
120470
|
* @description get the list of most recent trades for a particular symbol
|
|
120471
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#retrieve-market-trades
|
|
120472
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#futures-trading-history
|
|
120473
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#futures-trading-history-2
|
|
120474
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#options-trade-history
|
|
120140
120475
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
120141
120476
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
120142
120477
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
@@ -120240,6 +120575,10 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
120240
120575
|
* @method
|
|
120241
120576
|
* @name gate#fetchOrderTrades
|
|
120242
120577
|
* @description fetch all the trades made from a single order
|
|
120578
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#list-personal-trading-history
|
|
120579
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#list-personal-trading-history-2
|
|
120580
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#list-personal-trading-history-3
|
|
120581
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#list-personal-trading-history-4
|
|
120243
120582
|
* @param {string} id order id
|
|
120244
120583
|
* @param {string} symbol unified market symbol
|
|
120245
120584
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
@@ -120557,6 +120896,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
120557
120896
|
* @method
|
|
120558
120897
|
* @name gate#fetchDeposits
|
|
120559
120898
|
* @description fetch all deposits made to an account
|
|
120899
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#retrieve-deposit-records
|
|
120560
120900
|
* @param {string} code unified currency code
|
|
120561
120901
|
* @param {int} [since] the earliest time in ms to fetch deposits for
|
|
120562
120902
|
* @param {int} [limit] the maximum number of deposits structures to retrieve
|
|
@@ -120594,6 +120934,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
120594
120934
|
* @method
|
|
120595
120935
|
* @name gate#fetchWithdrawals
|
|
120596
120936
|
* @description fetch all withdrawals made from an account
|
|
120937
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#retrieve-withdrawal-records
|
|
120597
120938
|
* @param {string} code unified currency code
|
|
120598
120939
|
* @param {int} [since] the earliest time in ms to fetch withdrawals for
|
|
120599
120940
|
* @param {int} [limit] the maximum number of withdrawals structures to retrieve
|
|
@@ -120631,6 +120972,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
120631
120972
|
* @method
|
|
120632
120973
|
* @name gate#withdraw
|
|
120633
120974
|
* @description make a withdrawal
|
|
120975
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#withdraw
|
|
120634
120976
|
* @param {string} code unified currency code
|
|
120635
120977
|
* @param {float} amount the amount to withdraw
|
|
120636
120978
|
* @param {string} address the address to withdraw to
|
|
@@ -120777,6 +121119,13 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
120777
121119
|
* @method
|
|
120778
121120
|
* @name gate#createOrder
|
|
120779
121121
|
* @description Create an order on the exchange
|
|
121122
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#create-an-order
|
|
121123
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#create-a-price-triggered-order
|
|
121124
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#create-a-futures-order
|
|
121125
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#create-a-price-triggered-order-2
|
|
121126
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#create-a-futures-order-2
|
|
121127
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#create-a-price-triggered-order-3
|
|
121128
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#create-an-options-order
|
|
120780
121129
|
* @param {string} symbol Unified CCXT market symbol
|
|
120781
121130
|
* @param {string} type 'limit' or 'market' *"market" is contract only*
|
|
120782
121131
|
* @param {string} side 'buy' or 'sell'
|
|
@@ -121589,6 +121938,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
121589
121938
|
* @method
|
|
121590
121939
|
* @name gate#fetchOpenOrders
|
|
121591
121940
|
* @description fetch all unfilled currently open orders
|
|
121941
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#list-all-open-orders
|
|
121592
121942
|
* @param {string} symbol unified market symbol
|
|
121593
121943
|
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
121594
121944
|
* @param {int} [limit] the maximum number of open orders structures to retrieve
|
|
@@ -121605,6 +121955,13 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
121605
121955
|
* @method
|
|
121606
121956
|
* @name gate#fetchClosedOrders
|
|
121607
121957
|
* @description fetches information on multiple closed orders made by the user
|
|
121958
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#list-orders
|
|
121959
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#retrieve-running-auto-order-list
|
|
121960
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#list-futures-orders
|
|
121961
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#list-all-auto-orders
|
|
121962
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#list-futures-orders-2
|
|
121963
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#list-all-auto-orders-2
|
|
121964
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#list-options-orders
|
|
121608
121965
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
121609
121966
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
121610
121967
|
* @param {int} [limit] the maximum number of orde structures to retrieve
|
|
@@ -121813,6 +122170,10 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
121813
122170
|
* @method
|
|
121814
122171
|
* @name gate#cancelOrder
|
|
121815
122172
|
* @description Cancels an open order
|
|
122173
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#cancel-a-single-order
|
|
122174
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#cancel-a-single-order-2
|
|
122175
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#cancel-a-single-order-3
|
|
122176
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#cancel-a-single-order-4
|
|
121816
122177
|
* @param {string} id Order id
|
|
121817
122178
|
* @param {string} symbol Unified market symbol
|
|
121818
122179
|
* @param {object} [params] Parameters specified by the exchange api
|
|
@@ -121923,6 +122284,10 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
121923
122284
|
* @method
|
|
121924
122285
|
* @name gate#cancelAllOrders
|
|
121925
122286
|
* @description cancel all open orders
|
|
122287
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#cancel-all-open-orders-in-specified-currency-pair
|
|
122288
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#cancel-all-open-orders-matched
|
|
122289
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#cancel-all-open-orders-matched-2
|
|
122290
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#cancel-all-open-orders-matched-3
|
|
121926
122291
|
* @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
|
|
121927
122292
|
* @param {object} [params] extra parameters specific to the gate api endpoint
|
|
121928
122293
|
* @returns {object[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
@@ -122054,6 +122419,8 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
122054
122419
|
* @method
|
|
122055
122420
|
* @name gate#setLeverage
|
|
122056
122421
|
* @description set the level of leverage for a market
|
|
122422
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#update-position-leverage
|
|
122423
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#update-position-leverage-2
|
|
122057
122424
|
* @param {float} leverage the rate of leverage
|
|
122058
122425
|
* @param {string} symbol unified market symbol
|
|
122059
122426
|
* @param {object} [params] extra parameters specific to the gate api endpoint
|
|
@@ -122418,6 +122785,8 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
122418
122785
|
* @method
|
|
122419
122786
|
* @name gate#fetchLeverageTiers
|
|
122420
122787
|
* @description retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes
|
|
122788
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#list-all-futures-contracts
|
|
122789
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#list-all-futures-contracts-2
|
|
122421
122790
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
122422
122791
|
* @param {object} [params] extra parameters specific to the gate api endpoint
|
|
122423
122792
|
* @returns {object} a dictionary of [leverage tiers structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#leverage-tiers-structure}, indexed by market symbols
|
|
@@ -122673,12 +123042,12 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
122673
123042
|
'currency': currency['id'],
|
|
122674
123043
|
'amount': this.currencyToPrecision(code, amount),
|
|
122675
123044
|
};
|
|
122676
|
-
let
|
|
123045
|
+
let response = undefined;
|
|
123046
|
+
params = this.omit(params, ['marginMode']);
|
|
122677
123047
|
if (symbol === undefined) {
|
|
122678
|
-
|
|
123048
|
+
response = await this.privateMarginPostCrossRepayments(this.extend(request, params));
|
|
122679
123049
|
}
|
|
122680
123050
|
else {
|
|
122681
|
-
method = 'privateMarginPostLoansLoanIdRepayment';
|
|
122682
123051
|
const market = this.market(symbol);
|
|
122683
123052
|
request['currency_pair'] = market['id'];
|
|
122684
123053
|
request['mode'] = 'partial';
|
|
@@ -122687,9 +123056,9 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
122687
123056
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' repayMargin() requires loan_id param for isolated margin');
|
|
122688
123057
|
}
|
|
122689
123058
|
request['loan_id'] = loanId;
|
|
123059
|
+
params = this.omit(params, ['loan_id', 'id']);
|
|
123060
|
+
response = await this.privateMarginPostLoansLoanIdRepayment(this.extend(request, params));
|
|
122690
123061
|
}
|
|
122691
|
-
params = this.omit(params, ['marginMode', 'loan_id', 'id']);
|
|
122692
|
-
let response = await this[method](this.extend(request, params));
|
|
122693
123062
|
//
|
|
122694
123063
|
// Cross
|
|
122695
123064
|
//
|
|
@@ -122756,9 +123125,9 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
122756
123125
|
'currency': currency['id'],
|
|
122757
123126
|
'amount': this.currencyToPrecision(code, amount),
|
|
122758
123127
|
};
|
|
122759
|
-
let
|
|
123128
|
+
let response = undefined;
|
|
122760
123129
|
if (symbol === undefined) {
|
|
122761
|
-
|
|
123130
|
+
response = await this.privateMarginPostCrossLoans(this.extend(request, params));
|
|
122762
123131
|
}
|
|
122763
123132
|
else {
|
|
122764
123133
|
const market = this.market(symbol);
|
|
@@ -122768,10 +123137,9 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
122768
123137
|
// as it is the smallest tick size currently offered by gateio
|
|
122769
123138
|
request['rate'] = this.safeString(params, 'rate', '0.0001');
|
|
122770
123139
|
request['auto_renew'] = true;
|
|
122771
|
-
|
|
123140
|
+
params = this.omit(params, ['rate']);
|
|
123141
|
+
response = await this.privateMarginPostLoans(this.extend(request, params));
|
|
122772
123142
|
}
|
|
122773
|
-
params = this.omit(params, ['marginMode', 'rate']);
|
|
122774
|
-
const response = await this[method](this.extend(request, params));
|
|
122775
123143
|
//
|
|
122776
123144
|
// Cross
|
|
122777
123145
|
//
|
|
@@ -122995,6 +123363,8 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
122995
123363
|
* @method
|
|
122996
123364
|
* @name gate#reduceMargin
|
|
122997
123365
|
* @description remove margin from a position
|
|
123366
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#update-position-margin
|
|
123367
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#update-position-margin-2
|
|
122998
123368
|
* @param {string} symbol unified market symbol
|
|
122999
123369
|
* @param {float} amount the amount of margin to remove
|
|
123000
123370
|
* @param {object} [params] extra parameters specific to the exmo api endpoint
|
|
@@ -123007,6 +123377,8 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
123007
123377
|
* @method
|
|
123008
123378
|
* @name gate#addMargin
|
|
123009
123379
|
* @description add margin
|
|
123380
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#update-position-margin
|
|
123381
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#update-position-margin-2
|
|
123010
123382
|
* @param {string} symbol unified market symbol
|
|
123011
123383
|
* @param {float} amount amount of margin to add
|
|
123012
123384
|
* @param {object} [params] extra parameters specific to the exmo api endpoint
|
|
@@ -123544,6 +123916,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
123544
123916
|
* @method
|
|
123545
123917
|
* @name gate#fetchUnderlyingAssets
|
|
123546
123918
|
* @description fetches the market ids of underlying assets for a specific contract market type
|
|
123919
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#list-all-underlyings
|
|
123547
123920
|
* @param {object} [params] exchange specific params
|
|
123548
123921
|
* @param {string} [params.type] the contract market type, 'option', 'swap' or 'future', the default is 'option'
|
|
123549
123922
|
* @returns {object[]} a list of [underlying assets]{@link https://github.com/ccxt/ccxt/wiki/Manual#underlying-assets-structure}
|
|
@@ -131723,7 +132096,6 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
131723
132096
|
'GET': 'Themis',
|
|
131724
132097
|
'GTC': 'Game.com',
|
|
131725
132098
|
'HIT': 'HitChain',
|
|
131726
|
-
'HOT': 'Hydro Protocol',
|
|
131727
132099
|
// https://github.com/ccxt/ccxt/issues/7399
|
|
131728
132100
|
// https://coinmarketcap.com/currencies/pnetwork/
|
|
131729
132101
|
// https://coinmarketcap.com/currencies/penta/markets/
|
|
@@ -139337,7 +139709,6 @@ class huobijp extends _abstract_huobijp_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
139337
139709
|
'GET': 'Themis',
|
|
139338
139710
|
'GTC': 'Game.com',
|
|
139339
139711
|
'HIT': 'HitChain',
|
|
139340
|
-
'HOT': 'Hydro Protocol',
|
|
139341
139712
|
// https://github.com/ccxt/ccxt/issues/7399
|
|
139342
139713
|
// https://coinmarketcap.com/currencies/pnetwork/
|
|
139343
139714
|
// https://coinmarketcap.com/currencies/penta/markets/
|
|
@@ -147665,6 +148036,7 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
147665
148036
|
/**
|
|
147666
148037
|
* @method
|
|
147667
148038
|
* @name krakenfutures#fetchOrderBook
|
|
148039
|
+
* @see https://docs.futures.kraken.com/#http-api-trading-v3-api-market-data-get-orderbook
|
|
147668
148040
|
* @description Fetches a list of open orders in a market
|
|
147669
148041
|
* @param {string} symbol Unified market symbol
|
|
147670
148042
|
* @param {int} [limit] Not used by krakenfutures
|
|
@@ -147711,6 +148083,15 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
147711
148083
|
return this.parseOrderBook(response['orderBook'], symbol, timestamp);
|
|
147712
148084
|
}
|
|
147713
148085
|
async fetchTickers(symbols = undefined, params = {}) {
|
|
148086
|
+
/**
|
|
148087
|
+
* @method
|
|
148088
|
+
* @name krakenfutures#fetchTickers
|
|
148089
|
+
* @description fetches price tickers for multiple markets, statistical calculations with the information calculated over the past 24 hours each market
|
|
148090
|
+
* @see https://docs.futures.kraken.com/#http-api-trading-v3-api-market-data-get-tickers
|
|
148091
|
+
* @param {string[]} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
148092
|
+
* @param {object} [params] extra parameters specific to the krakenfutures api endpoint
|
|
148093
|
+
* @returns {object} an array of [ticker structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#ticker-structure}
|
|
148094
|
+
*/
|
|
147714
148095
|
await this.loadMarkets();
|
|
147715
148096
|
const response = await this.publicGetTickers(params);
|
|
147716
148097
|
//
|
|
@@ -147910,6 +148291,7 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
147910
148291
|
/**
|
|
147911
148292
|
* @method
|
|
147912
148293
|
* @name krakenfutures#fetchTrades
|
|
148294
|
+
* @see https://docs.futures.kraken.com/#http-api-trading-v3-api-market-data-get-trade-history
|
|
147913
148295
|
* @descriptions Fetch a history of filled trades that this account has made
|
|
147914
148296
|
* @param {string} symbol Unified CCXT market symbol
|
|
147915
148297
|
* @param {int} [since] Timestamp in ms of earliest trade. Not used by krakenfutures except in combination with params.until
|
|
@@ -148231,6 +148613,7 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
148231
148613
|
/**
|
|
148232
148614
|
* @method
|
|
148233
148615
|
* @name krakenfutures#editOrder
|
|
148616
|
+
* @see https://docs.futures.kraken.com/#http-api-trading-v3-api-order-management-edit-order
|
|
148234
148617
|
* @description Edit an open order on the exchange
|
|
148235
148618
|
* @param {string} id order id
|
|
148236
148619
|
* @param {string} symbol Not used by Krakenfutures
|
|
@@ -148260,6 +148643,10 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
148260
148643
|
}
|
|
148261
148644
|
async cancelOrder(id, symbol = undefined, params = {}) {
|
|
148262
148645
|
/**
|
|
148646
|
+
* @method
|
|
148647
|
+
* @name krakenfutures#cancelOrder
|
|
148648
|
+
* @see https://docs.futures.kraken.com/#http-api-trading-v3-api-order-management-cancel-order
|
|
148649
|
+
* @description Cancel an open order on the exchange
|
|
148263
148650
|
* @param {string} id Order id
|
|
148264
148651
|
* @param {string} symbol Not used by Krakenfutures
|
|
148265
148652
|
* @param {object} [params] Exchange specific params
|
|
@@ -148343,6 +148730,7 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
148343
148730
|
/**
|
|
148344
148731
|
* @method
|
|
148345
148732
|
* @name krakenfutures#cancelAllOrders
|
|
148733
|
+
* @see https://docs.futures.kraken.com/#http-api-trading-v3-api-order-management-cancel-all-orders
|
|
148346
148734
|
* @description Cancels all orders on the exchange, including trigger orders
|
|
148347
148735
|
* @param {str} symbol Unified market symbol
|
|
148348
148736
|
* @param {dict} [params] Exchange specific params
|
|
@@ -148359,6 +148747,7 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
148359
148747
|
/**
|
|
148360
148748
|
* @method
|
|
148361
148749
|
* @name krakenfutures#fetchOpenOrders
|
|
148750
|
+
* @see https://docs.futures.kraken.com/#http-api-trading-v3-api-order-management-get-open-orders
|
|
148362
148751
|
* @description Gets all open orders, including trigger orders, for an account from the exchange api
|
|
148363
148752
|
* @param {string} symbol Unified market symbol
|
|
148364
148753
|
* @param {int} [since] Timestamp (ms) of earliest order. (Not used by kraken api but filtered internally by CCXT)
|
|
@@ -148766,6 +149155,18 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
148766
149155
|
});
|
|
148767
149156
|
}
|
|
148768
149157
|
async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
149158
|
+
/**
|
|
149159
|
+
* @method
|
|
149160
|
+
* @name krakenfutures#fetchMyTrades
|
|
149161
|
+
* @description fetch all trades made by the user
|
|
149162
|
+
* @see https://docs.futures.kraken.com/#http-api-trading-v3-api-historical-data-get-your-fills
|
|
149163
|
+
* @param {string} symbol unified market symbol
|
|
149164
|
+
* @param {int} [since] *not used by the api* the earliest time in ms to fetch trades for
|
|
149165
|
+
* @param {int} [limit] the maximum number of trades structures to retrieve
|
|
149166
|
+
* @param {object} [params] extra parameters specific to the bybit api endpoint
|
|
149167
|
+
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
149168
|
+
* @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
|
|
149169
|
+
*/
|
|
148769
149170
|
await this.loadMarkets();
|
|
148770
149171
|
let market = undefined;
|
|
148771
149172
|
if (symbol !== undefined) {
|
|
@@ -148798,9 +149199,10 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
148798
149199
|
/**
|
|
148799
149200
|
* @method
|
|
148800
149201
|
* @name krakenfutures#fetchBalance
|
|
149202
|
+
* @see https://docs.futures.kraken.com/#http-api-trading-v3-api-account-information-get-wallets
|
|
148801
149203
|
* @description Fetch the balance for a sub-account, all sub-account balances are inside 'info' in the response
|
|
148802
149204
|
* @param {object} [params] Exchange specific parameters
|
|
148803
|
-
* @param {string} [params.type] The sub-account type to query the balance of, possible values include 'flex', 'cash'/'main'/'funding', or a market symbol * defaults to '
|
|
149205
|
+
* @param {string} [params.type] The sub-account type to query the balance of, possible values include 'flex', 'cash'/'main'/'funding', or a market symbol * defaults to 'flex' *
|
|
148804
149206
|
* @param {string} [params.symbol] A unified market symbol, when assigned the balance for a trading market that matches the symbol is returned
|
|
148805
149207
|
* @returns A [balance structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#balance-structure}
|
|
148806
149208
|
*/
|
|
@@ -148904,7 +149306,7 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
148904
149306
|
type = symbol;
|
|
148905
149307
|
}
|
|
148906
149308
|
if (type === undefined) {
|
|
148907
|
-
type = (symbol === undefined) ? '
|
|
149309
|
+
type = (symbol === undefined) ? 'flex' : symbol;
|
|
148908
149310
|
}
|
|
148909
149311
|
const accountName = this.parseAccount(type);
|
|
148910
149312
|
const accounts = this.safeValue(response, 'accounts');
|
|
@@ -149102,6 +149504,17 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
149102
149504
|
};
|
|
149103
149505
|
}
|
|
149104
149506
|
async fetchFundingRateHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
149507
|
+
/**
|
|
149508
|
+
* @method
|
|
149509
|
+
* @name krakenfutures#fetchFundingRateHistory
|
|
149510
|
+
* @description fetches historical funding rate prices
|
|
149511
|
+
* @see https://docs.futures.kraken.com/#http-api-trading-v3-api-historical-funding-rates-historical-funding-rates
|
|
149512
|
+
* @param {string} symbol unified symbol of the market to fetch the funding rate history for
|
|
149513
|
+
* @param {int} [since] timestamp in ms of the earliest funding rate to fetch
|
|
149514
|
+
* @param {int} [limit] the maximum amount of [funding rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-history-structure} to fetch
|
|
149515
|
+
* @param {object} [params] extra parameters specific to the api endpoint
|
|
149516
|
+
* @returns {object[]} a list of [funding rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-history-structure}
|
|
149517
|
+
*/
|
|
149105
149518
|
this.checkRequiredSymbol('fetchFundingRateHistory', symbol);
|
|
149106
149519
|
await this.loadMarkets();
|
|
149107
149520
|
const market = this.market(symbol);
|
|
@@ -149132,7 +149545,7 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
149132
149545
|
result.push({
|
|
149133
149546
|
'info': item,
|
|
149134
149547
|
'symbol': symbol,
|
|
149135
|
-
'fundingRate': this.safeNumber(item, '
|
|
149548
|
+
'fundingRate': this.safeNumber(item, 'relativeFundingRate'),
|
|
149136
149549
|
'timestamp': this.parse8601(datetime),
|
|
149137
149550
|
'datetime': datetime,
|
|
149138
149551
|
});
|
|
@@ -149144,6 +149557,7 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
149144
149557
|
/**
|
|
149145
149558
|
* @method
|
|
149146
149559
|
* @name krakenfutures#fetchPositions
|
|
149560
|
+
* @see https://docs.futures.kraken.com/#websocket-api-private-feeds-open-positions
|
|
149147
149561
|
* @description Fetches current contract trading positions
|
|
149148
149562
|
* @param {string[]} symbols List of unified symbols
|
|
149149
149563
|
* @param {object} [params] Not used by krakenfutures
|
|
@@ -149223,7 +149637,7 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
149223
149637
|
'entryPrice': this.safeNumber(position, 'price'),
|
|
149224
149638
|
'notional': undefined,
|
|
149225
149639
|
'leverage': leverage,
|
|
149226
|
-
'unrealizedPnl':
|
|
149640
|
+
'unrealizedPnl': undefined,
|
|
149227
149641
|
'contracts': this.safeNumber(position, 'size'),
|
|
149228
149642
|
'contractSize': this.safeNumber(market, 'contractSize'),
|
|
149229
149643
|
'marginRatio': undefined,
|
|
@@ -149236,6 +149650,15 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
149236
149650
|
};
|
|
149237
149651
|
}
|
|
149238
149652
|
async fetchLeverageTiers(symbols = undefined, params = {}) {
|
|
149653
|
+
/**
|
|
149654
|
+
* @method
|
|
149655
|
+
* @name krakenfutures#fetchLeverageTiers
|
|
149656
|
+
* @see https://docs.futures.kraken.com/#http-api-trading-v3-api-instrument-details-get-instruments
|
|
149657
|
+
* @description retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes
|
|
149658
|
+
* @param {string[]|undefined} symbols list of unified market symbols
|
|
149659
|
+
* @param {object} [params] extra parameters specific to the krakenfutures api endpoint
|
|
149660
|
+
* @returns {object} a dictionary of [leverage tiers structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#leverage-tiers-structure}, indexed by market symbols
|
|
149661
|
+
*/
|
|
149239
149662
|
await this.loadMarkets();
|
|
149240
149663
|
const response = await this.publicGetInstruments(params);
|
|
149241
149664
|
//
|
|
@@ -149415,6 +149838,8 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
149415
149838
|
/**
|
|
149416
149839
|
* @method
|
|
149417
149840
|
* @name krakenfutures#transfer
|
|
149841
|
+
* @see https://docs.futures.kraken.com/#http-api-trading-v3-api-transfers-initiate-wallet-transfer
|
|
149842
|
+
* @see https://docs.futures.kraken.com/#http-api-trading-v3-api-transfers-initiate-withdrawal-to-spot-wallet
|
|
149418
149843
|
* @description transfers currencies between sub-accounts
|
|
149419
149844
|
* @param {string} code Unified currency code
|
|
149420
149845
|
* @param {float} amount Size of the transfer
|
|
@@ -166081,6 +166506,7 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
166081
166506
|
'cancelOrders': undefined,
|
|
166082
166507
|
'createDepositAddress': true,
|
|
166083
166508
|
'createOrder': true,
|
|
166509
|
+
'createOrders': true,
|
|
166084
166510
|
'createReduceOnlyOrder': true,
|
|
166085
166511
|
'deposit': undefined,
|
|
166086
166512
|
'editOrder': undefined,
|
|
@@ -168125,7 +168551,7 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
168125
168551
|
return await this.createSwapOrder(market, type, side, amount, price, marginMode, query);
|
|
168126
168552
|
}
|
|
168127
168553
|
}
|
|
168128
|
-
|
|
168554
|
+
createSpotOrderRequest(market, type, side, amount, price = undefined, marginMode = undefined, params = {}) {
|
|
168129
168555
|
const symbol = market['symbol'];
|
|
168130
168556
|
const orderSide = (side === 'buy') ? 'BUY' : 'SELL';
|
|
168131
168557
|
const request = {
|
|
@@ -168162,19 +168588,28 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
168162
168588
|
request['newClientOrderId'] = clientOrderId;
|
|
168163
168589
|
params = this.omit(params, ['type', 'clientOrderId']);
|
|
168164
168590
|
}
|
|
168165
|
-
let method = 'spotPrivatePostOrder';
|
|
168166
168591
|
if (marginMode !== undefined) {
|
|
168167
168592
|
if (marginMode !== 'isolated') {
|
|
168168
168593
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest(this.id + ' createOrder() does not support marginMode ' + marginMode + ' for spot-margin trading');
|
|
168169
168594
|
}
|
|
168170
|
-
method = 'spotPrivatePostMarginOrder';
|
|
168171
168595
|
}
|
|
168172
168596
|
let postOnly = undefined;
|
|
168173
168597
|
[postOnly, params] = this.handlePostOnly(type === 'market', type === 'LIMIT_MAKER', params);
|
|
168174
168598
|
if (postOnly) {
|
|
168175
168599
|
request['type'] = 'LIMIT_MAKER';
|
|
168176
168600
|
}
|
|
168177
|
-
|
|
168601
|
+
return this.extend(request, params);
|
|
168602
|
+
}
|
|
168603
|
+
async createSpotOrder(market, type, side, amount, price = undefined, marginMode = undefined, params = {}) {
|
|
168604
|
+
await this.loadMarkets();
|
|
168605
|
+
const request = this.createSpotOrderRequest(market, type, side, amount, price, marginMode, params);
|
|
168606
|
+
let response = undefined;
|
|
168607
|
+
if (marginMode !== undefined) {
|
|
168608
|
+
response = await this.spotPrivatePostMarginOrder(this.extend(request, params));
|
|
168609
|
+
}
|
|
168610
|
+
else {
|
|
168611
|
+
response = await this.spotPrivatePostOrder(this.extend(request, params));
|
|
168612
|
+
}
|
|
168178
168613
|
//
|
|
168179
168614
|
// spot
|
|
168180
168615
|
//
|
|
@@ -168307,6 +168742,70 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
168307
168742
|
const data = this.safeString(response, 'data');
|
|
168308
168743
|
return this.parseOrder(data, market);
|
|
168309
168744
|
}
|
|
168745
|
+
async createOrders(orders, params = {}) {
|
|
168746
|
+
/**
|
|
168747
|
+
* @method
|
|
168748
|
+
* @name mexc#createOrders
|
|
168749
|
+
* @description *spot only* *all orders must have the same symbol* create a list of trade orders
|
|
168750
|
+
* @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#batch-orders
|
|
168751
|
+
* @param {array} orders list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
|
|
168752
|
+
* @param {object} [params] extra parameters specific to api endpoint
|
|
168753
|
+
* @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
168754
|
+
*/
|
|
168755
|
+
await this.loadMarkets();
|
|
168756
|
+
const ordersRequests = [];
|
|
168757
|
+
let symbol = undefined;
|
|
168758
|
+
for (let i = 0; i < orders.length; i++) {
|
|
168759
|
+
const rawOrder = orders[i];
|
|
168760
|
+
const marketId = this.safeString(rawOrder, 'symbol');
|
|
168761
|
+
const market = this.market(marketId);
|
|
168762
|
+
if (!market['spot']) {
|
|
168763
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' createOrders() is only supported for spot markets');
|
|
168764
|
+
}
|
|
168765
|
+
if (symbol === undefined) {
|
|
168766
|
+
symbol = marketId;
|
|
168767
|
+
}
|
|
168768
|
+
else {
|
|
168769
|
+
if (symbol !== marketId) {
|
|
168770
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest(this.id + ' createOrders() requires all orders to have the same symbol');
|
|
168771
|
+
}
|
|
168772
|
+
}
|
|
168773
|
+
const type = this.safeString(rawOrder, 'type');
|
|
168774
|
+
const side = this.safeString(rawOrder, 'side');
|
|
168775
|
+
const amount = this.safeValue(rawOrder, 'amount');
|
|
168776
|
+
const price = this.safeValue(rawOrder, 'price');
|
|
168777
|
+
const orderParams = this.safeValue(rawOrder, 'params', {});
|
|
168778
|
+
let marginMode = undefined;
|
|
168779
|
+
[marginMode, params] = this.handleMarginModeAndParams('createOrder', params);
|
|
168780
|
+
const orderRequest = this.createSpotOrderRequest(market, type, side, amount, price, marginMode, orderParams);
|
|
168781
|
+
ordersRequests.push(orderRequest);
|
|
168782
|
+
}
|
|
168783
|
+
const request = {
|
|
168784
|
+
'batchOrders': ordersRequests,
|
|
168785
|
+
};
|
|
168786
|
+
const response = await this.spotPrivatePostBatchOrders(request);
|
|
168787
|
+
//
|
|
168788
|
+
// [
|
|
168789
|
+
// {
|
|
168790
|
+
// "symbol": "BTCUSDT",
|
|
168791
|
+
// "orderId": "1196315350023612316",
|
|
168792
|
+
// "newClientOrderId": "hio8279hbdsds",
|
|
168793
|
+
// "orderListId": -1
|
|
168794
|
+
// },
|
|
168795
|
+
// {
|
|
168796
|
+
// "newClientOrderId": "123456",
|
|
168797
|
+
// "msg": "The minimum transaction volume cannot be less than:0.5USDT",
|
|
168798
|
+
// "code": 30002
|
|
168799
|
+
// },
|
|
168800
|
+
// {
|
|
168801
|
+
// "symbol": "BTCUSDT",
|
|
168802
|
+
// "orderId": "1196315350023612318",
|
|
168803
|
+
// "orderListId": -1
|
|
168804
|
+
// }
|
|
168805
|
+
// ]
|
|
168806
|
+
//
|
|
168807
|
+
return this.parseOrders(response);
|
|
168808
|
+
}
|
|
168310
168809
|
async fetchOrder(id, symbol = undefined, params = {}) {
|
|
168311
168810
|
/**
|
|
168312
168811
|
* @method
|
|
@@ -169167,6 +169666,23 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
169167
169666
|
// "updateTime": "1648984276000",
|
|
169168
169667
|
// }
|
|
169169
169668
|
//
|
|
169669
|
+
// createOrders error
|
|
169670
|
+
//
|
|
169671
|
+
// {
|
|
169672
|
+
// "newClientOrderId": "123456",
|
|
169673
|
+
// "msg": "The minimum transaction volume cannot be less than:0.5USDT",
|
|
169674
|
+
// "code": 30002
|
|
169675
|
+
// }
|
|
169676
|
+
//
|
|
169677
|
+
const code = this.safeInteger(order, 'code');
|
|
169678
|
+
if (code !== undefined) {
|
|
169679
|
+
// error upon placing multiple orders
|
|
169680
|
+
return this.safeOrder({
|
|
169681
|
+
'info': order,
|
|
169682
|
+
'status': 'rejected',
|
|
169683
|
+
'clientOrderId': this.safeString(order, 'newClientOrderId'),
|
|
169684
|
+
});
|
|
169685
|
+
}
|
|
169170
169686
|
let id = undefined;
|
|
169171
169687
|
if (typeof order === 'string') {
|
|
169172
169688
|
id = order;
|
|
@@ -179873,6 +180389,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
179873
180389
|
'sprd/order': 1,
|
|
179874
180390
|
'sprd/cancel-order': 1,
|
|
179875
180391
|
'sprd/mass-cancel': 1,
|
|
180392
|
+
'sprd/amend-order': 1,
|
|
179876
180393
|
// trade
|
|
179877
180394
|
'trade/order': 1 / 3,
|
|
179878
180395
|
'trade/batch-orders': 1 / 15,
|
|
@@ -188900,6 +189417,9 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
188900
189417
|
[type, params] = this.handleMarketTypeAndParams('fetchBalance', undefined, params);
|
|
188901
189418
|
let method = 'privateGetSpotWallets';
|
|
188902
189419
|
const request = {};
|
|
189420
|
+
if ((type !== 'spot') && (type !== 'swap')) {
|
|
189421
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest(this.id + ' does not support ' + type + ' markets, only spot and swap');
|
|
189422
|
+
}
|
|
188903
189423
|
if (type === 'swap') {
|
|
188904
189424
|
const code = this.safeString(params, 'code');
|
|
188905
189425
|
let settle = undefined;
|
|
@@ -224014,6 +224534,7 @@ class huobi extends _huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
224014
224534
|
// id: 1583473663565,
|
|
224015
224535
|
// rep: 'market.btcusdt.mbp.150',
|
|
224016
224536
|
// status: 'ok',
|
|
224537
|
+
// ts: 1698359289261,
|
|
224017
224538
|
// data: {
|
|
224018
224539
|
// seqNum: 104999417756,
|
|
224019
224540
|
// bids: [
|
|
@@ -224042,6 +224563,9 @@ class huobi extends _huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
224042
224563
|
const sequence = this.safeInteger(tick, 'seqNum');
|
|
224043
224564
|
const nonce = this.safeInteger(data, 'seqNum');
|
|
224044
224565
|
snapshot['nonce'] = nonce;
|
|
224566
|
+
const timestamp = this.safeInteger(message, 'ts');
|
|
224567
|
+
snapshot['timestamp'] = timestamp;
|
|
224568
|
+
snapshot['datetime'] = this.iso8601(timestamp);
|
|
224045
224569
|
const snapshotLimit = this.safeInteger(subscription, 'limit');
|
|
224046
224570
|
const snapshotOrderBook = this.orderBook(snapshot, snapshotLimit);
|
|
224047
224571
|
client.resolve(snapshotOrderBook, id);
|
|
@@ -279071,7 +279595,7 @@ SOFTWARE.
|
|
|
279071
279595
|
|
|
279072
279596
|
//-----------------------------------------------------------------------------
|
|
279073
279597
|
// this is updated by vss.js when building
|
|
279074
|
-
const version = '4.1.
|
|
279598
|
+
const version = '4.1.30';
|
|
279075
279599
|
_src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange.ccxtVersion */ .e.ccxtVersion = version;
|
|
279076
279600
|
//-----------------------------------------------------------------------------
|
|
279077
279601
|
|