ccxt 4.4.75 → 4.4.78

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 (114) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.min.js +7 -7
  3. package/dist/cjs/ccxt.js +8 -4
  4. package/dist/cjs/src/abstract/apex.js +9 -0
  5. package/dist/cjs/src/apex.js +1949 -0
  6. package/dist/cjs/src/base/Exchange.js +49 -3
  7. package/dist/cjs/src/binance.js +44 -220
  8. package/dist/cjs/src/bitget.js +139 -71
  9. package/dist/cjs/src/bitmex.js +4 -4
  10. package/dist/cjs/src/bitrue.js +48 -0
  11. package/dist/cjs/src/cex.js +1 -1
  12. package/dist/cjs/src/coinbase.js +32 -3
  13. package/dist/cjs/src/coincatch.js +68 -0
  14. package/dist/cjs/src/coinex.js +3 -0
  15. package/dist/cjs/src/coinlist.js +85 -1
  16. package/dist/cjs/src/hitbtc.js +3 -0
  17. package/dist/cjs/src/hyperliquid.js +13 -4
  18. package/dist/cjs/src/mexc.js +50 -57
  19. package/dist/cjs/src/okx.js +23 -8
  20. package/dist/cjs/src/paradex.js +3 -12
  21. package/dist/cjs/src/phemex.js +2 -1
  22. package/dist/cjs/src/poloniex.js +1 -1
  23. package/dist/cjs/src/pro/apex.js +1043 -0
  24. package/dist/cjs/src/pro/coinbase.js +4 -8
  25. package/dist/cjs/src/pro/gate.js +27 -2
  26. package/dist/cjs/src/pro/hollaex.js +2 -2
  27. package/dist/cjs/src/pro/hyperliquid.js +1 -1
  28. package/dist/cjs/src/pro/p2b.js +2 -2
  29. package/dist/cjs/src/pro/tradeogre.js +283 -0
  30. package/dist/cjs/src/probit.js +1 -0
  31. package/dist/cjs/src/static_dependencies/zklink/zklink-sdk-web.js +2645 -0
  32. package/dist/cjs/src/tradeogre.js +2 -1
  33. package/dist/cjs/src/upbit.js +299 -93
  34. package/dist/cjs/src/whitebit.js +1 -0
  35. package/dist/cjs/src/woo.js +3 -1
  36. package/dist/cjs/src/xt.js +131 -4
  37. package/js/ccxt.d.ts +11 -5
  38. package/js/ccxt.js +8 -4
  39. package/js/src/abstract/apex.d.ts +34 -0
  40. package/js/src/abstract/myokx.d.ts +4 -0
  41. package/js/src/abstract/okx.d.ts +4 -0
  42. package/js/src/abstract/upbit.d.ts +15 -1
  43. package/js/src/abstract/xt.d.ts +3 -0
  44. package/js/src/apex.d.ts +333 -0
  45. package/js/src/apex.js +1951 -0
  46. package/js/src/ascendex.d.ts +3 -3
  47. package/js/src/base/Exchange.d.ts +3 -0
  48. package/js/src/base/Exchange.js +49 -2
  49. package/js/src/binance.d.ts +9 -7
  50. package/js/src/binance.js +44 -220
  51. package/js/src/bitfinex.d.ts +3 -3
  52. package/js/src/bitflyer.d.ts +2 -2
  53. package/js/src/bitget.d.ts +2 -0
  54. package/js/src/bitget.js +139 -71
  55. package/js/src/bitmart.d.ts +4 -4
  56. package/js/src/bitmex.d.ts +3 -3
  57. package/js/src/bitmex.js +4 -4
  58. package/js/src/bitrue.js +48 -0
  59. package/js/src/cex.js +1 -1
  60. package/js/src/coinbase.d.ts +6 -4
  61. package/js/src/coinbase.js +32 -3
  62. package/js/src/coinbaseexchange.d.ts +1 -1
  63. package/js/src/coincatch.d.ts +11 -0
  64. package/js/src/coincatch.js +68 -0
  65. package/js/src/coinex.js +3 -0
  66. package/js/src/coinlist.d.ts +12 -1
  67. package/js/src/coinlist.js +85 -1
  68. package/js/src/cryptocom.d.ts +4 -4
  69. package/js/src/deribit.d.ts +4 -4
  70. package/js/src/derive.d.ts +3 -3
  71. package/js/src/digifinex.d.ts +4 -4
  72. package/js/src/hitbtc.js +3 -0
  73. package/js/src/htx.d.ts +4 -4
  74. package/js/src/hyperliquid.d.ts +1 -0
  75. package/js/src/hyperliquid.js +13 -4
  76. package/js/src/kraken.d.ts +3 -3
  77. package/js/src/krakenfutures.d.ts +2 -2
  78. package/js/src/kucoinfutures.d.ts +5 -5
  79. package/js/src/mexc.d.ts +1 -0
  80. package/js/src/mexc.js +50 -57
  81. package/js/src/okx.js +23 -8
  82. package/js/src/oxfun.d.ts +3 -3
  83. package/js/src/paradex.js +3 -12
  84. package/js/src/phemex.d.ts +3 -3
  85. package/js/src/phemex.js +2 -1
  86. package/js/src/poloniex.d.ts +3 -3
  87. package/js/src/poloniex.js +1 -1
  88. package/js/src/pro/apex.d.ts +160 -0
  89. package/js/src/pro/apex.js +1044 -0
  90. package/js/src/pro/coinbase.js +4 -8
  91. package/js/src/pro/gate.js +27 -2
  92. package/js/src/pro/hollaex.js +2 -2
  93. package/js/src/pro/hyperliquid.js +1 -1
  94. package/js/src/pro/p2b.js +2 -2
  95. package/js/src/pro/tradeogre.d.ts +49 -0
  96. package/js/src/pro/tradeogre.js +284 -0
  97. package/js/src/probit.js +1 -0
  98. package/js/src/static_dependencies/zklink/zklink-sdk-web.d.ts +1279 -0
  99. package/js/src/static_dependencies/zklink/zklink-sdk-web.js +4282 -0
  100. package/js/src/tradeogre.js +2 -1
  101. package/js/src/upbit.d.ts +34 -4
  102. package/js/src/upbit.js +299 -93
  103. package/js/src/vertex.d.ts +3 -3
  104. package/js/src/whitebit.js +1 -0
  105. package/js/src/woo.d.ts +4 -4
  106. package/js/src/woo.js +3 -1
  107. package/js/src/woofipro.d.ts +4 -4
  108. package/js/src/xt.d.ts +23 -4
  109. package/js/src/xt.js +131 -4
  110. package/package.json +2 -2
  111. package/js/src/abstract/ace.d.ts +0 -18
  112. package/js/src/ace.d.ts +0 -158
  113. package/js/src/ace.js +0 -1181
  114. /package/js/src/abstract/{ace.js → apex.js} +0 -0
