ccxt 4.1.35 → 4.1.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/build.sh +4 -0
- package/dist/ccxt.browser.js +1590 -496
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +31 -0
- package/dist/cjs/src/base/errors.js +6 -6
- package/dist/cjs/src/binance.js +3 -2
- package/dist/cjs/src/bingx.js +109 -2
- package/dist/cjs/src/bitforex.js +1 -1
- package/dist/cjs/src/bitget.js +3 -2
- package/dist/cjs/src/bitmart.js +2 -2
- package/dist/cjs/src/bitmex.js +3 -3
- package/dist/cjs/src/bitopro.js +1 -0
- package/dist/cjs/src/bitstamp.js +12 -0
- package/dist/cjs/src/bybit.js +112 -109
- package/dist/cjs/src/deribit.js +2 -2
- package/dist/cjs/src/gate.js +2 -2
- package/dist/cjs/src/hollaex.js +7 -7
- package/dist/cjs/src/huobi.js +2 -2
- package/dist/cjs/src/kucoinfutures.js +0 -3
- package/dist/cjs/src/kuna.js +1284 -350
- package/dist/cjs/src/latoken.js +2 -2
- package/dist/cjs/src/phemex.js +1 -0
- package/dist/cjs/src/wazirx.js +1 -1
- 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/bitopro.d.ts +1 -0
- package/js/src/abstract/bitstamp.d.ts +10 -0
- package/js/src/abstract/kuna.d.ts +29 -27
- package/js/src/ace.d.ts +7 -7
- package/js/src/alpaca.d.ts +7 -7
- package/js/src/ascendex.d.ts +3 -3
- package/js/src/base/Exchange.d.ts +7 -2
- package/js/src/base/Exchange.js +31 -0
- package/js/src/base/errorHierarchy.d.ts +1 -1
- package/js/src/base/errorHierarchy.js +1 -1
- package/js/src/base/errors.d.ts +3 -3
- package/js/src/base/errors.js +6 -6
- package/js/src/bigone.d.ts +10 -10
- package/js/src/binance.d.ts +48 -15
- package/js/src/binance.js +3 -2
- package/js/src/bingx.d.ts +10 -8
- package/js/src/bingx.js +109 -2
- package/js/src/bit2c.d.ts +5 -5
- package/js/src/bitbank.d.ts +7 -7
- package/js/src/bitbns.d.ts +6 -6
- package/js/src/bitfinex.d.ts +9 -9
- package/js/src/bitfinex2.d.ts +1 -1
- package/js/src/bitforex.d.ts +8 -8
- package/js/src/bitforex.js +1 -1
- package/js/src/bitget.d.ts +2 -12
- package/js/src/bitget.js +3 -2
- package/js/src/bithumb.d.ts +7 -7
- package/js/src/bitmart.d.ts +11 -21
- package/js/src/bitmart.js +2 -2
- package/js/src/bitmex.d.ts +2 -12
- package/js/src/bitmex.js +3 -3
- package/js/src/bitopro.d.ts +9 -9
- package/js/src/bitopro.js +1 -0
- package/js/src/bitpanda.d.ts +8 -8
- package/js/src/bitrue.d.ts +9 -9
- package/js/src/bitso.d.ts +7 -7
- package/js/src/bitstamp.d.ts +7 -7
- package/js/src/bitstamp.js +12 -0
- package/js/src/bittrex.d.ts +9 -9
- package/js/src/bitvavo.d.ts +1 -1
- package/js/src/blockchaincom.d.ts +8 -8
- package/js/src/btcalpha.d.ts +9 -9
- package/js/src/btcbox.d.ts +8 -8
- package/js/src/btcmarkets.d.ts +3 -3
- package/js/src/btctradeua.d.ts +3 -3
- package/js/src/btcturk.d.ts +6 -6
- package/js/src/bybit.d.ts +1 -1
- package/js/src/bybit.js +112 -109
- package/js/src/cex.d.ts +3 -3
- package/js/src/coinbase.d.ts +1 -1
- package/js/src/coinbasepro.d.ts +1 -1
- package/js/src/coinex.d.ts +11 -11
- package/js/src/coinfalcon.d.ts +6 -6
- package/js/src/coinmate.d.ts +6 -6
- package/js/src/coinone.d.ts +5 -5
- package/js/src/coinsph.d.ts +10 -10
- package/js/src/cryptocom.d.ts +1 -1
- package/js/src/currencycom.d.ts +8 -8
- package/js/src/delta.d.ts +10 -10
- package/js/src/deribit.d.ts +9 -19
- package/js/src/deribit.js +2 -2
- package/js/src/digifinex.d.ts +8 -8
- package/js/src/exmo.d.ts +3 -3
- package/js/src/gate.d.ts +2 -12
- package/js/src/gate.js +2 -2
- package/js/src/gemini.d.ts +6 -6
- package/js/src/hitbtc.d.ts +1 -1
- package/js/src/hollaex.d.ts +12 -12
- package/js/src/hollaex.js +7 -7
- package/js/src/huobi.d.ts +2 -12
- package/js/src/huobi.js +2 -2
- package/js/src/huobijp.d.ts +3 -3
- package/js/src/idex.d.ts +3 -3
- package/js/src/independentreserve.d.ts +6 -6
- package/js/src/kraken.d.ts +8 -8
- package/js/src/krakenfutures.d.ts +8 -8
- package/js/src/kucoin.d.ts +1 -1
- package/js/src/kucoinfutures.d.ts +4 -5
- package/js/src/kucoinfutures.js +0 -3
- package/js/src/kuna.d.ts +155 -7
- package/js/src/kuna.js +1290 -351
- package/js/src/latoken.d.ts +7 -7
- package/js/src/latoken.js +2 -2
- package/js/src/lbank.d.ts +3 -3
- package/js/src/lbank2.d.ts +10 -10
- package/js/src/luno.d.ts +8 -8
- package/js/src/lykke.d.ts +6 -6
- package/js/src/mercado.d.ts +9 -9
- package/js/src/mexc.d.ts +17 -17
- package/js/src/ndax.d.ts +9 -9
- package/js/src/novadax.d.ts +10 -10
- package/js/src/oceanex.d.ts +3 -3
- package/js/src/okcoin.d.ts +9 -9
- package/js/src/okx.d.ts +1 -1
- package/js/src/phemex.d.ts +13 -13
- package/js/src/phemex.js +1 -0
- package/js/src/poloniex.d.ts +9 -9
- package/js/src/poloniexfutures.d.ts +8 -8
- package/js/src/pro/bingx.d.ts +2 -2
- package/js/src/pro/bitget.d.ts +3 -3
- package/js/src/pro/bybit.d.ts +3 -3
- package/js/src/pro/hitbtc.d.ts +2 -2
- package/js/src/pro/mexc.d.ts +2 -2
- package/js/src/pro/poloniex.d.ts +2 -2
- package/js/src/pro/wazirx.d.ts +2 -2
- package/js/src/probit.d.ts +9 -9
- package/js/src/tidex.d.ts +5 -5
- package/js/src/timex.d.ts +9 -9
- package/js/src/tokocrypto.d.ts +10 -10
- package/js/src/upbit.d.ts +11 -11
- package/js/src/wavesexchange.d.ts +9 -9
- package/js/src/wazirx.d.ts +8 -8
- package/js/src/wazirx.js +1 -1
- package/js/src/whitebit.d.ts +3 -3
- package/js/src/woo.d.ts +8 -8
- package/js/src/yobit.d.ts +6 -6
- package/js/src/zaif.d.ts +5 -5
- package/js/src/zonda.d.ts +6 -6
- package/package.json +7 -3
package/dist/ccxt.browser.js
CHANGED
|
@@ -6679,6 +6679,9 @@ class Exchange {
|
|
|
6679
6679
|
this.last_json_response = undefined;
|
|
6680
6680
|
this.last_response_headers = undefined;
|
|
6681
6681
|
this.last_request_headers = undefined;
|
|
6682
|
+
this.last_request_body = undefined;
|
|
6683
|
+
this.last_request_url = undefined;
|
|
6684
|
+
this.last_request_path = undefined;
|
|
6682
6685
|
this.id = undefined;
|
|
6683
6686
|
this.markets = undefined;
|
|
6684
6687
|
this.status = undefined;
|
|
@@ -6873,6 +6876,9 @@ class Exchange {
|
|
|
6873
6876
|
this.last_json_response = undefined;
|
|
6874
6877
|
this.last_response_headers = undefined;
|
|
6875
6878
|
this.last_request_headers = undefined;
|
|
6879
|
+
this.last_request_body = undefined;
|
|
6880
|
+
this.last_request_url = undefined;
|
|
6881
|
+
this.last_request_path = undefined;
|
|
6876
6882
|
// camelCase and snake_notation support
|
|
6877
6883
|
const unCamelCaseProperties = (obj = this) => {
|
|
6878
6884
|
if (obj !== null) {
|
|
@@ -8704,6 +8710,25 @@ class Exchange {
|
|
|
8704
8710
|
'cost': this.parseNumber(cost),
|
|
8705
8711
|
};
|
|
8706
8712
|
}
|
|
8713
|
+
safeLiquidation(liquidation, market = undefined) {
|
|
8714
|
+
const contracts = this.safeString(liquidation, 'contracts');
|
|
8715
|
+
const contractSize = this.safeString(market, 'contractSize');
|
|
8716
|
+
const price = this.safeString(liquidation, 'price');
|
|
8717
|
+
let baseValue = this.safeString(liquidation, 'baseValue');
|
|
8718
|
+
let quoteValue = this.safeString(liquidation, 'quoteValue');
|
|
8719
|
+
if ((baseValue === undefined) && (contracts !== undefined) && (contractSize !== undefined) && (price !== undefined)) {
|
|
8720
|
+
baseValue = _Precise_js__WEBPACK_IMPORTED_MODULE_8__/* .Precise.stringMul */ .O.stringMul(contracts, contractSize);
|
|
8721
|
+
}
|
|
8722
|
+
if ((quoteValue === undefined) && (baseValue !== undefined) && (price !== undefined)) {
|
|
8723
|
+
quoteValue = _Precise_js__WEBPACK_IMPORTED_MODULE_8__/* .Precise.stringMul */ .O.stringMul(baseValue, price);
|
|
8724
|
+
}
|
|
8725
|
+
liquidation['contracts'] = this.parseNumber(contracts);
|
|
8726
|
+
liquidation['contractSize'] = this.parseNumber(contractSize);
|
|
8727
|
+
liquidation['price'] = this.parseNumber(price);
|
|
8728
|
+
liquidation['baseValue'] = this.parseNumber(baseValue);
|
|
8729
|
+
liquidation['quoteValue'] = this.parseNumber(quoteValue);
|
|
8730
|
+
return liquidation;
|
|
8731
|
+
}
|
|
8707
8732
|
safeTrade(trade, market = undefined) {
|
|
8708
8733
|
const amount = this.safeString(trade, 'amount');
|
|
8709
8734
|
const price = this.safeString(trade, 'price');
|
|
@@ -9443,6 +9468,8 @@ class Exchange {
|
|
|
9443
9468
|
this.lastRestRequestTimestamp = this.milliseconds();
|
|
9444
9469
|
const request = this.sign(path, api, method, params, headers, body);
|
|
9445
9470
|
this.last_request_headers = request['headers'];
|
|
9471
|
+
this.last_request_body = request['body'];
|
|
9472
|
+
this.last_request_url = request['url'];
|
|
9446
9473
|
return await this.fetch(request['url'], request['method'], request['headers'], request['body']);
|
|
9447
9474
|
}
|
|
9448
9475
|
async request(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined, config = {}) {
|
|
@@ -10280,6 +10307,10 @@ class Exchange {
|
|
|
10280
10307
|
filterByCurrencySinceLimit(array, code = undefined, since = undefined, limit = undefined, tail = false) {
|
|
10281
10308
|
return this.filterByValueSinceLimit(array, 'currency', code, since, limit, 'timestamp', tail);
|
|
10282
10309
|
}
|
|
10310
|
+
filterBySymbolsSinceLimit(array, symbols = undefined, since = undefined, limit = undefined, tail = false) {
|
|
10311
|
+
const result = this.filterByArray(array, 'symbol', symbols, false);
|
|
10312
|
+
return this.filterBySinceLimit(result, since, limit, 'timestamp', tail);
|
|
10313
|
+
}
|
|
10283
10314
|
parseLastPrices(pricesData, symbols = undefined, params = {}) {
|
|
10284
10315
|
//
|
|
10285
10316
|
// the value of tickers is either a dict or a list
|
|
@@ -11513,12 +11544,6 @@ class ExchangeError extends Error {
|
|
|
11513
11544
|
this.name = 'ExchangeError';
|
|
11514
11545
|
}
|
|
11515
11546
|
}
|
|
11516
|
-
class OperationFailed extends ExchangeError {
|
|
11517
|
-
constructor(message) {
|
|
11518
|
-
super(message);
|
|
11519
|
-
this.name = 'OperationFailed';
|
|
11520
|
-
}
|
|
11521
|
-
}
|
|
11522
11547
|
class AuthenticationError extends ExchangeError {
|
|
11523
11548
|
constructor(message) {
|
|
11524
11549
|
super(message);
|
|
@@ -11706,6 +11731,12 @@ class RequestTimeout extends NetworkError {
|
|
|
11706
11731
|
this.name = 'RequestTimeout';
|
|
11707
11732
|
}
|
|
11708
11733
|
}
|
|
11734
|
+
class OperationFailed extends NetworkError {
|
|
11735
|
+
constructor(message) {
|
|
11736
|
+
super(message);
|
|
11737
|
+
this.name = 'OperationFailed';
|
|
11738
|
+
}
|
|
11739
|
+
}
|
|
11709
11740
|
/* ------------------------------------------------------------------------ */
|
|
11710
11741
|
// export default subclass (
|
|
11711
11742
|
// // Root class
|
|
@@ -16985,6 +17016,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
16985
17016
|
'topLongShortPositionRatio': 1,
|
|
16986
17017
|
'globalLongShortAccountRatio': 1,
|
|
16987
17018
|
'takerlongshortRatio': 1,
|
|
17019
|
+
'basis': 1,
|
|
16988
17020
|
},
|
|
16989
17021
|
},
|
|
16990
17022
|
'fapiPrivate': {
|
|
@@ -25784,7 +25816,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
25784
25816
|
//
|
|
25785
25817
|
const marketId = this.safeString(liquidation, 'symbol');
|
|
25786
25818
|
const timestamp = this.safeInteger2(liquidation, 'updatedTime', 'updateTime');
|
|
25787
|
-
return {
|
|
25819
|
+
return this.safeLiquidation({
|
|
25788
25820
|
'info': liquidation,
|
|
25789
25821
|
'symbol': this.safeSymbol(marketId, market),
|
|
25790
25822
|
'contracts': this.safeNumber(liquidation, 'executedQty'),
|
|
@@ -25794,7 +25826,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
25794
25826
|
'quoteValue': this.safeNumber(liquidation, 'cumQuote'),
|
|
25795
25827
|
'timestamp': timestamp,
|
|
25796
25828
|
'datetime': this.iso8601(timestamp),
|
|
25797
|
-
};
|
|
25829
|
+
});
|
|
25798
25830
|
}
|
|
25799
25831
|
}
|
|
25800
25832
|
|
|
@@ -26027,7 +26059,9 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
26027
26059
|
'fetchFundingRate': true,
|
|
26028
26060
|
'fetchFundingRateHistory': true,
|
|
26029
26061
|
'fetchLeverage': true,
|
|
26062
|
+
'fetchLiquidations': false,
|
|
26030
26063
|
'fetchMarkets': true,
|
|
26064
|
+
'fetchMyLiquidations': true,
|
|
26031
26065
|
'fetchOHLCV': true,
|
|
26032
26066
|
'fetchOpenInterest': true,
|
|
26033
26067
|
'fetchOpenOrders': true,
|
|
@@ -26326,7 +26360,8 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
26326
26360
|
'PFUTURES': 'swap',
|
|
26327
26361
|
'SFUTURES': 'future',
|
|
26328
26362
|
},
|
|
26329
|
-
'recvWindow': 5 * 1000,
|
|
26363
|
+
'recvWindow': 5 * 1000,
|
|
26364
|
+
'broker': 'CCXT',
|
|
26330
26365
|
},
|
|
26331
26366
|
});
|
|
26332
26367
|
}
|
|
@@ -29063,6 +29098,110 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
29063
29098
|
}
|
|
29064
29099
|
return sortedParams;
|
|
29065
29100
|
}
|
|
29101
|
+
async fetchMyLiquidations(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
29102
|
+
/**
|
|
29103
|
+
* @method
|
|
29104
|
+
* @name bingx#fetchMyLiquidations
|
|
29105
|
+
* @description retrieves the users liquidated positions
|
|
29106
|
+
* @see https://bingx-api.github.io/docs/#/swapV2/trade-api.html#User's%20Force%20Orders
|
|
29107
|
+
* @param {string} [symbol] unified CCXT market symbol
|
|
29108
|
+
* @param {int} [since] the earliest time in ms to fetch liquidations for
|
|
29109
|
+
* @param {int} [limit] the maximum number of liquidation structures to retrieve
|
|
29110
|
+
* @param {object} [params] exchange specific parameters for the bingx api endpoint
|
|
29111
|
+
* @param {int} [params.until] timestamp in ms of the latest liquidation
|
|
29112
|
+
* @returns {object} an array of [liquidation structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#liquidation-structure}
|
|
29113
|
+
*/
|
|
29114
|
+
await this.loadMarkets();
|
|
29115
|
+
let request = {
|
|
29116
|
+
'autoCloseType': 'LIQUIDATION',
|
|
29117
|
+
};
|
|
29118
|
+
[request, params] = this.handleUntilOption('endTime', request, params);
|
|
29119
|
+
let market = undefined;
|
|
29120
|
+
if (symbol !== undefined) {
|
|
29121
|
+
market = this.market(symbol);
|
|
29122
|
+
request['symbol'] = symbol;
|
|
29123
|
+
}
|
|
29124
|
+
if (since !== undefined) {
|
|
29125
|
+
request['startTime'] = since;
|
|
29126
|
+
}
|
|
29127
|
+
if (limit !== undefined) {
|
|
29128
|
+
request['limit'] = limit;
|
|
29129
|
+
}
|
|
29130
|
+
const response = await this.swapV2PrivateGetTradeForceOrders(this.extend(request, params));
|
|
29131
|
+
//
|
|
29132
|
+
// {
|
|
29133
|
+
// "code": 0,
|
|
29134
|
+
// "msg": "",
|
|
29135
|
+
// "data": {
|
|
29136
|
+
// "orders": [
|
|
29137
|
+
// {
|
|
29138
|
+
// "time": "int64",
|
|
29139
|
+
// "symbol": "string",
|
|
29140
|
+
// "side": "string",
|
|
29141
|
+
// "type": "string",
|
|
29142
|
+
// "positionSide": "string",
|
|
29143
|
+
// "cumQuote": "string",
|
|
29144
|
+
// "status": "string",
|
|
29145
|
+
// "stopPrice": "string",
|
|
29146
|
+
// "price": "string",
|
|
29147
|
+
// "origQty": "string",
|
|
29148
|
+
// "avgPrice": "string",
|
|
29149
|
+
// "executedQty": "string",
|
|
29150
|
+
// "orderId": "int64",
|
|
29151
|
+
// "profit": "string",
|
|
29152
|
+
// "commission": "string",
|
|
29153
|
+
// "workingType": "string",
|
|
29154
|
+
// "updateTime": "int64"
|
|
29155
|
+
// },
|
|
29156
|
+
// ]
|
|
29157
|
+
// }
|
|
29158
|
+
// }
|
|
29159
|
+
//
|
|
29160
|
+
const data = this.safeValue(response, 'data', {});
|
|
29161
|
+
const liquidations = this.safeValue(data, 'orders', []);
|
|
29162
|
+
return this.parseLiquidations(liquidations, market, since, limit);
|
|
29163
|
+
}
|
|
29164
|
+
parseLiquidation(liquidation, market = undefined) {
|
|
29165
|
+
//
|
|
29166
|
+
// {
|
|
29167
|
+
// "time": "int64",
|
|
29168
|
+
// "symbol": "string",
|
|
29169
|
+
// "side": "string",
|
|
29170
|
+
// "type": "string",
|
|
29171
|
+
// "positionSide": "string",
|
|
29172
|
+
// "cumQuote": "string",
|
|
29173
|
+
// "status": "string",
|
|
29174
|
+
// "stopPrice": "string",
|
|
29175
|
+
// "price": "string",
|
|
29176
|
+
// "origQty": "string",
|
|
29177
|
+
// "avgPrice": "string",
|
|
29178
|
+
// "executedQty": "string",
|
|
29179
|
+
// "orderId": "int64",
|
|
29180
|
+
// "profit": "string",
|
|
29181
|
+
// "commission": "string",
|
|
29182
|
+
// "workingType": "string",
|
|
29183
|
+
// "updateTime": "int64"
|
|
29184
|
+
// }
|
|
29185
|
+
//
|
|
29186
|
+
const marketId = this.safeString(liquidation, 'symbol');
|
|
29187
|
+
const timestamp = this.safeInteger(liquidation, 'time');
|
|
29188
|
+
const contractsString = this.safeString(liquidation, 'executedQty');
|
|
29189
|
+
const contractSizeString = this.safeString(market, 'contractSize');
|
|
29190
|
+
const priceString = this.safeString(liquidation, 'avgPrice');
|
|
29191
|
+
const baseValueString = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringMul */ .O.stringMul(contractsString, contractSizeString);
|
|
29192
|
+
const quoteValueString = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringMul */ .O.stringMul(baseValueString, priceString);
|
|
29193
|
+
return this.safeLiquidation({
|
|
29194
|
+
'info': liquidation,
|
|
29195
|
+
'symbol': this.safeSymbol(marketId, market),
|
|
29196
|
+
'contracts': this.parseNumber(contractsString),
|
|
29197
|
+
'contractSize': this.parseNumber(contractSizeString),
|
|
29198
|
+
'price': this.parseNumber(priceString),
|
|
29199
|
+
'baseValue': this.parseNumber(baseValueString),
|
|
29200
|
+
'quoteValue': this.parseNumber(quoteValueString),
|
|
29201
|
+
'timestamp': timestamp,
|
|
29202
|
+
'datetime': this.iso8601(timestamp),
|
|
29203
|
+
});
|
|
29204
|
+
}
|
|
29066
29205
|
sign(path, section = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
29067
29206
|
const type = section[0];
|
|
29068
29207
|
const version = section[1];
|
|
@@ -29100,7 +29239,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
29100
29239
|
query += 'signature=' + signature;
|
|
29101
29240
|
headers = {
|
|
29102
29241
|
'X-BX-APIKEY': this.apiKey,
|
|
29103
|
-
'X-SOURCE-KEY': 'CCXT',
|
|
29242
|
+
'X-SOURCE-KEY': this.safeString(this.options, 'broker', 'CCXT'),
|
|
29104
29243
|
};
|
|
29105
29244
|
url += query;
|
|
29106
29245
|
}
|
|
@@ -38100,7 +38239,7 @@ class bitforex extends _abstract_bitforex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
38100
38239
|
'CORS': undefined,
|
|
38101
38240
|
'spot': true,
|
|
38102
38241
|
'margin': false,
|
|
38103
|
-
'swap':
|
|
38242
|
+
'swap': false,
|
|
38104
38243
|
'future': false,
|
|
38105
38244
|
'option': false,
|
|
38106
38245
|
'cancelOrder': true,
|
|
@@ -39733,6 +39872,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
39733
39872
|
'40017': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeError,
|
|
39734
39873
|
'40018': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.PermissionDenied,
|
|
39735
39874
|
'40019': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest,
|
|
39875
|
+
'40037': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.AuthenticationError,
|
|
39736
39876
|
'40102': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest,
|
|
39737
39877
|
'40103': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest,
|
|
39738
39878
|
'40104': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeError,
|
|
@@ -45222,7 +45362,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
45222
45362
|
const liquidationFee = this.safeString(liquidation, 'LiqFee');
|
|
45223
45363
|
const totalDebt = this.safeString(liquidation, 'totalDebt');
|
|
45224
45364
|
const quoteValueString = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringAdd */ .O.stringAdd(liquidationFee, totalDebt);
|
|
45225
|
-
return {
|
|
45365
|
+
return this.safeLiquidation({
|
|
45226
45366
|
'info': liquidation,
|
|
45227
45367
|
'symbol': this.safeSymbol(marketId, market),
|
|
45228
45368
|
'contracts': undefined,
|
|
@@ -45232,7 +45372,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
45232
45372
|
'quoteValue': this.parseNumber(quoteValueString),
|
|
45233
45373
|
'timestamp': timestamp,
|
|
45234
45374
|
'datetime': this.iso8601(timestamp),
|
|
45235
|
-
};
|
|
45375
|
+
});
|
|
45236
45376
|
}
|
|
45237
45377
|
async fetchBorrowRate(code, params = {}) {
|
|
45238
45378
|
/**
|
|
@@ -50815,7 +50955,7 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
50815
50955
|
const priceString = this.safeString(liquidation, 'deal_avg_price');
|
|
50816
50956
|
const baseValueString = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringMul */ .O.stringMul(contractsString, contractSizeString);
|
|
50817
50957
|
const quoteValueString = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringMul */ .O.stringMul(baseValueString, priceString);
|
|
50818
|
-
return {
|
|
50958
|
+
return this.safeLiquidation({
|
|
50819
50959
|
'info': liquidation,
|
|
50820
50960
|
'symbol': this.safeSymbol(marketId, market),
|
|
50821
50961
|
'contracts': this.parseNumber(contractsString),
|
|
@@ -50825,7 +50965,7 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
50825
50965
|
'quoteValue': this.parseNumber(quoteValueString),
|
|
50826
50966
|
'timestamp': timestamp,
|
|
50827
50967
|
'datetime': this.iso8601(timestamp),
|
|
50828
|
-
};
|
|
50968
|
+
});
|
|
50829
50969
|
}
|
|
50830
50970
|
nonce() {
|
|
50831
50971
|
return this.milliseconds();
|
|
@@ -51837,7 +51977,7 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
51837
51977
|
*/
|
|
51838
51978
|
// Bitmex barfs if you set 'open': false in the filter...
|
|
51839
51979
|
const orders = await this.fetchOrders(symbol, since, limit, params);
|
|
51840
|
-
return this.
|
|
51980
|
+
return this.filterByArray(orders, 'status', ['closed', 'canceled'], false);
|
|
51841
51981
|
}
|
|
51842
51982
|
async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
51843
51983
|
/**
|
|
@@ -53608,7 +53748,7 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
53608
53748
|
// }
|
|
53609
53749
|
//
|
|
53610
53750
|
const marketId = this.safeString(liquidation, 'symbol');
|
|
53611
|
-
return {
|
|
53751
|
+
return this.safeLiquidation({
|
|
53612
53752
|
'info': liquidation,
|
|
53613
53753
|
'symbol': this.safeSymbol(marketId, market),
|
|
53614
53754
|
'contracts': undefined,
|
|
@@ -53618,7 +53758,7 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
53618
53758
|
'quoteValue': undefined,
|
|
53619
53759
|
'timestamp': undefined,
|
|
53620
53760
|
'datetime': undefined,
|
|
53621
|
-
};
|
|
53761
|
+
});
|
|
53622
53762
|
}
|
|
53623
53763
|
handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
|
|
53624
53764
|
if (response === undefined) {
|
|
@@ -53816,6 +53956,7 @@ class bitopro extends _abstract_bitopro_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
53816
53956
|
'provisioning/trading-pairs': 1,
|
|
53817
53957
|
'provisioning/limitations-and-fees': 1,
|
|
53818
53958
|
'trading-history/{pair}': 1,
|
|
53959
|
+
'price/otc/{currency}': 1,
|
|
53819
53960
|
},
|
|
53820
53961
|
},
|
|
53821
53962
|
'private': {
|
|
@@ -61405,9 +61546,16 @@ class bitstamp extends _abstract_bitstamp_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
61405
61546
|
'trading-pairs-info/': 1,
|
|
61406
61547
|
'currencies/': 1,
|
|
61407
61548
|
'eur_usd/': 1,
|
|
61549
|
+
'travel_rule/vasps/': 1,
|
|
61408
61550
|
},
|
|
61409
61551
|
},
|
|
61410
61552
|
'private': {
|
|
61553
|
+
'get': {
|
|
61554
|
+
'travel_rule/contacts/': 1,
|
|
61555
|
+
'contacts/{contact_uuid}/': 1,
|
|
61556
|
+
'earn/subscriptions/': 1,
|
|
61557
|
+
'earn/transactions/': 1,
|
|
61558
|
+
},
|
|
61411
61559
|
'post': {
|
|
61412
61560
|
'account_balances/': 1,
|
|
61413
61561
|
'account_balances/{currency}/': 1,
|
|
@@ -61434,6 +61582,7 @@ class bitstamp extends _abstract_bitstamp_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
61434
61582
|
'transfer-from-main/': 1,
|
|
61435
61583
|
'my_trading_pairs/': 1,
|
|
61436
61584
|
'fees/trading/': 1,
|
|
61585
|
+
'fees/trading/{pair}': 1,
|
|
61437
61586
|
'fees/withdrawal/': 1,
|
|
61438
61587
|
'fees/withdrawal/{currency}/': 1,
|
|
61439
61588
|
'withdrawal-requests/': 1,
|
|
@@ -61607,6 +61756,10 @@ class bitstamp extends _abstract_bitstamp_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
61607
61756
|
'dgld_address/': 1,
|
|
61608
61757
|
'ldo_withdrawal/': 1,
|
|
61609
61758
|
'ldo_address/': 1,
|
|
61759
|
+
'travel_rule/contacts/': 1,
|
|
61760
|
+
'earn/subscribe/': 1,
|
|
61761
|
+
'earn/subscriptions/setting/': 1,
|
|
61762
|
+
'earn/unsubscribe': 1,
|
|
61610
61763
|
},
|
|
61611
61764
|
},
|
|
61612
61765
|
},
|
|
@@ -74288,35 +74441,35 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
74288
74441
|
'derivatives/v3/public/open-interest': 1,
|
|
74289
74442
|
'derivatives/v3/public/insurance': 1,
|
|
74290
74443
|
// v5
|
|
74291
|
-
'v5/announcements/index':
|
|
74444
|
+
'v5/announcements/index': 5,
|
|
74292
74445
|
// market
|
|
74293
|
-
'v5/market/time':
|
|
74294
|
-
'v5/market/kline':
|
|
74295
|
-
'v5/market/mark-price-kline':
|
|
74296
|
-
'v5/market/index-price-kline':
|
|
74297
|
-
'v5/market/premium-index-price-kline':
|
|
74298
|
-
'v5/market/instruments-info':
|
|
74299
|
-
'v5/market/orderbook':
|
|
74300
|
-
'v5/market/tickers':
|
|
74301
|
-
'v5/market/funding/history':
|
|
74302
|
-
'v5/market/recent-trade':
|
|
74303
|
-
'v5/market/open-interest':
|
|
74304
|
-
'v5/market/historical-volatility':
|
|
74305
|
-
'v5/market/insurance':
|
|
74306
|
-
'v5/market/risk-limit':
|
|
74307
|
-
'v5/market/delivery-price':
|
|
74308
|
-
'v5/market/account-ratio':
|
|
74446
|
+
'v5/market/time': 5,
|
|
74447
|
+
'v5/market/kline': 5,
|
|
74448
|
+
'v5/market/mark-price-kline': 5,
|
|
74449
|
+
'v5/market/index-price-kline': 5,
|
|
74450
|
+
'v5/market/premium-index-price-kline': 5,
|
|
74451
|
+
'v5/market/instruments-info': 5,
|
|
74452
|
+
'v5/market/orderbook': 5,
|
|
74453
|
+
'v5/market/tickers': 5,
|
|
74454
|
+
'v5/market/funding/history': 5,
|
|
74455
|
+
'v5/market/recent-trade': 5,
|
|
74456
|
+
'v5/market/open-interest': 5,
|
|
74457
|
+
'v5/market/historical-volatility': 5,
|
|
74458
|
+
'v5/market/insurance': 5,
|
|
74459
|
+
'v5/market/risk-limit': 5,
|
|
74460
|
+
'v5/market/delivery-price': 5,
|
|
74461
|
+
'v5/market/account-ratio': 5,
|
|
74309
74462
|
// spot leverage token
|
|
74310
|
-
'v5/spot-lever-token/info':
|
|
74311
|
-
'v5/spot-lever-token/reference':
|
|
74463
|
+
'v5/spot-lever-token/info': 5,
|
|
74464
|
+
'v5/spot-lever-token/reference': 5,
|
|
74312
74465
|
// spot margin trade
|
|
74313
|
-
'v5/spot-margin-trade/data':
|
|
74314
|
-
'v5/spot-cross-margin-trade/data':
|
|
74315
|
-
'v5/spot-cross-margin-trade/pledge-token':
|
|
74316
|
-
'v5/spot-cross-margin-trade/borrow-token':
|
|
74466
|
+
'v5/spot-margin-trade/data': 5,
|
|
74467
|
+
'v5/spot-cross-margin-trade/data': 5,
|
|
74468
|
+
'v5/spot-cross-margin-trade/pledge-token': 5,
|
|
74469
|
+
'v5/spot-cross-margin-trade/borrow-token': 5,
|
|
74317
74470
|
// institutional lending
|
|
74318
|
-
'v5/ins-loan/product-infos':
|
|
74319
|
-
'v5/ins-loan/ensure-tokens-convert':
|
|
74471
|
+
'v5/ins-loan/product-infos': 5,
|
|
74472
|
+
'v5/ins-loan/ensure-tokens-convert': 5,
|
|
74320
74473
|
},
|
|
74321
74474
|
},
|
|
74322
74475
|
'private': {
|
|
@@ -74385,11 +74538,11 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
74385
74538
|
'spot/v3/private/margin-ltv': 10,
|
|
74386
74539
|
// account
|
|
74387
74540
|
'asset/v1/private/transfer/list': 50,
|
|
74388
|
-
'asset/v3/private/transfer/inter-transfer/list/query':
|
|
74541
|
+
'asset/v3/private/transfer/inter-transfer/list/query': 50,
|
|
74389
74542
|
'asset/v1/private/sub-member/transfer/list': 50,
|
|
74390
|
-
'asset/v3/private/transfer/sub-member/list/query':
|
|
74391
|
-
'asset/v3/private/transfer/sub-member-transfer/list/query':
|
|
74392
|
-
'asset/v3/private/transfer/universal-transfer/list/query':
|
|
74543
|
+
'asset/v3/private/transfer/sub-member/list/query': 50,
|
|
74544
|
+
'asset/v3/private/transfer/sub-member-transfer/list/query': 50,
|
|
74545
|
+
'asset/v3/private/transfer/universal-transfer/list/query': 25,
|
|
74393
74546
|
'asset/v1/private/sub-member/member-ids': 50,
|
|
74394
74547
|
'asset/v1/private/deposit/record/query': 50,
|
|
74395
74548
|
'asset/v1/private/withdraw/record/query': 25,
|
|
@@ -74397,11 +74550,11 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
74397
74550
|
'asset/v3/private/coin-info/query': 25,
|
|
74398
74551
|
'asset/v1/private/asset-info/query': 50,
|
|
74399
74552
|
'asset/v1/private/deposit/address': 100,
|
|
74400
|
-
'asset/v3/private/deposit/address/query':
|
|
74553
|
+
'asset/v3/private/deposit/address/query': 10,
|
|
74401
74554
|
'asset/v1/private/universal/transfer/list': 50,
|
|
74402
|
-
'contract/v3/private/copytrading/order/list':
|
|
74403
|
-
'contract/v3/private/copytrading/position/list':
|
|
74404
|
-
'contract/v3/private/copytrading/wallet/balance':
|
|
74555
|
+
'contract/v3/private/copytrading/order/list': 30,
|
|
74556
|
+
'contract/v3/private/copytrading/position/list': 40,
|
|
74557
|
+
'contract/v3/private/copytrading/wallet/balance': 25,
|
|
74405
74558
|
'contract/v3/private/position/limit-info': 25,
|
|
74406
74559
|
'contract/v3/private/order/unfilled-orders': 1,
|
|
74407
74560
|
'contract/v3/private/order/list': 1,
|
|
@@ -74428,43 +74581,43 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
74428
74581
|
'user/v3/private/query-sub-members': 5,
|
|
74429
74582
|
'user/v3/private/query-api': 5,
|
|
74430
74583
|
'user/v3/private/get-member-type': 1,
|
|
74431
|
-
'asset/v3/private/transfer/transfer-coin/list/query':
|
|
74432
|
-
'asset/v3/private/transfer/account-coin/balance/query':
|
|
74433
|
-
'asset/v3/private/transfer/account-coins/balance/query':
|
|
74434
|
-
'asset/v3/private/transfer/asset-info/query':
|
|
74584
|
+
'asset/v3/private/transfer/transfer-coin/list/query': 50,
|
|
74585
|
+
'asset/v3/private/transfer/account-coin/balance/query': 50,
|
|
74586
|
+
'asset/v3/private/transfer/account-coins/balance/query': 25,
|
|
74587
|
+
'asset/v3/private/transfer/asset-info/query': 50,
|
|
74435
74588
|
'asset/v3/public/deposit/allowed-deposit-list/query': 0.17,
|
|
74436
|
-
'asset/v3/private/deposit/record/query':
|
|
74437
|
-
'asset/v3/private/withdraw/record/query':
|
|
74589
|
+
'asset/v3/private/deposit/record/query': 10,
|
|
74590
|
+
'asset/v3/private/withdraw/record/query': 10,
|
|
74438
74591
|
// v5
|
|
74439
74592
|
// trade
|
|
74440
74593
|
'v5/order/realtime': 5,
|
|
74441
74594
|
'v5/order/history': 5,
|
|
74442
|
-
'v5/order/spot-borrow-check':
|
|
74595
|
+
'v5/order/spot-borrow-check': 1,
|
|
74443
74596
|
// position
|
|
74444
74597
|
'v5/position/list': 5,
|
|
74445
74598
|
'v5/execution/list': 5,
|
|
74446
74599
|
'v5/position/closed-pnl': 5,
|
|
74447
74600
|
// pre-upgrade
|
|
74448
|
-
'v5/pre-upgrade/order/history':
|
|
74449
|
-
'v5/pre-upgrade/execution/list':
|
|
74450
|
-
'v5/pre-upgrade/position/closed-pnl':
|
|
74451
|
-
'v5/pre-upgrade/account/transaction-log':
|
|
74452
|
-
'v5/pre-upgrade/asset/delivery-record':
|
|
74453
|
-
'v5/pre-upgrade/asset/settlement-record':
|
|
74601
|
+
'v5/pre-upgrade/order/history': 5,
|
|
74602
|
+
'v5/pre-upgrade/execution/list': 5,
|
|
74603
|
+
'v5/pre-upgrade/position/closed-pnl': 5,
|
|
74604
|
+
'v5/pre-upgrade/account/transaction-log': 5,
|
|
74605
|
+
'v5/pre-upgrade/asset/delivery-record': 5,
|
|
74606
|
+
'v5/pre-upgrade/asset/settlement-record': 5,
|
|
74454
74607
|
// account
|
|
74455
|
-
'v5/account/wallet-balance':
|
|
74456
|
-
'v5/account/borrow-history':
|
|
74457
|
-
'v5/account/set-collateral-switch':
|
|
74458
|
-
'v5/account/collateral-info':
|
|
74459
|
-
'v5/asset/coin-greeks':
|
|
74460
|
-
'v5/account/fee-rate':
|
|
74461
|
-
'v5/account/info':
|
|
74462
|
-
'v5/account/transaction-log':
|
|
74463
|
-
'v5/account/mmp-state':
|
|
74608
|
+
'v5/account/wallet-balance': 1,
|
|
74609
|
+
'v5/account/borrow-history': 1,
|
|
74610
|
+
'v5/account/set-collateral-switch': 5,
|
|
74611
|
+
'v5/account/collateral-info': 1,
|
|
74612
|
+
'v5/asset/coin-greeks': 1,
|
|
74613
|
+
'v5/account/fee-rate': 10,
|
|
74614
|
+
'v5/account/info': 5,
|
|
74615
|
+
'v5/account/transaction-log': 1,
|
|
74616
|
+
'v5/account/mmp-state': 5,
|
|
74464
74617
|
// asset
|
|
74465
74618
|
'v5/asset/exchange/order-record': 5,
|
|
74466
|
-
'v5/asset/delivery-record':
|
|
74467
|
-
'v5/asset/settlement-record':
|
|
74619
|
+
'v5/asset/delivery-record': 5,
|
|
74620
|
+
'v5/asset/settlement-record': 5,
|
|
74468
74621
|
'v5/asset/transfer/query-asset-info': 50,
|
|
74469
74622
|
'v5/asset/transfer/query-account-coins-balance': 25,
|
|
74470
74623
|
'v5/asset/transfer/query-account-coin-balance': 50,
|
|
@@ -74472,38 +74625,38 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
74472
74625
|
'v5/asset/transfer/query-inter-transfer-list': 50,
|
|
74473
74626
|
'v5/asset/transfer/query-sub-member-list': 50,
|
|
74474
74627
|
'v5/asset/transfer/query-universal-transfer-list': 25,
|
|
74475
|
-
'v5/asset/deposit/query-allowed-list':
|
|
74628
|
+
'v5/asset/deposit/query-allowed-list': 5,
|
|
74476
74629
|
'v5/asset/deposit/query-record': 10,
|
|
74477
74630
|
'v5/asset/deposit/query-sub-member-record': 10,
|
|
74478
|
-
'v5/asset/deposit/query-internal-record':
|
|
74631
|
+
'v5/asset/deposit/query-internal-record': 5,
|
|
74479
74632
|
'v5/asset/deposit/query-address': 10,
|
|
74480
74633
|
'v5/asset/deposit/query-sub-member-address': 10,
|
|
74481
74634
|
'v5/asset/coin/query-info': 25,
|
|
74482
74635
|
'v5/asset/withdraw/query-record': 10,
|
|
74483
|
-
'v5/asset/withdraw/withdrawable-amount':
|
|
74636
|
+
'v5/asset/withdraw/withdrawable-amount': 5,
|
|
74484
74637
|
// user
|
|
74485
74638
|
'v5/user/query-sub-members': 5,
|
|
74486
74639
|
'v5/user/query-api': 5,
|
|
74487
|
-
'v5/user/get-member-type':
|
|
74488
|
-
'v5/user/aff-customer-info':
|
|
74640
|
+
'v5/user/get-member-type': 5,
|
|
74641
|
+
'v5/user/aff-customer-info': 5,
|
|
74489
74642
|
// spot leverage token
|
|
74490
74643
|
'v5/spot-lever-token/order-record': 1,
|
|
74491
74644
|
// spot margin trade
|
|
74492
|
-
'v5/spot-margin-trade/state':
|
|
74645
|
+
'v5/spot-margin-trade/state': 5,
|
|
74493
74646
|
'v5/spot-cross-margin-trade/loan-info': 1,
|
|
74494
74647
|
'v5/spot-cross-margin-trade/account': 1,
|
|
74495
74648
|
'v5/spot-cross-margin-trade/orders': 1,
|
|
74496
74649
|
'v5/spot-cross-margin-trade/repay-history': 1,
|
|
74497
74650
|
// institutional lending
|
|
74498
|
-
'v5/ins-loan/loan-order':
|
|
74499
|
-
'v5/ins-loan/repaid-history':
|
|
74500
|
-
'v5/ins-loan/ltv-convert':
|
|
74651
|
+
'v5/ins-loan/loan-order': 5,
|
|
74652
|
+
'v5/ins-loan/repaid-history': 5,
|
|
74653
|
+
'v5/ins-loan/ltv-convert': 5,
|
|
74501
74654
|
// c2c lending
|
|
74502
|
-
'v5/lending/info':
|
|
74503
|
-
'v5/lending/history-order':
|
|
74504
|
-
'v5/lending/account':
|
|
74655
|
+
'v5/lending/info': 5,
|
|
74656
|
+
'v5/lending/history-order': 5,
|
|
74657
|
+
'v5/lending/account': 5,
|
|
74505
74658
|
// broker
|
|
74506
|
-
'v5/broker/earning-record':
|
|
74659
|
+
'v5/broker/earning-record': 5,
|
|
74507
74660
|
},
|
|
74508
74661
|
'post': {
|
|
74509
74662
|
// inverse swap
|
|
@@ -74569,17 +74722,17 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
74569
74722
|
'spot/v3/private/cross-margin-repay': 10,
|
|
74570
74723
|
// account
|
|
74571
74724
|
'asset/v1/private/transfer': 150,
|
|
74572
|
-
'asset/v3/private/transfer/inter-transfer':
|
|
74725
|
+
'asset/v3/private/transfer/inter-transfer': 150,
|
|
74573
74726
|
'asset/v1/private/sub-member/transfer': 150,
|
|
74574
74727
|
'asset/v1/private/withdraw': 50,
|
|
74575
|
-
'asset/v3/private/withdraw/create':
|
|
74728
|
+
'asset/v3/private/withdraw/create': 300,
|
|
74576
74729
|
'asset/v1/private/withdraw/cancel': 50,
|
|
74577
|
-
'asset/v3/private/withdraw/cancel':
|
|
74730
|
+
'asset/v3/private/withdraw/cancel': 50,
|
|
74578
74731
|
'asset/v1/private/transferable-subs/save': 3000,
|
|
74579
74732
|
'asset/v1/private/universal/transfer': 1500,
|
|
74580
|
-
'asset/v3/private/transfer/sub-member-transfer':
|
|
74581
|
-
'asset/v3/private/transfer/transfer-sub-member-save':
|
|
74582
|
-
'asset/v3/private/transfer/universal-transfer':
|
|
74733
|
+
'asset/v3/private/transfer/sub-member-transfer': 150,
|
|
74734
|
+
'asset/v3/private/transfer/transfer-sub-member-save': 150,
|
|
74735
|
+
'asset/v3/private/transfer/universal-transfer': 10,
|
|
74583
74736
|
'user/v3/private/create-sub-member': 10,
|
|
74584
74737
|
'user/v3/private/create-sub-api': 10,
|
|
74585
74738
|
'user/v3/private/update-api': 10,
|
|
@@ -74618,12 +74771,12 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
74618
74771
|
'perpetual/usdc/openapi/public/v1/risk-limit/list': 2.5,
|
|
74619
74772
|
'perpetual/usdc/openapi/private/v1/position/set-risk-limit': 2.5,
|
|
74620
74773
|
'perpetual/usdc/openapi/private/v1/predicted-funding': 2.5,
|
|
74621
|
-
'contract/v3/private/copytrading/order/create':
|
|
74622
|
-
'contract/v3/private/copytrading/order/cancel':
|
|
74623
|
-
'contract/v3/private/copytrading/order/close':
|
|
74624
|
-
'contract/v3/private/copytrading/position/close':
|
|
74625
|
-
'contract/v3/private/copytrading/position/set-leverage':
|
|
74626
|
-
'contract/v3/private/copytrading/wallet/transfer':
|
|
74774
|
+
'contract/v3/private/copytrading/order/create': 30,
|
|
74775
|
+
'contract/v3/private/copytrading/order/cancel': 30,
|
|
74776
|
+
'contract/v3/private/copytrading/order/close': 30,
|
|
74777
|
+
'contract/v3/private/copytrading/position/close': 40,
|
|
74778
|
+
'contract/v3/private/copytrading/position/set-leverage': 40,
|
|
74779
|
+
'contract/v3/private/copytrading/wallet/transfer': 25,
|
|
74627
74780
|
'contract/v3/private/copytrading/order/trading-stop': 2.5,
|
|
74628
74781
|
'contract/v3/private/order/create': 1,
|
|
74629
74782
|
'contract/v3/private/order/cancel': 1,
|
|
@@ -74638,13 +74791,13 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
74638
74791
|
'contract/v3/private/position/set-risk-limit': 1,
|
|
74639
74792
|
'contract/v3/private/account/setMarginMode': 1,
|
|
74640
74793
|
// derivative
|
|
74641
|
-
'unified/v3/private/order/create':
|
|
74642
|
-
'unified/v3/private/order/replace':
|
|
74643
|
-
'unified/v3/private/order/cancel':
|
|
74644
|
-
'unified/v3/private/order/create-batch':
|
|
74645
|
-
'unified/v3/private/order/replace-batch':
|
|
74646
|
-
'unified/v3/private/order/cancel-batch':
|
|
74647
|
-
'unified/v3/private/order/cancel-all':
|
|
74794
|
+
'unified/v3/private/order/create': 30,
|
|
74795
|
+
'unified/v3/private/order/replace': 30,
|
|
74796
|
+
'unified/v3/private/order/cancel': 30,
|
|
74797
|
+
'unified/v3/private/order/create-batch': 30,
|
|
74798
|
+
'unified/v3/private/order/replace-batch': 30,
|
|
74799
|
+
'unified/v3/private/order/cancel-batch': 30,
|
|
74800
|
+
'unified/v3/private/order/cancel-all': 30,
|
|
74648
74801
|
'unified/v3/private/position/set-leverage': 2.5,
|
|
74649
74802
|
'unified/v3/private/position/tpsl/switch-mode': 2.5,
|
|
74650
74803
|
'unified/v3/private/position/set-risk-limit': 2.5,
|
|
@@ -74658,34 +74811,34 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
74658
74811
|
'fht/compliance/tax/v3/private/url': 50,
|
|
74659
74812
|
// v5
|
|
74660
74813
|
// trade
|
|
74661
|
-
'v5/order/create': 5,
|
|
74814
|
+
'v5/order/create': 2.5,
|
|
74662
74815
|
'v5/order/amend': 5,
|
|
74663
|
-
'v5/order/cancel': 5,
|
|
74664
|
-
'v5/order/cancel-all':
|
|
74816
|
+
'v5/order/cancel': 2.5,
|
|
74817
|
+
'v5/order/cancel-all': 50,
|
|
74665
74818
|
'v5/order/create-batch': 5,
|
|
74666
74819
|
'v5/order/amend-batch': 5,
|
|
74667
74820
|
'v5/order/cancel-batch': 5,
|
|
74668
|
-
'v5/order/disconnected-cancel-all':
|
|
74821
|
+
'v5/order/disconnected-cancel-all': 5,
|
|
74669
74822
|
// position
|
|
74670
74823
|
'v5/position/set-leverage': 5,
|
|
74671
|
-
'v5/position/switch-isolated':
|
|
74824
|
+
'v5/position/switch-isolated': 5,
|
|
74672
74825
|
'v5/position/set-tpsl-mode': 5,
|
|
74673
|
-
'v5/position/switch-mode':
|
|
74826
|
+
'v5/position/switch-mode': 5,
|
|
74674
74827
|
'v5/position/set-risk-limit': 5,
|
|
74675
74828
|
'v5/position/trading-stop': 5,
|
|
74676
|
-
'v5/position/set-auto-add-margin':
|
|
74677
|
-
'v5/position/add-margin':
|
|
74678
|
-
'v5/position/confirm-pending-mmr':
|
|
74829
|
+
'v5/position/set-auto-add-margin': 5,
|
|
74830
|
+
'v5/position/add-margin': 5,
|
|
74831
|
+
'v5/position/confirm-pending-mmr': 5,
|
|
74679
74832
|
// account
|
|
74680
|
-
'v5/account/upgrade-to-uta':
|
|
74681
|
-
'v5/account/set-margin-mode':
|
|
74682
|
-
'v5/account/mmp-modify':
|
|
74683
|
-
'v5/account/mmp-reset':
|
|
74833
|
+
'v5/account/upgrade-to-uta': 5,
|
|
74834
|
+
'v5/account/set-margin-mode': 5,
|
|
74835
|
+
'v5/account/mmp-modify': 5,
|
|
74836
|
+
'v5/account/mmp-reset': 5,
|
|
74684
74837
|
// asset
|
|
74685
74838
|
'v5/asset/transfer/inter-transfer': 150,
|
|
74686
74839
|
'v5/asset/transfer/save-transfer-sub-member': 150,
|
|
74687
74840
|
'v5/asset/transfer/universal-transfer': 10,
|
|
74688
|
-
'v5/asset/deposit/deposit-to-account':
|
|
74841
|
+
'v5/asset/deposit/deposit-to-account': 5,
|
|
74689
74842
|
'v5/asset/withdraw/create': 300,
|
|
74690
74843
|
'v5/asset/withdraw/cancel': 50,
|
|
74691
74844
|
// user
|
|
@@ -74700,15 +74853,15 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
74700
74853
|
'v5/spot-lever-token/purchase': 2.5,
|
|
74701
74854
|
'v5/spot-lever-token/redeem': 2.5,
|
|
74702
74855
|
// spot margin trade
|
|
74703
|
-
'v5/spot-margin-trade/switch-mode':
|
|
74704
|
-
'v5/spot-margin-trade/set-leverage':
|
|
74856
|
+
'v5/spot-margin-trade/switch-mode': 5,
|
|
74857
|
+
'v5/spot-margin-trade/set-leverage': 5,
|
|
74705
74858
|
'v5/spot-cross-margin-trade/loan': 2.5,
|
|
74706
74859
|
'v5/spot-cross-margin-trade/repay': 2.5,
|
|
74707
74860
|
'v5/spot-cross-margin-trade/switch': 2.5,
|
|
74708
74861
|
// c2c lending
|
|
74709
|
-
'v5/lending/purchase':
|
|
74710
|
-
'v5/lending/redeem':
|
|
74711
|
-
'v5/lending/redeem-cancel':
|
|
74862
|
+
'v5/lending/purchase': 5,
|
|
74863
|
+
'v5/lending/redeem': 5,
|
|
74864
|
+
'v5/lending/redeem-cancel': 5,
|
|
74712
74865
|
},
|
|
74713
74866
|
'delete': {
|
|
74714
74867
|
// spot
|
|
@@ -78247,7 +78400,10 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
78247
78400
|
// Valid for option only.
|
|
78248
78401
|
// 'orderIv': '0', // Implied volatility; parameters are passed according to the real value; for example, for 10%, 0.1 is passed
|
|
78249
78402
|
};
|
|
78250
|
-
if (market['
|
|
78403
|
+
if (market['spot']) {
|
|
78404
|
+
request['category'] = 'spot';
|
|
78405
|
+
}
|
|
78406
|
+
else if (market['linear']) {
|
|
78251
78407
|
request['category'] = 'linear';
|
|
78252
78408
|
}
|
|
78253
78409
|
else if (market['inverse']) {
|
|
@@ -110951,7 +111107,7 @@ class deribit extends _abstract_deribit_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
110951
111107
|
// }
|
|
110952
111108
|
//
|
|
110953
111109
|
const timestamp = this.safeInteger(liquidation, 'timestamp');
|
|
110954
|
-
return {
|
|
111110
|
+
return this.safeLiquidation({
|
|
110955
111111
|
'info': liquidation,
|
|
110956
111112
|
'symbol': this.safeSymbol(undefined, market),
|
|
110957
111113
|
'contracts': undefined,
|
|
@@ -110961,7 +111117,7 @@ class deribit extends _abstract_deribit_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
110961
111117
|
'quoteValue': undefined,
|
|
110962
111118
|
'timestamp': timestamp,
|
|
110963
111119
|
'datetime': this.iso8601(timestamp),
|
|
110964
|
-
};
|
|
111120
|
+
});
|
|
110965
111121
|
}
|
|
110966
111122
|
nonce() {
|
|
110967
111123
|
return this.milliseconds();
|
|
@@ -124464,7 +124620,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
124464
124620
|
if (quoteValueString === undefined) {
|
|
124465
124621
|
quoteValueString = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringMul */ .O.stringMul(baseValueString, priceString);
|
|
124466
124622
|
}
|
|
124467
|
-
return {
|
|
124623
|
+
return this.safeLiquidation({
|
|
124468
124624
|
'info': liquidation,
|
|
124469
124625
|
'symbol': this.safeSymbol(marketId, market),
|
|
124470
124626
|
'contracts': this.parseNumber(contractsString),
|
|
@@ -124474,7 +124630,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
124474
124630
|
'quoteValue': this.parseNumber(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringAbs */ .O.stringAbs(quoteValueString)),
|
|
124475
124631
|
'timestamp': timestamp,
|
|
124476
124632
|
'datetime': this.iso8601(timestamp),
|
|
124477
|
-
};
|
|
124633
|
+
});
|
|
124478
124634
|
}
|
|
124479
124635
|
handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
|
|
124480
124636
|
if (response === undefined) {
|
|
@@ -130301,7 +130457,7 @@ class hollaex extends _abstract_hollaex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
130301
130457
|
//
|
|
130302
130458
|
return this.parseOHLCVs(response, market, timeframe, since, limit);
|
|
130303
130459
|
}
|
|
130304
|
-
parseOHLCV(
|
|
130460
|
+
parseOHLCV(ohlcv, market = undefined) {
|
|
130305
130461
|
//
|
|
130306
130462
|
// {
|
|
130307
130463
|
// "time":"2020-03-02T20:00:00.000Z",
|
|
@@ -130314,12 +130470,12 @@ class hollaex extends _abstract_hollaex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
130314
130470
|
// }
|
|
130315
130471
|
//
|
|
130316
130472
|
return [
|
|
130317
|
-
this.parse8601(this.safeString(
|
|
130318
|
-
this.safeNumber(
|
|
130319
|
-
this.safeNumber(
|
|
130320
|
-
this.safeNumber(
|
|
130321
|
-
this.safeNumber(
|
|
130322
|
-
this.safeNumber(
|
|
130473
|
+
this.parse8601(this.safeString(ohlcv, 'time')),
|
|
130474
|
+
this.safeNumber(ohlcv, 'open'),
|
|
130475
|
+
this.safeNumber(ohlcv, 'high'),
|
|
130476
|
+
this.safeNumber(ohlcv, 'low'),
|
|
130477
|
+
this.safeNumber(ohlcv, 'close'),
|
|
130478
|
+
this.safeNumber(ohlcv, 'volume'),
|
|
130323
130479
|
];
|
|
130324
130480
|
}
|
|
130325
130481
|
parseBalance(response) {
|
|
@@ -139887,7 +140043,7 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
139887
140043
|
//
|
|
139888
140044
|
const marketId = this.safeString(liquidation, 'contract_code');
|
|
139889
140045
|
const timestamp = this.safeInteger(liquidation, 'created_at');
|
|
139890
|
-
return {
|
|
140046
|
+
return this.safeLiquidation({
|
|
139891
140047
|
'info': liquidation,
|
|
139892
140048
|
'symbol': this.safeSymbol(marketId, market),
|
|
139893
140049
|
'contracts': this.safeNumber(liquidation, 'volume'),
|
|
@@ -139897,7 +140053,7 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
139897
140053
|
'quoteValue': this.safeNumber(liquidation, 'trade_turnover'),
|
|
139898
140054
|
'timestamp': timestamp,
|
|
139899
140055
|
'datetime': this.iso8601(timestamp),
|
|
139900
|
-
};
|
|
140056
|
+
});
|
|
139901
140057
|
}
|
|
139902
140058
|
}
|
|
139903
140059
|
|
|
@@ -155626,9 +155782,6 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
155626
155782
|
//
|
|
155627
155783
|
return this.parseTicker(response['data'], market);
|
|
155628
155784
|
}
|
|
155629
|
-
async fetchTickers(symbols = undefined, params = {}) {
|
|
155630
|
-
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchTickers() is not supported yet');
|
|
155631
|
-
}
|
|
155632
155785
|
parseTicker(ticker, market = undefined) {
|
|
155633
155786
|
//
|
|
155634
155787
|
// {
|
|
@@ -157296,14 +157449,16 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
157296
157449
|
/* harmony import */ var _abstract_kuna_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4722);
|
|
157297
157450
|
/* harmony import */ var _base_errors_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6689);
|
|
157298
157451
|
/* harmony import */ var _base_functions_number_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9292);
|
|
157299
|
-
/* harmony import */ var
|
|
157300
|
-
/* harmony import */ var
|
|
157452
|
+
/* harmony import */ var _static_dependencies_noble_hashes_sha256_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(1372);
|
|
157453
|
+
/* harmony import */ var _static_dependencies_noble_hashes_sha512_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(7110);
|
|
157454
|
+
/* harmony import */ var _ccxt_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(2194);
|
|
157301
157455
|
// ---------------------------------------------------------------------------
|
|
157302
157456
|
|
|
157303
157457
|
|
|
157304
157458
|
|
|
157305
157459
|
|
|
157306
157460
|
|
|
157461
|
+
|
|
157307
157462
|
// ---------------------------------------------------------------------------
|
|
157308
157463
|
/**
|
|
157309
157464
|
* @class kuna
|
|
@@ -157317,35 +157472,63 @@ class kuna extends _abstract_kuna_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
157317
157472
|
'name': 'Kuna',
|
|
157318
157473
|
'countries': ['UA'],
|
|
157319
157474
|
'rateLimit': 1000,
|
|
157320
|
-
'version': '
|
|
157475
|
+
'version': 'v4',
|
|
157321
157476
|
'has': {
|
|
157322
157477
|
'CORS': undefined,
|
|
157323
157478
|
'spot': true,
|
|
157324
|
-
'margin':
|
|
157479
|
+
'margin': false,
|
|
157325
157480
|
'swap': false,
|
|
157326
157481
|
'future': false,
|
|
157327
157482
|
'option': false,
|
|
157483
|
+
'addMargin': false,
|
|
157484
|
+
'borrowMargin': false,
|
|
157328
157485
|
'cancelOrder': true,
|
|
157486
|
+
'cancelOrders': true,
|
|
157487
|
+
'createDepositAddress': true,
|
|
157329
157488
|
'createOrder': true,
|
|
157489
|
+
'createPostOnlyOrder': false,
|
|
157490
|
+
'createReduceOnlyOrder': false,
|
|
157491
|
+
'createStopLimitOrder': true,
|
|
157492
|
+
'createStopMarketOrder': false,
|
|
157493
|
+
'createStopOrder': true,
|
|
157330
157494
|
'fetchBalance': true,
|
|
157495
|
+
'fetchBorrowInterest': false,
|
|
157496
|
+
'fetchBorrowRate': false,
|
|
157497
|
+
'fetchBorrowRateHistories': false,
|
|
157498
|
+
'fetchBorrowRateHistory': false,
|
|
157499
|
+
'fetchBorrowRates': false,
|
|
157500
|
+
'fetchBorrowRatesPerSymbol': false,
|
|
157501
|
+
'fetchClosedOrders': true,
|
|
157502
|
+
'fetchCurrencies': true,
|
|
157503
|
+
'fetchDeposit': true,
|
|
157504
|
+
'fetchDepositAddress': true,
|
|
157505
|
+
'fetchDeposits': true,
|
|
157506
|
+
'fetchDepositsWithdrawals': false,
|
|
157331
157507
|
'fetchFundingHistory': false,
|
|
157332
157508
|
'fetchFundingRate': false,
|
|
157333
157509
|
'fetchFundingRateHistory': false,
|
|
157334
157510
|
'fetchFundingRates': false,
|
|
157335
157511
|
'fetchIndexOHLCV': false,
|
|
157512
|
+
'fetchIsolatedPositions': false,
|
|
157336
157513
|
'fetchL3OrderBook': true,
|
|
157337
157514
|
'fetchLeverage': false,
|
|
157515
|
+
'fetchLeverageTiers': false,
|
|
157338
157516
|
'fetchMarginMode': false,
|
|
157517
|
+
'fetchMarketLeverageTiers': false,
|
|
157339
157518
|
'fetchMarkets': true,
|
|
157340
157519
|
'fetchMarkOHLCV': false,
|
|
157341
157520
|
'fetchMyTrades': true,
|
|
157342
157521
|
'fetchOHLCV': 'emulated',
|
|
157522
|
+
'fetchOpenInterest': false,
|
|
157343
157523
|
'fetchOpenInterestHistory': false,
|
|
157344
157524
|
'fetchOpenOrders': true,
|
|
157345
157525
|
'fetchOrder': true,
|
|
157346
157526
|
'fetchOrderBook': true,
|
|
157527
|
+
'fetchOrdersByStatus': true,
|
|
157528
|
+
'fetchPosition': false,
|
|
157347
157529
|
'fetchPositionMode': false,
|
|
157348
157530
|
'fetchPositions': false,
|
|
157531
|
+
'fetchPositionsBySymbol': false,
|
|
157349
157532
|
'fetchPositionsRisk': false,
|
|
157350
157533
|
'fetchPremiumIndexOHLCV': false,
|
|
157351
157534
|
'fetchTicker': true,
|
|
@@ -157354,9 +157537,20 @@ class kuna extends _abstract_kuna_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
157354
157537
|
'fetchTrades': true,
|
|
157355
157538
|
'fetchTradingFee': false,
|
|
157356
157539
|
'fetchTradingFees': false,
|
|
157540
|
+
'fetchTransactions': false,
|
|
157541
|
+
'fetchTransfers': false,
|
|
157542
|
+
'fetchWithdrawAddresses': false,
|
|
157543
|
+
'fetchWithdrawal': true,
|
|
157544
|
+
'fetchWithdrawals': true,
|
|
157357
157545
|
'reduceMargin': false,
|
|
157546
|
+
'repayMargin': false,
|
|
157358
157547
|
'setLeverage': false,
|
|
157548
|
+
'setMargin': false,
|
|
157549
|
+
'setMarginMode': false,
|
|
157359
157550
|
'setPositionMode': false,
|
|
157551
|
+
'signIn': false,
|
|
157552
|
+
'transfer': false,
|
|
157553
|
+
'withdraw': true,
|
|
157360
157554
|
},
|
|
157361
157555
|
'timeframes': undefined,
|
|
157362
157556
|
'urls': {
|
|
@@ -157388,34 +157582,34 @@ class kuna extends _abstract_kuna_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
157388
157582
|
'v4': {
|
|
157389
157583
|
'private': {
|
|
157390
157584
|
'get': {
|
|
157391
|
-
'me': 1,
|
|
157392
|
-
'getBalance': 1,
|
|
157393
|
-
'active': 1,
|
|
157394
|
-
'order/history': 1,
|
|
157585
|
+
'private/me': 1,
|
|
157586
|
+
'private/getBalance': 1,
|
|
157587
|
+
'order/private/active': 1,
|
|
157588
|
+
'order/private/history': 1,
|
|
157395
157589
|
'order/private/{id}/trades': 1,
|
|
157396
|
-
'order/details/{id}
|
|
157397
|
-
'trade/history': 1,
|
|
157398
|
-
'transaction/{hash}': 1,
|
|
157399
|
-
'deposit/preRequest': 1,
|
|
157400
|
-
'deposit/crypto/address': 1,
|
|
157401
|
-
'deposit/crypto/getMerchantAddress': 1,
|
|
157402
|
-
'deposit/history': 1,
|
|
157403
|
-
'deposit/details/{depositId}': 1,
|
|
157404
|
-
'withdraw/preRequest': 1,
|
|
157405
|
-
'withdraw/history': 1,
|
|
157406
|
-
'withdraw/details/{withdrawId}': 1,
|
|
157590
|
+
'order/private/details/{id}': 1,
|
|
157591
|
+
'trade/private/history': 1,
|
|
157592
|
+
'transaction/private/{hash}': 1,
|
|
157593
|
+
'deposit/private/preRequest': 1,
|
|
157594
|
+
'deposit/private/crypto/address': 1,
|
|
157595
|
+
'deposit/private/crypto/getMerchantAddress': 1,
|
|
157596
|
+
'deposit/private/history': 1,
|
|
157597
|
+
'deposit/private/details/{depositId}': 1,
|
|
157598
|
+
'withdraw/private/preRequest': 1,
|
|
157599
|
+
'withdraw/private/history': 1,
|
|
157600
|
+
'withdraw/private/details/{withdrawId}': 1,
|
|
157407
157601
|
'kuna-code/{id}': 1,
|
|
157408
157602
|
'kuna-code/{code}/check': 1,
|
|
157409
157603
|
'kuna-code/issued-by-me': 1,
|
|
157410
157604
|
'kuna-code/redeemed-by-me': 1,
|
|
157411
157605
|
},
|
|
157412
157606
|
'post': {
|
|
157413
|
-
'order/create': 1,
|
|
157414
|
-
'order/cancel': 1,
|
|
157415
|
-
'order/cancel/multi': 1,
|
|
157416
|
-
'deposit/crypto/generateAddress': 1,
|
|
157417
|
-
'deposit/crypto/generateMerchantAddress': 1,
|
|
157418
|
-
'withdraw/create': 1,
|
|
157607
|
+
'order/private/create': 1,
|
|
157608
|
+
'order/private/cancel': 1,
|
|
157609
|
+
'order/private/cancel/multi': 1,
|
|
157610
|
+
'deposit/private/crypto/generateAddress': 1,
|
|
157611
|
+
'deposit/private/crypto/generateMerchantAddress': 1,
|
|
157612
|
+
'withdraw/private/create': 1,
|
|
157419
157613
|
'kuna-code': 1,
|
|
157420
157614
|
},
|
|
157421
157615
|
'put': {
|
|
@@ -157424,12 +157618,14 @@ class kuna extends _abstract_kuna_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
157424
157618
|
},
|
|
157425
157619
|
'public': {
|
|
157426
157620
|
'get': {
|
|
157427
|
-
'timestamp': 1,
|
|
157428
|
-
'fees': 1,
|
|
157429
|
-
'currencies?type={type}': 1,
|
|
157430
|
-
'
|
|
157431
|
-
'markets/
|
|
157432
|
-
'
|
|
157621
|
+
'public/timestamp': 1,
|
|
157622
|
+
'public/fees': 1,
|
|
157623
|
+
'public/currencies?type={type}': 1,
|
|
157624
|
+
'public/currencies': 1,
|
|
157625
|
+
'markets/public/getAll': 1,
|
|
157626
|
+
'markets/public/tickers?pairs={pairs}': 1,
|
|
157627
|
+
'order/public/book/{pairs}': 1,
|
|
157628
|
+
'trade/public/book/{pairs}': 1,
|
|
157433
157629
|
},
|
|
157434
157630
|
},
|
|
157435
157631
|
},
|
|
@@ -157637,6 +157833,12 @@ class kuna extends _abstract_kuna_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
157637
157833
|
},
|
|
157638
157834
|
'precisionMode': _base_functions_number_js__WEBPACK_IMPORTED_MODULE_1__/* .TICK_SIZE */ .sh,
|
|
157639
157835
|
'exceptions': {
|
|
157836
|
+
'ARGUMENT_VALIDATION_ERROR': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest,
|
|
157837
|
+
'PAYMENT_METHOD_NOT_SUPPORTED': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest,
|
|
157838
|
+
'NOT_FOUND': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.OrderNotFound,
|
|
157839
|
+
'INVALID:ORDER_SIZE': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder,
|
|
157840
|
+
'WrongRequestException': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest,
|
|
157841
|
+
'INSUFFICIENT_FUNDS': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InsufficientFunds,
|
|
157640
157842
|
'2002': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InsufficientFunds,
|
|
157641
157843
|
'2003': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.OrderNotFound,
|
|
157642
157844
|
},
|
|
@@ -157650,109 +157852,206 @@ class kuna extends _abstract_kuna_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
157650
157852
|
* @method
|
|
157651
157853
|
* @name kuna#fetchTime
|
|
157652
157854
|
* @description fetches the current integer timestamp in milliseconds from the exchange server
|
|
157855
|
+
* @see https://docs.kuna.io/docs/get-time-on-the-server
|
|
157653
157856
|
* @param {object} [params] extra parameters specific to the kuna api endpoint
|
|
157654
157857
|
* @returns {int} the current integer timestamp in milliseconds from the exchange server
|
|
157655
157858
|
*/
|
|
157656
|
-
const response = await this.
|
|
157859
|
+
const response = await this.v4PublicGetPublicTimestamp(params);
|
|
157860
|
+
//
|
|
157861
|
+
// {
|
|
157862
|
+
// "data": {
|
|
157863
|
+
// "timestamp": 1686740531,
|
|
157864
|
+
// "timestamp_miliseconds": 1686740531725,
|
|
157865
|
+
// }
|
|
157866
|
+
// }
|
|
157867
|
+
//
|
|
157868
|
+
const data = this.safeValue(response, 'data', {});
|
|
157869
|
+
return this.safeInteger(data, 'timestamp_miliseconds');
|
|
157870
|
+
}
|
|
157871
|
+
async fetchCurrencies(params = {}) {
|
|
157872
|
+
/**
|
|
157873
|
+
* @method
|
|
157874
|
+
* @name kuna#fetchCurrencies
|
|
157875
|
+
* @description fetches all available currencies on an exchange
|
|
157876
|
+
* @see https://docs.kuna.io/docs/get-information-about-available-currencies
|
|
157877
|
+
* @param {object} [params] extra parameters specific to the kuna api endpoint
|
|
157878
|
+
* @returns {object} an associative dictionary of currencies
|
|
157879
|
+
*/
|
|
157880
|
+
const response = await this.v4PublicGetPublicCurrencies(params);
|
|
157881
|
+
//
|
|
157882
|
+
// {
|
|
157883
|
+
// "data": [
|
|
157884
|
+
// {
|
|
157885
|
+
// "code": "BTC",
|
|
157886
|
+
// "name": "Bitcoin",
|
|
157887
|
+
// "payload": {
|
|
157888
|
+
// "chart": "https://kuna-pro.kuna.io/bitcoin-chart",
|
|
157889
|
+
// "icons": {
|
|
157890
|
+
// "svg": "https://kuna-pro.kuna.io/icon-btc-svg",
|
|
157891
|
+
// "png2x": "https://kuna-pro.kuna.io/icon-btc-png2x",
|
|
157892
|
+
// "png3x": "https://kuna-pro.kuna.io/icon-btc-png3x",
|
|
157893
|
+
// "svgXL": "https://kuna-pro.kuna.io/icon-btc-svg"
|
|
157894
|
+
// },
|
|
157895
|
+
// "pngChart": "https://kuna-pro.kuna.io/png-bitcoin-chart"
|
|
157896
|
+
// },
|
|
157897
|
+
// "position": 1,
|
|
157898
|
+
// "precision": 8,
|
|
157899
|
+
// "tradePrecision": 6,
|
|
157900
|
+
// "type": "Crypto"
|
|
157901
|
+
// }
|
|
157902
|
+
// ]
|
|
157903
|
+
// }
|
|
157904
|
+
//
|
|
157905
|
+
const data = this.safeValue(response, 'data', []);
|
|
157906
|
+
return this.parseCurrencies(data);
|
|
157907
|
+
}
|
|
157908
|
+
parseCurrencies(currencies, params = {}) {
|
|
157909
|
+
currencies = this.toArray(currencies);
|
|
157910
|
+
const result = {};
|
|
157911
|
+
for (let i = 0; i < currencies.length; i++) {
|
|
157912
|
+
const currency = this.parseCurrency(currencies[i]);
|
|
157913
|
+
result[currency['code']] = currency;
|
|
157914
|
+
}
|
|
157915
|
+
return result;
|
|
157916
|
+
}
|
|
157917
|
+
parseCurrency(currency) {
|
|
157657
157918
|
//
|
|
157658
|
-
//
|
|
157919
|
+
// {
|
|
157920
|
+
// "code": "BTC",
|
|
157921
|
+
// "name": "Bitcoin",
|
|
157922
|
+
// "payload": {
|
|
157923
|
+
// "chart": "https://kuna-pro.kuna.io/bitcoin-chart",
|
|
157924
|
+
// "icons": {
|
|
157925
|
+
// "svg": "https://kuna-pro.kuna.io/icon-btc-svg",
|
|
157926
|
+
// "png2x": "https://kuna-pro.kuna.io/icon-btc-png2x",
|
|
157927
|
+
// "png3x": "https://kuna-pro.kuna.io/icon-btc-png3x",
|
|
157928
|
+
// "svgXL": "https://kuna-pro.kuna.io/icon-btc-svg"
|
|
157929
|
+
// },
|
|
157930
|
+
// "pngChart": "https://kuna-pro.kuna.io/png-bitcoin-chart"
|
|
157931
|
+
// },
|
|
157932
|
+
// "position": 1,
|
|
157933
|
+
// "precision": 8,
|
|
157934
|
+
// "tradePrecision": 6,
|
|
157935
|
+
// "type": "Crypto"
|
|
157936
|
+
// }
|
|
157659
157937
|
//
|
|
157660
|
-
|
|
157938
|
+
const currencyId = this.safeString(currency, 'code');
|
|
157939
|
+
const precision = this.safeString(currency, 'precision');
|
|
157940
|
+
const tradePrecision = this.safeString(currency, 'tradePrecision');
|
|
157941
|
+
return {
|
|
157942
|
+
'info': currency,
|
|
157943
|
+
'id': currencyId,
|
|
157944
|
+
'code': this.safeCurrencyCode(currencyId),
|
|
157945
|
+
'type': undefined,
|
|
157946
|
+
'margin': undefined,
|
|
157947
|
+
'name': this.safeString(currency, 'name'),
|
|
157948
|
+
'active': undefined,
|
|
157949
|
+
'deposit': undefined,
|
|
157950
|
+
'withdraw': undefined,
|
|
157951
|
+
'fee': undefined,
|
|
157952
|
+
'precision': _ccxt_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringMin */ .O.stringMin(precision, tradePrecision),
|
|
157953
|
+
'limits': {
|
|
157954
|
+
'amount': {
|
|
157955
|
+
'min': undefined,
|
|
157956
|
+
'max': undefined,
|
|
157957
|
+
},
|
|
157958
|
+
'withdraw': {
|
|
157959
|
+
'min': undefined,
|
|
157960
|
+
'max': undefined,
|
|
157961
|
+
},
|
|
157962
|
+
},
|
|
157963
|
+
'networks': {},
|
|
157964
|
+
};
|
|
157661
157965
|
}
|
|
157662
157966
|
async fetchMarkets(params = {}) {
|
|
157663
157967
|
/**
|
|
157664
157968
|
* @method
|
|
157665
157969
|
* @name kuna#fetchMarkets
|
|
157666
157970
|
* @description retrieves data on all markets for kuna
|
|
157971
|
+
* @see https://docs.kuna.io/docs/get-all-traded-markets
|
|
157667
157972
|
* @param {object} [params] extra parameters specific to the exchange api endpoint
|
|
157668
157973
|
* @returns {object[]} an array of objects representing market data
|
|
157669
157974
|
*/
|
|
157670
|
-
const
|
|
157671
|
-
const markets = [];
|
|
157672
|
-
const response = await this.publicGetTickers(params);
|
|
157975
|
+
const response = await this.v4PublicGetMarketsPublicGetAll(params);
|
|
157673
157976
|
//
|
|
157674
157977
|
// {
|
|
157675
|
-
//
|
|
157676
|
-
//
|
|
157677
|
-
//
|
|
157678
|
-
//
|
|
157679
|
-
//
|
|
157680
|
-
//
|
|
157681
|
-
//
|
|
157682
|
-
//
|
|
157683
|
-
//
|
|
157684
|
-
//
|
|
157978
|
+
// "data": [
|
|
157979
|
+
// {
|
|
157980
|
+
// "pair": "BTC_USDT", // Traded pair of assets
|
|
157981
|
+
// "baseAsset": { // The base asset of the traded pair, the one to sell or buy as a result of the trade
|
|
157982
|
+
// "code": "BTC",
|
|
157983
|
+
// "precision": 6 // Maximum amount of digits for the decimal part of a number
|
|
157984
|
+
// },
|
|
157985
|
+
// "quoteAsset": { // The quoted asset of the traded pair, the one to use to sell or buy the base asset
|
|
157986
|
+
// "code": "USDT",
|
|
157987
|
+
// "precision": 2 // Maximum amount of digits for the decimal part of a number
|
|
157988
|
+
// },
|
|
157989
|
+
// "tickerPriceChange": "-0.07" // Relative change compared with the last tick
|
|
157685
157990
|
// }
|
|
157686
|
-
//
|
|
157991
|
+
// ]
|
|
157687
157992
|
// }
|
|
157688
157993
|
//
|
|
157689
|
-
const
|
|
157690
|
-
|
|
157691
|
-
|
|
157692
|
-
|
|
157693
|
-
|
|
157694
|
-
|
|
157695
|
-
|
|
157696
|
-
|
|
157697
|
-
|
|
157698
|
-
|
|
157699
|
-
|
|
157700
|
-
|
|
157701
|
-
|
|
157702
|
-
|
|
157703
|
-
|
|
157704
|
-
|
|
157705
|
-
|
|
157706
|
-
|
|
157707
|
-
|
|
157708
|
-
|
|
157709
|
-
|
|
157710
|
-
|
|
157711
|
-
|
|
157712
|
-
|
|
157713
|
-
|
|
157714
|
-
|
|
157715
|
-
|
|
157716
|
-
|
|
157717
|
-
|
|
157718
|
-
|
|
157719
|
-
|
|
157720
|
-
|
|
157721
|
-
|
|
157722
|
-
|
|
157723
|
-
|
|
157724
|
-
|
|
157725
|
-
|
|
157726
|
-
|
|
157727
|
-
|
|
157728
|
-
|
|
157729
|
-
|
|
157730
|
-
|
|
157731
|
-
|
|
157732
|
-
|
|
157733
|
-
'
|
|
157734
|
-
|
|
157735
|
-
|
|
157736
|
-
|
|
157737
|
-
|
|
157738
|
-
|
|
157739
|
-
|
|
157740
|
-
|
|
157741
|
-
|
|
157742
|
-
|
|
157743
|
-
|
|
157744
|
-
|
|
157745
|
-
|
|
157746
|
-
|
|
157747
|
-
|
|
157748
|
-
|
|
157749
|
-
|
|
157750
|
-
},
|
|
157751
|
-
'created': undefined,
|
|
157752
|
-
'info': undefined,
|
|
157753
|
-
});
|
|
157754
|
-
}
|
|
157755
|
-
}
|
|
157994
|
+
const data = this.safeValue(response, 'data', []);
|
|
157995
|
+
const markets = [];
|
|
157996
|
+
for (let i = 0; i < data.length; i++) {
|
|
157997
|
+
const item = data[i];
|
|
157998
|
+
const marketId = this.safeString(item, 'pair');
|
|
157999
|
+
const baseAsset = this.safeValue(item, 'baseAsset');
|
|
158000
|
+
const quoteAsset = this.safeValue(item, 'quoteAsset');
|
|
158001
|
+
const baseId = this.safeString(baseAsset, 'code');
|
|
158002
|
+
const quoteId = this.safeString(quoteAsset, 'code');
|
|
158003
|
+
const base = this.safeCurrencyCode(baseId);
|
|
158004
|
+
const quote = this.safeCurrencyCode(quoteId);
|
|
158005
|
+
const basePrecision = this.safeString(baseAsset, 'precision');
|
|
158006
|
+
const quotePrecision = this.safeString(quoteAsset, 'precision');
|
|
158007
|
+
markets.push({
|
|
158008
|
+
'id': marketId,
|
|
158009
|
+
'symbol': base + '/' + quote,
|
|
158010
|
+
'base': base,
|
|
158011
|
+
'quote': quote,
|
|
158012
|
+
'settle': undefined,
|
|
158013
|
+
'baseId': baseId,
|
|
158014
|
+
'quoteId': quoteId,
|
|
158015
|
+
'settleId': undefined,
|
|
158016
|
+
'type': 'spot',
|
|
158017
|
+
'spot': true,
|
|
158018
|
+
'margin': false,
|
|
158019
|
+
'swap': false,
|
|
158020
|
+
'future': false,
|
|
158021
|
+
'option': false,
|
|
158022
|
+
'active': undefined,
|
|
158023
|
+
'contract': false,
|
|
158024
|
+
'linear': undefined,
|
|
158025
|
+
'inverse': undefined,
|
|
158026
|
+
'contractSize': undefined,
|
|
158027
|
+
'expiry': undefined,
|
|
158028
|
+
'expiryDatetime': undefined,
|
|
158029
|
+
'strike': undefined,
|
|
158030
|
+
'optionType': undefined,
|
|
158031
|
+
'precision': {
|
|
158032
|
+
'amount': this.parseNumber(this.parsePrecision(basePrecision)),
|
|
158033
|
+
'price': this.parseNumber(this.parsePrecision(quotePrecision)),
|
|
158034
|
+
},
|
|
158035
|
+
'limits': {
|
|
158036
|
+
'leverage': {
|
|
158037
|
+
'min': undefined,
|
|
158038
|
+
'max': undefined,
|
|
158039
|
+
},
|
|
158040
|
+
'amount': {
|
|
158041
|
+
'min': undefined,
|
|
158042
|
+
'max': undefined,
|
|
158043
|
+
},
|
|
158044
|
+
'price': {
|
|
158045
|
+
'min': undefined,
|
|
158046
|
+
'max': undefined,
|
|
158047
|
+
},
|
|
158048
|
+
'cost': {
|
|
158049
|
+
'min': undefined,
|
|
158050
|
+
'max': undefined,
|
|
158051
|
+
},
|
|
158052
|
+
},
|
|
158053
|
+
'info': item,
|
|
158054
|
+
});
|
|
157756
158055
|
}
|
|
157757
158056
|
return markets;
|
|
157758
158057
|
}
|
|
@@ -157761,78 +158060,137 @@ class kuna extends _abstract_kuna_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
157761
158060
|
* @method
|
|
157762
158061
|
* @name kuna#fetchOrderBook
|
|
157763
158062
|
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
158063
|
+
* @see https://docs.kuna.io/docs/get-public-orders-book
|
|
157764
158064
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
157765
|
-
* @param {int} [limit]
|
|
158065
|
+
* @param {int} [limit] 5, 10, 20, 50, 100, 500, or 1000 (default)
|
|
157766
158066
|
* @param {object} [params] extra parameters specific to the kuna api endpoint
|
|
157767
158067
|
* @returns {object} A dictionary of [order book structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-book-structure} indexed by market symbols
|
|
157768
158068
|
*/
|
|
157769
158069
|
await this.loadMarkets();
|
|
157770
158070
|
const market = this.market(symbol);
|
|
157771
158071
|
const request = {
|
|
157772
|
-
'
|
|
158072
|
+
'pairs': market['id'],
|
|
157773
158073
|
};
|
|
157774
158074
|
if (limit !== undefined) {
|
|
157775
|
-
request['
|
|
158075
|
+
request['level'] = limit;
|
|
157776
158076
|
}
|
|
157777
|
-
const
|
|
157778
|
-
|
|
157779
|
-
|
|
158077
|
+
const response = await this.v4PublicGetOrderPublicBookPairs(this.extend(request, params));
|
|
158078
|
+
//
|
|
158079
|
+
// {
|
|
158080
|
+
// "data": {
|
|
158081
|
+
// "asks": [ // An array of sell orders
|
|
158082
|
+
// [
|
|
158083
|
+
// "16950", // Sell price, level 1
|
|
158084
|
+
// "0.001" // Sell quantity, level 1
|
|
158085
|
+
// ],
|
|
158086
|
+
// [
|
|
158087
|
+
// "17000", // Sell price, level 2
|
|
158088
|
+
// "0.01" // Sell quantity, level 2
|
|
158089
|
+
// ]
|
|
158090
|
+
// ],
|
|
158091
|
+
// "bids": [ // An array of buy orders
|
|
158092
|
+
// [
|
|
158093
|
+
// "16700", // Sell price, level 1
|
|
158094
|
+
// "0.01" // Sell quantity, level 1
|
|
158095
|
+
// ],
|
|
158096
|
+
// [
|
|
158097
|
+
// "16000", // Sell price, level 2
|
|
158098
|
+
// "0.001" // Sell quantity, level 2
|
|
158099
|
+
// ]
|
|
158100
|
+
// ]
|
|
158101
|
+
// }
|
|
158102
|
+
// }
|
|
158103
|
+
//
|
|
158104
|
+
const data = this.safeValue(response, 'data', {});
|
|
158105
|
+
return this.parseOrderBook(data, market['symbol'], undefined, 'bids', 'asks', 0, 1);
|
|
157780
158106
|
}
|
|
157781
158107
|
parseTicker(ticker, market = undefined) {
|
|
157782
|
-
|
|
157783
|
-
|
|
157784
|
-
|
|
157785
|
-
|
|
158108
|
+
//
|
|
158109
|
+
// {
|
|
158110
|
+
// "pair": "BTC_USDT", // Traded pair
|
|
158111
|
+
// "percentagePriceChange": "-0.03490931899641581", // Relative price change, in percent
|
|
158112
|
+
// "price": "27900", // Current median price
|
|
158113
|
+
// "equivalentPrice": "", // TBD
|
|
158114
|
+
// "high": "29059.69", // Highest price
|
|
158115
|
+
// "low": "27900", // Lowest price
|
|
158116
|
+
// "baseVolume": "2.9008499999999993", // Traded volume as base
|
|
158117
|
+
// "quoteVolume": "82251.41477976", // Traded volume as quote
|
|
158118
|
+
// "bestBidPrice": "27926.91", // The best bid price now
|
|
158119
|
+
// "bestAskPrice": "27970.02", // The best ask price now
|
|
158120
|
+
// "priceChange": "-973.9700000000012" // Absolute price change
|
|
158121
|
+
// }
|
|
158122
|
+
//
|
|
158123
|
+
const marketId = this.safeString(ticker, 'pair');
|
|
157786
158124
|
return this.safeTicker({
|
|
157787
|
-
'
|
|
157788
|
-
'
|
|
157789
|
-
'
|
|
158125
|
+
'info': ticker,
|
|
158126
|
+
'symbol': this.safeSymbol(marketId, market),
|
|
158127
|
+
'timestamp': undefined,
|
|
158128
|
+
'datetime': undefined,
|
|
157790
158129
|
'high': this.safeString(ticker, 'high'),
|
|
157791
158130
|
'low': this.safeString(ticker, 'low'),
|
|
157792
|
-
'bid': this.safeString(ticker, '
|
|
157793
|
-
'
|
|
157794
|
-
'ask': this.safeString(ticker, 'sell'),
|
|
157795
|
-
'askVolume': undefined,
|
|
158131
|
+
'bid': this.safeString(ticker, 'bestBidPrice'),
|
|
158132
|
+
'ask': this.safeString(ticker, 'bestAskPrice'),
|
|
157796
158133
|
'vwap': undefined,
|
|
157797
158134
|
'open': this.safeString(ticker, 'open'),
|
|
157798
|
-
'close':
|
|
157799
|
-
'last':
|
|
158135
|
+
'close': undefined,
|
|
158136
|
+
'last': undefined,
|
|
157800
158137
|
'previousClose': undefined,
|
|
157801
|
-
'change':
|
|
157802
|
-
'percentage':
|
|
158138
|
+
'change': this.safeString(ticker, 'priceChange'),
|
|
158139
|
+
'percentage': this.safeString(ticker, 'percentagePriceChange'),
|
|
157803
158140
|
'average': undefined,
|
|
157804
|
-
'baseVolume': this.safeString(ticker, '
|
|
157805
|
-
'quoteVolume':
|
|
157806
|
-
'info': ticker,
|
|
158141
|
+
'baseVolume': this.safeString(ticker, 'baseVolume'),
|
|
158142
|
+
'quoteVolume': this.safeString(ticker, 'quoteVolume'),
|
|
157807
158143
|
}, market);
|
|
157808
158144
|
}
|
|
157809
158145
|
async fetchTickers(symbols = undefined, params = {}) {
|
|
157810
158146
|
/**
|
|
157811
158147
|
* @method
|
|
157812
158148
|
* @name kuna#fetchTickers
|
|
157813
|
-
* @description fetches price tickers for multiple markets, statistical calculations with the information calculated over the past 24 hours each market
|
|
157814
|
-
* @
|
|
158149
|
+
* @description fetches price tickers for multiple markets, statistical calculations with the information calculated over the past 24 hours each market. The average is not returned in the response, but the median can be accessed via response['info']['price']
|
|
158150
|
+
* @see https://docs.kuna.io/docs/get-market-info-by-tickers
|
|
158151
|
+
* @param {string[]} [symbols] unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
157815
158152
|
* @param {object} [params] extra parameters specific to the kuna api endpoint
|
|
157816
158153
|
* @returns {object} a dictionary of [ticker structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#ticker-structure}
|
|
157817
158154
|
*/
|
|
157818
158155
|
await this.loadMarkets();
|
|
157819
|
-
symbols
|
|
157820
|
-
|
|
157821
|
-
const ids = Object.keys(response);
|
|
157822
|
-
const result = {};
|
|
157823
|
-
for (let i = 0; i < ids.length; i++) {
|
|
157824
|
-
const id = ids[i];
|
|
157825
|
-
const market = this.safeMarket(id);
|
|
157826
|
-
const symbol = market['symbol'];
|
|
157827
|
-
result[symbol] = this.parseTicker(response[id], market);
|
|
158156
|
+
if (symbols === undefined) {
|
|
158157
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' fetchTickers () requires a symbols argument');
|
|
157828
158158
|
}
|
|
157829
|
-
|
|
158159
|
+
symbols = this.marketSymbols(symbols);
|
|
158160
|
+
const marketIds = this.marketIds(symbols);
|
|
158161
|
+
const request = {
|
|
158162
|
+
'pairs': marketIds.join(','),
|
|
158163
|
+
};
|
|
158164
|
+
const response = await this.v4PublicGetMarketsPublicTickersPairsPairs(this.extend(request, params));
|
|
158165
|
+
//
|
|
158166
|
+
// {
|
|
158167
|
+
// "data": [
|
|
158168
|
+
// {
|
|
158169
|
+
// "pair": "BTC_USDT", // Traded pair
|
|
158170
|
+
// "percentagePriceChange": "-0.03490931899641581", // Relative price change, in percent
|
|
158171
|
+
// "price": "27900", // Current median price
|
|
158172
|
+
// "equivalentPrice": "", // TBD
|
|
158173
|
+
// "high": "29059.69", // Highest price
|
|
158174
|
+
// "low": "27900", // Lowest price
|
|
158175
|
+
// "baseVolume": "2.9008499999999993", // Traded volume as base
|
|
158176
|
+
// "quoteVolume": "82251.41477976", // Traded volume as quote
|
|
158177
|
+
// "bestBidPrice": "27926.91", // The best bid price now
|
|
158178
|
+
// "bestAskPrice": "27970.02", // The best ask price now
|
|
158179
|
+
// "priceChange": "-973.9700000000012" // Absolute price change
|
|
158180
|
+
// }
|
|
158181
|
+
// ...
|
|
158182
|
+
// ]
|
|
158183
|
+
// }
|
|
158184
|
+
//
|
|
158185
|
+
const data = this.safeValue(response, 'data', []);
|
|
158186
|
+
return this.parseTickers(data, symbols, params);
|
|
157830
158187
|
}
|
|
157831
158188
|
async fetchTicker(symbol, params = {}) {
|
|
157832
158189
|
/**
|
|
157833
158190
|
* @method
|
|
157834
158191
|
* @name kuna#fetchTicker
|
|
157835
158192
|
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
158193
|
+
* @see https://docs.kuna.io/docs/get-market-info-by-tickers
|
|
157836
158194
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
157837
158195
|
* @param {object} [params] extra parameters specific to the kuna api endpoint
|
|
157838
158196
|
* @returns {object} a [ticker structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#ticker-structure}
|
|
@@ -157840,13 +158198,36 @@ class kuna extends _abstract_kuna_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
157840
158198
|
await this.loadMarkets();
|
|
157841
158199
|
const market = this.market(symbol);
|
|
157842
158200
|
const request = {
|
|
157843
|
-
'
|
|
158201
|
+
'pairs': market['id'],
|
|
157844
158202
|
};
|
|
157845
|
-
const response = await this.
|
|
157846
|
-
|
|
158203
|
+
const response = await this.v4PublicGetMarketsPublicTickersPairsPairs(this.extend(request, params));
|
|
158204
|
+
//
|
|
158205
|
+
// {
|
|
158206
|
+
// "data": [
|
|
158207
|
+
// {
|
|
158208
|
+
// "pair": "BTC_USDT", // Traded pair
|
|
158209
|
+
// "percentagePriceChange": "-0.03490931899641581", // Relative price change, in percent
|
|
158210
|
+
// "price": "27900", // Current median price
|
|
158211
|
+
// "equivalentPrice": "", // TBD
|
|
158212
|
+
// "high": "29059.69", // Highest price
|
|
158213
|
+
// "low": "27900", // Lowest price
|
|
158214
|
+
// "baseVolume": "2.9008499999999993", // Traded volume as base
|
|
158215
|
+
// "quoteVolume": "82251.41477976", // Traded volume as quote
|
|
158216
|
+
// "bestBidPrice": "27926.91", // The best bid price now
|
|
158217
|
+
// "bestAskPrice": "27970.02", // The best ask price now
|
|
158218
|
+
// "priceChange": "-973.9700000000012" // Absolute price change
|
|
158219
|
+
// }
|
|
158220
|
+
// ...
|
|
158221
|
+
// ]
|
|
158222
|
+
// }
|
|
158223
|
+
//
|
|
158224
|
+
const data = this.safeValue(response, 'data', []);
|
|
158225
|
+
const ticker = this.safeValue(data, 0);
|
|
158226
|
+
return this.parseTicker(ticker, market);
|
|
157847
158227
|
}
|
|
157848
158228
|
async fetchL3OrderBook(symbol, limit = undefined, params = {}) {
|
|
157849
158229
|
/**
|
|
158230
|
+
* TODO: double check
|
|
157850
158231
|
* @method
|
|
157851
158232
|
* @name kuna#fetchL3OrderBook
|
|
157852
158233
|
* @description fetches level 3 information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
@@ -157862,136 +158243,115 @@ class kuna extends _abstract_kuna_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
157862
158243
|
* @method
|
|
157863
158244
|
* @name kuna#fetchTrades
|
|
157864
158245
|
* @description get the list of most recent trades for a particular symbol
|
|
158246
|
+
* @see https://docs.kuna.io/docs/get-public-trades-book
|
|
157865
158247
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
157866
158248
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
157867
|
-
* @param {int} [limit]
|
|
158249
|
+
* @param {int} [limit] between 1 and 100, 25 by default
|
|
157868
158250
|
* @param {object} [params] extra parameters specific to the kuna api endpoint
|
|
157869
158251
|
* @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#public-trades}
|
|
157870
158252
|
*/
|
|
157871
158253
|
await this.loadMarkets();
|
|
157872
158254
|
const market = this.market(symbol);
|
|
157873
158255
|
const request = {
|
|
157874
|
-
'
|
|
158256
|
+
'pair': market['id'],
|
|
157875
158257
|
};
|
|
157876
|
-
|
|
158258
|
+
if (limit !== undefined) {
|
|
158259
|
+
request['limit'] = limit;
|
|
158260
|
+
}
|
|
158261
|
+
const response = await this.v4PublicGetTradePublicBookPairs(this.extend(request, params));
|
|
157877
158262
|
//
|
|
157878
|
-
//
|
|
157879
|
-
//
|
|
157880
|
-
//
|
|
157881
|
-
//
|
|
157882
|
-
//
|
|
157883
|
-
//
|
|
157884
|
-
//
|
|
157885
|
-
//
|
|
157886
|
-
//
|
|
157887
|
-
//
|
|
157888
|
-
//
|
|
157889
|
-
// ]
|
|
158263
|
+
// {
|
|
158264
|
+
// "data": {
|
|
158265
|
+
// "id": "3e5591ba-2778-4d85-8851-54284045ea44", // Unique identifier of a trade
|
|
158266
|
+
// "pair": "BTC_USDT", // Market pair that is being traded
|
|
158267
|
+
// "quoteQuantity": "11528.8118", // Qty of the quote asset, USDT in this example
|
|
158268
|
+
// "matchPrice": "18649", // Exchange price at the moment of execution
|
|
158269
|
+
// "matchQuantity": "0.6182", // Qty of the base asset, BTC in this example
|
|
158270
|
+
// "createdAt": "2022-09-23T14:30:41.486Z", // Date-time of trade execution, UTC
|
|
158271
|
+
// "side": "Ask" // Trade type: `Ask` or `Bid`. Bid for buying base asset, Ask for selling base asset (e.g. for BTC_USDT trading pair, BTC is the base asset).
|
|
158272
|
+
// }
|
|
158273
|
+
// }
|
|
157890
158274
|
//
|
|
157891
|
-
|
|
158275
|
+
const data = this.safeValue(response, 'data', {});
|
|
158276
|
+
return this.parseTrades(data, market, since, limit);
|
|
157892
158277
|
}
|
|
157893
158278
|
parseTrade(trade, market = undefined) {
|
|
157894
158279
|
//
|
|
157895
158280
|
// fetchTrades (public)
|
|
157896
158281
|
//
|
|
157897
|
-
//
|
|
157898
|
-
//
|
|
157899
|
-
//
|
|
157900
|
-
//
|
|
157901
|
-
//
|
|
157902
|
-
//
|
|
157903
|
-
//
|
|
157904
|
-
//
|
|
157905
|
-
//
|
|
157906
|
-
// }
|
|
158282
|
+
// {
|
|
158283
|
+
// "id": "3e5591ba-2778-4d85-8851-54284045ea44", // Unique identifier of a trade
|
|
158284
|
+
// "pair": "BTC_USDT", // Market pair that is being traded
|
|
158285
|
+
// "quoteQuantity": "11528.8118", // Qty of the quote asset, USDT in this example
|
|
158286
|
+
// "matchPrice": "18649", // Exchange price at the moment of execution
|
|
158287
|
+
// "matchQuantity": "0.6182", // Qty of the base asset, BTC in this example
|
|
158288
|
+
// "createdAt": "2022-09-23T14:30:41.486Z", // Date-time of trade execution, UTC
|
|
158289
|
+
// "side": "Ask" // Trade type: `Ask` or `Bid`. Bid for buying base asset, Ask for selling base asset (e.g. for BTC_USDT trading pair, BTC is the base asset).
|
|
158290
|
+
// }
|
|
157907
158291
|
//
|
|
157908
|
-
// fetchMyTrades (private)
|
|
158292
|
+
// fetchMyTrades, fetchOrder (private)
|
|
157909
158293
|
//
|
|
157910
|
-
//
|
|
157911
|
-
//
|
|
157912
|
-
//
|
|
157913
|
-
//
|
|
157914
|
-
//
|
|
157915
|
-
//
|
|
157916
|
-
//
|
|
157917
|
-
//
|
|
157918
|
-
//
|
|
157919
|
-
//
|
|
157920
|
-
//
|
|
158294
|
+
// {
|
|
158295
|
+
// id: "edb17459-c9bf-4148-9ae6-7367d7f55d71", // Unique identifier of a trade
|
|
158296
|
+
// orderId: "a80bec3f-4ffa-45c1-9d78-f6301e9748fe", // Unique identifier of an order associated with the trade
|
|
158297
|
+
// pair: "BTC_USDT", // Traded pair, base asset first, followed by quoted asset
|
|
158298
|
+
// quantity: "1.5862", // Traded quantity of base asset
|
|
158299
|
+
// price: "19087", // Price of the trade
|
|
158300
|
+
// isTaker: true, // Various fees for Makers and Takers; "Market" orders are always `true`
|
|
158301
|
+
// fee: "0.0039655", // Exchange commission fee
|
|
158302
|
+
// feeCurrency: "BTC", // Currency of the commission
|
|
158303
|
+
// isBuyer: true, // Buy or sell the base asset
|
|
158304
|
+
// quoteQuantity: "30275.7994", // Quote asset quantity spent to fulfill the base amount
|
|
158305
|
+
// createdAt: "2022-09-29T13:43:53.824Z", // Date-time of trade execution, UTC
|
|
158306
|
+
// }
|
|
157921
158307
|
//
|
|
157922
|
-
const
|
|
157923
|
-
|
|
157924
|
-
|
|
157925
|
-
|
|
157926
|
-
|
|
157927
|
-
|
|
157928
|
-
|
|
157929
|
-
const sideMap = {
|
|
157930
|
-
'ask': 'sell',
|
|
157931
|
-
'bid': 'buy',
|
|
157932
|
-
};
|
|
157933
|
-
side = this.safeString(sideMap, side, side);
|
|
158308
|
+
const datetime = this.safeString(trade, 'createdAt');
|
|
158309
|
+
const marketId = this.safeString(trade, 'pair');
|
|
158310
|
+
const isTaker = this.safeValue(trade, 'isMaker');
|
|
158311
|
+
let side = this.safeStringLower(trade, 'side');
|
|
158312
|
+
if (side === undefined) {
|
|
158313
|
+
const isBuyer = this.safeValue(trade, 'isBuyer');
|
|
158314
|
+
side = isBuyer ? 'buy' : 'sell';
|
|
157934
158315
|
}
|
|
157935
|
-
const priceString = this.safeString(trade, 'price');
|
|
157936
|
-
const amountString = this.safeString(trade, 'volume');
|
|
157937
|
-
const costString = this.safeNumber(trade, 'funds');
|
|
157938
|
-
const orderId = this.safeString(trade, 'order_id');
|
|
157939
|
-
const id = this.safeString(trade, 'id');
|
|
157940
158316
|
return this.safeTrade({
|
|
157941
|
-
'id': id,
|
|
157942
158317
|
'info': trade,
|
|
157943
|
-
'
|
|
157944
|
-
'
|
|
157945
|
-
'
|
|
158318
|
+
'id': this.safeString(trade, 'id'),
|
|
158319
|
+
'symbol': this.safeSymbol(marketId, market),
|
|
158320
|
+
'timestamp': this.parse8601(datetime),
|
|
158321
|
+
'datetime': datetime,
|
|
157946
158322
|
'type': undefined,
|
|
157947
158323
|
'side': side,
|
|
157948
|
-
'order': orderId,
|
|
157949
|
-
'takerOrMaker':
|
|
157950
|
-
'price':
|
|
157951
|
-
'amount':
|
|
157952
|
-
'cost':
|
|
157953
|
-
'fee':
|
|
158324
|
+
'order': this.safeString(trade, 'orderId'),
|
|
158325
|
+
'takerOrMaker': isTaker ? 'taker' : 'maker',
|
|
158326
|
+
'price': this.safeString2(trade, 'matchPrice', 'price'),
|
|
158327
|
+
'amount': this.safeString2(trade, 'matchQuantity', 'quantity'),
|
|
158328
|
+
'cost': this.safeString(trade, 'quoteQuantity'),
|
|
158329
|
+
'fee': {
|
|
158330
|
+
'cost': this.safeString(trade, 'fee'),
|
|
158331
|
+
'currency': this.safeCurrencyCode(this.safeString(trade, 'feeCurrency')),
|
|
158332
|
+
'rate': undefined,
|
|
158333
|
+
},
|
|
157954
158334
|
}, market);
|
|
157955
158335
|
}
|
|
157956
|
-
async fetchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
|
|
157957
|
-
/**
|
|
157958
|
-
* @method
|
|
157959
|
-
* @name kuna#fetchOHLCV
|
|
157960
|
-
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
157961
|
-
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
157962
|
-
* @param {string} timeframe the length of time each candle represents
|
|
157963
|
-
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
157964
|
-
* @param {int} [limit] the maximum amount of candles to fetch
|
|
157965
|
-
* @param {object} [params] extra parameters specific to the kuna api endpoint
|
|
157966
|
-
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
157967
|
-
*/
|
|
157968
|
-
await this.loadMarkets();
|
|
157969
|
-
const trades = await this.fetchTrades(symbol, since, limit, params);
|
|
157970
|
-
const ohlcvc = this.buildOHLCVC(trades, timeframe, since, limit);
|
|
157971
|
-
const result = [];
|
|
157972
|
-
for (let i = 0; i < ohlcvc.length; i++) {
|
|
157973
|
-
const ohlcv = ohlcvc[i];
|
|
157974
|
-
result.push([
|
|
157975
|
-
ohlcv[0],
|
|
157976
|
-
ohlcv[1],
|
|
157977
|
-
ohlcv[2],
|
|
157978
|
-
ohlcv[3],
|
|
157979
|
-
ohlcv[4],
|
|
157980
|
-
ohlcv[5],
|
|
157981
|
-
]);
|
|
157982
|
-
}
|
|
157983
|
-
return result;
|
|
157984
|
-
}
|
|
157985
158336
|
parseBalance(response) {
|
|
157986
|
-
|
|
157987
|
-
|
|
157988
|
-
|
|
157989
|
-
|
|
158337
|
+
//
|
|
158338
|
+
// [
|
|
158339
|
+
// {
|
|
158340
|
+
// "currency": "UAH",
|
|
158341
|
+
// "balance": "7134.6",
|
|
158342
|
+
// "lockBalance": "100"
|
|
158343
|
+
// }
|
|
158344
|
+
// ...
|
|
158345
|
+
// ]
|
|
158346
|
+
//
|
|
158347
|
+
const result = { 'info': response };
|
|
158348
|
+
for (let i = 0; i < response.length; i++) {
|
|
158349
|
+
const balance = response[i];
|
|
157990
158350
|
const currencyId = this.safeString(balance, 'currency');
|
|
157991
158351
|
const code = this.safeCurrencyCode(currencyId);
|
|
157992
158352
|
const account = this.account();
|
|
157993
158353
|
account['free'] = this.safeString(balance, 'balance');
|
|
157994
|
-
account['used'] = this.safeString(balance, '
|
|
158354
|
+
account['used'] = this.safeString(balance, 'lockBalance');
|
|
157995
158355
|
result[code] = account;
|
|
157996
158356
|
}
|
|
157997
158357
|
return this.safeBalance(result);
|
|
@@ -158005,35 +158365,79 @@ class kuna extends _abstract_kuna_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
158005
158365
|
* @returns {object} a [balance structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#balance-structure}
|
|
158006
158366
|
*/
|
|
158007
158367
|
await this.loadMarkets();
|
|
158008
|
-
const response = await this.
|
|
158009
|
-
|
|
158368
|
+
const response = await this.v4PrivateGetPrivateGetBalance(params);
|
|
158369
|
+
//
|
|
158370
|
+
// {
|
|
158371
|
+
// "data": [{
|
|
158372
|
+
// "currency": "UAH", // Wallet currency
|
|
158373
|
+
// "balance": "7134.6", // Available balance, precision depends on the currency
|
|
158374
|
+
// "lockBalance": "100" // Minimum amount locked on the balance
|
|
158375
|
+
// }]
|
|
158376
|
+
// }
|
|
158377
|
+
//
|
|
158378
|
+
const data = this.safeValue(response, 'data', []);
|
|
158379
|
+
return this.parseBalance(data);
|
|
158010
158380
|
}
|
|
158011
158381
|
async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
|
|
158012
158382
|
/**
|
|
158013
158383
|
* @method
|
|
158014
158384
|
* @name kuna#createOrder
|
|
158015
158385
|
* @description create a trade order
|
|
158386
|
+
* @see https://docs.kuna.io/docs/create-a-new-order-private
|
|
158016
158387
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
158017
158388
|
* @param {string} type 'market' or 'limit'
|
|
158018
158389
|
* @param {string} side 'buy' or 'sell'
|
|
158019
158390
|
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
158020
158391
|
* @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
158021
158392
|
* @param {object} [params] extra parameters specific to the kuna api endpoint
|
|
158393
|
+
* @param {float} [params.triggerPrice] the price at which a trigger order is triggered at
|
|
158394
|
+
*
|
|
158395
|
+
* EXCHANGE SPECIFIC PARAMETERS
|
|
158396
|
+
* @param {string} [params.id] id must be a UUID format, if you do not specify id, it will be generated automatically.
|
|
158397
|
+
* @param {float} [params.quoteQuantity] the max quantity of the quote asset to use for selling/buying
|
|
158022
158398
|
* @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
158023
158399
|
*/
|
|
158024
158400
|
await this.loadMarkets();
|
|
158025
158401
|
const market = this.market(symbol);
|
|
158402
|
+
const triggerPrice = this.safeString2(params, 'triggerPrice', 'stopPrice');
|
|
158403
|
+
params = this.omit(params, ['triggerPrice', 'stopPrice']);
|
|
158404
|
+
const capitalizedType = this.capitalize(type);
|
|
158026
158405
|
const request = {
|
|
158027
|
-
'
|
|
158028
|
-
'side':
|
|
158029
|
-
'
|
|
158030
|
-
'
|
|
158406
|
+
'pair': market['id'],
|
|
158407
|
+
'orderSide': (side === 'buy') ? 'Bid' : 'Ask',
|
|
158408
|
+
'quantity': amount.toString(),
|
|
158409
|
+
'type': capitalizedType,
|
|
158031
158410
|
};
|
|
158032
|
-
if (
|
|
158033
|
-
request['price'] =
|
|
158411
|
+
if (capitalizedType === 'Limit') {
|
|
158412
|
+
request['price'] = this.priceToPrecision(market['symbol'], price);
|
|
158034
158413
|
}
|
|
158035
|
-
|
|
158036
|
-
|
|
158414
|
+
if (triggerPrice !== undefined) {
|
|
158415
|
+
if (capitalizedType === 'Market') {
|
|
158416
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest(this.id + ' createOrder () cannot place trigger market orders, or trigger limit');
|
|
158417
|
+
}
|
|
158418
|
+
request['stopPrice'] = this.priceToPrecision(market['symbol'], triggerPrice);
|
|
158419
|
+
if (capitalizedType !== 'TakeProfitLimit') {
|
|
158420
|
+
request['type'] = 'StopLossLimit';
|
|
158421
|
+
}
|
|
158422
|
+
}
|
|
158423
|
+
const response = await this.v4PrivatePostOrderPrivateCreate(this.extend(request, params));
|
|
158424
|
+
//
|
|
158425
|
+
// {
|
|
158426
|
+
// "data": {
|
|
158427
|
+
// "id": "b0fcb54c-2278-4f16-a300-02765faad8b0", // ID of your newly created order
|
|
158428
|
+
// "type": "Limit", // Type of an order
|
|
158429
|
+
// "quantity": "0.06", // Original order quantity
|
|
158430
|
+
// "executedQuantity": "0", // Traded quantity in stock (>0 if traded)
|
|
158431
|
+
// "pair": "BTC_USDT", // Traded pair
|
|
158432
|
+
// "price": "26440.46", // Price of the trade
|
|
158433
|
+
// "status": "Open", // The status of the order
|
|
158434
|
+
// "createdAt": "2023-07-11T08:01:30.550Z", // Date-time of order creation, UTC
|
|
158435
|
+
// "updatedAt": "2023-07-11T08:01:30.550Z" // Date-time of the last update of the order, UTC
|
|
158436
|
+
// }
|
|
158437
|
+
// }
|
|
158438
|
+
//
|
|
158439
|
+
const data = this.safeValue(response, 'data', {});
|
|
158440
|
+
return this.parseOrder(data, market);
|
|
158037
158441
|
}
|
|
158038
158442
|
async cancelOrder(id, symbol = undefined, params = {}) {
|
|
158039
158443
|
/**
|
|
@@ -158041,24 +158445,66 @@ class kuna extends _abstract_kuna_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
158041
158445
|
* @name kuna#cancelOrder
|
|
158042
158446
|
* @description cancels an open order
|
|
158043
158447
|
* @param {string} id order id
|
|
158044
|
-
* @param {string} symbol
|
|
158448
|
+
* @param {string} symbol unified market symbol
|
|
158045
158449
|
* @param {object} [params] extra parameters specific to the kuna api endpoint
|
|
158046
158450
|
* @returns {object} An [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
158047
158451
|
*/
|
|
158048
158452
|
await this.loadMarkets();
|
|
158049
158453
|
const request = {
|
|
158050
|
-
'
|
|
158454
|
+
'orderId': id,
|
|
158051
158455
|
};
|
|
158052
|
-
const response = await this.
|
|
158053
|
-
|
|
158054
|
-
|
|
158055
|
-
|
|
158056
|
-
|
|
158456
|
+
const response = await this.v4PrivatePostOrderPrivateCancel(this.extend(request, params));
|
|
158457
|
+
//
|
|
158458
|
+
// {
|
|
158459
|
+
// "data": {
|
|
158460
|
+
// "success": true
|
|
158461
|
+
// }
|
|
158462
|
+
// }
|
|
158463
|
+
//
|
|
158464
|
+
const data = this.safeValue(response, 'data', {});
|
|
158465
|
+
let market = undefined;
|
|
158466
|
+
if (symbol !== undefined) {
|
|
158467
|
+
market = this.market(symbol);
|
|
158057
158468
|
}
|
|
158469
|
+
const order = this.parseOrder(data, market);
|
|
158470
|
+
order['id'] = id;
|
|
158058
158471
|
return order;
|
|
158059
158472
|
}
|
|
158473
|
+
async cancelOrders(ids, symbol = undefined, params = {}) {
|
|
158474
|
+
/**
|
|
158475
|
+
* @method
|
|
158476
|
+
* @name kuna#cancelOrder
|
|
158477
|
+
* @description cancels an open order
|
|
158478
|
+
* @param {string} ids order ids
|
|
158479
|
+
* @param {string} symbol not used by kuna cancelOrder
|
|
158480
|
+
* @param {object} [params] extra parameters specific to the kuna api endpoint
|
|
158481
|
+
* @returns {object} An [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
158482
|
+
*/
|
|
158483
|
+
await this.loadMarkets();
|
|
158484
|
+
const request = {
|
|
158485
|
+
'orderIds': ids,
|
|
158486
|
+
};
|
|
158487
|
+
const response = await this.v4PrivatePostOrderPrivateCancelMulti(this.extend(request, params));
|
|
158488
|
+
//
|
|
158489
|
+
// {
|
|
158490
|
+
// "data": [
|
|
158491
|
+
// {
|
|
158492
|
+
// "id": "c7fc5b2b-bd9d-48c1-a458-a83412669fe2", // Unique identifier of a canceled order
|
|
158493
|
+
// "success": true // Status for this order
|
|
158494
|
+
// },
|
|
158495
|
+
// ...
|
|
158496
|
+
// ]
|
|
158497
|
+
// }
|
|
158498
|
+
//
|
|
158499
|
+
const data = this.safeValue(response, 'data', []);
|
|
158500
|
+
return this.parseOrders(data);
|
|
158501
|
+
}
|
|
158060
158502
|
parseOrderStatus(status) {
|
|
158061
158503
|
const statuses = {
|
|
158504
|
+
'Canceled': 'canceled',
|
|
158505
|
+
'Closed': 'filled',
|
|
158506
|
+
'Pending': 'open',
|
|
158507
|
+
'Open': 'open',
|
|
158062
158508
|
'done': 'closed',
|
|
158063
158509
|
'wait': 'open',
|
|
158064
158510
|
'cancel': 'canceled',
|
|
@@ -158066,36 +158512,81 @@ class kuna extends _abstract_kuna_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
158066
158512
|
return this.safeString(statuses, status, status);
|
|
158067
158513
|
}
|
|
158068
158514
|
parseOrder(order, market = undefined) {
|
|
158069
|
-
|
|
158070
|
-
|
|
158071
|
-
|
|
158072
|
-
|
|
158073
|
-
|
|
158074
|
-
|
|
158075
|
-
|
|
158515
|
+
//
|
|
158516
|
+
// createOrder, fetchOrder, fetchOpenOrders, fetchOrdersByStatus
|
|
158517
|
+
//
|
|
158518
|
+
// {
|
|
158519
|
+
// "id": "5992a049-8612-409d-8599-2c3d7298b106", // Unique identifier of an order
|
|
158520
|
+
// "type": "Limit", // Type of an order
|
|
158521
|
+
// "quantity": "5", // Original order quantity
|
|
158522
|
+
// "executedQuantity": "0", // Traded quantity in stock (>0 if traded)
|
|
158523
|
+
// "cumulativeQuoteQty": "0", // *absent on createOrder* Traded quantity in money (>0 if traded)
|
|
158524
|
+
// "cost": "0.05", // Total amount
|
|
158525
|
+
// "side": "Bid", // *absent on createOrder* Bid for buying base asset, Ask for selling base asset. FYI: For BTC_USDT trading pair, BTC is the base asset
|
|
158526
|
+
// "pair": "TRX_USDT", // Traded pair
|
|
158527
|
+
// "price": "0.01", // Price of the trade
|
|
158528
|
+
// "status": "Open", // The status of the order
|
|
158529
|
+
// "createdAt": "2023-07-11T07:04:20.131Z", // Date-time of order creation, UTC
|
|
158530
|
+
// "updatedAt": "2023-07-11T07:04:20.131Z" // Date-time of the last update of the order, UTC
|
|
158531
|
+
// "closedAt": "2023-05-08T08:53:58.333Z" // *absent on fetchOpenOrders/createOrder* Date-time of order finish time, UTC
|
|
158532
|
+
// "trades": [ // * fetchOrder only *
|
|
158533
|
+
// {
|
|
158534
|
+
// "id": "15ff497c-8d25-4155-8184-bb1f905cce1e", // Unique identifier of a trade
|
|
158535
|
+
// "orderId": "4b9b9705-e85f-4180-bdec-219fbf025fa3", // Unique identifier of an associated order
|
|
158536
|
+
// "pair": "BTC_USDT", // Traded pair
|
|
158537
|
+
// "quantity": "0.00054", // Traded quantity
|
|
158538
|
+
// "price": "27770", // Traded price
|
|
158539
|
+
// "isTaker": false, // Various fees for Makers and Takers; "Market" orders are always `true`
|
|
158540
|
+
// "fee": "0.000001350", // Exchange commission fee
|
|
158541
|
+
// "feeCurrency": "BTC", // Currency of the commission
|
|
158542
|
+
// "isBuyer": true, // Buy or sell the base asset
|
|
158543
|
+
// "quoteQuantity": "14.9958", // Quote asset quantity
|
|
158544
|
+
// "createdAt": "2023-05-08T08:53:58.332Z" // Date-time of trade execution, UTC
|
|
158545
|
+
// }
|
|
158546
|
+
// ]
|
|
158547
|
+
// }
|
|
158548
|
+
//
|
|
158549
|
+
// cancelOrder, cancelOrders
|
|
158550
|
+
//
|
|
158551
|
+
// {
|
|
158552
|
+
// "id": "c7fc5b2b-bd9d-48c1-a458-a83412669fe2", // Unique identifier of a canceled order *absent on cancelOrder*
|
|
158553
|
+
// "success": true // Status for this order
|
|
158554
|
+
// }
|
|
158555
|
+
//
|
|
158556
|
+
const marketId = this.safeString(order, 'pair');
|
|
158557
|
+
const datetime = this.safeString(order, 'createdAt');
|
|
158558
|
+
const triggerPrice = this.safeString(order, 'stopPrice');
|
|
158559
|
+
let side = this.safeString(order, 'side');
|
|
158560
|
+
if (side === 'Bid') {
|
|
158561
|
+
side = 'buy';
|
|
158562
|
+
}
|
|
158563
|
+
else if (side === 'Ask') {
|
|
158564
|
+
side = 'sell';
|
|
158565
|
+
}
|
|
158566
|
+
const trades = this.safeValue(order, 'trades', []);
|
|
158076
158567
|
return this.safeOrder({
|
|
158077
|
-
'
|
|
158568
|
+
'info': order,
|
|
158569
|
+
'id': this.safeString2(order, 'id', 'orderId'),
|
|
158078
158570
|
'clientOrderId': undefined,
|
|
158079
|
-
'
|
|
158080
|
-
'
|
|
158081
|
-
'
|
|
158082
|
-
'
|
|
158083
|
-
'
|
|
158084
|
-
'type': type,
|
|
158571
|
+
'symbol': this.safeSymbol(marketId, market),
|
|
158572
|
+
'timestamp': this.parse8601(datetime),
|
|
158573
|
+
'datetime': datetime,
|
|
158574
|
+
'lastTradeTimestamp': this.parse8601(this.safeString(order, 'updatedAt')),
|
|
158575
|
+
'status': this.parseOrderStatus(this.safeString(order, 'status')),
|
|
158576
|
+
'type': this.safeStringLower(order, 'type'),
|
|
158085
158577
|
'timeInForce': undefined,
|
|
158086
158578
|
'postOnly': undefined,
|
|
158087
158579
|
'side': side,
|
|
158088
158580
|
'price': this.safeString(order, 'price'),
|
|
158089
|
-
'stopPrice':
|
|
158090
|
-
'triggerPrice':
|
|
158091
|
-
'amount': this.safeString(order, '
|
|
158092
|
-
'filled': this.safeString(order, '
|
|
158093
|
-
'remaining':
|
|
158094
|
-
'trades':
|
|
158095
|
-
'
|
|
158096
|
-
'info': order,
|
|
158097
|
-
'cost': undefined,
|
|
158581
|
+
'stopPrice': triggerPrice,
|
|
158582
|
+
'triggerPrice': triggerPrice,
|
|
158583
|
+
'amount': this.safeString(order, 'quantity'),
|
|
158584
|
+
'filled': this.safeString(order, 'executedQuantity'),
|
|
158585
|
+
'remaining': undefined,
|
|
158586
|
+
'trades': this.parseTrades(trades),
|
|
158587
|
+
'cost': this.safeString(order, 'cost'),
|
|
158098
158588
|
'average': undefined,
|
|
158589
|
+
'fee': undefined,
|
|
158099
158590
|
}, market);
|
|
158100
158591
|
}
|
|
158101
158592
|
async fetchOrder(id, symbol = undefined, params = {}) {
|
|
@@ -158103,78 +158594,656 @@ class kuna extends _abstract_kuna_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
158103
158594
|
* @method
|
|
158104
158595
|
* @name kuna#fetchOrder
|
|
158105
158596
|
* @description fetches information on an order made by the user
|
|
158597
|
+
* @see https://docs.kuna.io/docs/get-order-details-by-id
|
|
158106
158598
|
* @param {string} symbol not used by kuna fetchOrder
|
|
158107
158599
|
* @param {object} [params] extra parameters specific to the kuna api endpoint
|
|
158600
|
+
*
|
|
158601
|
+
* EXCHANGE SPECIFIC PARAMETERS
|
|
158602
|
+
* @param {boolean} [params.withTrades] default == true, specify if the response should include trades associated with the order
|
|
158108
158603
|
* @returns {object} An [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
158109
158604
|
*/
|
|
158110
158605
|
await this.loadMarkets();
|
|
158111
158606
|
const request = {
|
|
158112
|
-
'id':
|
|
158607
|
+
'id': id,
|
|
158608
|
+
'withTrades': true,
|
|
158113
158609
|
};
|
|
158114
|
-
const response = await this.
|
|
158115
|
-
|
|
158610
|
+
const response = await this.v4PrivateGetOrderPrivateDetailsId(this.extend(request, params));
|
|
158611
|
+
//
|
|
158612
|
+
// {
|
|
158613
|
+
// "data": {
|
|
158614
|
+
// "id": "4b9b9705-e85f-4180-bdec-219fbf025fa3",
|
|
158615
|
+
// "type": "Limit",
|
|
158616
|
+
// "quantity": "0.00054",
|
|
158617
|
+
// "executedQuantity": "0.00054",
|
|
158618
|
+
// "cumulativeQuoteQty": "14.99580",
|
|
158619
|
+
// "cost": "14.9958",
|
|
158620
|
+
// "side": "Bid",
|
|
158621
|
+
// "pair": "BTC_USDT",
|
|
158622
|
+
// "price": "27770",
|
|
158623
|
+
// "status": "Closed",
|
|
158624
|
+
// "createdAt": "2023-05-08T08:39:46.708Z",
|
|
158625
|
+
// "updatedAt": "2023-05-08T08:53:58.332Z",
|
|
158626
|
+
// "closedAt": "2023-05-08T08:53:58.333Z",
|
|
158627
|
+
// "trades": [
|
|
158628
|
+
// {
|
|
158629
|
+
// "id": "15ff497c-8d25-4155-8184-bb1f905cce1e", // Unique identifier of a trade
|
|
158630
|
+
// "orderId": "4b9b9705-e85f-4180-bdec-219fbf025fa3", // Unique identifier of an associated order
|
|
158631
|
+
// "pair": "BTC_USDT", // Traded pair
|
|
158632
|
+
// "quantity": "0.00054", // Traded quantity
|
|
158633
|
+
// "price": "27770", // Traded price
|
|
158634
|
+
// "isTaker": false, // Various fees for Makers and Takers; "Market" orders are always `true`
|
|
158635
|
+
// "fee": "0.000001350", // Exchange commission fee
|
|
158636
|
+
// "feeCurrency": "BTC", // Currency of the commission
|
|
158637
|
+
// "isBuyer": true, // Buy or sell the base asset
|
|
158638
|
+
// "quoteQuantity": "14.9958", // Quote asset quantity
|
|
158639
|
+
// "createdAt": "2023-05-08T08:53:58.332Z" // Date-time of trade execution, UTC
|
|
158640
|
+
// }
|
|
158641
|
+
// ]
|
|
158642
|
+
// }
|
|
158643
|
+
// }
|
|
158644
|
+
//
|
|
158645
|
+
const data = this.safeValue(response, 'data', {});
|
|
158646
|
+
return this.parseOrder(data);
|
|
158116
158647
|
}
|
|
158117
158648
|
async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
158118
158649
|
/**
|
|
158119
158650
|
* @method
|
|
158120
158651
|
* @name kuna#fetchOpenOrders
|
|
158121
158652
|
* @description fetch all unfilled currently open orders
|
|
158653
|
+
* @see https://docs.kuna.io/docs/get-active-client-orders-private
|
|
158122
158654
|
* @param {string} symbol unified market symbol
|
|
158123
158655
|
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
158124
|
-
* @param {int} [limit] the maximum number of
|
|
158656
|
+
* @param {int} [limit] 1-100, the maximum number of open orders structures to retrieve
|
|
158125
158657
|
* @param {object} [params] extra parameters specific to the kuna api endpoint
|
|
158658
|
+
* @param {int} [params.until] the latest timestamp (ms) to fetch orders for
|
|
158659
|
+
*
|
|
158660
|
+
* EXCHANGE SPECIFIC PARAMETERS
|
|
158661
|
+
* @param {string} [params.sort] asc (oldest-on-top) or desc (newest-on-top)
|
|
158126
158662
|
* @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
158127
158663
|
*/
|
|
158128
|
-
|
|
158129
|
-
|
|
158664
|
+
await this.loadMarkets();
|
|
158665
|
+
const until = this.safeInteger(params, 'until');
|
|
158666
|
+
params = this.omit(params, ['until']);
|
|
158667
|
+
let market = undefined;
|
|
158668
|
+
const request = {};
|
|
158669
|
+
if (symbol !== undefined) {
|
|
158670
|
+
market = this.market(symbol);
|
|
158671
|
+
request['pairs'] = market['id'];
|
|
158672
|
+
}
|
|
158673
|
+
if (since !== undefined) {
|
|
158674
|
+
request['start'] = this.iso8601(since);
|
|
158675
|
+
}
|
|
158676
|
+
if (limit !== undefined) {
|
|
158677
|
+
request['limit'] = limit;
|
|
158678
|
+
}
|
|
158679
|
+
if (until !== undefined) {
|
|
158680
|
+
request['end'] = this.iso8601(until);
|
|
158130
158681
|
}
|
|
158682
|
+
const response = await this.v4PrivateGetOrderPrivateActive(this.extend(request, params));
|
|
158683
|
+
//
|
|
158684
|
+
// {
|
|
158685
|
+
// "data": [
|
|
158686
|
+
// {
|
|
158687
|
+
// "id": "5992a049-8612-409d-8599-2c3d7298b106", // Unique identifier of an order
|
|
158688
|
+
// "type": "Limit", // Type of an order
|
|
158689
|
+
// "quantity": "5", // Original order quantity
|
|
158690
|
+
// "executedQuantity": "0", // Traded quantity in stock (>0 if traded)
|
|
158691
|
+
// "cumulativeQuoteQty": "0", // Traded quantity in money (>0 if traded)
|
|
158692
|
+
// "cost": "0.05", // Total amount
|
|
158693
|
+
// "side": "Bid", // Bid for buying base asset, Ask for selling base asset. FYI: For BTC_USDT trading pair, BTC is the base asset
|
|
158694
|
+
// "pair": "TRX_USDT", // Traded pair
|
|
158695
|
+
// "price": "0.01", // Price of the trade
|
|
158696
|
+
// "status": "Open", // The status of the order
|
|
158697
|
+
// "createdAt": "2023-07-11T07:04:20.131Z", // Date-time of order creation, UTC
|
|
158698
|
+
// "updatedAt": "2023-07-11T07:04:20.131Z" // Date-time of the last update of the order, UTC
|
|
158699
|
+
// }
|
|
158700
|
+
// ...
|
|
158701
|
+
// ]
|
|
158702
|
+
// }
|
|
158703
|
+
//
|
|
158704
|
+
const data = this.safeValue(response, 'data', []);
|
|
158705
|
+
return this.parseOrders(data, market, since, limit);
|
|
158706
|
+
}
|
|
158707
|
+
async fetchClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
158708
|
+
/**
|
|
158709
|
+
* @method
|
|
158710
|
+
* @name kuna#fetchClosedOrders
|
|
158711
|
+
* @description fetches information on multiple closed orders made by the user
|
|
158712
|
+
* @see https://docs.kuna.io/docs/get-private-orders-history
|
|
158713
|
+
* @param {string} symbol unified market symbol of the market orders were made in
|
|
158714
|
+
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
158715
|
+
* @param {int} [limit] the maximum number of orde structures to retrieve
|
|
158716
|
+
* @param {object} [params] extra parameters specific to the kuna api endpoint
|
|
158717
|
+
* @param {int} [params.until] the latest time in ms to fetch orders for
|
|
158718
|
+
*
|
|
158719
|
+
* EXCHANGE SPECIFIC PARAMETERS
|
|
158720
|
+
* @param {string} [params.sort] asc (oldest-on-top) or desc (newest-on-top)
|
|
158721
|
+
* @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
158722
|
+
*/
|
|
158723
|
+
return await this.fetchOrdersByStatus('closed', symbol, since, limit, params);
|
|
158724
|
+
}
|
|
158725
|
+
async fetchOrdersByStatus(status, symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
158726
|
+
/**
|
|
158727
|
+
* @method
|
|
158728
|
+
* @name kuna#fetchOrdersByStatus
|
|
158729
|
+
* @description fetch a list of orders
|
|
158730
|
+
* @see https://docs.kuna.io/docs/get-private-orders-history
|
|
158731
|
+
* @param {string} status canceled, closed, expired, open, pending, rejected, or waitStop
|
|
158732
|
+
* @param {string} symbol unified market symbol of the market orders were made in
|
|
158733
|
+
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
158734
|
+
* @param {int} [limit] 1-100, the maximum number of open orders structures to retrieve
|
|
158735
|
+
* @param {object} [params] extra parameters specific to the kuna api endpoint
|
|
158736
|
+
* @param {int} [params.until] the latest timestamp (ms) to fetch orders for
|
|
158737
|
+
*
|
|
158738
|
+
* EXCHANGE SPECIFIC PARAMETERS
|
|
158739
|
+
* @param {string} [params.sort] asc (oldest-on-top) or desc (newest-on-top)
|
|
158740
|
+
* @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
158741
|
+
*/
|
|
158131
158742
|
await this.loadMarkets();
|
|
158132
|
-
|
|
158743
|
+
if (status === 'open') {
|
|
158744
|
+
return this.fetchOpenOrders(symbol, since, limit, params);
|
|
158745
|
+
}
|
|
158746
|
+
const until = this.safeInteger(params, 'until');
|
|
158747
|
+
params = this.omit(params, ['until']);
|
|
158748
|
+
let market = undefined;
|
|
158133
158749
|
const request = {
|
|
158134
|
-
'
|
|
158750
|
+
'status': this.capitalize(status),
|
|
158135
158751
|
};
|
|
158136
|
-
|
|
158137
|
-
|
|
158138
|
-
|
|
158139
|
-
|
|
158140
|
-
|
|
158752
|
+
if (symbol !== undefined) {
|
|
158753
|
+
market = this.market(symbol);
|
|
158754
|
+
request['pairs'] = market['id'];
|
|
158755
|
+
}
|
|
158756
|
+
if (since !== undefined) {
|
|
158757
|
+
request['start'] = this.iso8601(since);
|
|
158758
|
+
}
|
|
158759
|
+
if (limit !== undefined) {
|
|
158760
|
+
request['limit'] = limit;
|
|
158761
|
+
}
|
|
158762
|
+
if (until !== undefined) {
|
|
158763
|
+
request['end'] = this.iso8601(until);
|
|
158764
|
+
}
|
|
158765
|
+
const response = await this.v4PrivateGetOrderPrivateHistory(request);
|
|
158766
|
+
//
|
|
158767
|
+
// {
|
|
158768
|
+
// "data": [
|
|
158769
|
+
// {
|
|
158770
|
+
// "id": "4b9b9705-e85f-4180-bdec-219fbf025fa3", // Unique identifier of an order
|
|
158771
|
+
// "type": "Limit", // Type of an order
|
|
158772
|
+
// "quantity": "0.00054", // Original order quantity
|
|
158773
|
+
// "executedQuantity": "0.00054", // Traded quantity in stock (>0 if traded)
|
|
158774
|
+
// "cumulativeQuoteQty": "14.99580", // Traded quantity in money (>0 if traded)
|
|
158775
|
+
// "cost": "14.9958", // Total amount
|
|
158776
|
+
// "side": "Bid", // Bid for buying base asset, Ask for selling base asset. FYI: For BTC_USDT trading pair, BTC is the base asset
|
|
158777
|
+
// "pair": "BTC_USDT", // Traded pair
|
|
158778
|
+
// "price": "27770", // Price of the trade
|
|
158779
|
+
// "status": "Closed", // The status of the order
|
|
158780
|
+
// "createdAt": "2023-05-08T08:39:46.708Z", // Date-time of order creation, UTC
|
|
158781
|
+
// "updatedAt": "2023-05-08T08:53:58.332Z", // Date-time of the last update of the order, UTC
|
|
158782
|
+
// "closedAt": "2023-05-08T08:53:58.333Z" // Date-time of order finish time, UTC
|
|
158783
|
+
// },
|
|
158784
|
+
// ...
|
|
158785
|
+
// ]
|
|
158786
|
+
// }
|
|
158787
|
+
//
|
|
158788
|
+
const data = this.safeValue(response, 'data', []);
|
|
158789
|
+
return this.parseOrders(data, market, since, limit);
|
|
158141
158790
|
}
|
|
158142
158791
|
async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
158143
158792
|
/**
|
|
158144
158793
|
* @method
|
|
158145
158794
|
* @name kuna#fetchMyTrades
|
|
158146
158795
|
* @description fetch all trades made by the user
|
|
158796
|
+
* @see https://docs.kuna.io/docs/get-private-trades-history
|
|
158147
158797
|
* @param {string} symbol unified market symbol
|
|
158148
|
-
* @param {int} [since]
|
|
158149
|
-
* @param {int} [limit]
|
|
158798
|
+
* @param {int} [since] not used by kuna fetchMyTrades
|
|
158799
|
+
* @param {int} [limit] not used by kuna fetchMyTrades
|
|
158150
158800
|
* @param {object} [params] extra parameters specific to the kuna api endpoint
|
|
158801
|
+
*
|
|
158802
|
+
* EXCHANGE SPECIFIC PARAMETERS
|
|
158803
|
+
* @param {string} [params.orderId] UUID of an order, to receive trades for this order only
|
|
158804
|
+
* @param {string} [params.sort] asc (oldest-on-top) or desc (newest-on-top)
|
|
158151
158805
|
* @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
|
|
158152
158806
|
*/
|
|
158153
|
-
|
|
158154
|
-
|
|
158807
|
+
await this.loadMarkets();
|
|
158808
|
+
let market = undefined;
|
|
158809
|
+
const request = {};
|
|
158810
|
+
if (symbol !== undefined) {
|
|
158811
|
+
market = this.market(symbol);
|
|
158812
|
+
request['pair'] = market['id'];
|
|
158155
158813
|
}
|
|
158814
|
+
const response = await this.v4PrivateGetTradePrivateHistory(this.extend(request, params));
|
|
158815
|
+
//
|
|
158816
|
+
// {
|
|
158817
|
+
// "data": [
|
|
158818
|
+
// {
|
|
158819
|
+
// id: "edb17459-c9bf-4148-9ae6-7367d7f55d71", // Unique identifier of a trade
|
|
158820
|
+
// orderId: "a80bec3f-4ffa-45c1-9d78-f6301e9748fe", // Unique identifier of an order associated with the trade
|
|
158821
|
+
// pair: "BTC_USDT", // Traded pair, base asset first, followed by quoted asset
|
|
158822
|
+
// quantity: "1.5862", // Traded quantity of base asset
|
|
158823
|
+
// price: "19087", // Price of the trade
|
|
158824
|
+
// isTaker: true, // Various fees for Makers and Takers; "Market" orders are always `true`
|
|
158825
|
+
// fee: "0.0039655", // Exchange commission fee
|
|
158826
|
+
// feeCurrency: "BTC", // Currency of the commission
|
|
158827
|
+
// isBuyer: true, // Buy or sell the base asset
|
|
158828
|
+
// quoteQuantity: "30275.7994", // Quote asset quantity spent to fulfill the base amount
|
|
158829
|
+
// createdAt: "2022-09-29T13:43:53.824Z", // Date-time of trade execution, UTC
|
|
158830
|
+
// },
|
|
158831
|
+
// ]
|
|
158832
|
+
// }
|
|
158833
|
+
//
|
|
158834
|
+
const data = this.safeValue(response, 'data');
|
|
158835
|
+
return this.parseTrades(data, market, since, limit);
|
|
158836
|
+
}
|
|
158837
|
+
async withdraw(code, amount, address, tag = undefined, params = {}) {
|
|
158838
|
+
/**
|
|
158839
|
+
* @method
|
|
158840
|
+
* @name kuna#withdraw
|
|
158841
|
+
* @description make a withdrawal
|
|
158842
|
+
* @see https://docs.kuna.io/docs/create-a-withdraw
|
|
158843
|
+
* @param {string} code unified currency code
|
|
158844
|
+
* @param {float} amount the amount to withdraw
|
|
158845
|
+
* @param {string} address the address to withdraw to
|
|
158846
|
+
* @param {string} tag
|
|
158847
|
+
* @param {object} [params] extra parameters specific to the kuna api endpoint
|
|
158848
|
+
* @param {string} [params.chain] the chain to withdraw to
|
|
158849
|
+
*
|
|
158850
|
+
* EXCHANGE SPECIFIC PARAMETERS
|
|
158851
|
+
* @param {string} [params.id] id must be a uuid format, if you do not specify id, it will be generated automatically
|
|
158852
|
+
* @param {boolean} [params.withdrawAll] this field says that the amount should also include a fee
|
|
158853
|
+
* @returns {object} a [transaction structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#transaction-structure}
|
|
158854
|
+
*/
|
|
158855
|
+
this.checkAddress(address);
|
|
158856
|
+
let chain = this.safeString2(params, 'chain', 'network');
|
|
158857
|
+
params = this.omit(params, ['chain', 'network']);
|
|
158156
158858
|
await this.loadMarkets();
|
|
158157
|
-
const
|
|
158859
|
+
const currency = this.currency(code);
|
|
158860
|
+
if (chain === undefined) {
|
|
158861
|
+
if (currency['code'].indexOf('USD') > 0) {
|
|
158862
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' withdraw () requires an extra parameter params["network"] to withdraw ' + currency['code']);
|
|
158863
|
+
}
|
|
158864
|
+
else {
|
|
158865
|
+
chain = currency['id'].toUpperCase();
|
|
158866
|
+
}
|
|
158867
|
+
}
|
|
158868
|
+
const networkId = this.networkCodeToId(chain);
|
|
158158
158869
|
const request = {
|
|
158159
|
-
'
|
|
158870
|
+
'currency': networkId,
|
|
158871
|
+
'amount': amount,
|
|
158872
|
+
'address': address,
|
|
158873
|
+
'paymentMethod': chain, // TODO: double check, Withdraw method for currency, should be taken from "Get info about withdrawal methods by currency name" endpoint (key field).
|
|
158160
158874
|
};
|
|
158161
|
-
|
|
158875
|
+
if (tag !== undefined) {
|
|
158876
|
+
request['paymentId'] = tag;
|
|
158877
|
+
}
|
|
158878
|
+
const response = await this.v4PrivatePostWithdrawPrivateCreate(this.extend(request, params));
|
|
158162
158879
|
//
|
|
158163
|
-
//
|
|
158164
|
-
//
|
|
158165
|
-
//
|
|
158166
|
-
//
|
|
158167
|
-
//
|
|
158168
|
-
//
|
|
158169
|
-
// "market":"dogeusdt",
|
|
158170
|
-
// "created_at":"2022-04-12T18:58:44Z",
|
|
158171
|
-
// "side":"ask",
|
|
158172
|
-
// "order_id":1665670371,
|
|
158173
|
-
// "trend":"buy"
|
|
158174
|
-
// },
|
|
158175
|
-
// ]
|
|
158880
|
+
// {
|
|
158881
|
+
// "data": {
|
|
158882
|
+
// "id": "edb17459-c9bf-4148-9ae6-7367d7f55d71", // unique identifier of a withdraw
|
|
158883
|
+
// "status": "waitingForConfirmation" // status of a withdraw, if you turn off withdrawal confirmation by email, it will return "processing" status, which means that the transaction is already being processed on our side
|
|
158884
|
+
// }
|
|
158885
|
+
// }
|
|
158176
158886
|
//
|
|
158177
|
-
|
|
158887
|
+
const data = this.safeValue(response, 'data', {});
|
|
158888
|
+
return this.parseTransaction(data, currency);
|
|
158889
|
+
}
|
|
158890
|
+
async fetchWithdrawals(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
158891
|
+
/**
|
|
158892
|
+
* @method
|
|
158893
|
+
* @name kuna#fetchWithdrawals
|
|
158894
|
+
* @description fetch all withdrawals made to an account
|
|
158895
|
+
* @see https://docs.kuna.io/docs/get-withdraw-history
|
|
158896
|
+
* @param {string} code unified currency code
|
|
158897
|
+
* @param {int} [since] the earliest time in ms to fetch withdrawals for
|
|
158898
|
+
* @param {int} [limit] the maximum number of withdrawals structures to retrieve
|
|
158899
|
+
* @param {object} [params] extra parameters specific to the kuna api endpoint
|
|
158900
|
+
* @param {int} [params.until] the latest time in ms to fetch deposits for
|
|
158901
|
+
*
|
|
158902
|
+
* EXCHANGE SPECIFIC PARAMETERS
|
|
158903
|
+
* @param {string} [params.status] Created, Canceled, PartiallyProcessed, Processing, Processed, WaitForConfirmation, Pending, AmlChecking
|
|
158904
|
+
* @param {string} [params.sortField] amount (sorting by time), createdAt (sorting by date)
|
|
158905
|
+
* @param {string} [params.sortOrder] asc (oldest-on-top), or desc (newest-on-top, default)
|
|
158906
|
+
* @param {int} [params.skip] 0 - ... Select the number of transactions to skip
|
|
158907
|
+
* @param {string} [params.address]
|
|
158908
|
+
* @returns {object[]} a list of [transaction structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#transaction-structure}
|
|
158909
|
+
*/
|
|
158910
|
+
await this.loadMarkets();
|
|
158911
|
+
const until = this.safeInteger(params, 'until');
|
|
158912
|
+
params = this.omit(params, 'until');
|
|
158913
|
+
let currency = undefined;
|
|
158914
|
+
if (currency !== undefined) {
|
|
158915
|
+
currency = this.currency(code);
|
|
158916
|
+
}
|
|
158917
|
+
const request = {};
|
|
158918
|
+
if (code !== undefined) {
|
|
158919
|
+
request['currency'] = code;
|
|
158920
|
+
}
|
|
158921
|
+
if (since !== undefined) {
|
|
158922
|
+
request['dateFrom'] = this.iso8601(since);
|
|
158923
|
+
}
|
|
158924
|
+
if (limit !== undefined) {
|
|
158925
|
+
request['take'] = limit;
|
|
158926
|
+
}
|
|
158927
|
+
if (until !== undefined) {
|
|
158928
|
+
request['dateTo'] = this.iso8601(until);
|
|
158929
|
+
}
|
|
158930
|
+
const response = await this.v4PrivateGetWithdrawPrivateHistory(this.extend(request, params));
|
|
158931
|
+
//
|
|
158932
|
+
// {
|
|
158933
|
+
// "data": [
|
|
158934
|
+
// {
|
|
158935
|
+
// "id": "e9aa15b8-9c19-42eb-800a-026a7a153990", // Unique identifier of withdrawal
|
|
158936
|
+
// "amount": "10.75", // Amount deducted from your account
|
|
158937
|
+
// "asset": "USDT", // Withdrawal currency
|
|
158938
|
+
// "merchantId": "16214228-5c0c-5abc-be6a-c90259b21d4e", // Internal ID (not for use)
|
|
158939
|
+
// "paymentCode": "TRX", // Blockchain name
|
|
158940
|
+
// "status": "Processed", // Withdrawal status
|
|
158941
|
+
// "type": "Withdraw", // Transaction type
|
|
158942
|
+
// "reason": [], // Reason for manual transaction processing
|
|
158943
|
+
// "address": "TL3CWAwviQQYSnzHT4RotCWYnarnunQM46", // Withdrawal address
|
|
158944
|
+
// "memo": "", // Withdrawal memo
|
|
158945
|
+
// "txId": "5ecc4e559b528c57be6723ac960a38211fbd3101ef4b59008452b3bd88c84621", // Withdrawal transaction hash
|
|
158946
|
+
// "fee": "0.75", // Withdrawal fee
|
|
158947
|
+
// "processedAmount": "10", // Withdrawal amount
|
|
158948
|
+
// "createdAt": "2023-06-09T11:33:02.383Z", // Withdrawal creation date
|
|
158949
|
+
// "updatedAt": "2023-06-09T11:34:25.317Z" // Date of final withdrawal status
|
|
158950
|
+
// },
|
|
158951
|
+
// ...
|
|
158952
|
+
// ]
|
|
158953
|
+
// }
|
|
158954
|
+
//
|
|
158955
|
+
const data = this.safeValue(response, 'data', []);
|
|
158956
|
+
return this.parseTransactions(data, currency);
|
|
158957
|
+
}
|
|
158958
|
+
async fetchWithdrawal(id, code = undefined, params = {}) {
|
|
158959
|
+
/**
|
|
158960
|
+
* @method
|
|
158961
|
+
* @name kuna#fetchWithdrawal
|
|
158962
|
+
* @description fetch data on a currency withdrawal via the withdrawal id
|
|
158963
|
+
* @see https://docs.kuna.io/docs/get-withdraw-details-by-id
|
|
158964
|
+
* @param {string} id withdrawal id
|
|
158965
|
+
* @param {string} code not used by kuna.fetchWithdrawal
|
|
158966
|
+
* @param {object} [params] extra parameters specific to the kuna api endpoint
|
|
158967
|
+
* @returns {object} a [transaction structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#transaction-structure}
|
|
158968
|
+
*/
|
|
158969
|
+
await this.loadMarkets();
|
|
158970
|
+
const request = {
|
|
158971
|
+
'withdrawId': id,
|
|
158972
|
+
};
|
|
158973
|
+
const response = await this.v4PrivateGetWithdrawPrivateDetailsWithdrawId(this.extend(request, params));
|
|
158974
|
+
//
|
|
158975
|
+
// {
|
|
158976
|
+
// "data": {
|
|
158977
|
+
// "id": "e9aa15b8-9c19-42eb-800a-026a7a153990", // Unique identifier of withdrawal
|
|
158978
|
+
// "amount": "10.75", // Amount deducted from your account
|
|
158979
|
+
// "asset": "USDT", // Withdrawal currency
|
|
158980
|
+
// "merchantId": "16214228-5c0c-5abc-be6a-c90259b21d4e", // Internal ID (not for use)
|
|
158981
|
+
// "paymentCode": "TRX", // Blockchain name
|
|
158982
|
+
// "status": "Processed", // Withdrawal status
|
|
158983
|
+
// "type": "Withdraw", // Transaction type
|
|
158984
|
+
// "reason": [], // Reason for manual transaction processing
|
|
158985
|
+
// "address": "TL3CWAwviQQYSnzHT4RotCWYnarnunQM46", // Withdrawal address
|
|
158986
|
+
// "memo": "", // Withdrawal memo
|
|
158987
|
+
// "txId": "5ecc4e559b528c57be6723ac960a38211fbd3101ef4b59008452b3bd88c84621", // Withdrawal transaction hash
|
|
158988
|
+
// "fee": "0.75", // Withdrawal fee
|
|
158989
|
+
// "processedAmount": "10", // Withdrawal amount
|
|
158990
|
+
// "createdAt": "2023-06-09T11:33:02.383Z", // Withdrawal creation date
|
|
158991
|
+
// "updatedAt": "2023-06-09T11:34:25.317Z" // Date of final withdrawal status
|
|
158992
|
+
// }
|
|
158993
|
+
// }
|
|
158994
|
+
//
|
|
158995
|
+
const data = this.safeValue(response, 'data', {});
|
|
158996
|
+
return this.parseTransaction(data);
|
|
158997
|
+
}
|
|
158998
|
+
async createDepositAddress(code, params = {}) {
|
|
158999
|
+
/**
|
|
159000
|
+
* @method
|
|
159001
|
+
* @name kuna#createDepositAddress
|
|
159002
|
+
* @description create a currency deposit address
|
|
159003
|
+
* @see https://docs.kuna.io/docs/generate-a-constant-crypto-address-for-deposit
|
|
159004
|
+
* @param {string} code unified currency code of the currency for the deposit address
|
|
159005
|
+
* @param {object} [params] extra parameters specific to the kuna api endpoint
|
|
159006
|
+
* @returns {object} an [address structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#address-structure}
|
|
159007
|
+
*/
|
|
159008
|
+
await this.loadMarkets();
|
|
159009
|
+
const currency = this.currency(code);
|
|
159010
|
+
const request = {
|
|
159011
|
+
'source': currency['id'],
|
|
159012
|
+
};
|
|
159013
|
+
const response = await this.v4PrivatePostDepositPrivateCryptoGenerateAddress(this.extend(request, params));
|
|
159014
|
+
//
|
|
159015
|
+
// {
|
|
159016
|
+
// "data": {
|
|
159017
|
+
// "id": "1300c2b6-ree4-4f1e-2a9d-e0f7ed0991a7", // ID of your address
|
|
159018
|
+
// "source": "BTC", // Blockchain name for which you want to get the address to deposit into the account
|
|
159019
|
+
// "address": "bc1qm6xfv0qsaaanx0egn6hca5vgsd4r7ak9ttha2a" // Your deposit address
|
|
159020
|
+
// }
|
|
159021
|
+
// }
|
|
159022
|
+
//
|
|
159023
|
+
const data = this.safeValue(response, 'data', {});
|
|
159024
|
+
return this.parseDepositAddress(data, currency);
|
|
159025
|
+
}
|
|
159026
|
+
async fetchDepositAddress(code, params = {}) {
|
|
159027
|
+
/**
|
|
159028
|
+
* @method
|
|
159029
|
+
* @name kuna#fetchDepositAddress
|
|
159030
|
+
* @description fetch the deposit address for a currency associated with this account
|
|
159031
|
+
* @see https://docs.kuna.io/docs/find-crypto-address-for-deposit
|
|
159032
|
+
* @param {string} code unified currency code
|
|
159033
|
+
* @param {object} [params] extra parameters specific to the kuna api endpoint
|
|
159034
|
+
* @returns {object} an [address structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#address-structure}
|
|
159035
|
+
*/
|
|
159036
|
+
await this.loadMarkets();
|
|
159037
|
+
const currency = this.currency(code);
|
|
159038
|
+
const request = {
|
|
159039
|
+
'source': currency['id'].toUpperCase(),
|
|
159040
|
+
};
|
|
159041
|
+
const response = await this.v4PrivateGetDepositPrivateCryptoAddress(this.extend(request, params));
|
|
159042
|
+
//
|
|
159043
|
+
// {
|
|
159044
|
+
// "data": {
|
|
159045
|
+
// "id": "c52b6646-fb91-4760-b147-a4f952e8652c", // ID of the address.
|
|
159046
|
+
// "source": "BTC", // Blockchain name for which you want to get the address to deposit into the account.
|
|
159047
|
+
// "address": "bc1qm6xfv0qsaaanx0egn6hca5vgsd4r7ak9ttha2a" // Your deposit address
|
|
159048
|
+
// }
|
|
159049
|
+
// }
|
|
159050
|
+
//
|
|
159051
|
+
const data = this.safeValue(response, 'data', {});
|
|
159052
|
+
return this.parseDepositAddress(data, currency);
|
|
159053
|
+
}
|
|
159054
|
+
parseDepositAddress(depositAddress, currency = undefined) {
|
|
159055
|
+
//
|
|
159056
|
+
// {
|
|
159057
|
+
// "id": "c52b6646-fb91-4760-b147-a4f952e8652c", // ID of the address.
|
|
159058
|
+
// "source": "BTC", // Blockchain name for which you want to get the address to deposit into the account.
|
|
159059
|
+
// "address": "bc1qm6xfv0qsaaanx0egn6hca5vgsd4r7ak9ttha2a" // Your deposit address
|
|
159060
|
+
// }
|
|
159061
|
+
//
|
|
159062
|
+
const currencyId = this.safeString(depositAddress, 'source');
|
|
159063
|
+
return {
|
|
159064
|
+
'info': this.safeString(depositAddress, ''),
|
|
159065
|
+
'currency': this.safeCurrencyCode(currencyId, currency),
|
|
159066
|
+
'network': undefined,
|
|
159067
|
+
'address': this.safeString(depositAddress, 'address'),
|
|
159068
|
+
'tag': undefined,
|
|
159069
|
+
};
|
|
159070
|
+
}
|
|
159071
|
+
parseTransactionStatus(status) {
|
|
159072
|
+
const statuses = {
|
|
159073
|
+
'Created': 'pending',
|
|
159074
|
+
'Canceled': 'canceled',
|
|
159075
|
+
'PartiallyProcessed': 'pending',
|
|
159076
|
+
'Processing': 'pending',
|
|
159077
|
+
'Processed': 'ok',
|
|
159078
|
+
'WaitForConfirmation': 'pending',
|
|
159079
|
+
'Pending': 'pending',
|
|
159080
|
+
'AmlChecking': 'pending',
|
|
159081
|
+
};
|
|
159082
|
+
return this.safeString(statuses, status, status);
|
|
159083
|
+
}
|
|
159084
|
+
async fetchDeposits(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
159085
|
+
/**
|
|
159086
|
+
* @method
|
|
159087
|
+
* @name kuna#fetchDeposits
|
|
159088
|
+
* @description fetch all deposits made to an account
|
|
159089
|
+
* @see https://docs.kuna.io/docs/get-deposit-history
|
|
159090
|
+
* @param {string} code unified currency code
|
|
159091
|
+
* @param {int} [since] the earliest time in ms to fetch deposits for
|
|
159092
|
+
* @param {int} [limit] the maximum number of deposits structures to retrieve
|
|
159093
|
+
* @param {object} [params] extra parameters specific to the kuna api endpoint
|
|
159094
|
+
* @param {int} [params.until] the latest time in ms to fetch deposits for
|
|
159095
|
+
*
|
|
159096
|
+
* EXCHANGE SPECIFIC PARAMETERS
|
|
159097
|
+
* @param {string} [params.status] Created, Canceled, PartiallyProcessed, Processing, Processed, WaitForConfirmation, Pending, AmlChecking
|
|
159098
|
+
* @param {string} [params.sortField] amount (sorting by time), createdAt (sorting by date)
|
|
159099
|
+
* @param {string} [params.sortOrder] asc (oldest-on-top), or desc (newest-on-top, default)
|
|
159100
|
+
* @param {int} [params.skip] 0 - ... Select the number of transactions to skip
|
|
159101
|
+
* @param {string} [params.address]
|
|
159102
|
+
* @returns {object[]} a list of [transaction structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#transaction-structure}
|
|
159103
|
+
*/
|
|
159104
|
+
await this.loadMarkets();
|
|
159105
|
+
const until = this.safeInteger(params, 'until');
|
|
159106
|
+
params = this.omit(params, 'until');
|
|
159107
|
+
let currency = undefined;
|
|
159108
|
+
if (currency !== undefined) {
|
|
159109
|
+
currency = this.currency(code);
|
|
159110
|
+
}
|
|
159111
|
+
const request = {};
|
|
159112
|
+
if (code !== undefined) {
|
|
159113
|
+
request['currency'] = code;
|
|
159114
|
+
}
|
|
159115
|
+
if (since !== undefined) {
|
|
159116
|
+
request['dateFrom'] = this.iso8601(since);
|
|
159117
|
+
}
|
|
159118
|
+
if (limit !== undefined) {
|
|
159119
|
+
request['take'] = limit;
|
|
159120
|
+
}
|
|
159121
|
+
if (until !== undefined) {
|
|
159122
|
+
request['dateTo'] = this.iso8601(until);
|
|
159123
|
+
}
|
|
159124
|
+
const response = await this.v4PrivateGetDepositPrivateHistory(this.extend(request, params));
|
|
159125
|
+
//
|
|
159126
|
+
// {
|
|
159127
|
+
// "data": [
|
|
159128
|
+
// {
|
|
159129
|
+
// "id": "a201cb3c-5830-57ac-ad2c-f6a588dd55eb", // Unique ID of deposit
|
|
159130
|
+
// "amount": "9.9", // Amount credited to your account
|
|
159131
|
+
// "asset": "USDT", // Deposit currency
|
|
159132
|
+
// "merchantId": "16214228-5c0c-5abc-be6a-c90259b21d4e", // Internal ID (not for use)
|
|
159133
|
+
// "paymentCode": "TRX", // Blockchain name
|
|
159134
|
+
// "status": "Processed", // Transactions status
|
|
159135
|
+
// "type": "Deposit", // Transaction type
|
|
159136
|
+
// "reason": [], // Reason for manual transaction processing
|
|
159137
|
+
// "address": "TNeBQz8RyGGiAYAR7r8G6QGxtTWDkpH4dV", // Deposit address
|
|
159138
|
+
// "memo": "", // Deposit memo
|
|
159139
|
+
// "txId": "8a0b0c5a2ac5679879b71b2fa63b0a5c39f90bc8ff6c41e708906b398ac3d4ef", // Deposit transaction hash
|
|
159140
|
+
// "fee": "0.1", // Deposit fee
|
|
159141
|
+
// "processedAmount": "10", // Amount of deposit
|
|
159142
|
+
// "createdAt": "2023-06-13T12:55:01.256Z", // Deposit receipt date
|
|
159143
|
+
// "updatedAt": "2023-06-13T12:55:01.696Z" // Deposit credit date
|
|
159144
|
+
// },
|
|
159145
|
+
// ...
|
|
159146
|
+
// ]
|
|
159147
|
+
// }
|
|
159148
|
+
//
|
|
159149
|
+
const data = this.safeValue(response, 'data', []);
|
|
159150
|
+
return this.parseTransactions(data, currency);
|
|
159151
|
+
}
|
|
159152
|
+
async fetchDeposit(id, code = undefined, params = {}) {
|
|
159153
|
+
/**
|
|
159154
|
+
* @method
|
|
159155
|
+
* @name kuna#fetchDeposit
|
|
159156
|
+
* @description fetch data on a currency deposit via the deposit id
|
|
159157
|
+
* @see https://docs.kuna.io/docs/get-deposit-details-by-id
|
|
159158
|
+
* @param {string} id deposit id
|
|
159159
|
+
* @param {string} code filter by currency code
|
|
159160
|
+
* @param {object} [params] extra parameters specific to the kuna api endpoint
|
|
159161
|
+
* @returns {object} a [transaction structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#transaction-structure}
|
|
159162
|
+
*/
|
|
159163
|
+
await this.loadMarkets();
|
|
159164
|
+
let currency = undefined;
|
|
159165
|
+
if (code !== undefined) {
|
|
159166
|
+
currency = this.currency(code);
|
|
159167
|
+
}
|
|
159168
|
+
const request = {
|
|
159169
|
+
'depositId': id,
|
|
159170
|
+
};
|
|
159171
|
+
const response = await this.v4PrivateGetDepositPrivateDetailsDepositId(this.extend(request, params));
|
|
159172
|
+
//
|
|
159173
|
+
// {
|
|
159174
|
+
// "data": {
|
|
159175
|
+
// "id": "a201cb3c-5830-57ac-ad2c-f6a588dd55eb", // Unique ID of deposit
|
|
159176
|
+
// "amount": "9.9", // Amount credited to your account
|
|
159177
|
+
// "asset": "USDT", // Deposit currency
|
|
159178
|
+
// "merchantId": "16214228-5c0c-5abc-be6a-c90259b21d4e", // Internal ID (not for use)
|
|
159179
|
+
// "paymentCode": "TRX", // Blockchain name
|
|
159180
|
+
// "status": "Processed", // Transactions status
|
|
159181
|
+
// "type": "Deposit", // Transaction type
|
|
159182
|
+
// "reason": [], // Reason for manual transaction processing
|
|
159183
|
+
// "address": "TNeBQz8RyGGiAYAR7r8G6QGxtTWDkpH4dV", // Deposit address
|
|
159184
|
+
// "memo": "", // Deposit memo
|
|
159185
|
+
// "txId": "8a0b0c5a2ac5679879b71b2fa63b0a5c39f90bc8ff6c41e708906b398ac3d4ef", // Deposit transaction hash
|
|
159186
|
+
// "fee": "0.1", // Deposit fee
|
|
159187
|
+
// "processedAmount": "10", // Amount of deposit
|
|
159188
|
+
// "createdAt": "2023-06-13T12:55:01.256Z", // Deposit receipt date
|
|
159189
|
+
// "updatedAt": "2023-06-13T12:55:01.696Z" // Deposit credit date
|
|
159190
|
+
// }
|
|
159191
|
+
// }
|
|
159192
|
+
//
|
|
159193
|
+
const data = this.safeValue(response, 'data', {});
|
|
159194
|
+
return this.parseTransaction(data, currency);
|
|
159195
|
+
}
|
|
159196
|
+
parseTransaction(transaction, currency = undefined) {
|
|
159197
|
+
//
|
|
159198
|
+
// {
|
|
159199
|
+
// "id": "a201cb3c-5830-57ac-ad2c-f6a588dd55eb", // Unique ID of deposit
|
|
159200
|
+
// "amount": "9.9", // Amount credited to your account
|
|
159201
|
+
// "asset": "USDT", // Deposit currency
|
|
159202
|
+
// "merchantId": "16214228-5c0c-5abc-be6a-c90259b21d4e", // Internal ID (not for use)
|
|
159203
|
+
// "paymentCode": "TRX", // Blockchain name
|
|
159204
|
+
// "status": "Processed", // Transactions status
|
|
159205
|
+
// "type": "Deposit", // Transaction type
|
|
159206
|
+
// "reason": [], // Reason for manual transaction processing
|
|
159207
|
+
// "address": "TNeBQz8RyGGiAYAR7r8G6QGxtTWDkpH4dV", // Deposit address
|
|
159208
|
+
// "memo": "", // Deposit memo
|
|
159209
|
+
// "txId": "8a0b0c5a2ac5679879b71b2fa63b0a5c39f90bc8ff6c41e708906b398ac3d4ef", // Deposit transaction hash
|
|
159210
|
+
// "fee": "0.1", // Deposit fee
|
|
159211
|
+
// "processedAmount": "10", // Amount of deposit
|
|
159212
|
+
// "createdAt": "2023-06-13T12:55:01.256Z", // Deposit receipt date
|
|
159213
|
+
// "updatedAt": "2023-06-13T12:55:01.696Z" // Deposit credit date
|
|
159214
|
+
// }
|
|
159215
|
+
//
|
|
159216
|
+
const datetime = this.safeString(transaction, 'createdAt');
|
|
159217
|
+
const currencyId = this.safeString(transaction, 'asset');
|
|
159218
|
+
const code = this.safeCurrencyCode(currencyId, currency);
|
|
159219
|
+
const networkId = this.safeString(transaction, 'paymentCode');
|
|
159220
|
+
const type = this.safeStringLower(transaction, 'type');
|
|
159221
|
+
const address = this.safeString(transaction, 'address');
|
|
159222
|
+
const isDeposit = (type === 'deposit');
|
|
159223
|
+
return {
|
|
159224
|
+
'info': transaction,
|
|
159225
|
+
'id': this.safeString(transaction, 'id'),
|
|
159226
|
+
'txid': this.safeString(transaction, 'txId'),
|
|
159227
|
+
'currency': code,
|
|
159228
|
+
'timestamp': this.parse8601(datetime),
|
|
159229
|
+
'datetime': datetime,
|
|
159230
|
+
'network': this.networkIdToCode(networkId),
|
|
159231
|
+
'addressFrom': undefined,
|
|
159232
|
+
'address': address,
|
|
159233
|
+
'addressTo': address,
|
|
159234
|
+
'amount': this.safeNumber(transaction, 'amount'),
|
|
159235
|
+
'type': !isDeposit ? 'withdrawal' : type,
|
|
159236
|
+
'status': this.parseTransactionStatus(this.safeString(transaction, 'status')),
|
|
159237
|
+
'updated': this.parse8601(this.safeString(transaction, 'updatedAt')),
|
|
159238
|
+
'tagFrom': undefined,
|
|
159239
|
+
'tag': undefined,
|
|
159240
|
+
'tagTo': undefined,
|
|
159241
|
+
'comment': this.safeString(transaction, 'memo'),
|
|
159242
|
+
'fee': {
|
|
159243
|
+
'cost': this.safeString(transaction, 'fee'),
|
|
159244
|
+
'currency': code,
|
|
159245
|
+
},
|
|
159246
|
+
};
|
|
158178
159247
|
}
|
|
158179
159248
|
nonce() {
|
|
158180
159249
|
return this.milliseconds();
|
|
@@ -158199,11 +159268,12 @@ class kuna extends _abstract_kuna_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
158199
159268
|
sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
158200
159269
|
let url = undefined;
|
|
158201
159270
|
if (Array.isArray(api)) {
|
|
159271
|
+
const isGet = method === 'GET';
|
|
158202
159272
|
const [version, access] = api;
|
|
158203
159273
|
if (version === 'v3') {
|
|
158204
159274
|
url = this.urls['api'][version] + '/' + version + '/' + this.implodeParams(path, params);
|
|
158205
159275
|
if (access === 'public') {
|
|
158206
|
-
if (
|
|
159276
|
+
if (isGet) {
|
|
158207
159277
|
if (Object.keys(params).length) {
|
|
158208
159278
|
url += '?' + this.urlencode(params);
|
|
158209
159279
|
}
|
|
@@ -158218,35 +159288,39 @@ class kuna extends _abstract_kuna_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
158218
159288
|
}
|
|
158219
159289
|
}
|
|
158220
159290
|
else if (version === 'v4') {
|
|
158221
|
-
const
|
|
158222
|
-
|
|
158223
|
-
|
|
158224
|
-
if (
|
|
158225
|
-
|
|
158226
|
-
|
|
158227
|
-
|
|
159291
|
+
const extractedParams = this.extractParams(path);
|
|
159292
|
+
let urlPath = '/' + version + '/' + this.implodeParams(path, params);
|
|
159293
|
+
params = this.omit(params, extractedParams);
|
|
159294
|
+
if (isGet) {
|
|
159295
|
+
const paramsList = Object.keys(params);
|
|
159296
|
+
const numParams = paramsList.length;
|
|
159297
|
+
if (numParams > 0) {
|
|
159298
|
+
urlPath += '?' + this.urlencode(params);
|
|
158228
159299
|
}
|
|
158229
|
-
urlPath = '/' + version + '/' + splitPath[0] + '/' + access + '/' + this.implodeParams(pathTail, params);
|
|
158230
159300
|
}
|
|
158231
|
-
else {
|
|
158232
|
-
urlPath = '/' + version + '/' + access + '/' + this.implodeParams(path, params);
|
|
158233
|
-
}
|
|
158234
|
-
url = this.urls['api'][version] + urlPath;
|
|
158235
159301
|
if (access === 'private') {
|
|
158236
|
-
const nonce = this.nonce();
|
|
158237
|
-
|
|
159302
|
+
const nonce = this.nonce().toString();
|
|
159303
|
+
let auth = urlPath + nonce;
|
|
159304
|
+
if (isGet) {
|
|
159305
|
+
auth = auth + this.json({});
|
|
159306
|
+
}
|
|
159307
|
+
else {
|
|
159308
|
+
auth = auth + this.json(params);
|
|
159309
|
+
body = params;
|
|
159310
|
+
}
|
|
158238
159311
|
headers = {
|
|
158239
|
-
'
|
|
159312
|
+
'Content-Type': 'application/json',
|
|
158240
159313
|
'accept': 'application/json',
|
|
158241
159314
|
'nonce': nonce,
|
|
158242
159315
|
'public-key': this.apiKey,
|
|
158243
|
-
'signature': this.hmac(this.encode(auth), this.encode(this.secret),
|
|
159316
|
+
'signature': this.hmac(this.encode(auth), this.encode(this.secret), _static_dependencies_noble_hashes_sha512_js__WEBPACK_IMPORTED_MODULE_4__/* .sha384 */ .iC, 'hex'),
|
|
158244
159317
|
};
|
|
158245
159318
|
const account = this.safeString(this.options, 'account');
|
|
158246
159319
|
if (account === 'pro') {
|
|
158247
159320
|
headers['account'] = 'pro';
|
|
158248
159321
|
}
|
|
158249
159322
|
}
|
|
159323
|
+
url = this.urls['api'][version] + urlPath;
|
|
158250
159324
|
}
|
|
158251
159325
|
}
|
|
158252
159326
|
else {
|
|
@@ -158269,7 +159343,7 @@ class kuna extends _abstract_kuna_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
158269
159343
|
'tonce': nonce,
|
|
158270
159344
|
}, params));
|
|
158271
159345
|
const auth = method + '|' + request + '|' + queryInner;
|
|
158272
|
-
const signed = this.hmac(this.encode(auth), this.encode(this.secret),
|
|
159346
|
+
const signed = this.hmac(this.encode(auth), this.encode(this.secret), _static_dependencies_noble_hashes_sha256_js__WEBPACK_IMPORTED_MODULE_5__/* .sha256 */ .J);
|
|
158273
159347
|
const suffix = query + '&signature=' + signed;
|
|
158274
159348
|
if (method === 'GET') {
|
|
158275
159349
|
url += '?' + suffix;
|
|
@@ -158280,18 +159354,37 @@ class kuna extends _abstract_kuna_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
158280
159354
|
}
|
|
158281
159355
|
}
|
|
158282
159356
|
}
|
|
159357
|
+
if (body !== undefined) {
|
|
159358
|
+
body = JSON.stringify(body);
|
|
159359
|
+
}
|
|
158283
159360
|
return { 'url': url, 'method': method, 'body': body, 'headers': headers };
|
|
158284
159361
|
}
|
|
158285
159362
|
handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
|
|
158286
|
-
|
|
159363
|
+
//
|
|
159364
|
+
// {
|
|
159365
|
+
// "errors": [
|
|
159366
|
+
// {
|
|
159367
|
+
// "extensions": {
|
|
159368
|
+
// "code": "IP_NOT_IN_WHITE_LIST"
|
|
159369
|
+
// },
|
|
159370
|
+
// "code": "IP_NOT_IN_WHITE_LIST"
|
|
159371
|
+
// }
|
|
159372
|
+
// ]
|
|
159373
|
+
// }
|
|
159374
|
+
//
|
|
159375
|
+
const errors = this.safeValue(response, 'errors');
|
|
159376
|
+
if ((response === undefined) && (errors === undefined)) {
|
|
158287
159377
|
return undefined;
|
|
158288
159378
|
}
|
|
158289
|
-
if (code === 400) {
|
|
158290
|
-
|
|
159379
|
+
if ((errors !== undefined) || (code === 400)) {
|
|
159380
|
+
let error = this.safeValue(errors, 0);
|
|
159381
|
+
if (error === undefined) {
|
|
159382
|
+
error = this.safeValue(response, 'error');
|
|
159383
|
+
}
|
|
158291
159384
|
const errorCode = this.safeString(error, 'code');
|
|
158292
159385
|
const feedback = this.id + ' ' + this.json(response);
|
|
158293
159386
|
this.throwExactlyMatchedException(this.exceptions, errorCode, feedback);
|
|
158294
|
-
|
|
159387
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError(feedback);
|
|
158295
159388
|
}
|
|
158296
159389
|
return undefined;
|
|
158297
159390
|
}
|
|
@@ -158332,8 +159425,8 @@ class latoken extends _abstract_latoken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
158332
159425
|
'CORS': undefined,
|
|
158333
159426
|
'spot': true,
|
|
158334
159427
|
'margin': false,
|
|
158335
|
-
'swap':
|
|
158336
|
-
'future':
|
|
159428
|
+
'swap': false,
|
|
159429
|
+
'future': false,
|
|
158337
159430
|
'option': false,
|
|
158338
159431
|
'cancelAllOrders': true,
|
|
158339
159432
|
'cancelOrder': true,
|
|
@@ -188383,6 +189476,7 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
188383
189476
|
'exceptions': {
|
|
188384
189477
|
'exact': {
|
|
188385
189478
|
// not documented
|
|
189479
|
+
'401': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.AuthenticationError,
|
|
188386
189480
|
'412': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest,
|
|
188387
189481
|
'6001': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest,
|
|
188388
189482
|
// documented
|
|
@@ -264859,7 +265953,7 @@ class wazirx extends _abstract_wazirx_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
264859
265953
|
'has': {
|
|
264860
265954
|
'CORS': false,
|
|
264861
265955
|
'spot': true,
|
|
264862
|
-
'margin':
|
|
265956
|
+
'margin': false,
|
|
264863
265957
|
'swap': false,
|
|
264864
265958
|
'future': false,
|
|
264865
265959
|
'option': false,
|
|
@@ -280224,7 +281318,7 @@ SOFTWARE.
|
|
|
280224
281318
|
|
|
280225
281319
|
//-----------------------------------------------------------------------------
|
|
280226
281320
|
// this is updated by vss.js when building
|
|
280227
|
-
const version = '4.1.
|
|
281321
|
+
const version = '4.1.37';
|
|
280228
281322
|
_src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange.ccxtVersion */ .e.ccxtVersion = version;
|
|
280229
281323
|
//-----------------------------------------------------------------------------
|
|
280230
281324
|
|