ccxt 4.1.86 → 4.1.87

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 (181) hide show
  1. package/README.md +5 -8
  2. package/dist/ccxt.browser.js +17010 -23553
  3. package/dist/ccxt.browser.min.js +3 -3
  4. package/dist/cjs/ccxt.js +1 -16
  5. package/dist/cjs/src/binanceus.js +0 -2
  6. package/dist/cjs/src/bitforex.js +0 -2
  7. package/dist/cjs/src/coinlist.js +0 -2
  8. package/dist/cjs/src/coinsph.js +0 -2
  9. package/dist/cjs/src/cryptocom.js +0 -2
  10. package/dist/cjs/src/gate.js +0 -210
  11. package/dist/cjs/src/kuna.js +0 -2
  12. package/dist/cjs/src/mexc.js +0 -2
  13. package/dist/cjs/src/okx.js +0 -1
  14. package/dist/cjs/src/pro/coinex.js +2 -1
  15. package/dist/cjs/src/tokocrypto.js +0 -1
  16. package/dist/cjs/src/upbit.js +36 -26
  17. package/dist/cjs/src/wazirx.js +0 -2
  18. package/dist/cjs/src/whitebit.js +0 -2
  19. package/dist/cjs/src/woo.js +0 -2
  20. package/js/ccxt.d.ts +3 -21
  21. package/js/ccxt.js +2 -14
  22. package/js/src/ace.d.ts +1 -1
  23. package/js/src/alpaca.d.ts +1 -1
  24. package/js/src/ascendex.d.ts +1 -1
  25. package/js/src/base/Exchange.d.ts +3 -3
  26. package/js/src/bigone.d.ts +1 -1
  27. package/js/src/binance.d.ts +1 -1
  28. package/js/src/binanceus.js +0 -2
  29. package/js/src/bingx.d.ts +1 -1
  30. package/js/src/bit2c.d.ts +1 -1
  31. package/js/src/bitbank.d.ts +1 -1
  32. package/js/src/bitbns.d.ts +1 -1
  33. package/js/src/bitfinex.d.ts +1 -1
  34. package/js/src/bitfinex2.d.ts +1 -1
  35. package/js/src/bitflyer.d.ts +1 -1
  36. package/js/src/bitforex.d.ts +1 -1
  37. package/js/src/bitforex.js +0 -2
  38. package/js/src/bitget.d.ts +1 -1
  39. package/js/src/bithumb.d.ts +1 -1
  40. package/js/src/bitmart.d.ts +1 -1
  41. package/js/src/bitmex.d.ts +1 -1
  42. package/js/src/bitopro.d.ts +1 -1
  43. package/js/src/bitpanda.d.ts +1 -1
  44. package/js/src/bitrue.d.ts +1 -1
  45. package/js/src/bitso.d.ts +1 -1
  46. package/js/src/bitstamp.d.ts +1 -1
  47. package/js/src/bitvavo.d.ts +1 -1
  48. package/js/src/bl3p.d.ts +1 -1
  49. package/js/src/blockchaincom.d.ts +1 -1
  50. package/js/src/btcalpha.d.ts +1 -1
  51. package/js/src/btcbox.d.ts +1 -1
  52. package/js/src/btcmarkets.d.ts +1 -1
  53. package/js/src/btcturk.d.ts +1 -1
  54. package/js/src/bybit.d.ts +1 -1
  55. package/js/src/cex.d.ts +1 -1
  56. package/js/src/coinbase.d.ts +1 -1
  57. package/js/src/coinbasepro.d.ts +1 -1
  58. package/js/src/coincheck.d.ts +1 -1
  59. package/js/src/coinex.d.ts +1 -1
  60. package/js/src/coinlist.d.ts +1 -1
  61. package/js/src/coinlist.js +0 -2
  62. package/js/src/coinmate.d.ts +1 -1
  63. package/js/src/coinone.d.ts +1 -1
  64. package/js/src/coinsph.d.ts +1 -1
  65. package/js/src/coinsph.js +0 -2
  66. package/js/src/coinspot.d.ts +1 -1
  67. package/js/src/cryptocom.d.ts +1 -1
  68. package/js/src/cryptocom.js +0 -2
  69. package/js/src/currencycom.d.ts +1 -1
  70. package/js/src/delta.d.ts +1 -1
  71. package/js/src/deribit.d.ts +1 -1
  72. package/js/src/digifinex.d.ts +1 -1
  73. package/js/src/exmo.d.ts +1 -1
  74. package/js/src/gate.d.ts +1 -28
  75. package/js/src/gate.js +0 -210
  76. package/js/src/gemini.d.ts +1 -1
  77. package/js/src/hitbtc.d.ts +1 -1
  78. package/js/src/hollaex.d.ts +1 -1
  79. package/js/src/htx.d.ts +1 -1
  80. package/js/src/huobijp.d.ts +1 -1
  81. package/js/src/idex.d.ts +1 -1
  82. package/js/src/independentreserve.d.ts +1 -1
  83. package/js/src/indodax.d.ts +1 -1
  84. package/js/src/kraken.d.ts +1 -1
  85. package/js/src/krakenfutures.d.ts +1 -1
  86. package/js/src/kucoin.d.ts +1 -1
  87. package/js/src/kucoinfutures.d.ts +1 -1
  88. package/js/src/kuna.d.ts +1 -1
  89. package/js/src/kuna.js +0 -2
  90. package/js/src/latoken.d.ts +1 -1
  91. package/js/src/lbank.d.ts +1 -1
  92. package/js/src/luno.d.ts +1 -1
  93. package/js/src/lykke.d.ts +1 -1
  94. package/js/src/mercado.d.ts +1 -1
  95. package/js/src/mexc.d.ts +1 -1
  96. package/js/src/mexc.js +0 -2
  97. package/js/src/ndax.d.ts +1 -1
  98. package/js/src/novadax.d.ts +1 -1
  99. package/js/src/oceanex.d.ts +1 -1
  100. package/js/src/okcoin.d.ts +1 -1
  101. package/js/src/okx.d.ts +1 -1
  102. package/js/src/okx.js +0 -1
  103. package/js/src/p2b.d.ts +1 -1
  104. package/js/src/paymium.d.ts +1 -1
  105. package/js/src/phemex.d.ts +1 -1
  106. package/js/src/poloniex.d.ts +1 -1
  107. package/js/src/poloniexfutures.d.ts +1 -1
  108. package/js/src/pro/alpaca.d.ts +8 -8
  109. package/js/src/pro/ascendex.d.ts +7 -7
  110. package/js/src/pro/binance.d.ts +24 -24
  111. package/js/src/pro/bingx.d.ts +7 -7
  112. package/js/src/pro/bitfinex.d.ts +6 -6
  113. package/js/src/pro/bitfinex2.d.ts +11 -11
  114. package/js/src/pro/bitget.d.ts +17 -17
  115. package/js/src/pro/bitmart.d.ts +13 -13
  116. package/js/src/pro/bitmex.d.ts +10 -10
  117. package/js/src/pro/bitopro.d.ts +5 -5
  118. package/js/src/pro/bitpanda.d.ts +10 -10
  119. package/js/src/pro/bitrue.d.ts +5 -5
  120. package/js/src/pro/bitstamp.d.ts +6 -6
  121. package/js/src/pro/bitvavo.d.ts +7 -7
  122. package/js/src/pro/blockchaincom.d.ts +10 -10
  123. package/js/src/pro/bybit.d.ts +14 -14
  124. package/js/src/pro/cex.d.ts +20 -20
  125. package/js/src/pro/coinbase.d.ts +7 -6
  126. package/js/src/pro/coinbasepro.d.ts +12 -12
  127. package/js/src/pro/coinex.d.ts +12 -12
  128. package/js/src/pro/coinex.js +2 -1
  129. package/js/src/pro/cryptocom.d.ts +13 -13
  130. package/js/src/pro/currencycom.d.ts +6 -6
  131. package/js/src/pro/deribit.d.ts +8 -8
  132. package/js/src/pro/exmo.d.ts +6 -6
  133. package/js/src/pro/gate.d.ts +11 -11
  134. package/js/src/pro/gemini.d.ts +7 -7
  135. package/js/src/pro/hitbtc.d.ts +13 -13
  136. package/js/src/pro/hollaex.d.ts +6 -6
  137. package/js/src/pro/htx.d.ts +12 -12
  138. package/js/src/pro/huobijp.d.ts +5 -5
  139. package/js/src/pro/idex.d.ts +7 -7
  140. package/js/src/pro/independentreserve.d.ts +4 -4
  141. package/js/src/pro/kraken.d.ts +11 -11
  142. package/js/src/pro/krakenfutures.d.ts +15 -15
  143. package/js/src/pro/kucoin.d.ts +13 -13
  144. package/js/src/pro/kucoinfutures.d.ts +10 -10
  145. package/js/src/pro/luno.d.ts +3 -3
  146. package/js/src/pro/mexc.d.ts +11 -11
  147. package/js/src/pro/ndax.d.ts +5 -5
  148. package/js/src/pro/okcoin.d.ts +7 -7
  149. package/js/src/pro/okx.d.ts +16 -16
  150. package/js/src/pro/phemex.d.ts +9 -9
  151. package/js/src/pro/poloniex.d.ts +13 -13
  152. package/js/src/pro/poloniexfutures.d.ts +10 -10
  153. package/js/src/pro/probit.d.ts +7 -7
  154. package/js/src/pro/upbit.d.ts +4 -4
  155. package/js/src/pro/wazirx.d.ts +12 -12
  156. package/js/src/pro/whitebit.d.ts +10 -10
  157. package/js/src/pro/woo.d.ts +11 -11
  158. package/js/src/probit.d.ts +1 -1
  159. package/js/src/timex.d.ts +1 -1
  160. package/js/src/tokocrypto.d.ts +1 -1
  161. package/js/src/tokocrypto.js +0 -1
  162. package/js/src/upbit.d.ts +1 -1
  163. package/js/src/upbit.js +36 -26
  164. package/js/src/wavesexchange.d.ts +1 -1
  165. package/js/src/wazirx.d.ts +1 -1
  166. package/js/src/wazirx.js +0 -2
  167. package/js/src/whitebit.d.ts +1 -1
  168. package/js/src/whitebit.js +0 -2
  169. package/js/src/woo.d.ts +1 -1
  170. package/js/src/woo.js +0 -2
  171. package/js/src/yobit.d.ts +1 -1
  172. package/js/src/zaif.d.ts +1 -1
  173. package/js/src/zonda.d.ts +1 -1
  174. package/jsdoc2md.js +0 -2
  175. package/package.json +1 -1
  176. package/js/src/abstract/bittrex.d.ts +0 -79
  177. package/js/src/abstract/bittrex.js +0 -11
  178. package/js/src/abstract/coinbaseprime.d.ts +0 -69
  179. package/js/src/abstract/coinbaseprime.js +0 -11
  180. package/js/src/abstract/coinbasepro.d.ts +0 -69
  181. package/js/src/abstract/coinbasepro.js +0 -11
