ccxt 4.5.53 → 4.5.54

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.
Files changed (69) hide show
  1. package/README.md +144 -145
  2. package/dist/ccxt.browser.min.js +3 -3
  3. package/dist/cjs/ccxt.js +1 -4
  4. package/dist/cjs/src/base/Exchange.js +29 -0
  5. package/dist/cjs/src/bydfi.js +1 -1
  6. package/dist/cjs/src/coinbase.js +1 -1
  7. package/dist/cjs/src/coinbaseinternational.js +0 -38
  8. package/dist/cjs/src/coinex.js +1 -1
  9. package/dist/cjs/src/deepcoin.js +1 -1
  10. package/dist/cjs/src/dydx.js +1 -1
  11. package/dist/cjs/src/hollaex.js +2 -6
  12. package/dist/cjs/src/modetrade.js +1 -1
  13. package/dist/cjs/src/pacifica.js +42 -44
  14. package/dist/cjs/src/paradex.js +1 -1
  15. package/dist/cjs/src/pro/backpack.js +12 -3
  16. package/dist/cjs/src/pro/binance.js +7 -2
  17. package/dist/cjs/src/pro/hashkey.js +7 -4
  18. package/dist/cjs/src/pro/krakenfutures.js +27 -12
  19. package/dist/cjs/src/pro/kucoin.js +3 -3
  20. package/dist/cjs/src/pro/modetrade.js +1 -1
  21. package/dist/cjs/src/pro/weex.js +7 -5
  22. package/dist/cjs/src/pro/woo.js +1 -1
  23. package/dist/cjs/src/pro/woofipro.js +1 -1
  24. package/dist/cjs/src/weex.js +9 -6
  25. package/dist/cjs/src/woo.js +1 -1
  26. package/dist/cjs/src/woofipro.js +1 -1
  27. package/dist/cjs/src/xt.js +2 -2
  28. package/js/ccxt.d.ts +2 -5
  29. package/js/ccxt.js +2 -4
  30. package/js/src/base/Exchange.d.ts +23 -2
  31. package/js/src/base/Exchange.js +29 -0
  32. package/js/src/bydfi.js +1 -1
  33. package/js/src/coinbase.js +1 -1
  34. package/js/src/coinbaseexchange.d.ts +1 -1
  35. package/js/src/coinbaseinternational.d.ts +0 -21
  36. package/js/src/coinbaseinternational.js +0 -38
  37. package/js/src/coinex.js +1 -1
  38. package/js/src/deepcoin.js +1 -1
  39. package/js/src/dydx.js +1 -1
  40. package/js/src/hollaex.js +2 -6
  41. package/js/src/modetrade.js +1 -1
  42. package/js/src/pacifica.js +42 -44
  43. package/js/src/paradex.js +1 -1
  44. package/js/src/pro/backpack.js +12 -3
  45. package/js/src/pro/binance.d.ts +1 -1
  46. package/js/src/pro/binance.js +7 -2
  47. package/js/src/pro/hashkey.js +7 -4
  48. package/js/src/pro/krakenfutures.js +27 -12
  49. package/js/src/pro/kucoin.js +3 -3
  50. package/js/src/pro/modetrade.js +1 -1
  51. package/js/src/pro/weex.d.ts +1 -0
  52. package/js/src/pro/weex.js +7 -5
  53. package/js/src/pro/woo.js +1 -1
  54. package/js/src/pro/woofipro.js +1 -1
  55. package/js/src/protobuf/mexc/compiled.d.cts +0 -6
  56. package/js/src/static_dependencies/dydx-v4-client/long/index.d.cts +0 -6
  57. package/js/src/static_dependencies/fflake/browser.d.ts +5 -5
  58. package/js/src/static_dependencies/noble-curves/abstract/weierstrass.d.ts +0 -1
  59. package/js/src/weex.js +9 -6
  60. package/js/src/woo.js +1 -1
  61. package/js/src/woofipro.js +1 -1
  62. package/js/src/xt.js +2 -2
  63. package/package.json +3 -3
  64. package/dist/cjs/src/abstract/zonda.js +0 -11
  65. package/dist/cjs/src/zonda.js +0 -1998
  66. package/js/src/abstract/zonda.d.ts +0 -56
  67. package/js/src/abstract/zonda.js +0 -11
  68. package/js/src/zonda.d.ts +0 -214
  69. package/js/src/zonda.js +0 -1997
