ccxt 4.3.5 → 4.3.7
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/cjs/ccxt.js +1 -1
- package/dist/cjs/src/ace.js +5 -0
- package/dist/cjs/src/alpaca.js +6 -0
- package/dist/cjs/src/base/Exchange.js +37 -0
- package/dist/cjs/src/binance.js +4 -0
- package/dist/cjs/src/bingx.js +47 -0
- package/dist/cjs/src/bitbank.js +3 -0
- package/dist/cjs/src/bitget.js +74 -1
- package/dist/cjs/src/bithumb.js +4 -0
- package/dist/cjs/src/bitmex.js +26 -0
- package/dist/cjs/src/bitopro.js +5 -0
- package/dist/cjs/src/bitso.js +3 -0
- package/dist/cjs/src/bitstamp.js +3 -0
- package/dist/cjs/src/bitteam.js +4 -0
- package/dist/cjs/src/bitvavo.js +3 -0
- package/dist/cjs/src/bl3p.js +3 -0
- package/dist/cjs/src/btcalpha.js +3 -0
- package/dist/cjs/src/btcbox.js +3 -0
- package/dist/cjs/src/btcmarkets.js +3 -0
- package/dist/cjs/src/btcturk.js +3 -0
- package/dist/cjs/src/bybit.js +209 -12
- package/dist/cjs/src/cex.js +6 -0
- package/dist/cjs/src/coinbase.js +100 -21
- package/dist/cjs/src/coinbaseinternational.js +2 -0
- package/dist/cjs/src/coinbasepro.js +6 -0
- package/dist/cjs/src/coincheck.js +3 -0
- package/dist/cjs/src/coinex.js +180 -75
- package/dist/cjs/src/coinlist.js +4 -0
- package/dist/cjs/src/coinmate.js +3 -0
- package/dist/cjs/src/coinone.js +3 -0
- package/dist/cjs/src/coinsph.js +4 -0
- package/dist/cjs/src/coinspot.js +3 -0
- package/dist/cjs/src/cryptocom.js +34 -0
- package/dist/cjs/src/exmo.js +5 -0
- package/dist/cjs/src/gate.js +124 -22
- package/dist/cjs/src/hitbtc.js +4 -3
- package/dist/cjs/src/htx.js +30 -0
- package/dist/cjs/src/hyperliquid.js +40 -0
- package/dist/cjs/src/idex.js +3 -0
- package/dist/cjs/src/independentreserve.js +3 -0
- package/dist/cjs/src/indodax.js +3 -0
- package/dist/cjs/src/kraken.js +30 -0
- package/dist/cjs/src/krakenfutures.js +28 -0
- package/dist/cjs/src/kucoin.js +2 -0
- package/dist/cjs/src/kucoinfutures.js +4 -2
- package/dist/cjs/src/latoken.js +6 -0
- package/dist/cjs/src/luno.js +3 -0
- package/dist/cjs/src/lykke.js +5 -0
- package/dist/cjs/src/mercado.js +3 -0
- package/dist/cjs/src/mexc.js +111 -0
- package/dist/cjs/src/ndax.js +4 -0
- package/dist/cjs/src/novadax.js +4 -0
- package/dist/cjs/src/okx.js +196 -0
- package/dist/cjs/src/onetrading.js +3 -0
- package/dist/cjs/src/p2b.js +3 -0
- package/dist/cjs/src/pro/bitget.js +1 -1
- package/dist/cjs/src/pro/bybit.js +1 -1
- package/dist/cjs/src/pro/coinbase.js +30 -29
- package/dist/cjs/src/probit.js +3 -0
- package/dist/cjs/src/timex.js +3 -0
- package/dist/cjs/src/tradeogre.js +3 -0
- package/dist/cjs/src/wavesexchange.js +3 -0
- package/dist/cjs/src/wazirx.js +3 -0
- package/dist/cjs/src/whitebit.js +42 -0
- package/dist/cjs/src/woo.js +31 -0
- package/dist/cjs/src/yobit.js +3 -0
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/binance.d.ts +1 -0
- package/js/src/abstract/binancecoinm.d.ts +1 -0
- package/js/src/abstract/binanceus.d.ts +1 -0
- package/js/src/abstract/binanceusdm.d.ts +1 -0
- package/js/src/abstract/bingx.d.ts +1 -0
- package/js/src/abstract/coinbase.d.ts +5 -0
- package/js/src/abstract/woo.d.ts +1 -0
- package/js/src/ace.js +5 -0
- package/js/src/alpaca.js +6 -0
- package/js/src/ascendex.d.ts +2 -2
- package/js/src/base/Exchange.d.ts +5 -0
- package/js/src/base/Exchange.js +37 -0
- package/js/src/bigone.d.ts +1 -1
- package/js/src/binance.d.ts +3 -3
- package/js/src/binance.js +4 -0
- package/js/src/bingx.d.ts +2 -1
- package/js/src/bingx.js +47 -0
- package/js/src/bitbank.d.ts +1 -1
- package/js/src/bitbank.js +3 -0
- package/js/src/bitfinex.d.ts +1 -1
- package/js/src/bitfinex2.d.ts +1 -1
- package/js/src/bitflyer.d.ts +1 -1
- package/js/src/bitget.d.ts +4 -3
- package/js/src/bitget.js +74 -1
- package/js/src/bithumb.d.ts +1 -1
- package/js/src/bithumb.js +4 -0
- package/js/src/bitmart.d.ts +1 -1
- package/js/src/bitmex.d.ts +2 -1
- package/js/src/bitmex.js +26 -0
- package/js/src/bitopro.d.ts +1 -1
- package/js/src/bitopro.js +5 -0
- package/js/src/bitrue.d.ts +1 -1
- package/js/src/bitso.d.ts +1 -1
- package/js/src/bitso.js +3 -0
- package/js/src/bitstamp.d.ts +1 -1
- package/js/src/bitstamp.js +3 -0
- package/js/src/bitteam.js +4 -0
- package/js/src/bitvavo.d.ts +1 -1
- package/js/src/bitvavo.js +3 -0
- package/js/src/bl3p.js +3 -0
- package/js/src/blockchaincom.d.ts +1 -1
- package/js/src/btcalpha.js +3 -0
- package/js/src/btcbox.js +3 -0
- package/js/src/btcmarkets.d.ts +1 -1
- package/js/src/btcmarkets.js +3 -0
- package/js/src/btcturk.js +3 -0
- package/js/src/bybit.d.ts +8 -6
- package/js/src/bybit.js +209 -12
- package/js/src/cex.js +6 -0
- package/js/src/coinbase.d.ts +1 -1
- package/js/src/coinbase.js +100 -21
- package/js/src/coinbaseinternational.d.ts +1 -1
- package/js/src/coinbaseinternational.js +2 -0
- package/js/src/coinbasepro.d.ts +1 -1
- package/js/src/coinbasepro.js +6 -0
- package/js/src/coincheck.js +3 -0
- package/js/src/coinex.d.ts +8 -7
- package/js/src/coinex.js +180 -75
- package/js/src/coinlist.d.ts +1 -1
- package/js/src/coinlist.js +4 -0
- package/js/src/coinmate.d.ts +1 -1
- package/js/src/coinmate.js +3 -0
- package/js/src/coinone.js +3 -0
- package/js/src/coinsph.d.ts +1 -1
- package/js/src/coinsph.js +4 -0
- package/js/src/coinspot.js +3 -0
- package/js/src/cryptocom.d.ts +3 -2
- package/js/src/cryptocom.js +34 -0
- package/js/src/delta.d.ts +2 -2
- package/js/src/deribit.d.ts +1 -1
- package/js/src/digifinex.d.ts +3 -3
- package/js/src/exmo.d.ts +3 -3
- package/js/src/exmo.js +5 -0
- package/js/src/gate.d.ts +8 -7
- package/js/src/gate.js +124 -22
- package/js/src/gemini.d.ts +1 -1
- package/js/src/hitbtc.d.ts +3 -3
- package/js/src/hitbtc.js +4 -3
- package/js/src/hollaex.d.ts +1 -1
- package/js/src/htx.d.ts +2 -1
- package/js/src/htx.js +30 -0
- package/js/src/huobijp.d.ts +1 -1
- package/js/src/hyperliquid.d.ts +3 -2
- package/js/src/hyperliquid.js +40 -0
- package/js/src/idex.d.ts +1 -1
- package/js/src/idex.js +3 -0
- package/js/src/independentreserve.js +3 -0
- package/js/src/indodax.d.ts +1 -1
- package/js/src/indodax.js +3 -0
- package/js/src/kraken.d.ts +2 -1
- package/js/src/kraken.js +30 -0
- package/js/src/krakenfutures.d.ts +1 -0
- package/js/src/krakenfutures.js +28 -0
- package/js/src/kucoin.d.ts +1 -1
- package/js/src/kucoin.js +2 -0
- package/js/src/kucoinfutures.d.ts +1 -1
- package/js/src/kucoinfutures.js +4 -2
- package/js/src/kuna.d.ts +1 -1
- package/js/src/latoken.js +6 -0
- package/js/src/lbank.d.ts +1 -1
- package/js/src/luno.js +3 -0
- package/js/src/lykke.d.ts +1 -1
- package/js/src/lykke.js +5 -0
- package/js/src/mercado.d.ts +1 -1
- package/js/src/mercado.js +3 -0
- package/js/src/mexc.d.ts +4 -3
- package/js/src/mexc.js +111 -0
- package/js/src/ndax.d.ts +1 -1
- package/js/src/ndax.js +4 -0
- package/js/src/novadax.d.ts +1 -1
- package/js/src/novadax.js +4 -0
- package/js/src/okcoin.d.ts +1 -1
- package/js/src/okx.d.ts +11 -8
- package/js/src/okx.js +196 -0
- package/js/src/onetrading.d.ts +1 -1
- package/js/src/onetrading.js +3 -0
- package/js/src/p2b.js +3 -0
- package/js/src/phemex.d.ts +1 -1
- package/js/src/poloniex.d.ts +1 -1
- package/js/src/pro/bitget.d.ts +1 -1
- package/js/src/pro/bitget.js +1 -1
- package/js/src/pro/bybit.js +1 -1
- package/js/src/pro/coinbase.d.ts +2 -2
- package/js/src/pro/coinbase.js +30 -29
- package/js/src/probit.d.ts +1 -1
- package/js/src/probit.js +3 -0
- package/js/src/timex.js +3 -0
- package/js/src/tokocrypto.d.ts +1 -1
- package/js/src/tradeogre.js +3 -0
- package/js/src/upbit.d.ts +1 -1
- package/js/src/wavesexchange.d.ts +1 -1
- package/js/src/wavesexchange.js +3 -0
- package/js/src/wazirx.js +3 -0
- package/js/src/whitebit.d.ts +2 -1
- package/js/src/whitebit.js +42 -0
- package/js/src/woo.d.ts +3 -2
- package/js/src/woo.js +31 -0
- package/js/src/yobit.d.ts +1 -1
- package/js/src/yobit.js +3 -0
- package/js/src/zaif.d.ts +1 -1
- package/js/src/zonda.d.ts +1 -1
- package/package.json +1 -1
package/js/src/bybit.js
CHANGED
|
@@ -38,6 +38,8 @@ export default class bybit extends Exchange {
|
|
|
38
38
|
'borrowCrossMargin': true,
|
|
39
39
|
'cancelAllOrders': true,
|
|
40
40
|
'cancelOrder': true,
|
|
41
|
+
'cancelOrders': true,
|
|
42
|
+
'cancelOrdersForSymbols': true,
|
|
41
43
|
'closeAllPositions': false,
|
|
42
44
|
'closePosition': false,
|
|
43
45
|
'createMarketBuyOrderWithCost': true,
|
|
@@ -103,7 +105,9 @@ export default class bybit extends Exchange {
|
|
|
103
105
|
'fetchOrders': false,
|
|
104
106
|
'fetchOrderTrades': true,
|
|
105
107
|
'fetchPosition': true,
|
|
108
|
+
'fetchPositionHistory': 'emulated',
|
|
106
109
|
'fetchPositions': true,
|
|
110
|
+
'fetchPositionsHistory': true,
|
|
107
111
|
'fetchPremiumIndexOHLCV': true,
|
|
108
112
|
'fetchSettlementHistory': true,
|
|
109
113
|
'fetchTicker': true,
|
|
@@ -4385,6 +4389,90 @@ export default class bybit extends Exchange {
|
|
|
4385
4389
|
const row = this.safeList(result, 'list', []);
|
|
4386
4390
|
return this.parseOrders(row, market);
|
|
4387
4391
|
}
|
|
4392
|
+
async cancelOrdersForSymbols(orders, params = {}) {
|
|
4393
|
+
/**
|
|
4394
|
+
* @method
|
|
4395
|
+
* @name bybit#cancelOrdersForSymbols
|
|
4396
|
+
* @description cancel multiple orders for multiple symbols
|
|
4397
|
+
* @see https://bybit-exchange.github.io/docs/v5/order/batch-cancel
|
|
4398
|
+
* @param {string[]} ids order ids
|
|
4399
|
+
* @param {string} symbol unified symbol of the market the order was made in
|
|
4400
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4401
|
+
* @param {string[]} [params.clientOrderIds] client order ids
|
|
4402
|
+
* @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4403
|
+
*/
|
|
4404
|
+
await this.loadMarkets();
|
|
4405
|
+
const ordersRequests = [];
|
|
4406
|
+
let category = undefined;
|
|
4407
|
+
for (let i = 0; i < orders.length; i++) {
|
|
4408
|
+
const order = orders[i];
|
|
4409
|
+
const symbol = this.safeString(order, 'symbol');
|
|
4410
|
+
const market = this.market(symbol);
|
|
4411
|
+
let currentCategory = undefined;
|
|
4412
|
+
[currentCategory, params] = this.getBybitType('cancelOrders', market, params);
|
|
4413
|
+
if (currentCategory === 'inverse') {
|
|
4414
|
+
throw new NotSupported(this.id + ' cancelOrdersForSymbols does not allow inverse orders');
|
|
4415
|
+
}
|
|
4416
|
+
if ((category !== undefined) && (category !== currentCategory)) {
|
|
4417
|
+
throw new ExchangeError(this.id + ' cancelOrdersForSymbols requires all orders to be of the same category (linear, spot or option))');
|
|
4418
|
+
}
|
|
4419
|
+
category = currentCategory;
|
|
4420
|
+
const id = this.safeString(order, 'id');
|
|
4421
|
+
const clientOrderId = this.safeString(order, 'clientOrderId');
|
|
4422
|
+
let idKey = 'orderId';
|
|
4423
|
+
if (clientOrderId !== undefined) {
|
|
4424
|
+
idKey = 'orderLinkId';
|
|
4425
|
+
}
|
|
4426
|
+
const orderItem = {
|
|
4427
|
+
'symbol': market['id'],
|
|
4428
|
+
};
|
|
4429
|
+
orderItem[idKey] = (idKey === 'orderId') ? id : clientOrderId;
|
|
4430
|
+
ordersRequests.push(orderItem);
|
|
4431
|
+
}
|
|
4432
|
+
const request = {
|
|
4433
|
+
'category': category,
|
|
4434
|
+
'request': ordersRequests,
|
|
4435
|
+
};
|
|
4436
|
+
const response = await this.privatePostV5OrderCancelBatch(this.extend(request, params));
|
|
4437
|
+
//
|
|
4438
|
+
// {
|
|
4439
|
+
// "retCode": "0",
|
|
4440
|
+
// "retMsg": "OK",
|
|
4441
|
+
// "result": {
|
|
4442
|
+
// "list": [
|
|
4443
|
+
// {
|
|
4444
|
+
// "category": "spot",
|
|
4445
|
+
// "symbol": "BTCUSDT",
|
|
4446
|
+
// "orderId": "1636282505818800896",
|
|
4447
|
+
// "orderLinkId": "1636282505818800897"
|
|
4448
|
+
// },
|
|
4449
|
+
// {
|
|
4450
|
+
// "category": "spot",
|
|
4451
|
+
// "symbol": "BTCUSDT",
|
|
4452
|
+
// "orderId": "1636282505818800898",
|
|
4453
|
+
// "orderLinkId": "1636282505818800899"
|
|
4454
|
+
// }
|
|
4455
|
+
// ]
|
|
4456
|
+
// },
|
|
4457
|
+
// "retExtInfo": {
|
|
4458
|
+
// "list": [
|
|
4459
|
+
// {
|
|
4460
|
+
// "code": "0",
|
|
4461
|
+
// "msg": "OK"
|
|
4462
|
+
// },
|
|
4463
|
+
// {
|
|
4464
|
+
// "code": "0",
|
|
4465
|
+
// "msg": "OK"
|
|
4466
|
+
// }
|
|
4467
|
+
// ]
|
|
4468
|
+
// },
|
|
4469
|
+
// "time": "1709796158501"
|
|
4470
|
+
// }
|
|
4471
|
+
//
|
|
4472
|
+
const result = this.safeDict(response, 'result', {});
|
|
4473
|
+
const row = this.safeList(result, 'list', []);
|
|
4474
|
+
return this.parseOrders(row, undefined);
|
|
4475
|
+
}
|
|
4388
4476
|
async cancelAllUsdcOrders(symbol = undefined, params = {}) {
|
|
4389
4477
|
if (symbol === undefined) {
|
|
4390
4478
|
throw new ArgumentsRequired(this.id + ' cancelAllUsdcOrders() requires a symbol argument');
|
|
@@ -6374,37 +6462,64 @@ export default class bybit extends Exchange {
|
|
|
6374
6462
|
// "tradeMode": 0
|
|
6375
6463
|
// }
|
|
6376
6464
|
//
|
|
6465
|
+
// fetchPositionsHistory
|
|
6466
|
+
//
|
|
6467
|
+
// {
|
|
6468
|
+
// symbol: 'XRPUSDT',
|
|
6469
|
+
// orderType: 'Market',
|
|
6470
|
+
// leverage: '10',
|
|
6471
|
+
// updatedTime: '1712717265572',
|
|
6472
|
+
// side: 'Sell',
|
|
6473
|
+
// orderId: '071749f3-a9fa-427b-b5ca-27b2f52b81de',
|
|
6474
|
+
// closedPnl: '-0.00049568',
|
|
6475
|
+
// avgEntryPrice: '0.6045',
|
|
6476
|
+
// qty: '3',
|
|
6477
|
+
// cumEntryValue: '1.8135',
|
|
6478
|
+
// createdTime: '1712717265566',
|
|
6479
|
+
// orderPrice: '0.5744',
|
|
6480
|
+
// closedSize: '3',
|
|
6481
|
+
// avgExitPrice: '0.605',
|
|
6482
|
+
// execType: 'Trade',
|
|
6483
|
+
// fillCount: '1',
|
|
6484
|
+
// cumExitValue: '1.815'
|
|
6485
|
+
// }
|
|
6486
|
+
//
|
|
6487
|
+
const closedSize = this.safeString(position, 'closedSize');
|
|
6488
|
+
const isHistory = (closedSize !== undefined);
|
|
6377
6489
|
const contract = this.safeString(position, 'symbol');
|
|
6378
6490
|
market = this.safeMarket(contract, market, undefined, 'contract');
|
|
6379
|
-
const size = Precise.stringAbs(this.
|
|
6491
|
+
const size = Precise.stringAbs(this.safeString2(position, 'size', 'qty'));
|
|
6380
6492
|
let side = this.safeString(position, 'side');
|
|
6381
6493
|
if (side !== undefined) {
|
|
6382
6494
|
if (side === 'Buy') {
|
|
6383
|
-
side = 'long';
|
|
6495
|
+
side = isHistory ? 'short' : 'long';
|
|
6384
6496
|
}
|
|
6385
6497
|
else if (side === 'Sell') {
|
|
6386
|
-
side = 'short';
|
|
6498
|
+
side = isHistory ? 'long' : 'short';
|
|
6387
6499
|
}
|
|
6388
6500
|
else {
|
|
6389
6501
|
side = undefined;
|
|
6390
6502
|
}
|
|
6391
6503
|
}
|
|
6392
|
-
const notional = this.
|
|
6504
|
+
const notional = this.safeString2(position, 'positionValue', 'cumExitValue');
|
|
6393
6505
|
const unrealisedPnl = this.omitZero(this.safeString(position, 'unrealisedPnl'));
|
|
6394
|
-
let initialMarginString = this.
|
|
6506
|
+
let initialMarginString = this.safeStringN(position, ['positionIM', 'cumEntryValue']);
|
|
6395
6507
|
let maintenanceMarginString = this.safeString(position, 'positionMM');
|
|
6396
|
-
|
|
6397
|
-
|
|
6398
|
-
|
|
6508
|
+
const timestamp = this.safeIntegerN(position, ['createdTime', 'createdAt']);
|
|
6509
|
+
let lastUpdateTimestamp = this.parse8601(this.safeString(position, 'updated_at'));
|
|
6510
|
+
if (lastUpdateTimestamp === undefined) {
|
|
6511
|
+
lastUpdateTimestamp = this.safeIntegerN(position, ['updatedTime', 'updatedAt', 'updatedTime']);
|
|
6399
6512
|
}
|
|
6400
6513
|
const tradeMode = this.safeInteger(position, 'tradeMode', 0);
|
|
6401
6514
|
let marginMode = undefined;
|
|
6402
6515
|
if ((!this.options['enableUnifiedAccount']) || (this.options['enableUnifiedAccount'] && market['inverse'])) {
|
|
6403
6516
|
// tradeMode would work for classic and UTA(inverse)
|
|
6404
|
-
marginMode
|
|
6517
|
+
if (!isHistory) { // cannot tell marginMode for fetchPositionsHistory, and closedSize will only be defined for fetchPositionsHistory response
|
|
6518
|
+
marginMode = (tradeMode === 1) ? 'isolated' : 'cross';
|
|
6519
|
+
}
|
|
6405
6520
|
}
|
|
6406
6521
|
let collateralString = this.safeString(position, 'positionBalance');
|
|
6407
|
-
const entryPrice = this.omitZero(this.
|
|
6522
|
+
const entryPrice = this.omitZero(this.safeStringN(position, ['entryPrice', 'avgPrice', 'avgEntryPrice']));
|
|
6408
6523
|
const liquidationPrice = this.omitZero(this.safeString(position, 'liqPrice'));
|
|
6409
6524
|
const leverage = this.safeString(position, 'leverage');
|
|
6410
6525
|
if (liquidationPrice !== undefined) {
|
|
@@ -6450,7 +6565,7 @@ export default class bybit extends Exchange {
|
|
|
6450
6565
|
'symbol': market['symbol'],
|
|
6451
6566
|
'timestamp': timestamp,
|
|
6452
6567
|
'datetime': this.iso8601(timestamp),
|
|
6453
|
-
'lastUpdateTimestamp':
|
|
6568
|
+
'lastUpdateTimestamp': lastUpdateTimestamp,
|
|
6454
6569
|
'initialMargin': this.parseNumber(initialMarginString),
|
|
6455
6570
|
'initialMarginPercentage': this.parseNumber(Precise.stringDiv(initialMarginString, notional)),
|
|
6456
6571
|
'maintenanceMargin': this.parseNumber(maintenanceMarginString),
|
|
@@ -6459,12 +6574,13 @@ export default class bybit extends Exchange {
|
|
|
6459
6574
|
'notional': this.parseNumber(notional),
|
|
6460
6575
|
'leverage': this.parseNumber(leverage),
|
|
6461
6576
|
'unrealizedPnl': this.parseNumber(unrealisedPnl),
|
|
6577
|
+
'realizedPnl': this.safeNumber(position, 'closedPnl'),
|
|
6462
6578
|
'contracts': this.parseNumber(size),
|
|
6463
6579
|
'contractSize': this.safeNumber(market, 'contractSize'),
|
|
6464
6580
|
'marginRatio': this.parseNumber(marginRatio),
|
|
6465
6581
|
'liquidationPrice': this.parseNumber(liquidationPrice),
|
|
6466
6582
|
'markPrice': this.safeNumber(position, 'markPrice'),
|
|
6467
|
-
'lastPrice':
|
|
6583
|
+
'lastPrice': this.safeNumber(position, 'avgExitPrice'),
|
|
6468
6584
|
'collateral': this.parseNumber(collateralString),
|
|
6469
6585
|
'marginMode': marginMode,
|
|
6470
6586
|
'side': side,
|
|
@@ -8391,6 +8507,87 @@ export default class bybit extends Exchange {
|
|
|
8391
8507
|
'quoteVolume': undefined,
|
|
8392
8508
|
};
|
|
8393
8509
|
}
|
|
8510
|
+
async fetchPositionsHistory(symbols = undefined, since = undefined, limit = undefined, params = {}) {
|
|
8511
|
+
/**
|
|
8512
|
+
* @method
|
|
8513
|
+
* @name bybit#fetchPositionsHistory
|
|
8514
|
+
* @description fetches historical positions
|
|
8515
|
+
* @see https://bybit-exchange.github.io/docs/v5/position/close-pnl
|
|
8516
|
+
* @param {string} [symbol] unified market symbols, symbols must have the same subType (must all be linear or all be inverse)
|
|
8517
|
+
* @param {int} [since] timestamp in ms of the earliest position to fetch, params["until"] - since <= 7 days
|
|
8518
|
+
* @param {int} [limit] the maximum amount of records to fetch, default=50, max=100
|
|
8519
|
+
* @param {object} params extra parameters specific to the exchange api endpoint
|
|
8520
|
+
* @param {int} [params.until] timestamp in ms of the latest position to fetch, params["until"] - since <= 7 days
|
|
8521
|
+
* @param {string} [params.subType] 'linear' or 'inverse'
|
|
8522
|
+
* @returns {object[]} a list of [position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
8523
|
+
*/
|
|
8524
|
+
await this.loadMarkets();
|
|
8525
|
+
let market = undefined;
|
|
8526
|
+
let subType = undefined;
|
|
8527
|
+
let symbolsLength = 0;
|
|
8528
|
+
if (symbols !== undefined) {
|
|
8529
|
+
symbolsLength = symbols.length;
|
|
8530
|
+
if (symbolsLength > 0) {
|
|
8531
|
+
market = this.market(symbols[0]);
|
|
8532
|
+
}
|
|
8533
|
+
}
|
|
8534
|
+
const until = this.safeInteger(params, 'until');
|
|
8535
|
+
[subType, params] = this.handleSubTypeAndParams('fetchPositionsHistory', market, params, 'linear');
|
|
8536
|
+
params = this.omit(params, 'until');
|
|
8537
|
+
const request = {
|
|
8538
|
+
'category': subType,
|
|
8539
|
+
};
|
|
8540
|
+
if ((symbols !== undefined) && (symbolsLength === 1)) {
|
|
8541
|
+
request['symbol'] = market['id'];
|
|
8542
|
+
}
|
|
8543
|
+
if (since !== undefined) {
|
|
8544
|
+
request['startTime'] = since;
|
|
8545
|
+
}
|
|
8546
|
+
if (limit !== undefined) {
|
|
8547
|
+
request['limit'] = limit;
|
|
8548
|
+
}
|
|
8549
|
+
if (until !== undefined) {
|
|
8550
|
+
request['endTime'] = until;
|
|
8551
|
+
}
|
|
8552
|
+
const response = await this.privateGetV5PositionClosedPnl(this.extend(request, params));
|
|
8553
|
+
//
|
|
8554
|
+
// {
|
|
8555
|
+
// retCode: '0',
|
|
8556
|
+
// retMsg: 'OK',
|
|
8557
|
+
// result: {
|
|
8558
|
+
// nextPageCursor: '071749f3-a9fa-427b-b5ca-27b2f52b81de%3A1712717265566520788%2C071749f3-a9fa-427b-b5ca-27b2f52b81de%3A1712717265566520788',
|
|
8559
|
+
// category: 'linear',
|
|
8560
|
+
// list: [
|
|
8561
|
+
// {
|
|
8562
|
+
// symbol: 'XRPUSDT',
|
|
8563
|
+
// orderType: 'Market',
|
|
8564
|
+
// leverage: '10',
|
|
8565
|
+
// updatedTime: '1712717265572',
|
|
8566
|
+
// side: 'Sell',
|
|
8567
|
+
// orderId: '071749f3-a9fa-427b-b5ca-27b2f52b81de',
|
|
8568
|
+
// closedPnl: '-0.00049568',
|
|
8569
|
+
// avgEntryPrice: '0.6045',
|
|
8570
|
+
// qty: '3',
|
|
8571
|
+
// cumEntryValue: '1.8135',
|
|
8572
|
+
// createdTime: '1712717265566',
|
|
8573
|
+
// orderPrice: '0.5744',
|
|
8574
|
+
// closedSize: '3',
|
|
8575
|
+
// avgExitPrice: '0.605',
|
|
8576
|
+
// execType: 'Trade',
|
|
8577
|
+
// fillCount: '1',
|
|
8578
|
+
// cumExitValue: '1.815'
|
|
8579
|
+
// }
|
|
8580
|
+
// ]
|
|
8581
|
+
// },
|
|
8582
|
+
// retExtInfo: {},
|
|
8583
|
+
// time: '1712717286073'
|
|
8584
|
+
// }
|
|
8585
|
+
//
|
|
8586
|
+
const result = this.safeDict(response, 'result');
|
|
8587
|
+
const rawPositions = this.safeList(result, 'list');
|
|
8588
|
+
const positions = this.parsePositions(rawPositions, symbols, params);
|
|
8589
|
+
return this.filterBySinceLimit(positions, since, limit);
|
|
8590
|
+
}
|
|
8394
8591
|
sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
8395
8592
|
let url = this.implodeHostname(this.urls['api'][api]) + '/' + path;
|
|
8396
8593
|
if (api === 'public') {
|
package/js/src/cex.js
CHANGED
|
@@ -65,7 +65,13 @@ export default class cex extends Exchange {
|
|
|
65
65
|
'fetchOrder': true,
|
|
66
66
|
'fetchOrderBook': true,
|
|
67
67
|
'fetchOrders': true,
|
|
68
|
+
'fetchPosition': false,
|
|
69
|
+
'fetchPositionHistory': false,
|
|
68
70
|
'fetchPositionMode': false,
|
|
71
|
+
'fetchPositions': false,
|
|
72
|
+
'fetchPositionsForSymbol': false,
|
|
73
|
+
'fetchPositionsHistory': false,
|
|
74
|
+
'fetchPositionsRisk': false,
|
|
69
75
|
'fetchPremiumIndexOHLCV': false,
|
|
70
76
|
'fetchTicker': true,
|
|
71
77
|
'fetchTickers': true,
|
package/js/src/coinbase.d.ts
CHANGED
|
@@ -93,7 +93,7 @@ export default class coinbase extends Exchange {
|
|
|
93
93
|
fetchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
94
94
|
fetchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
|
|
95
95
|
fetchBidsAsks(symbols?: Strings, params?: {}): Promise<import("./base/types.js").Dictionary<Ticker>>;
|
|
96
|
-
withdraw(code: string, amount: number, address:
|
|
96
|
+
withdraw(code: string, amount: number, address: string, tag?: any, params?: {}): Promise<Transaction>;
|
|
97
97
|
fetchDepositAddressesByNetwork(code: string, params?: {}): Promise<{}>;
|
|
98
98
|
parseDepositAddress(depositAddress: any, currency?: Currency): {
|
|
99
99
|
info: any;
|
package/js/src/coinbase.js
CHANGED
|
@@ -205,6 +205,11 @@ export default class coinbase extends Exchange {
|
|
|
205
205
|
'public': {
|
|
206
206
|
'get': {
|
|
207
207
|
'brokerage/time': 3,
|
|
208
|
+
'brokerage/market/product_book': 3,
|
|
209
|
+
'brokerage/market/products': 3,
|
|
210
|
+
'brokerage/market/products/{product_id}': 3,
|
|
211
|
+
'brokerage/market/products/{product_id}/candles': 3,
|
|
212
|
+
'brokerage/market/products/{product_id}/ticker': 3,
|
|
208
213
|
},
|
|
209
214
|
},
|
|
210
215
|
'private': {
|
|
@@ -1094,7 +1099,7 @@ export default class coinbase extends Exchange {
|
|
|
1094
1099
|
/**
|
|
1095
1100
|
* @method
|
|
1096
1101
|
* @name coinbase#fetchMarkets
|
|
1097
|
-
* @see https://docs.cloud.coinbase.com/advanced-trade-api/reference/
|
|
1102
|
+
* @see https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_getpublicproducts
|
|
1098
1103
|
* @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-currencies#get-fiat-currencies
|
|
1099
1104
|
* @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-exchange-rates#get-exchange-rates
|
|
1100
1105
|
* @description retrieves data on all markets for coinbase
|
|
@@ -1181,20 +1186,92 @@ export default class coinbase extends Exchange {
|
|
|
1181
1186
|
}
|
|
1182
1187
|
async fetchMarketsV3(params = {}) {
|
|
1183
1188
|
const spotUnresolvedPromises = [
|
|
1184
|
-
this.
|
|
1185
|
-
|
|
1189
|
+
this.v3PublicGetBrokerageMarketProducts(params),
|
|
1190
|
+
//
|
|
1191
|
+
// {
|
|
1192
|
+
// products: [
|
|
1193
|
+
// {
|
|
1194
|
+
// product_id: 'BTC-USD',
|
|
1195
|
+
// price: '67060',
|
|
1196
|
+
// price_percentage_change_24h: '3.30054960636883',
|
|
1197
|
+
// volume_24h: '10967.87426597',
|
|
1198
|
+
// volume_percentage_change_24h: '141.73048325503036',
|
|
1199
|
+
// base_increment: '0.00000001',
|
|
1200
|
+
// quote_increment: '0.01',
|
|
1201
|
+
// quote_min_size: '1',
|
|
1202
|
+
// quote_max_size: '150000000',
|
|
1203
|
+
// base_min_size: '0.00000001',
|
|
1204
|
+
// base_max_size: '3400',
|
|
1205
|
+
// base_name: 'Bitcoin',
|
|
1206
|
+
// quote_name: 'US Dollar',
|
|
1207
|
+
// watched: false,
|
|
1208
|
+
// is_disabled: false,
|
|
1209
|
+
// new: false,
|
|
1210
|
+
// status: 'online',
|
|
1211
|
+
// cancel_only: false,
|
|
1212
|
+
// limit_only: false,
|
|
1213
|
+
// post_only: false,
|
|
1214
|
+
// trading_disabled: false,
|
|
1215
|
+
// auction_mode: false,
|
|
1216
|
+
// product_type: 'SPOT',
|
|
1217
|
+
// quote_currency_id: 'USD',
|
|
1218
|
+
// base_currency_id: 'BTC',
|
|
1219
|
+
// fcm_trading_session_details: null,
|
|
1220
|
+
// mid_market_price: '',
|
|
1221
|
+
// alias: '',
|
|
1222
|
+
// alias_to: [ 'BTC-USDC' ],
|
|
1223
|
+
// base_display_symbol: 'BTC',
|
|
1224
|
+
// quote_display_symbol: 'USD',
|
|
1225
|
+
// view_only: false,
|
|
1226
|
+
// price_increment: '0.01',
|
|
1227
|
+
// display_name: 'BTC-USD',
|
|
1228
|
+
// product_venue: 'CBE'
|
|
1229
|
+
// },
|
|
1230
|
+
// ...
|
|
1231
|
+
// ],
|
|
1232
|
+
// num_products: '646'
|
|
1233
|
+
// }
|
|
1234
|
+
//
|
|
1186
1235
|
];
|
|
1236
|
+
if (this.checkRequiredCredentials(false)) {
|
|
1237
|
+
spotUnresolvedPromises.push(this.v3PrivateGetBrokerageTransactionSummary(params));
|
|
1238
|
+
}
|
|
1239
|
+
//
|
|
1240
|
+
// {
|
|
1241
|
+
// total_volume: '9.995989116664404',
|
|
1242
|
+
// total_fees: '0.07996791093331522',
|
|
1243
|
+
// fee_tier: {
|
|
1244
|
+
// pricing_tier: 'Advanced 1',
|
|
1245
|
+
// usd_from: '0',
|
|
1246
|
+
// usd_to: '1000',
|
|
1247
|
+
// taker_fee_rate: '0.008',
|
|
1248
|
+
// maker_fee_rate: '0.006',
|
|
1249
|
+
// aop_from: '',
|
|
1250
|
+
// aop_to: ''
|
|
1251
|
+
// },
|
|
1252
|
+
// margin_rate: null,
|
|
1253
|
+
// goods_and_services_tax: null,
|
|
1254
|
+
// advanced_trade_only_volume: '9.995989116664404',
|
|
1255
|
+
// advanced_trade_only_fees: '0.07996791093331522',
|
|
1256
|
+
// coinbase_pro_volume: '0',
|
|
1257
|
+
// coinbase_pro_fees: '0',
|
|
1258
|
+
// total_balance: '',
|
|
1259
|
+
// has_promo_fee: false
|
|
1260
|
+
// }
|
|
1261
|
+
//
|
|
1187
1262
|
let unresolvedContractPromises = [];
|
|
1188
1263
|
try {
|
|
1189
1264
|
unresolvedContractPromises = [
|
|
1190
|
-
this.
|
|
1191
|
-
this.
|
|
1192
|
-
this.v3PrivateGetBrokerageTransactionSummary(this.extend(params, { 'product_type': 'FUTURE' })),
|
|
1193
|
-
this.v3PrivateGetBrokerageTransactionSummary(this.extend(params, { 'product_type': 'FUTURE', 'contract_expiry_type': 'PERPETUAL' })),
|
|
1265
|
+
this.v3PublicGetBrokerageMarketProducts(this.extend(params, { 'product_type': 'FUTURE' })),
|
|
1266
|
+
this.v3PublicGetBrokerageMarketProducts(this.extend(params, { 'product_type': 'FUTURE', 'contract_expiry_type': 'PERPETUAL' })),
|
|
1194
1267
|
];
|
|
1268
|
+
if (this.checkRequiredCredentials(false)) {
|
|
1269
|
+
unresolvedContractPromises.push(this.extend(params, { 'product_type': 'FUTURE' }));
|
|
1270
|
+
unresolvedContractPromises.push(this.extend(params, { 'product_type': 'FUTURE', 'contract_expiry_type': 'PERPETUAL' }));
|
|
1271
|
+
}
|
|
1195
1272
|
}
|
|
1196
1273
|
catch (e) {
|
|
1197
|
-
unresolvedContractPromises = []; // the sync version of ccxt won't have the promise.all line so the request is made here
|
|
1274
|
+
unresolvedContractPromises = []; // the sync version of ccxt won't have the promise.all line so the request is made here. Some users can't access perpetual products
|
|
1198
1275
|
}
|
|
1199
1276
|
const promises = await Promise.all(spotUnresolvedPromises);
|
|
1200
1277
|
let contractPromises = undefined;
|
|
@@ -1463,6 +1540,7 @@ export default class coinbase extends Exchange {
|
|
|
1463
1540
|
const contractSize = this.safeNumber(futureProductDetails, 'contract_size');
|
|
1464
1541
|
const contractExpire = this.safeString(futureProductDetails, 'contract_expiry');
|
|
1465
1542
|
const expireTimestamp = this.parse8601(contractExpire);
|
|
1543
|
+
const expireDateTime = this.iso8601(expireTimestamp);
|
|
1466
1544
|
const isSwap = (contractExpiryType === 'PERPETUAL');
|
|
1467
1545
|
const baseId = this.safeString(futureProductDetails, 'contract_root_unit');
|
|
1468
1546
|
const quoteId = this.safeString(market, 'quote_currency_id');
|
|
@@ -1506,7 +1584,7 @@ export default class coinbase extends Exchange {
|
|
|
1506
1584
|
'maker': maker,
|
|
1507
1585
|
'contractSize': contractSize,
|
|
1508
1586
|
'expiry': expireTimestamp,
|
|
1509
|
-
'expiryDatetime':
|
|
1587
|
+
'expiryDatetime': expireDateTime,
|
|
1510
1588
|
'strike': undefined,
|
|
1511
1589
|
'optionType': undefined,
|
|
1512
1590
|
'precision': {
|
|
@@ -1731,7 +1809,7 @@ export default class coinbase extends Exchange {
|
|
|
1731
1809
|
if (symbols !== undefined) {
|
|
1732
1810
|
request['product_ids'] = this.marketIds(symbols);
|
|
1733
1811
|
}
|
|
1734
|
-
const response = await this.
|
|
1812
|
+
const response = await this.v3PublicGetBrokerageMarketProducts(this.extend(request, params));
|
|
1735
1813
|
//
|
|
1736
1814
|
// {
|
|
1737
1815
|
// "products": [
|
|
@@ -1834,7 +1912,7 @@ export default class coinbase extends Exchange {
|
|
|
1834
1912
|
'product_id': market['id'],
|
|
1835
1913
|
'limit': 1,
|
|
1836
1914
|
};
|
|
1837
|
-
const response = await this.
|
|
1915
|
+
const response = await this.v3PublicGetBrokerageMarketProductsProductIdTicker(this.extend(request, params));
|
|
1838
1916
|
//
|
|
1839
1917
|
// {
|
|
1840
1918
|
// "trades": [
|
|
@@ -3395,7 +3473,7 @@ export default class coinbase extends Exchange {
|
|
|
3395
3473
|
* @method
|
|
3396
3474
|
* @name coinbase#fetchOHLCV
|
|
3397
3475
|
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
3398
|
-
* @see https://docs.cloud.coinbase.com/advanced-trade-api/reference/
|
|
3476
|
+
* @see https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_getpubliccandles
|
|
3399
3477
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
3400
3478
|
* @param {string} timeframe the length of time each candle represents
|
|
3401
3479
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
@@ -3431,13 +3509,14 @@ export default class coinbase extends Exchange {
|
|
|
3431
3509
|
sinceString = Precise.stringSub(now, requestedDuration.toString());
|
|
3432
3510
|
}
|
|
3433
3511
|
request['start'] = sinceString;
|
|
3434
|
-
|
|
3435
|
-
|
|
3512
|
+
if (until !== undefined) {
|
|
3513
|
+
request['end'] = this.numberToString(this.parseToInt(until / 1000));
|
|
3514
|
+
}
|
|
3515
|
+
else {
|
|
3436
3516
|
// 300 candles max
|
|
3437
|
-
|
|
3517
|
+
request['end'] = Precise.stringAdd(sinceString, requestedDuration.toString());
|
|
3438
3518
|
}
|
|
3439
|
-
|
|
3440
|
-
const response = await this.v3PrivateGetBrokerageProductsProductIdCandles(this.extend(request, params));
|
|
3519
|
+
const response = await this.v3PublicGetBrokerageMarketProductsProductIdCandles(this.extend(request, params));
|
|
3441
3520
|
//
|
|
3442
3521
|
// {
|
|
3443
3522
|
// "candles": [
|
|
@@ -3482,7 +3561,7 @@ export default class coinbase extends Exchange {
|
|
|
3482
3561
|
* @method
|
|
3483
3562
|
* @name coinbase#fetchTrades
|
|
3484
3563
|
* @description get the list of most recent trades for a particular symbol
|
|
3485
|
-
* @see https://docs.cloud.coinbase.com/advanced-trade-api/reference/
|
|
3564
|
+
* @see https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_getpublicmarkettrades
|
|
3486
3565
|
* @param {string} symbol unified market symbol of the trades
|
|
3487
3566
|
* @param {int} [since] not used by coinbase fetchTrades
|
|
3488
3567
|
* @param {int} [limit] the maximum number of trade structures to fetch
|
|
@@ -3508,7 +3587,7 @@ export default class coinbase extends Exchange {
|
|
|
3508
3587
|
else if (since !== undefined) {
|
|
3509
3588
|
throw new ArgumentsRequired(this.id + ' fetchTrades() requires a `until` parameter when you use `since` argument');
|
|
3510
3589
|
}
|
|
3511
|
-
const response = await this.
|
|
3590
|
+
const response = await this.v3PublicGetBrokerageMarketProductsProductIdTicker(this.extend(request, params));
|
|
3512
3591
|
//
|
|
3513
3592
|
// {
|
|
3514
3593
|
// "trades": [
|
|
@@ -3605,7 +3684,7 @@ export default class coinbase extends Exchange {
|
|
|
3605
3684
|
* @method
|
|
3606
3685
|
* @name coinbase#fetchOrderBook
|
|
3607
3686
|
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
3608
|
-
* @see https://docs.cloud.coinbase.com/advanced-trade-api/reference/
|
|
3687
|
+
* @see https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_getpublicproductbook
|
|
3609
3688
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
3610
3689
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
3611
3690
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -3619,7 +3698,7 @@ export default class coinbase extends Exchange {
|
|
|
3619
3698
|
if (limit !== undefined) {
|
|
3620
3699
|
request['limit'] = limit;
|
|
3621
3700
|
}
|
|
3622
|
-
const response = await this.
|
|
3701
|
+
const response = await this.v3PublicGetBrokerageMarketProductBook(this.extend(request, params));
|
|
3623
3702
|
//
|
|
3624
3703
|
// {
|
|
3625
3704
|
// "pricebook": {
|
|
@@ -114,7 +114,7 @@ export default class coinbaseinternational extends Exchange {
|
|
|
114
114
|
fetchOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
|
|
115
115
|
fetchOpenOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
116
116
|
fetchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
117
|
-
withdraw(code: string, amount: number, address:
|
|
117
|
+
withdraw(code: string, amount: number, address: string, tag?: any, params?: {}): Promise<Transaction>;
|
|
118
118
|
safeNetwork(network: any): {
|
|
119
119
|
info: any;
|
|
120
120
|
id: string;
|
|
@@ -93,8 +93,10 @@ export default class coinbaseinternational extends Exchange {
|
|
|
93
93
|
'fetchOrderBook': false,
|
|
94
94
|
'fetchOrders': false,
|
|
95
95
|
'fetchPosition': true,
|
|
96
|
+
'fetchPositionHistory': false,
|
|
96
97
|
'fetchPositionMode': false,
|
|
97
98
|
'fetchPositions': true,
|
|
99
|
+
'fetchPositionsHistory': false,
|
|
98
100
|
'fetchPositionsRisk': false,
|
|
99
101
|
'fetchPremiumIndexOHLCV': false,
|
|
100
102
|
'fetchTicker': true,
|
package/js/src/coinbasepro.d.ts
CHANGED
|
@@ -39,7 +39,7 @@ export default class coinbasepro extends Exchange {
|
|
|
39
39
|
cancelOrder(id: string, symbol?: Str, params?: {}): Promise<any>;
|
|
40
40
|
cancelAllOrders(symbol?: Str, params?: {}): Promise<any>;
|
|
41
41
|
fetchPaymentMethods(params?: {}): Promise<any>;
|
|
42
|
-
withdraw(code: string, amount: number, address:
|
|
42
|
+
withdraw(code: string, amount: number, address: string, tag?: any, params?: {}): Promise<Transaction>;
|
|
43
43
|
parseLedgerEntryType(type: any): string;
|
|
44
44
|
parseLedgerEntry(item: any, currency?: Currency): {
|
|
45
45
|
id: string;
|
package/js/src/coinbasepro.js
CHANGED
|
@@ -56,7 +56,13 @@ export default class coinbasepro extends Exchange {
|
|
|
56
56
|
'fetchOrderBook': true,
|
|
57
57
|
'fetchOrders': true,
|
|
58
58
|
'fetchOrderTrades': true,
|
|
59
|
+
'fetchPosition': false,
|
|
60
|
+
'fetchPositionHistory': false,
|
|
59
61
|
'fetchPositionMode': false,
|
|
62
|
+
'fetchPositions': false,
|
|
63
|
+
'fetchPositionsForSymbol': false,
|
|
64
|
+
'fetchPositionsHistory': false,
|
|
65
|
+
'fetchPositionsRisk': false,
|
|
60
66
|
'fetchTicker': true,
|
|
61
67
|
'fetchTickers': true,
|
|
62
68
|
'fetchTime': true,
|
package/js/src/coincheck.js
CHANGED
|
@@ -55,8 +55,11 @@ export default class coincheck extends Exchange {
|
|
|
55
55
|
'fetchOpenOrders': true,
|
|
56
56
|
'fetchOrderBook': true,
|
|
57
57
|
'fetchPosition': false,
|
|
58
|
+
'fetchPositionHistory': false,
|
|
58
59
|
'fetchPositionMode': false,
|
|
59
60
|
'fetchPositions': false,
|
|
61
|
+
'fetchPositionsForSymbol': false,
|
|
62
|
+
'fetchPositionsHistory': false,
|
|
60
63
|
'fetchPositionsRisk': false,
|
|
61
64
|
'fetchPremiumIndexOHLCV': false,
|
|
62
65
|
'fetchTicker': true,
|
package/js/src/coinex.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Exchange from './abstract/coinex.js';
|
|
2
|
-
import type { Balances, Currency, FundingHistory, FundingRateHistory, Int, Market, OHLCV, Order, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, OrderRequest, TransferEntry, Leverage, Leverages, Num, MarginModification, TradingFeeInterface, Currencies, TradingFees } from './base/types.js';
|
|
2
|
+
import type { Balances, Currency, FundingHistory, FundingRateHistory, Int, Market, OHLCV, Order, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, OrderRequest, TransferEntry, Leverage, Leverages, Num, MarginModification, TradingFeeInterface, Currencies, TradingFees, Position } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class coinex
|
|
5
5
|
* @augments Exchange
|
|
@@ -65,17 +65,17 @@ export default class coinex extends Exchange {
|
|
|
65
65
|
network: any;
|
|
66
66
|
};
|
|
67
67
|
fetchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
68
|
-
fetchPositions(symbols?: Strings, params?: {}): Promise<
|
|
69
|
-
fetchPosition(symbol: string, params?: {}): Promise<
|
|
70
|
-
parsePosition(position: any, market?: Market):
|
|
68
|
+
fetchPositions(symbols?: Strings, params?: {}): Promise<Position[]>;
|
|
69
|
+
fetchPosition(symbol: string, params?: {}): Promise<Position>;
|
|
70
|
+
parsePosition(position: any, market?: Market): Position;
|
|
71
71
|
setMarginMode(marginMode: string, symbol?: Str, params?: {}): Promise<any>;
|
|
72
72
|
setLeverage(leverage: Int, symbol?: Str, params?: {}): Promise<any>;
|
|
73
73
|
fetchLeverageTiers(symbols?: Strings, params?: {}): Promise<{}>;
|
|
74
74
|
parseMarketLeverageTiers(item: any, market?: Market): any[];
|
|
75
75
|
modifyMarginHelper(symbol: string, amount: any, addOrReduce: any, params?: {}): Promise<any>;
|
|
76
76
|
parseMarginModification(data: any, market?: Market): MarginModification;
|
|
77
|
-
addMargin(symbol: string, amount:
|
|
78
|
-
reduceMargin(symbol: string, amount:
|
|
77
|
+
addMargin(symbol: string, amount: number, params?: {}): Promise<MarginModification>;
|
|
78
|
+
reduceMargin(symbol: string, amount: number, params?: {}): Promise<MarginModification>;
|
|
79
79
|
fetchFundingHistory(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<FundingHistory[]>;
|
|
80
80
|
fetchFundingRate(symbol: string, params?: {}): Promise<{
|
|
81
81
|
info: any;
|
|
@@ -116,7 +116,7 @@ export default class coinex extends Exchange {
|
|
|
116
116
|
previousFundingDatetime: any;
|
|
117
117
|
};
|
|
118
118
|
fetchFundingRates(symbols?: Strings, params?: {}): Promise<any>;
|
|
119
|
-
withdraw(code: string, amount: number, address:
|
|
119
|
+
withdraw(code: string, amount: number, address: string, tag?: any, params?: {}): Promise<Transaction>;
|
|
120
120
|
parseTransactionStatus(status: any): string;
|
|
121
121
|
fetchFundingRateHistory(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<FundingRateHistory[]>;
|
|
122
122
|
parseTransaction(transaction: any, currency?: Currency): Transaction;
|
|
@@ -188,6 +188,7 @@ export default class coinex extends Exchange {
|
|
|
188
188
|
parseDepositWithdrawFees(response: any, codes?: any, currencyIdKey?: any): {};
|
|
189
189
|
fetchLeverages(symbols?: string[], params?: {}): Promise<Leverages>;
|
|
190
190
|
parseLeverage(leverage: any, market?: any): Leverage;
|
|
191
|
+
fetchPositionHistory(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Position>;
|
|
191
192
|
handleMarginModeAndParams(methodName: any, params?: {}, defaultValue?: any): any[];
|
|
192
193
|
nonce(): number;
|
|
193
194
|
sign(path: any, api?: any[], method?: string, params?: {}, headers?: any, body?: any): {
|