package/dist/cjs/ccxt.js CHANGED
@@ -40,7 +40,6 @@ var bitpanda = require('./src/bitpanda.js');
40
40
  var bitrue = require('./src/bitrue.js');
41
41
  var bitso = require('./src/bitso.js');
42
42
  var bitstamp = require('./src/bitstamp.js');
43
- var bittrex = require('./src/bittrex.js');
44
43
  var bitvavo = require('./src/bitvavo.js');
45
44
  var bl3p = require('./src/bl3p.js');
46
45
  var blockchaincom = require('./src/blockchaincom.js');
@@ -51,8 +50,6 @@ var btcturk = require('./src/btcturk.js');
51
50
  var bybit = require('./src/bybit.js');
52
51
  var cex = require('./src/cex.js');
53
52
  var coinbase = require('./src/coinbase.js');
54
- var coinbaseprime = require('./src/coinbaseprime.js');
55
- var coinbasepro = require('./src/coinbasepro.js');
56
53
  var coincheck = require('./src/coincheck.js');
57
54
  var coinex = require('./src/coinex.js');
58
55
  var coinlist = require('./src/coinlist.js');
@@ -129,14 +126,11 @@ var bitopro$1 = require('./src/pro/bitopro.js');
129
126
  var bitpanda$1 = require('./src/pro/bitpanda.js');