@@ -321,6 +321,7 @@ export default class weex extends weexRest {
321
321
  */
322
322
  unWatchPositions(symbols?: Strings, params?: {}): Promise<any>;
323
323
  handlePositions(client: any, message: any): void;
324
+ parseWsPosition(position: any, market?: any): Position;
324
325
  getMarketFromClientAndMessage(client: Client, message: any): import("../base/types.js").MarketInterface;
325
326
  pong(client: Client, message: any): Promise<void>;
326
327
  handlePing(client: Client, message: any): void;
@@ -1310,12 +1310,10 @@ export default class weex extends weexRest {
1310
1310
  this.orders = new ArrayCacheBySymbolById(limit);
1311
1311
  }
1312
1312
  const orders = this.orders;
1313
- const newOrders = [];
1314
1313
  for (let i = 0; i < data.length; i++) {
1315
1314
  const rawOrder = this.safeDict(data, i, {});
1316
1315
  const parsed = this.parseWsOrder(rawOrder);
1317
1316
  orders.append(parsed);
1318
- newOrders.push(parsed);
1319
1317
  const symbol = parsed['symbol'];
1320
1318
  symbols[symbol] = true;
1321
1319
  }
@@ -1328,9 +1326,9 @@ export default class weex extends weexRest {
1328
1326
  for (let i = 0; i < symbolKeys.length; i++) {
1329
1327
  const symbol = symbolKeys[i];
1330
1328
  const symbolMessageHash = messageHash + '::' + symbol;
1331
- client.resolve(newOrders, symbolMessageHash);
1329
+ client.resolve(orders, symbolMessageHash);
1332
1330
  }
1333
- client.resolve(newOrders, messageHash);
1331
+ client.resolve(this.orders, messageHash);
1334
1332
  }
1335
1333
  parseWsOrder(order, market = undefined) {
1336
1334
  //
@@ -1763,7 +1761,7 @@ export default class weex extends weexRest {
1763
1761
  const data = this.safeList(message, 'd', []);
1764
1762
  for (let i = 0; i < data.length; i++) {
1765
1763
  const rawPosition = this.safeDict(data, i, {});
1766
- const position = this.parsePosition(rawPosition);
1764
+ const position = this.parseWsPosition(rawPosition);
1767
1765
  cache.append(position);
1768
1766
  newPositions.push(position);
1769
1767
  }
@@ -1780,6 +1778,10 @@ export default class weex extends weexRest {
1780
1778
  }
1781
1779
  client.resolve(newPositions, 'positions');
1782
1780
  }
1781
+ parseWsPosition(position, market = undefined) {
1782
+ // same as REST api
1783
+ return this.parsePosition(position, market);
1784
+ }
1783
1785
  getMarketFromClientAndMessage(client, message) {
1784
1786
  const url = client.url;
1785
1787
  let marketType = 'spot';
package/js/src/pro/woo.js CHANGED
@@ -975,7 +975,7 @@ export default class woo extends wooRest {
975
975
  // "orderTag": "default",
976
976
  // "totalFee": 0,
977
977
  // "visible": 0.01,
978
- // "timestamp": 1657515556799,
978
+ // "timestamp": 1657515556798,
979
979
  // "reduceOnly": false,
980
980
  // "maker": false
981
981
  // }
@@ -730,7 +730,7 @@ export default class woofipro extends woofiproRest {
730
730
  // "orderTag": "default",
731
731
  // "totalFee": 0,
732
732
  // "visible": 0.01,
733
- // "timestamp": 1657515556799,
733
+ // "timestamp": 1657515556798,
734
734
  // "reduceOnly": false,
735
735
  // "maker": false
736
736
  // }
@@ -1,8 +1,2 @@
1
- // ----------------------------------------------------------------------------
2
-
3
- // PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
4
- // https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
- // EDIT THE CORRESPONDENT .ts FILE INSTEAD
6
-
7
1
  export = $root;
8
2
  declare var $root: {};
@@ -1,8 +1,2 @@
1
- // ----------------------------------------------------------------------------
2
-
3
- // PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
4
- // https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
- // EDIT THE CORRESPONDENT .ts FILE INSTEAD
6
-
7
1
  declare const _exports: any;
8
2
  export = _exports;
@@ -5,7 +5,7 @@ export function deflate(data: any, opts: any, cb: any): () => void;
5
5
  * @param opts The compression options
6
6
  * @returns The deflated version of the data
7
7
  */
8
- export function deflateSync(data: any, opts: any): Uint8Array | Uint16Array | Uint32Array;
8
+ export function deflateSync(data: any, opts: any): Uint8Array | Uint32Array | Uint16Array;
9
9
  export function inflate(data: any, opts: any, cb: any): () => void;
10
10
  /**
11
11
  * Expands DEFLATE data with no wrapper
@@ -21,7 +21,7 @@ export function gzip(data: any, opts: any, cb: any): () => void;
21
21
  * @param opts The compression options
22
22
  * @returns The gzipped version of the data
23
23
  */
24
- export function gzipSync(data: any, opts: any): Uint8Array | Uint16Array | Uint32Array;
24
+ export function gzipSync(data: any, opts: any): Uint8Array | Uint32Array | Uint16Array;
25
25
  export function gunzip(data: any, opts: any, cb: any): () => void;
26
26
  /**
27
27
  * Expands GZIP data
@@ -37,7 +37,7 @@ export function zlib(data: any, opts: any, cb: any): () => void;
37
37
  * @param opts The compression options
38
38
  * @returns The zlib-compressed version of the data
39
39
  */
40
- export function zlibSync(data: any, opts: any): Uint8Array | Uint16Array | Uint32Array;
40
+ export function zlibSync(data: any, opts: any): Uint8Array | Uint32Array | Uint16Array;
41
41
  export function unzlib(data: any, opts: any, cb: any): () => void;
42
42
  /**
43
43
  * Expands Zlib data
@@ -61,7 +61,7 @@ export function decompressSync(data: any, out: any): any;
61
61
  * not need to be true unless decoding a binary string.
62
62
  * @returns The string encoded in UTF-8/Latin-1 binary
63
63
  */
64
- export function strToU8(str: any, latin1: any): Uint8Array | Uint16Array | Uint32Array;
64
+ export function strToU8(str: any, latin1: any): Uint8Array | Uint32Array | Uint16Array;
65
65
  /**
66
66
  * Converts a Uint8Array to a string
67
67
  * @param dat The data to decode to string
@@ -69,7 +69,7 @@ export function strToU8(str: any, latin1: any): Uint8Array | Uint16Array | Uint3
69
69
  * not need to be true unless encoding to binary string.
70
70
  * @returns The original UTF-8/Latin-1 string
71
71
  */
72
- export function strFromU8(dat: any, latin1: any): string | Uint8Array | Uint16Array | Uint32Array;
72
+ export function strFromU8(dat: any, latin1: any): string | Uint8Array | Uint32Array | Uint16Array;
73
73
  export function zip(data: any, opts: any, cb: any): () => void;
74
74
  /**
75
75
  * Synchronously creates a ZIP file. Prefer using `zip` for better performance
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
3
2
  import * as mod from './modular.js';
4
3
  import * as ut from './utils.js';
package/js/src/weex.js CHANGED
@@ -1487,7 +1487,7 @@ export default class weex extends Exchange {
1487
1487
  'symbol': market['id'],
1488
1488
  };
1489
1489
  if (limit !== undefined) {
1490
- request['limit'] = limit;
1490
+ request['limit'] = Math.min(limit, 1000);
1491
1491
  }
1492
1492
  let response = undefined;
1493
1493
  if (market['spot']) {
@@ -3310,7 +3310,7 @@ export default class weex extends Exchange {
3310
3310
  if (errorMessage !== undefined) {
3311
3311
  this.handleOrderOrPositionError(errorCode, errorMessage, position);
3312
3312
  }
3313
- const marketId = this.safeString(position, 'symbol');
3313
+ const marketId = this.safeString2(position, 'symbol', 'coinId'); // coinId might be used in testnet: https://github.com/ccxt/ccxt/issues/28576#issuecomment-4439400273
3314
3314
  market = this.safeMarket(marketId, market, undefined, 'contract');
3315
3315
  const timestamp = this.safeInteger(position, 'createdTime');
3316
3316
  const marginType = this.safeString2(position, 'marginType', 'marginMode');
@@ -3326,20 +3326,23 @@ export default class weex extends Exchange {
3326
3326
  else if (separatedMode === 'SEPARATED') {
3327
3327
  hedged = true;
3328
3328
  }
3329
+ const notional = this.safeString(position, 'openValue');
3330
+ const size = this.safeString(position, 'size');
3331
+ const entryPrice = Precise.stringDiv(notional, size);
3329
3332
  return this.safePosition({
3330
3333
  'symbol': market['symbol'],
3331
3334
  'id': this.safeString2(position, 'id', 'positionId'),
3332
3335
  'timestamp': timestamp,
3333
3336
  'datetime': this.iso8601(timestamp),
3334
- 'contracts': this.safeNumber(position, 'size'),
3337
+ 'contracts': this.parseNumber(size),
3335
3338
  'contractSize': undefined,
3336
3339
  'side': this.safeStringLower(position, 'side'),
3337
- 'notional': this.safeNumber(position, 'openValue'),
3340
+ 'notional': this.parseNumber(notional),
3338
3341
  'leverage': this.safeNumber(position, 'leverage'),
3339
3342
  'unrealizedPnl': this.safeNumber(position, 'unrealizePnl'),
3340
3343
  'realizedPnl': undefined,
3341
3344
  'collateral': undefined,
3342
- 'entryPrice': undefined,
3345
+ 'entryPrice': this.parseNumber(entryPrice),
3343
3346
  'markPrice': undefined,
3344
3347
  'liquidationPrice': this.safeNumber(position, 'liquidatePrice'),
3345
3348
  'marginMode': marginMode,
@@ -3354,7 +3357,7 @@ export default class weex extends Exchange {
3354
3357
  'stopLossPrice': undefined,
3355
3358
  'takeProfitPrice': undefined,
3356
3359
  'percentage': undefined,
3357
- 'info': undefined,
3360
+ 'info': position,
3358
3361
  });
3359
3362
  }
3360
3363
  /**
package/js/src/woo.js CHANGED
@@ -2555,7 +2555,7 @@ export default class woo extends Exchange {
2555
2555
  // {
2556
2556
  // "createdTime": "1734964440.523",
2557
2557
  // "updatedTime": "1734964614.081",
2558
- // "id": "24122314340000585",
2558
+ // "id": "24122314340000586",
2559
2559
  // "externalId": "241223143600621",
2560
2560
  // "applicationId": "251bf5c4-f3c8-4544-bb8b-80001007c3c0",
2561
2561
  // "token": "ARB_USDCNATIVE",
@@ -2076,7 +2076,7 @@ export default class woofipro extends Exchange {
2076
2076
  //
2077
2077
  // {
2078
2078
  // "success": true,
2079
- // "timestamp": 1702989203989,
2079
+ // "timestamp": 1702989203988,
2080
2080
  // "data": {
2081
2081
  // "meta": {
2082
2082
  // "total": 9,
package/js/src/xt.js CHANGED
@@ -1935,13 +1935,13 @@ export default class xt extends Exchange {
1935
1935
  let response = undefined;
1936
1936
  if (market['spot']) {
1937
1937
  if (limit !== undefined) {
1938
- request['limit'] = limit;
1938
+ request['limit'] = Math.min(limit, 1000);
1939
1939
  }
1940
1940
  response = await this.publicSpotGetTradeRecent(this.extend(request, params));
1941
1941
  }
1942
1942
  else {
1943
1943
  if (limit !== undefined) {
1944
- request['num'] = limit;
1944
+ request['num'] = Math.min(limit, 1000);
1945
1945
  }
1946
1946
  if (market['linear']) {
1947
1947
  response = await this.publicLinearGetFutureMarketV1PublicQDeal(this.extend(request, params));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt",
3
- "version": "4.5.53",
3
+ "version": "4.5.54",
4
4
  "description": "A cryptocurrency trading API with more than 100 exchanges in JavaScript / TypeScript / Python / C# / PHP / Go",
5
5
  "unpkg": "dist/ccxt.browser.min.js",
6
6
  "type": "module",
@@ -21,8 +21,8 @@
21
21
  },
22
22
  "publishConfig": {
23
23
  "registry": "https://registry.npmjs.org",
24
- "access": "public",
25
- "provenance": true
24
+ "access": "public",
25
+ "provenance": true
26
26
  },
27
27
  "repository": {
28
28
  "type": "git",
@@ -1,11 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var Exchange$1 = require('../base/Exchange.js');
6
-
7
- // ----------------------------------------------------------------------------
8
- class Exchange extends Exchange$1["default"] {
9
- }
10
-
11
- exports["default"] = Exchange;