ccxt 4.2.12 → 4.2.13

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 (63) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.js +718 -240
  3. package/dist/ccxt.browser.min.js +3 -3
  4. package/dist/cjs/ccxt.js +1 -1
  5. package/dist/cjs/js/ccxt.js +1 -1
  6. package/dist/cjs/js/src/bigone.js +89 -22
  7. package/dist/cjs/js/src/binance.js +34 -27
  8. package/dist/cjs/js/src/bingx.js +106 -36
  9. package/dist/cjs/js/src/bitget.js +13 -6
  10. package/dist/cjs/js/src/bitmart.js +3 -3
  11. package/dist/cjs/js/src/bybit.js +1 -1
  12. package/dist/cjs/js/src/coinbase.js +176 -26
  13. package/dist/cjs/js/src/coinlist.js +1 -1
  14. package/dist/cjs/js/src/coinone.js +1 -1
  15. package/dist/cjs/js/src/deribit.js +1 -1
  16. package/dist/cjs/js/src/gate.js +74 -56
  17. package/dist/cjs/js/src/gemini.js +1 -1
  18. package/dist/cjs/js/src/htx.js +26 -1
  19. package/dist/cjs/js/src/independentreserve.js +7 -5
  20. package/dist/cjs/js/src/kraken.js +3 -7
  21. package/dist/cjs/js/src/lbank.js +59 -33
  22. package/dist/cjs/js/src/oceanex.js +1 -1
  23. package/dist/cjs/js/src/okx.js +2 -1
  24. package/dist/cjs/js/src/phemex.js +9 -2
  25. package/dist/cjs/js/src/pro/kraken.js +1 -1
  26. package/dist/cjs/js/src/pro/okx.js +52 -2
  27. package/dist/cjs/js/src/probit.js +4 -2
  28. package/dist/cjs/js/src/wavesexchange.js +1 -1
  29. package/dist/cjs/js/src/woo.js +52 -2
  30. package/js/ccxt.d.ts +1 -1
  31. package/js/ccxt.js +1 -1
  32. package/js/src/abstract/bingx.d.ts +2 -0
  33. package/js/src/abstract/okx.d.ts +1 -0
  34. package/js/src/bigone.d.ts +2 -0
  35. package/js/src/bigone.js +89 -22
  36. package/js/src/binance.js +34 -27
  37. package/js/src/bingx.js +106 -36
  38. package/js/src/bitget.js +13 -6
  39. package/js/src/bitmart.js +3 -3
  40. package/js/src/bybit.js +1 -1
  41. package/js/src/coinbase.d.ts +26 -3
  42. package/js/src/coinbase.js +176 -26
  43. package/js/src/coinlist.js +1 -1
  44. package/js/src/coinone.js +1 -1
  45. package/js/src/deribit.js +1 -1
  46. package/js/src/gate.js +74 -56
  47. package/js/src/gemini.js +1 -1
  48. package/js/src/htx.d.ts +1 -0
  49. package/js/src/htx.js +26 -1
  50. package/js/src/independentreserve.js +7 -5
  51. package/js/src/kraken.js +3 -7
  52. package/js/src/lbank.js +59 -33
  53. package/js/src/oceanex.js +1 -1
  54. package/js/src/okx.js +2 -1
  55. package/js/src/phemex.js +9 -2
  56. package/js/src/pro/kraken.js +1 -1
  57. package/js/src/pro/okx.d.ts +1 -0
  58. package/js/src/pro/okx.js +52 -2
  59. package/js/src/probit.js +4 -2
  60. package/js/src/wavesexchange.js +1 -1
  61. package/js/src/woo.d.ts +2 -0
  62. package/js/src/woo.js +52 -2
  63. package/package.json +1 -1
@@ -105,7 +105,7 @@ export default class coinbase extends Exchange {
105
105
  'setLeverage': false,
106
106
  'setMarginMode': false,
107
107
  'setPositionMode': false,
108
- 'withdraw': undefined,
108
+ 'withdraw': true,
109
109
  },