130
127
  var bitrue$1 = require('./src/pro/bitrue.js');
131
128
  var bitstamp$1 = require('./src/pro/bitstamp.js');
132
- var bittrex$1 = require('./src/pro/bittrex.js');
133
129
  var bitvavo$1 = require('./src/pro/bitvavo.js');
134
130
  var blockchaincom$1 = require('./src/pro/blockchaincom.js');
135
131
  var bybit$1 = require('./src/pro/bybit.js');
136
132
  var cex$1 = require('./src/pro/cex.js');
137
133
  var coinbase$1 = require('./src/pro/coinbase.js');
138
- var coinbaseprime$1 = require('./src/pro/coinbaseprime.js');
139
- var coinbasepro$1 = require('./src/pro/coinbasepro.js');
140
134
  var coinex$1 = require('./src/pro/coinex.js');
141
135
  var cryptocom$1 = require('./src/pro/cryptocom.js');
142
136
  var currencycom$1 = require('./src/pro/currencycom.js');
@@ -172,7 +166,7 @@ var woo$1 = require('./src/pro/woo.js');
172
166
 
173
167
  //-----------------------------------------------------------------------------
174
168
  // this is updated by vss.js when building
175
- const version = '4.1.86';
169
+ const version = '4.1.87';
176
170
  Exchange["default"].ccxtVersion = version;
