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/js/src/latoken.js CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  // ---------------------------------------------------------------------------
8
8
  import Exchange from './abstract/latoken.js';
9
- import { ExchangeError, AuthenticationError, InvalidNonce, BadRequest, ExchangeNotAvailable, PermissionDenied, AccountSuspended, RateLimitExceeded, InsufficientFunds, BadSymbol, InvalidOrder, ArgumentsRequired } from './base/errors.js';
9
+ import { ExchangeError, AuthenticationError, InvalidNonce, BadRequest, ExchangeNotAvailable, PermissionDenied, AccountSuspended, RateLimitExceeded, InsufficientFunds, BadSymbol, InvalidOrder, ArgumentsRequired, NotSupported } from './base/errors.js';
10
10
  import { TICK_SIZE } from './base/functions/number.js';
11
11
  import { sha512 } from './static_dependencies/noble-hashes/sha512.js';
12
12
  // ---------------------------------------------------------------------------
@@ -829,13 +829,19 @@ export default class latoken extends Exchange {
829
829
  * @param {object} [params] extra parameters specific to the exchange API endpoint
830
830
  * @returns {object} a [fee structure]{@link https://docs.ccxt.com/#/?id=fee-structure}
831
831
  */
832
- let method = this.safeString(params, 'method');
832
+ const options = this.safeValue(this.options, 'fetchTradingFee', {});
833
+ const defaultMethod = this.safeString(options, 'method', 'fetchPrivateTradingFee');
834
+ const method = this.safeString(params, 'method', defaultMethod);
833
835
  params = this.omit(params, 'method');
834
- if (method === undefined) {
835
- const options = this.safeValue(this.options, 'fetchTradingFee', {});
836
- method = this.safeString(options, 'method', 'fetchPrivateTradingFee');
836
+ if (method === 'fetchPrivateTradingFee') {
837
+ return await this.fetchPrivateTradingFee(symbol, params);
838
+ }
839
+ else if (method === 'fetchPublicTradingFee') {
840
+ return await this.fetchPublicTradingFee(symbol, params);
841
+ }
842
+ else {
843
+ throw new NotSupported(this.id + ' not support this method');
837
844
  }
838
- return await this[method](symbol, params);
839
845
  }
840
846
  async fetchPublicTradingFee(symbol, params = {}) {
841
847
  await this.loadMarkets();
@@ -901,18 +907,20 @@ export default class latoken extends Exchange {
901
907
  // 'from': this.milliseconds (),
902
908
  // 'limit': limit, // default '100'
903
909
  };
904
- let method = 'privateGetAuthTrade';
905
910
  let market = undefined;
911
+ if (limit !== undefined) {
912
+ request['limit'] = limit; // default 100
913
+ }
914
+ let response = undefined;
906
915
  if (symbol !== undefined) {
907
916
  market = this.market(symbol);
908
917
  request['currency'] = market['baseId'];
909
918
  request['quote'] = market['quoteId'];
910
- method = 'privateGetAuthTradePairCurrencyQuote';
919
+ response = await this.privateGetAuthTradePairCurrencyQuote(this.extend(request, params));
911
920
  }
912
- if (limit !== undefined) {
913
- request['limit'] = limit; // default 100
921
+ else {
922
+ response = await this.privateGetAuthTrade(this.extend(request, params));
914
923
  }
915
- const response = await this[method](this.extend(request, params));
916
924
  //
917
925
  // [
918
926
  // {
@@ -1578,22 +1586,21 @@ export default class latoken extends Exchange {
1578
1586
  */
1579
1587
  await this.loadMarkets();
1580
1588
  const currency = this.currency(code);
1581
- let method = undefined;
1589
+ const request = {
1590
+ 'currency': currency['id'],
1591
+ 'recipient': toAccount,
1592
+ 'value': this.currencyToPrecision(code, amount),
1593
+ };
1594
+ let response = undefined;
1582
1595
  if (toAccount.indexOf('@') >= 0) {
1583
- method = 'privatePostAuthTransferEmail';
1596
+ response = await this.privatePostAuthTransferEmail(this.extend(request, params));
1584
1597
  }
1585
1598
  else if (toAccount.length === 36) {
1586
- method = 'privatePostAuthTransferId';
1599
+ response = await this.privatePostAuthTransferId(this.extend(request, params));
1587
1600
  }
1588
1601
  else {
1589
- method = 'privatePostAuthTransferPhone';
1602
+ response = await this.privatePostAuthTransferPhone(this.extend(request, params));
1590
1603
  }
1591
- const request = {
1592
- 'currency': currency['id'],
1593
- 'recipient': toAccount,
1594
- 'value': this.currencyToPrecision(code, amount),
1595
- };
1596
- const response = await this[method](this.extend(request, params));
1597
1604
  //
1598
1605
  // {
1599
1606
  // "id": "e6fc4ace-7750-44e4-b7e9-6af038ac7107",
package/js/src/mexc.js CHANGED
@@ -2086,7 +2086,7 @@ export default class mexc extends Exchange {
2086
2086
  }
2087
2087
  createSpotOrderRequest(market, type, side, amount, price = undefined, marginMode = undefined, params = {}) {
2088
2088
  const symbol = market['symbol'];
2089
- const orderSide = (side === 'buy') ? 'BUY' : 'SELL';
2089
+ const orderSide = side.toUpperCase();
2090
2090
  const request = {
2091
2091
  'symbol': market['id'],
2092
2092
  'side': orderSide,
@@ -2105,10 +2105,10 @@ export default class mexc extends Exchange {
2105
2105
  const amountString = this.numberToString(amount);
2106
2106
  const priceString = this.numberToString(price);
2107
2107
  const quoteAmount = Precise.stringMul(amountString, priceString);
2108
- amount = this.parseNumber(quoteAmount);
2108
+ amount = quoteAmount;
2109
2109
  }
2110
2110
  }
2111
- request['quoteOrderQty'] = amount;
2111
+ request['quoteOrderQty'] = this.costToPrecision(symbol, amount);
2112
2112
  }
2113
2113
  else {
2114
2114
  request['quantity'] = this.amountToPrecision(symbol, amount);
@@ -2308,7 +2308,7 @@ export default class mexc extends Exchange {
2308
2308
  ordersRequests.push(orderRequest);
2309
2309
  }
2310
2310
  const request = {
2311
- 'batchOrders': ordersRequests,
2311
+ 'batchOrders': this.json(ordersRequests),
2312
2312
  };
2313
2313
  const response = await this.spotPrivatePostBatchOrders(request);
2314
2314
  //
@@ -2396,6 +2396,9 @@ export default class binance extends binanceRest {
2396
2396
  return this.filterBySymbolsSinceLimit(cache, symbols, since, limit, true);
2397
2397
  }
2398
2398
  setPositionsCache(client, type, symbols = undefined) {
2399
+ if (type === 'spot') {
2400
+ return;
2401
+ }
2399
2402
  if (this.positions === undefined) {
2400
2403
  this.positions = {};
2401
2404
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt",
3
- "version": "4.1.71",
3
+ "version": "4.1.73",
4
4
  "description": "A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 130+ exchanges",
5
5
  "unpkg": "dist/ccxt.browser.js",
6
6
  "type": "module",
@@ -119,6 +119,7 @@
119
119
  "devDependencies": {
120
120
  "@rollup/plugin-commonjs": "^21.0.3",
121
121
  "@rollup/plugin-json": "^4.1.0",
122
+ "@rollup/plugin-node-resolve": "^15.2.3",
122
123
  "@types/node": "^18.15.11",
123
124
  "@typescript-eslint/eslint-plugin": "^5.30.5",
124
125
  "@typescript-eslint/parser": "^5.30.5",
package/rollup.config.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import commonjs from "@rollup/plugin-commonjs";
2
2
  import json from "@rollup/plugin-json";
3
3
  import execute from 'rollup-plugin-execute';
4
+ import nodeResolve from '@rollup/plugin-node-resolve'
4
5
 
5
6
  export default [
6
7
  {
@@ -13,6 +14,9 @@ export default [
13
14
  }
14
15
  ],
15
16
  plugins: [
17
+ nodeResolve({
18
+ preferBuiltins: true,
19
+ }),
16
20
  json(),
17
21
  commonjs({
18
22
  transformMixedEsModules: true,
@@ -24,6 +28,11 @@ export default [
24
28
  if ( warning.message.indexOf('is implicitly using "default" export mode') > -1 ) return;
25
29
  next( warning );
26
30
  },
31
+ external: [
32
+ 'socks-proxy-agent',
33
+ // node resolve generate dist/cjs/js directory, treat ws, debug as external
34
+ 'ws', 'debug'
35
+ ]
27
36
  },
28
37
  {
29
38
  inlineDynamicImports: true,
@@ -35,11 +44,15 @@ export default [
35
44
  },
36
45
  ],
37
46
  plugins: [
47
+ nodeResolve({ preferBuiltins: true }),
38
48
  json(),
39
49
  commonjs({
40
50
  transformMixedEsModules: true,
41
51
  dynamicRequireTargets: ["**/js/src/static_dependencies/**/*.cjs"],
42
52
  }),
43
53
  ],
54
+ external: [
55
+ 'socks-proxy-agent'
56
+ ]
44
57
  }
45
58
  ];