@@ -18,7 +18,7 @@ class tradeogre extends tradeogre$1 {
18
18
  'countries': [],
19
19
  'rateLimit': 100,
20
20
  'version': 'v2',
21
- 'pro': false,
21
+ 'pro': true,
22
22
  'has': {
23
23
  'CORS': undefined,
24
24
  'spot': true,
@@ -529,6 +529,7 @@ class tradeogre extends tradeogre$1 {
529
529
  'asks': rawAsks,
530
530
  };
531
531
  const orderbook = this.parseOrderBook(rawOrderbook, symbol);
532
+ orderbook['nonce'] = this.safeInteger(response, 's');
532
533
  return orderbook;
533
534
  }
534
535
  parseBidsAsks(bidasks, priceKey = 0, amountKey = 1, countOrIdKey = 2) {
@@ -21,7 +21,7 @@ class upbit extends upbit$1 {
21
21
  'name': 'Upbit',
22
22
  'countries': ['KR'],
23
23
  'version': 'v1',
24
- 'rateLimit': 1000,
24
+ 'rateLimit': 50,
25
25
  'pro': true,
26
26
  // new metainfo interface
27
27
  'has': {
@@ -38,6 +38,7 @@ class upbit extends upbit$1 {
38
38
  'createMarketOrderWithCost': false,
39
39
  'createMarketSellOrderWithCost': false,
40
40
  'createOrder': true,
41
+ 'editOrder': true,
41
42
  'fetchBalance': true,
42
43
  'fetchCanceledOrders': true,
43
44
  'fetchClosedOrders': true,
@@ -68,7 +69,7 @@ class upbit extends upbit$1 {
68
69
  'fetchTickers': true,
69
70
  'fetchTrades': true,
70
71
  'fetchTradingFee': true,
71
- 'fetchTradingFees': false,
72
+ 'fetchTradingFees': true,
72
73
  'fetchTransactions': false,
73
74
  'fetchWithdrawal': true,
74
75
  'fetchWithdrawals': true,
@@ -76,6 +77,7 @@ class upbit extends upbit$1 {
76
77
  'withdraw': true,
77
78
  },
78
79
  'timeframes': {
80
+ '1s': 'seconds',
79
81
  '1m': 'minutes',
80
82
  '3m': 'minutes',
81
83
  '5m': 'minutes',
@@ -87,6 +89,7 @@ class upbit extends upbit$1 {
87
89
  '1d': 'days',
88
90
  '1w': 'weeks',
89
91
  '1M': 'months',
92
+ '1y': 'years',
90
93
  },
91
94
  'hostname': 'api.upbit.com',
92
95
  'urls': {
@@ -100,54 +103,70 @@ class upbit extends upbit$1 {
100
103
  'fees': 'https://upbit.com/service_center/guide',
101
104
  },
102
105
  'api': {
106
+ // 'endpoint','API Cost'
107
+ // cost = 1000 / (rateLimit * RPS)
103
108
  'public': {
104
- 'get': [
105
- 'market/all',
106
- 'candles/{timeframe}',
107
- 'candles/{timeframe}/{unit}',
108
- 'candles/minutes/{unit}',
109
- 'candles/minutes/1',
110
- 'candles/minutes/3',
111
- 'candles/minutes/5',
112
- 'candles/minutes/10',
113
- 'candles/minutes/15',
114
- 'candles/minutes/30',
115
- 'candles/minutes/60',
116
- 'candles/minutes/240',
117
- 'candles/days',
118
- 'candles/weeks',
119
- 'candles/months',
120
- 'trades/ticks',
121
- 'ticker',
122
- 'orderbook',
123
- ],
109
+ 'get': {
110
+ 'market/all': 2,
111
+ 'candles/{timeframe}': 2,
112
+ 'candles/{timeframe}/{unit}': 2,
113
+ 'candles/seconds': 2,
114
+ 'candles/minutes/{unit}': 2,
115
+ 'candles/minutes/1': 2,
116
+ 'candles/minutes/3': 2,
117
+ 'candles/minutes/5': 2,
118
+ 'candles/minutes/10': 2,
119
+ 'candles/minutes/15': 2,
120
+ 'candles/minutes/30': 2,
121
+ 'candles/minutes/60': 2,
122
+ 'candles/minutes/240': 2,
123
+ 'candles/days': 2,
124
+ 'candles/weeks': 2,
125
+ 'candles/months': 2,
126
+ 'candles/years': 2,
127
+ 'trades/ticks': 2,
128
+ 'ticker': 2,
129
+ 'ticker/all': 2,
130
+ 'orderbook': 2,
131
+ 'orderbook/supported_levels': 2, // Upbit KR only
132
+ },
124
133
  },
125
134
  'private': {
126
- 'get': [
127
- 'accounts',
128
- 'orders/chance',
129
- 'order',
130
- 'orders',
131
- 'orders/closed',
132
- 'orders/open',
133
- 'orders/uuids',
134
- 'withdraws',
135
- 'withdraw',
136
- 'withdraws/chance',
137
- 'deposits',
138
- 'deposit',
139
- 'deposits/coin_addresses',
140
- 'deposits/coin_address',
141
- ],
142
- 'post': [
143
- 'orders',
144
- 'withdraws/coin',
145
- 'withdraws/krw',
146
- 'deposits/generate_coin_address',
147
- ],
148
- 'delete': [
149
- 'order',
150
- ],
135
+ 'get': {
136
+ 'accounts': 0.67,
137
+ 'orders/chance': 0.67,
138
+ 'order': 0.67,
139
+ 'orders/closed': 0.67,
140
+ 'orders/open': 0.67,
141
+ 'orders/uuids': 0.67,
142
+ 'withdraws': 0.67,
143
+ 'withdraw': 0.67,
144
+ 'withdraws/chance': 0.67,
145
+ 'withdraws/coin_addresses': 0.67,
146
+ 'deposits': 0.67,
147
+ 'deposits/chance/coin': 0.67,
148
+ 'deposit': 0.67,
149
+ 'deposits/coin_addresses': 0.67,
150
+ 'deposits/coin_address': 0.67,
151
+ 'travel_rule/vasps': 0.67,
152
+ 'status/wallet': 0.67,
153
+ 'api_keys': 0.67, // Upbit KR only
154
+ },
155
+ 'post': {
156
+ 'orders': 2.5,
157
+ 'orders/cancel_and_new': 2.5,
158
+ 'withdraws/coin': 0.67,
159
+ 'withdraws/krw': 0.67,
160
+ 'deposits/krw': 0.67,
161
+ 'deposits/generate_coin_address': 0.67,
162
+ 'travel_rule/deposit/uuid': 0.67,
163
+ 'travel_rule/deposit/txid': 0.67, // RPS: 30, but each deposit can only be queried once every 10 minutes
164
+ },
165
+ 'delete': {
166
+ 'order': 0.67,
167
+ 'orders/open': 40,
168
+ 'orders/uuids': 0.67,
169
+ },
151
170
  },
152
171
  },
153
172
  'fees': {
@@ -250,8 +269,6 @@ class upbit extends upbit$1 {
250
269
  },
251
270
  'options': {
252
271
  'createMarketBuyOrderRequiresPrice': true,
253
- 'fetchTickersMaxLength': 4096,
254
- 'fetchOrderBooksMaxLength': 4096,
255
272
  'tradingFeesByQuoteCurrency': {
256
273
  'KRW': 0.0005,
257
274
  },
@@ -606,11 +623,6 @@ class upbit extends upbit$1 {
606
623
  let ids = undefined;
607
624
  if (symbols === undefined) {
608
625
  ids = this.ids.join(',');
609
- // max URL length is 2083 symbols, including http schema, hostname, tld, etc...
610
- if (ids.length > this.options['fetchOrderBooksMaxLength']) {
611
- const numIds = this.ids.length;
612
- throw new errors.ExchangeError(this.id + ' fetchOrderBooks() has ' + numIds.toString() + ' symbols (' + ids.length.toString() + ' characters) exceeding max URL length (' + this.options['fetchOrderBooksMaxLength'].toString() + ' characters), you are required to specify a list of symbols in the first argument to fetchOrderBooks');
613
- }
614
626
  }
615
627
  else {
616
628
  ids = this.marketIds(symbols);
@@ -750,11 +762,6 @@ class upbit extends upbit$1 {
750
762
  let ids = undefined;
751
763
  if (symbols === undefined) {
752
764
  ids = this.ids.join(',');
753
- // max URL length is 2083 symbols, including http schema, hostname, tld, etc...
754
- if (ids.length > this.options['fetchTickersMaxLength']) {
755
- const numIds = this.ids.length;
756
- throw new errors.ExchangeError(this.id + ' fetchTickers() has ' + numIds.toString() + ' symbols exceeding max URL length, you are required to specify a list of symbols in the first argument to fetchTickers');
757
- }
758
765
  }
759
766
  else {
760
767
  ids = this.marketIds(symbols);
@@ -996,6 +1003,29 @@ class upbit extends upbit$1 {
996
1003
  'tierBased': false,
997
1004
  };
998
1005
  }
1006
+ /**
1007
+ * @method
1008
+ * @name upbit#fetchTradingFees
1009
+ * @description fetch the trading fees for markets
1010
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1011
+ * @returns {object} a [trading fee structure]{@link https://docs.ccxt.com/#/?id=trading-fee-structure}
1012
+ */
1013
+ async fetchTradingFees(params = {}) {
1014
+ await this.loadMarkets();
1015
+ const fetchMarketResponse = await this.fetchMarkets(params);
1016
+ const response = {};
1017
+ for (let i = 0; i < fetchMarketResponse.length; i++) {
1018
+ const element = {};
1019
+ element['maker'] = this.safeNumber(fetchMarketResponse[i], 'maker');
1020
+ element['taker'] = this.safeNumber(fetchMarketResponse[i], 'taker');
1021
+ element['symbol'] = this.safeString(fetchMarketResponse[i], 'symbol');
1022
+ element['percentage'] = true;
1023
+ element['tierBased'] = false;
1024
+ element['info'] = fetchMarketResponse[i];
1025
+ response[this.safeString(fetchMarketResponse[i], 'symbol')] = element;
1026
+ }
1027
+ return response;
1028
+ }
999
1029
  parseOHLCV(ohlcv, market = undefined) {
1000
1030
  //
1001
1031
  // {
@@ -1091,6 +1121,30 @@ class upbit extends upbit$1 {
1091
1121
  //
1092
1122
  return this.parseOHLCVs(response, market, timeframe, since, limit);
1093
1123
  }
1124
+ calcOrderPrice(symbol, amount, price = undefined, params = {}) {
1125
+ let quoteAmount = undefined;
1126
+ const createMarketBuyOrderRequiresPrice = this.safeValue(this.options, 'createMarketBuyOrderRequiresPrice');
1127
+ const cost = this.safeString(params, 'cost');
1128
+ if (cost !== undefined) {
1129
+ quoteAmount = this.costToPrecision(symbol, cost);
1130
+ }
1131
+ else if (createMarketBuyOrderRequiresPrice) {
1132
+ if (price === undefined || amount === undefined) {
1133
+ throw new errors.InvalidOrder(this.id + ' createOrder() requires the price and amount argument for market buy orders to calculate the total cost to spend (amount * price), alternatively set the createMarketBuyOrderRequiresPrice option or param to false and pass the cost to spend (quote quantity) in the amount argument');
1134
+ }
1135
+ const amountString = this.numberToString(amount);
1136
+ const priceString = this.numberToString(price);
1137
+ const costRequest = Precise["default"].stringMul(amountString, priceString);
1138
+ quoteAmount = this.costToPrecision(symbol, costRequest);
1139
+ }
1140
+ else {
1141
+ if (amount === undefined) {
1142
+ throw new errors.ArgumentsRequired(this.id + ' When createMarketBuyOrderRequiresPrice is false, "amount" is required and should be the total quote amount to spend.');
1143
+ }
1144
+ quoteAmount = this.costToPrecision(symbol, amount);
1145
+ }
1146
+ return quoteAmount;
1147
+ }
1094
1148
  /**
1095
1149
  * @method
1096
1150
  * @name upbit#createOrder
@@ -1098,13 +1152,14 @@ class upbit extends upbit$1 {
1098
1152
  * @see https://docs.upbit.com/reference/%EC%A3%BC%EB%AC%B8%ED%95%98%EA%B8%B0
1099
1153
  * @see https://global-docs.upbit.com/reference/order
1100
1154
  * @param {string} symbol unified symbol of the market to create an order in
1101
- * @param {string} type 'market' or 'limit'
1155
+ * @param {string} type supports 'market' and 'limit'. if params.ordType is set to best, a best-type order will be created regardless of the value of type.
1102
1156
  * @param {string} side 'buy' or 'sell'
1103
1157
  * @param {float} amount how much you want to trade in units of the base currency
1104
1158
  * @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
1105
1159
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1106
- * @param {float} [params.cost] for market buy orders, the quote quantity that can be used as an alternative for the amount
1107
- * @param {string} [params.timeInForce] 'IOC' or 'FOK'
1160
+ * @param {float} [params.cost] for market buy and best buy orders, the quote quantity that can be used as an alternative for the amount
1161
+ * @param {string} [params.ordType] this field can be used to place a ‘best’ type order
1162
+ * @param {string} [params.timeInForce] 'IOC' or 'FOK'. only for limit or best type orders. this field is required when the order type is 'best'.
1108
1163
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1109
1164
  */
1110
1165
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
@@ -1118,58 +1173,69 @@ class upbit extends upbit$1 {
1118
1173
  orderSide = 'ask';
1119
1174
  }
1120
1175
  else {
1121
- throw new errors.InvalidOrder(this.id + ' createOrder() allows buy or sell side only!');
1176
+ throw new errors.InvalidOrder(this.id + ' createOrder() supports only buy or sell in the side argument.');
1122
1177
  }
1123
1178
  const request = {
1124
1179
  'market': market['id'],
1125
1180
  'side': orderSide,
1126
1181
  };
1127
1182
  if (type === 'limit') {
1183
+ if (price === undefined || amount === undefined) {
1184
+ throw new errors.ArgumentsRequired(this.id + ' the limit type order in createOrder() is required price and amount.');
1185
+ }
1186
+ request['ord_type'] = 'limit';
1128
1187
  request['price'] = this.priceToPrecision(symbol, price);
1188
+ request['volume'] = this.amountToPrecision(symbol, amount);
1129
1189
  }
1130
- if ((type === 'market') && (side === 'buy')) {
1131
- // for market buy it requires the amount of quote currency to spend
1132
- let quoteAmount = undefined;
1133
- let createMarketBuyOrderRequiresPrice = true;
1134
- [createMarketBuyOrderRequiresPrice, params] = this.handleOptionAndParams(params, 'createOrder', 'createMarketBuyOrderRequiresPrice', true);
1135
- const cost = this.safeNumber(params, 'cost');
1136
- params = this.omit(params, 'cost');
1137
- if (cost !== undefined) {
1138
- quoteAmount = this.costToPrecision(symbol, cost);
1139
- }
1140
- else if (createMarketBuyOrderRequiresPrice) {
1141
- if (price === undefined) {
1142
- throw new errors.InvalidOrder(this.id + ' createOrder() requires the price argument for market buy orders to calculate the total cost to spend (amount * price), alternatively set the createMarketBuyOrderRequiresPrice option or param to false and pass the cost to spend (quote quantity) in the amount argument');
1143
- }
1144
- else {
1145
- const amountString = this.numberToString(amount);
1146
- const priceString = this.numberToString(price);
1147
- const costRequest = Precise["default"].stringMul(amountString, priceString);
1148
- quoteAmount = this.costToPrecision(symbol, costRequest);
1149
- }
1190
+ else if (type === 'market') {
1191
+ if (side === 'buy') {
1192
+ request['ord_type'] = 'price';
1193
+ const orderPrice = this.calcOrderPrice(symbol, amount, price, params);
1194
+ request['price'] = orderPrice;
1150
1195
  }
1151
1196
  else {
1152
- quoteAmount = this.costToPrecision(symbol, amount);
1197
+ if (amount === undefined) {
1198
+ throw new errors.ArgumentsRequired(this.id + ' the market sell type order in createOrder() is required amount.');
1199
+ }
1200
+ request['ord_type'] = 'market';
1201
+ request['volume'] = this.amountToPrecision(symbol, amount);
1153
1202
  }
1154
- request['ord_type'] = 'price';
1155
- request['price'] = quoteAmount;
1156
1203
  }
1157
1204
  else {
1158
- request['ord_type'] = type;
1159
- request['volume'] = this.amountToPrecision(symbol, amount);
1205
+ throw new errors.InvalidOrder(this.id + ' createOrder() supports only limit or market types in the type argument.');
1160
1206
  }
1161
- const clientOrderId = this.safeString2(params, 'clientOrderId', 'identifier');
1207
+ const customType = this.safeString2(params, 'ordType', 'ord_type');
1208
+ if (customType === 'best') {
1209
+ params = this.omit(params, ['ordType', 'ord_type']);
1210
+ request['ord_type'] = 'best';
1211
+ if (side === 'buy') {
1212
+ const orderPrice = this.calcOrderPrice(symbol, amount, price, params);
1213
+ request['price'] = orderPrice;
1214
+ }
1215
+ else {
1216
+ if (amount === undefined) {
1217
+ throw new errors.ArgumentsRequired(this.id + ' the best sell type order in createOrder() is required amount.');
1218
+ }
1219
+ request['volume'] = this.amountToPrecision(symbol, amount);
1220
+ }
1221
+ }
1222
+ const clientOrderId = this.safeString(params, 'clientOrderId');
1162
1223
  if (clientOrderId !== undefined) {
1163
1224
  request['identifier'] = clientOrderId;
1164
1225
  }
1165
- if (type !== 'market') {
1226
+ if (request['ord_type'] !== 'market' && request['ord_type'] !== 'price') {
1166
1227
  const timeInForce = this.safeStringLower2(params, 'timeInForce', 'time_in_force');
1167
- params = this.omit(params, 'timeInForce');
1228
+ params = this.omit(params, ['timeInForce']);
1168
1229
  if (timeInForce !== undefined) {
1169
1230
  request['time_in_force'] = timeInForce;
1170
1231
  }
1232
+ else {
1233
+ if (request['ord_type'] === 'best') {
1234
+ throw new errors.ArgumentsRequired(this.id + ' the best type order in createOrder() is required timeInForce.');
1235
+ }
1236
+ }
1171
1237
  }
1172
- params = this.omit(params, ['clientOrderId', 'identifier']);
1238
+ params = this.omit(params, ['clientOrderId', 'cost']);
1173
1239
  const response = await this.privatePostOrders(this.extend(request, params));
1174
1240
  //
1175
1241
  // {
@@ -1230,6 +1296,125 @@ class upbit extends upbit$1 {
1230
1296
  //
1231
1297
  return this.parseOrder(response);
1232
1298
  }
1299
+ /**
1300
+ * @method
1301
+ * @name upbit#editOrder
1302
+ * @see https://docs.upbit.com/reference/%EC%B7%A8%EC%86%8C-%ED%9B%84-%EC%9E%AC%EC%A3%BC%EB%AC%B8
1303
+ * @description canceled existing order and create new order. It's only generated same side and symbol as the canceled order. it returns the data of the canceled order, except for `new_order_uuid` and `new_identifier`. to get the details of the new order, use `fetchOrder(new_order_uuid)`.
1304
+ * @param {string} id the uuid of the previous order you want to edit.
1305
+ * @param {string} symbol the symbol of the new order. it must be the same as the symbol of the previous order.
1306
+ * @param {string} type the type of the new order. only limit or market is accepted. if params.newOrdType is set to best, a best-type order will be created regardless of the value of type.
1307
+ * @param {string} side the side of the new order. it must be the same as the side of the previous order.
1308
+ * @param {number} amount the amount of the asset you want to buy or sell. It could be overridden by specifying the new_volume parameter in params.
1309
+ * @param {number} price the price of the asset you want to buy or sell. It could be overridden by specifying the new_price parameter in params.
1310
+ * @param {object} [params] extra parameters specific to the exchange API endpoint.
1311
+ * @param {string} [params.clientOrderId] to identify the previous order, either the id or this field is required in this method.
1312
+ * @param {float} [params.cost] for market buy and best buy orders, the quote quantity that can be used as an alternative for the amount.
1313
+ * @param {string} [params.newTimeInForce] 'IOC' or 'FOK'. only for limit or best type orders. this field is required when the order type is 'best'.
1314
+ * @param {string} [params.newClientOrderId] the order ID that the user can define.
1315
+ * @param {string} [params.newOrdType] this field only accepts limit, price, market, or best. You can refer to the Upbit developer documentation for details on how to use this field.
1316
+ * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1317
+ */
1318
+ async editOrder(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
1319
+ await this.loadMarkets();
1320
+ const request = {};
1321
+ const prevClientOrderId = this.safeString(params, 'clientOrderId');
1322
+ params = this.omit(params, 'clientOrderId');
1323
+ if (id !== undefined) {
1324
+ request['prev_order_uuid'] = id;
1325
+ }
1326
+ else if (prevClientOrderId !== undefined) {
1327
+ request['prev_order_identifier'] = prevClientOrderId;
1328
+ }
1329
+ else {
1330
+ throw new errors.ArgumentsRequired(this.id + ' editOrder() is required id or clientOrderId.');
1331
+ }
1332
+ if (type === 'limit') {
1333
+ if (price === undefined || amount === undefined) {
1334
+ throw new errors.ArgumentsRequired(this.id + ' editOrder() is required price and amount to create limit type order.');
1335
+ }
1336
+ request['new_ord_type'] = 'limit';
1337
+ request['new_price'] = this.priceToPrecision(symbol, price);
1338
+ request['new_volume'] = this.amountToPrecision(symbol, amount);
1339
+ }
1340
+ else if (type === 'market') {
1341
+ if (side === 'buy') {
1342
+ request['new_ord_type'] = 'price';
1343
+ const orderPrice = this.calcOrderPrice(symbol, amount, price, params);
1344
+ request['new_price'] = orderPrice;
1345
+ }
1346
+ else {
1347
+ if (amount === undefined) {
1348
+ throw new errors.ArgumentsRequired(this.id + ' editOrder() is required amount to create market sell type order.');
1349
+ }
1350
+ request['new_ord_type'] = 'market';
1351
+ request['new_volume'] = this.amountToPrecision(symbol, amount);
1352
+ }
1353
+ }
1354
+ else {
1355
+ throw new errors.InvalidOrder(this.id + ' editOrder() supports only limit or market types in the type argument.');
1356
+ }
1357
+ const customType = this.safeString2(params, 'newOrdType', 'new_ord_type');
1358
+ if (customType === 'best') {
1359
+ params = this.omit(params, ['newOrdType', 'new_ord_type']);
1360
+ request['new_ord_type'] = 'best';
1361
+ if (side === 'buy') {
1362
+ const orderPrice = this.calcOrderPrice(symbol, amount, price, params);
1363
+ request['new_price'] = orderPrice;
1364
+ }
1365
+ else {
1366
+ if (amount === undefined) {
1367
+ throw new errors.ArgumentsRequired(this.id + ' editOrder() is required amount to create best sell order.');
1368
+ }
1369
+ request['new_volume'] = this.amountToPrecision(symbol, amount);
1370
+ }
1371
+ }
1372
+ const clientOrderId = this.safeString(params, 'newClientOrderId');
1373
+ if (clientOrderId !== undefined) {
1374
+ request['new_identifier'] = clientOrderId;
1375
+ }
1376
+ if (request['new_ord_type'] !== 'market' && request['new_ord_type'] !== 'price') {
1377
+ const timeInForce = this.safeStringLower2(params, 'newTimeInForce', 'new_time_in_force');
1378
+ params = this.omit(params, ['newTimeInForce', 'new_time_in_force']);
1379
+ if (timeInForce !== undefined) {
1380
+ request['new_time_in_force'] = timeInForce;
1381
+ }
1382
+ else {
1383
+ if (request['new_ord_type'] === 'best') {
1384
+ throw new errors.ArgumentsRequired(this.id + ' the best type order is required timeInForce.');
1385
+ }
1386
+ }
1387
+ }
1388
+ params = this.omit(params, ['newClientOrderId', 'cost']);
1389
+ // console.log ('check the each request params: ', request);
1390
+ const response = await this.privatePostOrdersCancelAndNew(this.extend(request, params));
1391
+ // {
1392
+ // uuid: '63b38774-27db-4439-ac20-1be16a24d18e', //previous order data
1393
+ // side: 'bid', //previous order data
1394
+ // ord_type: 'limit', //previous order data
1395
+ // price: '100000000', //previous order data
1396
+ // state: 'wait', //previous order data
1397
+ // market: 'KRW-BTC', //previous order data
1398
+ // created_at: '2025-04-01T15:30:47+09:00', //previous order data
1399
+ // volume: '0.00008', //previous order data
1400
+ // remaining_volume: '0.00008', //previous order data
1401
+ // reserved_fee: '4', //previous order data
1402
+ // remaining_fee: '4', //previous order data
1403
+ // paid_fee: '0', //previous order data
1404
+ // locked: '8004', //previous order data
1405
+ // executed_volume: '0', //previous order data
1406
+ // trades_count: '0', //previous order data
1407
+ // identifier: '21', //previous order data
1408
+ // new_order_uuid: 'cb1cce56-6237-4a78-bc11-4cfffc1bb4c2', // new order data
1409
+ // new_order_identifier: '22' // new order data
1410
+ // }
1411
+ const result = {};
1412
+ result['uuid'] = this.safeString(response, 'new_order_uuid');
1413
+ result['identifier'] = this.safeString(response, 'new_order_identifier');
1414
+ result['side'] = this.safeString(response, 'side');
1415
+ result['market'] = this.safeString(response, 'market');
1416
+ return this.parseOrder(result);
1417
+ }
1233
1418
  /**
1234
1419
  * @method
1235
1420
  * @name upbit#fetchDeposits
@@ -1550,6 +1735,26 @@ class upbit extends upbit$1 {
1550
1735
  // "time_in_force": "ioc"
1551
1736
  // }
1552
1737
  //
1738
+ // {
1739
+ // uuid: '63b38774-27db-4439-ac20-1be16a24d18e',
1740
+ // side: 'bid',
1741
+ // ord_type: 'limit',
1742
+ // price: '100000000',
1743
+ // state: 'wait',
1744
+ // market: 'KRW-BTC',
1745
+ // created_at: '2025-04-01T15:30:47+09:00',
1746
+ // volume: '0.00008',
1747
+ // remaining_volume: '0.00008',
1748
+ // reserved_fee: '4',
1749
+ // remaining_fee: '4',
1750
+ // paid_fee: '0',
1751
+ // locked: '8004',
1752
+ // executed_volume: '0',
1753
+ // trades_count: '0',
1754
+ // identifier: '21',
1755
+ // new_order_uuid: 'cb1cce56-6237-4a78-bc11-4cfffc1bb4c2',
1756
+ // new_order_identifier: '22'
1757
+ // }
1553
1758
  const id = this.safeString(order, 'uuid');
1554
1759
  let side = this.safeString(order, 'side');
1555
1760
  if (side === 'bid') {
@@ -1558,6 +1763,7 @@ class upbit extends upbit$1 {
1558
1763
  else {
1559
1764
  side = 'sell';
1560
1765
  }
1766
+ const identifier = this.safeString(order, 'identifier');
1561
1767
  let type = this.safeString(order, 'ord_type');
1562
1768
  const timestamp = this.parse8601(this.safeString(order, 'created_at'));
1563
1769
  const status = this.parseOrderStatus(this.safeString(order, 'state'));
@@ -1614,7 +1820,7 @@ class upbit extends upbit$1 {
1614
1820
  return this.safeOrder({
1615
1821
  'info': order,
1616
1822
  'id': id,
1617
- 'clientOrderId': undefined,
1823
+ 'clientOrderId': identifier,
1618
1824
  'timestamp': timestamp,
1619
1825
  'datetime': this.iso8601(timestamp),
1620
1826
  'lastTradeTimestamp': lastTradeTimestamp,
@@ -577,6 +577,7 @@ class whitebit extends whitebit$1 {
577
577
  'deposit': canDeposit,
578
578
  'withdraw': canWithdraw,
579
579
  'fee': undefined,
580
+ 'networks': undefined,
580
581
  'precision': undefined,
581
582
  'limits': {
582
583
  'amount': {
@@ -571,6 +571,7 @@ class woo extends woo$1 {
571
571
  linear = true;
572
572
  inverse = false;
573
573
  }
574
+ const active = this.safeString(market, 'is_trading') === '1';
574
575
  return {
575
576
  'id': marketId,
576
577
  'symbol': symbol,
@@ -586,7 +587,7 @@ class woo extends woo$1 {
586
587
  'swap': swap,
587
588
  'future': false,
588
589
  'option': false,
589
- 'active': this.safeString(market, 'is_trading') === '1',
590
+ 'active': active,
590
591
  'contract': contract,
591
592
  'linear': linear,
592
593
  'inverse': inverse,
@@ -930,6 +931,7 @@ class woo extends woo$1 {
930
931
  'networks': resultingNetworks,
931
932
  'deposit': undefined,
932
933
  'withdraw': undefined,
934
+ 'type': 'crypto',
933
935
  'limits': {
934
936
  'deposit': {
935
937
  'min': undefined,