ccxt 4.1.76 → 4.1.78
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 +574 -185
- package/dist/ccxt.browser.min.js +5 -5
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/bingx.js +4 -1
- package/dist/cjs/src/bitget.js +71 -0
- package/dist/cjs/src/bitmart.js +9 -13
- package/dist/cjs/src/bitmex.js +6 -0
- package/dist/cjs/src/bitrue.js +27 -1
- package/dist/cjs/src/bitstamp.js +3 -2
- package/dist/cjs/src/bybit.js +2 -0
- package/dist/cjs/src/coinbase.js +47 -9
- package/dist/cjs/src/coinex.js +7 -11
- package/dist/cjs/src/gate.js +5 -0
- package/dist/cjs/src/hitbtc.js +326 -123
- package/dist/cjs/src/idex.js +10 -1
- package/dist/cjs/src/mexc.js +33 -5
- package/dist/cjs/src/okx.js +6 -10
- package/dist/cjs/src/pro/binance.js +10 -2
- package/dist/cjs/src/pro/binanceus.js +1 -0
- package/dist/cjs/src/pro/gate.js +1 -1
- package/dist/cjs/src/upbit.js +5 -5
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bybit.d.ts +2 -0
- package/js/src/abstract/gate.d.ts +3 -0
- package/js/src/abstract/gateio.d.ts +3 -0
- package/js/src/abstract/okx.d.ts +2 -0
- package/js/src/base/Exchange.d.ts +1 -1
- package/js/src/bingx.js +4 -1
- package/js/src/bitget.d.ts +5 -4
- package/js/src/bitget.js +71 -0
- package/js/src/bitmart.js +9 -13
- package/js/src/bitmex.d.ts +1 -1
- package/js/src/bitmex.js +6 -0
- package/js/src/bitrue.d.ts +1 -0
- package/js/src/bitrue.js +27 -1
- package/js/src/bitstamp.js +3 -2
- package/js/src/bybit.js +2 -0
- package/js/src/coinbase.d.ts +1 -0
- package/js/src/coinbase.js +47 -9
- package/js/src/coinex.js +7 -11
- package/js/src/gate.js +5 -0
- package/js/src/hitbtc.js +326 -123
- package/js/src/idex.js +10 -1
- package/js/src/mexc.d.ts +1 -0
- package/js/src/mexc.js +33 -5
- package/js/src/okx.js +6 -10
- package/js/src/pro/binance.js +10 -2
- package/js/src/pro/binanceus.js +1 -0
- package/js/src/pro/gate.js +1 -1
- package/js/src/upbit.js +5 -5
- package/package.json +1 -1
- package/skip-tests.json +2 -1
- package/js/src/huobipro.d.ts +0 -4
- package/js/src/huobipro.js +0 -20
- package/js/src/mexc3.d.ts +0 -4
- package/js/src/mexc3.js +0 -17
- package/js/src/okex.d.ts +0 -4
- package/js/src/okex.js +0 -17
- package/js/src/okex5.d.ts +0 -4
- package/js/src/okex5.js +0 -17
- package/js/src/tidex.d.ts +0 -36
- package/js/src/tidex.js +0 -1068
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.78';
|
|
176
176
|
Exchange["default"].ccxtVersion = version;
|
|
177
177
|
const exchanges = {
|
|
178
178
|
'ace': ace,
|
package/dist/cjs/src/bingx.js
CHANGED
|
@@ -29,6 +29,8 @@ class bingx extends bingx$1 {
|
|
|
29
29
|
'cancelAllOrders': true,
|
|
30
30
|
'cancelOrder': true,
|
|
31
31
|
'cancelOrders': true,
|
|
32
|
+
'closeAllPositions': true,
|
|
33
|
+
'closePosition': false,
|
|
32
34
|
'createMarketBuyOrderWithCost': true,
|
|
33
35
|
'createMarketOrderWithCost': true,
|
|
34
36
|
'createMarketSellOrderWithCost': true,
|
|
@@ -1373,7 +1375,8 @@ class bingx extends bingx$1 {
|
|
|
1373
1375
|
const close = this.safeString(ticker, 'lastPrice');
|
|
1374
1376
|
const quoteVolume = this.safeString(ticker, 'quoteVolume');
|
|
1375
1377
|
const baseVolume = this.safeString(ticker, 'volume');
|
|
1376
|
-
|
|
1378
|
+
let percentage = this.safeString(ticker, 'priceChangePercent', ''); // priceChangePercent: '5.66%',
|
|
1379
|
+
percentage = percentage.replace('%', '');
|
|
1377
1380
|
const ts = this.safeInteger(ticker, 'closeTime');
|
|
1378
1381
|
const datetime = this.iso8601(ts);
|
|
1379
1382
|
const bid = this.safeString(ticker, 'bidPrice');
|
package/dist/cjs/src/bitget.js
CHANGED
|
@@ -35,6 +35,8 @@ class bitget extends bitget$1 {
|
|
|
35
35
|
'cancelAllOrders': true,
|
|
36
36
|
'cancelOrder': true,
|
|
37
37
|
'cancelOrders': true,
|
|
38
|
+
'closeAllPositions': true,
|
|
39
|
+
'closePosition': false,
|
|
38
40
|
'createOrder': true,
|
|
39
41
|
'createOrders': true,
|
|
40
42
|
'createReduceOnlyOrder': false,
|
|
@@ -5447,6 +5449,14 @@ class bitget extends bitget$1 {
|
|
|
5447
5449
|
// "utime": "1689300238205"
|
|
5448
5450
|
// }
|
|
5449
5451
|
//
|
|
5452
|
+
// closeAllPositions
|
|
5453
|
+
//
|
|
5454
|
+
// {
|
|
5455
|
+
// "symbol": "XRPUSDT_UMCBL",
|
|
5456
|
+
// "orderId": "1111861847410757635",
|
|
5457
|
+
// "clientOid": "1111861847410757637"
|
|
5458
|
+
// }
|
|
5459
|
+
//
|
|
5450
5460
|
const marketId = this.safeString(position, 'symbol');
|
|
5451
5461
|
market = this.safeMarket(marketId, market);
|
|
5452
5462
|
const symbol = market['symbol'];
|
|
@@ -6997,6 +7007,67 @@ class bitget extends bitget$1 {
|
|
|
6997
7007
|
'info': info,
|
|
6998
7008
|
};
|
|
6999
7009
|
}
|
|
7010
|
+
async closeAllPositions(params = {}) {
|
|
7011
|
+
/**
|
|
7012
|
+
* @method
|
|
7013
|
+
* @name bitget#closePositions
|
|
7014
|
+
* @description closes open positions for a market
|
|
7015
|
+
* @see https://bitgetlimited.github.io/apidoc/en/mix/#close-all-position
|
|
7016
|
+
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
7017
|
+
* @param {string} [params.subType] 'linear' or 'inverse'
|
|
7018
|
+
* @param {string} [params.settle] *required and only valid when params.subType === "linear"* 'USDT' or 'USDC'
|
|
7019
|
+
* @returns {[object]} [A list of position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
7020
|
+
*/
|
|
7021
|
+
await this.loadMarkets();
|
|
7022
|
+
let subType = undefined;
|
|
7023
|
+
let settle = undefined;
|
|
7024
|
+
[subType, params] = this.handleSubTypeAndParams('closeAllPositions', undefined, params);
|
|
7025
|
+
settle = this.safeString(params, 'settle', 'USDT');
|
|
7026
|
+
params = this.omit(params, ['settle']);
|
|
7027
|
+
const productType = this.safeString(params, 'productType');
|
|
7028
|
+
const request = {};
|
|
7029
|
+
if (productType === undefined) {
|
|
7030
|
+
const sandboxMode = this.safeValue(this.options, 'sandboxMode', false);
|
|
7031
|
+
let localProductType = undefined;
|
|
7032
|
+
if (subType === 'inverse') {
|
|
7033
|
+
localProductType = 'dmcbl';
|
|
7034
|
+
}
|
|
7035
|
+
else {
|
|
7036
|
+
if (settle === 'USDT') {
|
|
7037
|
+
localProductType = 'umcbl';
|
|
7038
|
+
}
|
|
7039
|
+
else if (settle === 'USDC') {
|
|
7040
|
+
localProductType = 'cmcbl';
|
|
7041
|
+
}
|
|
7042
|
+
}
|
|
7043
|
+
if (sandboxMode) {
|
|
7044
|
+
localProductType = 's' + localProductType;
|
|
7045
|
+
}
|
|
7046
|
+
request['productType'] = localProductType;
|
|
7047
|
+
}
|
|
7048
|
+
const response = await this.privateMixPostMixV1OrderCloseAllPositions(this.extend(request, params));
|
|
7049
|
+
//
|
|
7050
|
+
// {
|
|
7051
|
+
// "code": "00000",
|
|
7052
|
+
// "msg": "success",
|
|
7053
|
+
// "requestTime": 1700814442466,
|
|
7054
|
+
// "data": {
|
|
7055
|
+
// "orderInfo": [
|
|
7056
|
+
// {
|
|
7057
|
+
// "symbol": "XRPUSDT_UMCBL",
|
|
7058
|
+
// "orderId": "1111861847410757635",
|
|
7059
|
+
// "clientOid": "1111861847410757637"
|
|
7060
|
+
// },
|
|
7061
|
+
// ],
|
|
7062
|
+
// "failure": [],
|
|
7063
|
+
// "result": true
|
|
7064
|
+
// }
|
|
7065
|
+
// }
|
|
7066
|
+
//
|
|
7067
|
+
const data = this.safeValue(response, 'data', {});
|
|
7068
|
+
const orderInfo = this.safeValue(data, 'orderInfo', []);
|
|
7069
|
+
return this.parsePositions(orderInfo, undefined, params);
|
|
7070
|
+
}
|
|
7000
7071
|
handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
|
|
7001
7072
|
if (!response) {
|
|
7002
7073
|
return undefined; // fallback to default error handler
|
package/dist/cjs/src/bitmart.js
CHANGED
|
@@ -3338,19 +3338,15 @@ class bitmart extends bitmart$1 {
|
|
|
3338
3338
|
};
|
|
3339
3339
|
}
|
|
3340
3340
|
async fetchIsolatedBorrowRate(symbol, params = {}) {
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
// =======
|
|
3351
|
-
// @returns {object} an [isolated borrow rate structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#isolated-borrow-rate-structure}
|
|
3352
|
-
// >>>>>>> 3215552206edf1cda1ae63d2063535e19973dbe5
|
|
3353
|
-
//
|
|
3341
|
+
/**
|
|
3342
|
+
* @method
|
|
3343
|
+
* @name bitmart#fetchIsolatedBorrowRate
|
|
3344
|
+
* @description fetch the rate of interest to borrow a currency for margin trading
|
|
3345
|
+
* @see https://developer-pro.bitmart.com/en/spot/#get-trading-pair-borrowing-rate-and-amount-keyed
|
|
3346
|
+
* @param {string} symbol unified symbol of the market to fetch the borrow rate for
|
|
3347
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3348
|
+
* @returns {object} an [isolated borrow rate structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#isolated-borrow-rate-structure}
|
|
3349
|
+
*/
|
|
3354
3350
|
await this.loadMarkets();
|
|
3355
3351
|
const market = this.market(symbol);
|
|
3356
3352
|
const request = {
|
package/dist/cjs/src/bitmex.js
CHANGED
|
@@ -388,6 +388,12 @@ class bitmex extends bitmex$1 {
|
|
|
388
388
|
return this.parseNumber(finalAmount);
|
|
389
389
|
}
|
|
390
390
|
convertToRealAmount(code, amount) {
|
|
391
|
+
if (code === undefined) {
|
|
392
|
+
return amount;
|
|
393
|
+
}
|
|
394
|
+
else if (amount === undefined) {
|
|
395
|
+
return undefined;
|
|
396
|
+
}
|
|
391
397
|
const currency = this.currency(code);
|
|
392
398
|
const precision = this.safeString(currency, 'precision');
|
|
393
399
|
return Precise["default"].stringMul(amount, precision);
|
package/dist/cjs/src/bitrue.js
CHANGED
|
@@ -32,6 +32,9 @@ class bitrue extends bitrue$1 {
|
|
|
32
32
|
'option': false,
|
|
33
33
|
'cancelAllOrders': true,
|
|
34
34
|
'cancelOrder': true,
|
|
35
|
+
'createMarketBuyOrderWithCost': true,
|
|
36
|
+
'createMarketOrderWithCost': false,
|
|
37
|
+
'createMarketSellOrderWithCost': false,
|
|
35
38
|
'createOrder': true,
|
|
36
39
|
'createStopLimitOrder': true,
|
|
37
40
|
'createStopMarketOrder': true,
|
|
@@ -1886,6 +1889,26 @@ class bitrue extends bitrue$1 {
|
|
|
1886
1889
|
'trades': fills,
|
|
1887
1890
|
}, market);
|
|
1888
1891
|
}
|
|
1892
|
+
async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
|
|
1893
|
+
/**
|
|
1894
|
+
* @method
|
|
1895
|
+
* @name bitrue#createMarketBuyOrderWithCost
|
|
1896
|
+
* @description create a market buy order by providing the symbol and cost
|
|
1897
|
+
* @see https://www.bitrue.com/api-docs#new-order-trade-hmac-sha256
|
|
1898
|
+
* @see https://www.bitrue.com/api_docs_includes_file/delivery.html#new-order-trade-hmac-sha256
|
|
1899
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
1900
|
+
* @param {float} cost how much you want to trade in units of the quote currency
|
|
1901
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1902
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1903
|
+
*/
|
|
1904
|
+
await this.loadMarkets();
|
|
1905
|
+
const market = this.market(symbol);
|
|
1906
|
+
if (!market['swap']) {
|
|
1907
|
+
throw new errors.NotSupported(this.id + ' createMarketBuyOrderWithCost() supports swap orders only');
|
|
1908
|
+
}
|
|
1909
|
+
params['createMarketBuyOrderRequiresPrice'] = false;
|
|
1910
|
+
return await this.createOrder(symbol, 'market', 'buy', cost, undefined, params);
|
|
1911
|
+
}
|
|
1889
1912
|
async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
|
|
1890
1913
|
/**
|
|
1891
1914
|
* @method
|
|
@@ -1909,6 +1932,7 @@ class bitrue extends bitrue$1 {
|
|
|
1909
1932
|
* EXCHANGE SPECIFIC PARAMETERS
|
|
1910
1933
|
* @param {decimal} [params.icebergQty]
|
|
1911
1934
|
* @param {long} [params.recvWindow]
|
|
1935
|
+
* @param {float} [params.cost] *swap market buy only* the quote quantity that can be used as an alternative for the amount
|
|
1912
1936
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1913
1937
|
*/
|
|
1914
1938
|
await this.loadMarkets();
|
|
@@ -1945,7 +1969,9 @@ class bitrue extends bitrue$1 {
|
|
|
1945
1969
|
request['type'] = 'IOC';
|
|
1946
1970
|
}
|
|
1947
1971
|
request['contractName'] = market['id'];
|
|
1948
|
-
|
|
1972
|
+
let createMarketBuyOrderRequiresPrice = true;
|
|
1973
|
+
[createMarketBuyOrderRequiresPrice, params] = this.handleOptionAndParams(params, 'createOrder', 'createMarketBuyOrderRequiresPrice', true);
|
|
1974
|
+
if (isMarket && (side === 'buy') && createMarketBuyOrderRequiresPrice) {
|
|
1949
1975
|
const cost = this.safeString(params, 'cost');
|
|
1950
1976
|
params = this.omit(params, 'cost');
|
|
1951
1977
|
if (price === undefined && cost === undefined) {
|
package/dist/cjs/src/bitstamp.js
CHANGED
|
@@ -1039,6 +1039,7 @@ class bitstamp extends bitstamp$1 {
|
|
|
1039
1039
|
* @method
|
|
1040
1040
|
* @name bitstamp#fetchOHLCV
|
|
1041
1041
|
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
1042
|
+
* @see https://www.bitstamp.net/api/#tag/Market-info/operation/GetOHLCData
|
|
1042
1043
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
1043
1044
|
* @param {string} timeframe the length of time each candle represents
|
|
1044
1045
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
@@ -1061,7 +1062,7 @@ class bitstamp extends bitstamp$1 {
|
|
|
1061
1062
|
limit = 1000;
|
|
1062
1063
|
const start = this.parseToInt(since / 1000);
|
|
1063
1064
|
request['start'] = start;
|
|
1064
|
-
request['end'] = this.sum(start,
|
|
1065
|
+
request['end'] = this.sum(start, duration * (limit - 1));
|
|
1065
1066
|
request['limit'] = limit;
|
|
1066
1067
|
}
|
|
1067
1068
|
}
|
|
@@ -1069,7 +1070,7 @@ class bitstamp extends bitstamp$1 {
|
|
|
1069
1070
|
if (since !== undefined) {
|
|
1070
1071
|
const start = this.parseToInt(since / 1000);
|
|
1071
1072
|
request['start'] = start;
|
|
1072
|
-
request['end'] = this.sum(start,
|
|
1073
|
+
request['end'] = this.sum(start, duration * (limit - 1));
|
|
1073
1074
|
}
|
|
1074
1075
|
request['limit'] = Math.min(limit, 1000); // min 1, max 1000
|
|
1075
1076
|
}
|
package/dist/cjs/src/bybit.js
CHANGED
package/dist/cjs/src/coinbase.js
CHANGED
|
@@ -41,7 +41,10 @@ class coinbase extends coinbase$1 {
|
|
|
41
41
|
'createLimitBuyOrder': true,
|
|
42
42
|
'createLimitSellOrder': true,
|
|
43
43
|
'createMarketBuyOrder': true,
|
|
44
|
+
'createMarketBuyOrderWithCost': true,
|
|
45
|
+
'createMarketOrderWithCost': false,
|
|
44
46
|
'createMarketSellOrder': true,
|
|
47
|
+
'createMarketSellOrderWithCost': false,
|
|
45
48
|
'createOrder': true,
|
|
46
49
|
'createPostOnlyOrder': true,
|
|
47
50
|
'createReduceOnlyOrder': false,
|
|
@@ -904,7 +907,11 @@ class coinbase extends coinbase$1 {
|
|
|
904
907
|
else {
|
|
905
908
|
cost = costString;
|
|
906
909
|
}
|
|
907
|
-
|
|
910
|
+
let feeCurrencyId = this.safeString(feeObject, 'currency');
|
|
911
|
+
const feeCost = this.safeNumber(feeObject, 'amount', this.parseNumber(v3FeeCost));
|
|
912
|
+
if ((feeCurrencyId === undefined) && (market !== undefined) && (feeCost !== undefined)) {
|
|
913
|
+
feeCurrencyId = market['quote'];
|
|
914
|
+
}
|
|
908
915
|
const datetime = this.safeStringN(trade, ['created_at', 'trade_time', 'time']);
|
|
909
916
|
const side = this.safeStringLower2(trade, 'resource', 'side');
|
|
910
917
|
const takerOrMaker = this.safeStringLower(trade, 'liquidity_indicator');
|
|
@@ -922,7 +929,7 @@ class coinbase extends coinbase$1 {
|
|
|
922
929
|
'amount': amountString,
|
|
923
930
|
'cost': cost,
|
|
924
931
|
'fee': {
|
|
925
|
-
'cost':
|
|
932
|
+
'cost': feeCost,
|
|
926
933
|
'currency': this.safeCurrencyCode(feeCurrencyId),
|
|
927
934
|
},
|
|
928
935
|
});
|
|
@@ -2080,6 +2087,25 @@ class coinbase extends coinbase$1 {
|
|
|
2080
2087
|
}
|
|
2081
2088
|
return request;
|
|
2082
2089
|
}
|
|
2090
|
+
async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
|
|
2091
|
+
/**
|
|
2092
|
+
* @method
|
|
2093
|
+
* @name coinbase#createMarketBuyOrderWithCost
|
|
2094
|
+
* @description create a market buy order by providing the symbol and cost
|
|
2095
|
+
* @see https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_postorder
|
|
2096
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
2097
|
+
* @param {float} cost how much you want to trade in units of the quote currency
|
|
2098
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2099
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
2100
|
+
*/
|
|
2101
|
+
await this.loadMarkets();
|
|
2102
|
+
const market = this.market(symbol);
|
|
2103
|
+
if (!market['spot']) {
|
|
2104
|
+
throw new errors.NotSupported(this.id + ' createMarketBuyOrderWithCost() supports spot orders only');
|
|
2105
|
+
}
|
|
2106
|
+
params['createMarketBuyOrderRequiresPrice'] = false;
|
|
2107
|
+
return await this.createOrder(symbol, 'market', 'buy', cost, undefined, params);
|
|
2108
|
+
}
|
|
2083
2109
|
async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
|
|
2084
2110
|
/**
|
|
2085
2111
|
* @method
|
|
@@ -2100,6 +2126,7 @@ class coinbase extends coinbase$1 {
|
|
|
2100
2126
|
* @param {string} [params.timeInForce] 'GTC', 'IOC', 'GTD' or 'PO'
|
|
2101
2127
|
* @param {string} [params.stop_direction] 'UNKNOWN_STOP_DIRECTION', 'STOP_DIRECTION_STOP_UP', 'STOP_DIRECTION_STOP_DOWN' the direction the stopPrice is triggered from
|
|
2102
2128
|
* @param {string} [params.end_time] '2023-05-25T17:01:05.092Z' for 'GTD' orders
|
|
2129
|
+
* @param {float} [params.cost] *spot market buy only* the quote quantity that can be used as an alternative for the amount
|
|
2103
2130
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
2104
2131
|
*/
|
|
2105
2132
|
await this.loadMarkets();
|
|
@@ -2202,21 +2229,27 @@ class coinbase extends coinbase$1 {
|
|
|
2202
2229
|
throw new errors.NotSupported(this.id + ' createOrder() only stop limit orders are supported');
|
|
2203
2230
|
}
|
|
2204
2231
|
if (side === 'buy') {
|
|
2205
|
-
const createMarketBuyOrderRequiresPrice = this.safeValue(this.options, 'createMarketBuyOrderRequiresPrice', true);
|
|
2206
2232
|
let total = undefined;
|
|
2207
|
-
|
|
2233
|
+
let createMarketBuyOrderRequiresPrice = true;
|
|
2234
|
+
[createMarketBuyOrderRequiresPrice, params] = this.handleOptionAndParams(params, 'createOrder', 'createMarketBuyOrderRequiresPrice', true);
|
|
2235
|
+
const cost = this.safeNumber(params, 'cost');
|
|
2236
|
+
params = this.omit(params, 'cost');
|
|
2237
|
+
if (cost !== undefined) {
|
|
2238
|
+
total = this.costToPrecision(symbol, cost);
|
|
2239
|
+
}
|
|
2240
|
+
else if (createMarketBuyOrderRequiresPrice) {
|
|
2208
2241
|
if (price === undefined) {
|
|
2209
|
-
throw new errors.InvalidOrder(this.id + ' createOrder() requires a price argument for market buy orders on spot markets to calculate the total amount to spend (amount * price), alternatively set the createMarketBuyOrderRequiresPrice option to false and pass
|
|
2242
|
+
throw new errors.InvalidOrder(this.id + ' createOrder() requires a price argument for market buy orders on spot markets to calculate the total amount to spend (amount * price), alternatively set the createMarketBuyOrderRequiresPrice option or param to false and pass the cost to spend in the amount argument');
|
|
2210
2243
|
}
|
|
2211
2244
|
else {
|
|
2212
2245
|
const amountString = this.numberToString(amount);
|
|
2213
2246
|
const priceString = this.numberToString(price);
|
|
2214
|
-
const
|
|
2215
|
-
total = this.
|
|
2247
|
+
const costRequest = Precise["default"].stringMul(amountString, priceString);
|
|
2248
|
+
total = this.costToPrecision(symbol, costRequest);
|
|
2216
2249
|
}
|
|
2217
2250
|
}
|
|
2218
2251
|
else {
|
|
2219
|
-
total = this.
|
|
2252
|
+
total = this.costToPrecision(symbol, amount);
|
|
2220
2253
|
}
|
|
2221
2254
|
request['order_configuration'] = {
|
|
2222
2255
|
'market_market_ioc': {
|
|
@@ -2346,6 +2379,11 @@ class coinbase extends coinbase$1 {
|
|
|
2346
2379
|
amount = this.safeString(marketIOC, 'base_size');
|
|
2347
2380
|
}
|
|
2348
2381
|
const datetime = this.safeString(order, 'created_time');
|
|
2382
|
+
const totalFees = this.safeString(order, 'total_fees');
|
|
2383
|
+
let currencyFee = undefined;
|
|
2384
|
+
if ((totalFees !== undefined) && (market !== undefined)) {
|
|
2385
|
+
currencyFee = market['quote'];
|
|
2386
|
+
}
|
|
2349
2387
|
return this.safeOrder({
|
|
2350
2388
|
'info': order,
|
|
2351
2389
|
'id': this.safeString(order, 'order_id'),
|
|
@@ -2369,7 +2407,7 @@ class coinbase extends coinbase$1 {
|
|
|
2369
2407
|
'status': this.parseOrderStatus(this.safeString(order, 'status')),
|
|
2370
2408
|
'fee': {
|
|
2371
2409
|
'cost': this.safeString(order, 'total_fees'),
|
|
2372
|
-
'currency':
|
|
2410
|
+
'currency': currencyFee,
|
|
2373
2411
|
},
|
|
2374
2412
|
'trades': undefined,
|
|
2375
2413
|
}, market);
|
package/dist/cjs/src/coinex.js
CHANGED
|
@@ -4822,17 +4822,13 @@ class coinex extends coinex$1 {
|
|
|
4822
4822
|
return this.parseIsolatedBorrowRate(data, market);
|
|
4823
4823
|
}
|
|
4824
4824
|
async fetchIsolatedBorrowRates(params = {}) {
|
|
4825
|
-
|
|
4826
|
-
|
|
4827
|
-
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
|
|
4832
|
-
// =======
|
|
4833
|
-
// @returns {object} a list of [isolated borrow rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#isolated-borrow-rate-structure}
|
|
4834
|
-
// >>>>>>> 3215552206edf1cda1ae63d2063535e19973dbe5
|
|
4835
|
-
//
|
|
4825
|
+
/**
|
|
4826
|
+
* @method
|
|
4827
|
+
* @name coinex#fetchIsolatedBorrowRates
|
|
4828
|
+
* @description fetch the borrow interest rates of all currencies
|
|
4829
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4830
|
+
* @returns {object} a list of [isolated borrow rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#isolated-borrow-rate-structure}
|
|
4831
|
+
*/
|
|
4836
4832
|
await this.loadMarkets();
|
|
4837
4833
|
const response = await this.privateGetMarginConfig(params);
|
|
4838
4834
|
//
|
package/dist/cjs/src/gate.js
CHANGED
|
@@ -45,6 +45,7 @@ class gate extends gate$1 {
|
|
|
45
45
|
'spot': 'https://api.gateio.ws/api/v4',
|
|
46
46
|
'options': 'https://api.gateio.ws/api/v4',
|
|
47
47
|
'subAccounts': 'https://api.gateio.ws/api/v4',
|
|
48
|
+
'portfolio': 'https://api.gateio.ws/api/v4',
|
|
48
49
|
'rebate': 'https://api.gateio.ws/api/v4',
|
|
49
50
|
'earn': 'https://api.gateio.ws/api/v4',
|
|
50
51
|
'account': 'https://api.gateio.ws/api/v4',
|
|
@@ -482,10 +483,13 @@ class gate extends gate$1 {
|
|
|
482
483
|
},
|
|
483
484
|
'earn': {
|
|
484
485
|
'get': {
|
|
486
|
+
'uni/currencies': 20 / 15,
|
|
487
|
+
'uni/currencies/{currency}': 20 / 15,
|
|
485
488
|
'uni/lends': 20 / 15,
|
|
486
489
|
'uni/lend_records': 20 / 15,
|
|
487
490
|
'uni/interests/{currency}': 20 / 15,
|
|
488
491
|
'uni/interest_records': 20 / 15,
|
|
492
|
+
'uni/interest_status/{currency}': 20 / 15,
|
|
489
493
|
},
|
|
490
494
|
'post': {
|
|
491
495
|
'uni/lends': 20 / 15,
|
|
@@ -542,6 +546,7 @@ class gate extends gate$1 {
|
|
|
542
546
|
'15m': '15m',
|
|
543
547
|
'30m': '30m',
|
|
544
548
|
'1h': '1h',
|
|
549
|
+
'2h': '2h',
|
|
545
550
|
'4h': '4h',
|
|
546
551
|
'8h': '8h',
|
|
547
552
|
'1d': '1d',
|