ccxt 4.2.47 → 4.2.49

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 (59) hide show
  1. package/README.md +3 -3
  2. package/build.sh +7 -0
  3. package/dist/ccxt.browser.js +681 -84
  4. package/dist/ccxt.browser.min.js +3 -3
  5. package/dist/cjs/ccxt.js +1 -1
  6. package/dist/cjs/src/binance.js +10 -4
  7. package/dist/cjs/src/bitmart.js +30 -4
  8. package/dist/cjs/src/bitstamp.js +8 -0
  9. package/dist/cjs/src/btcalpha.js +4 -0
  10. package/dist/cjs/src/btcmarkets.js +4 -0
  11. package/dist/cjs/src/btcturk.js +4 -0
  12. package/dist/cjs/src/bybit.js +138 -6
  13. package/dist/cjs/src/idex.js +52 -1
  14. package/dist/cjs/src/independentreserve.js +48 -0
  15. package/dist/cjs/src/indodax.js +120 -19
  16. package/dist/cjs/src/latoken.js +16 -0
  17. package/dist/cjs/src/luno.js +18 -0
  18. package/dist/cjs/src/lykke.js +19 -0
  19. package/dist/cjs/src/ndax.js +18 -0
  20. package/dist/cjs/src/okx.js +32 -5
  21. package/dist/cjs/src/pro/ascendex.js +22 -7
  22. package/dist/cjs/src/pro/bitget.js +28 -7
  23. package/dist/cjs/src/pro/bitstamp.js +1 -1
  24. package/dist/cjs/src/pro/hitbtc.js +6 -11
  25. package/dist/cjs/src/pro/mexc.js +2 -1
  26. package/dist/cjs/src/upbit.js +100 -17
  27. package/js/ccxt.d.ts +1 -1
  28. package/js/ccxt.js +1 -1
  29. package/js/src/abstract/bitstamp.d.ts +8 -0
  30. package/js/src/abstract/indodax.d.ts +9 -8
  31. package/js/src/binance.js +10 -4
  32. package/js/src/bitmart.js +30 -4
  33. package/js/src/bitstamp.js +8 -0
  34. package/js/src/btcalpha.js +4 -0
  35. package/js/src/btcmarkets.js +4 -0
  36. package/js/src/btcturk.js +4 -0
  37. package/js/src/bybit.d.ts +3 -1
  38. package/js/src/bybit.js +138 -6
  39. package/js/src/idex.d.ts +7 -0
  40. package/js/src/idex.js +52 -1
  41. package/js/src/independentreserve.d.ts +15 -1
  42. package/js/src/independentreserve.js +48 -0
  43. package/js/src/indodax.d.ts +3 -1
  44. package/js/src/indodax.js +120 -19
  45. package/js/src/latoken.js +16 -0
  46. package/js/src/luno.js +18 -0
  47. package/js/src/lykke.js +19 -0
  48. package/js/src/ndax.js +18 -0
  49. package/js/src/okx.js +32 -5
  50. package/js/src/pro/ascendex.d.ts +1 -0
  51. package/js/src/pro/ascendex.js +22 -7
  52. package/js/src/pro/bitget.js +28 -7
  53. package/js/src/pro/bitstamp.js +1 -1
  54. package/js/src/pro/hitbtc.js +6 -11
  55. package/js/src/pro/mexc.js +2 -1
  56. package/js/src/upbit.d.ts +2 -0
  57. package/js/src/upbit.js +100 -17
  58. package/package.json +3 -1
  59. package/skip-tests.json +4 -2
