ccxt 4.1.91 → 4.1.94
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/CHANGELOG.md +37 -0
- package/README.md +3 -3
- package/dist/ccxt.browser.js +695 -262
- package/dist/ccxt.browser.min.js +7 -7
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/binance.js +11 -9
- package/dist/cjs/src/bingx.js +11 -6
- package/dist/cjs/src/bitget.js +120 -79
- package/dist/cjs/src/bitrue.js +2 -11
- package/dist/cjs/src/bybit.js +1 -0
- package/dist/cjs/src/coinbase.js +44 -2
- package/dist/cjs/src/coinone.js +394 -143
- package/dist/cjs/src/hitbtc.js +41 -0
- package/dist/cjs/src/kucoinfutures.js +22 -6
- package/dist/cjs/src/okx.js +2 -0
- package/dist/cjs/src/pro/bingx.js +44 -5
- 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/coinbase.d.ts +6 -0
- package/js/src/abstract/coinone.d.ts +44 -2
- package/js/src/abstract/kucoinfutures.d.ts +2 -0
- package/js/src/abstract/okx.d.ts +2 -0
- package/js/src/binance.js +11 -9
- package/js/src/bingx.js +11 -6
- package/js/src/bitget.d.ts +1 -0
- package/js/src/bitget.js +120 -79
- package/js/src/bitrue.js +2 -11
- package/js/src/bybit.js +1 -0
- package/js/src/coinbase.js +44 -2
- package/js/src/coinone.d.ts +1 -0
- package/js/src/coinone.js +394 -143
- package/js/src/hitbtc.d.ts +1 -0
- package/js/src/hitbtc.js +41 -0
- package/js/src/kucoinfutures.js +22 -6
- package/js/src/okx.js +2 -0
- package/js/src/pro/bingx.d.ts +2 -0
- package/js/src/pro/bingx.js +44 -5
- package/package.json +1 -1
- package/skip-tests.json +7 -0
- package/changelog.js +0 -101
package/dist/ccxt.browser.js
CHANGED
|
@@ -11912,7 +11912,8 @@ class Exchange {
|
|
|
11912
11912
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
11913
11913
|
|
|
11914
11914
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
11915
|
-
/* harmony export */ O: () => (/* binding */ Precise)
|
|
11915
|
+
/* harmony export */ O: () => (/* binding */ Precise),
|
|
11916
|
+
/* harmony export */ Z: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
11916
11917
|
/* harmony export */ });
|
|
11917
11918
|
const zero = BigInt(0);
|
|
11918
11919
|
const minusOne = BigInt(-1);
|
|
@@ -12170,7 +12171,7 @@ class Precise {
|
|
|
12170
12171
|
return (new Precise(string1)).le(new Precise(string2));
|
|
12171
12172
|
}
|
|
12172
12173
|
}
|
|
12173
|
-
/*
|
|
12174
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Precise);
|
|
12174
12175
|
|
|
12175
12176
|
|
|
12176
12177
|
|
|
@@ -20218,7 +20219,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
20218
20219
|
* @see https://binance-docs.github.io/apidocs/futures/en/#24hr-ticker-price-change-statistics // swap
|
|
20219
20220
|
* @see https://binance-docs.github.io/apidocs/delivery/en/#24hr-ticker-price-change-statistics // future
|
|
20220
20221
|
* @see https://binance-docs.github.io/apidocs/voptions/en/#24hr-ticker-price-change-statistics // option
|
|
20221
|
-
* @param {string[]
|
|
20222
|
+
* @param {string[]} [symbols] unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
20222
20223
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
20223
20224
|
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
20224
20225
|
*/
|
|
@@ -20233,22 +20234,24 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
20233
20234
|
[type, params] = this.handleMarketTypeAndParams('fetchTickers', market, params);
|
|
20234
20235
|
let subType = undefined;
|
|
20235
20236
|
[subType, params] = this.handleSubTypeAndParams('fetchTickers', market, params);
|
|
20236
|
-
|
|
20237
|
-
let defaultMethod = undefined;
|
|
20237
|
+
let response = undefined;
|
|
20238
20238
|
if (type === 'option') {
|
|
20239
|
-
|
|
20239
|
+
response = await this.eapiPublicGetTicker(params);
|
|
20240
20240
|
}
|
|
20241
20241
|
else if (this.isLinear(type, subType)) {
|
|
20242
|
-
|
|
20242
|
+
response = await this.fapiPublicGetTicker24hr(params);
|
|
20243
20243
|
}
|
|
20244
20244
|
else if (this.isInverse(type, subType)) {
|
|
20245
|
-
|
|
20245
|
+
response = await this.dapiPublicGetTicker24hr(params);
|
|
20246
20246
|
}
|
|
20247
20247
|
else {
|
|
20248
|
-
|
|
20248
|
+
const request = {};
|
|
20249
|
+
if (symbols !== undefined) {
|
|
20250
|
+
const marketIds = this.marketIds(symbols);
|
|
20251
|
+
request['symbols'] = this.json(marketIds);
|
|
20252
|
+
}
|
|
20253
|
+
response = await this.publicGetTicker24hr(this.extend(request, params));
|
|
20249
20254
|
}
|
|
20250
|
-
const method = this.safeString(this.options, 'fetchTickersMethod', defaultMethod);
|
|
20251
|
-
const response = await this[method](query);
|
|
20252
20255
|
return this.parseTickers(response, symbols);
|
|
20253
20256
|
}
|
|
20254
20257
|
parseOHLCV(ohlcv, market = undefined) {
|
|
@@ -27856,14 +27859,19 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
27856
27859
|
const type = (cost === undefined) ? 'spot' : 'swap';
|
|
27857
27860
|
const currencyId = this.safeString2(trade, 'currency', 'N');
|
|
27858
27861
|
const currencyCode = this.safeCurrencyCode(currencyId);
|
|
27859
|
-
const m = this.safeValue(trade, 'm'
|
|
27862
|
+
const m = this.safeValue(trade, 'm');
|
|
27860
27863
|
const marketId = this.safeString(trade, 's');
|
|
27861
27864
|
const isBuyerMaker = this.safeValue2(trade, 'buyerMaker', 'isBuyerMaker');
|
|
27862
|
-
let takeOrMaker =
|
|
27865
|
+
let takeOrMaker = undefined;
|
|
27866
|
+
if ((isBuyerMaker !== undefined) || (m !== undefined)) {
|
|
27867
|
+
takeOrMaker = (isBuyerMaker || m) ? 'maker' : 'taker';
|
|
27868
|
+
}
|
|
27863
27869
|
let side = this.safeStringLower2(trade, 'side', 'S');
|
|
27864
27870
|
if (side === undefined) {
|
|
27865
|
-
|
|
27866
|
-
|
|
27871
|
+
if ((isBuyerMaker !== undefined) || (m !== undefined)) {
|
|
27872
|
+
side = (isBuyerMaker || m) ? 'sell' : 'buy';
|
|
27873
|
+
takeOrMaker = 'taker';
|
|
27874
|
+
}
|
|
27867
27875
|
}
|
|
27868
27876
|
return this.safeTrade({
|
|
27869
27877
|
'id': this.safeStringN(trade, ['id', 't']),
|
|
@@ -27876,7 +27884,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
27876
27884
|
'side': this.parseOrderSide(side),
|
|
27877
27885
|
'takerOrMaker': takeOrMaker,
|
|
27878
27886
|
'price': this.safeString2(trade, 'price', 'p'),
|
|
27879
|
-
'amount': this.safeStringN(trade, ['qty', 'amount', 'q']),
|
|
27887
|
+
'amount': this.safeStringN(trade, ['qty', 'volume', 'amount', 'q']),
|
|
27880
27888
|
'cost': cost,
|
|
27881
27889
|
'fee': {
|
|
27882
27890
|
'cost': this.parseNumber(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringAbs(this.safeString2(trade, 'commission', 'n'))),
|
|
@@ -28312,7 +28320,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
28312
28320
|
async fetchBalance(params = {}) {
|
|
28313
28321
|
/**
|
|
28314
28322
|
* @method
|
|
28315
|
-
* @name
|
|
28323
|
+
* @name bingx#fetchBalance
|
|
28316
28324
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
28317
28325
|
* @see https://bingx-api.github.io/docs/#/spot/trade-api.html#Query%20Assets
|
|
28318
28326
|
* @see https://bingx-api.github.io/docs/#/swapV2/account-api.html#Get%20Perpetual%20Swap%20Account%20Asset%20Information
|
|
@@ -40303,7 +40311,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
40303
40311
|
'cancelOrder': true,
|
|
40304
40312
|
'cancelOrders': true,
|
|
40305
40313
|
'closeAllPositions': true,
|
|
40306
|
-
'closePosition':
|
|
40314
|
+
'closePosition': true,
|
|
40307
40315
|
'createMarketBuyOrderWithCost': true,
|
|
40308
40316
|
'createMarketOrderWithCost': false,
|
|
40309
40317
|
'createMarketSellOrderWithCost': false,
|
|
@@ -43834,7 +43842,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
43834
43842
|
}
|
|
43835
43843
|
parseOrder(order, market = undefined) {
|
|
43836
43844
|
//
|
|
43837
|
-
// createOrder, editOrder
|
|
43845
|
+
// createOrder, editOrder, closePosition
|
|
43838
43846
|
//
|
|
43839
43847
|
// {
|
|
43840
43848
|
// "clientOid": "abe95dbe-6081-4a6f-a2d3-ae49601cd479",
|
|
@@ -44112,8 +44120,13 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
44112
44120
|
'status': 'rejected',
|
|
44113
44121
|
}, market);
|
|
44114
44122
|
}
|
|
44123
|
+
const isContractOrder = ('posSide' in order);
|
|
44124
|
+
let marketType = isContractOrder ? 'contract' : 'spot';
|
|
44125
|
+
if (market !== undefined) {
|
|
44126
|
+
marketType = market['type'];
|
|
44127
|
+
}
|
|
44115
44128
|
const marketId = this.safeString(order, 'symbol');
|
|
44116
|
-
market = this.safeMarket(marketId, market);
|
|
44129
|
+
market = this.safeMarket(marketId, market, undefined, marketType);
|
|
44117
44130
|
const timestamp = this.safeInteger2(order, 'cTime', 'ctime');
|
|
44118
44131
|
const updateTimestamp = this.safeInteger(order, 'uTime');
|
|
44119
44132
|
const rawStatus = this.safeString2(order, 'status', 'state');
|
|
@@ -45553,13 +45566,14 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
45553
45566
|
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
45554
45567
|
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
45555
45568
|
* @param {string} [params.isPlan] *swap only* 'plan' for stop orders and 'profit_loss' for tp/sl orders, default is 'plan'
|
|
45569
|
+
* @param {string} [params.productType] *contract only* 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES'
|
|
45556
45570
|
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
45557
45571
|
*/
|
|
45558
|
-
if (symbol === undefined) {
|
|
45559
|
-
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' fetchClosedOrders() requires a symbol argument');
|
|
45560
|
-
}
|
|
45561
45572
|
await this.loadMarkets();
|
|
45562
|
-
|
|
45573
|
+
let market = undefined;
|
|
45574
|
+
if (symbol !== undefined) {
|
|
45575
|
+
market = this.market(symbol);
|
|
45576
|
+
}
|
|
45563
45577
|
const response = await this.fetchCanceledAndClosedOrders(symbol, since, limit, params);
|
|
45564
45578
|
const result = [];
|
|
45565
45579
|
for (let i = 0; i < response.length; i++) {
|
|
@@ -45589,13 +45603,14 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
45589
45603
|
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
45590
45604
|
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
45591
45605
|
* @param {string} [params.isPlan] *swap only* 'plan' for stop orders and 'profit_loss' for tp/sl orders, default is 'plan'
|
|
45606
|
+
* @param {string} [params.productType] *contract only* 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES'
|
|
45592
45607
|
* @returns {object} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
45593
45608
|
*/
|
|
45594
|
-
if (symbol === undefined) {
|
|
45595
|
-
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' fetchCanceledOrders() requires a symbol argument');
|
|
45596
|
-
}
|
|
45597
45609
|
await this.loadMarkets();
|
|
45598
|
-
|
|
45610
|
+
let market = undefined;
|
|
45611
|
+
if (symbol !== undefined) {
|
|
45612
|
+
market = this.market(symbol);
|
|
45613
|
+
}
|
|
45599
45614
|
const response = await this.fetchCanceledAndClosedOrders(symbol, since, limit, params);
|
|
45600
45615
|
const result = [];
|
|
45601
45616
|
for (let i = 0; i < response.length; i++) {
|
|
@@ -45612,19 +45627,25 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
45612
45627
|
const sandboxMode = this.safeValue(this.options, 'sandboxMode', false);
|
|
45613
45628
|
let market = undefined;
|
|
45614
45629
|
if (sandboxMode) {
|
|
45615
|
-
|
|
45616
|
-
|
|
45630
|
+
if (symbol !== undefined) {
|
|
45631
|
+
const sandboxSymbol = this.convertSymbolForSandbox(symbol);
|
|
45632
|
+
symbol = sandboxSymbol;
|
|
45633
|
+
}
|
|
45617
45634
|
}
|
|
45618
|
-
|
|
45635
|
+
let request = {};
|
|
45636
|
+
if (symbol !== undefined) {
|
|
45619
45637
|
market = this.market(symbol);
|
|
45638
|
+
request['symbol'] = market['id'];
|
|
45620
45639
|
}
|
|
45640
|
+
let marketType = undefined;
|
|
45641
|
+
[marketType, params] = this.handleMarketTypeAndParams('fetchCanceledAndClosedOrders', market, params);
|
|
45621
45642
|
let marginMode = undefined;
|
|
45622
45643
|
[marginMode, params] = this.handleMarginModeAndParams('fetchCanceledAndClosedOrders', params);
|
|
45623
45644
|
let paginate = false;
|
|
45624
45645
|
[paginate, params] = this.handleOptionAndParams(params, 'fetchCanceledAndClosedOrders', 'paginate');
|
|
45625
45646
|
if (paginate) {
|
|
45626
45647
|
let cursorReceived = undefined;
|
|
45627
|
-
if (
|
|
45648
|
+
if (marketType === 'spot') {
|
|
45628
45649
|
if (marginMode !== undefined) {
|
|
45629
45650
|
cursorReceived = 'minId';
|
|
45630
45651
|
}
|
|
@@ -45634,9 +45655,6 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
45634
45655
|
}
|
|
45635
45656
|
return await this.fetchPaginatedCallCursor('fetchCanceledAndClosedOrders', symbol, since, limit, params, cursorReceived, 'idLessThan');
|
|
45636
45657
|
}
|
|
45637
|
-
let request = {
|
|
45638
|
-
'symbol': market['id'],
|
|
45639
|
-
};
|
|
45640
45658
|
let response = undefined;
|
|
45641
45659
|
const stop = this.safeValue2(params, 'stop', 'trigger');
|
|
45642
45660
|
params = this.omit(params, ['stop', 'trigger']);
|
|
@@ -45647,7 +45665,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
45647
45665
|
if (limit !== undefined) {
|
|
45648
45666
|
request['limit'] = limit;
|
|
45649
45667
|
}
|
|
45650
|
-
if ((
|
|
45668
|
+
if ((marketType === 'swap') || (marketType === 'future') || (marginMode !== undefined)) {
|
|
45651
45669
|
const clientOrderId = this.safeString2(params, 'clientOid', 'clientOrderId');
|
|
45652
45670
|
params = this.omit(params, 'clientOrderId');
|
|
45653
45671
|
if (clientOrderId !== undefined) {
|
|
@@ -45655,7 +45673,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
45655
45673
|
}
|
|
45656
45674
|
}
|
|
45657
45675
|
const now = this.milliseconds();
|
|
45658
|
-
if (
|
|
45676
|
+
if (marketType === 'spot') {
|
|
45659
45677
|
if (marginMode !== undefined) {
|
|
45660
45678
|
if (since === undefined) {
|
|
45661
45679
|
since = now - 7776000000;
|
|
@@ -45670,6 +45688,9 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
45670
45688
|
}
|
|
45671
45689
|
else {
|
|
45672
45690
|
if (stop) {
|
|
45691
|
+
if (symbol === undefined) {
|
|
45692
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' fetchCanceledAndClosedOrders() requires a symbol argument');
|
|
45693
|
+
}
|
|
45673
45694
|
const endTime = this.safeIntegerN(params, ['endTime', 'until', 'till']);
|
|
45674
45695
|
params = this.omit(params, ['until', 'till']);
|
|
45675
45696
|
if (since === undefined) {
|
|
@@ -45878,7 +45899,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
45878
45899
|
// }
|
|
45879
45900
|
//
|
|
45880
45901
|
const data = this.safeValue(response, 'data', {});
|
|
45881
|
-
if (
|
|
45902
|
+
if (marketType === 'spot') {
|
|
45882
45903
|
if ((marginMode !== undefined) || stop) {
|
|
45883
45904
|
return this.safeValue(data, 'orderList', []);
|
|
45884
45905
|
}
|
|
@@ -46566,11 +46587,10 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
46566
46587
|
//
|
|
46567
46588
|
// closeAllPositions
|
|
46568
46589
|
//
|
|
46569
|
-
//
|
|
46570
|
-
//
|
|
46571
|
-
//
|
|
46572
|
-
//
|
|
46573
|
-
// }
|
|
46590
|
+
// {
|
|
46591
|
+
// "orderId": "1120923953904893955",
|
|
46592
|
+
// "clientOid": "1120923953904893956"
|
|
46593
|
+
// }
|
|
46574
46594
|
//
|
|
46575
46595
|
const marketId = this.safeString(position, 'symbol');
|
|
46576
46596
|
market = this.safeMarket(marketId, market, undefined, 'contract');
|
|
@@ -46639,7 +46659,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
46639
46659
|
const percentage = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringMul(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringDiv(unrealizedPnl, initialMargin, 4), '100');
|
|
46640
46660
|
return this.safePosition({
|
|
46641
46661
|
'info': position,
|
|
46642
|
-
'id':
|
|
46662
|
+
'id': this.safeString(position, 'orderId'),
|
|
46643
46663
|
'symbol': symbol,
|
|
46644
46664
|
'notional': this.parseNumber(notional),
|
|
46645
46665
|
'marginMode': marginMode,
|
|
@@ -48259,65 +48279,94 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
48259
48279
|
'info': info,
|
|
48260
48280
|
};
|
|
48261
48281
|
}
|
|
48262
|
-
async
|
|
48282
|
+
async closePosition(symbol, side = undefined, params = {}) {
|
|
48263
48283
|
/**
|
|
48264
48284
|
* @method
|
|
48265
|
-
* @name bitget#
|
|
48266
|
-
* @description closes open
|
|
48267
|
-
* @see https://
|
|
48268
|
-
* @param {
|
|
48269
|
-
* @param {string} [
|
|
48270
|
-
* @param {
|
|
48271
|
-
* @returns {object
|
|
48285
|
+
* @name bitget#closePosition
|
|
48286
|
+
* @description closes an open position for a market
|
|
48287
|
+
* @see https://www.bitget.com/api-doc/contract/trade/Flash-Close-Position
|
|
48288
|
+
* @param {string} symbol unified CCXT market symbol
|
|
48289
|
+
* @param {string} [side] one-way mode: 'buy' or 'sell', hedge-mode: 'long' or 'short'
|
|
48290
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
48291
|
+
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
48272
48292
|
*/
|
|
48273
48293
|
await this.loadMarkets();
|
|
48274
|
-
|
|
48275
|
-
let
|
|
48276
|
-
|
|
48277
|
-
|
|
48278
|
-
|
|
48279
|
-
|
|
48280
|
-
|
|
48281
|
-
|
|
48282
|
-
|
|
48283
|
-
|
|
48284
|
-
|
|
48285
|
-
|
|
48286
|
-
|
|
48287
|
-
|
|
48288
|
-
|
|
48289
|
-
|
|
48290
|
-
|
|
48291
|
-
else if (settle === 'USDC') {
|
|
48292
|
-
localProductType = 'cmcbl';
|
|
48293
|
-
}
|
|
48294
|
-
}
|
|
48295
|
-
if (sandboxMode) {
|
|
48296
|
-
localProductType = 's' + localProductType;
|
|
48297
|
-
}
|
|
48298
|
-
request['productType'] = localProductType;
|
|
48294
|
+
const sandboxMode = this.safeValue(this.options, 'sandboxMode', false);
|
|
48295
|
+
let market = undefined;
|
|
48296
|
+
if (sandboxMode) {
|
|
48297
|
+
const sandboxSymbol = this.convertSymbolForSandbox(symbol);
|
|
48298
|
+
market = this.market(sandboxSymbol);
|
|
48299
|
+
}
|
|
48300
|
+
else {
|
|
48301
|
+
market = this.market(symbol);
|
|
48302
|
+
}
|
|
48303
|
+
let productType = undefined;
|
|
48304
|
+
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
48305
|
+
const request = {
|
|
48306
|
+
'symbol': market['id'],
|
|
48307
|
+
'productType': productType,
|
|
48308
|
+
};
|
|
48309
|
+
if (side !== undefined) {
|
|
48310
|
+
request['holdSide'] = side;
|
|
48299
48311
|
}
|
|
48300
|
-
const response = await this.
|
|
48312
|
+
const response = await this.privateMixPostV2MixOrderClosePositions(this.extend(request, params));
|
|
48301
48313
|
//
|
|
48302
|
-
//
|
|
48303
|
-
//
|
|
48304
|
-
//
|
|
48305
|
-
//
|
|
48306
|
-
//
|
|
48307
|
-
//
|
|
48308
|
-
//
|
|
48309
|
-
//
|
|
48310
|
-
//
|
|
48311
|
-
//
|
|
48312
|
-
//
|
|
48313
|
-
//
|
|
48314
|
-
//
|
|
48315
|
-
//
|
|
48316
|
-
//
|
|
48317
|
-
//
|
|
48314
|
+
// {
|
|
48315
|
+
// "code": "00000",
|
|
48316
|
+
// "msg": "success",
|
|
48317
|
+
// "requestTime": 1702975017017,
|
|
48318
|
+
// "data": {
|
|
48319
|
+
// "successList": [
|
|
48320
|
+
// {
|
|
48321
|
+
// "orderId": "1120923953904893955",
|
|
48322
|
+
// "clientOid": "1120923953904893956"
|
|
48323
|
+
// }
|
|
48324
|
+
// ],
|
|
48325
|
+
// "failureList": [],
|
|
48326
|
+
// "result": false
|
|
48327
|
+
// }
|
|
48328
|
+
// }
|
|
48329
|
+
//
|
|
48330
|
+
const data = this.safeValue(response, 'data', {});
|
|
48331
|
+
const order = this.safeValue(data, 'successList', []);
|
|
48332
|
+
return this.parseOrder(order[0], market);
|
|
48333
|
+
}
|
|
48334
|
+
async closeAllPositions(params = {}) {
|
|
48335
|
+
/**
|
|
48336
|
+
* @method
|
|
48337
|
+
* @name bitget#closeAllPositions
|
|
48338
|
+
* @description closes all open positions for a market type
|
|
48339
|
+
* @see https://www.bitget.com/api-doc/contract/trade/Flash-Close-Position
|
|
48340
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
48341
|
+
* @param {string} [params.productType] 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES'
|
|
48342
|
+
* @returns {object[]} A list of [position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
48343
|
+
*/
|
|
48344
|
+
await this.loadMarkets();
|
|
48345
|
+
let productType = undefined;
|
|
48346
|
+
[productType, params] = this.handleProductTypeAndParams(undefined, params);
|
|
48347
|
+
const request = {
|
|
48348
|
+
'productType': productType,
|
|
48349
|
+
};
|
|
48350
|
+
const response = await this.privateMixPostV2MixOrderClosePositions(this.extend(request, params));
|
|
48351
|
+
//
|
|
48352
|
+
// {
|
|
48353
|
+
// "code": "00000",
|
|
48354
|
+
// "msg": "success",
|
|
48355
|
+
// "requestTime": 1702975017017,
|
|
48356
|
+
// "data": {
|
|
48357
|
+
// "successList": [
|
|
48358
|
+
// {
|
|
48359
|
+
// "orderId": "1120923953904893955",
|
|
48360
|
+
// "clientOid": "1120923953904893956"
|
|
48361
|
+
// }
|
|
48362
|
+
// ],
|
|
48363
|
+
// "failureList": [],
|
|
48364
|
+
// "result": false
|
|
48365
|
+
// }
|
|
48366
|
+
// }
|
|
48318
48367
|
//
|
|
48319
48368
|
const data = this.safeValue(response, 'data', {});
|
|
48320
|
-
const orderInfo = this.safeValue(data, '
|
|
48369
|
+
const orderInfo = this.safeValue(data, 'successList', []);
|
|
48321
48370
|
return this.parsePositions(orderInfo, undefined, params);
|
|
48322
48371
|
}
|
|
48323
48372
|
handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
|
|
@@ -61963,18 +62012,9 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
61963
62012
|
const first = this.safeString(symbols, 0);
|
|
61964
62013
|
const market = this.market(first);
|
|
61965
62014
|
if (market['swap']) {
|
|
61966
|
-
|
|
61967
|
-
if (market['linear']) {
|
|
61968
|
-
response = await this.fapiV1PublicGetTicker(this.extend(request, params));
|
|
61969
|
-
}
|
|
61970
|
-
else if (market['inverse']) {
|
|
61971
|
-
response = await this.dapiV1PublicGetTicker(this.extend(request, params));
|
|
61972
|
-
}
|
|
61973
|
-
response['symbol'] = market['id'];
|
|
61974
|
-
data = [response];
|
|
62015
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchTickers does not support swap markets, please use fetchTicker instead');
|
|
61975
62016
|
}
|
|
61976
62017
|
else if (market['spot']) {
|
|
61977
|
-
request['symbol'] = market['id'];
|
|
61978
62018
|
response = await this.spotV1PublicGetTicker24hr(this.extend(request, params));
|
|
61979
62019
|
data = response;
|
|
61980
62020
|
}
|
|
@@ -61985,7 +62025,7 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
61985
62025
|
else {
|
|
61986
62026
|
[type, params] = this.handleMarketTypeAndParams('fetchTickers', undefined, params);
|
|
61987
62027
|
if (type !== 'spot') {
|
|
61988
|
-
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchTickers only support spot when symbols
|
|
62028
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchTickers only support spot when symbols are not proved');
|
|
61989
62029
|
}
|
|
61990
62030
|
response = await this.spotV1PublicGetTicker24hr(this.extend(request, params));
|
|
61991
62031
|
data = response;
|
|
@@ -75194,6 +75234,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
75194
75234
|
'v5/account/fee-rate': 10,
|
|
75195
75235
|
'v5/account/info': 5,
|
|
75196
75236
|
'v5/account/transaction-log': 1,
|
|
75237
|
+
'v5/account/smp-group': 1,
|
|
75197
75238
|
'v5/account/mmp-state': 5,
|
|
75198
75239
|
// asset
|
|
75199
75240
|
'v5/asset/exchange/order-record': 5,
|
|
@@ -84430,6 +84471,8 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
84430
84471
|
'brokerage/products/{product_id}',
|
|
84431
84472
|
'brokerage/products/{product_id}/candles',
|
|
84432
84473
|
'brokerage/products/{product_id}/ticker',
|
|
84474
|
+
'brokerage/portfolios',
|
|
84475
|
+
'brokerage/portfolios/{portfolio_uuid}',
|
|
84433
84476
|
'brokerage/transaction_summary',
|
|
84434
84477
|
'brokerage/product_book',
|
|
84435
84478
|
'brokerage/best_bid_ask',
|
|
@@ -84441,9 +84484,17 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
84441
84484
|
'brokerage/orders/batch_cancel',
|
|
84442
84485
|
'brokerage/orders/edit',
|
|
84443
84486
|
'brokerage/orders/edit_preview',
|
|
84487
|
+
'brokerage/portfolios',
|
|
84488
|
+
'brokerage/portfolios/move_funds',
|
|
84444
84489
|
'brokerage/convert/quote',
|
|
84445
84490
|
'brokerage/convert/trade/{trade_id}',
|
|
84446
84491
|
],
|
|
84492
|
+
'put': [
|
|
84493
|
+
'brokerage/portfolios/{portfolio_uuid}',
|
|
84494
|
+
],
|
|
84495
|
+
'delete': [
|
|
84496
|
+
'brokerage/portfolios/{portfolio_uuid}',
|
|
84497
|
+
],
|
|
84447
84498
|
},
|
|
84448
84499
|
},
|
|
84449
84500
|
},
|
|
@@ -84499,7 +84550,9 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
84499
84550
|
'invalid_scope': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.AuthenticationError,
|
|
84500
84551
|
'not_found': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError,
|
|
84501
84552
|
'rate_limit_exceeded': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.RateLimitExceeded,
|
|
84502
|
-
'internal_server_error': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError,
|
|
84553
|
+
'internal_server_error': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError,
|
|
84554
|
+
'UNSUPPORTED_ORDER_CONFIGURATION': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest,
|
|
84555
|
+
'INSUFFICIENT_FUND': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest,
|
|
84503
84556
|
},
|
|
84504
84557
|
'broad': {
|
|
84505
84558
|
'request timestamp expired': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidNonce,
|
|
@@ -86504,6 +86557,8 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
86504
86557
|
params = this.omit(params, ['timeInForce', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice', 'stopPrice', 'stop_price', 'stopDirection', 'stop_direction', 'clientOrderId', 'postOnly', 'post_only', 'end_time']);
|
|
86505
86558
|
const response = await this.v3PrivatePostBrokerageOrders(this.extend(request, params));
|
|
86506
86559
|
//
|
|
86560
|
+
// successful order
|
|
86561
|
+
//
|
|
86507
86562
|
// {
|
|
86508
86563
|
// "success": true,
|
|
86509
86564
|
// "failure_reason": "UNKNOWN_FAILURE_REASON",
|
|
@@ -86517,9 +86572,37 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
86517
86572
|
// "order_configuration": null
|
|
86518
86573
|
// }
|
|
86519
86574
|
//
|
|
86575
|
+
// failed order
|
|
86576
|
+
//
|
|
86577
|
+
// {
|
|
86578
|
+
// "success": false,
|
|
86579
|
+
// "failure_reason": "UNKNOWN_FAILURE_REASON",
|
|
86580
|
+
// "order_id": "",
|
|
86581
|
+
// "error_response": {
|
|
86582
|
+
// "error": "UNSUPPORTED_ORDER_CONFIGURATION",
|
|
86583
|
+
// "message": "source is not enabled for trading",
|
|
86584
|
+
// "error_details": "",
|
|
86585
|
+
// "new_order_failure_reason": "UNSUPPORTED_ORDER_CONFIGURATION"
|
|
86586
|
+
// },
|
|
86587
|
+
// "order_configuration": {
|
|
86588
|
+
// "limit_limit_gtc": {
|
|
86589
|
+
// "base_size": "100",
|
|
86590
|
+
// "limit_price": "40000",
|
|
86591
|
+
// "post_only": false
|
|
86592
|
+
// }
|
|
86593
|
+
// }
|
|
86594
|
+
// }
|
|
86595
|
+
//
|
|
86520
86596
|
const success = this.safeValue(response, 'success');
|
|
86521
86597
|
if (success !== true) {
|
|
86522
|
-
|
|
86598
|
+
const errorResponse = this.safeValue(response, 'error_response');
|
|
86599
|
+
const errorTitle = this.safeString(errorResponse, 'error');
|
|
86600
|
+
const errorMessage = this.safeString(errorResponse, 'message');
|
|
86601
|
+
if (errorResponse !== undefined) {
|
|
86602
|
+
this.throwExactlyMatchedException(this.exceptions['exact'], errorTitle, errorMessage);
|
|
86603
|
+
this.throwBroadlyMatchedException(this.exceptions['broad'], errorTitle, errorMessage);
|
|
86604
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError(errorMessage);
|
|
86605
|
+
}
|
|
86523
86606
|
}
|
|
86524
86607
|
const data = this.safeValue(response, 'success_response', {});
|
|
86525
86608
|
return this.parseOrder(data, market);
|
|
@@ -98969,6 +99052,7 @@ class coinone extends _abstract_coinone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
98969
99052
|
'fetchClosedOrders': false,
|
|
98970
99053
|
'fetchCrossBorrowRate': false,
|
|
98971
99054
|
'fetchCrossBorrowRates': false,
|
|
99055
|
+
'fetchCurrencies': true,
|
|
98972
99056
|
'fetchDepositAddresses': true,
|
|
98973
99057
|
'fetchFundingHistory': false,
|
|
98974
99058
|
'fetchFundingRate': false,
|
|
@@ -99005,6 +99089,9 @@ class coinone extends _abstract_coinone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
99005
99089
|
'logo': 'https://user-images.githubusercontent.com/1294454/38003300-adc12fba-323f-11e8-8525-725f53c4a659.jpg',
|
|
99006
99090
|
'api': {
|
|
99007
99091
|
'rest': 'https://api.coinone.co.kr',
|
|
99092
|
+
'v2Public': 'https://api.coinone.co.kr/public/v2',
|
|
99093
|
+
'v2Private': 'https://api.coinone.co.kr/v2',
|
|
99094
|
+
'v2_1Private': 'https://api.coinone.co.kr/v2.1',
|
|
99008
99095
|
},
|
|
99009
99096
|
'www': 'https://coinone.co.kr',
|
|
99010
99097
|
'doc': 'https://doc.coinone.co.kr',
|
|
@@ -99016,31 +99103,85 @@ class coinone extends _abstract_coinone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
99016
99103
|
'api': {
|
|
99017
99104
|
'public': {
|
|
99018
99105
|
'get': [
|
|
99019
|
-
'orderbook
|
|
99020
|
-
'
|
|
99021
|
-
'
|
|
99106
|
+
'orderbook',
|
|
99107
|
+
'ticker',
|
|
99108
|
+
'ticker_utc',
|
|
99109
|
+
'trades',
|
|
99110
|
+
],
|
|
99111
|
+
},
|
|
99112
|
+
'v2Public': {
|
|
99113
|
+
'get': [
|
|
99114
|
+
'range_units',
|
|
99115
|
+
'markets/{quote_currency}',
|
|
99116
|
+
'markets/{quote_currency}/{target_currency}',
|
|
99117
|
+
'orderbook/{quote_currency}/{target_currency}',
|
|
99118
|
+
'trades/{quote_currency}/{target_currency}',
|
|
99119
|
+
'ticker_new/{quote_currency}',
|
|
99120
|
+
'ticker_new/{quote_currency}/{target_currency}',
|
|
99121
|
+
'ticker_utc_new/{quote_currency}',
|
|
99122
|
+
'ticker_utc_new/{quote_currency}/{target_currency}',
|
|
99123
|
+
'currencies',
|
|
99124
|
+
'currencies/{currency}',
|
|
99125
|
+
'chart/{quote_currency}/{target_currency}',
|
|
99022
99126
|
],
|
|
99023
99127
|
},
|
|
99024
99128
|
'private': {
|
|
99025
99129
|
'post': [
|
|
99026
|
-
'account/deposit_address
|
|
99027
|
-
'account/btc_deposit_address
|
|
99028
|
-
'account/balance
|
|
99029
|
-
'account/daily_balance
|
|
99030
|
-
'account/user_info
|
|
99031
|
-
'account/virtual_account
|
|
99032
|
-
'order/cancel_all
|
|
99033
|
-
'order/cancel
|
|
99034
|
-
'order/limit_buy
|
|
99035
|
-
'order/limit_sell
|
|
99036
|
-
'order/complete_orders
|
|
99037
|
-
'order/limit_orders
|
|
99038
|
-
'order/
|
|
99039
|
-
'transaction/auth_number
|
|
99040
|
-
'transaction/history
|
|
99041
|
-
'transaction/krw/history
|
|
99042
|
-
'transaction/btc
|
|
99043
|
-
'transaction/coin
|
|
99130
|
+
'account/deposit_address',
|
|
99131
|
+
'account/btc_deposit_address',
|
|
99132
|
+
'account/balance',
|
|
99133
|
+
'account/daily_balance',
|
|
99134
|
+
'account/user_info',
|
|
99135
|
+
'account/virtual_account',
|
|
99136
|
+
'order/cancel_all',
|
|
99137
|
+
'order/cancel',
|
|
99138
|
+
'order/limit_buy',
|
|
99139
|
+
'order/limit_sell',
|
|
99140
|
+
'order/complete_orders',
|
|
99141
|
+
'order/limit_orders',
|
|
99142
|
+
'order/order_info',
|
|
99143
|
+
'transaction/auth_number',
|
|
99144
|
+
'transaction/history',
|
|
99145
|
+
'transaction/krw/history',
|
|
99146
|
+
'transaction/btc',
|
|
99147
|
+
'transaction/coin',
|
|
99148
|
+
],
|
|
99149
|
+
},
|
|
99150
|
+
'v2Private': {
|
|
99151
|
+
'post': [
|
|
99152
|
+
'account/balance',
|
|
99153
|
+
'account/deposit_address',
|
|
99154
|
+
'account/user_info',
|
|
99155
|
+
'account/virtual_account',
|
|
99156
|
+
'order/cancel',
|
|
99157
|
+
'order/limit_buy',
|
|
99158
|
+
'order/limit_sell',
|
|
99159
|
+
'order/limit_orders',
|
|
99160
|
+
'order/complete_orders',
|
|
99161
|
+
'order/query_order',
|
|
99162
|
+
'transaction/auth_number',
|
|
99163
|
+
'transaction/btc',
|
|
99164
|
+
'transaction/history',
|
|
99165
|
+
'transaction/krw/history',
|
|
99166
|
+
],
|
|
99167
|
+
},
|
|
99168
|
+
'v2_1Private': {
|
|
99169
|
+
'post': [
|
|
99170
|
+
'account/balance/all',
|
|
99171
|
+
'account/balance',
|
|
99172
|
+
'account/trade_fee',
|
|
99173
|
+
'account/trade_fee/{quote_currency}/{target_currency}',
|
|
99174
|
+
'order/limit',
|
|
99175
|
+
'order/cancel',
|
|
99176
|
+
'order/cancel/all',
|
|
99177
|
+
'order/open_orders',
|
|
99178
|
+
'order/open_orders/all',
|
|
99179
|
+
'order/complete_orders',
|
|
99180
|
+
'order/complete_orders/all',
|
|
99181
|
+
'order/info',
|
|
99182
|
+
'transaction/krw/history',
|
|
99183
|
+
'transaction/coin/history',
|
|
99184
|
+
'transaction/coin/withdrawal/limit',
|
|
99044
99185
|
],
|
|
99045
99186
|
},
|
|
99046
99187
|
},
|
|
@@ -99064,53 +99205,129 @@ class coinone extends _abstract_coinone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
99064
99205
|
},
|
|
99065
99206
|
});
|
|
99066
99207
|
}
|
|
99208
|
+
async fetchCurrencies(params = {}) {
|
|
99209
|
+
/**
|
|
99210
|
+
* @method
|
|
99211
|
+
* @name coinone#fetchCurrencies
|
|
99212
|
+
* @description fetches all available currencies on an exchange
|
|
99213
|
+
* @see https://docs.coinone.co.kr/reference/currencies
|
|
99214
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
99215
|
+
* @returns {object} an associative dictionary of currencies
|
|
99216
|
+
*/
|
|
99217
|
+
const response = await this.v2PublicGetCurrencies(params);
|
|
99218
|
+
//
|
|
99219
|
+
// {
|
|
99220
|
+
// "result": "success",
|
|
99221
|
+
// "error_code": "0",
|
|
99222
|
+
// "server_time": 1701054555578,
|
|
99223
|
+
// "currencies": [
|
|
99224
|
+
// {
|
|
99225
|
+
// "name": "Polygon",
|
|
99226
|
+
// "symbol": "MATIC",
|
|
99227
|
+
// "deposit_status": "normal",
|
|
99228
|
+
// "withdraw_status": "normal",
|
|
99229
|
+
// "deposit_confirm_count": 150,
|
|
99230
|
+
// "max_precision": 8,
|
|
99231
|
+
// "deposit_fee": "0.0",
|
|
99232
|
+
// "withdrawal_min_amount": "1.0",
|
|
99233
|
+
// "withdrawal_fee": "3.0"
|
|
99234
|
+
// }
|
|
99235
|
+
// ]
|
|
99236
|
+
// }
|
|
99237
|
+
//
|
|
99238
|
+
const result = {};
|
|
99239
|
+
const currencies = this.safeValue(response, 'currencies', []);
|
|
99240
|
+
for (let i = 0; i < currencies.length; i++) {
|
|
99241
|
+
const entry = currencies[i];
|
|
99242
|
+
const id = this.safeString(entry, 'symbol');
|
|
99243
|
+
const name = this.safeString(entry, 'name');
|
|
99244
|
+
const code = this.safeCurrencyCode(id);
|
|
99245
|
+
const withdrawStatus = this.safeString(entry, 'withdraw_status', '');
|
|
99246
|
+
const depositStatus = this.safeString(entry, 'deposit_status', '');
|
|
99247
|
+
const isWithdrawEnabled = withdrawStatus === 'normal';
|
|
99248
|
+
const isDepositEnabled = depositStatus === 'normal';
|
|
99249
|
+
result[code] = {
|
|
99250
|
+
'id': id,
|
|
99251
|
+
'code': code,
|
|
99252
|
+
'info': entry,
|
|
99253
|
+
'name': name,
|
|
99254
|
+
'active': isWithdrawEnabled && isDepositEnabled,
|
|
99255
|
+
'deposit': isDepositEnabled,
|
|
99256
|
+
'withdraw': isWithdrawEnabled,
|
|
99257
|
+
'fee': this.safeNumber(entry, 'withdrawal_fee'),
|
|
99258
|
+
'precision': this.parseNumber(this.parsePrecision(this.safeString(entry, 'max_precision'))),
|
|
99259
|
+
'limits': {
|
|
99260
|
+
'amount': {
|
|
99261
|
+
'min': undefined,
|
|
99262
|
+
'max': undefined,
|
|
99263
|
+
},
|
|
99264
|
+
'withdraw': {
|
|
99265
|
+
'min': this.safeNumber(entry, 'withdrawal_min_amount'),
|
|
99266
|
+
'max': undefined,
|
|
99267
|
+
},
|
|
99268
|
+
},
|
|
99269
|
+
'networks': {},
|
|
99270
|
+
};
|
|
99271
|
+
}
|
|
99272
|
+
return result;
|
|
99273
|
+
}
|
|
99067
99274
|
async fetchMarkets(params = {}) {
|
|
99068
99275
|
/**
|
|
99069
99276
|
* @method
|
|
99070
99277
|
* @name coinone#fetchMarkets
|
|
99071
99278
|
* @description retrieves data on all markets for coinone
|
|
99279
|
+
* @see https://docs.coinone.co.kr/v1.0/reference/tickers
|
|
99072
99280
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
99073
99281
|
* @returns {object[]} an array of objects representing market data
|
|
99074
99282
|
*/
|
|
99075
99283
|
const request = {
|
|
99076
|
-
'
|
|
99284
|
+
'quote_currency': 'KRW',
|
|
99077
99285
|
};
|
|
99078
|
-
const response = await this.
|
|
99286
|
+
const response = await this.v2PublicGetTickerNewQuoteCurrency(request);
|
|
99079
99287
|
//
|
|
99080
|
-
//
|
|
99081
|
-
//
|
|
99082
|
-
//
|
|
99083
|
-
//
|
|
99084
|
-
//
|
|
99085
|
-
//
|
|
99086
|
-
//
|
|
99087
|
-
//
|
|
99088
|
-
//
|
|
99089
|
-
//
|
|
99090
|
-
//
|
|
99091
|
-
//
|
|
99092
|
-
//
|
|
99093
|
-
//
|
|
99094
|
-
//
|
|
99095
|
-
//
|
|
99096
|
-
//
|
|
99097
|
-
//
|
|
99098
|
-
//
|
|
99288
|
+
// {
|
|
99289
|
+
// "result": "success",
|
|
99290
|
+
// "error_code": "0",
|
|
99291
|
+
// "server_time": 1701067923060,
|
|
99292
|
+
// "tickers": [
|
|
99293
|
+
// {
|
|
99294
|
+
// "quote_currency": "krw",
|
|
99295
|
+
// "target_currency": "stg",
|
|
99296
|
+
// "timestamp": 1701067920001,
|
|
99297
|
+
// "high": "667.5",
|
|
99298
|
+
// "low": "667.5",
|
|
99299
|
+
// "first": "667.5",
|
|
99300
|
+
// "last": "667.5",
|
|
99301
|
+
// "quote_volume": "0.0",
|
|
99302
|
+
// "target_volume": "0.0",
|
|
99303
|
+
// "best_asks": [
|
|
99304
|
+
// {
|
|
99305
|
+
// "price": "777.0",
|
|
99306
|
+
// "qty": "73.9098"
|
|
99307
|
+
// }
|
|
99308
|
+
// ],
|
|
99309
|
+
// "best_bids": [
|
|
99310
|
+
// {
|
|
99311
|
+
// "price": "690.8",
|
|
99312
|
+
// "qty": "40.7768"
|
|
99313
|
+
// }
|
|
99314
|
+
// ],
|
|
99315
|
+
// "id": "1701067920001001"
|
|
99316
|
+
// }
|
|
99317
|
+
// ]
|
|
99318
|
+
// }
|
|
99099
99319
|
//
|
|
99320
|
+
const tickers = this.safeValue(response, 'tickers', []);
|
|
99100
99321
|
const result = [];
|
|
99101
|
-
|
|
99102
|
-
|
|
99103
|
-
|
|
99104
|
-
|
|
99105
|
-
const
|
|
99106
|
-
const ticker = this.safeValue(response, baseId, {});
|
|
99107
|
-
const currency = this.safeValue(ticker, 'currency');
|
|
99108
|
-
if (currency === undefined) {
|
|
99109
|
-
continue;
|
|
99110
|
-
}
|
|
99322
|
+
for (let i = 0; i < tickers.length; i++) {
|
|
99323
|
+
const entry = this.safeValue(tickers, i);
|
|
99324
|
+
const id = this.safeString(entry, 'id');
|
|
99325
|
+
const baseId = this.safeStringUpper(entry, 'target_currency');
|
|
99326
|
+
const quoteId = this.safeStringUpper(entry, 'quote_currency');
|
|
99111
99327
|
const base = this.safeCurrencyCode(baseId);
|
|
99328
|
+
const quote = this.safeCurrencyCode(quoteId);
|
|
99112
99329
|
result.push({
|
|
99113
|
-
'id':
|
|
99330
|
+
'id': id,
|
|
99114
99331
|
'symbol': base + '/' + quote,
|
|
99115
99332
|
'base': base,
|
|
99116
99333
|
'quote': quote,
|
|
@@ -99157,7 +99374,7 @@ class coinone extends _abstract_coinone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
99157
99374
|
},
|
|
99158
99375
|
},
|
|
99159
99376
|
'created': undefined,
|
|
99160
|
-
'info':
|
|
99377
|
+
'info': entry,
|
|
99161
99378
|
});
|
|
99162
99379
|
}
|
|
99163
99380
|
return result;
|
|
@@ -99186,11 +99403,12 @@ class coinone extends _abstract_coinone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
99186
99403
|
* @method
|
|
99187
99404
|
* @name coinone#fetchBalance
|
|
99188
99405
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
99406
|
+
* @see https://docs.coinone.co.kr/v1.0/reference/v21
|
|
99189
99407
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
99190
99408
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
99191
99409
|
*/
|
|
99192
99410
|
await this.loadMarkets();
|
|
99193
|
-
const response = await this.
|
|
99411
|
+
const response = await this.v2PrivatePostAccountBalance(params);
|
|
99194
99412
|
return this.parseBalance(response);
|
|
99195
99413
|
}
|
|
99196
99414
|
async fetchOrderBook(symbol, limit = undefined, params = {}) {
|
|
@@ -99198,6 +99416,7 @@ class coinone extends _abstract_coinone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
99198
99416
|
* @method
|
|
99199
99417
|
* @name coinone#fetchOrderBook
|
|
99200
99418
|
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
99419
|
+
* @see https://docs.coinone.co.kr/v1.0/reference/orderbook
|
|
99201
99420
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
99202
99421
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
99203
99422
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -99206,18 +99425,46 @@ class coinone extends _abstract_coinone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
99206
99425
|
await this.loadMarkets();
|
|
99207
99426
|
const market = this.market(symbol);
|
|
99208
99427
|
const request = {
|
|
99209
|
-
'
|
|
99210
|
-
'
|
|
99428
|
+
'quote_currency': market['quote'],
|
|
99429
|
+
'target_currency': market['base'],
|
|
99211
99430
|
};
|
|
99212
|
-
|
|
99213
|
-
|
|
99214
|
-
|
|
99431
|
+
if (limit !== undefined) {
|
|
99432
|
+
request['size'] = limit; // only support 5, 10, 15, 16
|
|
99433
|
+
}
|
|
99434
|
+
const response = await this.v2PublicGetOrderbookQuoteCurrencyTargetCurrency(this.extend(request, params));
|
|
99435
|
+
//
|
|
99436
|
+
// {
|
|
99437
|
+
// "result": "success",
|
|
99438
|
+
// "error_code": "0",
|
|
99439
|
+
// "timestamp": 1701071108673,
|
|
99440
|
+
// "id": "1701071108673001",
|
|
99441
|
+
// "quote_currency": "KRW",
|
|
99442
|
+
// "target_currency": "BTC",
|
|
99443
|
+
// "order_book_unit": "0.0",
|
|
99444
|
+
// "bids": [
|
|
99445
|
+
// {
|
|
99446
|
+
// "price": "50048000",
|
|
99447
|
+
// "qty": "0.01080229"
|
|
99448
|
+
// }
|
|
99449
|
+
// ],
|
|
99450
|
+
// "asks": [
|
|
99451
|
+
// {
|
|
99452
|
+
// "price": "50058000",
|
|
99453
|
+
// "qty": "0.00272592"
|
|
99454
|
+
// }
|
|
99455
|
+
// ]
|
|
99456
|
+
// }
|
|
99457
|
+
//
|
|
99458
|
+
const timestamp = this.safeInteger(response, 'timestamp');
|
|
99459
|
+
return this.parseOrderBook(response, market['symbol'], timestamp, 'bids', 'asks', 'price', 'qty');
|
|
99215
99460
|
}
|
|
99216
99461
|
async fetchTickers(symbols = undefined, params = {}) {
|
|
99217
99462
|
/**
|
|
99218
99463
|
* @method
|
|
99219
99464
|
* @name coinone#fetchTickers
|
|
99220
99465
|
* @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
|
99466
|
+
* @see https://docs.coinone.co.kr/v1.0/reference/tickers
|
|
99467
|
+
* @see https://docs.coinone.co.kr/v1.0/reference/ticker
|
|
99221
99468
|
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
99222
99469
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
99223
99470
|
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -99225,28 +99472,62 @@ class coinone extends _abstract_coinone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
99225
99472
|
await this.loadMarkets();
|
|
99226
99473
|
symbols = this.marketSymbols(symbols);
|
|
99227
99474
|
const request = {
|
|
99228
|
-
'
|
|
99229
|
-
'format': 'json',
|
|
99475
|
+
'quote_currency': 'KRW',
|
|
99230
99476
|
};
|
|
99231
|
-
|
|
99232
|
-
|
|
99233
|
-
|
|
99234
|
-
|
|
99235
|
-
|
|
99236
|
-
|
|
99237
|
-
|
|
99238
|
-
|
|
99239
|
-
const ticker = response[id];
|
|
99240
|
-
result[symbol] = this.parseTicker(ticker, market);
|
|
99241
|
-
result[symbol]['timestamp'] = timestamp;
|
|
99477
|
+
let market = undefined;
|
|
99478
|
+
let response = undefined;
|
|
99479
|
+
if (symbols !== undefined) {
|
|
99480
|
+
const first = this.safeString(symbols, 0);
|
|
99481
|
+
market = this.market(first);
|
|
99482
|
+
request['quote_currency'] = market['quote'];
|
|
99483
|
+
request['target_currency'] = market['base'];
|
|
99484
|
+
response = await this.v2PublicGetTickerNewQuoteCurrencyTargetCurrency(this.extend(request, params));
|
|
99242
99485
|
}
|
|
99243
|
-
|
|
99486
|
+
else {
|
|
99487
|
+
response = await this.v2PublicGetTickerNewQuoteCurrency(this.extend(request, params));
|
|
99488
|
+
}
|
|
99489
|
+
//
|
|
99490
|
+
// {
|
|
99491
|
+
// "result": "success",
|
|
99492
|
+
// "error_code": "0",
|
|
99493
|
+
// "server_time": 1701073358487,
|
|
99494
|
+
// "tickers": [
|
|
99495
|
+
// {
|
|
99496
|
+
// "quote_currency": "krw",
|
|
99497
|
+
// "target_currency": "btc",
|
|
99498
|
+
// "timestamp": 1701073357818,
|
|
99499
|
+
// "high": "50543000.0",
|
|
99500
|
+
// "low": "49945000.0",
|
|
99501
|
+
// "first": "50487000.0",
|
|
99502
|
+
// "last": "50062000.0",
|
|
99503
|
+
// "quote_volume": "11349804285.3859",
|
|
99504
|
+
// "target_volume": "226.07268994",
|
|
99505
|
+
// "best_asks": [
|
|
99506
|
+
// {
|
|
99507
|
+
// "price": "50081000.0",
|
|
99508
|
+
// "qty": "0.18471358"
|
|
99509
|
+
// }
|
|
99510
|
+
// ],
|
|
99511
|
+
// "best_bids": [
|
|
99512
|
+
// {
|
|
99513
|
+
// "price": "50062000.0",
|
|
99514
|
+
// "qty": "0.04213455"
|
|
99515
|
+
// }
|
|
99516
|
+
// ],
|
|
99517
|
+
// "id": "1701073357818001"
|
|
99518
|
+
// }
|
|
99519
|
+
// ]
|
|
99520
|
+
// }
|
|
99521
|
+
//
|
|
99522
|
+
const data = this.safeValue(response, 'tickers', []);
|
|
99523
|
+
return this.parseTickers(data, symbols);
|
|
99244
99524
|
}
|
|
99245
99525
|
async fetchTicker(symbol, params = {}) {
|
|
99246
99526
|
/**
|
|
99247
99527
|
* @method
|
|
99248
99528
|
* @name coinone#fetchTicker
|
|
99249
99529
|
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
99530
|
+
* @see https://docs.coinone.co.kr/v1.0/reference/ticker
|
|
99250
99531
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
99251
99532
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
99252
99533
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -99254,53 +99535,102 @@ class coinone extends _abstract_coinone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
99254
99535
|
await this.loadMarkets();
|
|
99255
99536
|
const market = this.market(symbol);
|
|
99256
99537
|
const request = {
|
|
99257
|
-
'
|
|
99258
|
-
'
|
|
99538
|
+
'quote_currency': market['quote'],
|
|
99539
|
+
'target_currency': market['base'],
|
|
99259
99540
|
};
|
|
99260
|
-
const response = await this.
|
|
99261
|
-
|
|
99541
|
+
const response = await this.v2PublicGetTickerNewQuoteCurrencyTargetCurrency(this.extend(request, params));
|
|
99542
|
+
//
|
|
99543
|
+
// {
|
|
99544
|
+
// "result": "success",
|
|
99545
|
+
// "error_code": "0",
|
|
99546
|
+
// "server_time": 1701073358487,
|
|
99547
|
+
// "tickers": [
|
|
99548
|
+
// {
|
|
99549
|
+
// "quote_currency": "krw",
|
|
99550
|
+
// "target_currency": "btc",
|
|
99551
|
+
// "timestamp": 1701073357818,
|
|
99552
|
+
// "high": "50543000.0",
|
|
99553
|
+
// "low": "49945000.0",
|
|
99554
|
+
// "first": "50487000.0",
|
|
99555
|
+
// "last": "50062000.0",
|
|
99556
|
+
// "quote_volume": "11349804285.3859",
|
|
99557
|
+
// "target_volume": "226.07268994",
|
|
99558
|
+
// "best_asks": [
|
|
99559
|
+
// {
|
|
99560
|
+
// "price": "50081000.0",
|
|
99561
|
+
// "qty": "0.18471358"
|
|
99562
|
+
// }
|
|
99563
|
+
// ],
|
|
99564
|
+
// "best_bids": [
|
|
99565
|
+
// {
|
|
99566
|
+
// "price": "50062000.0",
|
|
99567
|
+
// "qty": "0.04213455"
|
|
99568
|
+
// }
|
|
99569
|
+
// ],
|
|
99570
|
+
// "id": "1701073357818001"
|
|
99571
|
+
// }
|
|
99572
|
+
// ]
|
|
99573
|
+
// }
|
|
99574
|
+
//
|
|
99575
|
+
const data = this.safeValue(response, 'tickers', []);
|
|
99576
|
+
const ticker = this.safeValue(data, 0, {});
|
|
99577
|
+
return this.parseTicker(ticker, market);
|
|
99262
99578
|
}
|
|
99263
99579
|
parseTicker(ticker, market = undefined) {
|
|
99264
99580
|
//
|
|
99265
99581
|
// {
|
|
99266
|
-
// "
|
|
99267
|
-
// "
|
|
99268
|
-
// "
|
|
99269
|
-
// "high":"0
|
|
99270
|
-
// "
|
|
99271
|
-
// "
|
|
99272
|
-
// "
|
|
99273
|
-
// "
|
|
99274
|
-
// "
|
|
99275
|
-
// "
|
|
99276
|
-
//
|
|
99582
|
+
// "quote_currency": "krw",
|
|
99583
|
+
// "target_currency": "btc",
|
|
99584
|
+
// "timestamp": 1701073357818,
|
|
99585
|
+
// "high": "50543000.0",
|
|
99586
|
+
// "low": "49945000.0",
|
|
99587
|
+
// "first": "50487000.0",
|
|
99588
|
+
// "last": "50062000.0",
|
|
99589
|
+
// "quote_volume": "11349804285.3859",
|
|
99590
|
+
// "target_volume": "226.07268994",
|
|
99591
|
+
// "best_asks": [
|
|
99592
|
+
// {
|
|
99593
|
+
// "price": "50081000.0",
|
|
99594
|
+
// "qty": "0.18471358"
|
|
99595
|
+
// }
|
|
99596
|
+
// ],
|
|
99597
|
+
// "best_bids": [
|
|
99598
|
+
// {
|
|
99599
|
+
// "price": "50062000.0",
|
|
99600
|
+
// "qty": "0.04213455"
|
|
99601
|
+
// }
|
|
99602
|
+
// ],
|
|
99603
|
+
// "id": "1701073357818001"
|
|
99277
99604
|
// }
|
|
99278
99605
|
//
|
|
99279
|
-
const timestamp = this.
|
|
99280
|
-
const open = this.safeString(ticker, 'first');
|
|
99606
|
+
const timestamp = this.safeInteger(ticker, 'timestamp');
|
|
99281
99607
|
const last = this.safeString(ticker, 'last');
|
|
99282
|
-
const
|
|
99283
|
-
const
|
|
99608
|
+
const asks = this.safeValue(ticker, 'best_asks');
|
|
99609
|
+
const bids = this.safeValue(ticker, 'best_bids');
|
|
99610
|
+
const baseId = this.safeString(ticker, 'target_currency');
|
|
99611
|
+
const quoteId = this.safeString(ticker, 'quote_currency');
|
|
99612
|
+
const base = this.safeCurrencyCode(baseId);
|
|
99613
|
+
const quote = this.safeCurrencyCode(quoteId);
|
|
99284
99614
|
return this.safeTicker({
|
|
99285
|
-
'symbol':
|
|
99615
|
+
'symbol': base + '/' + quote,
|
|
99286
99616
|
'timestamp': timestamp,
|
|
99287
99617
|
'datetime': this.iso8601(timestamp),
|
|
99288
99618
|
'high': this.safeString(ticker, 'high'),
|
|
99289
99619
|
'low': this.safeString(ticker, 'low'),
|
|
99290
|
-
'bid':
|
|
99291
|
-
'bidVolume':
|
|
99292
|
-
'ask':
|
|
99293
|
-
'askVolume':
|
|
99620
|
+
'bid': this.safeString(bids, 'price'),
|
|
99621
|
+
'bidVolume': this.safeString(bids, 'qty'),
|
|
99622
|
+
'ask': this.safeString(asks, 'price'),
|
|
99623
|
+
'askVolume': this.safeString(asks, 'qty'),
|
|
99294
99624
|
'vwap': undefined,
|
|
99295
|
-
'open':
|
|
99625
|
+
'open': this.safeString(ticker, 'first'),
|
|
99296
99626
|
'close': last,
|
|
99297
99627
|
'last': last,
|
|
99298
|
-
'previousClose':
|
|
99628
|
+
'previousClose': undefined,
|
|
99299
99629
|
'change': undefined,
|
|
99300
99630
|
'percentage': undefined,
|
|
99301
99631
|
'average': undefined,
|
|
99302
|
-
'baseVolume': this.safeString(ticker, '
|
|
99303
|
-
'quoteVolume':
|
|
99632
|
+
'baseVolume': this.safeString(ticker, 'target_volume'),
|
|
99633
|
+
'quoteVolume': this.safeString(ticker, 'quote_volume'),
|
|
99304
99634
|
'info': ticker,
|
|
99305
99635
|
}, market);
|
|
99306
99636
|
}
|
|
@@ -99309,10 +99639,11 @@ class coinone extends _abstract_coinone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
99309
99639
|
// fetchTrades (public)
|
|
99310
99640
|
//
|
|
99311
99641
|
// {
|
|
99312
|
-
// "
|
|
99313
|
-
// "
|
|
99314
|
-
// "
|
|
99315
|
-
// "
|
|
99642
|
+
// "id": "1701075265708001",
|
|
99643
|
+
// "timestamp": 1701075265708,
|
|
99644
|
+
// "price": "50020000",
|
|
99645
|
+
// "qty": "0.00155177",
|
|
99646
|
+
// "is_seller_maker": false
|
|
99316
99647
|
// }
|
|
99317
99648
|
//
|
|
99318
99649
|
// fetchMyTrades (private)
|
|
@@ -99327,25 +99658,12 @@ class coinone extends _abstract_coinone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
99327
99658
|
// "orderId": "E84A1AC2-8088-4FA0-B093-A3BCDB9B3C85"
|
|
99328
99659
|
// }
|
|
99329
99660
|
//
|
|
99330
|
-
const timestamp = this.
|
|
99661
|
+
const timestamp = this.safeInteger(trade, 'timestamp');
|
|
99331
99662
|
market = this.safeMarket(undefined, market);
|
|
99332
|
-
const
|
|
99333
|
-
let side =
|
|
99334
|
-
if (
|
|
99335
|
-
|
|
99336
|
-
side = 'sell';
|
|
99337
|
-
}
|
|
99338
|
-
else if (is_ask === '0') {
|
|
99339
|
-
side = 'buy';
|
|
99340
|
-
}
|
|
99341
|
-
}
|
|
99342
|
-
else {
|
|
99343
|
-
if (side === 'ask') {
|
|
99344
|
-
side = 'sell';
|
|
99345
|
-
}
|
|
99346
|
-
else if (side === 'bid') {
|
|
99347
|
-
side = 'buy';
|
|
99348
|
-
}
|
|
99663
|
+
const isSellerMaker = this.safeValue(trade, 'is_seller_maker');
|
|
99664
|
+
let side = undefined;
|
|
99665
|
+
if (isSellerMaker !== undefined) {
|
|
99666
|
+
side = isSellerMaker ? 'sell' : 'buy';
|
|
99349
99667
|
}
|
|
99350
99668
|
const priceString = this.safeString(trade, 'price');
|
|
99351
99669
|
const amountString = this.safeString(trade, 'qty');
|
|
@@ -99384,6 +99702,7 @@ class coinone extends _abstract_coinone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
99384
99702
|
* @method
|
|
99385
99703
|
* @name coinone#fetchTrades
|
|
99386
99704
|
* @description get the list of most recent trades for a particular symbol
|
|
99705
|
+
* @see https://docs.coinone.co.kr/v1.0/reference/recent-completed-orders
|
|
99387
99706
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
99388
99707
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
99389
99708
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
@@ -99393,28 +99712,33 @@ class coinone extends _abstract_coinone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
99393
99712
|
await this.loadMarkets();
|
|
99394
99713
|
const market = this.market(symbol);
|
|
99395
99714
|
const request = {
|
|
99396
|
-
'
|
|
99397
|
-
'
|
|
99715
|
+
'quote_currency': market['quote'],
|
|
99716
|
+
'target_currency': market['base'],
|
|
99398
99717
|
};
|
|
99399
|
-
|
|
99718
|
+
if (limit !== undefined) {
|
|
99719
|
+
request['size'] = limit; // only support 10, 50, 100, 150, 200
|
|
99720
|
+
}
|
|
99721
|
+
const response = await this.v2PublicGetTradesQuoteCurrencyTargetCurrency(this.extend(request, params));
|
|
99400
99722
|
//
|
|
99401
99723
|
// {
|
|
99402
99724
|
// "result": "success",
|
|
99403
|
-
// "
|
|
99404
|
-
// "
|
|
99405
|
-
// "
|
|
99406
|
-
// "
|
|
99725
|
+
// "error_code": "0",
|
|
99726
|
+
// "server_time": 1701075315771,
|
|
99727
|
+
// "quote_currency": "KRW",
|
|
99728
|
+
// "target_currency": "BTC",
|
|
99729
|
+
// "transactions": [
|
|
99407
99730
|
// {
|
|
99408
|
-
// "
|
|
99409
|
-
// "
|
|
99410
|
-
// "
|
|
99411
|
-
// "
|
|
99731
|
+
// "id": "1701075265708001",
|
|
99732
|
+
// "timestamp": 1701075265708,
|
|
99733
|
+
// "price": "50020000",
|
|
99734
|
+
// "qty": "0.00155177",
|
|
99735
|
+
// "is_seller_maker": false
|
|
99412
99736
|
// }
|
|
99413
99737
|
// ]
|
|
99414
99738
|
// }
|
|
99415
99739
|
//
|
|
99416
|
-
const
|
|
99417
|
-
return this.parseTrades(
|
|
99740
|
+
const data = this.safeValue(response, 'transactions', []);
|
|
99741
|
+
return this.parseTrades(data, market, since, limit);
|
|
99418
99742
|
}
|
|
99419
99743
|
async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
|
|
99420
99744
|
/**
|
|
@@ -99470,7 +99794,7 @@ class coinone extends _abstract_coinone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
99470
99794
|
'order_id': id,
|
|
99471
99795
|
'currency': market['id'],
|
|
99472
99796
|
};
|
|
99473
|
-
const response = await this.
|
|
99797
|
+
const response = await this.v2PrivatePostOrderQueryOrder(this.extend(request, params));
|
|
99474
99798
|
//
|
|
99475
99799
|
// {
|
|
99476
99800
|
// "result": "success",
|
|
@@ -99681,7 +100005,7 @@ class coinone extends _abstract_coinone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
99681
100005
|
const request = {
|
|
99682
100006
|
'currency': market['id'],
|
|
99683
100007
|
};
|
|
99684
|
-
const response = await this.
|
|
100008
|
+
const response = await this.v2PrivatePostOrderCompleteOrders(this.extend(request, params));
|
|
99685
100009
|
//
|
|
99686
100010
|
// despite the name of the endpoint it returns trades which may have a duplicate orderId
|
|
99687
100011
|
// https://github.com/ccxt/ccxt/pull/7067
|
|
@@ -99734,7 +100058,7 @@ class coinone extends _abstract_coinone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
99734
100058
|
'is_ask': isAsk,
|
|
99735
100059
|
'currency': this.marketId(symbol),
|
|
99736
100060
|
};
|
|
99737
|
-
const response = await this.
|
|
100061
|
+
const response = await this.v2PrivatePostOrderCancel(this.extend(request, params));
|
|
99738
100062
|
//
|
|
99739
100063
|
// {
|
|
99740
100064
|
// "result": "success",
|
|
@@ -99753,7 +100077,7 @@ class coinone extends _abstract_coinone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
99753
100077
|
* @returns {object} a list of [address structures]{@link https://docs.ccxt.com/#/?id=address-structure}
|
|
99754
100078
|
*/
|
|
99755
100079
|
await this.loadMarkets();
|
|
99756
|
-
const response = await this.
|
|
100080
|
+
const response = await this.v2PrivatePostAccountDepositAddress(params);
|
|
99757
100081
|
//
|
|
99758
100082
|
// {
|
|
99759
100083
|
// "result": "success",
|
|
@@ -99806,6 +100130,16 @@ class coinone extends _abstract_coinone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
99806
100130
|
const request = this.implodeParams(path, params);
|
|
99807
100131
|
const query = this.omit(params, this.extractParams(path));
|
|
99808
100132
|
let url = this.urls['api']['rest'] + '/';
|
|
100133
|
+
if (api === 'v2Public') {
|
|
100134
|
+
url = this.urls['api']['v2Public'] + '/';
|
|
100135
|
+
api = 'public';
|
|
100136
|
+
}
|
|
100137
|
+
else if (api === 'v2Private') {
|
|
100138
|
+
url = this.urls['api']['v2Private'] + '/';
|
|
100139
|
+
}
|
|
100140
|
+
else if (api === 'v2_1Private') {
|
|
100141
|
+
url = this.urls['api']['v2_1Private'] + '/';
|
|
100142
|
+
}
|
|
99809
100143
|
if (api === 'public') {
|
|
99810
100144
|
url += request;
|
|
99811
100145
|
if (Object.keys(query).length) {
|
|
@@ -99814,7 +100148,7 @@ class coinone extends _abstract_coinone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
99814
100148
|
}
|
|
99815
100149
|
else {
|
|
99816
100150
|
this.checkRequiredCredentials();
|
|
99817
|
-
url +=
|
|
100151
|
+
url += request;
|
|
99818
100152
|
const nonce = this.nonce().toString();
|
|
99819
100153
|
const json = this.json(this.extend({
|
|
99820
100154
|
'access_token': this.apiKey,
|
|
@@ -129867,6 +130201,7 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
129867
130201
|
'addMargin': true,
|
|
129868
130202
|
'cancelAllOrders': true,
|
|
129869
130203
|
'cancelOrder': true,
|
|
130204
|
+
'closePosition': false,
|
|
129870
130205
|
'createDepositAddress': true,
|
|
129871
130206
|
'createOrder': true,
|
|
129872
130207
|
'createPostOnlyOrder': true,
|
|
@@ -132706,6 +133041,9 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
132706
133041
|
let marketType = undefined;
|
|
132707
133042
|
let marginMode = undefined;
|
|
132708
133043
|
[marketType, params] = this.handleMarketTypeAndParams('fetchPositions', undefined, params);
|
|
133044
|
+
if (marketType === 'spot') {
|
|
133045
|
+
marketType = 'swap';
|
|
133046
|
+
}
|
|
132709
133047
|
[marginMode, params] = this.handleMarginModeAndParams('fetchPositions', params);
|
|
132710
133048
|
params = this.omit(params, ['marginMode', 'margin']);
|
|
132711
133049
|
let response = undefined;
|
|
@@ -133364,6 +133702,43 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
133364
133702
|
}
|
|
133365
133703
|
return result;
|
|
133366
133704
|
}
|
|
133705
|
+
async closePosition(symbol, side = undefined, params = {}) {
|
|
133706
|
+
/**
|
|
133707
|
+
* @method
|
|
133708
|
+
* @name hitbtc#closePosition
|
|
133709
|
+
* @description closes open positions for a market
|
|
133710
|
+
* @see https://api.hitbtc.com/#close-all-futures-margin-positions
|
|
133711
|
+
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
133712
|
+
* @param {string} [params.symbol] *required* unified market symbol
|
|
133713
|
+
* @param {string} [params.marginMode] 'cross' or 'isolated', default is 'cross'
|
|
133714
|
+
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
133715
|
+
*/
|
|
133716
|
+
await this.loadMarkets();
|
|
133717
|
+
let marginMode = undefined;
|
|
133718
|
+
[marginMode, params] = this.handleMarginModeAndParams('closePosition', params, 'cross');
|
|
133719
|
+
const market = this.market(symbol);
|
|
133720
|
+
const request = {
|
|
133721
|
+
'symbol': market['id'],
|
|
133722
|
+
'margin_mode': marginMode,
|
|
133723
|
+
};
|
|
133724
|
+
const response = await this.privateDeleteFuturesPositionMarginModeSymbol(this.extend(request, params));
|
|
133725
|
+
//
|
|
133726
|
+
// {
|
|
133727
|
+
// "id":"202471640",
|
|
133728
|
+
// "symbol":"TRXUSDT_PERP",
|
|
133729
|
+
// "margin_mode":"Cross",
|
|
133730
|
+
// "leverage":"1.00",
|
|
133731
|
+
// "quantity":"0",
|
|
133732
|
+
// "price_entry":"0",
|
|
133733
|
+
// "price_margin_call":"0",
|
|
133734
|
+
// "price_liquidation":"0",
|
|
133735
|
+
// "pnl":"0.001234100000",
|
|
133736
|
+
// "created_at":"2023-10-29T14:46:13.235Z",
|
|
133737
|
+
// "updated_at":"2023-12-19T09:34:40.014Z"
|
|
133738
|
+
// }
|
|
133739
|
+
//
|
|
133740
|
+
return this.parseOrder(response, market);
|
|
133741
|
+
}
|
|
133367
133742
|
handleMarginModeAndParams(methodName, params = {}, defaultValue = undefined) {
|
|
133368
133743
|
/**
|
|
133369
133744
|
* @ignore
|
|
@@ -159470,14 +159845,14 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
159470
159845
|
'addMargin': true,
|
|
159471
159846
|
'cancelAllOrders': true,
|
|
159472
159847
|
'cancelOrder': true,
|
|
159848
|
+
'closePosition': true,
|
|
159849
|
+
'closePositions': false,
|
|
159473
159850
|
'createDepositAddress': true,
|
|
159474
159851
|
'createOrder': true,
|
|
159475
159852
|
'createReduceOnlyOrder': true,
|
|
159476
159853
|
'createStopLimitOrder': true,
|
|
159477
159854
|
'createStopMarketOrder': true,
|
|
159478
159855
|
'createStopOrder': true,
|
|
159479
|
-
'closePosition': true,
|
|
159480
|
-
'closePositions': false,
|
|
159481
159856
|
'fetchAccounts': true,
|
|
159482
159857
|
'fetchBalance': true,
|
|
159483
159858
|
'fetchBorrowRateHistories': false,
|
|
@@ -159592,6 +159967,7 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
159592
159967
|
'positions': 4.44,
|
|
159593
159968
|
'funding-history': 4.44,
|
|
159594
159969
|
'sub/api-key': 1,
|
|
159970
|
+
'trade-statistics': 1,
|
|
159595
159971
|
},
|
|
159596
159972
|
'post': {
|
|
159597
159973
|
'withdrawals': 1,
|
|
@@ -159613,6 +159989,7 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
159613
159989
|
'orders': 4.44,
|
|
159614
159990
|
'stopOrders': 1,
|
|
159615
159991
|
'sub/api-key': 1,
|
|
159992
|
+
'orders/client-order/{clientOid}': 1,
|
|
159616
159993
|
},
|
|
159617
159994
|
},
|
|
159618
159995
|
'webExchange': {
|
|
@@ -160675,13 +161052,27 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
160675
161052
|
* @param {string} id order id
|
|
160676
161053
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
160677
161054
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
161055
|
+
* @param {string} [params.clientOrderId] cancel order by client order id
|
|
160678
161056
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
160679
161057
|
*/
|
|
160680
161058
|
await this.loadMarkets();
|
|
160681
|
-
const
|
|
160682
|
-
|
|
160683
|
-
};
|
|
160684
|
-
|
|
161059
|
+
const clientOrderId = this.safeString2(params, 'clientOid', 'clientOrderId');
|
|
161060
|
+
params = this.omit(params, ['clientOrderId']);
|
|
161061
|
+
const request = {};
|
|
161062
|
+
let response = undefined;
|
|
161063
|
+
if (clientOrderId !== undefined) {
|
|
161064
|
+
if (symbol === undefined) {
|
|
161065
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' cancelOrder() requires a symbol argument when cancelling by clientOrderId');
|
|
161066
|
+
}
|
|
161067
|
+
const market = this.market(symbol);
|
|
161068
|
+
request['symbol'] = market['id'];
|
|
161069
|
+
request['clientOid'] = clientOrderId;
|
|
161070
|
+
response = await this.futuresPrivateDeleteOrdersClientOrderClientOid(this.extend(request, params));
|
|
161071
|
+
}
|
|
161072
|
+
else {
|
|
161073
|
+
request['orderId'] = id;
|
|
161074
|
+
response = await this.futuresPrivateDeleteOrdersOrderId(this.extend(request, params));
|
|
161075
|
+
}
|
|
160685
161076
|
//
|
|
160686
161077
|
// {
|
|
160687
161078
|
// "code": "200000",
|
|
@@ -185494,6 +185885,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
185494
185885
|
// rfq
|
|
185495
185886
|
'rfq/counterparties': 4,
|
|
185496
185887
|
'rfq/maker-instrument-settings': 4,
|
|
185888
|
+
'rfq/mmp-config': 4,
|
|
185497
185889
|
'rfq/rfqs': 10,
|
|
185498
185890
|
'rfq/quotes': 10,
|
|
185499
185891
|
'rfq/trades': 4,
|
|
@@ -185633,6 +186025,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
185633
186025
|
'rfq/execute-quote': 15,
|
|
185634
186026
|
'rfq/maker-instrument-settings': 4,
|
|
185635
186027
|
'rfq/mmp-reset': 4,
|
|
186028
|
+
'rfq/mmp-config': 100,
|
|
185636
186029
|
'rfq/create-quote': 0.4,
|
|
185637
186030
|
'rfq/cancel-quote': 0.4,
|
|
185638
186031
|
'rfq/cancel-batch-quotes': 10,
|
|
@@ -207880,10 +208273,12 @@ class binanceusdm extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
207880
208273
|
/* harmony import */ var _bingx_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7960);
|
|
207881
208274
|
/* harmony import */ var _base_errors_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6689);
|
|
207882
208275
|
/* harmony import */ var _base_ws_Cache_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(3020);
|
|
208276
|
+
/* harmony import */ var _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(2194);
|
|
207883
208277
|
// ---------------------------------------------------------------------------
|
|
207884
208278
|
|
|
207885
208279
|
|
|
207886
208280
|
|
|
208281
|
+
|
|
207887
208282
|
// ---------------------------------------------------------------------------
|
|
207888
208283
|
class bingx extends _bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
207889
208284
|
describe() {
|
|
@@ -207939,6 +208334,10 @@ class bingx extends _bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
207939
208334
|
'1d': '1day',
|
|
207940
208335
|
},
|
|
207941
208336
|
},
|
|
208337
|
+
'watchBalance': {
|
|
208338
|
+
'fetchBalanceSnapshot': true,
|
|
208339
|
+
'awaitBalanceSnapshot': false, // whether to wait for the balance snapshot before providing updates
|
|
208340
|
+
},
|
|
207942
208341
|
},
|
|
207943
208342
|
'streaming': {
|
|
207944
208343
|
'keepAlive': 1800000, // 30 minutes
|
|
@@ -208426,8 +208825,41 @@ class bingx extends _bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
208426
208825
|
'dataType': 'ACCOUNT_UPDATE',
|
|
208427
208826
|
};
|
|
208428
208827
|
}
|
|
208828
|
+
const client = this.client(url);
|
|
208829
|
+
this.setBalanceCache(client, type, subscriptionHash, params);
|
|
208830
|
+
let fetchBalanceSnapshot = undefined;
|
|
208831
|
+
let awaitBalanceSnapshot = undefined;
|
|
208832
|
+
[fetchBalanceSnapshot, params] = this.handleOptionAndParams(params, 'watchBalance', 'fetchBalanceSnapshot', true);
|
|
208833
|
+
[awaitBalanceSnapshot, params] = this.handleOptionAndParams(params, 'watchBalance', 'awaitBalanceSnapshot', false);
|
|
208834
|
+
if (fetchBalanceSnapshot && awaitBalanceSnapshot) {
|
|
208835
|
+
await client.future(type + ':fetchBalanceSnapshot');
|
|
208836
|
+
}
|
|
208429
208837
|
return await this.watch(url, messageHash, request, subscriptionHash);
|
|
208430
208838
|
}
|
|
208839
|
+
setBalanceCache(client, type, subscriptionHash, params) {
|
|
208840
|
+
if (subscriptionHash in client.subscriptions) {
|
|
208841
|
+
return undefined;
|
|
208842
|
+
}
|
|
208843
|
+
const fetchBalanceSnapshot = this.handleOptionAndParams(params, 'watchBalance', 'fetchBalanceSnapshot', true);
|
|
208844
|
+
if (fetchBalanceSnapshot) {
|
|
208845
|
+
const messageHash = type + ':fetchBalanceSnapshot';
|
|
208846
|
+
if (!(messageHash in client.futures)) {
|
|
208847
|
+
client.future(messageHash);
|
|
208848
|
+
this.spawn(this.loadBalanceSnapshot, client, messageHash, type);
|
|
208849
|
+
}
|
|
208850
|
+
}
|
|
208851
|
+
else {
|
|
208852
|
+
this.balance[type] = {};
|
|
208853
|
+
}
|
|
208854
|
+
}
|
|
208855
|
+
async loadBalanceSnapshot(client, messageHash, type) {
|
|
208856
|
+
const response = await this.fetchBalance({ 'type': type });
|
|
208857
|
+
this.balance[type] = this.extend(response, this.safeValue(this.balance, type, {}));
|
|
208858
|
+
// don't remove the future from the .futures cache
|
|
208859
|
+
const future = client.futures[messageHash];
|
|
208860
|
+
future.resolve();
|
|
208861
|
+
client.resolve(this.balance[type], type + ':balance');
|
|
208862
|
+
}
|
|
208431
208863
|
handleErrorMessage(client, message) {
|
|
208432
208864
|
//
|
|
208433
208865
|
// { code: 100400, msg: '', timestamp: 1696245808833 }
|
|
@@ -208710,9 +209142,6 @@ class bingx extends _bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
208710
209142
|
const data = this.safeValue(a, 'B', []);
|
|
208711
209143
|
const timestamp = this.safeInteger2(message, 'T', 'E');
|
|
208712
209144
|
const type = ('P' in a) ? 'swap' : 'spot';
|
|
208713
|
-
if (!(type in this.balance)) {
|
|
208714
|
-
this.balance[type] = {};
|
|
208715
|
-
}
|
|
208716
209145
|
this.balance[type]['info'] = data;
|
|
208717
209146
|
this.balance[type]['timestamp'] = timestamp;
|
|
208718
209147
|
this.balance[type]['datetime'] = this.iso8601(timestamp);
|
|
@@ -208720,8 +209149,12 @@ class bingx extends _bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
208720
209149
|
const balance = data[i];
|
|
208721
209150
|
const currencyId = this.safeString(balance, 'a');
|
|
208722
209151
|
const code = this.safeCurrencyCode(currencyId);
|
|
208723
|
-
const account = (code in this.balance) ? this.balance[code] : this.account();
|
|
208724
|
-
account['
|
|
209152
|
+
const account = (code in this.balance[type]) ? this.balance[type][code] : this.account();
|
|
209153
|
+
account['free'] = this.safeString(balance, 'wb');
|
|
209154
|
+
const balanceChange = this.safeString(balance, 'bc');
|
|
209155
|
+
if (account['used'] !== undefined) {
|
|
209156
|
+
account['used'] = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z.stringSub(this.safeString(account, 'used'), balanceChange);
|
|
209157
|
+
}
|
|
208725
209158
|
this.balance[type][code] = account;
|
|
208726
209159
|
}
|
|
208727
209160
|
this.balance[type] = this.safeBalance(this.balance[type]);
|
|
@@ -287994,7 +288427,7 @@ SOFTWARE.
|
|
|
287994
288427
|
|
|
287995
288428
|
//-----------------------------------------------------------------------------
|
|
287996
288429
|
// this is updated by vss.js when building
|
|
287997
|
-
const version = '4.1.
|
|
288430
|
+
const version = '4.1.94';
|
|
287998
288431
|
_src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
|
|
287999
288432
|
//-----------------------------------------------------------------------------
|
|
288000
288433
|
|