ccxt 4.1.36 → 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/dist/ccxt.browser.js +1447 -385
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +19 -0
- package/dist/cjs/src/base/errors.js +6 -6
- package/dist/cjs/src/binance.js +2 -2
- package/dist/cjs/src/bingx.js +106 -0
- package/dist/cjs/src/bitforex.js +1 -1
- package/dist/cjs/src/bitget.js +2 -2
- package/dist/cjs/src/bitmart.js +2 -2
- package/dist/cjs/src/bitmex.js +3 -3
- 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/wazirx.js +1 -1
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- 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 +3 -2
- package/js/src/base/Exchange.js +19 -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 +2 -2
- package/js/src/bingx.d.ts +10 -8
- package/js/src/bingx.js +106 -0
- 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 +2 -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/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/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/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/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 +1 -1
package/dist/ccxt.browser.js
CHANGED
|
@@ -8710,6 +8710,25 @@ class Exchange {
|
|
|
8710
8710
|
'cost': this.parseNumber(cost),
|
|
8711
8711
|
};
|
|
8712
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
|
+
}
|
|
8713
8732
|
safeTrade(trade, market = undefined) {
|
|
8714
8733
|
const amount = this.safeString(trade, 'amount');
|
|
8715
8734
|
const price = this.safeString(trade, 'price');
|
|
@@ -11525,12 +11544,6 @@ class ExchangeError extends Error {
|
|
|
11525
11544
|
this.name = 'ExchangeError';
|
|
11526
11545
|
}
|
|
11527
11546
|
}
|
|
11528
|
-
class OperationFailed extends ExchangeError {
|
|
11529
|
-
constructor(message) {
|
|
11530
|
-
super(message);
|
|
11531
|
-
this.name = 'OperationFailed';
|
|
11532
|
-
}
|
|
11533
|
-
}
|
|
11534
11547
|
class AuthenticationError extends ExchangeError {
|
|
11535
11548
|
constructor(message) {
|
|
11536
11549
|
super(message);
|
|
@@ -11718,6 +11731,12 @@ class RequestTimeout extends NetworkError {
|
|
|
11718
11731
|
this.name = 'RequestTimeout';
|
|
11719
11732
|
}
|
|
11720
11733
|
}
|
|
11734
|
+
class OperationFailed extends NetworkError {
|
|
11735
|
+
constructor(message) {
|
|
11736
|
+
super(message);
|
|
11737
|
+
this.name = 'OperationFailed';
|
|
11738
|
+
}
|
|
11739
|
+
}
|
|
11721
11740
|
/* ------------------------------------------------------------------------ */
|
|
11722
11741
|
// export default subclass (
|
|
11723
11742
|
// // Root class
|
|
@@ -25797,7 +25816,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
25797
25816
|
//
|
|
25798
25817
|
const marketId = this.safeString(liquidation, 'symbol');
|
|
25799
25818
|
const timestamp = this.safeInteger2(liquidation, 'updatedTime', 'updateTime');
|
|
25800
|
-
return {
|
|
25819
|
+
return this.safeLiquidation({
|
|
25801
25820
|
'info': liquidation,
|
|
25802
25821
|
'symbol': this.safeSymbol(marketId, market),
|
|
25803
25822
|
'contracts': this.safeNumber(liquidation, 'executedQty'),
|
|
@@ -25807,7 +25826,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
25807
25826
|
'quoteValue': this.safeNumber(liquidation, 'cumQuote'),
|
|
25808
25827
|
'timestamp': timestamp,
|
|
25809
25828
|
'datetime': this.iso8601(timestamp),
|
|
25810
|
-
};
|
|
25829
|
+
});
|
|
25811
25830
|
}
|
|
25812
25831
|
}
|
|
25813
25832
|
|
|
@@ -26040,7 +26059,9 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
26040
26059
|
'fetchFundingRate': true,
|
|
26041
26060
|
'fetchFundingRateHistory': true,
|
|
26042
26061
|
'fetchLeverage': true,
|
|
26062
|
+
'fetchLiquidations': false,
|
|
26043
26063
|
'fetchMarkets': true,
|
|
26064
|
+
'fetchMyLiquidations': true,
|
|
26044
26065
|
'fetchOHLCV': true,
|
|
26045
26066
|
'fetchOpenInterest': true,
|
|
26046
26067
|
'fetchOpenOrders': true,
|
|
@@ -29077,6 +29098,110 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
29077
29098
|
}
|
|
29078
29099
|
return sortedParams;
|
|
29079
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
|
+
}
|
|
29080
29205
|
sign(path, section = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
29081
29206
|
const type = section[0];
|
|
29082
29207
|
const version = section[1];
|
|
@@ -38114,7 +38239,7 @@ class bitforex extends _abstract_bitforex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
38114
38239
|
'CORS': undefined,
|
|
38115
38240
|
'spot': true,
|
|
38116
38241
|
'margin': false,
|
|
38117
|
-
'swap':
|
|
38242
|
+
'swap': false,
|
|
38118
38243
|
'future': false,
|
|
38119
38244
|
'option': false,
|
|
38120
38245
|
'cancelOrder': true,
|
|
@@ -45237,7 +45362,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
45237
45362
|
const liquidationFee = this.safeString(liquidation, 'LiqFee');
|
|
45238
45363
|
const totalDebt = this.safeString(liquidation, 'totalDebt');
|
|
45239
45364
|
const quoteValueString = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringAdd */ .O.stringAdd(liquidationFee, totalDebt);
|
|
45240
|
-
return {
|
|
45365
|
+
return this.safeLiquidation({
|
|
45241
45366
|
'info': liquidation,
|
|
45242
45367
|
'symbol': this.safeSymbol(marketId, market),
|
|
45243
45368
|
'contracts': undefined,
|
|
@@ -45247,7 +45372,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
45247
45372
|
'quoteValue': this.parseNumber(quoteValueString),
|
|
45248
45373
|
'timestamp': timestamp,
|
|
45249
45374
|
'datetime': this.iso8601(timestamp),
|
|
45250
|
-
};
|
|
45375
|
+
});
|
|
45251
45376
|
}
|
|
45252
45377
|
async fetchBorrowRate(code, params = {}) {
|
|
45253
45378
|
/**
|
|
@@ -50830,7 +50955,7 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
50830
50955
|
const priceString = this.safeString(liquidation, 'deal_avg_price');
|
|
50831
50956
|
const baseValueString = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringMul */ .O.stringMul(contractsString, contractSizeString);
|
|
50832
50957
|
const quoteValueString = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringMul */ .O.stringMul(baseValueString, priceString);
|
|
50833
|
-
return {
|
|
50958
|
+
return this.safeLiquidation({
|
|
50834
50959
|
'info': liquidation,
|
|
50835
50960
|
'symbol': this.safeSymbol(marketId, market),
|
|
50836
50961
|
'contracts': this.parseNumber(contractsString),
|
|
@@ -50840,7 +50965,7 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
50840
50965
|
'quoteValue': this.parseNumber(quoteValueString),
|
|
50841
50966
|
'timestamp': timestamp,
|
|
50842
50967
|
'datetime': this.iso8601(timestamp),
|
|
50843
|
-
};
|
|
50968
|
+
});
|
|
50844
50969
|
}
|
|
50845
50970
|
nonce() {
|
|
50846
50971
|
return this.milliseconds();
|
|
@@ -51852,7 +51977,7 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
51852
51977
|
*/
|
|
51853
51978
|
// Bitmex barfs if you set 'open': false in the filter...
|
|
51854
51979
|
const orders = await this.fetchOrders(symbol, since, limit, params);
|
|
51855
|
-
return this.
|
|
51980
|
+
return this.filterByArray(orders, 'status', ['closed', 'canceled'], false);
|
|
51856
51981
|
}
|
|
51857
51982
|
async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
51858
51983
|
/**
|
|
@@ -53623,7 +53748,7 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
53623
53748
|
// }
|
|
53624
53749
|
//
|
|
53625
53750
|
const marketId = this.safeString(liquidation, 'symbol');
|
|
53626
|
-
return {
|
|
53751
|
+
return this.safeLiquidation({
|
|
53627
53752
|
'info': liquidation,
|
|
53628
53753
|
'symbol': this.safeSymbol(marketId, market),
|
|
53629
53754
|
'contracts': undefined,
|
|
@@ -53633,7 +53758,7 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
53633
53758
|
'quoteValue': undefined,
|
|
53634
53759
|
'timestamp': undefined,
|
|
53635
53760
|
'datetime': undefined,
|
|
53636
|
-
};
|
|
53761
|
+
});
|
|
53637
53762
|
}
|
|
53638
53763
|
handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
|
|
53639
53764
|
if (response === undefined) {
|
|
@@ -110982,7 +111107,7 @@ class deribit extends _abstract_deribit_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
110982
111107
|
// }
|
|
110983
111108
|
//
|
|
110984
111109
|
const timestamp = this.safeInteger(liquidation, 'timestamp');
|
|
110985
|
-
return {
|
|
111110
|
+
return this.safeLiquidation({
|
|
110986
111111
|
'info': liquidation,
|
|
110987
111112
|
'symbol': this.safeSymbol(undefined, market),
|
|
110988
111113
|
'contracts': undefined,
|
|
@@ -110992,7 +111117,7 @@ class deribit extends _abstract_deribit_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
110992
111117
|
'quoteValue': undefined,
|
|
110993
111118
|
'timestamp': timestamp,
|
|
110994
111119
|
'datetime': this.iso8601(timestamp),
|
|
110995
|
-
};
|
|
111120
|
+
});
|
|
110996
111121
|
}
|
|
110997
111122
|
nonce() {
|
|
110998
111123
|
return this.milliseconds();
|
|
@@ -124495,7 +124620,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
124495
124620
|
if (quoteValueString === undefined) {
|
|
124496
124621
|
quoteValueString = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringMul */ .O.stringMul(baseValueString, priceString);
|
|
124497
124622
|
}
|
|
124498
|
-
return {
|
|
124623
|
+
return this.safeLiquidation({
|
|
124499
124624
|
'info': liquidation,
|
|
124500
124625
|
'symbol': this.safeSymbol(marketId, market),
|
|
124501
124626
|
'contracts': this.parseNumber(contractsString),
|
|
@@ -124505,7 +124630,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
124505
124630
|
'quoteValue': this.parseNumber(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringAbs */ .O.stringAbs(quoteValueString)),
|
|
124506
124631
|
'timestamp': timestamp,
|
|
124507
124632
|
'datetime': this.iso8601(timestamp),
|
|
124508
|
-
};
|
|
124633
|
+
});
|
|
124509
124634
|
}
|
|
124510
124635
|
handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
|
|
124511
124636
|
if (response === undefined) {
|
|
@@ -130332,7 +130457,7 @@ class hollaex extends _abstract_hollaex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
130332
130457
|
//
|
|
130333
130458
|
return this.parseOHLCVs(response, market, timeframe, since, limit);
|
|
130334
130459
|
}
|
|
130335
|
-
parseOHLCV(
|
|
130460
|
+
parseOHLCV(ohlcv, market = undefined) {
|
|
130336
130461
|
//
|
|
130337
130462
|
// {
|
|
130338
130463
|
// "time":"2020-03-02T20:00:00.000Z",
|
|
@@ -130345,12 +130470,12 @@ class hollaex extends _abstract_hollaex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
130345
130470
|
// }
|
|
130346
130471
|
//
|
|
130347
130472
|
return [
|
|
130348
|
-
this.parse8601(this.safeString(
|
|
130349
|
-
this.safeNumber(
|
|
130350
|
-
this.safeNumber(
|
|
130351
|
-
this.safeNumber(
|
|
130352
|
-
this.safeNumber(
|
|
130353
|
-
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'),
|
|
130354
130479
|
];
|
|
130355
130480
|
}
|
|
130356
130481
|
parseBalance(response) {
|
|
@@ -139918,7 +140043,7 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
139918
140043
|
//
|
|
139919
140044
|
const marketId = this.safeString(liquidation, 'contract_code');
|
|
139920
140045
|
const timestamp = this.safeInteger(liquidation, 'created_at');
|
|
139921
|
-
return {
|
|
140046
|
+
return this.safeLiquidation({
|
|
139922
140047
|
'info': liquidation,
|
|
139923
140048
|
'symbol': this.safeSymbol(marketId, market),
|
|
139924
140049
|
'contracts': this.safeNumber(liquidation, 'volume'),
|
|
@@ -139928,7 +140053,7 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
139928
140053
|
'quoteValue': this.safeNumber(liquidation, 'trade_turnover'),
|
|
139929
140054
|
'timestamp': timestamp,
|
|
139930
140055
|
'datetime': this.iso8601(timestamp),
|
|
139931
|
-
};
|
|
140056
|
+
});
|
|
139932
140057
|
}
|
|
139933
140058
|
}
|
|
139934
140059
|
|
|
@@ -155657,9 +155782,6 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
155657
155782
|
//
|
|
155658
155783
|
return this.parseTicker(response['data'], market);
|
|
155659
155784
|
}
|
|
155660
|
-
async fetchTickers(symbols = undefined, params = {}) {
|
|
155661
|
-
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchTickers() is not supported yet');
|
|
155662
|
-
}
|
|
155663
155785
|
parseTicker(ticker, market = undefined) {
|
|
155664
155786
|
//
|
|
155665
155787
|
// {
|
|
@@ -157327,14 +157449,16 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
157327
157449
|
/* harmony import */ var _abstract_kuna_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4722);
|
|
157328
157450
|
/* harmony import */ var _base_errors_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6689);
|
|
157329
157451
|
/* harmony import */ var _base_functions_number_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9292);
|
|
157330
|
-
/* harmony import */ var
|
|
157331
|
-
/* 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);
|
|
157332
157455
|
// ---------------------------------------------------------------------------
|
|
157333
157456
|
|
|
157334
157457
|
|
|
157335
157458
|
|
|
157336
157459
|
|
|
157337
157460
|
|
|
157461
|
+
|
|
157338
157462
|
// ---------------------------------------------------------------------------
|
|
157339
157463
|
/**
|
|
157340
157464
|
* @class kuna
|
|
@@ -157348,35 +157472,63 @@ class kuna extends _abstract_kuna_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
157348
157472
|
'name': 'Kuna',
|
|
157349
157473
|
'countries': ['UA'],
|
|
157350
157474
|
'rateLimit': 1000,
|
|
157351
|
-
'version': '
|
|
157475
|
+
'version': 'v4',
|
|
157352
157476
|
'has': {
|
|
157353
157477
|
'CORS': undefined,
|
|
157354
157478
|
'spot': true,
|
|
157355
|
-
'margin':
|
|
157479
|
+
'margin': false,
|
|
157356
157480
|
'swap': false,
|
|
157357
157481
|
'future': false,
|
|
157358
157482
|
'option': false,
|
|
157483
|
+
'addMargin': false,
|
|
157484
|
+
'borrowMargin': false,
|
|
157359
157485
|
'cancelOrder': true,
|
|
157486
|
+
'cancelOrders': true,
|
|
157487
|
+
'createDepositAddress': true,
|
|
157360
157488
|
'createOrder': true,
|
|
157489
|
+
'createPostOnlyOrder': false,
|
|
157490
|
+
'createReduceOnlyOrder': false,
|
|
157491
|
+
'createStopLimitOrder': true,
|
|
157492
|
+
'createStopMarketOrder': false,
|
|
157493
|
+
'createStopOrder': true,
|
|
157361
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,
|
|
157362
157507
|
'fetchFundingHistory': false,
|
|
157363
157508
|
'fetchFundingRate': false,
|
|
157364
157509
|
'fetchFundingRateHistory': false,
|
|
157365
157510
|
'fetchFundingRates': false,
|
|
157366
157511
|
'fetchIndexOHLCV': false,
|
|
157512
|
+
'fetchIsolatedPositions': false,
|
|
157367
157513
|
'fetchL3OrderBook': true,
|
|
157368
157514
|
'fetchLeverage': false,
|
|
157515
|
+
'fetchLeverageTiers': false,
|
|
157369
157516
|
'fetchMarginMode': false,
|
|
157517
|
+
'fetchMarketLeverageTiers': false,
|
|
157370
157518
|
'fetchMarkets': true,
|
|
157371
157519
|
'fetchMarkOHLCV': false,
|
|
157372
157520
|
'fetchMyTrades': true,
|
|
157373
157521
|
'fetchOHLCV': 'emulated',
|
|
157522
|
+
'fetchOpenInterest': false,
|
|
157374
157523
|
'fetchOpenInterestHistory': false,
|
|
157375
157524
|
'fetchOpenOrders': true,
|
|
157376
157525
|
'fetchOrder': true,
|
|
157377
157526
|
'fetchOrderBook': true,
|
|
157527
|
+
'fetchOrdersByStatus': true,
|
|
157528
|
+
'fetchPosition': false,
|
|
157378
157529
|
'fetchPositionMode': false,
|
|
157379
157530
|
'fetchPositions': false,
|
|
157531
|
+
'fetchPositionsBySymbol': false,
|
|
157380
157532
|
'fetchPositionsRisk': false,
|
|
157381
157533
|
'fetchPremiumIndexOHLCV': false,
|
|
157382
157534
|
'fetchTicker': true,
|
|
@@ -157385,9 +157537,20 @@ class kuna extends _abstract_kuna_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
157385
157537
|
'fetchTrades': true,
|
|
157386
157538
|
'fetchTradingFee': false,
|
|
157387
157539
|
'fetchTradingFees': false,
|
|
157540
|
+
'fetchTransactions': false,
|
|
157541
|
+
'fetchTransfers': false,
|
|
157542
|
+
'fetchWithdrawAddresses': false,
|
|
157543
|
+
'fetchWithdrawal': true,
|
|
157544
|
+
'fetchWithdrawals': true,
|
|
157388
157545
|
'reduceMargin': false,
|
|
157546
|
+
'repayMargin': false,
|
|
157389
157547
|
'setLeverage': false,
|
|
157548
|
+
'setMargin': false,
|
|
157549
|
+
'setMarginMode': false,
|
|
157390
157550
|
'setPositionMode': false,
|
|
157551
|
+
'signIn': false,
|
|
157552
|
+
'transfer': false,
|
|
157553
|
+
'withdraw': true,
|
|
157391
157554
|
},
|
|
157392
157555
|
'timeframes': undefined,
|
|
157393
157556
|
'urls': {
|
|
@@ -157419,34 +157582,34 @@ class kuna extends _abstract_kuna_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
157419
157582
|
'v4': {
|
|
157420
157583
|
'private': {
|
|
157421
157584
|
'get': {
|
|
157422
|
-
'me': 1,
|
|
157423
|
-
'getBalance': 1,
|
|
157424
|
-
'active': 1,
|
|
157425
|
-
'order/history': 1,
|
|
157585
|
+
'private/me': 1,
|
|
157586
|
+
'private/getBalance': 1,
|
|
157587
|
+
'order/private/active': 1,
|
|
157588
|
+
'order/private/history': 1,
|
|
157426
157589
|
'order/private/{id}/trades': 1,
|
|
157427
|
-
'order/details/{id}
|
|
157428
|
-
'trade/history': 1,
|
|
157429
|
-
'transaction/{hash}': 1,
|
|
157430
|
-
'deposit/preRequest': 1,
|
|
157431
|
-
'deposit/crypto/address': 1,
|
|
157432
|
-
'deposit/crypto/getMerchantAddress': 1,
|
|
157433
|
-
'deposit/history': 1,
|
|
157434
|
-
'deposit/details/{depositId}': 1,
|
|
157435
|
-
'withdraw/preRequest': 1,
|
|
157436
|
-
'withdraw/history': 1,
|
|
157437
|
-
'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,
|
|
157438
157601
|
'kuna-code/{id}': 1,
|
|
157439
157602
|
'kuna-code/{code}/check': 1,
|
|
157440
157603
|
'kuna-code/issued-by-me': 1,
|
|
157441
157604
|
'kuna-code/redeemed-by-me': 1,
|
|
157442
157605
|
},
|
|
157443
157606
|
'post': {
|
|
157444
|
-
'order/create': 1,
|
|
157445
|
-
'order/cancel': 1,
|
|
157446
|
-
'order/cancel/multi': 1,
|
|
157447
|
-
'deposit/crypto/generateAddress': 1,
|
|
157448
|
-
'deposit/crypto/generateMerchantAddress': 1,
|
|
157449
|
-
'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,
|
|
157450
157613
|
'kuna-code': 1,
|
|
157451
157614
|
},
|
|
157452
157615
|
'put': {
|
|
@@ -157455,12 +157618,14 @@ class kuna extends _abstract_kuna_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
157455
157618
|
},
|
|
157456
157619
|
'public': {
|
|
157457
157620
|
'get': {
|
|
157458
|
-
'timestamp': 1,
|
|
157459
|
-
'fees': 1,
|
|
157460
|
-
'currencies?type={type}': 1,
|
|
157461
|
-
'
|
|
157462
|
-
'markets/
|
|
157463
|
-
'
|
|
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,
|
|
157464
157629
|
},
|
|
157465
157630
|
},
|
|
157466
157631
|
},
|
|
@@ -157668,6 +157833,12 @@ class kuna extends _abstract_kuna_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
157668
157833
|
},
|
|
157669
157834
|
'precisionMode': _base_functions_number_js__WEBPACK_IMPORTED_MODULE_1__/* .TICK_SIZE */ .sh,
|
|
157670
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,
|
|
157671
157842
|
'2002': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InsufficientFunds,
|
|
157672
157843
|
'2003': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.OrderNotFound,
|
|
157673
157844
|
},
|
|
@@ -157681,109 +157852,206 @@ class kuna extends _abstract_kuna_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
157681
157852
|
* @method
|
|
157682
157853
|
* @name kuna#fetchTime
|
|
157683
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
|
|
157684
157856
|
* @param {object} [params] extra parameters specific to the kuna api endpoint
|
|
157685
157857
|
* @returns {int} the current integer timestamp in milliseconds from the exchange server
|
|
157686
157858
|
*/
|
|
157687
|
-
const response = await this.
|
|
157859
|
+
const response = await this.v4PublicGetPublicTimestamp(params);
|
|
157860
|
+
//
|
|
157861
|
+
// {
|
|
157862
|
+
// "data": {
|
|
157863
|
+
// "timestamp": 1686740531,
|
|
157864
|
+
// "timestamp_miliseconds": 1686740531725,
|
|
157865
|
+
// }
|
|
157866
|
+
// }
|
|
157688
157867
|
//
|
|
157689
|
-
|
|
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
|
+
// }
|
|
157690
157904
|
//
|
|
157691
|
-
|
|
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) {
|
|
157918
|
+
//
|
|
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
|
+
// }
|
|
157937
|
+
//
|
|
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
|
+
};
|
|
157692
157965
|
}
|
|
157693
157966
|
async fetchMarkets(params = {}) {
|
|
157694
157967
|
/**
|
|
157695
157968
|
* @method
|
|
157696
157969
|
* @name kuna#fetchMarkets
|
|
157697
157970
|
* @description retrieves data on all markets for kuna
|
|
157971
|
+
* @see https://docs.kuna.io/docs/get-all-traded-markets
|
|
157698
157972
|
* @param {object} [params] extra parameters specific to the exchange api endpoint
|
|
157699
157973
|
* @returns {object[]} an array of objects representing market data
|
|
157700
157974
|
*/
|
|
157701
|
-
const
|
|
157702
|
-
const markets = [];
|
|
157703
|
-
const response = await this.publicGetTickers(params);
|
|
157975
|
+
const response = await this.v4PublicGetMarketsPublicGetAll(params);
|
|
157704
157976
|
//
|
|
157705
157977
|
// {
|
|
157706
|
-
//
|
|
157707
|
-
//
|
|
157708
|
-
//
|
|
157709
|
-
//
|
|
157710
|
-
//
|
|
157711
|
-
//
|
|
157712
|
-
//
|
|
157713
|
-
//
|
|
157714
|
-
//
|
|
157715
|
-
//
|
|
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
|
|
157716
157990
|
// }
|
|
157717
|
-
//
|
|
157991
|
+
// ]
|
|
157718
157992
|
// }
|
|
157719
157993
|
//
|
|
157720
|
-
const
|
|
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
|
-
|
|
157752
|
-
|
|
157753
|
-
|
|
157754
|
-
|
|
157755
|
-
|
|
157756
|
-
|
|
157757
|
-
|
|
157758
|
-
|
|
157759
|
-
|
|
157760
|
-
|
|
157761
|
-
|
|
157762
|
-
|
|
157763
|
-
|
|
157764
|
-
'
|
|
157765
|
-
|
|
157766
|
-
|
|
157767
|
-
|
|
157768
|
-
|
|
157769
|
-
|
|
157770
|
-
|
|
157771
|
-
|
|
157772
|
-
|
|
157773
|
-
|
|
157774
|
-
|
|
157775
|
-
|
|
157776
|
-
|
|
157777
|
-
|
|
157778
|
-
|
|
157779
|
-
|
|
157780
|
-
|
|
157781
|
-
},
|
|
157782
|
-
'created': undefined,
|
|
157783
|
-
'info': undefined,
|
|
157784
|
-
});
|
|
157785
|
-
}
|
|
157786
|
-
}
|
|
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
|
+
});
|
|
157787
158055
|
}
|
|
157788
158056
|
return markets;
|
|
157789
158057
|
}
|
|
@@ -157792,78 +158060,137 @@ class kuna extends _abstract_kuna_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
157792
158060
|
* @method
|
|
157793
158061
|
* @name kuna#fetchOrderBook
|
|
157794
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
|
|
157795
158064
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
157796
|
-
* @param {int} [limit]
|
|
158065
|
+
* @param {int} [limit] 5, 10, 20, 50, 100, 500, or 1000 (default)
|
|
157797
158066
|
* @param {object} [params] extra parameters specific to the kuna api endpoint
|
|
157798
158067
|
* @returns {object} A dictionary of [order book structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-book-structure} indexed by market symbols
|
|
157799
158068
|
*/
|
|
157800
158069
|
await this.loadMarkets();
|
|
157801
158070
|
const market = this.market(symbol);
|
|
157802
158071
|
const request = {
|
|
157803
|
-
'
|
|
158072
|
+
'pairs': market['id'],
|
|
157804
158073
|
};
|
|
157805
158074
|
if (limit !== undefined) {
|
|
157806
|
-
request['
|
|
158075
|
+
request['level'] = limit;
|
|
157807
158076
|
}
|
|
157808
|
-
const
|
|
157809
|
-
|
|
157810
|
-
|
|
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);
|
|
157811
158106
|
}
|
|
157812
158107
|
parseTicker(ticker, market = undefined) {
|
|
157813
|
-
|
|
157814
|
-
|
|
157815
|
-
|
|
157816
|
-
|
|
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');
|
|
157817
158124
|
return this.safeTicker({
|
|
157818
|
-
'
|
|
157819
|
-
'
|
|
157820
|
-
'
|
|
158125
|
+
'info': ticker,
|
|
158126
|
+
'symbol': this.safeSymbol(marketId, market),
|
|
158127
|
+
'timestamp': undefined,
|
|
158128
|
+
'datetime': undefined,
|
|
157821
158129
|
'high': this.safeString(ticker, 'high'),
|
|
157822
158130
|
'low': this.safeString(ticker, 'low'),
|
|
157823
|
-
'bid': this.safeString(ticker, '
|
|
157824
|
-
'
|
|
157825
|
-
'ask': this.safeString(ticker, 'sell'),
|
|
157826
|
-
'askVolume': undefined,
|
|
158131
|
+
'bid': this.safeString(ticker, 'bestBidPrice'),
|
|
158132
|
+
'ask': this.safeString(ticker, 'bestAskPrice'),
|
|
157827
158133
|
'vwap': undefined,
|
|
157828
158134
|
'open': this.safeString(ticker, 'open'),
|
|
157829
|
-
'close':
|
|
157830
|
-
'last':
|
|
158135
|
+
'close': undefined,
|
|
158136
|
+
'last': undefined,
|
|
157831
158137
|
'previousClose': undefined,
|
|
157832
|
-
'change':
|
|
157833
|
-
'percentage':
|
|
158138
|
+
'change': this.safeString(ticker, 'priceChange'),
|
|
158139
|
+
'percentage': this.safeString(ticker, 'percentagePriceChange'),
|
|
157834
158140
|
'average': undefined,
|
|
157835
|
-
'baseVolume': this.safeString(ticker, '
|
|
157836
|
-
'quoteVolume':
|
|
157837
|
-
'info': ticker,
|
|
158141
|
+
'baseVolume': this.safeString(ticker, 'baseVolume'),
|
|
158142
|
+
'quoteVolume': this.safeString(ticker, 'quoteVolume'),
|
|
157838
158143
|
}, market);
|
|
157839
158144
|
}
|
|
157840
158145
|
async fetchTickers(symbols = undefined, params = {}) {
|
|
157841
158146
|
/**
|
|
157842
158147
|
* @method
|
|
157843
158148
|
* @name kuna#fetchTickers
|
|
157844
|
-
* @description fetches price tickers for multiple markets, statistical calculations with the information calculated over the past 24 hours each market
|
|
157845
|
-
* @
|
|
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
|
|
157846
158152
|
* @param {object} [params] extra parameters specific to the kuna api endpoint
|
|
157847
158153
|
* @returns {object} a dictionary of [ticker structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#ticker-structure}
|
|
157848
158154
|
*/
|
|
157849
158155
|
await this.loadMarkets();
|
|
157850
|
-
symbols
|
|
157851
|
-
|
|
157852
|
-
const ids = Object.keys(response);
|
|
157853
|
-
const result = {};
|
|
157854
|
-
for (let i = 0; i < ids.length; i++) {
|
|
157855
|
-
const id = ids[i];
|
|
157856
|
-
const market = this.safeMarket(id);
|
|
157857
|
-
const symbol = market['symbol'];
|
|
157858
|
-
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');
|
|
157859
158158
|
}
|
|
157860
|
-
|
|
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);
|
|
157861
158187
|
}
|
|
157862
158188
|
async fetchTicker(symbol, params = {}) {
|
|
157863
158189
|
/**
|
|
157864
158190
|
* @method
|
|
157865
158191
|
* @name kuna#fetchTicker
|
|
157866
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
|
|
157867
158194
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
157868
158195
|
* @param {object} [params] extra parameters specific to the kuna api endpoint
|
|
157869
158196
|
* @returns {object} a [ticker structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#ticker-structure}
|
|
@@ -157871,13 +158198,36 @@ class kuna extends _abstract_kuna_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
157871
158198
|
await this.loadMarkets();
|
|
157872
158199
|
const market = this.market(symbol);
|
|
157873
158200
|
const request = {
|
|
157874
|
-
'
|
|
158201
|
+
'pairs': market['id'],
|
|
157875
158202
|
};
|
|
157876
|
-
const response = await this.
|
|
157877
|
-
|
|
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);
|
|
157878
158227
|
}
|
|
157879
158228
|
async fetchL3OrderBook(symbol, limit = undefined, params = {}) {
|
|
157880
158229
|
/**
|
|
158230
|
+
* TODO: double check
|
|
157881
158231
|
* @method
|
|
157882
158232
|
* @name kuna#fetchL3OrderBook
|
|
157883
158233
|
* @description fetches level 3 information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
@@ -157893,136 +158243,115 @@ class kuna extends _abstract_kuna_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
157893
158243
|
* @method
|
|
157894
158244
|
* @name kuna#fetchTrades
|
|
157895
158245
|
* @description get the list of most recent trades for a particular symbol
|
|
158246
|
+
* @see https://docs.kuna.io/docs/get-public-trades-book
|
|
157896
158247
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
157897
158248
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
157898
|
-
* @param {int} [limit]
|
|
158249
|
+
* @param {int} [limit] between 1 and 100, 25 by default
|
|
157899
158250
|
* @param {object} [params] extra parameters specific to the kuna api endpoint
|
|
157900
158251
|
* @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#public-trades}
|
|
157901
158252
|
*/
|
|
157902
158253
|
await this.loadMarkets();
|
|
157903
158254
|
const market = this.market(symbol);
|
|
157904
158255
|
const request = {
|
|
157905
|
-
'
|
|
158256
|
+
'pair': market['id'],
|
|
157906
158257
|
};
|
|
157907
|
-
|
|
158258
|
+
if (limit !== undefined) {
|
|
158259
|
+
request['limit'] = limit;
|
|
158260
|
+
}
|
|
158261
|
+
const response = await this.v4PublicGetTradePublicBookPairs(this.extend(request, params));
|
|
157908
158262
|
//
|
|
157909
|
-
//
|
|
157910
|
-
//
|
|
157911
|
-
//
|
|
157912
|
-
//
|
|
157913
|
-
//
|
|
157914
|
-
//
|
|
157915
|
-
//
|
|
157916
|
-
//
|
|
157917
|
-
//
|
|
157918
|
-
//
|
|
157919
|
-
//
|
|
157920
|
-
// ]
|
|
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
|
+
// }
|
|
157921
158274
|
//
|
|
157922
|
-
|
|
158275
|
+
const data = this.safeValue(response, 'data', {});
|
|
158276
|
+
return this.parseTrades(data, market, since, limit);
|
|
157923
158277
|
}
|
|
157924
158278
|
parseTrade(trade, market = undefined) {
|
|
157925
158279
|
//
|
|
157926
158280
|
// fetchTrades (public)
|
|
157927
158281
|
//
|
|
157928
|
-
//
|
|
157929
|
-
//
|
|
157930
|
-
//
|
|
157931
|
-
//
|
|
157932
|
-
//
|
|
157933
|
-
//
|
|
157934
|
-
//
|
|
157935
|
-
//
|
|
157936
|
-
//
|
|
157937
|
-
// }
|
|
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
|
+
// }
|
|
157938
158291
|
//
|
|
157939
|
-
// fetchMyTrades (private)
|
|
158292
|
+
// fetchMyTrades, fetchOrder (private)
|
|
157940
158293
|
//
|
|
157941
|
-
//
|
|
157942
|
-
//
|
|
157943
|
-
//
|
|
157944
|
-
//
|
|
157945
|
-
//
|
|
157946
|
-
//
|
|
157947
|
-
//
|
|
157948
|
-
//
|
|
157949
|
-
//
|
|
157950
|
-
//
|
|
157951
|
-
//
|
|
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
|
+
// }
|
|
157952
158307
|
//
|
|
157953
|
-
const
|
|
157954
|
-
|
|
157955
|
-
|
|
157956
|
-
|
|
157957
|
-
|
|
157958
|
-
|
|
157959
|
-
|
|
157960
|
-
const sideMap = {
|
|
157961
|
-
'ask': 'sell',
|
|
157962
|
-
'bid': 'buy',
|
|
157963
|
-
};
|
|
157964
|
-
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';
|
|
157965
158315
|
}
|
|
157966
|
-
const priceString = this.safeString(trade, 'price');
|
|
157967
|
-
const amountString = this.safeString(trade, 'volume');
|
|
157968
|
-
const costString = this.safeNumber(trade, 'funds');
|
|
157969
|
-
const orderId = this.safeString(trade, 'order_id');
|
|
157970
|
-
const id = this.safeString(trade, 'id');
|
|
157971
158316
|
return this.safeTrade({
|
|
157972
|
-
'id': id,
|
|
157973
158317
|
'info': trade,
|
|
157974
|
-
'
|
|
157975
|
-
'
|
|
157976
|
-
'
|
|
158318
|
+
'id': this.safeString(trade, 'id'),
|
|
158319
|
+
'symbol': this.safeSymbol(marketId, market),
|
|
158320
|
+
'timestamp': this.parse8601(datetime),
|
|
158321
|
+
'datetime': datetime,
|
|
157977
158322
|
'type': undefined,
|
|
157978
158323
|
'side': side,
|
|
157979
|
-
'order': orderId,
|
|
157980
|
-
'takerOrMaker':
|
|
157981
|
-
'price':
|
|
157982
|
-
'amount':
|
|
157983
|
-
'cost':
|
|
157984
|
-
'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
|
+
},
|
|
157985
158334
|
}, market);
|
|
157986
158335
|
}
|
|
157987
|
-
async fetchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
|
|
157988
|
-
/**
|
|
157989
|
-
* @method
|
|
157990
|
-
* @name kuna#fetchOHLCV
|
|
157991
|
-
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
157992
|
-
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
157993
|
-
* @param {string} timeframe the length of time each candle represents
|
|
157994
|
-
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
157995
|
-
* @param {int} [limit] the maximum amount of candles to fetch
|
|
157996
|
-
* @param {object} [params] extra parameters specific to the kuna api endpoint
|
|
157997
|
-
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
157998
|
-
*/
|
|
157999
|
-
await this.loadMarkets();
|
|
158000
|
-
const trades = await this.fetchTrades(symbol, since, limit, params);
|
|
158001
|
-
const ohlcvc = this.buildOHLCVC(trades, timeframe, since, limit);
|
|
158002
|
-
const result = [];
|
|
158003
|
-
for (let i = 0; i < ohlcvc.length; i++) {
|
|
158004
|
-
const ohlcv = ohlcvc[i];
|
|
158005
|
-
result.push([
|
|
158006
|
-
ohlcv[0],
|
|
158007
|
-
ohlcv[1],
|
|
158008
|
-
ohlcv[2],
|
|
158009
|
-
ohlcv[3],
|
|
158010
|
-
ohlcv[4],
|
|
158011
|
-
ohlcv[5],
|
|
158012
|
-
]);
|
|
158013
|
-
}
|
|
158014
|
-
return result;
|
|
158015
|
-
}
|
|
158016
158336
|
parseBalance(response) {
|
|
158017
|
-
|
|
158018
|
-
|
|
158019
|
-
|
|
158020
|
-
|
|
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];
|
|
158021
158350
|
const currencyId = this.safeString(balance, 'currency');
|
|
158022
158351
|
const code = this.safeCurrencyCode(currencyId);
|
|
158023
158352
|
const account = this.account();
|
|
158024
158353
|
account['free'] = this.safeString(balance, 'balance');
|
|
158025
|
-
account['used'] = this.safeString(balance, '
|
|
158354
|
+
account['used'] = this.safeString(balance, 'lockBalance');
|
|
158026
158355
|
result[code] = account;
|
|
158027
158356
|
}
|
|
158028
158357
|
return this.safeBalance(result);
|
|
@@ -158036,35 +158365,79 @@ class kuna extends _abstract_kuna_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
158036
158365
|
* @returns {object} a [balance structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#balance-structure}
|
|
158037
158366
|
*/
|
|
158038
158367
|
await this.loadMarkets();
|
|
158039
|
-
const response = await this.
|
|
158040
|
-
|
|
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);
|
|
158041
158380
|
}
|
|
158042
158381
|
async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
|
|
158043
158382
|
/**
|
|
158044
158383
|
* @method
|
|
158045
158384
|
* @name kuna#createOrder
|
|
158046
158385
|
* @description create a trade order
|
|
158386
|
+
* @see https://docs.kuna.io/docs/create-a-new-order-private
|
|
158047
158387
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
158048
158388
|
* @param {string} type 'market' or 'limit'
|
|
158049
158389
|
* @param {string} side 'buy' or 'sell'
|
|
158050
158390
|
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
158051
158391
|
* @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
158052
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
|
|
158053
158398
|
* @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
158054
158399
|
*/
|
|
158055
158400
|
await this.loadMarkets();
|
|
158056
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);
|
|
158057
158405
|
const request = {
|
|
158058
|
-
'
|
|
158059
|
-
'side':
|
|
158060
|
-
'
|
|
158061
|
-
'
|
|
158406
|
+
'pair': market['id'],
|
|
158407
|
+
'orderSide': (side === 'buy') ? 'Bid' : 'Ask',
|
|
158408
|
+
'quantity': amount.toString(),
|
|
158409
|
+
'type': capitalizedType,
|
|
158062
158410
|
};
|
|
158063
|
-
if (
|
|
158064
|
-
request['price'] =
|
|
158411
|
+
if (capitalizedType === 'Limit') {
|
|
158412
|
+
request['price'] = this.priceToPrecision(market['symbol'], price);
|
|
158065
158413
|
}
|
|
158066
|
-
|
|
158067
|
-
|
|
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);
|
|
158068
158441
|
}
|
|
158069
158442
|
async cancelOrder(id, symbol = undefined, params = {}) {
|
|
158070
158443
|
/**
|
|
@@ -158072,24 +158445,66 @@ class kuna extends _abstract_kuna_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
158072
158445
|
* @name kuna#cancelOrder
|
|
158073
158446
|
* @description cancels an open order
|
|
158074
158447
|
* @param {string} id order id
|
|
158075
|
-
* @param {string} symbol
|
|
158448
|
+
* @param {string} symbol unified market symbol
|
|
158076
158449
|
* @param {object} [params] extra parameters specific to the kuna api endpoint
|
|
158077
158450
|
* @returns {object} An [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
158078
158451
|
*/
|
|
158079
158452
|
await this.loadMarkets();
|
|
158080
158453
|
const request = {
|
|
158081
|
-
'
|
|
158454
|
+
'orderId': id,
|
|
158082
158455
|
};
|
|
158083
|
-
const response = await this.
|
|
158084
|
-
|
|
158085
|
-
|
|
158086
|
-
|
|
158087
|
-
|
|
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);
|
|
158088
158468
|
}
|
|
158469
|
+
const order = this.parseOrder(data, market);
|
|
158470
|
+
order['id'] = id;
|
|
158089
158471
|
return order;
|
|
158090
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
|
+
}
|
|
158091
158502
|
parseOrderStatus(status) {
|
|
158092
158503
|
const statuses = {
|
|
158504
|
+
'Canceled': 'canceled',
|
|
158505
|
+
'Closed': 'filled',
|
|
158506
|
+
'Pending': 'open',
|
|
158507
|
+
'Open': 'open',
|
|
158093
158508
|
'done': 'closed',
|
|
158094
158509
|
'wait': 'open',
|
|
158095
158510
|
'cancel': 'canceled',
|
|
@@ -158097,36 +158512,81 @@ class kuna extends _abstract_kuna_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
158097
158512
|
return this.safeString(statuses, status, status);
|
|
158098
158513
|
}
|
|
158099
158514
|
parseOrder(order, market = undefined) {
|
|
158100
|
-
|
|
158101
|
-
|
|
158102
|
-
|
|
158103
|
-
|
|
158104
|
-
|
|
158105
|
-
|
|
158106
|
-
|
|
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', []);
|
|
158107
158567
|
return this.safeOrder({
|
|
158108
|
-
'
|
|
158568
|
+
'info': order,
|
|
158569
|
+
'id': this.safeString2(order, 'id', 'orderId'),
|
|
158109
158570
|
'clientOrderId': undefined,
|
|
158110
|
-
'
|
|
158111
|
-
'
|
|
158112
|
-
'
|
|
158113
|
-
'
|
|
158114
|
-
'
|
|
158115
|
-
'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'),
|
|
158116
158577
|
'timeInForce': undefined,
|
|
158117
158578
|
'postOnly': undefined,
|
|
158118
158579
|
'side': side,
|
|
158119
158580
|
'price': this.safeString(order, 'price'),
|
|
158120
|
-
'stopPrice':
|
|
158121
|
-
'triggerPrice':
|
|
158122
|
-
'amount': this.safeString(order, '
|
|
158123
|
-
'filled': this.safeString(order, '
|
|
158124
|
-
'remaining':
|
|
158125
|
-
'trades':
|
|
158126
|
-
'
|
|
158127
|
-
'info': order,
|
|
158128
|
-
'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'),
|
|
158129
158588
|
'average': undefined,
|
|
158589
|
+
'fee': undefined,
|
|
158130
158590
|
}, market);
|
|
158131
158591
|
}
|
|
158132
158592
|
async fetchOrder(id, symbol = undefined, params = {}) {
|
|
@@ -158134,78 +158594,656 @@ class kuna extends _abstract_kuna_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
158134
158594
|
* @method
|
|
158135
158595
|
* @name kuna#fetchOrder
|
|
158136
158596
|
* @description fetches information on an order made by the user
|
|
158597
|
+
* @see https://docs.kuna.io/docs/get-order-details-by-id
|
|
158137
158598
|
* @param {string} symbol not used by kuna fetchOrder
|
|
158138
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
|
|
158139
158603
|
* @returns {object} An [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
158140
158604
|
*/
|
|
158141
158605
|
await this.loadMarkets();
|
|
158142
158606
|
const request = {
|
|
158143
|
-
'id':
|
|
158607
|
+
'id': id,
|
|
158608
|
+
'withTrades': true,
|
|
158144
158609
|
};
|
|
158145
|
-
const response = await this.
|
|
158146
|
-
|
|
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);
|
|
158147
158647
|
}
|
|
158148
158648
|
async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
158149
158649
|
/**
|
|
158150
158650
|
* @method
|
|
158151
158651
|
* @name kuna#fetchOpenOrders
|
|
158152
158652
|
* @description fetch all unfilled currently open orders
|
|
158653
|
+
* @see https://docs.kuna.io/docs/get-active-client-orders-private
|
|
158153
158654
|
* @param {string} symbol unified market symbol
|
|
158154
158655
|
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
158155
|
-
* @param {int} [limit] the maximum number of
|
|
158656
|
+
* @param {int} [limit] 1-100, the maximum number of open orders structures to retrieve
|
|
158156
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)
|
|
158157
158662
|
* @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
158158
158663
|
*/
|
|
158159
|
-
|
|
158160
|
-
|
|
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);
|
|
158161
158675
|
}
|
|
158676
|
+
if (limit !== undefined) {
|
|
158677
|
+
request['limit'] = limit;
|
|
158678
|
+
}
|
|
158679
|
+
if (until !== undefined) {
|
|
158680
|
+
request['end'] = this.iso8601(until);
|
|
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
|
+
*/
|
|
158162
158742
|
await this.loadMarkets();
|
|
158163
|
-
|
|
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;
|
|
158164
158749
|
const request = {
|
|
158165
|
-
'
|
|
158750
|
+
'status': this.capitalize(status),
|
|
158166
158751
|
};
|
|
158167
|
-
|
|
158168
|
-
|
|
158169
|
-
|
|
158170
|
-
|
|
158171
|
-
|
|
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);
|
|
158172
158790
|
}
|
|
158173
158791
|
async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
158174
158792
|
/**
|
|
158175
158793
|
* @method
|
|
158176
158794
|
* @name kuna#fetchMyTrades
|
|
158177
158795
|
* @description fetch all trades made by the user
|
|
158796
|
+
* @see https://docs.kuna.io/docs/get-private-trades-history
|
|
158178
158797
|
* @param {string} symbol unified market symbol
|
|
158179
|
-
* @param {int} [since]
|
|
158180
|
-
* @param {int} [limit]
|
|
158798
|
+
* @param {int} [since] not used by kuna fetchMyTrades
|
|
158799
|
+
* @param {int} [limit] not used by kuna fetchMyTrades
|
|
158181
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)
|
|
158182
158805
|
* @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
|
|
158183
158806
|
*/
|
|
158184
|
-
|
|
158185
|
-
|
|
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'];
|
|
158186
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']);
|
|
158187
158858
|
await this.loadMarkets();
|
|
158188
|
-
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);
|
|
158189
158869
|
const request = {
|
|
158190
|
-
'
|
|
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).
|
|
158191
158874
|
};
|
|
158192
|
-
|
|
158875
|
+
if (tag !== undefined) {
|
|
158876
|
+
request['paymentId'] = tag;
|
|
158877
|
+
}
|
|
158878
|
+
const response = await this.v4PrivatePostWithdrawPrivateCreate(this.extend(request, params));
|
|
158193
158879
|
//
|
|
158194
|
-
//
|
|
158195
|
-
//
|
|
158196
|
-
//
|
|
158197
|
-
//
|
|
158198
|
-
//
|
|
158199
|
-
//
|
|
158200
|
-
// "market":"dogeusdt",
|
|
158201
|
-
// "created_at":"2022-04-12T18:58:44Z",
|
|
158202
|
-
// "side":"ask",
|
|
158203
|
-
// "order_id":1665670371,
|
|
158204
|
-
// "trend":"buy"
|
|
158205
|
-
// },
|
|
158206
|
-
// ]
|
|
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
|
+
// }
|
|
158207
158886
|
//
|
|
158208
|
-
|
|
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
|
+
};
|
|
158209
159247
|
}
|
|
158210
159248
|
nonce() {
|
|
158211
159249
|
return this.milliseconds();
|
|
@@ -158230,11 +159268,12 @@ class kuna extends _abstract_kuna_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
158230
159268
|
sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
158231
159269
|
let url = undefined;
|
|
158232
159270
|
if (Array.isArray(api)) {
|
|
159271
|
+
const isGet = method === 'GET';
|
|
158233
159272
|
const [version, access] = api;
|
|
158234
159273
|
if (version === 'v3') {
|
|
158235
159274
|
url = this.urls['api'][version] + '/' + version + '/' + this.implodeParams(path, params);
|
|
158236
159275
|
if (access === 'public') {
|
|
158237
|
-
if (
|
|
159276
|
+
if (isGet) {
|
|
158238
159277
|
if (Object.keys(params).length) {
|
|
158239
159278
|
url += '?' + this.urlencode(params);
|
|
158240
159279
|
}
|
|
@@ -158249,35 +159288,39 @@ class kuna extends _abstract_kuna_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
158249
159288
|
}
|
|
158250
159289
|
}
|
|
158251
159290
|
else if (version === 'v4') {
|
|
158252
|
-
const
|
|
158253
|
-
|
|
158254
|
-
|
|
158255
|
-
if (
|
|
158256
|
-
|
|
158257
|
-
|
|
158258
|
-
|
|
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);
|
|
158259
159299
|
}
|
|
158260
|
-
urlPath = '/' + version + '/' + splitPath[0] + '/' + access + '/' + this.implodeParams(pathTail, params);
|
|
158261
159300
|
}
|
|
158262
|
-
else {
|
|
158263
|
-
urlPath = '/' + version + '/' + access + '/' + this.implodeParams(path, params);
|
|
158264
|
-
}
|
|
158265
|
-
url = this.urls['api'][version] + urlPath;
|
|
158266
159301
|
if (access === 'private') {
|
|
158267
|
-
const nonce = this.nonce();
|
|
158268
|
-
|
|
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
|
+
}
|
|
158269
159311
|
headers = {
|
|
158270
|
-
'
|
|
159312
|
+
'Content-Type': 'application/json',
|
|
158271
159313
|
'accept': 'application/json',
|
|
158272
159314
|
'nonce': nonce,
|
|
158273
159315
|
'public-key': this.apiKey,
|
|
158274
|
-
'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'),
|
|
158275
159317
|
};
|
|
158276
159318
|
const account = this.safeString(this.options, 'account');
|
|
158277
159319
|
if (account === 'pro') {
|
|
158278
159320
|
headers['account'] = 'pro';
|
|
158279
159321
|
}
|
|
158280
159322
|
}
|
|
159323
|
+
url = this.urls['api'][version] + urlPath;
|
|
158281
159324
|
}
|
|
158282
159325
|
}
|
|
158283
159326
|
else {
|
|
@@ -158300,7 +159343,7 @@ class kuna extends _abstract_kuna_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
158300
159343
|
'tonce': nonce,
|
|
158301
159344
|
}, params));
|
|
158302
159345
|
const auth = method + '|' + request + '|' + queryInner;
|
|
158303
|
-
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);
|
|
158304
159347
|
const suffix = query + '&signature=' + signed;
|
|
158305
159348
|
if (method === 'GET') {
|
|
158306
159349
|
url += '?' + suffix;
|
|
@@ -158311,18 +159354,37 @@ class kuna extends _abstract_kuna_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
158311
159354
|
}
|
|
158312
159355
|
}
|
|
158313
159356
|
}
|
|
159357
|
+
if (body !== undefined) {
|
|
159358
|
+
body = JSON.stringify(body);
|
|
159359
|
+
}
|
|
158314
159360
|
return { 'url': url, 'method': method, 'body': body, 'headers': headers };
|
|
158315
159361
|
}
|
|
158316
159362
|
handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
|
|
158317
|
-
|
|
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)) {
|
|
158318
159377
|
return undefined;
|
|
158319
159378
|
}
|
|
158320
|
-
if (code === 400) {
|
|
158321
|
-
|
|
159379
|
+
if ((errors !== undefined) || (code === 400)) {
|
|
159380
|
+
let error = this.safeValue(errors, 0);
|
|
159381
|
+
if (error === undefined) {
|
|
159382
|
+
error = this.safeValue(response, 'error');
|
|
159383
|
+
}
|
|
158322
159384
|
const errorCode = this.safeString(error, 'code');
|
|
158323
159385
|
const feedback = this.id + ' ' + this.json(response);
|
|
158324
159386
|
this.throwExactlyMatchedException(this.exceptions, errorCode, feedback);
|
|
158325
|
-
|
|
159387
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError(feedback);
|
|
158326
159388
|
}
|
|
158327
159389
|
return undefined;
|
|
158328
159390
|
}
|
|
@@ -158363,8 +159425,8 @@ class latoken extends _abstract_latoken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
158363
159425
|
'CORS': undefined,
|
|
158364
159426
|
'spot': true,
|
|
158365
159427
|
'margin': false,
|
|
158366
|
-
'swap':
|
|
158367
|
-
'future':
|
|
159428
|
+
'swap': false,
|
|
159429
|
+
'future': false,
|
|
158368
159430
|
'option': false,
|
|
158369
159431
|
'cancelAllOrders': true,
|
|
158370
159432
|
'cancelOrder': true,
|
|
@@ -264891,7 +265953,7 @@ class wazirx extends _abstract_wazirx_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
264891
265953
|
'has': {
|
|
264892
265954
|
'CORS': false,
|
|
264893
265955
|
'spot': true,
|
|
264894
|
-
'margin':
|
|
265956
|
+
'margin': false,
|
|
264895
265957
|
'swap': false,
|
|
264896
265958
|
'future': false,
|
|
264897
265959
|
'option': false,
|
|
@@ -280256,7 +281318,7 @@ SOFTWARE.
|
|
|
280256
281318
|
|
|
280257
281319
|
//-----------------------------------------------------------------------------
|
|
280258
281320
|
// this is updated by vss.js when building
|
|
280259
|
-
const version = '4.1.
|
|
281321
|
+
const version = '4.1.37';
|
|
280260
281322
|
_src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange.ccxtVersion */ .e.ccxtVersion = version;
|
|
280261
281323
|
//-----------------------------------------------------------------------------
|
|
280262
281324
|
|