package/js/src/upbit.js CHANGED
@@ -44,6 +44,7 @@ export default class upbit extends Exchange {
44
44
  'fetchBalance': true,
45
45
  'fetchCanceledOrders': true,
46
46
  'fetchClosedOrders': true,
47
+ 'fetchDeposit': true,
47
48
  'fetchDepositAddress': true,
48
49
  'fetchDepositAddresses': true,
49
50
  'fetchDeposits': true,
@@ -71,6 +72,7 @@ export default class upbit extends Exchange {
71
72
  'fetchTradingFee': true,
72
73
  'fetchTradingFees': false,
73
74
  'fetchTransactions': false,
75
+ 'fetchWithdrawal': true,
74
76
  'fetchWithdrawals': true,
75
77
  'transfer': false,
76
78
  'withdraw': true,
@@ -1028,6 +1030,7 @@ export default class upbit extends Exchange {
1028
1030
  * @name upbit#createOrder
1029
1031
  * @description create a trade order
1030
1032
  * @see https://docs.upbit.com/reference/%EC%A3%BC%EB%AC%B8%ED%95%98%EA%B8%B0
1033
+ * @see https://global-docs.upbit.com/reference/order
1031
1034
  * @param {string} symbol unified symbol of the market to create an order in
1032
1035
  * @param {string} type 'market' or 'limit'
1033
1036
  * @param {string} side 'buy' or 'sell'
@@ -1035,6 +1038,7 @@ export default class upbit extends Exchange {
1035
1038
  * @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
1036
1039
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1037
1040
  * @param {float} [params.cost] for market buy orders, the quote quantity that can be used as an alternative for the amount
1041
+ * @param {string} [params.timeInForce] 'IOC' or 'FOK'
1038
1042
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1039
1043
  */
1040
1044
  await this.loadMarkets();
@@ -1091,6 +1095,13 @@ export default class upbit extends Exchange {
1091
1095
  if (clientOrderId !== undefined) {
1092
1096
  request['identifier'] = clientOrderId;
1093
1097
  }
1098
+ if (type !== 'market') {
1099
+ const timeInForce = this.safeStringLower2(params, 'timeInForce', 'time_in_force');
1100
+ params = this.omit(params, 'timeInForce');
1101
+ if (timeInForce !== undefined) {
1102
+ request['time_in_force'] = timeInForce;
1103
+ }
1104
+ }
1094
1105
  params = this.omit(params, ['clientOrderId', 'identifier']);
1095
1106
  const response = await this.privatePostOrders(this.extend(request, params));
1096
1107
  //
@@ -1196,6 +1207,45 @@ export default class upbit extends Exchange {
1196
1207
  //
1197
1208
  return this.parseTransactions(response, currency, since, limit);
1198
1209
  }
1210
+ async fetchDeposit(id, code = undefined, params = {}) {
1211
+ /**
1212
+ * @method
1213
+ * @name upbit#fetchDeposit
1214
+ * @description fetch information on a deposit
1215
+ * @see https://global-docs.upbit.com/reference/individual-deposit-inquiry
1216
+ * @param {string} id the unique id for the deposit
1217
+ * @param {string} [code] unified currency code of the currency deposited
1218
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1219
+ * @param {string} [params.txid] withdrawal transaction id, the id argument is reserved for uuid
1220
+ * @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
1221
+ */
1222
+ await this.loadMarkets();
1223
+ const request = {
1224
+ 'uuid': id,
1225
+ };
1226
+ let currency = undefined;
1227
+ if (code !== undefined) {
1228
+ currency = this.currency(code);
1229
+ request['currency'] = currency['id'];
1230
+ }
1231
+ const response = await this.privateGetDeposit(this.extend(request, params));
1232
+ //
1233
+ // {
1234
+ // "type": "deposit",
1235
+ // "uuid": "7f54527e-2eee-4268-860e-fd8b9d7fe3c7",
1236
+ // "currency": "ADA",
1237
+ // "net_type": "ADA",
1238
+ // "txid": "99795bbfeca91eaa071068bb659b33eeb65d8aaff2551fdf7c78f345d188952b",
1239
+ // "state": "ACCEPTED",
1240
+ // "created_at": "2023-12-12T04:58:41Z",
1241
+ // "done_at": "2023-12-12T05:31:50Z",
1242
+ // "amount": "35.72344",
1243
+ // "fee": "0.0",
1244
+ // "transaction_type": "default"
1245
+ // }
1246
+ //
1247
+ return this.parseTransaction(response, currency);
1248
+ }
1199
1249
  async fetchWithdrawals(code = undefined, since = undefined, limit = undefined, params = {}) {
1200
1250
  /**
1201
1251
  * @method
@@ -1240,13 +1290,52 @@ export default class upbit extends Exchange {
1240
1290
  //
1241
1291
  return this.parseTransactions(response, currency, since, limit);
1242
1292
  }
1293
+ async fetchWithdrawal(id, code = undefined, params = {}) {
1294
+ /**
1295
+ * @method
1296
+ * @name upbit#fetchWithdrawal
1297
+ * @description fetch data on a currency withdrawal via the withdrawal id
1298
+ * @see https://global-docs.upbit.com/reference/individual-withdrawal-inquiry
1299
+ * @param {string} id the unique id for the withdrawal
1300
+ * @param {string} [code] unified currency code of the currency withdrawn
1301
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1302
+ * @param {string} [params.txid] withdrawal transaction id, the id argument is reserved for uuid
1303
+ * @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
1304
+ */
1305
+ await this.loadMarkets();
1306
+ const request = {
1307
+ 'uuid': id,
1308
+ };
1309
+ let currency = undefined;
1310
+ if (code !== undefined) {
1311
+ currency = this.currency(code);
1312
+ request['currency'] = currency['id'];
1313
+ }
1314
+ const response = await this.privateGetWithdraw(this.extend(request, params));
1315
+ //
1316
+ // {
1317
+ // "type": "withdraw",
1318
+ // "uuid": "95ef274b-23a6-4de4-95b0-5cbef4ca658f",
1319
+ // "currency": "ADA",
1320
+ // "net_type": "ADA",
1321
+ // "txid": "b1528f149297a71671b86636f731f8fdb0ff53da0f1d8c19093d59df96f34583",
1322
+ // "state": "DONE",
1323
+ // "created_at": "2023-12-14T02:46:52Z",
1324
+ // "done_at": "2023-12-14T03:10:11Z",
1325
+ // "amount": "35.22344",
1326
+ // "fee": "0.5",
1327
+ // "transaction_type": "default"
1328
+ // }
1329
+ //
1330
+ return this.parseTransaction(response, currency);
1331
+ }
1243
1332
  parseTransactionStatus(status) {
1244
1333
  const statuses = {
1245
1334
  'submitting': 'pending',
1246
1335
  'submitted': 'pending',
1247
1336
  'almost_accepted': 'pending',
1248
1337
  'rejected': 'failed',
1249
- 'accepted': 'pending',
1338
+ 'accepted': 'ok',
1250
1339
  'processing': 'pending',
1251
1340
  'done': 'ok',
1252
1341
  'canceled': 'canceled', // 취소됨
@@ -1255,7 +1344,7 @@ export default class upbit extends Exchange {
1255
1344
  }
1256
1345
  parseTransaction(transaction, currency = undefined) {
1257
1346
  //
1258
- // fetchDeposits
1347
+ // fetchDeposits, fetchDeposit
1259
1348
  //
1260
1349
  // {
1261
1350
  // "type": "deposit",
@@ -1269,7 +1358,7 @@ export default class upbit extends Exchange {
1269
1358
  // "fee": "0.0"
1270
1359
  // }
1271
1360
  //
1272
- // fetchWithdrawals
1361
+ // fetchWithdrawals, fetchWithdrawal
1273
1362
  //
1274
1363
  // {
1275
1364
  // "type": "withdraw",
@@ -1284,27 +1373,21 @@ export default class upbit extends Exchange {
1284
1373
  // "krw_amount": "80420.0"
1285
1374
  // }
1286
1375
  //
1287
- const id = this.safeString(transaction, 'uuid');
1288
- const amount = this.safeNumber(transaction, 'amount');
1289
1376
  const address = undefined; // not present in the data structure received from the exchange
1290
1377
  const tag = undefined; // not present in the data structure received from the exchange
1291
- const txid = this.safeString(transaction, 'txid');
1292
1378
  const updatedRaw = this.safeString(transaction, 'done_at');
1293
- const updated = this.parse8601(updatedRaw);
1294
1379
  const timestamp = this.parse8601(this.safeString(transaction, 'created_at', updatedRaw));
1295
1380
  let type = this.safeString(transaction, 'type');
1296
1381
  if (type === 'withdraw') {
1297
1382
  type = 'withdrawal';
1298
1383
  }
1299
1384
  const currencyId = this.safeString(transaction, 'currency');
1300
- const code = this.safeCurrencyCode(currencyId);
1301
- const status = this.parseTransactionStatus(this.safeStringLower(transaction, 'state'));
1302
- const feeCost = this.safeNumber(transaction, 'fee');
1385
+ const code = this.safeCurrencyCode(currencyId, currency);
1303
1386
  return {
1304
1387
  'info': transaction,
1305
- 'id': id,
1388
+ 'id': this.safeString(transaction, 'uuid'),
1306
1389
  'currency': code,
1307
- 'amount': amount,
1390
+ 'amount': this.safeNumber(transaction, 'amount'),
1308
1391
  'network': undefined,
1309
1392
  'address': address,
1310
1393
  'addressTo': undefined,
@@ -1312,17 +1395,17 @@ export default class upbit extends Exchange {
1312
1395
  'tag': tag,
1313
1396
  'tagTo': undefined,
1314
1397
  'tagFrom': undefined,
1315
- 'status': status,
1398
+ 'status': this.parseTransactionStatus(this.safeStringLower(transaction, 'state')),
1316
1399
  'type': type,
1317
- 'updated': updated,
1318
- 'txid': txid,
1400
+ 'updated': this.parse8601(updatedRaw),
1401
+ 'txid': this.safeString(transaction, 'txid'),
1319
1402
  'timestamp': timestamp,
1320
1403
  'datetime': this.iso8601(timestamp),
1321
1404
  'internal': undefined,
1322
1405
  'comment': undefined,
1323
1406
  'fee': {
1324
1407
  'currency': code,
1325
- 'cost': feeCost,
1408
+ 'cost': this.safeNumber(transaction, 'fee'),
1326
1409
  },
1327
1410
  };
1328
1411
  }
@@ -1802,7 +1885,7 @@ export default class upbit extends Exchange {
1802
1885
  }
1803
1886
  if (api === 'private') {
1804
1887
  this.checkRequiredCredentials();
1805
- const nonce = this.nonce();
1888
+ const nonce = this.uuid();
1806
1889
  const request = {
1807
1890
  'access_key': this.apiKey,
1808
1891
  'nonce': nonce,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt",
3
- "version": "4.2.47",
3
+ "version": "4.2.49",
4
4
  "description": "A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 100+ exchanges",
5
5
  "unpkg": "dist/ccxt.browser.js",
6
6
  "type": "module",
@@ -56,6 +56,8 @@
56
56
  "test-py-ws": "node run-tests --ws --python --useProxy",
57
57
  "test-php": "node run-tests --php --useProxy",
58
58
  "test-php-ws": "node run-tests --ws --php --useProxy",
59
+ "test-csharp": "npm run commonjs-test && node run-tests --csharp --useProxy",
60
+ "test-csharp-ws": "node run-tests --ws --csharp --useProxy",
59
61
  "test-js-base": "node ./js/src/test/base/test.base.js",
60
62
  "test-js-base-ws": "npm run test-js-cache && npm run test-js-orderbook",
61
63
  "test-python-base": "python3 python/ccxt/test/base/test_number.py && python3 python/ccxt/test/base/test_crypto.py",
package/skip-tests.json CHANGED
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "ace": {
3
3
  "skip": "temp",
4
- "skipWs": true,
5
4
  "skipMethods": {
6
5
  "loadMarkets": {
7
6
  "currencyIdAndCode": "temporary skip, because ids are numeric and we are in wip for numeric id tests",
@@ -22,7 +21,6 @@
22
21
  "skipWs": "private endpoints"
23
22
  },
24
23
  "ascendex": {
25
- "skipWs": "unknown https://app.travis-ci.com/github/ccxt/ccxt/builds/267900037#L2416",
26
24
  "skipMethods": {
27
25
  "loadMarkets": {
28
26
  "currencyIdAndCode": "broken currencies"
@@ -35,6 +33,10 @@
35
33
  "low":"16 Aug - happened weird negative 24hr low",
36
34
  "bid":"messed bid-ask",
37
35
  "ask":"messed bid-ask"
36
+ },
37
+ "watchOrderBook": {
38
+ "bid":"messed bid-ask",
39
+ "ask":"messed bid-ask"
38
40
  }
39
41
  }
40
42
  },