ccxt 4.1.74 → 4.1.75
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 +410 -119
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +6 -2
- package/dist/cjs/src/base/ws/Client.js +11 -14
- package/dist/cjs/src/bigone.js +38 -9
- package/dist/cjs/src/bingx.js +57 -18
- package/dist/cjs/src/bitmart.js +33 -11
- package/dist/cjs/src/gate.js +1 -0
- package/dist/cjs/src/gemini.js +21 -19
- package/dist/cjs/src/kraken.js +154 -11
- package/dist/cjs/src/poloniex.js +27 -25
- package/dist/cjs/src/pro/binance.js +60 -8
- package/dist/cjs/src/pro/coinbasepro.js +1 -1
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/base/Exchange.js +6 -2
- package/js/src/base/ws/Client.js +11 -14
- package/js/src/bigone.d.ts +1 -0
- package/js/src/bigone.js +38 -9
- package/js/src/bingx.d.ts +3 -0
- package/js/src/bingx.js +58 -19
- package/js/src/bitmart.d.ts +1 -0
- package/js/src/bitmart.js +33 -11
- package/js/src/gate.js +1 -0
- package/js/src/gemini.js +21 -19
- package/js/src/kraken.d.ts +2 -0
- package/js/src/kraken.js +154 -11
- package/js/src/poloniex.js +27 -25
- package/js/src/pro/binance.d.ts +1 -0
- package/js/src/pro/binance.js +61 -9
- package/js/src/pro/coinbasepro.js +1 -1
- package/package.json +1 -1
package/dist/cjs/ccxt.js
CHANGED
|
@@ -172,7 +172,7 @@ var woo$1 = require('./src/pro/woo.js');
|
|
|
172
172
|
|
|
173
173
|
//-----------------------------------------------------------------------------
|
|
174
174
|
// this is updated by vss.js when building
|
|
175
|
-
const version = '4.1.
|
|
175
|
+
const version = '4.1.75';
|
|
176
176
|
Exchange["default"].ccxtVersion = version;
|
|
177
177
|
const exchanges = {
|
|
178
178
|
'ace': ace,
|
|
@@ -4689,6 +4689,10 @@ class Exchange {
|
|
|
4689
4689
|
if (cursorValue === undefined) {
|
|
4690
4690
|
break;
|
|
4691
4691
|
}
|
|
4692
|
+
const lastTimestamp = this.safeInteger(last, 'timestamp');
|
|
4693
|
+
if (lastTimestamp !== undefined && lastTimestamp < since) {
|
|
4694
|
+
break;
|
|
4695
|
+
}
|
|
4692
4696
|
}
|
|
4693
4697
|
catch (e) {
|
|
4694
4698
|
errors += 1;
|
|
@@ -4741,10 +4745,10 @@ class Exchange {
|
|
|
4741
4745
|
const first = this.safeValue(result, 0);
|
|
4742
4746
|
if (first !== undefined) {
|
|
4743
4747
|
if ('timestamp' in first) {
|
|
4744
|
-
return this.sortBy(result, 'timestamp');
|
|
4748
|
+
return this.sortBy(result, 'timestamp', true);
|
|
4745
4749
|
}
|
|
4746
4750
|
if ('id' in first) {
|
|
4747
|
-
return this.sortBy(result, 'id');
|
|
4751
|
+
return this.sortBy(result, 'id', true);
|
|
4748
4752
|
}
|
|
4749
4753
|
}
|
|
4750
4754
|
return result;
|
|
@@ -251,23 +251,20 @@ class Client {
|
|
|
251
251
|
// MessageEvent {isTrusted: true, data: "{"e":"depthUpdate","E":1581358737706,"s":"ETHBTC",…"0.06200000"]],"a":[["0.02261300","0.00000000"]]}", origin: "wss://stream.binance.com:9443", lastEventId: "", source: null, …}
|
|
252
252
|
let message = messageEvent.data;
|
|
253
253
|
let arrayBuffer;
|
|
254
|
-
if (
|
|
255
|
-
if (
|
|
256
|
-
arrayBuffer = index.utf8.decode(message);
|
|
257
|
-
}
|
|
258
|
-
else {
|
|
254
|
+
if (typeof message !== 'string') {
|
|
255
|
+
if (this.gunzip || this.inflate) {
|
|
259
256
|
arrayBuffer = new Uint8Array(message.buffer.slice(message.byteOffset, message.byteOffset + message.byteLength));
|
|
257
|
+
if (this.gunzip) {
|
|
258
|
+
arrayBuffer = browser.gunzipSync(arrayBuffer);
|
|
259
|
+
}
|
|
260
|
+
else if (this.inflate) {
|
|
261
|
+
arrayBuffer = browser.inflateSync(arrayBuffer);
|
|
262
|
+
}
|
|
263
|
+
message = index.utf8.encode(arrayBuffer);
|
|
260
264
|
}
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
}
|
|
264
|
-
else if (this.inflate) {
|
|
265
|
-
arrayBuffer = browser.inflateSync(arrayBuffer);
|
|
265
|
+
else {
|
|
266
|
+
message = message.toString();
|
|
266
267
|
}
|
|
267
|
-
message = index.utf8.encode(arrayBuffer);
|
|
268
|
-
}
|
|
269
|
-
if (typeof message !== 'string') {
|
|
270
|
-
message = message.toString();
|
|
271
268
|
}
|
|
272
269
|
try {
|
|
273
270
|
if (encode.isJsonEncodedObject(message)) {
|
package/dist/cjs/src/bigone.js
CHANGED
|
@@ -30,6 +30,8 @@ class bigone extends bigone$1 {
|
|
|
30
30
|
'option': undefined,
|
|
31
31
|
'cancelAllOrders': true,
|
|
32
32
|
'cancelOrder': true,
|
|
33
|
+
'createMarketBuyOrderWithCost': true,
|
|
34
|
+
'createMarketSellOrderWithCost': false,
|
|
33
35
|
'createOrder': true,
|
|
34
36
|
'createPostOnlyOrder': true,
|
|
35
37
|
'createStopLimitOrder': true,
|
|
@@ -1152,6 +1154,20 @@ class bigone extends bigone$1 {
|
|
|
1152
1154
|
'trades': undefined,
|
|
1153
1155
|
}, market);
|
|
1154
1156
|
}
|
|
1157
|
+
async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
|
|
1158
|
+
/**
|
|
1159
|
+
* @method
|
|
1160
|
+
* @name bigone#createMarketBuyOrderWithCost
|
|
1161
|
+
* @see https://open.big.one/docs/spot_orders.html#create-order
|
|
1162
|
+
* @description create a market buy order by providing the symbol and cost
|
|
1163
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
1164
|
+
* @param {float} cost how much you want to trade in units of the quote currency
|
|
1165
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1166
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1167
|
+
*/
|
|
1168
|
+
params['createMarketBuyOrderRequiresPrice'] = false;
|
|
1169
|
+
return await this.createOrder(symbol, 'market', 'buy', cost, undefined, params);
|
|
1170
|
+
}
|
|
1155
1171
|
async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
|
|
1156
1172
|
/**
|
|
1157
1173
|
* @method
|
|
@@ -1179,7 +1195,7 @@ class bigone extends bigone$1 {
|
|
|
1179
1195
|
const requestSide = isBuy ? 'BID' : 'ASK';
|
|
1180
1196
|
let uppercaseType = type.toUpperCase();
|
|
1181
1197
|
const isLimit = uppercaseType === 'LIMIT';
|
|
1182
|
-
const exchangeSpecificParam = this.safeValue(params, 'post_only');
|
|
1198
|
+
const exchangeSpecificParam = this.safeValue(params, 'post_only', false);
|
|
1183
1199
|
let postOnly = undefined;
|
|
1184
1200
|
[postOnly, params] = this.handlePostOnly((uppercaseType === 'MARKET'), exchangeSpecificParam, params);
|
|
1185
1201
|
const triggerPrice = this.safeStringN(params, ['triggerPrice', 'stopPrice', 'stop_price']);
|
|
@@ -1203,21 +1219,34 @@ class bigone extends bigone$1 {
|
|
|
1203
1219
|
request['post_only'] = true;
|
|
1204
1220
|
}
|
|
1205
1221
|
}
|
|
1222
|
+
request['amount'] = this.amountToPrecision(symbol, amount);
|
|
1206
1223
|
}
|
|
1207
1224
|
else {
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1225
|
+
if (isBuy) {
|
|
1226
|
+
let createMarketBuyOrderRequiresPrice = true;
|
|
1227
|
+
[createMarketBuyOrderRequiresPrice, params] = this.handleOptionAndParams(params, 'createOrder', 'createMarketBuyOrderRequiresPrice', true);
|
|
1228
|
+
const cost = this.safeNumber(params, 'cost');
|
|
1229
|
+
params = this.omit(params, 'cost');
|
|
1230
|
+
if (createMarketBuyOrderRequiresPrice) {
|
|
1231
|
+
if ((price === undefined) && (cost === undefined)) {
|
|
1232
|
+
throw new errors.InvalidOrder(this.id + ' createOrder() requires the price argument for market buy orders to calculate the total cost to spend (amount * price), alternatively set the createMarketBuyOrderRequiresPrice option or param to false and pass the cost to spend in the amount argument');
|
|
1233
|
+
}
|
|
1234
|
+
else {
|
|
1235
|
+
const amountString = this.numberToString(amount);
|
|
1236
|
+
const priceString = this.numberToString(price);
|
|
1237
|
+
const quoteAmount = this.parseToNumeric(Precise["default"].stringMul(amountString, priceString));
|
|
1238
|
+
const costRequest = (cost !== undefined) ? cost : quoteAmount;
|
|
1239
|
+
request['amount'] = this.costToPrecision(symbol, costRequest);
|
|
1240
|
+
}
|
|
1212
1241
|
}
|
|
1213
1242
|
else {
|
|
1214
|
-
|
|
1215
|
-
const priceString = this.numberToString(price);
|
|
1216
|
-
amount = this.parseNumber(Precise["default"].stringMul(amountString, priceString));
|
|
1243
|
+
request['amount'] = this.costToPrecision(symbol, amount);
|
|
1217
1244
|
}
|
|
1218
1245
|
}
|
|
1246
|
+
else {
|
|
1247
|
+
request['amount'] = this.amountToPrecision(symbol, amount);
|
|
1248
|
+
}
|
|
1219
1249
|
}
|
|
1220
|
-
request['amount'] = this.amountToPrecision(symbol, amount);
|
|
1221
1250
|
if (triggerPrice !== undefined) {
|
|
1222
1251
|
request['stop_price'] = this.priceToPrecision(symbol, triggerPrice);
|
|
1223
1252
|
request['operator'] = isBuy ? 'GTE' : 'LTE';
|
package/dist/cjs/src/bingx.js
CHANGED
|
@@ -29,6 +29,9 @@ class bingx extends bingx$1 {
|
|
|
29
29
|
'cancelAllOrders': true,
|
|
30
30
|
'cancelOrder': true,
|
|
31
31
|
'cancelOrders': true,
|
|
32
|
+
'createMarketBuyOrderWithCost': true,
|
|
33
|
+
'createMarketOrderWithCost': true,
|
|
34
|
+
'createMarketSellOrderWithCost': true,
|
|
32
35
|
'createOrder': true,
|
|
33
36
|
'createOrders': true,
|
|
34
37
|
'fetchBalance': true,
|
|
@@ -1621,6 +1624,46 @@ class bingx extends bingx$1 {
|
|
|
1621
1624
|
'takeProfitPrice': undefined,
|
|
1622
1625
|
});
|
|
1623
1626
|
}
|
|
1627
|
+
async createMarketOrderWithCost(symbol, side, cost, params = {}) {
|
|
1628
|
+
/**
|
|
1629
|
+
* @method
|
|
1630
|
+
* @name bingx#createMarketOrderWithCost
|
|
1631
|
+
* @description create a market order by providing the symbol, side and cost
|
|
1632
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
1633
|
+
* @param {string} side 'buy' or 'sell'
|
|
1634
|
+
* @param {float} cost how much you want to trade in units of the quote currency
|
|
1635
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1636
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1637
|
+
*/
|
|
1638
|
+
params['quoteOrderQty'] = cost;
|
|
1639
|
+
return await this.createOrder(symbol, 'market', side, cost, undefined, params);
|
|
1640
|
+
}
|
|
1641
|
+
async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
|
|
1642
|
+
/**
|
|
1643
|
+
* @method
|
|
1644
|
+
* @name bingx#createMarketBuyOrderWithCost
|
|
1645
|
+
* @description create a market buy order by providing the symbol and cost
|
|
1646
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
1647
|
+
* @param {float} cost how much you want to trade in units of the quote currency
|
|
1648
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1649
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1650
|
+
*/
|
|
1651
|
+
params['quoteOrderQty'] = cost;
|
|
1652
|
+
return await this.createOrder(symbol, 'market', 'buy', cost, undefined, params);
|
|
1653
|
+
}
|
|
1654
|
+
async createMarketSellOrderWithCost(symbol, cost, params = {}) {
|
|
1655
|
+
/**
|
|
1656
|
+
* @method
|
|
1657
|
+
* @name bingx#createMarketSellOrderWithCost
|
|
1658
|
+
* @description create a market sell order by providing the symbol and cost
|
|
1659
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
1660
|
+
* @param {float} cost how much you want to trade in units of the quote currency
|
|
1661
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1662
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1663
|
+
*/
|
|
1664
|
+
params['quoteOrderQty'] = cost;
|
|
1665
|
+
return await this.createOrder(symbol, 'market', 'sell', cost, undefined, params);
|
|
1666
|
+
}
|
|
1624
1667
|
createOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
|
|
1625
1668
|
/**
|
|
1626
1669
|
* @method
|
|
@@ -1656,26 +1699,21 @@ class bingx extends bingx$1 {
|
|
|
1656
1699
|
if (postOnly || (timeInForce === 'POC')) {
|
|
1657
1700
|
request['timeInForce'] = 'POC';
|
|
1658
1701
|
}
|
|
1659
|
-
const
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
request['quoteOrderQty'] = this.parseToNumeric(this.priceToPrecision(symbol, cost));
|
|
1670
|
-
}
|
|
1702
|
+
const cost = this.safeNumber2(params, 'cost', 'quoteOrderQty');
|
|
1703
|
+
params = this.omit(params, 'cost');
|
|
1704
|
+
if (cost !== undefined) {
|
|
1705
|
+
request['quoteOrderQty'] = this.parseToNumeric(this.costToPrecision(symbol, cost));
|
|
1706
|
+
}
|
|
1707
|
+
else {
|
|
1708
|
+
if (market['spot'] && isMarketOrder && (price !== undefined)) {
|
|
1709
|
+
// keep the legacy behavior, to avoid breaking the old spot-market-buying code
|
|
1710
|
+
const calculatedCost = Precise["default"].stringMul(this.numberToString(amount), this.numberToString(price));
|
|
1711
|
+
request['quoteOrderQty'] = this.parseToNumeric(calculatedCost);
|
|
1671
1712
|
}
|
|
1672
1713
|
else {
|
|
1673
|
-
request['
|
|
1714
|
+
request['quantity'] = this.parseToNumeric(this.amountToPrecision(symbol, amount));
|
|
1674
1715
|
}
|
|
1675
1716
|
}
|
|
1676
|
-
else {
|
|
1677
|
-
request['quantity'] = this.parseToNumeric(this.amountToPrecision(symbol, amount));
|
|
1678
|
-
}
|
|
1679
1717
|
if (!isMarketOrder) {
|
|
1680
1718
|
request['price'] = this.parseToNumeric(this.priceToPrecision(symbol, price));
|
|
1681
1719
|
}
|
|
@@ -1750,8 +1788,8 @@ class bingx extends bingx$1 {
|
|
|
1750
1788
|
* @method
|
|
1751
1789
|
* @name bingx#createOrder
|
|
1752
1790
|
* @description create a trade order
|
|
1753
|
-
* @see https://bingx-api.github.io/docs/#/spot/trade-api.html#Create%20an%20Order
|
|
1754
|
-
* @see https://bingx-api.github.io/docs/#/swapV2/trade-api.html#Trade%20order
|
|
1791
|
+
* @see https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Create%20an%20Order
|
|
1792
|
+
* @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Trade%20order
|
|
1755
1793
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
1756
1794
|
* @param {string} type 'market' or 'limit'
|
|
1757
1795
|
* @param {string} side 'buy' or 'sell'
|
|
@@ -1764,6 +1802,7 @@ class bingx extends bingx$1 {
|
|
|
1764
1802
|
* @param {float} [params.triggerPrice] *swap only* triggerPrice at which the attached take profit / stop loss order will be triggered
|
|
1765
1803
|
* @param {float} [params.stopLossPrice] *swap only* stop loss trigger price
|
|
1766
1804
|
* @param {float} [params.takeProfitPrice] *swap only* take profit trigger price
|
|
1805
|
+
* @param {float} [params.cost] the quote quantity that can be used as an alternative for the amount
|
|
1767
1806
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1768
1807
|
*/
|
|
1769
1808
|
await this.loadMarkets();
|
package/dist/cjs/src/bitmart.js
CHANGED
|
@@ -36,6 +36,9 @@ class bitmart extends bitmart$1 {
|
|
|
36
36
|
'cancelAllOrders': true,
|
|
37
37
|
'cancelOrder': true,
|
|
38
38
|
'cancelOrders': false,
|
|
39
|
+
'createMarketBuyOrderWithCost': true,
|
|
40
|
+
'createMarketOrderWithCost': false,
|
|
41
|
+
'createMarketSellOrderWithCost': false,
|
|
39
42
|
'createOrder': true,
|
|
40
43
|
'createPostOnlyOrder': true,
|
|
41
44
|
'createStopLimitOrder': false,
|
|
@@ -2161,12 +2164,31 @@ class bitmart extends bitmart$1 {
|
|
|
2161
2164
|
const statuses = this.safeValue(statusesByType, type, {});
|
|
2162
2165
|
return this.safeString(statuses, status, status);
|
|
2163
2166
|
}
|
|
2167
|
+
async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
|
|
2168
|
+
/**
|
|
2169
|
+
* @method
|
|
2170
|
+
* @name bitmart#createMarketBuyOrderWithCost
|
|
2171
|
+
* @description create a market buy order by providing the symbol and cost
|
|
2172
|
+
* @see https://developer-pro.bitmart.com/en/spot/#new-order-v2-signed
|
|
2173
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
2174
|
+
* @param {float} cost how much you want to trade in units of the quote currency
|
|
2175
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2176
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
2177
|
+
*/
|
|
2178
|
+
await this.loadMarkets();
|
|
2179
|
+
const market = this.market(symbol);
|
|
2180
|
+
if (!market['spot']) {
|
|
2181
|
+
throw new errors.NotSupported(this.id + ' createMarketBuyOrderWithCost() supports spot orders only');
|
|
2182
|
+
}
|
|
2183
|
+
params['createMarketBuyOrderRequiresPrice'] = false;
|
|
2184
|
+
return await this.createOrder(symbol, 'market', 'buy', cost, undefined, params);
|
|
2185
|
+
}
|
|
2164
2186
|
async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
|
|
2165
2187
|
/**
|
|
2166
2188
|
* @method
|
|
2167
2189
|
* @name bitmart#createOrder
|
|
2168
2190
|
* @description create a trade order
|
|
2169
|
-
* @see https://developer-pro.bitmart.com/en/spot/#
|
|
2191
|
+
* @see https://developer-pro.bitmart.com/en/spot/#new-order-v2-signed
|
|
2170
2192
|
* @see https://developer-pro.bitmart.com/en/spot/#place-margin-order
|
|
2171
2193
|
* @see https://developer-pro.bitmart.com/en/futures/#submit-order-signed
|
|
2172
2194
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
@@ -2343,18 +2365,18 @@ class bitmart extends bitmart$1 {
|
|
|
2343
2365
|
else if (isMarketOrder) {
|
|
2344
2366
|
// for market buy it requires the amount of quote currency to spend
|
|
2345
2367
|
if (side === 'buy') {
|
|
2346
|
-
let notional = this.
|
|
2347
|
-
|
|
2368
|
+
let notional = this.safeNumber2(params, 'cost', 'notional');
|
|
2369
|
+
params = this.omit(params, 'cost');
|
|
2370
|
+
let createMarketBuyOrderRequiresPrice = true;
|
|
2371
|
+
[createMarketBuyOrderRequiresPrice, params] = this.handleOptionAndParams(params, 'createOrder', 'createMarketBuyOrderRequiresPrice', true);
|
|
2348
2372
|
if (createMarketBuyOrderRequiresPrice) {
|
|
2349
|
-
if (price
|
|
2350
|
-
|
|
2351
|
-
const amountString = this.numberToString(amount);
|
|
2352
|
-
const priceString = this.numberToString(price);
|
|
2353
|
-
notional = this.parseNumber(Precise["default"].stringMul(amountString, priceString));
|
|
2354
|
-
}
|
|
2373
|
+
if ((price === undefined) && (notional === undefined)) {
|
|
2374
|
+
throw new errors.InvalidOrder(this.id + ' createOrder() requires the price argument for market buy orders to calculate the total cost to spend (amount * price), alternatively set the createMarketBuyOrderRequiresPrice option or param to false and pass the cost to spend in the amount argument or in the "notional" extra parameter (the exchange-specific behaviour)');
|
|
2355
2375
|
}
|
|
2356
|
-
else
|
|
2357
|
-
|
|
2376
|
+
else {
|
|
2377
|
+
const amountString = this.numberToString(amount);
|
|
2378
|
+
const priceString = this.numberToString(price);
|
|
2379
|
+
notional = this.parseNumber(Precise["default"].stringMul(amountString, priceString));
|
|
2358
2380
|
}
|
|
2359
2381
|
}
|
|
2360
2382
|
else {
|
package/dist/cjs/src/gate.js
CHANGED
package/dist/cjs/src/gemini.js
CHANGED
|
@@ -341,26 +341,28 @@ class gemini extends gemini$1 {
|
|
|
341
341
|
const networks = {};
|
|
342
342
|
const networkId = this.safeString(currency, 9);
|
|
343
343
|
const networkCode = this.networkIdToCode(networkId);
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
'
|
|
355
|
-
'
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
'
|
|
360
|
-
|
|
344
|
+
if (networkCode !== undefined) {
|
|
345
|
+
networks[networkCode] = {
|
|
346
|
+
'info': currency,
|
|
347
|
+
'id': networkId,
|
|
348
|
+
'network': networkCode,
|
|
349
|
+
'active': undefined,
|
|
350
|
+
'deposit': undefined,
|
|
351
|
+
'withdraw': undefined,
|
|
352
|
+
'fee': undefined,
|
|
353
|
+
'precision': precision,
|
|
354
|
+
'limits': {
|
|
355
|
+
'deposit': {
|
|
356
|
+
'min': undefined,
|
|
357
|
+
'max': undefined,
|
|
358
|
+
},
|
|
359
|
+
'withdraw': {
|
|
360
|
+
'min': undefined,
|
|
361
|
+
'max': undefined,
|
|
362
|
+
},
|
|
361
363
|
},
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
+
};
|
|
365
|
+
}
|
|
364
366
|
result[code] = {
|
|
365
367
|
'info': currency,
|
|
366
368
|
'id': id,
|
package/dist/cjs/src/kraken.js
CHANGED
|
@@ -325,6 +325,91 @@ class kraken extends kraken$1 {
|
|
|
325
325
|
'ZEC': 'Zcash (Transparent)',
|
|
326
326
|
'ZRX': '0x (ZRX)',
|
|
327
327
|
},
|
|
328
|
+
'withdrawMethods': {
|
|
329
|
+
'Lightning': 'Lightning',
|
|
330
|
+
'Bitcoin': 'BTC',
|
|
331
|
+
'Ripple': 'XRP',
|
|
332
|
+
'Litecoin': 'LTC',
|
|
333
|
+
'Dogecoin': 'DOGE',
|
|
334
|
+
'Stellar': 'XLM',
|
|
335
|
+
'Ethereum': 'ERC20',
|
|
336
|
+
'Arbitrum One': 'Arbitrum',
|
|
337
|
+
'Polygon': 'MATIC',
|
|
338
|
+
'Arbitrum Nova': 'Arbitrum',
|
|
339
|
+
'Optimism': 'Optimism',
|
|
340
|
+
'zkSync Era': 'zkSync',
|
|
341
|
+
'Ethereum Classic': 'ETC',
|
|
342
|
+
'Zcash': 'ZEC',
|
|
343
|
+
'Monero': 'XMR',
|
|
344
|
+
'Tron': 'TRC20',
|
|
345
|
+
'Solana': 'SOL',
|
|
346
|
+
'EOS': 'EOS',
|
|
347
|
+
'Bitcoin Cash': 'BCH',
|
|
348
|
+
'Cardano': 'ADA',
|
|
349
|
+
'Qtum': 'QTUM',
|
|
350
|
+
'Tezos': 'XTZ',
|
|
351
|
+
'Cosmos': 'ATOM',
|
|
352
|
+
'Nano': 'NANO',
|
|
353
|
+
'Siacoin': 'SC',
|
|
354
|
+
'Lisk': 'LSK',
|
|
355
|
+
'Waves': 'WAVES',
|
|
356
|
+
'ICON': 'ICX',
|
|
357
|
+
'Algorand': 'ALGO',
|
|
358
|
+
'Polygon - USDC.e': 'MATIC',
|
|
359
|
+
'Arbitrum One - USDC.e': 'Arbitrum',
|
|
360
|
+
'Polkadot': 'DOT',
|
|
361
|
+
'Kava': 'KAVA',
|
|
362
|
+
'Filecoin': 'FIL',
|
|
363
|
+
'Kusama': 'KSM',
|
|
364
|
+
'Flow': 'FLOW',
|
|
365
|
+
'Energy Web': 'EW',
|
|
366
|
+
'Mina': 'MINA',
|
|
367
|
+
'Centrifuge': 'CFG',
|
|
368
|
+
'Karura': 'KAR',
|
|
369
|
+
'Moonriver': 'MOVR',
|
|
370
|
+
'Shiden': 'SDN',
|
|
371
|
+
'Khala': 'PHA',
|
|
372
|
+
'Bifrost Kusama': 'BNC',
|
|
373
|
+
'Songbird': 'SGB',
|
|
374
|
+
'Terra classic': 'LUNC',
|
|
375
|
+
'KILT': 'KILT',
|
|
376
|
+
'Basilisk': 'BSX',
|
|
377
|
+
'Flare': 'FLR',
|
|
378
|
+
'Avalanche C-Chain': 'AVAX',
|
|
379
|
+
'Kintsugi': 'KINT',
|
|
380
|
+
'Altair': 'AIR',
|
|
381
|
+
'Moonbeam': 'GLMR',
|
|
382
|
+
'Acala': 'ACA',
|
|
383
|
+
'Astar': 'ASTR',
|
|
384
|
+
'Akash': 'AKT',
|
|
385
|
+
'Robonomics': 'XRT',
|
|
386
|
+
'Fantom': 'FTM',
|
|
387
|
+
'Elrond': 'EGLD',
|
|
388
|
+
'THORchain': 'RUNE',
|
|
389
|
+
'Secret': 'SCRT',
|
|
390
|
+
'Near': 'NEAR',
|
|
391
|
+
'Internet Computer Protocol': 'ICP',
|
|
392
|
+
'Picasso': 'PICA',
|
|
393
|
+
'Crust Shadow': 'CSM',
|
|
394
|
+
'Integritee': 'TEER',
|
|
395
|
+
'Parallel Finance': 'PARA',
|
|
396
|
+
'HydraDX': 'HDX',
|
|
397
|
+
'Interlay': 'INTR',
|
|
398
|
+
'Fetch.ai': 'FET',
|
|
399
|
+
'NYM': 'NYM',
|
|
400
|
+
'Terra 2.0': 'LUNA2',
|
|
401
|
+
'Juno': 'JUNO',
|
|
402
|
+
'Nodle': 'NODL',
|
|
403
|
+
'Stacks': 'STX',
|
|
404
|
+
'Ethereum PoW': 'ETHW',
|
|
405
|
+
'Aptos': 'APT',
|
|
406
|
+
'Sui': 'SUI',
|
|
407
|
+
'Genshiro': 'GENS',
|
|
408
|
+
'Aventus': 'AVT',
|
|
409
|
+
'Sei': 'SEI',
|
|
410
|
+
'OriginTrail': 'OTP',
|
|
411
|
+
'Celestia': 'TIA',
|
|
412
|
+
},
|
|
328
413
|
},
|
|
329
414
|
'precisionMode': number.TICK_SIZE,
|
|
330
415
|
'exceptions': {
|
|
@@ -2071,6 +2156,10 @@ class kraken extends kraken$1 {
|
|
|
2071
2156
|
};
|
|
2072
2157
|
return this.safeString(statuses, status, status);
|
|
2073
2158
|
}
|
|
2159
|
+
parseNetwork(network) {
|
|
2160
|
+
const withdrawMethods = this.safeValue(this.options, 'withdrawMethods', {});
|
|
2161
|
+
return this.safeString(withdrawMethods, network, network);
|
|
2162
|
+
}
|
|
2074
2163
|
parseTransaction(transaction, currency = undefined) {
|
|
2075
2164
|
//
|
|
2076
2165
|
// fetchDeposits
|
|
@@ -2121,6 +2210,8 @@ class kraken extends kraken$1 {
|
|
|
2121
2210
|
// "fee": "0.0050000000",
|
|
2122
2211
|
// "time": 1530481750,
|
|
2123
2212
|
// "status": "Success"
|
|
2213
|
+
// "key":"Huobi wallet",
|
|
2214
|
+
// "network":"Tron"
|
|
2124
2215
|
// status-prop: 'on-hold' // this field might not be present in some cases
|
|
2125
2216
|
// }
|
|
2126
2217
|
//
|
|
@@ -2157,7 +2248,7 @@ class kraken extends kraken$1 {
|
|
|
2157
2248
|
'id': id,
|
|
2158
2249
|
'currency': code,
|
|
2159
2250
|
'amount': amount,
|
|
2160
|
-
'network':
|
|
2251
|
+
'network': this.parseNetwork(this.safeString(transaction, 'network')),
|
|
2161
2252
|
'address': address,
|
|
2162
2253
|
'addressTo': undefined,
|
|
2163
2254
|
'addressFrom': undefined,
|
|
@@ -2261,19 +2352,28 @@ class kraken extends kraken$1 {
|
|
|
2261
2352
|
* @param {int} [since] the earliest time in ms to fetch withdrawals for
|
|
2262
2353
|
* @param {int} [limit] the maximum number of withdrawals structures to retrieve
|
|
2263
2354
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2355
|
+
* @param {object} [params.end] End timestamp, withdrawals created strictly after will be not be included in the response
|
|
2356
|
+
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times
|
|
2264
2357
|
* @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
2265
|
-
|
|
2266
|
-
// https://www.kraken.com/en-us/help/api#withdraw-status
|
|
2267
|
-
if (code === undefined) {
|
|
2268
|
-
throw new errors.ArgumentsRequired(this.id + ' fetchWithdrawals() requires a currency code argument');
|
|
2269
|
-
}
|
|
2358
|
+
*/
|
|
2270
2359
|
await this.loadMarkets();
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2360
|
+
let paginate = false;
|
|
2361
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchWithdrawals', 'paginate');
|
|
2362
|
+
if (paginate) {
|
|
2363
|
+
params['cursor'] = true;
|
|
2364
|
+
return await this.fetchPaginatedCallCursor('fetchWithdrawals', code, since, limit, params, 'next_cursor', 'cursor');
|
|
2365
|
+
}
|
|
2366
|
+
const request = {};
|
|
2367
|
+
if (code !== undefined) {
|
|
2368
|
+
const currency = this.currency(code);
|
|
2369
|
+
request['asset'] = currency['id'];
|
|
2370
|
+
}
|
|
2371
|
+
if (since !== undefined) {
|
|
2372
|
+
request['since'] = since.toString();
|
|
2373
|
+
}
|
|
2275
2374
|
const response = await this.privatePostWithdrawStatus(this.extend(request, params));
|
|
2276
2375
|
//
|
|
2376
|
+
// with no pagination
|
|
2277
2377
|
// { error: [],
|
|
2278
2378
|
// "result": [ { "method": "Ether",
|
|
2279
2379
|
// "aclass": "currency",
|
|
@@ -2285,8 +2385,51 @@ class kraken extends kraken$1 {
|
|
|
2285
2385
|
// "fee": "0.0050000000",
|
|
2286
2386
|
// "time": 1530481750,
|
|
2287
2387
|
// "status": "Success" } ] }
|
|
2388
|
+
// with pagination
|
|
2389
|
+
// {
|
|
2390
|
+
// "error":[],
|
|
2391
|
+
// "result":{
|
|
2392
|
+
// "withdrawals":[
|
|
2393
|
+
// {
|
|
2394
|
+
// "method":"Tether USD (TRC20)",
|
|
2395
|
+
// "aclass":"currency",
|
|
2396
|
+
// "asset":"USDT",
|
|
2397
|
+
// "refid":"BSNFZU2-MEFN4G-J3NEZV",
|
|
2398
|
+
// "txid":"1c7a642fb7387bbc2c6a2c509fd1ae146937f4cf793b4079a4f0715e3a02615a",
|
|
2399
|
+
// "info":"TQmdxSuC16EhFg8FZWtYgrfFRosoRF7bCp",
|
|
2400
|
+
// "amount":"1996.50000000",
|
|
2401
|
+
// "fee":"2.50000000",
|
|
2402
|
+
// "time":1669126657,
|
|
2403
|
+
// "status":"Success",
|
|
2404
|
+
// "key":"poloniex",
|
|
2405
|
+
// "network":"Tron"
|
|
2406
|
+
// },
|
|
2407
|
+
// ...
|
|
2408
|
+
// ],
|
|
2409
|
+
// "next_cursor":"HgAAAAAAAABGVFRSd3k1LVF4Y0JQY05Gd0xRY0NxenFndHpybkwBAQH2AwEBAAAAAQAAAAAAAAABAAAAAAAZAAAAAAAAAA=="
|
|
2410
|
+
// }
|
|
2411
|
+
// }
|
|
2288
2412
|
//
|
|
2289
|
-
|
|
2413
|
+
let rawWithdrawals = undefined;
|
|
2414
|
+
const result = this.safeValue(response, 'result');
|
|
2415
|
+
if (!Array.isArray(result)) {
|
|
2416
|
+
rawWithdrawals = this.addPaginationCursorToResult(result);
|
|
2417
|
+
}
|
|
2418
|
+
else {
|
|
2419
|
+
rawWithdrawals = result;
|
|
2420
|
+
}
|
|
2421
|
+
return this.parseTransactionsByType('withdrawal', rawWithdrawals, code, since, limit);
|
|
2422
|
+
}
|
|
2423
|
+
addPaginationCursorToResult(result) {
|
|
2424
|
+
const cursor = this.safeString(result, 'next_cursor');
|
|
2425
|
+
const data = this.safeValue(result, 'withdrawals');
|
|
2426
|
+
const dataLength = data.length;
|
|
2427
|
+
if (cursor !== undefined && dataLength > 0) {
|
|
2428
|
+
const last = data[dataLength - 1];
|
|
2429
|
+
last['next_cursor'] = cursor;
|
|
2430
|
+
data[dataLength - 1] = last;
|
|
2431
|
+
}
|
|
2432
|
+
return data;
|
|
2290
2433
|
}
|
|
2291
2434
|
async createDepositAddress(code, params = {}) {
|
|
2292
2435
|
/**
|