110
110
  'urls': {
111
111
  'logo': 'https://user-images.githubusercontent.com/1294454/40811661-b6eceae2-653a-11e8-829e-10bfadb078cf.jpg',
@@ -776,46 +776,102 @@ export default class coinbase extends Exchange {
776
776
  // "next_step": null
777
777
  // }
778
778
  //
779
- const subtotalObject = this.safeValue(transaction, 'subtotal', {});
780
- const feeObject = this.safeValue(transaction, 'fee', {});
781
- const id = this.safeString(transaction, 'id');
782
- const timestamp = this.parse8601(this.safeValue(transaction, 'created_at'));
783
- const updated = this.parse8601(this.safeValue(transaction, 'updated_at'));
784
- const type = this.safeString(transaction, 'resource');
785
- const amount = this.safeNumber(subtotalObject, 'amount');
786
- const currencyId = this.safeString(subtotalObject, 'currency');
787
- const code = this.safeCurrencyCode(currencyId, currency);
788
- const feeCost = this.safeNumber(feeObject, 'amount');
789
- const feeCurrencyId = this.safeString(feeObject, 'currency');
790
- const feeCurrency = this.safeCurrencyCode(feeCurrencyId);
791
- const fee = {
792
- 'cost': feeCost,
793
- 'currency': feeCurrency,
794
- };
779
+ // withdraw
780
+ //
781
+ // {
782
+ // "id": "a1794ecf-5693-55fa-70cf-ef731748ed82",
783
+ // "type": "send",
784
+ // "status": "pending",
785
+ // "amount": {
786
+ // "amount": "-14.008308",
787
+ // "currency": "USDC"
788
+ // },
789
+ // "native_amount": {
790
+ // "amount": "-18.74",
791
+ // "currency": "CAD"
792
+ // },
793
+ // "description": null,
794
+ // "created_at": "2024-01-12T01:27:31Z",
795
+ // "updated_at": "2024-01-12T01:27:31Z",
796
+ // "resource": "transaction",
797
+ // "resource_path": "/v2/accounts/a34bgfad-ed67-538b-bffc-730c98c10da0/transactions/a1794ecf-5693-55fa-70cf-ef731748ed82",
798
+ // "instant_exchange": false,
799
+ // "network": {
800
+ // "status": "pending",
801
+ // "status_description": "Pending (est. less than 10 minutes)",
802
+ // "transaction_fee": {
803
+ // "amount": "4.008308",
804
+ // "currency": "USDC"
805
+ // },
806
+ // "transaction_amount": {
807
+ // "amount": "10.000000",
808
+ // "currency": "USDC"
809
+ // },
810
+ // "confirmations": 0
811
+ // },
812
+ // "to": {
813
+ // "resource": "ethereum_address",
814
+ // "address": "0x9...",
815
+ // "currency": "USDC",
816
+ // "address_info": {
817
+ // "address": "0x9..."
818
+ // }
819
+ // },
820
+ // "idem": "748d8591-dg9a-7831-a45b-crd61dg78762",
821
+ // "details": {
822
+ // "title": "Sent USDC",
823
+ // "subtitle": "To USDC address on Ethereum network",
824
+ // "header": "Sent 14.008308 USDC ($18.74)",
825
+ // "health": "warning"
826
+ // },
827
+ // "hide_native_amount": false
828
+ // }
829
+ //
830
+ const transactionType = this.safeString(transaction, 'type');
831
+ let amountAndCurrencyObject = undefined;
832
+ let feeObject = undefined;
833
+ if (transactionType === 'send') {
834
+ const network = this.safeValue(transaction, 'network', {});
835
+ amountAndCurrencyObject = this.safeValue(network, 'transaction_amount', {});
836
+ feeObject = this.safeValue(network, 'transaction_fee', {});
837
+ }
838
+ else {
839
+ amountAndCurrencyObject = this.safeValue(transaction, 'subtotal', {});
840
+ feeObject = this.safeValue(transaction, 'fee', {});
841
+ }
795
842
  let status = this.parseTransactionStatus(this.safeString(transaction, 'status'));
796
843
  if (status === undefined) {
797
844
  const committed = this.safeValue(transaction, 'committed');
798
845
  status = committed ? 'ok' : 'pending';
799
846
  }
847
+ const id = this.safeString(transaction, 'id');
848
+ const currencyId = this.safeString(amountAndCurrencyObject, 'currency');
849
+ const feeCurrencyId = this.safeString(feeObject, 'currency');
850
+ const datetime = this.safeValue(transaction, 'created_at');
851
+ const toObject = this.safeValue(transaction, 'to', {});
852
+ const toAddress = this.safeString(toObject, 'address');
800
853
  return {
801
854
  'info': transaction,
802
855
  'id': id,
803
856
  'txid': id,
804
- 'timestamp': timestamp,
805
- 'datetime': this.iso8601(timestamp),
857
+ 'timestamp': this.parse8601(datetime),
858
+ 'datetime': datetime,
806
859
  'network': undefined,
807
- 'address': undefined,
808
- 'addressTo': undefined,
860
+ 'address': toAddress,
861
+ 'addressTo': toAddress,
809
862
  'addressFrom': undefined,
810
863
  'tag': undefined,
811
864
  'tagTo': undefined,
812
865
  'tagFrom': undefined,
813
- 'type': type,
814
- 'amount': amount,
815
- 'currency': code,
866
+ 'type': this.safeString(transaction, 'resource'),
867
+ 'amount': this.safeNumber(amountAndCurrencyObject, 'amount'),
868
+ 'currency': this.safeCurrencyCode(currencyId, currency),
816
869
  'status': status,
817
- 'updated': updated,
818
- 'fee': fee,
870
+ 'updated': this.parse8601(this.safeValue(transaction, 'updated_at')),
871
+ 'fee': {
872
+ 'cost': this.safeNumber(feeObject, 'amount'),
873
+ 'currency': this.safeCurrencyCode(feeCurrencyId),
874
+ },
819
875
  };
820
876
  }
821
877
  parseTrade(trade, market = undefined) {
@@ -3169,6 +3225,100 @@ export default class coinbase extends Exchange {
3169
3225
  const tickers = this.safeValue(response, 'pricebooks', []);
3170
3226
  return this.parseTickers(tickers, symbols);
3171
3227
  }
3228
+ async withdraw(code, amount, address, tag = undefined, params = {}) {
3229
+ /**
3230
+ * @method
3231
+ * @name coinbase#withdraw
3232
+ * @description make a withdrawal
3233
+ * @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-transactions#send-money
3234
+ * @param {string} code unified currency code
3235
+ * @param {float} amount the amount to withdraw
3236
+ * @param {string} address the address to withdraw to
3237
+ * @param {string} [tag] an optional tag for the withdrawal
3238
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3239
+ * @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
3240
+ */
3241
+ [tag, params] = this.handleWithdrawTagAndParams(tag, params);
3242
+ this.checkAddress(address);
3243
+ await this.loadMarkets();
3244
+ const currency = this.currency(code);
3245
+ let accountId = this.safeString2(params, 'account_id', 'accountId');
3246
+ params = this.omit(params, ['account_id', 'accountId']);
3247
+ if (accountId === undefined) {
3248
+ if (code === undefined) {
3249
+ throw new ArgumentsRequired(this.id + ' withdraw() requires an account_id (or accountId) parameter OR a currency code argument');
3250
+ }
3251
+ accountId = await this.findAccountId(code);
3252
+ if (accountId === undefined) {
3253
+ throw new ExchangeError(this.id + ' withdraw() could not find account id for ' + code);
3254
+ }
3255
+ }
3256
+ const request = {
3257
+ 'account_id': accountId,
3258
+ 'type': 'send',
3259
+ 'to': address,
3260
+ 'amount': amount,
3261
+ 'currency': currency['id'],
3262
+ };
3263
+ if (tag !== undefined) {
3264
+ request['destination_tag'] = tag;
3265
+ }
3266
+ const response = await this.v2PrivatePostAccountsAccountIdTransactions(this.extend(request, params));
3267
+ //
3268
+ // {
3269
+ // "data": {
3270
+ // "id": "a1794ecf-5693-55fa-70cf-ef731748ed82",
3271
+ // "type": "send",
3272
+ // "status": "pending",
3273
+ // "amount": {
3274
+ // "amount": "-14.008308",
3275
+ // "currency": "USDC"
3276
+ // },
3277
+ // "native_amount": {
3278
+ // "amount": "-18.74",
3279
+ // "currency": "CAD"
3280
+ // },
3281
+ // "description": null,
3282
+ // "created_at": "2024-01-12T01:27:31Z",
3283
+ // "updated_at": "2024-01-12T01:27:31Z",
3284
+ // "resource": "transaction",
3285
+ // "resource_path": "/v2/accounts/a34bgfad-ed67-538b-bffc-730c98c10da0/transactions/a1794ecf-5693-55fa-70cf-ef731748ed82",
3286
+ // "instant_exchange": false,
3287
+ // "network": {
3288
+ // "status": "pending",
3289
+ // "status_description": "Pending (est. less than 10 minutes)",
3290
+ // "transaction_fee": {
3291
+ // "amount": "4.008308",
3292
+ // "currency": "USDC"
3293
+ // },
3294
+ // "transaction_amount": {
3295
+ // "amount": "10.000000",
3296
+ // "currency": "USDC"
3297
+ // },
3298
+ // "confirmations": 0
3299
+ // },
3300
+ // "to": {
3301
+ // "resource": "ethereum_address",
3302
+ // "address": "0x9...",
3303
+ // "currency": "USDC",
3304
+ // "address_info": {
3305
+ // "address": "0x9..."
3306
+ // }
3307
+ // },
3308
+ // "idem": "748d8591-dg9a-7831-a45b-crd61dg78762",
3309
+ // "details": {
3310
+ // "title": "Sent USDC",
3311
+ // "subtitle": "To USDC address on Ethereum network",
3312
+ // "header": "Sent 14.008308 USDC ($18.74)",
3313
+ // "health": "warning"
3314
+ // },
3315
+ // "hide_native_amount": false
3316
+ // }
3317
+ // }
3318
+ //
3319
+ const data = this.safeValue(response, 'data', {});
3320
+ return this.parseTransaction(data, currency);
3321
+ }
3172
3322
  sign(path, api = [], method = 'GET', params = {}, headers = undefined, body = undefined) {
3173
3323
  const version = api[0];
3174
3324
  const signed = api[1] === 'private';
@@ -753,7 +753,7 @@ export default class coinlist extends Exchange {
753
753
  request['start_time'] = this.iso8601(since);
754
754
  }
755
755
  if (limit !== undefined) {
756
- request['count'] = limit;
756
+ request['count'] = Math.min(limit, 500);
757
757
  }
758
758
  const until = this.safeInteger2(params, 'till', 'until');
759
759
  if (until !== undefined) {
package/js/src/coinone.js CHANGED
@@ -712,7 +712,7 @@ export default class coinone extends Exchange {
712
712
  'target_currency': market['base'],
713
713
  };
714
714
  if (limit !== undefined) {
715
- request['size'] = limit; // only support 10, 50, 100, 150, 200
715
+ request['size'] = Math.min(limit, 200);
716
716
  }
717
717
  const response = await this.v2PublicGetTradesQuoteCurrencyTargetCurrency(this.extend(request, params));
718
718
  //
package/js/src/deribit.js CHANGED
@@ -39,11 +39,11 @@ export default class deribit extends Exchange {
39
39
  'cancelOrder': true,
40
40
  'cancelOrders': false,
41
41
  'createDepositAddress': true,
42
- 'createTrailingAmountOrder': true,
43
42
  'createOrder': true,
44
43
  'createStopLimitOrder': true,
45
44
  'createStopMarketOrder': true,
46
45
  'createStopOrder': true,
46
+ 'createTrailingAmountOrder': true,
47
47
  'editOrder': true,
48
48
  'fetchAccounts': true,
49
49
  'fetchBalance': true,
package/js/src/gate.js CHANGED
@@ -3123,7 +3123,7 @@ export default class gate extends Exchange {
3123
3123
  request['to'] = this.parseToInt(until / 1000);
3124
3124
  }
3125
3125
  if (limit !== undefined) {
3126
- request['limit'] = limit; // default 100, max 1000
3126
+ request['limit'] = Math.min(limit, 1000); // default 100, max 1000
3127
3127
  }
3128
3128
  if (since !== undefined && (market['contract'])) {
3129
3129
  request['from'] = this.parseToInt(since / 1000);
@@ -5263,29 +5263,35 @@ export default class gate extends Exchange {
5263
5263
  // swap and future
5264
5264
  //
5265
5265
  // {
5266
- // "value": "12.475572",
5266
+ // "value": "4.60516",
5267
5267
  // "leverage": "0",
5268
5268
  // "mode": "single",
5269
5269
  // "realised_point": "0",
5270
5270
  // "contract": "BTC_USDT",
5271
- // "entry_price": "62422.6",
5272
- // "mark_price": "62377.86",
5271
+ // "entry_price": "46030.3",
5272
+ // "mark_price": "46051.6",
5273
5273
  // "history_point": "0",
5274
- // "realised_pnl": "-0.00624226",
5275
- // "close_order": null,
5276
- // "size": "2",
5277
- // "cross_leverage_limit": "25",
5278
- // "pending_orders": "0",
5279
- // "adl_ranking": "5",
5280
- // "maintenance_rate": "0.005",
5281
- // "unrealised_pnl": "-0.008948",
5282
- // "user": "663337",
5283
- // "leverage_max": "100",
5284
- // "history_pnl": "14.98868396636",
5274
+ // "realised_pnl": "-0.002301515",
5275
+ // "close_order": null,
5276
+ // "size": 1,
5277
+ // "cross_leverage_limit": "0",
5278
+ // "pending_orders": 0,
5279
+ // "adl_ranking": 5,
5280
+ // "maintenance_rate": "0.004",
5281
+ // "unrealised_pnl": "0.00213",
5282
+ // "user": 5691076,
5283
+ // "leverage_max": "125",
5284
+ // "history_pnl": "0",
5285
5285
  // "risk_limit": "1000000",
5286
- // "margin": "0.740721495056",
5287
- // "last_close_pnl": "-0.041996015",
5288
- // "liq_price": "59058.58"
5286
+ // "margin": "8.997698485",
5287
+ // "last_close_pnl": "0",
5288
+ // "liq_price": "0",
5289
+ // "update_time": 1705034246,
5290
+ // "update_id": 1,
5291
+ // "initial_margin": "0",
5292
+ // "maintenance_margin": "0",
5293
+ // "open_time": 1705034246,
5294
+ // "trade_max_size": "0"
5289
5295
  // }
5290
5296
  //
5291
5297
  // option
@@ -5336,14 +5342,14 @@ export default class gate extends Exchange {
5336
5342
  const takerFee = '0.00075';
5337
5343
  const feePaid = Precise.stringMul(takerFee, notional);
5338
5344
  const initialMarginString = Precise.stringAdd(Precise.stringDiv(notional, leverage), feePaid);
5339
- const timestamp = this.safeInteger(position, 'time_ms');
5345
+ const timestamp = this.safeTimestamp(position, 'open_time');
5340
5346
  return this.safePosition({
5341
5347
  'info': position,
5342
5348
  'id': undefined,
5343
5349
  'symbol': this.safeString(market, 'symbol'),
5344
- 'timestamp': undefined,
5345
- 'datetime': undefined,
5346
- 'lastUpdateTimestamp': timestamp,
5350
+ 'timestamp': timestamp,
5351
+ 'datetime': this.iso8601(timestamp),
5352
+ 'lastUpdateTimestamp': this.safeTimestamp(position, 'update_time'),
5347
5353
  'initialMargin': this.parseNumber(initialMarginString),
5348
5354
  'initialMarginPercentage': this.parseNumber(Precise.stringDiv(initialMarginString, notional)),
5349
5355
  'maintenanceMargin': this.parseNumber(Precise.stringMul(maintenanceRate, notional)),
@@ -5402,29 +5408,35 @@ export default class gate extends Exchange {
5402
5408
  // swap and future
5403
5409
  //
5404
5410
  // {
5405
- // "value": "12.475572",
5411
+ // "value": "4.60516",
5406
5412
  // "leverage": "0",
5407
5413
  // "mode": "single",
5408
5414
  // "realised_point": "0",
5409
5415
  // "contract": "BTC_USDT",
5410
- // "entry_price": "62422.6",
5411
- // "mark_price": "62377.86",
5416
+ // "entry_price": "46030.3",
5417
+ // "mark_price": "46051.6",
5412
5418
  // "history_point": "0",
5413
- // "realised_pnl": "-0.00624226",
5414
- // "close_order": null,
5415
- // "size": "2",
5416
- // "cross_leverage_limit": "25",
5417
- // "pending_orders": "0",
5418
- // "adl_ranking": "5",
5419
- // "maintenance_rate": "0.005",
5420
- // "unrealised_pnl": "-0.008948",
5421
- // "user": "6693577",
5422
- // "leverage_max": "100",
5423
- // "history_pnl": "14.98868396636",
5419
+ // "realised_pnl": "-0.002301515",
5420
+ // "close_order": null,
5421
+ // "size": 1,
5422
+ // "cross_leverage_limit": "0",
5423
+ // "pending_orders": 0,
5424
+ // "adl_ranking": 5,
5425
+ // "maintenance_rate": "0.004",
5426
+ // "unrealised_pnl": "0.00213",
5427
+ // "user": 5691076,
5428
+ // "leverage_max": "125",
5429
+ // "history_pnl": "0",
5424
5430
  // "risk_limit": "1000000",
5425
- // "margin": "0.740721495056",
5426
- // "last_close_pnl": "-0.041996015",
5427
- // "liq_price": "59058.58"
5431
+ // "margin": "8.997698485",
5432
+ // "last_close_pnl": "0",
5433
+ // "liq_price": "0",
5434
+ // "update_time": 1705034246,
5435
+ // "update_id": 1,
5436
+ // "initial_margin": "0",
5437
+ // "maintenance_margin": "0",
5438
+ // "open_time": 1705034246,
5439
+ // "trade_max_size": "0"
5428
5440
  // }
5429
5441
  //
5430
5442
  // option
@@ -5504,29 +5516,35 @@ export default class gate extends Exchange {
5504
5516
  //
5505
5517
  // [
5506
5518
  // {
5507
- // "value": "12.475572",
5519
+ // "value": "4.602828",
5508
5520
  // "leverage": "0",
5509
5521
  // "mode": "single",
5510
5522
  // "realised_point": "0",
5511
5523
  // "contract": "BTC_USDT",
5512
- // "entry_price": "62422.6",
5513
- // "mark_price": "62377.86",
5524
+ // "entry_price": "46030.3",
5525
+ // "mark_price": "46028.28",
5514
5526
  // "history_point": "0",
5515
- // "realised_pnl": "-0.00624226",
5516
- // "close_order": null,
5517
- // "size": "2",
5518
- // "cross_leverage_limit": "25",
5519
- // "pending_orders": "0",
5520
- // "adl_ranking": "5",
5521
- // "maintenance_rate": "0.005",
5522
- // "unrealised_pnl": "-0.008948",
5523
- // "user": "6693577",
5524
- // "leverage_max": "100",
5525
- // "history_pnl": "14.98868396636",
5527
+ // "realised_pnl": "-0.002301515",
5528
+ // "close_order": null,
5529
+ // "size": 1,
5530
+ // "cross_leverage_limit": "0",
5531
+ // "pending_orders": 0,
5532
+ // "adl_ranking": 5,
5533
+ // "maintenance_rate": "0.004",
5534
+ // "unrealised_pnl": "-0.000202",
5535
+ // "user": 5691076,
5536
+ // "leverage_max": "125",
5537
+ // "history_pnl": "0",
5526
5538
  // "risk_limit": "1000000",
5527
- // "margin": "0.740721495056",
5528
- // "last_close_pnl": "-0.041996015",
5529
- // "liq_price": "59058.58"
5539
+ // "margin": "8.997698485",
5540
+ // "last_close_pnl": "0",
5541
+ // "liq_price": "0",
5542
+ // "update_time": 1705034246,
5543
+ // "update_id": 1,
5544
+ // "initial_margin": "0",
5545
+ // "maintenance_margin": "0",
5546
+ // "open_time": 1705034246,
5547
+ // "trade_max_size": "0"
5530
5548
  // }
5531
5549
  // ]
5532
5550
  //
package/js/src/gemini.js CHANGED
@@ -954,7 +954,7 @@ export default class gemini extends Exchange {
954
954
  'symbol': market['id'],
955
955
  };
956
956
  if (limit !== undefined) {
957
- request['limit_trades'] = limit;
957
+ request['limit_trades'] = Math.min(limit, 500);
958
958
  }
959
959
  if (since !== undefined) {
960
960
  request['timestamp'] = since;
package/js/src/htx.d.ts CHANGED
@@ -84,6 +84,7 @@ export default class htx extends Exchange {
84
84
  parseOrderStatus(status: any): string;
85
85
  parseOrder(order: any, market?: Market): Order;
86
86
  createMarketBuyOrderWithCost(symbol: string, cost: any, params?: {}): Promise<Order>;
87
+ createTrailingPercentOrder(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, trailingPercent?: any, trailingTriggerPrice?: any, params?: {}): Promise<Order>;
87
88
  createSpotOrderRequest(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, params?: {}): Promise<any>;
88
89
  createContractOrderRequest(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, params?: {}): any;
89
90
  createOrder(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, params?: {}): Promise<Order>;
package/js/src/htx.js CHANGED
@@ -44,13 +44,13 @@ export default class htx extends Exchange {
44
44
  'createMarketBuyOrderWithCost': true,
45
45
  'createMarketOrderWithCost': false,
46
46
  'createMarketSellOrderWithCost': false,
47
- 'createTrailingPercentOrder': true,
48
47
  'createOrder': true,
49
48
  'createOrders': true,
50
49
  'createReduceOnlyOrder': false,
51
50
  'createStopLimitOrder': true,
52
51
  'createStopMarketOrder': true,
53
52
  'createStopOrder': true,
53
+ 'createTrailingPercentOrder': true,
54
54
  'fetchAccounts': true,
55
55
  'fetchBalance': true,
56
56
  'fetchBidsAsks': undefined,
@@ -4972,6 +4972,31 @@ export default class htx extends Exchange {
4972
4972
  params['createMarketBuyOrderRequiresPrice'] = false;
4973
4973
  return await this.createOrder(symbol, 'market', 'buy', cost, undefined, params);
4974
4974
  }
4975
+ async createTrailingPercentOrder(symbol, type, side, amount, price = undefined, trailingPercent = undefined, trailingTriggerPrice = undefined, params = {}) {
4976
+ /**
4977
+ * @method
4978
+ * @name createTrailingPercentOrder
4979
+ * @description create a trailing order by providing the symbol, type, side, amount, price and trailingPercent
4980
+ * @param {string} symbol unified symbol of the market to create an order in
4981
+ * @param {string} type 'market' or 'limit'
4982
+ * @param {string} side 'buy' or 'sell'
4983
+ * @param {float} amount how much you want to trade in units of the base currency, or number of contracts
4984
+ * @param {float} [price] the price for the order to be filled at, in units of the quote currency, ignored in market orders
4985
+ * @param {float} trailingPercent the percent to trail away from the current market price
4986
+ * @param {float} trailingTriggerPrice the price to activate a trailing order, default uses the price argument
4987
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
4988
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
4989
+ */
4990
+ if (trailingPercent === undefined) {
4991
+ throw new ArgumentsRequired(this.id + ' createTrailingPercentOrder() requires a trailingPercent argument');
4992
+ }
4993
+ if (trailingTriggerPrice === undefined) {
4994
+ throw new ArgumentsRequired(this.id + ' createTrailingPercentOrder() requires a trailingTriggerPrice argument');
4995
+ }
4996
+ params['trailingPercent'] = trailingPercent;
4997
+ params['trailingTriggerPrice'] = trailingTriggerPrice;
4998
+ return await this.createOrder(symbol, type, side, amount, price, params);
4999
+ }
4975
5000
  async createSpotOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
4976
5001
  /**
4977
5002
  * @method
@@ -686,20 +686,22 @@ export default class independentreserve extends Exchange {
686
686
  */
687
687
  await this.loadMarkets();
688
688
  const market = this.market(symbol);
689
- const capitalizedOrderType = this.capitalize(type);
690
- const method = 'privatePostPlace' + capitalizedOrderType + 'Order';
691
- let orderType = capitalizedOrderType;
689
+ let orderType = this.capitalize(type);
692
690
  orderType += (side === 'sell') ? 'Offer' : 'Bid';
693
691
  const request = this.ordered({
694
692
  'primaryCurrencyCode': market['baseId'],
695
693
  'secondaryCurrencyCode': market['quoteId'],
696
694
  'orderType': orderType,
697
695
  });
696
+ let response = undefined;
697
+ request['volume'] = amount;
698
698
  if (type === 'limit') {
699
699
  request['price'] = price;
700
+ response = await this.privatePostPlaceLimitOrder(this.extend(request, params));
701
+ }
702
+ else {
703
+ response = await this.privatePostPlaceMarketOrder(this.extend(request, params));
700
704
  }
701
- request['volume'] = amount;
702
- const response = await this[method](this.extend(request, params));
703
705
  return this.safeOrder({
704
706
  'info': response,
705
707
  'id': response['OrderGuid'],
package/js/src/kraken.js CHANGED
@@ -41,8 +41,8 @@ export default class kraken extends Exchange {
41
41
  'createOrder': true,
42
42
  'createStopLimitOrder': true,
43
43
  'createStopMarketOrder': true,
44
- 'createTrailingAmountOrder': true,
45
44
  'createStopOrder': true,
45
+ 'createTrailingAmountOrder': true,
46
46
  'editOrder': true,
47
47
  'fetchBalance': true,
48
48
  'fetchBorrowInterest': false,
@@ -1267,12 +1267,8 @@ export default class kraken extends Exchange {
1267
1267
  request['since'] = since * 1e6;
1268
1268
  request['since'] = since.toString() + '000000'; // expected to be in nanoseconds
1269
1269
  }
1270
- // https://github.com/ccxt/ccxt/issues/5698
1271
- if (limit !== undefined && limit !== 1000) {
1272
- const fetchTradesWarning = this.safeValue(this.options, 'fetchTradesWarning', true);
1273
- if (fetchTradesWarning) {
1274
- throw new ExchangeError(this.id + ' fetchTrades() cannot serve ' + limit.toString() + " trades without breaking the pagination, see https://github.com/ccxt/ccxt/issues/5698 for more details. Set exchange.options['fetchTradesWarning'] to acknowledge this warning and silence it.");
1275
- }
1270
+ if (limit !== undefined) {
1271
+ request['count'] = limit;
1276
1272
  }
1277
1273
  const response = await this.publicGetTrades(this.extend(request, params));
1278
1274
  //