ccxt 4.1.3 → 4.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/ccxt.browser.js +206 -31
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +3 -0
- package/dist/cjs/src/coinex.js +1 -1
- package/dist/cjs/src/coinsph.js +1 -2
- package/dist/cjs/src/idex.js +1 -1
- package/dist/cjs/src/kraken.js +38 -6
- package/dist/cjs/src/kucoinfutures.js +1 -1
- package/dist/cjs/src/kuna.js +97 -10
- package/dist/cjs/src/okx.js +37 -0
- package/dist/cjs/src/pro/bitget.js +22 -6
- package/dist/cjs/src/whitebit.js +1 -1
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/kuna.d.ts +34 -0
- package/js/src/base/Exchange.js +3 -0
- package/js/src/coinex.js +1 -1
- package/js/src/coinsph.js +1 -2
- package/js/src/idex.js +1 -1
- package/js/src/kraken.d.ts +1 -1
- package/js/src/kraken.js +38 -6
- package/js/src/kucoinfutures.js +1 -1
- package/js/src/kuna.d.ts +1 -0
- package/js/src/kuna.js +97 -10
- package/js/src/okx.js +37 -0
- package/js/src/pro/bitget.d.ts +5 -0
- package/js/src/pro/bitget.js +22 -6
- package/js/src/whitebit.js +1 -1
- package/package.json +1 -1
package/dist/cjs/ccxt.js
CHANGED
|
@@ -179,7 +179,7 @@ var woo$1 = require('./src/pro/woo.js');
|
|
|
179
179
|
|
|
180
180
|
//-----------------------------------------------------------------------------
|
|
181
181
|
// this is updated by vss.js when building
|
|
182
|
-
const version = '4.1.
|
|
182
|
+
const version = '4.1.5';
|
|
183
183
|
Exchange["default"].ccxtVersion = version;
|
|
184
184
|
const exchanges = {
|
|
185
185
|
'ace': ace,
|
|
@@ -1680,6 +1680,9 @@ class Exchange {
|
|
|
1680
1680
|
if (!tradesAreParsed) {
|
|
1681
1681
|
trades = this.parseTrades(rawTrades, market);
|
|
1682
1682
|
}
|
|
1683
|
+
else {
|
|
1684
|
+
trades = rawTrades;
|
|
1685
|
+
}
|
|
1683
1686
|
this.number = oldNumber;
|
|
1684
1687
|
let tradesLength = 0;
|
|
1685
1688
|
const isArray = Array.isArray(trades);
|
package/dist/cjs/src/coinex.js
CHANGED
package/dist/cjs/src/coinsph.js
CHANGED
|
@@ -540,7 +540,6 @@ class coinsph extends coinsph$1 {
|
|
|
540
540
|
const quoteId = this.safeString(market, 'quoteAsset');
|
|
541
541
|
const base = this.safeCurrencyCode(baseId);
|
|
542
542
|
const quote = this.safeCurrencyCode(quoteId);
|
|
543
|
-
const isActive = this.safeString(market, 'status') === 'TRADING';
|
|
544
543
|
const limits = this.indexBy(this.safeValue(market, 'filters'), 'filterType');
|
|
545
544
|
const amountLimits = this.safeValue(limits, 'LOT_SIZE', {});
|
|
546
545
|
const priceLimits = this.safeValue(limits, 'PRICE_FILTER', {});
|
|
@@ -560,7 +559,7 @@ class coinsph extends coinsph$1 {
|
|
|
560
559
|
'swap': false,
|
|
561
560
|
'future': false,
|
|
562
561
|
'option': false,
|
|
563
|
-
'active':
|
|
562
|
+
'active': this.safeStringLower(market, 'status') === 'trading',
|
|
564
563
|
'contract': false,
|
|
565
564
|
'linear': undefined,
|
|
566
565
|
'inverse': undefined,
|
package/dist/cjs/src/idex.js
CHANGED
|
@@ -1516,7 +1516,7 @@ class idex extends idex$1 {
|
|
|
1516
1516
|
//
|
|
1517
1517
|
// { serverTime: '1655258263236' }
|
|
1518
1518
|
//
|
|
1519
|
-
return this.
|
|
1519
|
+
return this.safeInteger(response, 'serverTime');
|
|
1520
1520
|
}
|
|
1521
1521
|
async fetchWithdrawal(id, code = undefined, params = {}) {
|
|
1522
1522
|
/**
|
package/dist/cjs/src/kraken.js
CHANGED
|
@@ -355,6 +355,7 @@ class kraken extends kraken$1 {
|
|
|
355
355
|
* @method
|
|
356
356
|
* @name kraken#fetchMarkets
|
|
357
357
|
* @description retrieves data on all markets for kraken
|
|
358
|
+
* @see https://docs.kraken.com/rest/#tag/Market-Data/operation/getTradableAssetPairs
|
|
358
359
|
* @param {object} [params] extra parameters specific to the exchange api endpoint
|
|
359
360
|
* @returns {object[]} an array of objects representing market data
|
|
360
361
|
*/
|
|
@@ -540,6 +541,7 @@ class kraken extends kraken$1 {
|
|
|
540
541
|
* @method
|
|
541
542
|
* @name kraken#fetchCurrencies
|
|
542
543
|
* @description fetches all available currencies on an exchange
|
|
544
|
+
* @see https://docs.kraken.com/rest/#tag/Market-Data/operation/getAssetInfo
|
|
543
545
|
* @param {object} [params] extra parameters specific to the kraken api endpoint
|
|
544
546
|
* @returns {object} an associative dictionary of currencies
|
|
545
547
|
*/
|
|
@@ -598,6 +600,7 @@ class kraken extends kraken$1 {
|
|
|
598
600
|
* @method
|
|
599
601
|
* @name kraken#fetchTradingFee
|
|
600
602
|
* @description fetch the trading fees for a market
|
|
603
|
+
* @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getTradeVolume
|
|
601
604
|
* @param {string} symbol unified market symbol
|
|
602
605
|
* @param {object} [params] extra parameters specific to the kraken api endpoint
|
|
603
606
|
* @returns {object} a [fee structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#fee-structure}
|
|
@@ -666,6 +669,7 @@ class kraken extends kraken$1 {
|
|
|
666
669
|
* @method
|
|
667
670
|
* @name kraken#fetchOrderBook
|
|
668
671
|
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
672
|
+
* @see https://docs.kraken.com/rest/#tag/Market-Data/operation/getOrderBook
|
|
669
673
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
670
674
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
671
675
|
* @param {object} [params] extra parameters specific to the kraken api endpoint
|
|
@@ -768,6 +772,7 @@ class kraken extends kraken$1 {
|
|
|
768
772
|
* @method
|
|
769
773
|
* @name kraken#fetchTickers
|
|
770
774
|
* @description fetches price tickers for multiple markets, statistical calculations with the information calculated over the past 24 hours each market
|
|
775
|
+
* @see https://docs.kraken.com/rest/#tag/Market-Data/operation/getTickerInformation
|
|
771
776
|
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
772
777
|
* @param {object} [params] extra parameters specific to the kraken api endpoint
|
|
773
778
|
* @returns {object} a dictionary of [ticker structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#ticker-structure}
|
|
@@ -804,6 +809,7 @@ class kraken extends kraken$1 {
|
|
|
804
809
|
* @method
|
|
805
810
|
* @name kraken#fetchTicker
|
|
806
811
|
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
812
|
+
* @see https://docs.kraken.com/rest/#tag/Market-Data/operation/getTickerInformation
|
|
807
813
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
808
814
|
* @param {object} [params] extra parameters specific to the kraken api endpoint
|
|
809
815
|
* @returns {object} a [ticker structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#ticker-structure}
|
|
@@ -848,6 +854,7 @@ class kraken extends kraken$1 {
|
|
|
848
854
|
* @method
|
|
849
855
|
* @name kraken#fetchOHLCV
|
|
850
856
|
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
857
|
+
* @see https://docs.kraken.com/rest/#tag/Market-Data/operation/getOHLCData
|
|
851
858
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
852
859
|
* @param {string} timeframe the length of time each candle represents
|
|
853
860
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
@@ -929,11 +936,7 @@ class kraken extends kraken$1 {
|
|
|
929
936
|
else {
|
|
930
937
|
direction = 'in';
|
|
931
938
|
}
|
|
932
|
-
const
|
|
933
|
-
let timestamp = undefined;
|
|
934
|
-
if (time !== undefined) {
|
|
935
|
-
timestamp = this.parseToInt(time * 1000);
|
|
936
|
-
}
|
|
939
|
+
const timestamp = this.safeIntegerProduct(item, 'time', 1000);
|
|
937
940
|
return {
|
|
938
941
|
'info': item,
|
|
939
942
|
'id': id,
|
|
@@ -960,6 +963,7 @@ class kraken extends kraken$1 {
|
|
|
960
963
|
* @method
|
|
961
964
|
* @name kraken#fetchLedger
|
|
962
965
|
* @description fetch the history of changes, actions done by the user or operations that altered balance of the user
|
|
966
|
+
* @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getLedgers
|
|
963
967
|
* @param {string} code unified currency code, default is undefined
|
|
964
968
|
* @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
|
|
965
969
|
* @param {int} [limit] max number of ledger entrys to return, default is undefined
|
|
@@ -1138,6 +1142,7 @@ class kraken extends kraken$1 {
|
|
|
1138
1142
|
* @method
|
|
1139
1143
|
* @name kraken#fetchTrades
|
|
1140
1144
|
* @description get the list of most recent trades for a particular symbol
|
|
1145
|
+
* @see https://docs.kraken.com/rest/#tag/Market-Data/operation/getRecentTrades
|
|
1141
1146
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
1142
1147
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
1143
1148
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
@@ -1211,6 +1216,7 @@ class kraken extends kraken$1 {
|
|
|
1211
1216
|
* @method
|
|
1212
1217
|
* @name kraken#fetchBalance
|
|
1213
1218
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
1219
|
+
* @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getAccountBalance
|
|
1214
1220
|
* @param {object} [params] extra parameters specific to the kraken api endpoint
|
|
1215
1221
|
* @returns {object} a [balance structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#balance-structure}
|
|
1216
1222
|
*/
|
|
@@ -1454,6 +1460,16 @@ class kraken extends kraken$1 {
|
|
|
1454
1460
|
}
|
|
1455
1461
|
const clientOrderId = this.safeString(order, 'userref');
|
|
1456
1462
|
const rawTrades = this.safeValue(order, 'trades');
|
|
1463
|
+
const trades = [];
|
|
1464
|
+
for (let i = 0; i < rawTrades.length; i++) {
|
|
1465
|
+
const rawTrade = rawTrades[i];
|
|
1466
|
+
if (typeof rawTrade === 'string') {
|
|
1467
|
+
trades.push(this.safeTrade({ 'id': rawTrade, 'orderId': id, 'symbol': symbol, 'info': {} }));
|
|
1468
|
+
}
|
|
1469
|
+
else {
|
|
1470
|
+
trades.push(rawTrade);
|
|
1471
|
+
}
|
|
1472
|
+
}
|
|
1457
1473
|
stopPrice = this.safeNumber(order, 'stopprice', stopPrice);
|
|
1458
1474
|
return this.safeOrder({
|
|
1459
1475
|
'id': id,
|
|
@@ -1477,7 +1493,7 @@ class kraken extends kraken$1 {
|
|
|
1477
1493
|
'average': average,
|
|
1478
1494
|
'remaining': undefined,
|
|
1479
1495
|
'fee': fee,
|
|
1480
|
-
'trades':
|
|
1496
|
+
'trades': trades,
|
|
1481
1497
|
}, market);
|
|
1482
1498
|
}
|
|
1483
1499
|
orderRequest(method, symbol, type, request, price = undefined, params = {}) {
|
|
@@ -1613,6 +1629,7 @@ class kraken extends kraken$1 {
|
|
|
1613
1629
|
* @method
|
|
1614
1630
|
* @name kraken#fetchOrder
|
|
1615
1631
|
* @description fetches information on an order made by the user
|
|
1632
|
+
* @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getOrdersInfo
|
|
1616
1633
|
* @param {string} symbol not used by kraken fetchOrder
|
|
1617
1634
|
* @param {object} [params] extra parameters specific to the kraken api endpoint
|
|
1618
1635
|
* @returns {object} An [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
@@ -1682,6 +1699,7 @@ class kraken extends kraken$1 {
|
|
|
1682
1699
|
* @method
|
|
1683
1700
|
* @name kraken#fetchOrderTrades
|
|
1684
1701
|
* @description fetch all the trades made from a single order
|
|
1702
|
+
* @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getTradesInfo
|
|
1685
1703
|
* @param {string} id order id
|
|
1686
1704
|
* @param {string} symbol unified market symbol
|
|
1687
1705
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
@@ -1781,6 +1799,7 @@ class kraken extends kraken$1 {
|
|
|
1781
1799
|
* @method
|
|
1782
1800
|
* @name kraken#fetchMyTrades
|
|
1783
1801
|
* @description fetch all trades made by the user
|
|
1802
|
+
* @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getTradeHistory
|
|
1784
1803
|
* @param {string} symbol unified market symbol
|
|
1785
1804
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
1786
1805
|
* @param {int} [limit] the maximum number of trades structures to retrieve
|
|
@@ -1840,6 +1859,7 @@ class kraken extends kraken$1 {
|
|
|
1840
1859
|
* @method
|
|
1841
1860
|
* @name kraken#cancelOrder
|
|
1842
1861
|
* @description cancels an open order
|
|
1862
|
+
* @see https://docs.kraken.com/rest/#tag/Trading/operation/cancelOrder
|
|
1843
1863
|
* @param {string} id order id
|
|
1844
1864
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
1845
1865
|
* @param {object} [params] extra parameters specific to the kraken api endpoint
|
|
@@ -1870,6 +1890,7 @@ class kraken extends kraken$1 {
|
|
|
1870
1890
|
* @method
|
|
1871
1891
|
* @name kraken#cancelOrders
|
|
1872
1892
|
* @description cancel multiple orders
|
|
1893
|
+
* @see https://docs.kraken.com/rest/#tag/Trading/operation/cancelOrderBatch
|
|
1873
1894
|
* @param {string[]} ids open orders transaction ID (txid) or user reference (userref)
|
|
1874
1895
|
* @param {string} symbol unified market symbol
|
|
1875
1896
|
* @param {object} [params] extra parameters specific to the kraken api endpoint
|
|
@@ -1894,6 +1915,7 @@ class kraken extends kraken$1 {
|
|
|
1894
1915
|
* @method
|
|
1895
1916
|
* @name kraken#cancelAllOrders
|
|
1896
1917
|
* @description cancel all open orders
|
|
1918
|
+
* @see https://docs.kraken.com/rest/#tag/Trading/operation/cancelAllOrders
|
|
1897
1919
|
* @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
|
|
1898
1920
|
* @param {object} [params] extra parameters specific to the kraken api endpoint
|
|
1899
1921
|
* @returns {object[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
@@ -1906,6 +1928,7 @@ class kraken extends kraken$1 {
|
|
|
1906
1928
|
* @method
|
|
1907
1929
|
* @name kraken#fetchOpenOrders
|
|
1908
1930
|
* @description fetch all unfilled currently open orders
|
|
1931
|
+
* @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getOpenOrders
|
|
1909
1932
|
* @param {string} symbol unified market symbol
|
|
1910
1933
|
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
1911
1934
|
* @param {int} [limit] the maximum number of open orders structures to retrieve
|
|
@@ -1937,6 +1960,7 @@ class kraken extends kraken$1 {
|
|
|
1937
1960
|
* @method
|
|
1938
1961
|
* @name kraken#fetchClosedOrders
|
|
1939
1962
|
* @description fetches information on multiple closed orders made by the user
|
|
1963
|
+
* @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getClosedOrders
|
|
1940
1964
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
1941
1965
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
1942
1966
|
* @param {int} [limit] the maximum number of orde structures to retrieve
|
|
@@ -2134,6 +2158,7 @@ class kraken extends kraken$1 {
|
|
|
2134
2158
|
* @method
|
|
2135
2159
|
* @name kraken#fetchDeposits
|
|
2136
2160
|
* @description fetch all deposits made to an account
|
|
2161
|
+
* @see https://docs.kraken.com/rest/#tag/Funding/operation/getStatusRecentDeposits
|
|
2137
2162
|
* @param {string} code unified currency code
|
|
2138
2163
|
* @param {int} [since] the earliest time in ms to fetch deposits for
|
|
2139
2164
|
* @param {int} [limit] the maximum number of deposits structures to retrieve
|
|
@@ -2170,6 +2195,7 @@ class kraken extends kraken$1 {
|
|
|
2170
2195
|
* @method
|
|
2171
2196
|
* @name kraken#fetchTime
|
|
2172
2197
|
* @description fetches the current integer timestamp in milliseconds from the exchange server
|
|
2198
|
+
* @see https://docs.kraken.com/rest/#tag/Market-Data/operation/getServerTime
|
|
2173
2199
|
* @param {object} [params] extra parameters specific to the kraken api endpoint
|
|
2174
2200
|
* @returns {int} the current integer timestamp in milliseconds from the exchange server
|
|
2175
2201
|
*/
|
|
@@ -2192,6 +2218,7 @@ class kraken extends kraken$1 {
|
|
|
2192
2218
|
* @method
|
|
2193
2219
|
* @name kraken#fetchWithdrawals
|
|
2194
2220
|
* @description fetch all withdrawals made from an account
|
|
2221
|
+
* @see https://docs.kraken.com/rest/#tag/Funding/operation/getStatusRecentWithdrawals
|
|
2195
2222
|
* @param {string} code unified currency code
|
|
2196
2223
|
* @param {int} [since] the earliest time in ms to fetch withdrawals for
|
|
2197
2224
|
* @param {int} [limit] the maximum number of withdrawals structures to retrieve
|
|
@@ -2228,6 +2255,7 @@ class kraken extends kraken$1 {
|
|
|
2228
2255
|
* @method
|
|
2229
2256
|
* @name kraken#createDepositAddress
|
|
2230
2257
|
* @description create a currency deposit address
|
|
2258
|
+
* @see https://docs.kraken.com/rest/#tag/Funding/operation/getDepositAddresses
|
|
2231
2259
|
* @param {string} code unified currency code of the currency for the deposit address
|
|
2232
2260
|
* @param {object} [params] extra parameters specific to the kraken api endpoint
|
|
2233
2261
|
* @returns {object} an [address structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#address-structure}
|
|
@@ -2274,6 +2302,7 @@ class kraken extends kraken$1 {
|
|
|
2274
2302
|
* @method
|
|
2275
2303
|
* @name kraken#fetchDepositAddress
|
|
2276
2304
|
* @description fetch the deposit address for a currency associated with this account
|
|
2305
|
+
* @see https://docs.kraken.com/rest/#tag/Funding/operation/getDepositAddresses
|
|
2277
2306
|
* @param {string} code unified currency code
|
|
2278
2307
|
* @param {object} [params] extra parameters specific to the kraken api endpoint
|
|
2279
2308
|
* @returns {object} an [address structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#address-structure}
|
|
@@ -2355,6 +2384,7 @@ class kraken extends kraken$1 {
|
|
|
2355
2384
|
* @method
|
|
2356
2385
|
* @name kraken#withdraw
|
|
2357
2386
|
* @description make a withdrawal
|
|
2387
|
+
* @see https://docs.kraken.com/rest/#tag/Funding/operation/withdrawFunds
|
|
2358
2388
|
* @param {string} code unified currency code
|
|
2359
2389
|
* @param {float} amount the amount to withdraw
|
|
2360
2390
|
* @param {string} address the address to withdraw to
|
|
@@ -2391,6 +2421,7 @@ class kraken extends kraken$1 {
|
|
|
2391
2421
|
* @method
|
|
2392
2422
|
* @name kraken#fetchPositions
|
|
2393
2423
|
* @description fetch all open positions
|
|
2424
|
+
* @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getOpenPositions
|
|
2394
2425
|
* @param {string[]|undefined} symbols not used by kraken fetchPositions ()
|
|
2395
2426
|
* @param {object} [params] extra parameters specific to the kraken api endpoint
|
|
2396
2427
|
* @returns {object[]} a list of [position structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#position-structure}
|
|
@@ -2462,6 +2493,7 @@ class kraken extends kraken$1 {
|
|
|
2462
2493
|
async transferOut(code, amount, params = {}) {
|
|
2463
2494
|
/**
|
|
2464
2495
|
* @description transfer from spot wallet to futures wallet
|
|
2496
|
+
* @see https://docs.kraken.com/rest/#tag/User-Funding/operation/walletTransfer
|
|
2465
2497
|
* @param {str} code Unified currency code
|
|
2466
2498
|
* @param {float} amount Size of the transfer
|
|
2467
2499
|
* @param {dict} [params] Exchange specific parameters
|
|
@@ -525,7 +525,7 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
525
525
|
// data: 1637385119302,
|
|
526
526
|
// }
|
|
527
527
|
//
|
|
528
|
-
return this.
|
|
528
|
+
return this.safeInteger(response, 'data');
|
|
529
529
|
}
|
|
530
530
|
async fetchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
|
|
531
531
|
/**
|
package/dist/cjs/src/kuna.js
CHANGED
|
@@ -4,12 +4,14 @@ var kuna$1 = require('./abstract/kuna.js');
|
|
|
4
4
|
var errors = require('./base/errors.js');
|
|
5
5
|
var number = require('./base/functions/number.js');
|
|
6
6
|
var sha256 = require('./static_dependencies/noble-hashes/sha256.js');
|
|
7
|
+
var sha512 = require('./static_dependencies/noble-hashes/sha512.js');
|
|
7
8
|
|
|
8
9
|
// ---------------------------------------------------------------------------
|
|
9
10
|
// ---------------------------------------------------------------------------
|
|
10
11
|
/**
|
|
11
12
|
* @class kuna
|
|
12
13
|
* @extends Exchange
|
|
14
|
+
* @description Use the public-key as your apiKey
|
|
13
15
|
*/
|
|
14
16
|
class kuna extends kuna$1 {
|
|
15
17
|
describe() {
|
|
@@ -67,6 +69,7 @@ class kuna extends kuna$1 {
|
|
|
67
69
|
'api': {
|
|
68
70
|
'xreserve': 'https://api.xreserve.fund',
|
|
69
71
|
'v3': 'https://api.kuna.io',
|
|
72
|
+
'v4': 'https://api.kuna.io',
|
|
70
73
|
'public': 'https://kuna.io',
|
|
71
74
|
'private': 'https://kuna.io', // v2
|
|
72
75
|
},
|
|
@@ -85,6 +88,54 @@ class kuna extends kuna$1 {
|
|
|
85
88
|
'delegate-transfer': 1,
|
|
86
89
|
},
|
|
87
90
|
},
|
|
91
|
+
'v4': {
|
|
92
|
+
'private': {
|
|
93
|
+
'get': {
|
|
94
|
+
'me': 1,
|
|
95
|
+
'getBalance': 1,
|
|
96
|
+
'active': 1,
|
|
97
|
+
'order/history': 1,
|
|
98
|
+
'order/private/{id}/trades': 1,
|
|
99
|
+
'order/details/{id}?withTrades={withTrades}': 1,
|
|
100
|
+
'trade/history': 1,
|
|
101
|
+
'transaction/{hash}': 1,
|
|
102
|
+
'deposit/preRequest': 1,
|
|
103
|
+
'deposit/crypto/address': 1,
|
|
104
|
+
'deposit/crypto/getMerchantAddress': 1,
|
|
105
|
+
'deposit/history': 1,
|
|
106
|
+
'deposit/details/{depositId}': 1,
|
|
107
|
+
'withdraw/preRequest': 1,
|
|
108
|
+
'withdraw/history': 1,
|
|
109
|
+
'withdraw/details/{withdrawId}': 1,
|
|
110
|
+
'kuna-code/{id}': 1,
|
|
111
|
+
'kuna-code/{code}/check': 1,
|
|
112
|
+
'kuna-code/issued-by-me': 1,
|
|
113
|
+
'kuna-code/redeemed-by-me': 1,
|
|
114
|
+
},
|
|
115
|
+
'post': {
|
|
116
|
+
'order/create': 1,
|
|
117
|
+
'order/cancel': 1,
|
|
118
|
+
'order/cancel/multi': 1,
|
|
119
|
+
'deposit/crypto/generateAddress': 1,
|
|
120
|
+
'deposit/crypto/generateMerchantAddress': 1,
|
|
121
|
+
'withdraw/create': 1,
|
|
122
|
+
'kuna-code': 1,
|
|
123
|
+
},
|
|
124
|
+
'put': {
|
|
125
|
+
'kuna-code/redeem': 1,
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
'public': {
|
|
129
|
+
'get': {
|
|
130
|
+
'timestamp': 1,
|
|
131
|
+
'fees': 1,
|
|
132
|
+
'currencies?type={type}': 1,
|
|
133
|
+
'markets/getAll': 1,
|
|
134
|
+
'markets/tickers?pairs={pairs}': 1,
|
|
135
|
+
'order/book/{pairs}': 1,
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
},
|
|
88
139
|
'v3': {
|
|
89
140
|
'public': {
|
|
90
141
|
'get': {
|
|
@@ -292,6 +343,9 @@ class kuna extends kuna$1 {
|
|
|
292
343
|
'2002': errors.InsufficientFunds,
|
|
293
344
|
'2003': errors.OrderNotFound,
|
|
294
345
|
},
|
|
346
|
+
'options': {
|
|
347
|
+
// 'account': 'pro' // Only for pro accounts
|
|
348
|
+
},
|
|
295
349
|
});
|
|
296
350
|
}
|
|
297
351
|
async fetchTime(params = {}) {
|
|
@@ -848,20 +902,53 @@ class kuna extends kuna$1 {
|
|
|
848
902
|
let url = undefined;
|
|
849
903
|
if (Array.isArray(api)) {
|
|
850
904
|
const [version, access] = api;
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
if (
|
|
854
|
-
if (
|
|
855
|
-
|
|
905
|
+
if (version === 'v3') {
|
|
906
|
+
url = this.urls['api'][version] + '/' + version + '/' + this.implodeParams(path, params);
|
|
907
|
+
if (access === 'public') {
|
|
908
|
+
if (method === 'GET') {
|
|
909
|
+
if (Object.keys(params).length) {
|
|
910
|
+
url += '?' + this.urlencode(params);
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
else if ((method === 'POST') || (method === 'PUT')) {
|
|
914
|
+
headers = { 'Content-Type': 'application/json' };
|
|
915
|
+
body = this.json(params);
|
|
856
916
|
}
|
|
857
917
|
}
|
|
858
|
-
else if (
|
|
859
|
-
|
|
860
|
-
body = this.json(params);
|
|
918
|
+
else if (access === 'private') {
|
|
919
|
+
throw new errors.NotSupported(this.id + ' private v3 API is not supported yet');
|
|
861
920
|
}
|
|
862
921
|
}
|
|
863
|
-
else if (
|
|
864
|
-
|
|
922
|
+
else if (version === 'v4') {
|
|
923
|
+
const splitPath = path.split('/');
|
|
924
|
+
const splitPathLength = splitPath.length;
|
|
925
|
+
let urlPath = '';
|
|
926
|
+
if ((splitPathLength > 1) && (splitPath[0] !== 'kuna-code')) {
|
|
927
|
+
let pathTail = '';
|
|
928
|
+
for (let i = 1; i < splitPathLength; i++) {
|
|
929
|
+
pathTail += splitPath[i];
|
|
930
|
+
}
|
|
931
|
+
urlPath = '/' + version + '/' + splitPath[0] + '/' + access + '/' + this.implodeParams(pathTail, params);
|
|
932
|
+
}
|
|
933
|
+
else {
|
|
934
|
+
urlPath = '/' + version + '/' + access + '/' + this.implodeParams(path, params);
|
|
935
|
+
}
|
|
936
|
+
url = this.urls['api'][version] + urlPath;
|
|
937
|
+
if (access === 'private') {
|
|
938
|
+
const nonce = this.nonce();
|
|
939
|
+
const auth = urlPath + nonce + this.json(params);
|
|
940
|
+
headers = {
|
|
941
|
+
'content-type': 'application/json',
|
|
942
|
+
'accept': 'application/json',
|
|
943
|
+
'nonce': nonce,
|
|
944
|
+
'public-key': this.apiKey,
|
|
945
|
+
'signature': this.hmac(this.encode(auth), this.encode(this.secret), sha512.sha384, 'hex'),
|
|
946
|
+
};
|
|
947
|
+
const account = this.safeString(this.options, 'account');
|
|
948
|
+
if (account === 'pro') {
|
|
949
|
+
headers['account'] = 'pro';
|
|
950
|
+
}
|
|
951
|
+
}
|
|
865
952
|
}
|
|
866
953
|
}
|
|
867
954
|
else {
|