ccxt 4.5.15 → 4.5.17

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.
@@ -493,6 +493,7 @@ class kucoin extends kucoin$1["default"] {
493
493
  'precisionMode': number.TICK_SIZE,
494
494
  'exceptions': {
495
495
  'exact': {
496
+ 'Order not exist or not allow to be cancelled': errors.OrderNotFound,
496
497
  'The order does not exist.': errors.OrderNotFound,
497
498
  'order not exist': errors.OrderNotFound,
498
499
  'order not exist.': errors.OrderNotFound,
@@ -931,6 +931,7 @@ class mexc extends mexc$1["default"] {
931
931
  '30029': errors.InvalidOrder,
932
932
  '30032': errors.InvalidOrder,
933
933
  '30041': errors.InvalidOrder,
934
+ '30087': errors.InvalidOrder,
934
935
  '60005': errors.ExchangeError,
935
936
  '700001': errors.AuthenticationError,
936
937
  '700002': errors.AuthenticationError,
@@ -402,12 +402,36 @@ class upbit extends upbit$1["default"] {
402
402
  'hostname': this.hostname,
403
403
  });
404
404
  url += '/private';
405
+ const client = this.client(url);
406
+ // Track private channel subscriptions to support multiple concurrent watches
407
+ const subscriptionsKey = 'upbitPrivateSubscriptions';
408
+ if (!(subscriptionsKey in client.subscriptions)) {
409
+ client.subscriptions[subscriptionsKey] = {};
410
+ }
411
+ let channelKey = channel;
412
+ if (symbol !== undefined) {
413
+ channelKey = channel + ':' + symbol;
414
+ }
415
+ const subscriptions = client.subscriptions[subscriptionsKey];
416
+ const isNewChannel = !(channelKey in subscriptions);
417
+ if (isNewChannel) {
418
+ subscriptions[channelKey] = request;
419
+ }
420
+ // Build subscription message with all requested private channels
421
+ // Format: [{'ticket': uuid}, {'type': 'myOrder'}, {'type': 'myAsset'}, ...]
422
+ const requests = [];
423
+ const channelKeys = Object.keys(subscriptions);
424
+ for (let i = 0; i < channelKeys.length; i++) {
425
+ requests.push(subscriptions[channelKeys[i]]);
426
+ }
405
427
  const message = [
406
428
  {
407
429
  'ticket': this.uuid(),
408
430
  },
409
- request,
410
431
  ];
432
+ for (let i = 0; i < requests.length; i++) {
433
+ message.push(requests[i]);
434
+ }
411
435
  return await this.watch(url, messageHash, message, messageHash);
412
436
  }
413
437
  /**
@@ -211,9 +211,7 @@ class woo extends woo$1["default"] {
211
211
  'post': {
212
212
  'order': 1,
213
213
  'order/cancel_all_after': 1,
214
- 'asset/main_sub_transfer': 30,
215
214
  'asset/ltv': 30,
216
- 'asset/withdraw': 30,
217
215
  'asset/internal_withdraw': 30,
218
216
  'interest/repay': 60,
219
217
  'client/account_mode': 120,
@@ -287,7 +285,6 @@ class woo extends woo$1["default"] {
287
285
  'spotMargin/maxMargin': 60,
288
286
  'algo/order/{oid}': 1,
289
287
  'algo/orders': 1,
290
- 'balances': 1,
291
288
  'positions': 3.33,
292
289
  'buypower': 1,
293
290
  'convert/exchangeInfo': 1,
@@ -2422,7 +2419,7 @@ class woo extends woo$1["default"] {
2422
2419
  */
2423
2420
  async fetchBalance(params = {}) {
2424
2421
  await this.loadMarkets();
2425
- const response = await this.v3PrivateGetBalances(params);
2422
+ const response = await this.v3PrivateGetAssetBalances(params);
2426
2423
  //
2427
2424
  // {
2428
2425
  // "success": true,
@@ -2752,14 +2749,14 @@ class woo extends woo$1["default"] {
2752
2749
  const networkizedCode = this.safeString(transaction, 'token');
2753
2750
  const currencyDefined = this.getCurrencyFromChaincode(networkizedCode, currency);
2754
2751
  const code = currencyDefined['code'];
2755
- let movementDirection = this.safeStringLower2(transaction, 'token_side', 'tokenSide');
2752
+ let movementDirection = this.safeStringLowerN(transaction, ['token_side', 'tokenSide', 'type']);
2756
2753
  if (movementDirection === 'withdraw') {
2757
2754
  movementDirection = 'withdrawal';
2758
2755
  }
2759
2756
  const fee = this.parseTokenAndFeeTemp(transaction, ['fee_token', 'feeToken'], ['fee_amount', 'feeAmount']);
2760
- const addressTo = this.safeString2(transaction, 'target_address', 'targetAddress');
2757
+ const addressTo = this.safeStringN(transaction, ['target_address', 'targetAddress', 'addressTo']);
2761
2758
  const addressFrom = this.safeString2(transaction, 'source_address', 'sourceAddress');
2762
- const timestamp = this.safeTimestamp2(transaction, 'created_time', 'createdTime');
2759
+ const timestamp = this.safeTimestampN(transaction, ['created_time', 'createdTime'], this.safeInteger(transaction, 'timestamp'));
2763
2760
  return {
2764
2761
  'info': transaction,
2765
2762
  'id': this.safeStringN(transaction, ['id', 'withdraw_id', 'withdrawId']),
@@ -2769,7 +2766,7 @@ class woo extends woo$1["default"] {
2769
2766
  'address': undefined,
2770
2767
  'addressFrom': addressFrom,
2771
2768
  'addressTo': addressTo,
2772
- 'tag': this.safeString(transaction, 'extra'),
2769
+ 'tag': this.safeString2(transaction, 'extra', 'tag'),
2773
2770
  'tagFrom': undefined,
2774
2771
  'tagTo': undefined,
2775
2772
  'type': movementDirection,
@@ -2780,7 +2777,7 @@ class woo extends woo$1["default"] {
2780
2777
  'comment': undefined,
2781
2778
  'internal': undefined,
2782
2779
  'fee': fee,
2783
- 'network': undefined,
2780
+ 'network': this.networkIdToCode(this.safeString(transaction, 'network')),
2784
2781
  };
2785
2782
  }
2786
2783
  parseTransactionStatus(status) {
@@ -2811,17 +2808,25 @@ class woo extends woo$1["default"] {
2811
2808
  const request = {
2812
2809
  'token': currency['id'],
2813
2810
  'amount': this.parseToNumeric(amount),
2814
- 'from_application_id': fromAccount,
2815
- 'to_application_id': toAccount,
2811
+ 'from': {
2812
+ 'applicationId': fromAccount,
2813
+ },
2814
+ 'to': {
2815
+ 'applicationId': toAccount,
2816
+ },
2816
2817
  };
2817
- const response = await this.v1PrivatePostAssetMainSubTransfer(this.extend(request, params));
2818
+ const response = await this.v3PrivatePostAssetTransfer(this.extend(request, params));
2818
2819
  //
2819
2820
  // {
2820
2821
  // "success": true,
2821
2822
  // "id": 200
2822
2823
  // }
2823
2824
  //
2824
- const transfer = this.parseTransfer(response, currency);
2825
+ const data = this.safeDict(response, 'data', {});
2826
+ data['timestamp'] = this.safeInteger(response, 'timestamp');
2827
+ data['token'] = currency['id'];
2828
+ data['status'] = 'ok';
2829
+ const transfer = this.parseTransfer(data, currency);
2825
2830
  const transferOptions = this.safeDict(this.options, 'transfer', {});
2826
2831
  const fillResponseFromRequest = this.safeBool(transferOptions, 'fillResponseFromRequest', true);
2827
2832
  if (fillResponseFromRequest) {
@@ -2935,7 +2940,7 @@ class woo extends woo$1["default"] {
2935
2940
  // }
2936
2941
  //
2937
2942
  const code = this.safeCurrencyCode(this.safeString(transfer, 'token'), currency);
2938
- const timestamp = this.safeTimestamp(transfer, 'createdTime');
2943
+ const timestamp = this.safeTimestamp2(transfer, 'createdTime', 'timestamp');
2939
2944
  const success = this.safeBool(transfer, 'success');
2940
2945
  let status = undefined;
2941
2946
  if (success !== undefined) {
@@ -2969,7 +2974,7 @@ class woo extends woo$1["default"] {
2969
2974
  * @method
2970
2975
  * @name woo#withdraw
2971
2976
  * @description make a withdrawal
2972
- * @see https://docs.woox.io/#token-withdraw
2977
+ * @see https://docs.woox.io/#token-withdraw-v3
2973
2978
  * @param {string} code unified currency code
2974
2979
  * @param {float} amount the amount to withdraw
2975
2980
  * @param {string} address the address to withdraw to
@@ -2989,17 +2994,33 @@ class woo extends woo$1["default"] {
2989
2994
  if (tag !== undefined) {
2990
2995
  request['extra'] = tag;
2991
2996
  }
2992
- let specialNetworkId = undefined;
2993
- [specialNetworkId, params] = this.getDedicatedNetworkId(currency, params);
2994
- request['token'] = specialNetworkId;
2995
- const response = await this.v1PrivatePostAssetWithdraw(this.extend(request, params));
2997
+ const network = this.safeString(params, 'network');
2998
+ if (network === undefined) {
2999
+ throw new errors.ArgumentsRequired(this.id + ' withdraw() requires a network parameter for ' + code);
3000
+ }
3001
+ params = this.omit(params, 'network');
3002
+ request['token'] = currency['id'];
3003
+ request['network'] = this.networkCodeToId(network);
3004
+ const response = await this.v3PrivatePostAssetWalletWithdraw(this.extend(request, params));
2996
3005
  //
2997
3006
  // {
2998
3007
  // "success": true,
2999
3008
  // "withdraw_id": "20200119145703654"
3000
3009
  // }
3001
3010
  //
3002
- return this.parseTransaction(response, currency);
3011
+ const data = this.safeDict(response, 'data', {});
3012
+ const transactionData = this.extend(data, {
3013
+ 'id': this.safeString(data, 'withdrawId'),
3014
+ 'timestamp': this.safeInteger(response, 'timestamp'),
3015
+ 'currency': code,
3016
+ 'amount': amount,
3017
+ 'addressTo': address,
3018
+ 'tag': tag,
3019
+ 'network': network,
3020
+ 'type': 'withdrawal',
3021
+ 'status': 'pending',
3022
+ });
3023
+ return this.parseTransaction(transactionData, currency);
3003
3024
  }
3004
3025
  /**
3005
3026
  * @method
package/js/ccxt.d.ts CHANGED
@@ -4,7 +4,7 @@ import * as functions from './src/base/functions.js';
4
4
  import * as errors from './src/base/errors.js';
5
5
  import type { Int, int, Str, Strings, Num, Bool, IndexType, OrderSide, OrderType, MarketType, SubType, Dict, NullableDict, List, NullableList, Fee, OHLCV, OHLCVC, implicitReturnType, Market, Currency, Dictionary, MinMax, FeeInterface, TradingFeeInterface, MarketInterface, Trade, Order, OrderBook, Ticker, Transaction, Tickers, CurrencyInterface, Balance, BalanceAccount, Account, PartialBalances, Balances, DepositAddress, WithdrawalResponse, FundingRate, FundingRates, Position, BorrowInterest, LeverageTier, LedgerEntry, DepositWithdrawFeeNetwork, DepositWithdrawFee, TransferEntry, CrossBorrowRate, IsolatedBorrowRate, FundingRateHistory, OpenInterest, Liquidation, OrderRequest, CancellationRequest, FundingHistory, MarketMarginModes, MarginMode, Greeks, Conversion, Option, LastPrice, Leverage, MarginModification, Leverages, LastPrices, Currencies, TradingFees, MarginModes, OptionChain, IsolatedBorrowRates, CrossBorrowRates, LeverageTiers, LongShortRatio, OrderBooks, OpenInterests, ConstructorArgs } from './src/base/types.js';
6
6
  import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, RestrictedLocation, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError } from './src/base/errors.js';
7
- declare const version = "4.5.14";
7
+ declare const version = "4.5.16";
8
8
  import alpaca from './src/alpaca.js';
9
9
  import apex from './src/apex.js';
10
10
  import arkham from './src/arkham.js';
package/js/ccxt.js CHANGED
@@ -38,7 +38,7 @@ import * as errors from './src/base/errors.js';
38
38
  import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, RestrictedLocation, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError } from './src/base/errors.js';
39
39
  //-----------------------------------------------------------------------------
40
40
  // this is updated by vss.js when building
41
- const version = '4.5.14';
41
+ const version = '4.5.16';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import alpaca from './src/alpaca.js';
@@ -282,6 +282,7 @@ interface Exchange {
282
282
  privatePostV5AccountMmpReset(params?: {}): Promise<implicitReturnType>;
283
283
  privatePostV5AccountBorrow(params?: {}): Promise<implicitReturnType>;
284
284
  privatePostV5AccountRepay(params?: {}): Promise<implicitReturnType>;
285
+ privatePostV5AccountNoConvertRepay(params?: {}): Promise<implicitReturnType>;
285
286
  privatePostV5AssetExchangeQuoteApply(params?: {}): Promise<implicitReturnType>;
286
287
  privatePostV5AssetExchangeConvertExecute(params?: {}): Promise<implicitReturnType>;
287
288
  privatePostV5AssetTransferInterTransfer(params?: {}): Promise<implicitReturnType>;
@@ -14,6 +14,8 @@ interface Exchange {
14
14
  publicGetHistorySparklines(params?: {}): Promise<implicitReturnType>;
15
15
  publicGetSettings(params?: {}): Promise<implicitReturnType>;
16
16
  privateGetOrders(params?: {}): Promise<implicitReturnType>;
17
+ privateGetOrdersOrderId(params?: {}): Promise<implicitReturnType>;
18
+ privateGetOrdersClientOrderIdClientOid(params?: {}): Promise<implicitReturnType>;
17
19
  privateGetProductsProductIdOrdersLeverage(params?: {}): Promise<implicitReturnType>;
18
20
  privateGetPositionsMargined(params?: {}): Promise<implicitReturnType>;
19
21
  privateGetPositions(params?: {}): Promise<implicitReturnType>;
@@ -27,8 +29,8 @@ interface Exchange {
27
29
  privateGetUsersTradingPreferences(params?: {}): Promise<implicitReturnType>;
28
30
  privateGetSubAccounts(params?: {}): Promise<implicitReturnType>;
29
31
  privateGetProfile(params?: {}): Promise<implicitReturnType>;
32
+ privateGetHeartbeat(params?: {}): Promise<implicitReturnType>;
30
33
  privateGetDepositsAddress(params?: {}): Promise<implicitReturnType>;
31
- privateGetOrdersLeverage(params?: {}): Promise<implicitReturnType>;
32
34
  privatePostOrders(params?: {}): Promise<implicitReturnType>;
33
35
  privatePostOrdersBracket(params?: {}): Promise<implicitReturnType>;
34
36
  privatePostOrdersBatch(params?: {}): Promise<implicitReturnType>;
@@ -36,6 +38,8 @@ interface Exchange {
36
38
  privatePostPositionsChangeMargin(params?: {}): Promise<implicitReturnType>;
37
39
  privatePostPositionsCloseAll(params?: {}): Promise<implicitReturnType>;
38
40
  privatePostWalletsSubAccountBalanceTransfer(params?: {}): Promise<implicitReturnType>;
41
+ privatePostHeartbeatCreate(params?: {}): Promise<implicitReturnType>;
42
+ privatePostHeartbeat(params?: {}): Promise<implicitReturnType>;
39
43
  privatePostOrdersCancelAfter(params?: {}): Promise<implicitReturnType>;
40
44
  privatePostOrdersLeverage(params?: {}): Promise<implicitReturnType>;
41
45
  privatePutOrders(params?: {}): Promise<implicitReturnType>;
@@ -44,9 +44,7 @@ interface Exchange {
44
44
  v1PrivateGetClientFuturesLeverage(params?: {}): Promise<implicitReturnType>;
45
45
  v1PrivatePostOrder(params?: {}): Promise<implicitReturnType>;
46
46
  v1PrivatePostOrderCancelAllAfter(params?: {}): Promise<implicitReturnType>;
47
- v1PrivatePostAssetMainSubTransfer(params?: {}): Promise<implicitReturnType>;
48
47
  v1PrivatePostAssetLtv(params?: {}): Promise<implicitReturnType>;
49
- v1PrivatePostAssetWithdraw(params?: {}): Promise<implicitReturnType>;
50
48
  v1PrivatePostAssetInternalWithdraw(params?: {}): Promise<implicitReturnType>;
51
49
  v1PrivatePostInterestRepay(params?: {}): Promise<implicitReturnType>;
52
50
  v1PrivatePostClientAccountMode(params?: {}): Promise<implicitReturnType>;
@@ -102,7 +100,6 @@ interface Exchange {
102
100
  v3PrivateGetSpotMarginMaxMargin(params?: {}): Promise<implicitReturnType>;
103
101
  v3PrivateGetAlgoOrderOid(params?: {}): Promise<implicitReturnType>;
104
102
  v3PrivateGetAlgoOrders(params?: {}): Promise<implicitReturnType>;
105
- v3PrivateGetBalances(params?: {}): Promise<implicitReturnType>;
106
103
  v3PrivateGetPositions(params?: {}): Promise<implicitReturnType>;
107
104
  v3PrivateGetBuypower(params?: {}): Promise<implicitReturnType>;
108
105
  v3PrivateGetConvertExchangeInfo(params?: {}): Promise<implicitReturnType>;
package/js/src/arkham.js CHANGED
@@ -31,23 +31,40 @@ export default class arkham extends Exchange {
31
31
  'swap': true,
32
32
  'future': false,
33
33
  'option': false,
34
+ 'borrowCrossMargin': false,
35
+ 'borrowIsolatedMargin': false,
36
+ 'borrowMargin': false,
34
37
  'cancelAllOrders': true,
35
38
  'cancelOrder': true,
36
39
  'createDepositAddress': true,
37
40
  'createOrder': true,
38
41
  'fetchAccounts': true,
42
+ 'fetchAllGreeks': false,
39
43
  'fetchBalance': true,
44
+ 'fetchBorrowInterest': false,
45
+ 'fetchBorrowRate': false,
46
+ 'fetchBorrowRateHistories': false,
47
+ 'fetchBorrowRateHistory': false,
48
+ 'fetchBorrowRates': false,
49
+ 'fetchBorrowRatesPerSymbol': false,
40
50
  'fetchClosedOrders': true,
51
+ 'fetchCrossBorrowRate': false,
52
+ 'fetchCrossBorrowRates': false,
41
53
  'fetchCurrencies': true,
42
54
  'fetchDepositAddress': false,
43
55
  'fetchDepositAddressesByNetwork': true,
44
56
  'fetchDeposits': true,
45
57
  'fetchFundingHistory': true,
58
+ 'fetchGreeks': false,
59
+ 'fetchIsolatedBorrowRate': false,
60
+ 'fetchIsolatedBorrowRates': false,
46
61
  'fetchLeverage': true,
47
62
  'fetchLeverageTiers': true,
48
63
  'fetchMyTrades': true,
49
64
  'fetchOHLCV': true,
50
65
  'fetchOpenOrders': true,
66
+ 'fetchOption': false,
67
+ 'fetchOptionChain': false,
51
68
  'fetchOrder': true,
52
69
  'fetchOrderBook': true,
53
70
  'fetchPositions': true,
@@ -56,7 +73,10 @@ export default class arkham extends Exchange {
56
73
  'fetchTime': true,
57
74
  'fetchTrades': true,
58
75
  'fetchTradingFees': true,
76
+ 'fetchVolatilityHistory': false,
59
77
  'fetchWithdrawals': true,
78
+ 'repayCrossMargin': false,
79
+ 'repayIsolatedMargin': false,
60
80
  'sandbox': false,
61
81
  'setLeverage': true,
62
82
  'withdraw': true,
@@ -677,6 +677,7 @@ export default class Exchange {
677
677
  editLimitSellOrder(id: string, symbol: string, amount: number, price?: Num, params?: {}): Promise<Order>;
678
678
  editLimitOrder(id: string, symbol: string, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
679
679
  editOrder(id: string, symbol: string, type: OrderType, side: OrderSide, amount?: Num, price?: Num, params?: {}): Promise<Order>;
680
+ editOrderWithClientOrderId(clientOrderId: string, symbol: string, type: OrderType, side: OrderSide, amount?: Num, price?: Num, params?: {}): Promise<Order>;
680
681
  editOrderWs(id: string, symbol: string, type: OrderType, side: OrderSide, amount?: Num, price?: Num, params?: {}): Promise<Order>;
681
682
  fetchPosition(symbol: string, params?: {}): Promise<Position>;
682
683
  fetchPositionWs(symbol: string, params?: {}): Promise<Position[]>;
@@ -737,6 +738,16 @@ export default class Exchange {
737
738
  watchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
738
739
  unWatchTickers(symbols?: Strings, params?: {}): Promise<any>;
739
740
  fetchOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
741
+ /**
742
+ * @method
743
+ * @name fetchOrderWithClientOrderId
744
+ * @description create a market order by providing the symbol, side and cost
745
+ * @param {string} clientOrderId client order Id
746
+ * @param {string} symbol unified symbol of the market to create an order in
747
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
748
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
749
+ */
750
+ fetchOrderWithClientOrderId(clientOrderId: string, symbol?: Str, params?: {}): Promise<Order>;
740
751
  fetchOrderWs(id: string, symbol?: Str, params?: {}): Promise<Order>;
741
752
  fetchOrderStatus(id: string, symbol?: Str, params?: {}): Promise<string>;
742
753
  fetchUnifiedOrder(order: any, params?: {}): Promise<Order>;
@@ -766,8 +777,28 @@ export default class Exchange {
766
777
  editOrders(orders: OrderRequest[], params?: {}): Promise<Order[]>;
767
778
  createOrderWs(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
768
779
  cancelOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
780
+ /**
781
+ * @method
782
+ * @name cancelOrderWithClientOrderId
783
+ * @description create a market order by providing the symbol, side and cost
784
+ * @param {string} clientOrderId client order Id
785
+ * @param {string} symbol unified symbol of the market to create an order in
786
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
787
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
788
+ */
789
+ cancelOrderWithClientOrderId(clientOrderId: string, symbol?: Str, params?: {}): Promise<Order>;
769
790
  cancelOrderWs(id: string, symbol?: Str, params?: {}): Promise<Order>;
770
791
  cancelOrders(ids: string[], symbol?: Str, params?: {}): Promise<Order[]>;
792
+ /**
793
+ * @method
794
+ * @name cancelOrdersWithClientOrderIds
795
+ * @description create a market order by providing the symbol, side and cost
796
+ * @param {string[]} clientOrderIds client order Ids
797
+ * @param {string} symbol unified symbol of the market to create an order in
798
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
799
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
800
+ */
801
+ cancelOrdersWithClientOrderIds(clientOrderIds: string[], symbol?: Str, params?: {}): Promise<Order[]>;
771
802
  cancelOrdersWs(ids: string[], symbol?: Str, params?: {}): Promise<Order[]>;
772
803
  cancelAllOrders(symbol?: Str, params?: {}): Promise<Order[]>;
773
804
  cancelAllOrdersAfter(timeout: Int, params?: {}): Promise<{}>;
@@ -20,7 +20,7 @@ import { OrderBook as WsOrderBook, IndexedOrderBook, CountedOrderBook } from './
20
20
  // ----------------------------------------------------------------------------
21
21
  //
22
22
  import { axolotl } from './functions/crypto.js';
23
- import totp from './functions/totp.js';
23
+ import { totp } from './functions/totp.js';
24
24
  import ethers from '../static_dependencies/ethers/index.js';
25
25
  import { TypedDataEncoder } from '../static_dependencies/ethers/hash/index.js';
26
26
  import { SecureRandom } from '../static_dependencies/jsencrypt/lib/jsbn/rng.js';
@@ -1440,8 +1440,10 @@ export default class Exchange {
1440
1440
  'cancelAllOrders': undefined,
1441
1441
  'cancelAllOrdersWs': undefined,
1442
1442
  'cancelOrder': true,
1443
+ 'cancelOrderWithClientOrderId': undefined,
1443
1444
  'cancelOrderWs': undefined,
1444
1445
  'cancelOrders': undefined,
1446
+ 'cancelOrdersWithClientOrderId': undefined,
1445
1447
  'cancelOrdersWs': undefined,
1446
1448
  'closeAllPositions': undefined,
1447
1449
  'closePosition': undefined,
@@ -1491,6 +1493,7 @@ export default class Exchange {
1491
1493
  'createTriggerOrderWs': undefined,
1492
1494
  'deposit': undefined,
1493
1495
  'editOrder': 'emulated',
1496
+ 'editOrderWithClientOrderId': undefined,
1494
1497
  'editOrders': undefined,
1495
1498
  'editOrderWs': undefined,
1496
1499
  'fetchAccounts': undefined,
@@ -1569,6 +1572,7 @@ export default class Exchange {
1569
1572
  'fetchOption': undefined,
1570
1573
  'fetchOptionChain': undefined,
1571
1574
  'fetchOrder': undefined,
1575
+ 'fetchOrderWithClientOrderId': undefined,
1572
1576
  'fetchOrderBook': true,
1573
1577
  'fetchOrderBooks': undefined,
1574
1578
  'fetchOrderBookWs': undefined,
@@ -4752,6 +4756,9 @@ export default class Exchange {
4752
4756
  await this.cancelOrder(id, symbol);
4753
4757
  return await this.createOrder(symbol, type, side, amount, price, params);
4754
4758
  }
4759
+ async editOrderWithClientOrderId(clientOrderId, symbol, type, side, amount = undefined, price = undefined, params = {}) {
4760
+ return await this.editOrder('', symbol, type, side, amount, price, this.extend({ 'clientOrderId': clientOrderId }, params));
4761
+ }
4755
4762
  async editOrderWs(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
4756
4763
  await this.cancelOrderWs(id, symbol);
4757
4764
  return await this.createOrderWs(symbol, type, side, amount, price, params);
@@ -5242,6 +5249,19 @@ export default class Exchange {
5242
5249
  async fetchOrder(id, symbol = undefined, params = {}) {
5243
5250
  throw new NotSupported(this.id + ' fetchOrder() is not supported yet');
5244
5251
  }
5252
+ /**
5253
+ * @method
5254
+ * @name fetchOrderWithClientOrderId
5255
+ * @description create a market order by providing the symbol, side and cost
5256
+ * @param {string} clientOrderId client order Id
5257
+ * @param {string} symbol unified symbol of the market to create an order in
5258
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
5259
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
5260
+ */
5261
+ async fetchOrderWithClientOrderId(clientOrderId, symbol = undefined, params = {}) {
5262
+ const extendedParams = this.extend(params, { 'clientOrderId': clientOrderId });
5263
+ return await this.fetchOrder('', symbol, extendedParams);
5264
+ }
5245
5265
  async fetchOrderWs(id, symbol = undefined, params = {}) {
5246
5266
  throw new NotSupported(this.id + ' fetchOrderWs() is not supported yet');
5247
5267
  }
@@ -5696,12 +5716,38 @@ export default class Exchange {
5696
5716
  async cancelOrder(id, symbol = undefined, params = {}) {
5697
5717
  throw new NotSupported(this.id + ' cancelOrder() is not supported yet');
5698
5718
  }
5719
+ /**
5720
+ * @method
5721
+ * @name cancelOrderWithClientOrderId
5722
+ * @description create a market order by providing the symbol, side and cost
5723
+ * @param {string} clientOrderId client order Id
5724
+ * @param {string} symbol unified symbol of the market to create an order in
5725
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
5726
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
5727
+ */
5728
+ async cancelOrderWithClientOrderId(clientOrderId, symbol = undefined, params = {}) {
5729
+ const extendedParams = this.extend(params, { 'clientOrderId': clientOrderId });
5730
+ return await this.cancelOrder('', symbol, extendedParams);
5731
+ }
5699
5732
  async cancelOrderWs(id, symbol = undefined, params = {}) {
5700
5733
  throw new NotSupported(this.id + ' cancelOrderWs() is not supported yet');
5701
5734
  }
5702
5735
  async cancelOrders(ids, symbol = undefined, params = {}) {
5703
5736
  throw new NotSupported(this.id + ' cancelOrders() is not supported yet');
5704
5737
  }
5738
+ /**
5739
+ * @method
5740
+ * @name cancelOrdersWithClientOrderIds
5741
+ * @description create a market order by providing the symbol, side and cost
5742
+ * @param {string[]} clientOrderIds client order Ids
5743
+ * @param {string} symbol unified symbol of the market to create an order in
5744
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
5745
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
5746
+ */
5747
+ async cancelOrdersWithClientOrderIds(clientOrderIds, symbol = undefined, params = {}) {
5748
+ const extendedParams = this.extend(params, { 'clientOrderIds': clientOrderIds });
5749
+ return await this.cancelOrders([], symbol, extendedParams);
5750
+ }
5705
5751
  async cancelOrdersWs(ids, symbol = undefined, params = {}) {
5706
5752
  throw new NotSupported(this.id + ' cancelOrdersWs() is not supported yet');
5707
5753
  }
package/js/src/blofin.js CHANGED
@@ -1389,18 +1389,20 @@ export default class blofin extends Exchange {
1389
1389
  [method, params] = this.handleOptionAndParams(params, 'createOrder', 'method', 'privatePostTradeOrder');
1390
1390
  const isStopLossPriceDefined = this.safeString(params, 'stopLossPrice') !== undefined;
1391
1391
  const isTakeProfitPriceDefined = this.safeString(params, 'takeProfitPrice') !== undefined;
1392
- const isTriggerOrder = this.safeString(params, 'triggerPrice') !== undefined;
1392
+ const hasTriggerPrice = this.safeString(params, 'triggerPrice') !== undefined;
1393
1393
  const isType2Order = (isStopLossPriceDefined || isTakeProfitPriceDefined);
1394
1394
  let response = undefined;
1395
1395
  const reduceOnly = this.safeBool(params, 'reduceOnly');
1396
1396
  if (reduceOnly !== undefined) {
1397
1397
  params['reduceOnly'] = reduceOnly ? 'true' : 'false';
1398
1398
  }
1399
- if (tpsl || (method === 'privatePostTradeOrderTpsl') || isType2Order) {
1399
+ const isTpslOrder = tpsl || (method === 'privatePostTradeOrderTpsl') || isType2Order;
1400
+ const isTriggerOrder = hasTriggerPrice || (method === 'privatePostTradeOrderAlgo');
1401
+ if (isTpslOrder) {
1400
1402
  const tpslRequest = this.createTpslOrderRequest(symbol, type, side, amount, price, params);
1401
1403
  response = await this.privatePostTradeOrderTpsl(tpslRequest);
1402
1404
  }
1403
- else if (isTriggerOrder || (method === 'privatePostTradeOrderAlgo')) {
1405
+ else if (isTriggerOrder) {
1404
1406
  const triggerRequest = this.createOrderRequest(symbol, type, side, amount, price, params);
1405
1407
  response = await this.privatePostTradeOrderAlgo(triggerRequest);
1406
1408
  }
@@ -1408,10 +1410,9 @@ export default class blofin extends Exchange {
1408
1410
  const request = this.createOrderRequest(symbol, type, side, amount, price, params);
1409
1411
  response = await this.privatePostTradeOrder(request);
1410
1412
  }
1411
- if (isTriggerOrder || (method === 'privatePostTradeOrderAlgo')) {
1413
+ if (isTpslOrder || isTriggerOrder) {
1412
1414
  const dataDict = this.safeDict(response, 'data', {});
1413
- const triggerOrder = this.parseOrder(dataDict, market);
1414
- return triggerOrder;
1415
+ return this.parseOrder(dataDict, market);
1415
1416
  }
1416
1417
  const data = this.safeList(response, 'data', []);
1417
1418
  const first = this.safeDict(data, 0);
package/js/src/bybit.d.ts CHANGED
@@ -232,7 +232,7 @@ export default class bybit extends Exchange {
232
232
  * @param {string} [params.positionIdx] *contracts only* 0 for one-way mode, 1 buy side of hedged mode, 2 sell side of hedged mode
233
233
  * @param {bool} [params.hedged] *contracts only* true for hedged mode, false for one way mode, default is false
234
234
  * @param {int} [params.isLeverage] *unified spot only* false then spot trading true then margin trading
235
- * @param {string} [params.tpslMode] *contract only* 'full' or 'partial'
235
+ * @param {string} [params.tpslMode] *contract only* 'Full' or 'Partial'
236
236
  * @param {string} [params.mmp] *option only* market maker protection
237
237
  * @param {string} [params.triggerDirection] *contract only* the direction for trigger orders, 'ascending' or 'descending'
238
238
  * @param {float} [params.triggerPrice] The price at which a trigger order is triggered at
package/js/src/bybit.js CHANGED
@@ -515,6 +515,7 @@ export default class bybit extends Exchange {
515
515
  'v5/account/mmp-reset': 5,
516
516
  'v5/account/borrow': 5,
517
517
  'v5/account/repay': 5,
518
+ 'v5/account/no-convert-repay': 5,
518
519
  // asset
519
520
  'v5/asset/exchange/quote-apply': 1,
520
521
  'v5/asset/exchange/convert-execute': 1,
@@ -3949,7 +3950,7 @@ export default class bybit extends Exchange {
3949
3950
  * @param {string} [params.positionIdx] *contracts only* 0 for one-way mode, 1 buy side of hedged mode, 2 sell side of hedged mode
3950
3951
  * @param {bool} [params.hedged] *contracts only* true for hedged mode, false for one way mode, default is false
3951
3952
  * @param {int} [params.isLeverage] *unified spot only* false then spot trading true then margin trading
3952
- * @param {string} [params.tpslMode] *contract only* 'full' or 'partial'
3953
+ * @param {string} [params.tpslMode] *contract only* 'Full' or 'Partial'
3953
3954
  * @param {string} [params.mmp] *option only* market maker protection
3954
3955
  * @param {string} [params.triggerDirection] *contract only* the direction for trigger orders, 'ascending' or 'descending'
3955
3956
  * @param {float} [params.triggerPrice] The price at which a trigger order is triggered at
@@ -4073,22 +4074,31 @@ export default class bybit extends Exchange {
4073
4074
  throw new InvalidOrder(this.id + ' the API endpoint used only supports contract trailingAmount, stopLossPrice and takeProfitPrice orders');
4074
4075
  }
4075
4076
  if (isStopLossTriggerOrder || isTakeProfitTriggerOrder) {
4077
+ const tpslMode = this.safeString(params, 'tpslMode', 'Partial');
4078
+ const isFullTpsl = tpslMode === 'Full';
4079
+ const isPartialTpsl = tpslMode === 'Partial';
4080
+ if (isLimit && isFullTpsl) {
4081
+ throw new InvalidOrder(this.id + ' tpsl orders with "full" tpslMode only support "market" type');
4082
+ }
4083
+ request['tpslMode'] = tpslMode;
4076
4084
  if (isStopLossTriggerOrder) {
4077
4085
  request['stopLoss'] = this.getPrice(symbol, stopLossTriggerPrice);
4086
+ if (isPartialTpsl) {
4087
+ request['slSize'] = amountString;
4088
+ }
4078
4089
  if (isLimit) {
4079
- request['tpslMode'] = 'Partial';
4080
4090
  request['slOrderType'] = 'Limit';
4081
4091
  request['slLimitPrice'] = priceString;
4082
- request['slSize'] = amountString;
4083
4092
  }
4084
4093
  }
4085
4094
  else if (isTakeProfitTriggerOrder) {
4086
4095
  request['takeProfit'] = this.getPrice(symbol, takeProfitTriggerPrice);
4096
+ if (isPartialTpsl) {
4097
+ request['tpSize'] = amountString;
4098
+ }
4087
4099
  if (isLimit) {
4088
- request['tpslMode'] = 'Partial';
4089
4100
  request['tpOrderType'] = 'Limit';
4090
4101
  request['tpLimitPrice'] = priceString;
4091
- request['tpSize'] = amountString;
4092
4102
  }
4093
4103
  }
4094
4104
  }
@@ -4274,7 +4284,7 @@ export default class bybit extends Exchange {
4274
4284
  }
4275
4285
  request['positionIdx'] = (side === 'buy') ? 1 : 2;
4276
4286
  }
4277
- params = this.omit(params, ['stopPrice', 'timeInForce', 'stopLossPrice', 'takeProfitPrice', 'postOnly', 'clientOrderId', 'triggerPrice', 'stopLoss', 'takeProfit', 'trailingAmount', 'trailingTriggerPrice', 'hedged']);
4287
+ params = this.omit(params, ['stopPrice', 'timeInForce', 'stopLossPrice', 'takeProfitPrice', 'postOnly', 'clientOrderId', 'triggerPrice', 'stopLoss', 'takeProfit', 'trailingAmount', 'trailingTriggerPrice', 'hedged', 'tpslMode']);
4278
4288
  return this.extend(request, params);
4279
4289
  }
4280
4290
  /**
package/js/src/delta.d.ts CHANGED
@@ -194,6 +194,19 @@ export default class delta extends Exchange {
194
194
  * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
195
195
  */
196
196
  cancelAllOrders(symbol?: Str, params?: {}): Promise<Order[]>;
197
+ /**
198
+ * @method
199
+ * @name delta#fetchOrder
200
+ * @description fetches information on an order made by the user
201
+ * @see https://docs.delta.exchange/#get-order-by-id
202
+ * @see https://docs.delta.exchange/#get-order-by-client-oid
203
+ * @param {string} id the order id
204
+ * @param {string} [symbol] unified symbol of the market the order was made in
205
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
206
+ * @param {string} [params.clientOrderId] client order id of the order
207
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
208
+ */
209
+ fetchOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
197
210
  /**
198
211
  * @method
199
212
  * @name delta#fetchOpenOrders