ccxt 4.3.51 → 4.3.53

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 (45) hide show
  1. package/README.md +6 -5
  2. package/dist/ccxt.browser.min.js +3 -3
  3. package/dist/cjs/ccxt.js +6 -1
  4. package/dist/cjs/src/abstract/vertex.js +9 -0
  5. package/dist/cjs/src/base/Precise.js +10 -0
  6. package/dist/cjs/src/base/functions/type.js +43 -10
  7. package/dist/cjs/src/binance.js +2 -2
  8. package/dist/cjs/src/bybit.js +6 -0
  9. package/dist/cjs/src/hyperliquid.js +27 -26
  10. package/dist/cjs/src/krakenfutures.js +1 -0
  11. package/dist/cjs/src/okx.js +1 -0
  12. package/dist/cjs/src/pro/okx.js +1 -1
  13. package/dist/cjs/src/pro/probit.js +8 -3
  14. package/dist/cjs/src/pro/vertex.js +978 -0
  15. package/dist/cjs/src/probit.js +10 -5
  16. package/dist/cjs/src/static_dependencies/ethers/hash/typed-data.js +1 -1
  17. package/dist/cjs/src/vertex.js +2941 -0
  18. package/js/ccxt.d.ts +8 -2
  19. package/js/ccxt.js +6 -2
  20. package/js/src/abstract/okx.d.ts +1 -0
  21. package/js/src/abstract/vertex.d.ts +22 -0
  22. package/js/src/abstract/vertex.js +11 -0
  23. package/js/src/base/Exchange.d.ts +1 -1
  24. package/js/src/base/Precise.d.ts +2 -0
  25. package/js/src/base/Precise.js +10 -0
  26. package/js/src/base/functions/type.js +43 -10
  27. package/js/src/binance.d.ts +1 -11
  28. package/js/src/binance.js +2 -2
  29. package/js/src/bitget.d.ts +1 -1
  30. package/js/src/bitmart.d.ts +1 -1
  31. package/js/src/bybit.js +6 -0
  32. package/js/src/coinex.d.ts +1 -1
  33. package/js/src/htx.d.ts +1 -1
  34. package/js/src/hyperliquid.js +27 -26
  35. package/js/src/krakenfutures.js +1 -0
  36. package/js/src/okx.js +1 -0
  37. package/js/src/pro/okx.js +1 -1
  38. package/js/src/pro/probit.js +8 -3
  39. package/js/src/pro/vertex.d.ts +39 -0
  40. package/js/src/pro/vertex.js +979 -0
  41. package/js/src/probit.js +11 -6
  42. package/js/src/static_dependencies/ethers/hash/typed-data.js +1 -1
  43. package/js/src/vertex.d.ts +112 -0
  44. package/js/src/vertex.js +2942 -0
  45. package/package.json +1 -1
package/dist/cjs/ccxt.js CHANGED
@@ -110,6 +110,7 @@ var timex = require('./src/timex.js');
110
110
  var tokocrypto = require('./src/tokocrypto.js');
111
111
  var tradeogre = require('./src/tradeogre.js');
112
112
  var upbit = require('./src/upbit.js');
113
+ var vertex = require('./src/vertex.js');
113
114
  var wavesexchange = require('./src/wavesexchange.js');
114
115
  var wazirx = require('./src/wazirx.js');
115
116
  var whitebit = require('./src/whitebit.js');
@@ -181,6 +182,7 @@ var poloniex$1 = require('./src/pro/poloniex.js');
181
182
  var poloniexfutures$1 = require('./src/pro/poloniexfutures.js');
182
183
  var probit$1 = require('./src/pro/probit.js');
183
184
  var upbit$1 = require('./src/pro/upbit.js');
185
+ var vertex$1 = require('./src/pro/vertex.js');
184
186
  var wazirx$1 = require('./src/pro/wazirx.js');
185
187
  var whitebit$1 = require('./src/pro/whitebit.js');
186
188
  var woo$1 = require('./src/pro/woo.js');
