ccxt 4.1.71 → 4.1.73
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 +118 -40
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +28 -2
- package/dist/cjs/src/bingx.js +21 -4
- package/dist/cjs/src/coinex.js +26 -8
- package/dist/cjs/src/gate.js +8 -1
- package/dist/cjs/src/latoken.js +27 -20
- package/dist/cjs/src/mexc.js +4 -4
- package/dist/cjs/src/pro/binance.js +3 -0
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/base/Exchange.d.ts +6 -2
- package/js/src/base/Exchange.js +28 -2
- package/js/src/bingx.js +21 -4
- package/js/src/coinex.d.ts +1 -0
- package/js/src/coinex.js +26 -8
- package/js/src/gate.js +8 -1
- package/js/src/latoken.d.ts +6 -1
- package/js/src/latoken.js +28 -21
- package/js/src/mexc.js +4 -4
- package/js/src/pro/binance.js +3 -0
- package/package.json +2 -1
- package/rollup.config.js +13 -0
package/README.md
CHANGED
|
@@ -211,13 +211,13 @@ console.log(version, Object.keys(exchanges));
|
|
|
211
211
|
|
|
212
212
|
All-in-one browser bundle (dependencies included), served from a CDN of your choice:
|
|
213
213
|
|
|
214
|
-
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.1.
|
|
215
|
-
* unpkg: https://unpkg.com/ccxt@4.1.
|
|
214
|
+
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.1.73/dist/ccxt.browser.js
|
|
215
|
+
* unpkg: https://unpkg.com/ccxt@4.1.73/dist/ccxt.browser.js
|
|
216
216
|
|
|
217
217
|
CDNs are not updated in real-time and may have delays. Defaulting to the most recent version without specifying the version number is not recommended. Please, keep in mind that we are not responsible for the correct operation of those CDN servers.
|
|
218
218
|
|
|
219
219
|
```HTML
|
|
220
|
-
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.1.
|
|
220
|
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.1.73/dist/ccxt.browser.js"></script>
|
|
221
221
|
```
|
|
222
222
|
|
|
223
223
|
Creates a global `ccxt` object:
|
package/dist/ccxt.browser.js
CHANGED
|
@@ -7352,6 +7352,8 @@ class Exchange {
|
|
|
7352
7352
|
'createLimitOrder': true,
|
|
7353
7353
|
'createMarketOrder': true,
|
|
7354
7354
|
'createOrder': true,
|
|
7355
|
+
'createMarketBuyOrderWithCost': undefined,
|
|
7356
|
+
'createMarketSellOrderWithCost': undefined,
|
|
7355
7357
|
'createOrders': undefined,
|
|
7356
7358
|
'createPostOnlyOrder': undefined,
|
|
7357
7359
|
'createReduceOnlyOrder': undefined,
|
|
@@ -10553,6 +10555,30 @@ class Exchange {
|
|
|
10553
10555
|
async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
|
|
10554
10556
|
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' createOrder() is not supported yet');
|
|
10555
10557
|
}
|
|
10558
|
+
async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
|
|
10559
|
+
/**
|
|
10560
|
+
* @method
|
|
10561
|
+
* @name createMarketBuyWithCost
|
|
10562
|
+
* @description create a market buy order by providing the symbol and cost
|
|
10563
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
10564
|
+
* @param {float} cost how much you want to trade in units of the quote currency
|
|
10565
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
10566
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
10567
|
+
*/
|
|
10568
|
+
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' createMarketBuyOrderWithCost() is not supported yet');
|
|
10569
|
+
}
|
|
10570
|
+
async createMarketSellOrderWithCost(symbol, cost, params = {}) {
|
|
10571
|
+
/**
|
|
10572
|
+
* @method
|
|
10573
|
+
* @name createMarketSellOrderWithCost
|
|
10574
|
+
* @description create a market buy order by providing the symbol and cost
|
|
10575
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
10576
|
+
* @param {float} cost how much you want to trade in units of the quote currency
|
|
10577
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
10578
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
10579
|
+
*/
|
|
10580
|
+
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' createMarketSellOrderWithCost() is not supported yet');
|
|
10581
|
+
}
|
|
10556
10582
|
async createOrders(orders, params = {}) {
|
|
10557
10583
|
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' createOrders() is not supported yet');
|
|
10558
10584
|
}
|
|
@@ -10629,10 +10655,10 @@ class Exchange {
|
|
|
10629
10655
|
*/
|
|
10630
10656
|
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchDepositsWithdrawals() is not supported yet');
|
|
10631
10657
|
}
|
|
10632
|
-
async fetchDeposits(
|
|
10658
|
+
async fetchDeposits(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
10633
10659
|
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchDeposits() is not supported yet');
|
|
10634
10660
|
}
|
|
10635
|
-
async fetchWithdrawals(
|
|
10661
|
+
async fetchWithdrawals(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
10636
10662
|
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchWithdrawals() is not supported yet');
|
|
10637
10663
|
}
|
|
10638
10664
|
async fetchOpenInterest(symbol, params = {}) {
|
|
@@ -28790,15 +28816,17 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
28790
28816
|
// "symbol": "XRP-USDT",
|
|
28791
28817
|
// "orderId": 1514073325788200960,
|
|
28792
28818
|
// "price": "0.5",
|
|
28819
|
+
// "StopPrice": "0",
|
|
28793
28820
|
// "origQty": "20",
|
|
28794
|
-
// "executedQty": "
|
|
28795
|
-
// "cummulativeQuoteQty": "
|
|
28821
|
+
// "executedQty": "10",
|
|
28822
|
+
// "cummulativeQuoteQty": "5",
|
|
28796
28823
|
// "status": "PENDING",
|
|
28797
28824
|
// "type": "LIMIT",
|
|
28798
28825
|
// "side": "BUY",
|
|
28799
28826
|
// "time": 1649818185647,
|
|
28800
28827
|
// "updateTime": 1649818185647,
|
|
28801
28828
|
// "origQuoteOrderQty": "0"
|
|
28829
|
+
// "fee": "-0.01"
|
|
28802
28830
|
// }
|
|
28803
28831
|
//
|
|
28804
28832
|
//
|
|
@@ -28858,9 +28886,24 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
28858
28886
|
const amount = this.safeString2(order, 'origQty', 'q');
|
|
28859
28887
|
const filled = this.safeString2(order, 'executedQty', 'z');
|
|
28860
28888
|
const statusId = this.safeString2(order, 'status', 'X');
|
|
28889
|
+
let feeCurrencyCode = this.safeString2(order, 'feeAsset', 'N');
|
|
28890
|
+
const feeCost = this.safeStringN(order, ['fee', 'commission', 'n']);
|
|
28891
|
+
if ((feeCurrencyCode === undefined)) {
|
|
28892
|
+
if (market['spot']) {
|
|
28893
|
+
if (side === 'buy') {
|
|
28894
|
+
feeCurrencyCode = market['base'];
|
|
28895
|
+
}
|
|
28896
|
+
else {
|
|
28897
|
+
feeCurrencyCode = market['quote'];
|
|
28898
|
+
}
|
|
28899
|
+
}
|
|
28900
|
+
else {
|
|
28901
|
+
feeCurrencyCode = market['quote'];
|
|
28902
|
+
}
|
|
28903
|
+
}
|
|
28861
28904
|
const fee = {
|
|
28862
|
-
'currency':
|
|
28863
|
-
'
|
|
28905
|
+
'currency': feeCurrencyCode,
|
|
28906
|
+
'cost': _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringAbs(feeCost),
|
|
28864
28907
|
};
|
|
28865
28908
|
const clientOrderId = this.safeString2(order, 'clientOrderId', 'c');
|
|
28866
28909
|
return this.safeOrder({
|
|
@@ -91138,6 +91181,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
91138
91181
|
'cancelOrder': true,
|
|
91139
91182
|
'cancelOrders': true,
|
|
91140
91183
|
'createDepositAddress': true,
|
|
91184
|
+
'createMarketBuyOrderWithCost': true,
|
|
91141
91185
|
'createOrder': true,
|
|
91142
91186
|
'createOrders': true,
|
|
91143
91187
|
'createReduceOnlyOrder': true,
|
|
@@ -92977,6 +93021,19 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
92977
93021
|
'info': order,
|
|
92978
93022
|
}, market);
|
|
92979
93023
|
}
|
|
93024
|
+
async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
|
|
93025
|
+
/**
|
|
93026
|
+
* @method
|
|
93027
|
+
* @name coinex#createMarketBuyWithCost
|
|
93028
|
+
* @description create a market buy order by providing the symbol and cost
|
|
93029
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
93030
|
+
* @param {float} cost how much you want to trade in units of the quote currency
|
|
93031
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
93032
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
93033
|
+
*/
|
|
93034
|
+
params['createMarketBuyOrderRequiresPrice'] = false;
|
|
93035
|
+
return await this.createOrder(symbol, 'market', 'buy', cost, undefined, params);
|
|
93036
|
+
}
|
|
92980
93037
|
createOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
|
|
92981
93038
|
const market = this.market(symbol);
|
|
92982
93039
|
const swap = market['swap'];
|
|
@@ -93077,16 +93134,20 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
93077
93134
|
else {
|
|
93078
93135
|
request['type'] = side;
|
|
93079
93136
|
if ((type === 'market') && (side === 'buy')) {
|
|
93080
|
-
|
|
93081
|
-
|
|
93082
|
-
|
|
93137
|
+
let createMarketBuyOrderRequiresPrice = true;
|
|
93138
|
+
[createMarketBuyOrderRequiresPrice, params] = this.handleOptionAndParams(params, 'createOrder', 'createMarketBuyOrderRequiresPrice', true);
|
|
93139
|
+
const cost = this.safeNumber(params, 'cost');
|
|
93140
|
+
params = this.omit(params, 'cost');
|
|
93141
|
+
if (createMarketBuyOrderRequiresPrice) {
|
|
93142
|
+
if ((price === undefined) && (cost === undefined)) {
|
|
93143
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.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');
|
|
93083
93144
|
}
|
|
93084
93145
|
else {
|
|
93085
|
-
const amountString = this.
|
|
93086
|
-
const priceString = this.
|
|
93087
|
-
const
|
|
93088
|
-
const
|
|
93089
|
-
request['amount'] = this.costToPrecision(symbol,
|
|
93146
|
+
const amountString = this.numberToString(amount);
|
|
93147
|
+
const priceString = this.numberToString(price);
|
|
93148
|
+
const quoteAmount = this.parseToNumeric(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringMul(amountString, priceString));
|
|
93149
|
+
const costRequest = (cost !== undefined) ? cost : quoteAmount;
|
|
93150
|
+
request['amount'] = this.costToPrecision(symbol, costRequest);
|
|
93090
93151
|
}
|
|
93091
93152
|
}
|
|
93092
93153
|
else {
|
|
@@ -125358,7 +125419,14 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
125358
125419
|
'PEND': 'pending',
|
|
125359
125420
|
'REQUEST': 'pending',
|
|
125360
125421
|
'DMOVE': 'pending',
|
|
125361
|
-
'
|
|
125422
|
+
'MANUAL': 'pending',
|
|
125423
|
+
'VERIFY': 'pending',
|
|
125424
|
+
'PROCES': 'pending',
|
|
125425
|
+
'EXTPEND': 'pending',
|
|
125426
|
+
'SPLITPEND': 'pending',
|
|
125427
|
+
'CANCEL': 'canceled',
|
|
125428
|
+
'FAIL': 'failed',
|
|
125429
|
+
'INVALID': 'failed',
|
|
125362
125430
|
'DONE': 'ok',
|
|
125363
125431
|
'BCODE': 'ok', // GateCode withdrawal
|
|
125364
125432
|
};
|
|
@@ -164892,13 +164960,19 @@ class latoken extends _abstract_latoken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
164892
164960
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
164893
164961
|
* @returns {object} a [fee structure]{@link https://docs.ccxt.com/#/?id=fee-structure}
|
|
164894
164962
|
*/
|
|
164895
|
-
|
|
164963
|
+
const options = this.safeValue(this.options, 'fetchTradingFee', {});
|
|
164964
|
+
const defaultMethod = this.safeString(options, 'method', 'fetchPrivateTradingFee');
|
|
164965
|
+
const method = this.safeString(params, 'method', defaultMethod);
|
|
164896
164966
|
params = this.omit(params, 'method');
|
|
164897
|
-
if (method ===
|
|
164898
|
-
|
|
164899
|
-
|
|
164967
|
+
if (method === 'fetchPrivateTradingFee') {
|
|
164968
|
+
return await this.fetchPrivateTradingFee(symbol, params);
|
|
164969
|
+
}
|
|
164970
|
+
else if (method === 'fetchPublicTradingFee') {
|
|
164971
|
+
return await this.fetchPublicTradingFee(symbol, params);
|
|
164972
|
+
}
|
|
164973
|
+
else {
|
|
164974
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' not support this method');
|
|
164900
164975
|
}
|
|
164901
|
-
return await this[method](symbol, params);
|
|
164902
164976
|
}
|
|
164903
164977
|
async fetchPublicTradingFee(symbol, params = {}) {
|
|
164904
164978
|
await this.loadMarkets();
|
|
@@ -164964,18 +165038,20 @@ class latoken extends _abstract_latoken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
164964
165038
|
// 'from': this.milliseconds (),
|
|
164965
165039
|
// 'limit': limit, // default '100'
|
|
164966
165040
|
};
|
|
164967
|
-
let method = 'privateGetAuthTrade';
|
|
164968
165041
|
let market = undefined;
|
|
165042
|
+
if (limit !== undefined) {
|
|
165043
|
+
request['limit'] = limit; // default 100
|
|
165044
|
+
}
|
|
165045
|
+
let response = undefined;
|
|
164969
165046
|
if (symbol !== undefined) {
|
|
164970
165047
|
market = this.market(symbol);
|
|
164971
165048
|
request['currency'] = market['baseId'];
|
|
164972
165049
|
request['quote'] = market['quoteId'];
|
|
164973
|
-
|
|
165050
|
+
response = await this.privateGetAuthTradePairCurrencyQuote(this.extend(request, params));
|
|
164974
165051
|
}
|
|
164975
|
-
|
|
164976
|
-
|
|
165052
|
+
else {
|
|
165053
|
+
response = await this.privateGetAuthTrade(this.extend(request, params));
|
|
164977
165054
|
}
|
|
164978
|
-
const response = await this[method](this.extend(request, params));
|
|
164979
165055
|
//
|
|
164980
165056
|
// [
|
|
164981
165057
|
// {
|
|
@@ -165641,22 +165717,21 @@ class latoken extends _abstract_latoken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
165641
165717
|
*/
|
|
165642
165718
|
await this.loadMarkets();
|
|
165643
165719
|
const currency = this.currency(code);
|
|
165644
|
-
|
|
165720
|
+
const request = {
|
|
165721
|
+
'currency': currency['id'],
|
|
165722
|
+
'recipient': toAccount,
|
|
165723
|
+
'value': this.currencyToPrecision(code, amount),
|
|
165724
|
+
};
|
|
165725
|
+
let response = undefined;
|
|
165645
165726
|
if (toAccount.indexOf('@') >= 0) {
|
|
165646
|
-
|
|
165727
|
+
response = await this.privatePostAuthTransferEmail(this.extend(request, params));
|
|
165647
165728
|
}
|
|
165648
165729
|
else if (toAccount.length === 36) {
|
|
165649
|
-
|
|
165730
|
+
response = await this.privatePostAuthTransferId(this.extend(request, params));
|
|
165650
165731
|
}
|
|
165651
165732
|
else {
|
|
165652
|
-
|
|
165733
|
+
response = await this.privatePostAuthTransferPhone(this.extend(request, params));
|
|
165653
165734
|
}
|
|
165654
|
-
const request = {
|
|
165655
|
-
'currency': currency['id'],
|
|
165656
|
-
'recipient': toAccount,
|
|
165657
|
-
'value': this.currencyToPrecision(code, amount),
|
|
165658
|
-
};
|
|
165659
|
-
const response = await this[method](this.extend(request, params));
|
|
165660
165735
|
//
|
|
165661
165736
|
// {
|
|
165662
165737
|
// "id": "e6fc4ace-7750-44e4-b7e9-6af038ac7107",
|
|
@@ -173940,7 +174015,7 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
173940
174015
|
}
|
|
173941
174016
|
createSpotOrderRequest(market, type, side, amount, price = undefined, marginMode = undefined, params = {}) {
|
|
173942
174017
|
const symbol = market['symbol'];
|
|
173943
|
-
const orderSide = (
|
|
174018
|
+
const orderSide = side.toUpperCase();
|
|
173944
174019
|
const request = {
|
|
173945
174020
|
'symbol': market['id'],
|
|
173946
174021
|
'side': orderSide,
|
|
@@ -173959,10 +174034,10 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
173959
174034
|
const amountString = this.numberToString(amount);
|
|
173960
174035
|
const priceString = this.numberToString(price);
|
|
173961
174036
|
const quoteAmount = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringMul(amountString, priceString);
|
|
173962
|
-
amount =
|
|
174037
|
+
amount = quoteAmount;
|
|
173963
174038
|
}
|
|
173964
174039
|
}
|
|
173965
|
-
request['quoteOrderQty'] = amount;
|
|
174040
|
+
request['quoteOrderQty'] = this.costToPrecision(symbol, amount);
|
|
173966
174041
|
}
|
|
173967
174042
|
else {
|
|
173968
174043
|
request['quantity'] = this.amountToPrecision(symbol, amount);
|
|
@@ -174162,7 +174237,7 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
174162
174237
|
ordersRequests.push(orderRequest);
|
|
174163
174238
|
}
|
|
174164
174239
|
const request = {
|
|
174165
|
-
'batchOrders': ordersRequests,
|
|
174240
|
+
'batchOrders': this.json(ordersRequests),
|
|
174166
174241
|
};
|
|
174167
174242
|
const response = await this.spotPrivatePostBatchOrders(request);
|
|
174168
174243
|
//
|
|
@@ -206989,6 +207064,9 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
206989
207064
|
return this.filterBySymbolsSinceLimit(cache, symbols, since, limit, true);
|
|
206990
207065
|
}
|
|
206991
207066
|
setPositionsCache(client, type, symbols = undefined) {
|
|
207067
|
+
if (type === 'spot') {
|
|
207068
|
+
return;
|
|
207069
|
+
}
|
|
206992
207070
|
if (this.positions === undefined) {
|
|
206993
207071
|
this.positions = {};
|
|
206994
207072
|
}
|
|
@@ -288480,7 +288558,7 @@ SOFTWARE.
|
|
|
288480
288558
|
|
|
288481
288559
|
//-----------------------------------------------------------------------------
|
|
288482
288560
|
// this is updated by vss.js when building
|
|
288483
|
-
const version = '4.1.
|
|
288561
|
+
const version = '4.1.73';
|
|
288484
288562
|
_src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
|
|
288485
288563
|
//-----------------------------------------------------------------------------
|
|
288486
288564
|
|