ccxt 4.2.83 → 4.2.84
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 +30 -38
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/bitget.js +10 -4
- package/dist/cjs/src/bybit.js +3 -3
- package/dist/cjs/src/coinex.js +1 -2
- package/dist/cjs/src/htx.js +5 -27
- package/dist/cjs/src/kucoin.js +10 -1
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/bitget.js +10 -4
- package/js/src/bybit.js +3 -3
- package/js/src/coinex.js +1 -2
- package/js/src/htx.js +5 -27
- package/js/src/kucoin.d.ts +1 -0
- package/js/src/kucoin.js +11 -2
- package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +1 -1
- package/package.json +1 -1
package/dist/cjs/ccxt.js
CHANGED
|
@@ -182,7 +182,7 @@ var woo$1 = require('./src/pro/woo.js');
|
|
|
182
182
|
|
|
183
183
|
//-----------------------------------------------------------------------------
|
|
184
184
|
// this is updated by vss.js when building
|
|
185
|
-
const version = '4.2.
|
|
185
|
+
const version = '4.2.84';
|
|
186
186
|
Exchange["default"].ccxtVersion = version;
|
|
187
187
|
const exchanges = {
|
|
188
188
|
'ace': ace,
|
package/dist/cjs/src/bitget.js
CHANGED
|
@@ -2768,6 +2768,7 @@ class bitget extends bitget$1 {
|
|
|
2768
2768
|
* @see https://www.bitget.com/api-doc/contract/market/Get-All-Symbol-Ticker
|
|
2769
2769
|
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
2770
2770
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2771
|
+
* @param {string} [params.subType] *contract only* 'linear', 'inverse'
|
|
2771
2772
|
* @param {string} [params.productType] *contract only* 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES'
|
|
2772
2773
|
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
2773
2774
|
*/
|
|
@@ -2784,16 +2785,21 @@ class bitget extends bitget$1 {
|
|
|
2784
2785
|
market = this.market(symbol);
|
|
2785
2786
|
}
|
|
2786
2787
|
}
|
|
2788
|
+
let response = undefined;
|
|
2787
2789
|
const request = {};
|
|
2788
2790
|
let type = undefined;
|
|
2789
2791
|
[type, params] = this.handleMarketTypeAndParams('fetchTickers', market, params);
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
+
// Calls like `.fetchTickers (undefined, {subType:'inverse'})` should be supported for this exchange, so
|
|
2793
|
+
// as "options.defaultSubType" is also set in exchange options, we should consider `params.subType`
|
|
2794
|
+
// with higher priority and only default to spot, if `subType` is not set in params
|
|
2795
|
+
const passedSubType = this.safeString(params, 'subType');
|
|
2796
|
+
let productType = undefined;
|
|
2797
|
+
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
2798
|
+
// only if passedSubType && productType is undefined, then use spot
|
|
2799
|
+
if (type === 'spot' && passedSubType === undefined) {
|
|
2792
2800
|
response = await this.publicSpotGetV2SpotMarketTickers(this.extend(request, params));
|
|
2793
2801
|
}
|
|
2794
2802
|
else {
|
|
2795
|
-
let productType = undefined;
|
|
2796
|
-
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
2797
2803
|
request['productType'] = productType;
|
|
2798
2804
|
response = await this.publicMixGetV2MixMarketTickers(this.extend(request, params));
|
|
2799
2805
|
}
|
package/dist/cjs/src/bybit.js
CHANGED
|
@@ -468,7 +468,7 @@ class bybit extends bybit$1 {
|
|
|
468
468
|
'v5/account/mmp-modify': 5,
|
|
469
469
|
'v5/account/mmp-reset': 5,
|
|
470
470
|
// asset
|
|
471
|
-
'v5/asset/transfer/inter-transfer':
|
|
471
|
+
'v5/asset/transfer/inter-transfer': 50,
|
|
472
472
|
'v5/asset/transfer/save-transfer-sub-member': 150,
|
|
473
473
|
'v5/asset/transfer/universal-transfer': 10,
|
|
474
474
|
'v5/asset/deposit/deposit-to-account': 5,
|
|
@@ -2840,11 +2840,11 @@ class bybit extends bybit$1 {
|
|
|
2840
2840
|
request['category'] = 'option';
|
|
2841
2841
|
}
|
|
2842
2842
|
else if (market['linear']) {
|
|
2843
|
-
// limit: [1,
|
|
2843
|
+
// limit: [1, 500]. Default: 25
|
|
2844
2844
|
request['category'] = 'linear';
|
|
2845
2845
|
}
|
|
2846
2846
|
else if (market['inverse']) {
|
|
2847
|
-
// limit: [1,
|
|
2847
|
+
// limit: [1, 500]. Default: 25
|
|
2848
2848
|
request['category'] = 'inverse';
|
|
2849
2849
|
}
|
|
2850
2850
|
}
|
package/dist/cjs/src/coinex.js
CHANGED
|
@@ -3760,8 +3760,7 @@ class coinex extends coinex$1 {
|
|
|
3760
3760
|
// }
|
|
3761
3761
|
//
|
|
3762
3762
|
const marketId = this.safeString(position, 'market');
|
|
3763
|
-
|
|
3764
|
-
market = this.safeMarket(marketId, market, undefined, defaultType);
|
|
3763
|
+
market = this.safeMarket(marketId, market, undefined, 'swap');
|
|
3765
3764
|
const symbol = market['symbol'];
|
|
3766
3765
|
const positionId = this.safeInteger(position, 'position_id');
|
|
3767
3766
|
const marginModeInteger = this.safeInteger(position, 'type');
|
package/dist/cjs/src/htx.js
CHANGED
|
@@ -2199,7 +2199,7 @@ class htx extends htx$1 {
|
|
|
2199
2199
|
// "ts":1639547261293
|
|
2200
2200
|
// }
|
|
2201
2201
|
//
|
|
2202
|
-
//
|
|
2202
|
+
// linear swap, linear future, inverse swap, inverse future
|
|
2203
2203
|
//
|
|
2204
2204
|
// {
|
|
2205
2205
|
// "status":"ok",
|
|
@@ -2216,37 +2216,15 @@ class htx extends htx$1 {
|
|
|
2216
2216
|
// "high":"0.10725",
|
|
2217
2217
|
// "amount":"2340267.415144052378486261756692535687481566",
|
|
2218
2218
|
// "count":882,
|
|
2219
|
-
// "vol":"24706"
|
|
2219
|
+
// "vol":"24706",
|
|
2220
|
+
// "trade_turnover":"840726.5048", // only in linear futures
|
|
2221
|
+
// "business_type":"futures", // only in linear futures
|
|
2222
|
+
// "contract_code":"BTC-USDT-CW", // only in linear futures, instead of 'symbol'
|
|
2220
2223
|
// }
|
|
2221
2224
|
// ],
|
|
2222
2225
|
// "ts":1637504679376
|
|
2223
2226
|
// }
|
|
2224
2227
|
//
|
|
2225
|
-
// linear futures
|
|
2226
|
-
//
|
|
2227
|
-
// {
|
|
2228
|
-
// "status":"ok",
|
|
2229
|
-
// "ticks":[
|
|
2230
|
-
// {
|
|
2231
|
-
// "id":1640745627,
|
|
2232
|
-
// "ts":1640745627957,
|
|
2233
|
-
// "ask":[48079.1,20],
|
|
2234
|
-
// "bid":[47713.8,125],
|
|
2235
|
-
// "business_type":"futures",
|
|
2236
|
-
// "contract_code":"BTC-USDT-CW",
|
|
2237
|
-
// "open":"49011.8",
|
|
2238
|
-
// "close":"47934",
|
|
2239
|
-
// "low":"47292.3",
|
|
2240
|
-
// "high":"49011.8",
|
|
2241
|
-
// "amount":"17.398",
|
|
2242
|
-
// "count":1515,
|
|
2243
|
-
// "vol":"17398",
|
|
2244
|
-
// "trade_turnover":"840726.5048"
|
|
2245
|
-
// }
|
|
2246
|
-
// ],
|
|
2247
|
-
// "ts":1640745627988
|
|
2248
|
-
// }
|
|
2249
|
-
//
|
|
2250
2228
|
const tickers = this.safeValue2(response, 'data', 'ticks', []);
|
|
2251
2229
|
const timestamp = this.safeInteger(response, 'ts');
|
|
2252
2230
|
const result = {};
|
package/dist/cjs/src/kucoin.js
CHANGED
|
@@ -423,6 +423,7 @@ class kucoin extends kucoin$1 {
|
|
|
423
423
|
'Order size below the minimum requirement.': errors.InvalidOrder,
|
|
424
424
|
'The withdrawal amount is below the minimum requirement.': errors.ExchangeError,
|
|
425
425
|
'Unsuccessful! Exceeded the max. funds out-transfer limit': errors.InsufficientFunds,
|
|
426
|
+
'The amount increment is invalid.': errors.BadRequest,
|
|
426
427
|
'400': errors.BadRequest,
|
|
427
428
|
'401': errors.AuthenticationError,
|
|
428
429
|
'403': errors.NotSupported,
|
|
@@ -2160,6 +2161,14 @@ class kucoin extends kucoin$1 {
|
|
|
2160
2161
|
data = this.safeList(data, 'data', []);
|
|
2161
2162
|
return this.parseOrders(data);
|
|
2162
2163
|
}
|
|
2164
|
+
marketOrderAmountToPrecision(symbol, amount) {
|
|
2165
|
+
const market = this.market(symbol);
|
|
2166
|
+
const result = this.decimalToPrecision(amount, number.TRUNCATE, market['info']['quoteIncrement'], this.precisionMode, this.paddingMode);
|
|
2167
|
+
if (result === '0') {
|
|
2168
|
+
throw new errors.InvalidOrder(this.id + ' amount of ' + market['symbol'] + ' must be greater than minimum amount precision of ' + this.numberToString(market['precision']['amount']));
|
|
2169
|
+
}
|
|
2170
|
+
return result;
|
|
2171
|
+
}
|
|
2163
2172
|
createOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
|
|
2164
2173
|
const market = this.market(symbol);
|
|
2165
2174
|
// required param, cannot be used twice
|
|
@@ -2180,7 +2189,7 @@ class kucoin extends kucoin$1 {
|
|
|
2180
2189
|
if (quoteAmount !== undefined) {
|
|
2181
2190
|
params = this.omit(params, ['cost', 'funds']);
|
|
2182
2191
|
// kucoin uses base precision even for quote values
|
|
2183
|
-
costString = this.
|
|
2192
|
+
costString = this.marketOrderAmountToPrecision(symbol, quoteAmount);
|
|
2184
2193
|
request['funds'] = costString;
|
|
2185
2194
|
}
|
|
2186
2195
|
else {
|
package/js/ccxt.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import * as functions from './src/base/functions.js';
|
|
|
4
4
|
import * as errors from './src/base/errors.js';
|
|
5
5
|
import type { Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation, FundingHistory, MarginMode, Greeks, Leverage, Leverages, Option, OptionChain } from './src/base/types.js';
|
|
6
6
|
import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
|
|
7
|
-
declare const version = "4.2.
|
|
7
|
+
declare const version = "4.2.83";
|
|
8
8
|
import ace from './src/ace.js';
|
|
9
9
|
import alpaca from './src/alpaca.js';
|
|
10
10
|
import ascendex from './src/ascendex.js';
|
package/js/ccxt.js
CHANGED
|
@@ -38,7 +38,7 @@ import * as errors from './src/base/errors.js';
|
|
|
38
38
|
import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
|
|
39
39
|
//-----------------------------------------------------------------------------
|
|
40
40
|
// this is updated by vss.js when building
|
|
41
|
-
const version = '4.2.
|
|
41
|
+
const version = '4.2.84';
|
|
42
42
|
Exchange.ccxtVersion = version;
|
|
43
43
|
//-----------------------------------------------------------------------------
|
|
44
44
|
import ace from './src/ace.js';
|
package/js/src/bitget.js
CHANGED
|
@@ -2771,6 +2771,7 @@ export default class bitget extends Exchange {
|
|
|
2771
2771
|
* @see https://www.bitget.com/api-doc/contract/market/Get-All-Symbol-Ticker
|
|
2772
2772
|
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
2773
2773
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2774
|
+
* @param {string} [params.subType] *contract only* 'linear', 'inverse'
|
|
2774
2775
|
* @param {string} [params.productType] *contract only* 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES'
|
|
2775
2776
|
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
2776
2777
|
*/
|
|
@@ -2787,16 +2788,21 @@ export default class bitget extends Exchange {
|
|
|
2787
2788
|
market = this.market(symbol);
|
|
2788
2789
|
}
|
|
2789
2790
|
}
|
|
2791
|
+
let response = undefined;
|
|
2790
2792
|
const request = {};
|
|
2791
2793
|
let type = undefined;
|
|
2792
2794
|
[type, params] = this.handleMarketTypeAndParams('fetchTickers', market, params);
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
+
// Calls like `.fetchTickers (undefined, {subType:'inverse'})` should be supported for this exchange, so
|
|
2796
|
+
// as "options.defaultSubType" is also set in exchange options, we should consider `params.subType`
|
|
2797
|
+
// with higher priority and only default to spot, if `subType` is not set in params
|
|
2798
|
+
const passedSubType = this.safeString(params, 'subType');
|
|
2799
|
+
let productType = undefined;
|
|
2800
|
+
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
2801
|
+
// only if passedSubType && productType is undefined, then use spot
|
|
2802
|
+
if (type === 'spot' && passedSubType === undefined) {
|
|
2795
2803
|
response = await this.publicSpotGetV2SpotMarketTickers(this.extend(request, params));
|
|
2796
2804
|
}
|
|
2797
2805
|
else {
|
|
2798
|
-
let productType = undefined;
|
|
2799
|
-
[productType, params] = this.handleProductTypeAndParams(market, params);
|
|
2800
2806
|
request['productType'] = productType;
|
|
2801
2807
|
response = await this.publicMixGetV2MixMarketTickers(this.extend(request, params));
|
|
2802
2808
|
}
|
package/js/src/bybit.js
CHANGED
|
@@ -471,7 +471,7 @@ export default class bybit extends Exchange {
|
|
|
471
471
|
'v5/account/mmp-modify': 5,
|
|
472
472
|
'v5/account/mmp-reset': 5,
|
|
473
473
|
// asset
|
|
474
|
-
'v5/asset/transfer/inter-transfer':
|
|
474
|
+
'v5/asset/transfer/inter-transfer': 50,
|
|
475
475
|
'v5/asset/transfer/save-transfer-sub-member': 150,
|
|
476
476
|
'v5/asset/transfer/universal-transfer': 10,
|
|
477
477
|
'v5/asset/deposit/deposit-to-account': 5,
|
|
@@ -2843,11 +2843,11 @@ export default class bybit extends Exchange {
|
|
|
2843
2843
|
request['category'] = 'option';
|
|
2844
2844
|
}
|
|
2845
2845
|
else if (market['linear']) {
|
|
2846
|
-
// limit: [1,
|
|
2846
|
+
// limit: [1, 500]. Default: 25
|
|
2847
2847
|
request['category'] = 'linear';
|
|
2848
2848
|
}
|
|
2849
2849
|
else if (market['inverse']) {
|
|
2850
|
-
// limit: [1,
|
|
2850
|
+
// limit: [1, 500]. Default: 25
|
|
2851
2851
|
request['category'] = 'inverse';
|
|
2852
2852
|
}
|
|
2853
2853
|
}
|
package/js/src/coinex.js
CHANGED
|
@@ -3763,8 +3763,7 @@ export default class coinex extends Exchange {
|
|
|
3763
3763
|
// }
|
|
3764
3764
|
//
|
|
3765
3765
|
const marketId = this.safeString(position, 'market');
|
|
3766
|
-
|
|
3767
|
-
market = this.safeMarket(marketId, market, undefined, defaultType);
|
|
3766
|
+
market = this.safeMarket(marketId, market, undefined, 'swap');
|
|
3768
3767
|
const symbol = market['symbol'];
|
|
3769
3768
|
const positionId = this.safeInteger(position, 'position_id');
|
|
3770
3769
|
const marginModeInteger = this.safeInteger(position, 'type');
|
package/js/src/htx.js
CHANGED
|
@@ -2202,7 +2202,7 @@ export default class htx extends Exchange {
|
|
|
2202
2202
|
// "ts":1639547261293
|
|
2203
2203
|
// }
|
|
2204
2204
|
//
|
|
2205
|
-
//
|
|
2205
|
+
// linear swap, linear future, inverse swap, inverse future
|
|
2206
2206
|
//
|
|
2207
2207
|
// {
|
|
2208
2208
|
// "status":"ok",
|
|
@@ -2219,37 +2219,15 @@ export default class htx extends Exchange {
|
|
|
2219
2219
|
// "high":"0.10725",
|
|
2220
2220
|
// "amount":"2340267.415144052378486261756692535687481566",
|
|
2221
2221
|
// "count":882,
|
|
2222
|
-
// "vol":"24706"
|
|
2222
|
+
// "vol":"24706",
|
|
2223
|
+
// "trade_turnover":"840726.5048", // only in linear futures
|
|
2224
|
+
// "business_type":"futures", // only in linear futures
|
|
2225
|
+
// "contract_code":"BTC-USDT-CW", // only in linear futures, instead of 'symbol'
|
|
2223
2226
|
// }
|
|
2224
2227
|
// ],
|
|
2225
2228
|
// "ts":1637504679376
|
|
2226
2229
|
// }
|
|
2227
2230
|
//
|
|
2228
|
-
// linear futures
|
|
2229
|
-
//
|
|
2230
|
-
// {
|
|
2231
|
-
// "status":"ok",
|
|
2232
|
-
// "ticks":[
|
|
2233
|
-
// {
|
|
2234
|
-
// "id":1640745627,
|
|
2235
|
-
// "ts":1640745627957,
|
|
2236
|
-
// "ask":[48079.1,20],
|
|
2237
|
-
// "bid":[47713.8,125],
|
|
2238
|
-
// "business_type":"futures",
|
|
2239
|
-
// "contract_code":"BTC-USDT-CW",
|
|
2240
|
-
// "open":"49011.8",
|
|
2241
|
-
// "close":"47934",
|
|
2242
|
-
// "low":"47292.3",
|
|
2243
|
-
// "high":"49011.8",
|
|
2244
|
-
// "amount":"17.398",
|
|
2245
|
-
// "count":1515,
|
|
2246
|
-
// "vol":"17398",
|
|
2247
|
-
// "trade_turnover":"840726.5048"
|
|
2248
|
-
// }
|
|
2249
|
-
// ],
|
|
2250
|
-
// "ts":1640745627988
|
|
2251
|
-
// }
|
|
2252
|
-
//
|
|
2253
2231
|
const tickers = this.safeValue2(response, 'data', 'ticks', []);
|
|
2254
2232
|
const timestamp = this.safeInteger(response, 'ts');
|
|
2255
2233
|
const result = {};
|
package/js/src/kucoin.d.ts
CHANGED
|
@@ -71,6 +71,7 @@ export default class kucoin extends Exchange {
|
|
|
71
71
|
createMarketBuyOrderWithCost(symbol: string, cost: number, params?: {}): Promise<Order>;
|
|
72
72
|
createMarketSellOrderWithCost(symbol: string, cost: number, params?: {}): Promise<Order>;
|
|
73
73
|
createOrders(orders: OrderRequest[], params?: {}): Promise<Order[]>;
|
|
74
|
+
marketOrderAmountToPrecision(symbol: string, amount: any): any;
|
|
74
75
|
createOrderRequest(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): any;
|
|
75
76
|
editOrder(id: string, symbol: string, type: OrderType, side: OrderSide, amount?: Num, price?: Num, params?: {}): Promise<Order>;
|
|
76
77
|
cancelOrder(id: string, symbol?: Str, params?: {}): Promise<any>;
|
package/js/src/kucoin.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import Exchange from './abstract/kucoin.js';
|
|
9
9
|
import { ExchangeError, ExchangeNotAvailable, InsufficientFunds, OrderNotFound, InvalidOrder, AccountSuspended, InvalidNonce, NotSupported, BadRequest, AuthenticationError, BadSymbol, RateLimitExceeded, PermissionDenied, InvalidAddress, ArgumentsRequired } from './base/errors.js';
|
|
10
10
|
import { Precise } from './base/Precise.js';
|
|
11
|
-
import { TICK_SIZE } from './base/functions/number.js';
|
|
11
|
+
import { TICK_SIZE, TRUNCATE } from './base/functions/number.js';
|
|
12
12
|
import { sha256 } from './static_dependencies/noble-hashes/sha256.js';
|
|
13
13
|
// ---------------------------------------------------------------------------
|
|
14
14
|
/**
|
|
@@ -426,6 +426,7 @@ export default class kucoin extends Exchange {
|
|
|
426
426
|
'Order size below the minimum requirement.': InvalidOrder,
|
|
427
427
|
'The withdrawal amount is below the minimum requirement.': ExchangeError,
|
|
428
428
|
'Unsuccessful! Exceeded the max. funds out-transfer limit': InsufficientFunds,
|
|
429
|
+
'The amount increment is invalid.': BadRequest,
|
|
429
430
|
'400': BadRequest,
|
|
430
431
|
'401': AuthenticationError,
|
|
431
432
|
'403': NotSupported,
|
|
@@ -2163,6 +2164,14 @@ export default class kucoin extends Exchange {
|
|
|
2163
2164
|
data = this.safeList(data, 'data', []);
|
|
2164
2165
|
return this.parseOrders(data);
|
|
2165
2166
|
}
|
|
2167
|
+
marketOrderAmountToPrecision(symbol, amount) {
|
|
2168
|
+
const market = this.market(symbol);
|
|
2169
|
+
const result = this.decimalToPrecision(amount, TRUNCATE, market['info']['quoteIncrement'], this.precisionMode, this.paddingMode);
|
|
2170
|
+
if (result === '0') {
|
|
2171
|
+
throw new InvalidOrder(this.id + ' amount of ' + market['symbol'] + ' must be greater than minimum amount precision of ' + this.numberToString(market['precision']['amount']));
|
|
2172
|
+
}
|
|
2173
|
+
return result;
|
|
2174
|
+
}
|
|
2166
2175
|
createOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
|
|
2167
2176
|
const market = this.market(symbol);
|
|
2168
2177
|
// required param, cannot be used twice
|
|
@@ -2183,7 +2192,7 @@ export default class kucoin extends Exchange {
|
|
|
2183
2192
|
if (quoteAmount !== undefined) {
|
|
2184
2193
|
params = this.omit(params, ['cost', 'funds']);
|
|
2185
2194
|
// kucoin uses base precision even for quote values
|
|
2186
|
-
costString = this.
|
|
2195
|
+
costString = this.marketOrderAmountToPrecision(symbol, quoteAmount);
|
|
2187
2196
|
request['funds'] = costString;
|
|
2188
2197
|
}
|
|
2189
2198
|
else {
|
|
@@ -15,7 +15,7 @@ export declare class BigInteger {
|
|
|
15
15
|
protected intValue(): number;
|
|
16
16
|
protected byteValue(): number;
|
|
17
17
|
protected shortValue(): number;
|
|
18
|
-
protected signum():
|
|
18
|
+
protected signum(): 1 | 0 | -1;
|
|
19
19
|
toByteArray(): number[];
|
|
20
20
|
protected equals(a: BigInteger): boolean;
|
|
21
21
|
protected min(a: BigInteger): BigInteger;
|
package/package.json
CHANGED