@@ -188,7 +190,7 @@ var woofipro$1 = require('./src/pro/woofipro.js');
188
190
 
189
191
  //-----------------------------------------------------------------------------
190
192
  // this is updated by vss.js when building
191
- const version = '4.3.51';
193
+ const version = '4.3.53';
192
194
  Exchange["default"].ccxtVersion = version;
193
195
  const exchanges = {
194
196
  'ace': ace,
@@ -289,6 +291,7 @@ const exchanges = {
289
291
  'tokocrypto': tokocrypto,
290
292
  'tradeogre': tradeogre,
291
293
  'upbit': upbit,
294
+ 'vertex': vertex,
292
295
  'wavesexchange': wavesexchange,
293
296
  'wazirx': wazirx,
294
297
  'whitebit': whitebit,
@@ -362,6 +365,7 @@ const pro = {
362
365
  'poloniexfutures': poloniexfutures$1,
363
366
  'probit': probit$1,
364
367
  'upbit': upbit$1,
368
+ 'vertex': vertex$1,
365
369
  'wazirx': wazirx$1,
366
370
  'whitebit': whitebit$1,
367
371
  'woo': woo$1,
@@ -512,6 +516,7 @@ exports.timex = timex;
512
516
  exports.tokocrypto = tokocrypto;
513
517
  exports.tradeogre = tradeogre;
514
518
  exports.upbit = upbit;
519
+ exports.vertex = vertex;
515
520
  exports.wavesexchange = wavesexchange;
516
521
  exports.wazirx = wazirx;
517
522
  exports.whitebit = whitebit;
@@ -0,0 +1,9 @@
1
+ 'use strict';
2
+
3
+ var Exchange$1 = require('../base/Exchange.js');
4
+
5
+ // -------------------------------------------------------------------------------
6
+ class Exchange extends Exchange$1["default"] {
7
+ }
8
+
9
+ module.exports = Exchange;
@@ -80,6 +80,10 @@ class Precise {
80
80
  neg() {
81
81
  return new Precise(-this.integer, this.decimals);
82
82
  }
83
+ or(other) {
84
+ const integerResult = this.integer | other.integer;
85
+ return new Precise(integerResult, this.decimals);
86
+ }
83
87
  min(other) {
84
88
  return this.lt(other) ? this : other;
85
89
  }
@@ -210,6 +214,12 @@ class Precise {
210
214
  }
211
215
  return (new Precise(string1)).mod(new Precise(string2)).toString();
212
216
  }
217
+ static stringOr(string1, string2) {
218
+ if ((string1 === undefined) || (string2 === undefined)) {
219
+ return undefined;
220
+ }
221
+ return (new Precise(string1)).or(new Precise(string2)).toString();
222
+ }
213
223
  static stringEquals(string1, string2) {
214
224
  if ((string1 === undefined) || (string2 === undefined)) {
215
225
  return undefined;
@@ -21,7 +21,7 @@ const prop2 = (o, k1, k2) => (!isObject(o)
21
21
  : (o[k2] !== '' && o[k2] !== null
22
22
  ? o[k2]
23
23
  : undefined)));
24
- const getValueFromKeysInArray = (object, array) => object[array.find((k) => prop(object, k) !== undefined)];
24
+ const getValueFromKeysInArray = (object, array) => isObject(object) ? object[array.find((k) => prop(object, k) !== undefined)] : undefined;
25
25
  /* ............................................. */
26
26
  const asFloat = (x) => ((isNumber(x) || (isString(x) && x.length !== 0)) ? parseFloat(x) : NaN);
27
27
  const asInteger = (x) => ((isNumber(x) || (isString(x) && x.length !== 0)) ? Math.trunc(Number(x)) : NaN);
@@ -52,11 +52,23 @@ const safeString = (o, k, $default) => {
52
52
  };
53
53
  const safeStringLower = (o, k, $default) => {
54
54
  const x = prop(o, k);
55
- return isStringCoercible(x) ? String(x).toLowerCase() : $default;
55
+ if (isStringCoercible(x)) {
56
+ return String(x).toLowerCase();
57
+ }
58
+ else if (isStringCoercible($default)) {
59
+ return String($default).toLowerCase();
60
+ }
61
+ return $default;
56
62
  };
57
63
  const safeStringUpper = (o, k, $default) => {
58
64
  const x = prop(o, k);
59
- return isStringCoercible(x) ? String(x).toUpperCase() : $default;
65
+ if (isStringCoercible(x)) {
66
+ return String(x).toUpperCase();
67
+ }
68
+ else if (isStringCoercible($default)) {
69
+ return String($default).toUpperCase();
70
+ }
71
+ return $default;
60
72
  };
61
73
  /* ............................................. */
62
74
  const safeFloat2 = (o, k1, k2, $default) => {
@@ -85,11 +97,23 @@ const safeString2 = (o, k1, k2, $default) => {
85
97
  };
86
98
  const safeStringLower2 = (o, k1, k2, $default) => {
87
99
  const x = prop2(o, k1, k2);
88
- return isStringCoercible(x) ? String(x).toLowerCase() : $default;
100
+ if (isStringCoercible(x)) {
101
+ return String(x).toLowerCase();
102
+ }
103
+ else if (isStringCoercible($default)) {
104
+ return String($default).toLowerCase();
105
+ }
106
+ return $default;
89
107
  };
90
108
  const safeStringUpper2 = (o, k1, k2, $default) => {
91
109
  const x = prop2(o, k1, k2);
92
- return isStringCoercible(x) ? String(x).toUpperCase() : $default;
110
+ if (isStringCoercible(x)) {
111
+ return String(x).toUpperCase();
112
+ }
113
+ else if (isStringCoercible($default)) {
114
+ return String($default).toUpperCase();
115
+ }
116
+ return $default;
93
117
  };
94
118
  const safeFloatN = (o, k, $default) => {
95
119
  const n = asFloat(getValueFromKeysInArray(o, k));
@@ -125,15 +149,24 @@ const safeStringN = (o, k, $default) => {
125
149
  return isStringCoercible(x) ? String(x) : $default;
126
150
  };
127
151
  const safeStringLowerN = (o, k, $default) => {
128
- if (o === undefined) {
129
- return $default;
130
- }
131
152
  const x = getValueFromKeysInArray(o, k);
132
- return isStringCoercible(x) ? String(x).toLowerCase() : $default;
153
+ if (isStringCoercible(x)) {
154
+ return String(x).toLowerCase();
155
+ }
156
+ else if (isStringCoercible($default)) {
157
+ return String($default).toLowerCase();
158
+ }
159
+ return $default;
133
160
  };
134
161
  const safeStringUpperN = (o, k, $default) => {
135
162
  const x = getValueFromKeysInArray(o, k);
136
- return isStringCoercible(x) ? String(x).toUpperCase() : $default;
163
+ if (isStringCoercible(x)) {
164
+ return String(x).toUpperCase();
165
+ }
166
+ else if (isStringCoercible($default)) {
167
+ return String($default).toUpperCase();
168
+ }
169
+ return $default;
137
170
  };
138
171
  /* ------------------------------------------------------------------------ */
139
172
 
@@ -11145,10 +11145,10 @@ class binance extends binance$1 {
11145
11145
  const orderidlistLength = orderidlist.length;
11146
11146
  const origclientorderidlistLength = origclientorderidlist.length;
11147
11147
  if (orderidlistLength > 0) {
11148
- query = query + '&' + 'orderidlist=[' + orderidlist.join(',') + ']';
11148
+ query = query + '&' + 'orderidlist=%5B' + orderidlist.join('%2C') + '%5D';
11149
11149
  }
11150
11150
  if (origclientorderidlistLength > 0) {
11151
- query = query + '&' + 'origclientorderidlist=[' + origclientorderidlist.join(',') + ']';
11151
+ query = query + '&' + 'origclientorderidlist=%5B' + origclientorderidlist.join('%2C') + '%5D';
11152
11152
  }
11153
11153
  }
11154
11154
  else {
@@ -5206,9 +5206,15 @@ class bybit extends bybit$1 {
5206
5206
  * @param {string} [params.baseCoin] Base coin. Supports linear, inverse & option
5207
5207
  * @param {string} [params.settleCoin] Settle coin. Supports linear, inverse & option
5208
5208
  * @param {string} [params.orderFilter] 'Order' or 'StopOrder' or 'tpslOrder'
5209
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
5209
5210
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
5210
5211
  */
5211
5212
  await this.loadMarkets();
5213
+ let paginate = false;
5214
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchOpenOrders', 'paginate');
5215
+ if (paginate) {
5216
+ return await this.fetchPaginatedCallCursor('fetchOpenOrders', symbol, since, limit, params, 'nextPageCursor', 'cursor', undefined, 50);
5217
+ }
5212
5218
  const [enableUnifiedMargin, enableUnifiedAccount] = await this.isUnifiedEnabled();
5213
5219
  const isUnifiedAccount = (enableUnifiedMargin || enableUnifiedAccount);
5214
5220
  const request = {};
@@ -442,24 +442,26 @@ class hyperliquid extends hyperliquid$1 {
442
442
  for (let i = 0; i < meta.length; i++) {
443
443
  const market = this.safeDict(meta, i, {});
444
444
  const marketName = this.safeString(market, 'name');
445
- if (marketName.indexOf('/') < 0) {
446
- // there are some weird spot markets in testnet, eg @2
447
- continue;
448
- }
449
- const marketParts = marketName.split('/');
450
- const baseName = this.safeString(marketParts, 0);
451
- const quoteId = this.safeString(marketParts, 1);
452
- const base = this.safeCurrencyCode(baseName);
453
- const quote = this.safeCurrencyCode(quoteId);
454
- const symbol = base + '/' + quote;
445
+ // if (marketName.indexOf ('/') < 0) {
446
+ // // there are some weird spot markets in testnet, eg @2
447
+ // continue;
448
+ // }
449
+ // const marketParts = marketName.split ('/');
450
+ // const baseName = this.safeString (marketParts, 0);
451
+ // const quoteId = this.safeString (marketParts, 1);
455
452
  const fees = this.safeDict(this.fees, 'spot', {});
456
453
  const taker = this.safeNumber(fees, 'taker');
457
454
  const maker = this.safeNumber(fees, 'maker');
458
455
  const tokensPos = this.safeList(market, 'tokens', []);
459
456
  const baseTokenPos = this.safeInteger(tokensPos, 0);
460
- // const quoteTokenPos = this.safeInteger (tokensPos, 1);
457
+ const quoteTokenPos = this.safeInteger(tokensPos, 1);
461
458
  const baseTokenInfo = this.safeDict(tokens, baseTokenPos, {});
462
- // const quoteTokenInfo = this.safeDict (tokens, quoteTokenPos, {});
459
+ const quoteTokenInfo = this.safeDict(tokens, quoteTokenPos, {});
460
+ const baseName = this.safeString(baseTokenInfo, 'name');
461
+ const quoteId = this.safeString(quoteTokenInfo, 'name');
462
+ const base = this.safeCurrencyCode(baseName);
463
+ const quote = this.safeCurrencyCode(quoteId);
464
+ const symbol = base + '/' + quote;
463
465
  const innerBaseTokenInfo = this.safeDict(baseTokenInfo, 'spec', baseTokenInfo);
464
466
  // const innerQuoteTokenInfo = this.safeDict (quoteTokenInfo, 'spec', quoteTokenInfo);
465
467
  const amountPrecision = this.parseNumber(this.parsePrecision(this.safeString(innerBaseTokenInfo, 'szDecimals')));
@@ -1153,7 +1155,7 @@ class hyperliquid extends hyperliquid$1 {
1153
1155
  if (clientOrderId !== undefined) {
1154
1156
  orderObj['c'] = clientOrderId;
1155
1157
  }
1156
- orderReq.push(this.extend(orderObj, orderParams));
1158
+ orderReq.push(orderObj);
1157
1159
  }
1158
1160
  const vaultAddress = this.formatVaultAddress(this.safeString(params, 'vaultAddress'));
1159
1161
  const orderAction = {
@@ -1176,7 +1178,7 @@ class hyperliquid extends hyperliquid$1 {
1176
1178
  params = this.omit(params, 'vaultAddress');
1177
1179
  request['vaultAddress'] = vaultAddress;
1178
1180
  }
1179
- const response = await this.privatePostExchange(this.extend(request, params));
1181
+ const response = await this.privatePostExchange(request);
1180
1182
  //
1181
1183
  // {
1182
1184
  // "status": "ok",
@@ -1279,7 +1281,7 @@ class hyperliquid extends hyperliquid$1 {
1279
1281
  params = this.omit(params, 'vaultAddress');
1280
1282
  request['vaultAddress'] = vaultAddress;
1281
1283
  }
1282
- const response = await this.privatePostExchange(this.extend(request, params));
1284
+ const response = await this.privatePostExchange(request);
1283
1285
  //
1284
1286
  // {
1285
1287
  // "status":"ok",
@@ -1363,7 +1365,7 @@ class hyperliquid extends hyperliquid$1 {
1363
1365
  params = this.omit(params, 'vaultAddress');
1364
1366
  request['vaultAddress'] = vaultAddress;
1365
1367
  }
1366
- const response = await this.privatePostExchange(this.extend(request, params));
1368
+ const response = await this.privatePostExchange(request);
1367
1369
  //
1368
1370
  // {
1369
1371
  // "status":"ok",
@@ -1409,7 +1411,7 @@ class hyperliquid extends hyperliquid$1 {
1409
1411
  params = this.omit(params, 'vaultAddress');
1410
1412
  request['vaultAddress'] = vaultAddress;
1411
1413
  }
1412
- const response = await this.privatePostExchange(this.extend(request, params));
1414
+ const response = await this.privatePostExchange(request);
1413
1415
  //
1414
1416
  // {
1415
1417
  // "status":"err",
@@ -1531,7 +1533,7 @@ class hyperliquid extends hyperliquid$1 {
1531
1533
  params = this.omit(params, 'vaultAddress');
1532
1534
  request['vaultAddress'] = vaultAddress;
1533
1535
  }
1534
- const response = await this.privatePostExchange(this.extend(request, params));
1536
+ const response = await this.privatePostExchange(request);
1535
1537
  //
1536
1538
  // {
1537
1539
  // "status": "ok",
@@ -2210,10 +2212,9 @@ class hyperliquid extends hyperliquid$1 {
2210
2212
  vaultAddress = vaultAddress.replace('0x', '');
2211
2213
  }
2212
2214
  }
2213
- const extendedAction = this.extend(updateAction, params);
2214
- const signature = this.signL1Action(extendedAction, nonce, vaultAddress);
2215
+ const signature = this.signL1Action(updateAction, nonce, vaultAddress);
2215
2216
  const request = {
2216
- 'action': extendedAction,
2217
+ 'action': updateAction,
2217
2218
  'nonce': nonce,
2218
2219
  'signature': signature,
2219
2220
  // 'vaultAddress': vaultAddress,
@@ -2271,7 +2272,7 @@ class hyperliquid extends hyperliquid$1 {
2271
2272
  params = this.omit(params, 'vaultAddress');
2272
2273
  request['vaultAddress'] = vaultAddress;
2273
2274
  }
2274
- const response = await this.privatePostExchange(this.extend(request, params));
2275
+ const response = await this.privatePostExchange(request);
2275
2276
  //
2276
2277
  // {
2277
2278
  // 'response': {
@@ -2335,7 +2336,7 @@ class hyperliquid extends hyperliquid$1 {
2335
2336
  params = this.omit(params, 'vaultAddress');
2336
2337
  request['vaultAddress'] = vaultAddress;
2337
2338
  }
2338
- const response = await this.privatePostExchange(this.extend(request, params));
2339
+ const response = await this.privatePostExchange(request);
2339
2340
  //
2340
2341
  // {
2341
2342
  // 'response': {
@@ -2402,7 +2403,7 @@ class hyperliquid extends hyperliquid$1 {
2402
2403
  };
2403
2404
  const signature = this.signL1Action(action, nonce, vaultAddress);
2404
2405
  const innerRequest = {
2405
- 'action': this.extend(action, params),
2406
+ 'action': action,
2406
2407
  'nonce': nonce,
2407
2408
  'signature': signature,
2408
2409
  };
@@ -2439,7 +2440,7 @@ class hyperliquid extends hyperliquid$1 {
2439
2440
  'nonce': nonce,
2440
2441
  'signature': sig,
2441
2442
  };
2442
- const response = await this.privatePostExchange(this.extend(request, params));
2443
+ const response = await this.privatePostExchange(request);
2443
2444
  return response;
2444
2445
  }
2445
2446
  async withdraw(code, amount, address, tag = undefined, params = {}) {
@@ -2485,7 +2486,7 @@ class hyperliquid extends hyperliquid$1 {
2485
2486
  'nonce': nonce,
2486
2487
  'signature': sig,
2487
2488
  };
2488
- const response = await this.privatePostExchange(this.extend(request, params));
2489
+ const response = await this.privatePostExchange(request);
2489
2490
  return this.parseTransaction(response);
2490
2491
  }
2491
2492
  parseTransaction(transaction, currency = undefined) {
@@ -81,6 +81,7 @@ class krakenfutures extends krakenfutures$1 {
81
81
  'public': 'https://demo-futures.kraken.com/derivatives/api/',
82
82
  'private': 'https://demo-futures.kraken.com/derivatives/api/',
83
83
  'charts': 'https://demo-futures.kraken.com/api/charts/',
84
+ 'history': 'https://demo-futures.kraken.com/api/history/',
84
85
  'www': 'https://demo-futures.kraken.com',
85
86
  },
86
87
  'logo': 'https://user-images.githubusercontent.com/24300605/81436764-b22fd580-9172-11ea-9703-742783e6376d.jpg',
@@ -431,6 +431,7 @@ class okx extends okx$1 {
431
431
  'sprd/cancel-order': 1,
432
432
  'sprd/mass-cancel': 1,
433
433
  'sprd/amend-order': 1,
434
+ 'sprd/cancel-all-after': 10,
434
435
  // trade
435
436
  'trade/order': 1 / 3,
436
437
  'trade/batch-orders': 1 / 15,
@@ -99,7 +99,7 @@ class okx extends okx$1 {
99
99
  // okex does not support built-in ws protocol-level ping-pong
100
100
  // instead it requires a custom text-based ping-pong
101
101
  'ping': this.ping,
102
- 'keepAlive': 20000,
102
+ 'keepAlive': 18000,
103
103
  },
104
104
  });
105
105
  }
@@ -44,7 +44,6 @@ class probit extends probit$1 {
44
44
  },
45
45
  },
46
46
  'streaming': {},
47
- 'exceptions': {},
48
47
  });
49
48
  }
50
49
  async watchBalance(params = {}) {
@@ -493,8 +492,14 @@ class probit extends probit$1 {
493
492
  const code = this.safeString(message, 'errorCode');
494
493
  const errMessage = this.safeString(message, 'message', '');
495
494
  const details = this.safeValue(message, 'details');
496
- // todo - throw properly here
497
- throw new errors.ExchangeError(this.id + ' ' + code + ' ' + errMessage + ' ' + this.json(details));
495
+ const feedback = this.id + ' ' + code + ' ' + errMessage + ' ' + this.json(details);
496
+ if ('exact' in this.exceptions) {
497
+ this.throwExactlyMatchedException(this.exceptions['exact'], code, feedback);
498
+ }
499
+ if ('broad' in this.exceptions) {
500
+ this.throwBroadlyMatchedException(this.exceptions['broad'], errMessage, feedback);
501
+ }
502
+ throw new errors.ExchangeError(feedback);
498
503
  }
499
504
  handleAuthenticate(client, message) {
500
505
  //