177
171
  const exchanges = {
178
172
  'ace': ace,
@@ -203,7 +197,6 @@ const exchanges = {
203
197
  'bitrue': bitrue,
204
198
  'bitso': bitso,
205
199
  'bitstamp': bitstamp,
206
- 'bittrex': bittrex,
207
200
  'bitvavo': bitvavo,
208
201
  'bl3p': bl3p,
209
202
  'blockchaincom': blockchaincom,
@@ -214,8 +207,6 @@ const exchanges = {
214
207
  'bybit': bybit,
215
208
  'cex': cex,
216
209
  'coinbase': coinbase,
217
- 'coinbaseprime': coinbaseprime,
218
- 'coinbasepro': coinbasepro,
219
210
  'coincheck': coincheck,
220
211
  'coinex': coinex,
221
212
  'coinlist': coinlist,
@@ -294,14 +285,11 @@ const pro = {
294
285
  'bitpanda': bitpanda$1,
295
286
  'bitrue': bitrue$1,
296
287
  'bitstamp': bitstamp$1,
297
- 'bittrex': bittrex$1,
298
288
  'bitvavo': bitvavo$1,
299
289
  'blockchaincom': blockchaincom$1,
300
290
  'bybit': bybit$1,
301
291
  'cex': cex$1,
302
292
  'coinbase': coinbase$1,
303
- 'coinbaseprime': coinbaseprime$1,
304
- 'coinbasepro': coinbasepro$1,
305
293
  'coinex': coinex$1,
306
294
  'cryptocom': cryptocom$1,
307
295
  'currencycom': currencycom$1,
@@ -404,7 +392,6 @@ exports.bitpanda = bitpanda;
404
392
  exports.bitrue = bitrue;
405
393
  exports.bitso = bitso;
406
394
  exports.bitstamp = bitstamp;
407
- exports.bittrex = bittrex;
408
395
  exports.bitvavo = bitvavo;
409
396
  exports.bl3p = bl3p;
410
397
  exports.blockchaincom = blockchaincom;
@@ -415,8 +402,6 @@ exports.btcturk = btcturk;
415
402
  exports.bybit = bybit;
416
403
  exports.cex = cex;
417
404
  exports.coinbase = coinbase;
418
- exports.coinbaseprime = coinbaseprime;
419
- exports.coinbasepro = coinbasepro;
420
405
  exports.coincheck = coincheck;
421
406
  exports.coinex = coinex;
422
407
  exports.coinlist = coinlist;
@@ -47,7 +47,6 @@ class binanceus extends binance {
47
47
  'future': undefined,
48
48
  'option': false,
49
49
  'addMargin': false,
50
- 'borrowMargin': false,
51
50
  'closeAllPositions': false,
52
51
  'closePosition': false,
53
52
  'createReduceOnlyOrder': false,
@@ -73,7 +72,6 @@ class binanceus extends binance {
73
72
  'fetchPositionsRisk': false,
74
73
  'fetchPremiumIndexOHLCV': false,
75
74
  'reduceMargin': false,
76
- 'repayMargin': false,
77
75
  'setLeverage': false,
78
76
  'setMargin': false,
79
77
  'setMarginMode': false,
@@ -27,7 +27,6 @@ class bitforex extends bitforex$1 {
27
27
  'future': false,
28
28
  'option': false,
29
29
  'addMargin': false,
30
- 'borrowMargin': false,
31
30
  'cancelOrder': true,
32
31
  'createOrder': true,
33
32
  'createReduceOnlyOrder': false,
@@ -75,7 +74,6 @@ class bitforex extends bitforex$1 {
75
74
  'fetchWithdrawal': false,
76
75
  'fetchWithdrawals': false,
77
76
  'reduceMargin': false,
78
- 'repayMargin': false,
79
77
  'setLeverage': false,
80
78
  'setMargin': false,
81
79
  'setMarginMode': false,
@@ -28,7 +28,6 @@ class coinlist extends coinlist$1 {
28
28
  'future': false,
29
29
  'option': false,
30
30
  'addMargin': false,
31
- 'borrowMargin': false,
32
31
  'cancelAllOrders': true,
33
32
  'cancelOrder': true,
34
33
  'cancelOrders': true,
@@ -107,7 +106,6 @@ class coinlist extends coinlist$1 {
107
106
  'fetchWithdrawals': false,
108
107
  'fetchWithdrawalWhitelist': false,
109
108
  'reduceMargin': false,
110
- 'repayMargin': false,
111
109
  'setLeverage': false,
112
110
  'setMargin': false,
113
111
  'setMarginMode': false,
@@ -28,7 +28,6 @@ class coinsph extends coinsph$1 {
28
28
  'future': false,
29
29
  'option': false,
30
30
  'addMargin': false,
31
- 'borrowMargin': false,
32
31
  'cancelAllOrders': true,
33
32
  'cancelOrder': true,
34
33
  'cancelOrders': false,
@@ -109,7 +108,6 @@ class coinsph extends coinsph$1 {
109
108
  'fetchWithdrawals': true,
110
109
  'fetchWithdrawalWhitelist': false,
111
110
  'reduceMargin': false,
112
- 'repayMargin': false,
113
111
  'setLeverage': false,
114
112
  'setMargin': false,
115
113
  'setMarginMode': false,
@@ -29,7 +29,6 @@ class cryptocom extends cryptocom$1 {
29
29
  'future': true,
30
30
  'option': true,
31
31
  'addMargin': false,
32
- 'borrowMargin': false,
33
32
  'cancelAllOrders': true,
34
33
  'cancelOrder': true,
35
34
  'cancelOrders': true,
@@ -94,7 +93,6 @@ class cryptocom extends cryptocom$1 {
94
93
  'fetchVolatilityHistory': false,
95
94
  'fetchWithdrawals': true,
96
95
  'reduceMargin': false,
97
- 'repayMargin': false,
98
96
  'setLeverage': false,
99
97
  'setMarginMode': false,
100
98
  'setPositionMode': false,
@@ -5739,216 +5739,6 @@ class gate extends gate$1 {
5739
5739
  }
5740
5740
  return tiers;
5741
5741
  }
5742
- async repayMargin(code, amount, symbol = undefined, params = {}) {
5743
- /**
5744
- * @method
5745
- * @name gate#repayMargin
5746
- * @description repay borrowed margin and interest
5747
- * @see https://www.gate.io/docs/apiv4/en/#repay-cross-margin-loan
5748
- * @see https://www.gate.io/docs/apiv4/en/#repay-a-loan
5749
- * @param {string} code unified currency code of the currency to repay
5750
- * @param {float} amount the amount to repay
5751
- * @param {string} symbol unified market symbol, required for isolated margin
5752
- * @param {object} [params] extra parameters specific to the exchange API endpoint
5753
- * @param {string} [params.mode] 'all' or 'partial' payment mode, extra parameter required for isolated margin
5754
- * @param {string} [params.id] '34267567' loan id, extra parameter required for isolated margin
5755
- * @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
5756
- */
5757
- let marginMode = undefined;
5758
- [marginMode, params] = this.handleOptionAndParams(params, 'repayMargin', 'marginMode');
5759
- this.checkRequiredArgument('repayMargin', marginMode, 'marginMode', ['cross', 'isolated']);
5760
- this.checkRequiredMarginArgument('repayMargin', symbol, marginMode);
5761
- await this.loadMarkets();
5762
- const currency = this.currency(code);
5763
- const request = {
5764
- 'currency': currency['id'].toUpperCase(),
5765
- 'amount': this.currencyToPrecision(code, amount),
5766
- };
5767
- let response = undefined;
5768
- if ((marginMode === 'cross') && (symbol === undefined)) {
5769
- response = await this.privateMarginPostCrossRepayments(this.extend(request, params));
5770
- }
5771
- else if ((marginMode === 'isolated') || (symbol !== undefined)) {
5772
- if (symbol === undefined) {
5773
- throw new errors.BadRequest(this.id + ' repayMargin() requires a symbol argument for isolated margin');
5774
- }
5775
- const market = this.market(symbol);
5776
- request['currency_pair'] = market['id'];
5777
- request['type'] = 'repay';
5778
- response = await this.privateMarginPostUniLoans(this.extend(request, params));
5779
- }
5780
- //
5781
- // Cross
5782
- //
5783
- // [
5784
- // {
5785
- // "id": "17",
5786
- // "create_time": 1620381696159,
5787
- // "update_time": 1620381696159,
5788
- // "currency": "EOS",
5789
- // "amount": "110.553635",
5790
- // "text": "web",
5791
- // "status": 2,
5792
- // "repaid": "110.506649705159",
5793
- // "repaid_interest": "0.046985294841",
5794
- // "unpaid_interest": "0.0000074393366667"
5795
- // }
5796
- // ]
5797
- //
5798
- // Isolated
5799
- //
5800
- // {
5801
- // "id": "34267567",
5802
- // "create_time": "1656394778",
5803
- // "expire_time": "1657258778",
5804
- // "status": "finished",
5805
- // "side": "borrow",
5806
- // "currency": "USDT",
5807
- // "rate": "0.0002",
5808
- // "amount": "100",
5809
- // "days": 10,
5810
- // "auto_renew": false,
5811
- // "currency_pair": "LTC_USDT",
5812
- // "left": "0",
5813
- // "repaid": "100",
5814
- // "paid_interest": "0.003333333333",
5815
- // "unpaid_interest": "0"
5816
- // }
5817
- //
5818
- if (marginMode === 'cross') {
5819
- response = response[0];
5820
- }
5821
- return this.parseMarginLoan(response, currency);
5822
- }
5823
- async borrowMargin(code, amount, symbol = undefined, params = {}) {
5824
- /**
5825
- * @method
5826
- * @name gate#borrowMargin
5827
- * @description create a loan to borrow margin
5828
- * @see https://www.gate.io/docs/apiv4/en/#create-a-cross-margin-borrow-loan
5829
- * @see https://www.gate.io/docs/developers/apiv4/en/#marginuni
5830
- * @param {string} code unified currency code of the currency to borrow
5831
- * @param {float} amount the amount to borrow
5832
- * @param {string} symbol unified market symbol, required for isolated margin
5833
- * @param {object} [params] extra parameters specific to the exchange API endpoint
5834
- * @param {string} [params.rate] '0.0002' or '0.002' extra parameter required for isolated margin
5835
- * @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
5836
- */
5837
- let marginMode = undefined;
5838
- [marginMode, params] = this.handleOptionAndParams(params, 'borrowMargin', 'marginMode');
5839
- this.checkRequiredArgument('borrowMargin', marginMode, 'marginMode', ['cross', 'isolated']);
5840
- this.checkRequiredMarginArgument('borrowMargin', symbol, marginMode);
5841
- await this.loadMarkets();
5842
- const currency = this.currency(code);
5843
- const request = {
5844
- 'currency': currency['id'].toUpperCase(),
5845
- 'amount': this.currencyToPrecision(code, amount),
5846
- };
5847
- let response = undefined;
5848
- if ((marginMode === 'cross') && (symbol === undefined)) {
5849
- response = await this.privateMarginPostCrossLoans(this.extend(request, params));
5850
- }
5851
- else if ((marginMode === 'isolated') || (symbol !== undefined)) {
5852
- if (symbol === undefined) {
5853
- throw new errors.BadRequest(this.id + ' borrowMargin() requires a symbol argument for isolated margin');
5854
- }
5855
- const market = this.market(symbol);
5856
- request['currency_pair'] = market['id'];
5857
- request['type'] = 'borrow';
5858
- response = await this.privateMarginPostUniLoans(this.extend(request, params));
5859
- }
5860
- //
5861
- // Cross
5862
- //
5863
- // {
5864
- // "id": "17",
5865
- // "create_time": 1620381696159,
5866
- // "update_time": 1620381696159,
5867
- // "currency": "EOS",
5868
- // "amount": "110.553635",
5869
- // "text": "web",
5870
- // "status": 2,
5871
- // "repaid": "110.506649705159",
5872
- // "repaid_interest": "0.046985294841",
5873
- // "unpaid_interest": "0.0000074393366667"
5874
- // }
5875
- //
5876
- // Isolated
5877
- //
5878
- // {
5879
- // "id": "34267567",
5880
- // "create_time": "1656394778",
5881
- // "expire_time": "1657258778",
5882
- // "status": "loaned",
5883
- // "side": "borrow",
5884
- // "currency": "USDT",
5885
- // "rate": "0.0002",
5886
- // "amount": "100",
5887
- // "days": 10,
5888
- // "auto_renew": false,
5889
- // "currency_pair": "LTC_USDT",
5890
- // "left": "0",
5891
- // "repaid": "0",
5892
- // "paid_interest": "0",
5893
- // "unpaid_interest": "0.003333333333"
5894
- // }
5895
- //
5896
- return this.parseMarginLoan(response, currency);
5897
- }
5898
- parseMarginLoan(info, currency = undefined) {
5899
- //
5900
- // Cross
5901
- //
5902
- // {
5903
- // "id": "17",
5904
- // "create_time": 1620381696159,
5905
- // "update_time": 1620381696159,
5906
- // "currency": "EOS",
5907
- // "amount": "110.553635",
5908
- // "text": "web",
5909
- // "status": 2,
5910
- // "repaid": "110.506649705159",
5911
- // "repaid_interest": "0.046985294841",
5912
- // "unpaid_interest": "0.0000074393366667"
5913
- // }
5914
- //
5915
- // Isolated
5916
- //
5917
- // {
5918
- // "id": "34267567",
5919
- // "create_time": "1656394778",
5920
- // "expire_time": "1657258778",
5921
- // "status": "loaned",
5922
- // "side": "borrow",
5923
- // "currency": "USDT",
5924
- // "rate": "0.0002",
5925
- // "amount": "100",
5926
- // "days": 10,
5927
- // "auto_renew": false,
5928
- // "currency_pair": "LTC_USDT",
5929
- // "left": "0",
5930
- // "repaid": "0",
5931
- // "paid_interest": "0",
5932
- // "unpaid_interest": "0.003333333333"
5933
- // }
5934
- //
5935
- const marginMode = this.safeString2(this.options, 'defaultMarginMode', 'marginMode', 'cross');
5936
- let timestamp = this.safeInteger(info, 'create_time');
5937
- if (marginMode === 'isolated') {
5938
- timestamp = this.safeTimestamp(info, 'create_time');
5939
- }
5940
- const currencyId = this.safeString(info, 'currency');
5941
- const marketId = this.safeString(info, 'currency_pair');
5942
- return {
5943
- 'id': this.safeInteger(info, 'id'),
5944
- 'currency': this.safeCurrencyCode(currencyId, currency),
5945
- 'amount': this.safeNumber(info, 'amount'),
5946
- 'symbol': this.safeSymbol(marketId, undefined, '_', 'margin'),
5947
- 'timestamp': timestamp,
5948
- 'datetime': this.iso8601(timestamp),
5949
- 'info': info,
5950
- };
5951
- }
5952
5742
  sign(path, api = [], method = 'GET', params = {}, headers = undefined, body = undefined) {
5953
5743
  const authentication = api[0]; // public, private
5954
5744
  const type = api[1]; // spot, margin, future, delivery
@@ -30,7 +30,6 @@ class kuna extends kuna$1 {
30
30
  'future': false,
31
31
  'option': false,
32
32
  'addMargin': false,
33
- 'borrowMargin': false,
34
33
  'cancelOrder': true,
35
34
  'cancelOrders': true,
36
35
  'closeAllPositions': false,
@@ -95,7 +94,6 @@ class kuna extends kuna$1 {
95
94
  'fetchWithdrawal': true,
96
95
  'fetchWithdrawals': true,
97
96
  'reduceMargin': false,
98
- 'repayMargin': false,
99
97
  'setLeverage': false,
100
98
  'setMargin': false,
101
99
  'setMarginMode': false,
@@ -30,7 +30,6 @@ class mexc extends mexc$1 {
30
30
  'future': false,
31
31
  'option': false,
32
32
  'addMargin': true,
33
- 'borrowMargin': false,
34
33
  'cancelAllOrders': true,
35
34
  'cancelOrder': true,
36
35
  'cancelOrders': undefined,
@@ -107,7 +106,6 @@ class mexc extends mexc$1 {
107
106
  'fetchWithdrawal': undefined,
108
107
  'fetchWithdrawals': true,
109
108
  'reduceMargin': true,
110
- 'repayMargin': false,
111
109
  'setLeverage': true,
112
110
  'setMarginMode': undefined,
113
111
  'setPositionMode': true,
@@ -30,7 +30,6 @@ class okx extends okx$1 {
30
30
  'future': true,
31
31
  'option': true,
32
32
  'addMargin': true,
33
- 'borrowMargin': true,
34
33
  'cancelAllOrders': false,
35
34
  'cancelOrder': true,
36
35
  'cancelOrders': true,
@@ -406,7 +406,8 @@ class coinex extends coinex$1 {
406
406
  * @param {object} [params] extra parameters specific to the exchange API endpoint
407
407
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
408
408
  */
409
- return await this.watchTickers([symbol], params);
409
+ const tickers = await this.watchTickers([symbol], params);
410
+ return this.safeValue(tickers, symbol);
410
411
  }
411
412
  async watchTickers(symbols = undefined, params = {}) {
412
413
  /**
@@ -102,7 +102,6 @@ class tokocrypto extends tokocrypto$1 {
102
102
  'fetchWithdrawals': true,
103
103
  'fetchWithdrawalWhitelist': false,
104
104
  'reduceMargin': false,
105
- 'repayMargin': false,
106
105
  'setLeverage': false,
107
106
  'setMargin': false,
108
107
  'setMarginMode': false,
@@ -33,7 +33,10 @@ class upbit extends upbit$1 {
33
33
  'option': false,
34
34
  'cancelOrder': true,
35
35
  'createDepositAddress': true,
36
+ 'createMarketBuyOrderWithCost': true,
36
37
  'createMarketOrder': true,
38
+ 'createMarketOrderWithCost': false,
39
+ 'createMarketSellOrderWithCost': false,
37
40
  'createOrder': true,
38
41
  'fetchBalance': true,
39
42
  'fetchCanceledOrders': true,
@@ -1020,29 +1023,19 @@ class upbit extends upbit$1 {
1020
1023
  /**
1021
1024
  * @method
1022
1025
  * @name upbit#createOrder
1023
- * @see https://docs.upbit.com/reference/%EC%A3%BC%EB%AC%B8%ED%95%98%EA%B8%B0
1024
1026
  * @description create a trade order
1027
+ * @see https://docs.upbit.com/reference/%EC%A3%BC%EB%AC%B8%ED%95%98%EA%B8%B0
1025
1028
  * @param {string} symbol unified symbol of the market to create an order in
1026
1029
  * @param {string} type 'market' or 'limit'
1027
1030
  * @param {string} side 'buy' or 'sell'
1028
- * @param {float} amount how much of currency you want to trade in units of base currency
1031
+ * @param {float} amount how much you want to trade in units of the base currency
1029
1032
  * @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
1030
1033
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1034
+ * @param {float} [params.cost] for market buy orders, the quote quantity that can be used as an alternative for the amount
1031
1035
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1032
1036
  */
1033
- if (type === 'market') {
1034
- // for market buy it requires the amount of quote currency to spend
1035
- if (side === 'buy') {
1036
- if (this.options['createMarketBuyOrderRequiresPrice']) {
1037
- if (price === undefined) {
1038
- throw new errors.InvalidOrder(this.id + ' createOrder() requires the price argument with market buy orders to calculate total order cost (amount to spend), where cost = amount * price. Supply a price argument to createOrder() call if you want the cost to be calculated for you from price and amount, or, alternatively, add .options["createMarketBuyOrderRequiresPrice"] = false to supply the cost in the amount argument (the exchange-specific behaviour)');
1039
- }
1040
- else {
1041
- amount = amount * price;
1042
- }
1043
- }
1044
- }
1045
- }
1037
+ await this.loadMarkets();
1038
+ const market = this.market(symbol);
1046
1039
  let orderSide = undefined;
1047
1040
  if (side === 'buy') {
1048
1041
  orderSide = 'bid';
@@ -1053,26 +1046,43 @@ class upbit extends upbit$1 {
1053
1046
  else {
1054
1047
  throw new errors.InvalidOrder(this.id + ' createOrder() allows buy or sell side only!');
1055
1048
  }
1056
- await this.loadMarkets();
1057
- const market = this.market(symbol);
1058
1049
  const request = {
1059
1050
  'market': market['id'],
1060
1051
  'side': orderSide,
1061
1052
  };
1062
1053
  if (type === 'limit') {
1063
- request['volume'] = this.amountToPrecision(symbol, amount);
1064
1054
  request['price'] = this.priceToPrecision(symbol, price);
1065
- request['ord_type'] = type;
1066
1055
  }
1067
- else if (type === 'market') {
1068
- if (side === 'buy') {
1069
- request['ord_type'] = 'price';
1070
- request['price'] = this.priceToPrecision(symbol, amount);
1056
+ if ((type === 'market') && (side === 'buy')) {
1057
+ // for market buy it requires the amount of quote currency to spend
1058
+ let quoteAmount = undefined;
1059
+ let createMarketBuyOrderRequiresPrice = true;
1060
+ [createMarketBuyOrderRequiresPrice, params] = this.handleOptionAndParams(params, 'createOrder', 'createMarketBuyOrderRequiresPrice', true);
1061
+ const cost = this.safeNumber(params, 'cost');
1062
+ params = this.omit(params, 'cost');
1063
+ if (cost !== undefined) {
1064
+ quoteAmount = this.costToPrecision(symbol, cost);
1071
1065
  }
1072
- else if (side === 'sell') {
1073
- request['ord_type'] = type;
1074
- request['volume'] = this.amountToPrecision(symbol, amount);
1066
+ else if (createMarketBuyOrderRequiresPrice) {
1067
+ if (price === undefined) {
1068
+ 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');
1069
+ }
1070
+ else {
1071
+ const amountString = this.numberToString(amount);
1072
+ const priceString = this.numberToString(price);
1073
+ const costRequest = Precise["default"].stringMul(amountString, priceString);
1074
+ quoteAmount = this.costToPrecision(symbol, costRequest);
1075
+ }
1075
1076
  }
1077
+ else {
1078
+ quoteAmount = this.costToPrecision(symbol, amount);
1079
+ }
1080
+ request['ord_type'] = 'price';
1081
+ request['price'] = quoteAmount;
1082
+ }
1083
+ else {
1084
+ request['ord_type'] = type;
1085
+ request['volume'] = this.amountToPrecision(symbol, amount);
1076
1086
  }
1077
1087
  const clientOrderId = this.safeString2(params, 'clientOrderId', 'identifier');
1078
1088
  if (clientOrderId !== undefined) {
@@ -27,7 +27,6 @@ class wazirx extends wazirx$1 {
27
27
  'future': false,
28
28
  'option': false,
29
29
  'addMargin': false,
30
- 'borrowMargin': false,
31
30
  'cancelAllOrders': true,
32
31
  'cancelOrder': true,
33
32
  'closeAllPositions': false,
@@ -88,7 +87,6 @@ class wazirx extends wazirx$1 {
88
87
  'fetchTransfers': false,
89
88
  'fetchWithdrawals': false,
90
89
  'reduceMargin': false,
91
- 'repayMargin': false,
92
90
  'setLeverage': false,
93
91
  'setMargin': false,
94
92
  'setMarginMode': false,
@@ -28,7 +28,6 @@ class whitebit extends whitebit$1 {
28
28
  'swap': false,
29
29
  'future': false,
30
30
  'option': false,
31
- 'borrowMargin': false,
32
31
  'cancelAllOrders': false,
33
32
  'cancelOrder': true,
34
33
  'cancelOrders': false,
@@ -74,7 +73,6 @@ class whitebit extends whitebit$1 {
74
73
  'fetchTradingFee': false,
75
74
  'fetchTradingFees': true,
76
75
  'fetchTransactionFees': true,
77
- 'repayMargin': false,
78
76
  'setLeverage': true,
79
77
  'transfer': true,
80
78
  'withdraw': true,
@@ -31,7 +31,6 @@ class woo extends woo$1 {
31
31
  'future': false,
32
32
  'option': false,
33
33
  'addMargin': false,
34
- 'borrowMargin': false,
35
34
  'cancelAllOrders': true,
36
35
  'cancelOrder': true,
37
36
  'cancelWithdraw': false,
@@ -87,7 +86,6 @@ class woo extends woo$1 {
87
86
  'fetchTransfers': true,
88
87
  'fetchWithdrawals': true,
89
88
  'reduceMargin': false,
90
- 'repayMargin': true,
91
89
  'setLeverage': true,
92
90
  'setMargin': false,
93
91
  'transfer': true,