ccxt 4.1.40 → 4.1.43

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/okx.js CHANGED
@@ -570,9 +570,12 @@ export default class okx extends Exchange {
570
570
  '51028': ContractUnavailable,
571
571
  '51029': ContractUnavailable,
572
572
  '51030': ContractUnavailable,
573
+ '51031': InvalidOrder,
573
574
  '51046': InvalidOrder,
574
575
  '51047': InvalidOrder,
575
- '51031': InvalidOrder,
576
+ '51072': InvalidOrder,
577
+ '51073': InvalidOrder,
578
+ '51074': InvalidOrder,
576
579
  '51100': InvalidOrder,
577
580
  '51101': InvalidOrder,
578
581
  '51102': InvalidOrder,
@@ -617,6 +620,7 @@ export default class okx extends Exchange {
617
620
  '51163': InvalidOrder,
618
621
  '51166': InvalidOrder,
619
622
  '51174': InvalidOrder,
623
+ '51185': InvalidOrder,
620
624
  '51201': InvalidOrder,
621
625
  '51202': InvalidOrder,
622
626
  '51203': InvalidOrder,
@@ -764,6 +768,8 @@ export default class okx extends Exchange {
764
768
  '59200': InsufficientFunds,
765
769
  '59201': InsufficientFunds,
766
770
  '59216': BadRequest,
771
+ '59260': PermissionDenied,
772
+ '59262': PermissionDenied,
767
773
  '59300': ExchangeError,
768
774
  '59301': ExchangeError,
769
775
  '59313': ExchangeError,
@@ -777,6 +783,8 @@ export default class okx extends Exchange {
777
783
  '59506': ExchangeError,
778
784
  '59507': ExchangeError,
779
785
  '59508': AccountSuspended,
786
+ '59642': BadRequest,
787
+ '59643': ExchangeError,
780
788
  // WebSocket error Codes from 60000-63999
781
789
  '60001': AuthenticationError,
782
790
  '60002': AuthenticationError,
@@ -1237,10 +1237,11 @@ export default class binance extends binanceRest {
1237
1237
  }
1238
1238
  async authenticate(params = {}) {
1239
1239
  const time = this.milliseconds();
1240
- let type = this.safeString2(this.options, 'defaultType', 'authenticate', 'spot');
1241
- type = this.safeString(params, 'type', type);
1240
+ let query = undefined;
1241
+ let type = undefined;
1242
+ [type, query] = this.handleMarketTypeAndParams('authenticate', undefined, params);
1242
1243
  let subType = undefined;
1243
- [subType, params] = this.handleSubTypeAndParams('authenticate', undefined, params);
1244
+ [subType, query] = this.handleSubTypeAndParams('authenticate', undefined, query);
1244
1245
  if (this.isLinear(type, subType)) {
1245
1246
  type = 'future';
1246
1247
  }
@@ -1248,11 +1249,11 @@ export default class binance extends binanceRest {
1248
1249
  type = 'delivery';
1249
1250
  }
1250
1251
  let marginMode = undefined;
1251
- [marginMode, params] = this.handleMarginModeAndParams('authenticate', params);
1252
+ [marginMode, query] = this.handleMarginModeAndParams('authenticate', query);
1252
1253
  const isIsolatedMargin = (marginMode === 'isolated');
1253
1254
  const isCrossMargin = (marginMode === 'cross') || (marginMode === undefined);
1254
- const symbol = this.safeString(params, 'symbol');
1255
- params = this.omit(params, 'symbol');
1255
+ const symbol = this.safeString(query, 'symbol');
1256
+ query = this.omit(query, 'symbol');
1256
1257
  const options = this.safeValue(this.options, type, {});
1257
1258
  const lastAuthenticatedTime = this.safeInteger(options, 'lastAuthenticatedTime', 0);
1258
1259
  const listenKeyRefreshRate = this.safeInteger(this.options, 'listenKeyRefreshRate', 1200000);
@@ -1274,9 +1275,9 @@ export default class binance extends binanceRest {
1274
1275
  throw new ArgumentsRequired(this.id + ' authenticate() requires a symbol argument for isolated margin mode');
1275
1276
  }
1276
1277
  const marketId = this.marketId(symbol);
1277
- params = this.extend(params, { 'symbol': marketId });
1278
+ query = this.extend(query, { 'symbol': marketId });
1278
1279
  }
1279
- const response = await this[method](params);
1280
+ const response = await this[method](query);
1280
1281
  this.options[type] = this.extend(options, {
1281
1282
  'listenKey': this.safeString(response, 'listenKey'),
1282
1283
  'lastAuthenticatedTime': time,
@@ -1288,8 +1289,8 @@ export default class binance extends binanceRest {
1288
1289
  // https://binance-docs.github.io/apidocs/spot/en/#listen-key-spot
1289
1290
  let type = this.safeString2(this.options, 'defaultType', 'authenticate', 'spot');
1290
1291
  type = this.safeString(params, 'type', type);
1291
- let subType = undefined;
1292
- [subType, params] = this.handleSubTypeAndParams('keepAliveListenKey', undefined, params);
1292
+ const subTypeInfo = this.handleSubTypeAndParams('keepAliveListenKey', undefined, params);
1293
+ const subType = subTypeInfo[0];
1293
1294
  if (this.isLinear(type, subType)) {
1294
1295
  type = 'future';
1295
1296
  }
@@ -2066,7 +2067,7 @@ export default class binance extends binanceRest {
2066
2067
  market = this.market(symbol);
2067
2068
  symbol = market['symbol'];
2068
2069
  messageHash += ':' + symbol;
2069
- params = this.extend(params, { 'symbol': symbol }); // needed inside authenticate for isolated margin
2070
+ params = this.extend(params, { 'type': market['type'], 'symbol': symbol }); // needed inside authenticate for isolated margin
2070
2071
  }
2071
2072
  await this.authenticate(params);
2072
2073
  let type = undefined;
@@ -2079,7 +2080,11 @@ export default class binance extends binanceRest {
2079
2080
  else if (this.isInverse(type, subType)) {
2080
2081
  type = 'delivery';
2081
2082
  }
2082
- const url = this.urls['api']['ws'][type] + '/' + this.options[type]['listenKey'];
2083
+ let urlType = type;
2084
+ if (type === 'margin') {
2085
+ urlType = 'spot'; // spot-margin shares the same stream as regular spot
2086
+ }
2087
+ const url = this.urls['api']['ws'][urlType] + '/' + this.options[type]['listenKey'];
2083
2088
  const client = this.client(url);
2084
2089
  this.setBalanceCache(client, type);
2085
2090
  const message = undefined;
@@ -2419,10 +2424,15 @@ export default class binance extends binanceRest {
2419
2424
  * @returns {object[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure
2420
2425
  */
2421
2426
  await this.loadMarkets();
2422
- const defaultType = this.safeString2(this.options, 'watchMyTrades', 'defaultType', 'spot');
2423
- let type = this.safeString(params, 'type', defaultType);
2427
+ let type = undefined;
2428
+ let market = undefined;
2429
+ if (symbol !== undefined) {
2430
+ market = this.market(symbol);
2431
+ symbol = market['symbol'];
2432
+ }
2433
+ [type, params] = this.handleMarketTypeAndParams('watchMyTrades', market, params);
2424
2434
  let subType = undefined;
2425
- [subType, params] = this.handleSubTypeAndParams('watchMyTrades', undefined, params);
2435
+ [subType, params] = this.handleSubTypeAndParams('watchMyTrades', market, params);
2426
2436
  if (this.isLinear(type, subType)) {
2427
2437
  type = 'future';
2428
2438
  }
@@ -2433,10 +2443,14 @@ export default class binance extends binanceRest {
2433
2443
  if (symbol !== undefined) {
2434
2444
  symbol = this.symbol(symbol);
2435
2445
  messageHash += ':' + symbol;
2436
- params = this.extend(params, { 'symbol': symbol });
2446
+ params = this.extend(params, { 'type': market['type'], 'symbol': symbol });
2437
2447
  }
2438
2448
  await this.authenticate(params);
2439
- const url = this.urls['api']['ws'][type] + '/' + this.options[type]['listenKey'];
2449
+ let urlType = type; // we don't change type because the listening key is different
2450
+ if (type === 'margin') {
2451
+ urlType = 'spot'; // spot-margin shares the same stream as regular spot
2452
+ }
2453
+ const url = this.urls['api']['ws'][urlType] + '/' + this.options[type]['listenKey'];
2440
2454
  const client = this.client(url);
2441
2455
  this.setBalanceCache(client, type);
2442
2456
  const message = undefined;
@@ -48,7 +48,7 @@ export default class probit extends Exchange {
48
48
  id: string;
49
49
  currency: any;
50
50
  amount: number;
51
- network: any;
51
+ network: string;
52
52
  addressFrom: any;
53
53
  address: string;
54
54
  addressTo: string;
@@ -71,7 +71,7 @@ export default class probit extends Exchange {
71
71
  id: string;
72
72
  currency: any;
73
73
  amount: number;
74
- network: any;
74
+ network: string;
75
75
  addressFrom: any;
76
76
  address: string;
77
77
  addressTo: string;
package/js/src/probit.js CHANGED
@@ -1484,6 +1484,7 @@ export default class probit extends Exchange {
1484
1484
  * @param {string} code unified currency code
1485
1485
  * @param {int} [since] the earliest time in ms to fetch transactions for
1486
1486
  * @param {int} [limit] the maximum number of transaction structures to retrieve
1487
+ * @param {int} [params.until] the latest time in ms to fetch transactions for
1487
1488
  * @param {object} [params] extra parameters specific to the probit api endpoint
1488
1489
  * @returns {object[]} a list of [transaction structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#transaction-structure}
1489
1490
  */
@@ -1497,6 +1498,17 @@ export default class probit extends Exchange {
1497
1498
  if (since !== undefined) {
1498
1499
  request['start_time'] = this.iso8601(since);
1499
1500
  }
1501
+ else {
1502
+ request['start_time'] = this.iso8601(1);
1503
+ }
1504
+ const until = this.safeInteger2(params, 'till', 'until');
1505
+ if (until !== undefined) {
1506
+ request['end_time'] = this.iso8601(until);
1507
+ params = this.omit(params, ['until', 'till']);
1508
+ }
1509
+ else {
1510
+ request['end_time'] = this.iso8601(this.milliseconds());
1511
+ }
1500
1512
  if (limit !== undefined) {
1501
1513
  request['limit'] = limit;
1502
1514
  }
@@ -1532,7 +1544,29 @@ export default class probit extends Exchange {
1532
1544
  return this.parseTransactions(data, currency, since, limit);
1533
1545
  }
1534
1546
  parseTransaction(transaction, currency = undefined) {
1547
+ //
1548
+ // {
1549
+ // "id": "01211d4b-0e68-41d6-97cb-298bfe2cab67",
1550
+ // "type": "deposit",
1551
+ // "status": "done",
1552
+ // "amount": "0.01",
1553
+ // "address": "0x9e7430fc0bdd14745bd00a1b92ed25133a7c765f",
1554
+ // "time": "2023-06-14T12:03:11.000Z",
1555
+ // "hash": "0x0ff5bedc9e378f9529acc6b9840fa8c2ef00fd0275e0bac7fa0589a9b5d1712e",
1556
+ // "currency_id": "ETH",
1557
+ // "confirmations":0,
1558
+ // "fee": "0",
1559
+ // "destination_tag": null,
1560
+ // "platform_id": "ETH",
1561
+ // "fee_currency_id": "ETH",
1562
+ // "payment_service_name":null,
1563
+ // "payment_service_display_name":null,
1564
+ // "crypto":null
1565
+ // }
1566
+ //
1535
1567
  const id = this.safeString(transaction, 'id');
1568
+ const networkId = this.safeString(transaction, 'platform_id');
1569
+ const networkCode = this.networkIdToCode(networkId);
1536
1570
  const amount = this.safeNumber(transaction, 'amount');
1537
1571
  const address = this.safeString(transaction, 'address');
1538
1572
  const tag = this.safeString(transaction, 'destination_tag');
@@ -1554,7 +1588,7 @@ export default class probit extends Exchange {
1554
1588
  'id': id,
1555
1589
  'currency': code,
1556
1590
  'amount': amount,
1557
- 'network': undefined,
1591
+ 'network': networkCode,
1558
1592
  'addressFrom': undefined,
1559
1593
  'address': address,
1560
1594
  'addressTo': address,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt",
3
- "version": "4.1.40",
3
+ "version": "4.1.43",
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",
package/skip-tests.json CHANGED
@@ -1368,6 +1368,7 @@
1368
1368
  }
1369
1369
  },
1370
1370
  "tidex": {
1371
+ "skip": "exchange unavailable, probably api upgrade needed"
1371
1372
  },
1372
1373
  "kraken": {
1373
1374
  "skipWs": true,
@@ -1567,5 +1568,16 @@
1567
1568
  "liquidationPrice": "undefined"
1568
1569
  }
1569
1570
  }
1571
+ },
1572
+ "coinlist": {
1573
+ "skipMethods": {
1574
+ "fetchTicker": {
1575
+ "quoteVolume": "quoteVolume >= baseVolume * low is failing"
1576
+ },
1577
+ "fetchTickers": {
1578
+ "quoteVolume": "quoteVolume >= baseVolume * low is failing",
1579
+ "ask": "invalid"
1580
+ }
1581
+ }
1570
1582
  }
1571
1583
  }