ccxt 4.3.17 → 4.3.19

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 (174) hide show
  1. package/README.md +7 -5
  2. package/dist/cjs/ccxt.js +6 -1
  3. package/dist/cjs/src/abstract/woofipro.js +9 -0
  4. package/dist/cjs/src/ascendex.js +3 -4
  5. package/dist/cjs/src/base/Exchange.js +43 -3
  6. package/dist/cjs/src/base/functions/crypto.js +10 -3
  7. package/dist/cjs/src/base/functions/encode.js +6 -3
  8. package/dist/cjs/src/base/functions/number.js +8 -5
  9. package/dist/cjs/src/base/functions/rsa.js +5 -5
  10. package/dist/cjs/src/bigone.js +1 -1
  11. package/dist/cjs/src/binance.js +32 -8
  12. package/dist/cjs/src/bitfinex.js +25 -1
  13. package/dist/cjs/src/bitfinex2.js +59 -51
  14. package/dist/cjs/src/bitget.js +1 -5
  15. package/dist/cjs/src/bitmart.js +3 -3
  16. package/dist/cjs/src/bitstamp.js +1 -3
  17. package/dist/cjs/src/bybit.js +1 -0
  18. package/dist/cjs/src/coinex.js +321 -537
  19. package/dist/cjs/src/coinlist.js +1 -2
  20. package/dist/cjs/src/deribit.js +1 -1
  21. package/dist/cjs/src/hollaex.js +3 -3
  22. package/dist/cjs/src/htx.js +1 -1
  23. package/dist/cjs/src/indodax.js +1 -1
  24. package/dist/cjs/src/latoken.js +1 -1
  25. package/dist/cjs/src/mexc.js +1 -1
  26. package/dist/cjs/src/novadax.js +0 -1
  27. package/dist/cjs/src/okx.js +17 -0
  28. package/dist/cjs/src/poloniex.js +1 -2
  29. package/dist/cjs/src/pro/bitget.js +136 -192
  30. package/dist/cjs/src/pro/bybit.js +4 -2
  31. package/dist/cjs/src/pro/coinbaseinternational.js +9 -1
  32. package/dist/cjs/src/pro/okx.js +85 -0
  33. package/dist/cjs/src/pro/woofipro.js +1263 -0
  34. package/dist/cjs/src/wavesexchange.js +2 -2
  35. package/dist/cjs/src/woo.js +17 -3
  36. package/dist/cjs/src/woofipro.js +2698 -0
  37. package/js/ccxt.d.ts +8 -2
  38. package/js/ccxt.js +6 -2
  39. package/js/src/abstract/bybit.d.ts +1 -0
  40. package/js/src/abstract/okx.d.ts +1 -0
  41. package/js/src/abstract/woofipro.d.ts +122 -0
  42. package/js/src/abstract/woofipro.js +11 -0
  43. package/js/src/ace.d.ts +2 -2
  44. package/js/src/ascendex.d.ts +5 -15
  45. package/js/src/ascendex.js +3 -4
  46. package/js/src/base/Exchange.d.ts +27 -18
  47. package/js/src/base/Exchange.js +43 -3
  48. package/js/src/base/functions/crypto.d.ts +1 -1
  49. package/js/src/base/functions/crypto.js +10 -3
  50. package/js/src/base/functions/encode.d.ts +1 -1
  51. package/js/src/base/functions/encode.js +6 -3
  52. package/js/src/base/functions/number.d.ts +1 -1
  53. package/js/src/base/functions/number.js +8 -5
  54. package/js/src/base/functions/rsa.js +6 -6
  55. package/js/src/base/types.d.ts +4 -0
  56. package/js/src/bigone.d.ts +4 -14
  57. package/js/src/bigone.js +1 -1
  58. package/js/src/binance.d.ts +13 -71
  59. package/js/src/binance.js +32 -8
  60. package/js/src/binancecoinm.d.ts +2 -22
  61. package/js/src/binanceusdm.d.ts +2 -22
  62. package/js/src/bingx.d.ts +4 -14
  63. package/js/src/bit2c.d.ts +2 -2
  64. package/js/src/bitbank.d.ts +2 -2
  65. package/js/src/bitbns.d.ts +2 -2
  66. package/js/src/bitfinex.d.ts +6 -16
  67. package/js/src/bitfinex.js +25 -1
  68. package/js/src/bitfinex2.d.ts +6 -16
  69. package/js/src/bitfinex2.js +59 -51
  70. package/js/src/bitflyer.d.ts +2 -2
  71. package/js/src/bitget.d.ts +7 -17
  72. package/js/src/bitget.js +1 -5
  73. package/js/src/bithumb.d.ts +3 -3
  74. package/js/src/bitmart.d.ts +5 -14
  75. package/js/src/bitmart.js +3 -3
  76. package/js/src/bitmex.d.ts +4 -4
  77. package/js/src/bitopro.d.ts +2 -2
  78. package/js/src/bitrue.d.ts +5 -5
  79. package/js/src/bitso.d.ts +2 -2
  80. package/js/src/bitstamp.d.ts +3 -3
  81. package/js/src/bitstamp.js +1 -3
  82. package/js/src/bitteam.d.ts +2 -2
  83. package/js/src/bitvavo.d.ts +5 -5
  84. package/js/src/bl3p.d.ts +2 -2
  85. package/js/src/blockchaincom.d.ts +2 -2
  86. package/js/src/blofin.d.ts +4 -14
  87. package/js/src/btcalpha.d.ts +2 -2
  88. package/js/src/btcbox.d.ts +2 -2
  89. package/js/src/btcmarkets.d.ts +2 -2
  90. package/js/src/btcturk.d.ts +2 -2
  91. package/js/src/bybit.d.ts +8 -56
  92. package/js/src/bybit.js +1 -0
  93. package/js/src/cex.d.ts +2 -2
  94. package/js/src/coinbase.d.ts +4 -4
  95. package/js/src/coinbasepro.d.ts +3 -3
  96. package/js/src/coincheck.d.ts +2 -2
  97. package/js/src/coinex.d.ts +6 -16
  98. package/js/src/coinex.js +321 -537
  99. package/js/src/coinlist.d.ts +5 -15
  100. package/js/src/coinlist.js +1 -2
  101. package/js/src/coinmate.d.ts +2 -2
  102. package/js/src/coinmetro.d.ts +3 -3
  103. package/js/src/coinone.d.ts +2 -2
  104. package/js/src/coinsph.d.ts +2 -2
  105. package/js/src/coinspot.d.ts +2 -2
  106. package/js/src/cryptocom.d.ts +2 -2
  107. package/js/src/currencycom.d.ts +3 -3
  108. package/js/src/delta.d.ts +5 -43
  109. package/js/src/deribit.d.ts +7 -55
  110. package/js/src/deribit.js +1 -1
  111. package/js/src/digifinex.d.ts +5 -15
  112. package/js/src/exmo.d.ts +2 -2
  113. package/js/src/gate.d.ts +6 -54
  114. package/js/src/gemini.d.ts +2 -2
  115. package/js/src/hitbtc.d.ts +4 -14
  116. package/js/src/hollaex.d.ts +3 -3
  117. package/js/src/hollaex.js +3 -3
  118. package/js/src/htx.d.ts +6 -16
  119. package/js/src/htx.js +1 -1
  120. package/js/src/huobijp.d.ts +4 -4
  121. package/js/src/hyperliquid.d.ts +1 -1
  122. package/js/src/idex.d.ts +3 -3
  123. package/js/src/independentreserve.d.ts +2 -2
  124. package/js/src/indodax.d.ts +2 -2
  125. package/js/src/indodax.js +1 -1
  126. package/js/src/kraken.d.ts +4 -14
  127. package/js/src/krakenfutures.d.ts +4 -14
  128. package/js/src/kucoin.d.ts +5 -15
  129. package/js/src/kucoinfutures.d.ts +4 -14
  130. package/js/src/kuna.d.ts +2 -2
  131. package/js/src/latoken.d.ts +5 -15
  132. package/js/src/latoken.js +1 -1
  133. package/js/src/lbank.d.ts +2 -2
  134. package/js/src/luno.d.ts +2 -2
  135. package/js/src/lykke.d.ts +2 -2
  136. package/js/src/mercado.d.ts +2 -2
  137. package/js/src/mexc.d.ts +8 -28
  138. package/js/src/mexc.js +1 -1
  139. package/js/src/ndax.d.ts +2 -2
  140. package/js/src/novadax.d.ts +4 -15
  141. package/js/src/novadax.js +0 -1
  142. package/js/src/okcoin.d.ts +4 -14
  143. package/js/src/okx.d.ts +10 -68
  144. package/js/src/okx.js +17 -0
  145. package/js/src/onetrading.d.ts +2 -2
  146. package/js/src/paymium.d.ts +4 -14
  147. package/js/src/phemex.d.ts +5 -15
  148. package/js/src/poloniex.d.ts +3 -13
  149. package/js/src/poloniex.js +1 -2
  150. package/js/src/poloniexfutures.d.ts +2 -2
  151. package/js/src/pro/bitget.js +137 -193
  152. package/js/src/pro/bybit.js +4 -2
  153. package/js/src/pro/coinbaseinternational.d.ts +3 -3
  154. package/js/src/pro/coinbaseinternational.js +9 -1
  155. package/js/src/pro/okx.d.ts +4 -1
  156. package/js/src/pro/okx.js +85 -0
  157. package/js/src/pro/woofipro.d.ts +47 -0
  158. package/js/src/pro/woofipro.js +1264 -0
  159. package/js/src/probit.d.ts +3 -3
  160. package/js/src/timex.d.ts +2 -2
  161. package/js/src/tokocrypto.d.ts +3 -3
  162. package/js/src/upbit.d.ts +2 -2
  163. package/js/src/wavesexchange.d.ts +3 -3
  164. package/js/src/wavesexchange.js +2 -2
  165. package/js/src/wazirx.d.ts +2 -2
  166. package/js/src/whitebit.d.ts +3 -13
  167. package/js/src/woo.d.ts +7 -17
  168. package/js/src/woo.js +17 -3
  169. package/js/src/woofipro.d.ts +131 -0
  170. package/js/src/woofipro.js +2699 -0
  171. package/js/src/yobit.d.ts +2 -2
  172. package/js/src/zaif.d.ts +2 -2
  173. package/js/src/zonda.d.ts +4 -14
  174. package/package.json +1 -1
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # CCXT – CryptoCurrency eXchange Trading Library
2
2
 
3
- [![Build Status](https://travis-ci.com/ccxt/ccxt.svg?branch=master)](https://travis-ci.com/ccxt/ccxt) [![npm](https://img.shields.io/npm/v/ccxt.svg)](https://npmjs.com/package/ccxt) [![PyPI](https://img.shields.io/pypi/v/ccxt.svg)](https://pypi.python.org/pypi/ccxt) [![NPM Downloads](https://img.shields.io/npm/dy/ccxt.svg)](https://www.npmjs.com/package/ccxt) [![Discord](https://img.shields.io/discord/690203284119617602?logo=discord&logoColor=white)](https://discord.gg/ccxt) [![Supported Exchanges](https://img.shields.io/badge/exchanges-103-blue.svg)](https://github.com/ccxt/ccxt/wiki/Exchange-Markets) [![Twitter Follow](https://img.shields.io/twitter/follow/ccxt_official.svg?style=social&label=CCXT)](https://twitter.com/ccxt_official)
3
+ [![Build Status](https://travis-ci.com/ccxt/ccxt.svg?branch=master)](https://travis-ci.com/ccxt/ccxt) [![npm](https://img.shields.io/npm/v/ccxt.svg)](https://npmjs.com/package/ccxt) [![PyPI](https://img.shields.io/pypi/v/ccxt.svg)](https://pypi.python.org/pypi/ccxt) [![NPM Downloads](https://img.shields.io/npm/dy/ccxt.svg)](https://www.npmjs.com/package/ccxt) [![Discord](https://img.shields.io/discord/690203284119617602?logo=discord&logoColor=white)](https://discord.gg/ccxt) [![Supported Exchanges](https://img.shields.io/badge/exchanges-104-blue.svg)](https://github.com/ccxt/ccxt/wiki/Exchange-Markets) [![Twitter Follow](https://img.shields.io/twitter/follow/ccxt_official.svg?style=social&label=CCXT)](https://twitter.com/ccxt_official)
4
4
 
5
5
  A JavaScript / Python / PHP / C# library for cryptocurrency trading and e-commerce with support for many bitcoin/ether/altcoin exchange markets and merchant APIs.
6
6
 
@@ -52,10 +52,11 @@ Current feature list:
52
52
  | [![mexc](https://user-images.githubusercontent.com/1294454/137283979-8b2a818d-8633-461b-bfca-de89e8c446b2.jpg)](https://m.mexc.com/auth/signup?inviteCode=1FQ1G) | mexc | [MEXC Global](https://m.mexc.com/auth/signup?inviteCode=1FQ1G) | [![API Version 3](https://img.shields.io/badge/3-lightgray)](https://mexcdevelop.github.io/apidocs/) | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | |
53
53
  | [![okx](https://user-images.githubusercontent.com/1294454/152485636-38b19e4a-bece-4dec-979a-5982859ffc04.jpg)](https://www.okx.com/join/CCXT2023) | okx | [OKX](https://www.okx.com/join/CCXT2023) | [![API Version 5](https://img.shields.io/badge/5-lightgray)](https://www.okx.com/docs-v5/en/) | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | [![Sign up with OKX using CCXT's referral link for a 20% discount!](https://img.shields.io/static/v1?label=Fee&message=%2d20%25&color=orange)](https://www.okx.com/join/CCXT2023) |
54
54
  | [![woo](https://user-images.githubusercontent.com/1294454/150730761-1a00e5e0-d28c-480f-9e65-089ce3e6ef3b.jpg)](https://x.woo.org/register?ref=YWOWC96B) | woo | [WOO X](https://x.woo.org/register?ref=YWOWC96B) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://docs.woo.org/) | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | [![Sign up with WOO X using CCXT's referral link for a 35% discount!](https://img.shields.io/static/v1?label=Fee&message=%2d35%25&color=orange)](https://x.woo.org/register?ref=YWOWC96B) |
55
+ | [![woofipro](https://github.com/ccxt/ccxt/assets/43336371/b1e7b348-a0fc-4605-8b7f-91176958fd69)](https://dex.woo.org/en/trade?ref=CCXT) | woofipro | [WOOFI PRO](https://dex.woo.org/en/trade?ref=CCXT) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://orderly.network/docs/build-on-evm/building-on-evm) | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | [![Sign up with WOOFI PRO using CCXT's referral link for a 5% discount!](https://img.shields.io/static/v1?label=Fee&message=%2d5%25&color=orange)](https://dex.woo.org/en/trade?ref=CCXT) |
55
56
 
56
57
  ## Supported Cryptocurrency Exchanges
57
58
 
58
- The CCXT library currently supports the following 97 cryptocurrency exchange markets and trading APIs:
59
+ The CCXT library currently supports the following 98 cryptocurrency exchange markets and trading APIs:
59
60
 
60
61
  | logo | id | name | ver | certified | pro |
61
62
  |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------|-------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------:|-----------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------|
@@ -153,6 +154,7 @@ The CCXT library currently supports the following 97 cryptocurrency exchange mar
153
154
  | [![wazirx](https://user-images.githubusercontent.com/1294454/148647666-c109c20b-f8ac-472f-91c3-5f658cb90f49.jpeg)](https://wazirx.com/invite/k7rrnks5) | wazirx | [WazirX](https://wazirx.com/invite/k7rrnks5) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://docs.wazirx.com/#public-rest-api-for-wazirx) | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) |
154
155
  | [![whitebit](https://user-images.githubusercontent.com/1294454/66732963-8eb7dd00-ee66-11e9-849b-10d9282bb9e0.jpg)](https://whitebit.com/referral/d9bdf40e-28f2-4b52-b2f9-cd1415d82963) | whitebit | [WhiteBit](https://whitebit.com/referral/d9bdf40e-28f2-4b52-b2f9-cd1415d82963) | [![API Version 4](https://img.shields.io/badge/4-lightgray)](https://github.com/whitebit-exchange/api-docs) | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) |
155
156
  | [![woo](https://user-images.githubusercontent.com/1294454/150730761-1a00e5e0-d28c-480f-9e65-089ce3e6ef3b.jpg)](https://x.woo.org/register?ref=YWOWC96B) | woo | [WOO X](https://x.woo.org/register?ref=YWOWC96B) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://docs.woo.org/) | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) |
157
+ | [![woofipro](https://github.com/ccxt/ccxt/assets/43336371/b1e7b348-a0fc-4605-8b7f-91176958fd69)](https://dex.woo.org/en/trade?ref=CCXT) | woofipro | [WOOFI PRO](https://dex.woo.org/en/trade?ref=CCXT) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://orderly.network/docs/build-on-evm/building-on-evm) | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) |
156
158
  | [![yobit](https://user-images.githubusercontent.com/1294454/27766910-cdcbfdae-5eea-11e7-9859-03fea873272d.jpg)](https://www.yobit.net) | yobit | [YoBit](https://www.yobit.net) | [![API Version 3](https://img.shields.io/badge/3-lightgray)](https://www.yobit.net/en/api/) | | |
157
159
  | [![zaif](https://user-images.githubusercontent.com/1294454/27766927-39ca2ada-5eeb-11e7-972f-1b4199518ca6.jpg)](https://zaif.jp) | zaif | [Zaif](https://zaif.jp) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://techbureau-api-document.readthedocs.io/ja/latest/index.html) | | |
158
160
  | [![zonda](https://user-images.githubusercontent.com/1294454/159202310-a0e38007-5e7c-4ba9-a32f-c8263a0291fe.jpg)](https://auth.zondaglobal.com/ref/jHlbB4mIkdS1) | zonda | [Zonda](https://auth.zondaglobal.com/ref/jHlbB4mIkdS1) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://docs.zondacrypto.exchange/) | | |
@@ -213,13 +215,13 @@ console.log(version, Object.keys(exchanges));
213
215
 
214
216
  All-in-one browser bundle (dependencies included), served from a CDN of your choice:
215
217
 
216
- * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.3.17/dist/ccxt.browser.js
217
- * unpkg: https://unpkg.com/ccxt@4.3.17/dist/ccxt.browser.js
218
+ * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.3.19/dist/ccxt.browser.js
219
+ * unpkg: https://unpkg.com/ccxt@4.3.19/dist/ccxt.browser.js
218
220
 
219
221
  CDNs are not updated in real-time and may have delays. Defaulting to the most recent version without specifying the version number is not recommended. Please, keep in mind that we are not responsible for the correct operation of those CDN servers.
220
222
 
221
223
  ```HTML
222
- <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.3.17/dist/ccxt.browser.js"></script>
224
+ <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.3.19/dist/ccxt.browser.js"></script>
223
225
  ```
224
226
 
225
227
  Creates a global `ccxt` object:
package/dist/cjs/ccxt.js CHANGED
@@ -112,6 +112,7 @@ var wavesexchange = require('./src/wavesexchange.js');
112
112
  var wazirx = require('./src/wazirx.js');
113
113
  var whitebit = require('./src/whitebit.js');
114
114
  var woo = require('./src/woo.js');
115
+ var woofipro = require('./src/woofipro.js');
115
116
  var yobit = require('./src/yobit.js');
116
117
  var zaif = require('./src/zaif.js');
117
118
  var zonda = require('./src/zonda.js');
@@ -179,10 +180,11 @@ var upbit$1 = require('./src/pro/upbit.js');
179
180
  var wazirx$1 = require('./src/pro/wazirx.js');
180
181
  var whitebit$1 = require('./src/pro/whitebit.js');
181
182
  var woo$1 = require('./src/pro/woo.js');
183
+ var woofipro$1 = require('./src/pro/woofipro.js');
182
184
 
183
185
  //-----------------------------------------------------------------------------
184
186
  // this is updated by vss.js when building
185
- const version = '4.3.17';
187
+ const version = '4.3.19';
186
188
  Exchange["default"].ccxtVersion = version;
187
189
  const exchanges = {
188
190
  'ace': ace,
@@ -285,6 +287,7 @@ const exchanges = {
285
287
  'wazirx': wazirx,
286
288
  'whitebit': whitebit,
287
289
  'woo': woo,
290
+ 'woofipro': woofipro,
288
291
  'yobit': yobit,
289
292
  'zaif': zaif,
290
293
  'zonda': zonda,
@@ -354,6 +357,7 @@ const pro = {
354
357
  'wazirx': wazirx$1,
355
358
  'whitebit': whitebit$1,
356
359
  'woo': woo$1,
360
+ 'woofipro': woofipro$1,
357
361
  };
358
362
  pro.exchanges = Object.keys(pro);
359
363
  pro['Exchange'] = Exchange["default"]; // now the same for rest and ts
@@ -502,6 +506,7 @@ exports.wavesexchange = wavesexchange;
502
506
  exports.wazirx = wazirx;
503
507
  exports.whitebit = whitebit;
504
508
  exports.woo = woo;
509
+ exports.woofipro = woofipro;
505
510
  exports.yobit = yobit;
506
511
  exports.zaif = zaif;
507
512
  exports.zonda = zonda;
@@ -0,0 +1,9 @@
1
+ 'use strict';
2
+
3
+ var Exchange$1 = require('../base/Exchange.js');
4
+
5
+ // -------------------------------------------------------------------------------
6
+ class Exchange extends Exchange$1["default"] {
7
+ }
8
+
9
+ module.exports = Exchange;
@@ -3162,7 +3162,6 @@ class ascendex extends ascendex$1 {
3162
3162
  const account = this.safeValue(this.accounts, 0, {});
3163
3163
  const accountGroup = this.safeString(account, 'id');
3164
3164
  const currency = this.currency(code);
3165
- amount = this.currencyToPrecision(code, amount);
3166
3165
  const accountsByType = this.safeValue(this.options, 'accountsByType', {});
3167
3166
  const fromId = this.safeString(accountsByType, fromAccount, fromAccount);
3168
3167
  const toId = this.safeString(accountsByType, toAccount, toAccount);
@@ -3171,7 +3170,7 @@ class ascendex extends ascendex$1 {
3171
3170
  }
3172
3171
  const request = {
3173
3172
  'account-group': accountGroup,
3174
- 'amount': amount,
3173
+ 'amount': this.currencyToPrecision(code, amount),
3175
3174
  'asset': currency['id'],
3176
3175
  'fromAccount': fromId,
3177
3176
  'toAccount': toId,
@@ -3195,7 +3194,7 @@ class ascendex extends ascendex$1 {
3195
3194
  //
3196
3195
  // { "code": "0" }
3197
3196
  //
3198
- const status = this.safeInteger(transfer, 'code');
3197
+ const status = this.safeString(transfer, 'code');
3199
3198
  const currencyCode = this.safeCurrencyCode(undefined, currency);
3200
3199
  return {
3201
3200
  'info': transfer,
@@ -3210,7 +3209,7 @@ class ascendex extends ascendex$1 {
3210
3209
  };
3211
3210
  }
3212
3211
  parseTransferStatus(status) {
3213
- if (status === 0) {
3212
+ if (status === '0') {
3214
3213
  return 'ok';
3215
3214
  }
3216
3215
  return 'failed';
@@ -44,7 +44,7 @@ function _interopNamespace(e) {
44
44
  }
45
45
 
46
46
  // ----------------------------------------------------------------------------
47
- const { isNode, deepExtend, extend, clone, flatten, unique, indexBy, sortBy, sortBy2, safeFloat2, groupBy, aggregate, uuid, unCamelCase, precisionFromString, Throttler, capitalize, now, decimalToPrecision, safeValue, safeValue2, safeString, safeString2, seconds, milliseconds, binaryToBase16, numberToBE, base16ToBinary, iso8601, omit, isJsonEncodedObject, safeInteger, sum, omitZero, implodeParams, extractParams, json, merge, binaryConcat, hash, ecdsa, arrayConcat, encode, urlencode, hmac, numberToString, parseTimeframe, safeInteger2, safeStringLower, parse8601, yyyymmdd, safeStringUpper, safeTimestamp, binaryConcatArray, uuidv1, numberToLE, ymdhms, stringToBase64, decode, uuid22, safeIntegerProduct2, safeIntegerProduct, safeStringLower2, yymmdd, base58ToBinary, binaryToBase58, safeTimestamp2, rawencode, keysort, inArray, isEmpty, ordered, filterBy, uuid16, safeFloat, base64ToBinary, safeStringUpper2, urlencodeWithArrayRepeat, microseconds, binaryToBase64, strip, toArray, safeFloatN, safeIntegerN, safeIntegerProductN, safeTimestampN, safeValueN, safeStringN, safeStringLowerN, safeStringUpperN, urlencodeNested, parseDate, ymd, base64ToString, crc32, packb, TRUNCATE, ROUND, DECIMAL_PLACES, NO_PADDING, TICK_SIZE, SIGNIFICANT_DIGITS } = functions;
47
+ const { isNode, deepExtend, extend, clone, flatten, unique, indexBy, sortBy, sortBy2, safeFloat2, groupBy, aggregate, uuid, unCamelCase, precisionFromString, Throttler, capitalize, now, decimalToPrecision, safeValue, safeValue2, safeString, safeString2, seconds, milliseconds, binaryToBase16, numberToBE, base16ToBinary, iso8601, omit, isJsonEncodedObject, safeInteger, sum, omitZero, implodeParams, extractParams, json, merge, binaryConcat, hash, ecdsa, arrayConcat, encode, urlencode, hmac, numberToString, parseTimeframe, safeInteger2, safeStringLower, parse8601, yyyymmdd, safeStringUpper, safeTimestamp, binaryConcatArray, uuidv1, numberToLE, ymdhms, stringToBase64, decode, uuid22, safeIntegerProduct2, safeIntegerProduct, safeStringLower2, yymmdd, base58ToBinary, binaryToBase58, safeTimestamp2, rawencode, keysort, inArray, isEmpty, ordered, filterBy, uuid16, safeFloat, base64ToBinary, safeStringUpper2, urlencodeWithArrayRepeat, microseconds, binaryToBase64, strip, toArray, safeFloatN, safeIntegerN, safeIntegerProductN, safeTimestampN, safeValueN, safeStringN, safeStringLowerN, safeStringUpperN, urlencodeNested, urlencodeBase64, parseDate, ymd, base64ToString, crc32, packb, TRUNCATE, ROUND, DECIMAL_PLACES, NO_PADDING, TICK_SIZE, SIGNIFICANT_DIGITS } = functions;
48
48
  // ----------------------------------------------------------------------------
49
49
  /**
50
50
  * @class Exchange
@@ -83,6 +83,7 @@ class Exchange {
83
83
  this.balance = {};
84
84
  this.orderbooks = {};
85
85
  this.tickers = {};
86
+ this.fundingRates = {};
86
87
  this.bidsasks = {};
87
88
  this.orders = undefined;
88
89
  this.triggerOrders = undefined;
@@ -232,6 +233,7 @@ class Exchange {
232
233
  this.base64ToString = base64ToString;
233
234
  this.crc32 = crc32;
234
235
  this.packb = packb;
236
+ this.urlencodeBase64 = urlencodeBase64;
235
237
  this.httpProxyAgentModule = undefined;
236
238
  this.httpsProxyAgentModule = undefined;
237
239
  this.socksProxyAgentModule = undefined;
@@ -586,6 +588,7 @@ class Exchange {
586
588
  'apiKey': true,
587
589
  'secret': true,
588
590
  'uid': false,
591
+ 'accountId': false,
589
592
  'login': false,
590
593
  'password': false,
591
594
  'twofa': false,
@@ -2158,6 +2161,13 @@ class Exchange {
2158
2161
  const res = this.parseToNumeric((value % 1));
2159
2162
  return res === 0;
2160
2163
  }
2164
+ safeIntegerOmitZero(obj, key, defaultValue = undefined) {
2165
+ const timestamp = this.safeInteger(obj, key, defaultValue);
2166
+ if (timestamp === undefined || timestamp === 0) {
2167
+ return undefined;
2168
+ }
2169
+ return timestamp;
2170
+ }
2161
2171
  afterConstruct() {
2162
2172
  this.createNetworksByIdObject();
2163
2173
  }
@@ -3383,7 +3393,7 @@ class Exchange {
3383
3393
  }
3384
3394
  return networkId;
3385
3395
  }
3386
- networkIdToCode(networkId, currencyCode = undefined) {
3396
+ networkIdToCode(networkId = undefined, currencyCode = undefined) {
3387
3397
  /**
3388
3398
  * @ignore
3389
3399
  * @method
@@ -5246,6 +5256,7 @@ class Exchange {
5246
5256
  //
5247
5257
  // the value of tickers is either a dict or a list
5248
5258
  //
5259
+ //
5249
5260
  // dict
5250
5261
  //
5251
5262
  // {
@@ -5340,13 +5351,17 @@ class Exchange {
5340
5351
  }
5341
5352
  return result;
5342
5353
  }
5343
- isTriggerOrder(params) {
5354
+ handleTriggerAndParams(params) {
5344
5355
  const isTrigger = this.safeBool2(params, 'trigger', 'stop');
5345
5356
  if (isTrigger) {
5346
5357
  params = this.omit(params, ['trigger', 'stop']);
5347
5358
  }
5348
5359
  return [isTrigger, params];
5349
5360
  }
5361
+ isTriggerOrder(params) {
5362
+ // for backwards compatibility
5363
+ return this.handleTriggerAndParams(params);
5364
+ }
5350
5365
  isPostOnly(isMarketOrder, exchangeSpecificParam, params = {}) {
5351
5366
  /**
5352
5367
  * @ignore
@@ -6298,6 +6313,31 @@ class Exchange {
6298
6313
  }
6299
6314
  return marginModifications;
6300
6315
  }
6316
+ async fetchTransfer(id, code = undefined, params = {}) {
6317
+ /**
6318
+ * @method
6319
+ * @name exchange#fetchTransfer
6320
+ * @description fetches a transfer
6321
+ * @param {string} id transfer id
6322
+ * @param {[string]} code unified currency code
6323
+ * @param {object} params extra parameters specific to the exchange api endpoint
6324
+ * @returns {object} a [transfer structure]{@link https://docs.ccxt.com/#/?id=transfer-structure}
6325
+ */
6326
+ throw new errors.NotSupported(this.id + ' fetchTransfer () is not supported yet');
6327
+ }
6328
+ async fetchTransfers(code = undefined, since = undefined, limit = undefined, params = {}) {
6329
+ /**
6330
+ * @method
6331
+ * @name exchange#fetchTransfer
6332
+ * @description fetches a transfer
6333
+ * @param {string} id transfer id
6334
+ * @param {int} [since] timestamp in ms of the earliest transfer to fetch
6335
+ * @param {int} [limit] the maximum amount of transfers to fetch
6336
+ * @param {object} params extra parameters specific to the exchange api endpoint
6337
+ * @returns {object} a [transfer structure]{@link https://docs.ccxt.com/#/?id=transfer-structure}
6338
+ */
6339
+ throw new errors.NotSupported(this.id + ' fetchTransfers () is not supported yet');
6340
+ }
6301
6341
  }
6302
6342
 
6303
6343
  exports.Exchange = Exchange;
@@ -91,9 +91,16 @@ function axolotl(request, secret, curve) {
91
91
  return index.base58.encode(signature);
92
92
  }
93
93
  function eddsa(request, secret, curve) {
94
- // secret is the base64 pem encoded key
95
- // we get the last 32 bytes
96
- const privateKey = new Uint8Array(base64.Base64.unarmor(secret).slice(16));
94
+ let privateKey = undefined;
95
+ if (secret.length === 32) {
96
+ // ed25519 secret is 32 bytes
97
+ privateKey = secret;
98
+ }
99
+ else if (typeof secret === 'string') {
100
+ // secret is the base64 pem encoded key
101
+ // we get the last 32 bytes
102
+ privateKey = new Uint8Array(base64.Base64.unarmor(secret).slice(16));
103
+ }
97
104
  const signature = curve.sign(request, privateKey);
98
105
  return index.base64.encode(signature);
99
106
  }
@@ -15,9 +15,12 @@ const json = (data, params = undefined) => JSON.stringify(data), isJsonEncodedOb
15
15
  , urlencodeWithArrayRepeat = (object) => index$1.stringify(object, { arrayFormat: 'repeat' }), rawencode = (object) => index$1.stringify(object, { encode: false }), encode = index.utf8.decode // lol
16
16
  , decode = index.utf8.encode
17
17
  // Url-safe-base64 without equals signs, with + replaced by - and slashes replaced by underscores
18
- , urlencodeBase64 = (base64string) => base64string.replace(/[=]+$/, '')
19
- .replace(/\+/g, '-')
20
- .replace(/\//g, '_'), numberToLE = (n, padding) => utils.numberToBytesLE(BigInt(n), padding), numberToBE = (n, padding) => utils.numberToBytesBE(BigInt(n), padding);
18
+ , urlencodeBase64 = (payload) => {
19
+ const payload64 = (typeof payload === 'string') ? stringToBase64(payload) : binaryToBase64(payload);
20
+ return payload64.replace(/[=]+$/, '')
21
+ .replace(/\+/g, '-')
22
+ .replace(/\//g, '_');
23
+ }, numberToLE = (n, padding) => utils.numberToBytesLE(BigInt(n), padding), numberToBE = (n, padding) => utils.numberToBytesBE(BigInt(n), padding);
21
24
  function packb(req) {
22
25
  return msgpack.serialize(req);
23
26
  }
@@ -96,6 +96,9 @@ function precisionFromString(str) {
96
96
  }
97
97
  /* ------------------------------------------------------------------------ */
98
98
  const decimalToPrecision = (x, roundingMode, numPrecisionDigits, countingMode = DECIMAL_PLACES, paddingMode = NO_PADDING) => {
99
+ return _decimalToPrecision(x, roundingMode, numPrecisionDigits, countingMode, paddingMode);
100
+ };
101
+ const _decimalToPrecision = (x, roundingMode, numPrecisionDigits, countingMode = DECIMAL_PLACES, paddingMode = NO_PADDING) => {
99
102
  if (countingMode === TICK_SIZE) {
100
103
  if (typeof numPrecisionDigits === 'string') {
101
104
  numPrecisionDigits = parseFloat(numPrecisionDigits);
@@ -107,7 +110,7 @@ const decimalToPrecision = (x, roundingMode, numPrecisionDigits, countingMode =
107
110
  if (numPrecisionDigits < 0) {
108
111
  const toNearest = Math.pow(10, -numPrecisionDigits);
109
112
  if (roundingMode === ROUND) {
110
- return (toNearest * decimalToPrecision(x / toNearest, roundingMode, 0, countingMode, paddingMode)).toString();
113
+ return (toNearest * _decimalToPrecision(x / toNearest, roundingMode, 0, countingMode, paddingMode)).toString();
111
114
  }
112
115
  if (roundingMode === TRUNCATE) {
113
116
  return (x - (x % toNearest)).toString();
@@ -115,12 +118,12 @@ const decimalToPrecision = (x, roundingMode, numPrecisionDigits, countingMode =
115
118
  }
116
119
  /* handle tick size */
117
120
  if (countingMode === TICK_SIZE) {
118
- const precisionDigitsString = decimalToPrecision(numPrecisionDigits, ROUND, 22, DECIMAL_PLACES, NO_PADDING);
121
+ const precisionDigitsString = _decimalToPrecision(numPrecisionDigits, ROUND, 22, DECIMAL_PLACES, NO_PADDING);
119
122
  const newNumPrecisionDigits = precisionFromString(precisionDigitsString);
120
123
  let missing = x % numPrecisionDigits;
121
124
  // See: https://github.com/ccxt/ccxt/pull/6486
122
- missing = Number(decimalToPrecision(missing, ROUND, 8, DECIMAL_PLACES, NO_PADDING));
123
- const fpError = decimalToPrecision(missing / numPrecisionDigits, ROUND, Math.max(newNumPrecisionDigits, 8), DECIMAL_PLACES, NO_PADDING);
125
+ missing = Number(_decimalToPrecision(missing, ROUND, 8, DECIMAL_PLACES, NO_PADDING));
126
+ const fpError = _decimalToPrecision(missing / numPrecisionDigits, ROUND, Math.max(newNumPrecisionDigits, 8), DECIMAL_PLACES, NO_PADDING);
124
127
  if (precisionFromString(fpError) !== 0) {
125
128
  if (roundingMode === ROUND) {
126
129
  if (x > 0) {
@@ -144,7 +147,7 @@ const decimalToPrecision = (x, roundingMode, numPrecisionDigits, countingMode =
144
147
  x = x - missing;
145
148
  }
146
149
  }
147
- return decimalToPrecision(x, ROUND, newNumPrecisionDigits, DECIMAL_PLACES, paddingMode);
150
+ return _decimalToPrecision(x, ROUND, newNumPrecisionDigits, DECIMAL_PLACES, paddingMode);
148
151
  }
149
152
  /* Convert to a string (if needed), skip leading minus sign (if any) */
150
153
  const str = numberToString(x);
@@ -25,22 +25,22 @@ function jwt(request, secret, hash, isRSA = false, opts = {}) {
25
25
  request['iat'] = header['iat'];
26
26
  delete header['iat'];
27
27
  }
28
- const encodedHeader = encode.urlencodeBase64(encode.stringToBase64(JSON.stringify(header)));
29
- const encodedData = encode.urlencodeBase64(encode.stringToBase64(JSON.stringify(request)));
28
+ const encodedHeader = encode.urlencodeBase64(JSON.stringify(header));
29
+ const encodedData = encode.urlencodeBase64(JSON.stringify(request));
30
30
  const token = [encodedHeader, encodedData].join('.');
31
31
  const algoType = alg.slice(0, 2);
32
32
  let signature = undefined;
33
33
  if (algoType === 'HS') {
34
- signature = encode.urlencodeBase64(crypto.hmac(token, secret, hash, 'base64'));
34
+ signature = encode.urlencodeBase64(crypto.hmac(token, secret, hash, 'binary'));
35
35
  }
36
36
  else if (isRSA || algoType === 'RS') {
37
- signature = encode.urlencodeBase64(rsa(token, index.utf8.encode(secret), hash));
37
+ signature = encode.urlencodeBase64(encode.base64ToBinary(rsa(token, index.utf8.encode(secret), hash)));
38
38
  }
39
39
  else if (algoType === 'ES') {
40
40
  const signedHash = crypto.ecdsa(token, index.utf8.encode(secret), p256.P256, hash);
41
41
  const r = signedHash.r.padStart(64, '0');
42
42
  const s = signedHash.s.padStart(64, '0');
43
- signature = encode.urlencodeBase64(encode.binaryToBase64(encode.base16ToBinary(r + s)));
43
+ signature = encode.urlencodeBase64(encode.base16ToBinary(r + s));
44
44
  }
45
45
  return [token, signature].join('.');
46
46
  }
@@ -2140,7 +2140,7 @@ class bigone extends bigone$1 {
2140
2140
  // "data": null
2141
2141
  // }
2142
2142
  //
2143
- const code = this.safeNumber(transfer, 'code');
2143
+ const code = this.safeString(transfer, 'code');
2144
2144
  return {
2145
2145
  'info': transfer,
2146
2146
  'id': undefined,
@@ -5747,6 +5747,7 @@ class binance extends binance$1 {
5747
5747
  * @param {float} [params.stopLossPrice] the price that a stop loss order is triggered at
5748
5748
  * @param {float} [params.takeProfitPrice] the price that a take profit order is triggered at
5749
5749
  * @param {boolean} [params.portfolioMargin] set to true if you would like to create an order in a portfolio margin account
5750
+ * @param {string} [params.stopLossOrTakeProfit] 'stopLoss' or 'takeProfit', required for spot trailing orders
5750
5751
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
5751
5752
  */
5752
5753
  await this.loadMarkets();
@@ -5872,8 +5873,8 @@ class binance extends binance$1 {
5872
5873
  const stopLossPrice = this.safeString(params, 'stopLossPrice', triggerPrice); // fallback to stopLoss
5873
5874
  const takeProfitPrice = this.safeString(params, 'takeProfitPrice');
5874
5875
  const trailingDelta = this.safeString(params, 'trailingDelta');
5875
- const trailingTriggerPrice = this.safeString2(params, 'trailingTriggerPrice', 'activationPrice', this.numberToString(price));
5876
- const trailingPercent = this.safeString2(params, 'trailingPercent', 'callbackRate');
5876
+ const trailingTriggerPrice = this.safeString2(params, 'trailingTriggerPrice', 'activationPrice');
5877
+ const trailingPercent = this.safeStringN(params, ['trailingPercent', 'callbackRate', 'trailingDelta']);
5877
5878
  const priceMatch = this.safeString(params, 'priceMatch');
5878
5879
  const isTrailingPercentOrder = trailingPercent !== undefined;
5879
5880
  const isStopLoss = stopLossPrice !== undefined || trailingDelta !== undefined;
@@ -5885,10 +5886,33 @@ class binance extends binance$1 {
5885
5886
  let uppercaseType = type.toUpperCase();
5886
5887
  let stopPrice = undefined;
5887
5888
  if (isTrailingPercentOrder) {
5888
- uppercaseType = 'TRAILING_STOP_MARKET';
5889
- request['callbackRate'] = trailingPercent;
5890
- if (trailingTriggerPrice !== undefined) {
5891
- request['activationPrice'] = this.priceToPrecision(symbol, trailingTriggerPrice);
5889
+ if (market['swap']) {
5890
+ uppercaseType = 'TRAILING_STOP_MARKET';
5891
+ request['callbackRate'] = trailingPercent;
5892
+ if (trailingTriggerPrice !== undefined) {
5893
+ request['activationPrice'] = this.priceToPrecision(symbol, trailingTriggerPrice);
5894
+ }
5895
+ }
5896
+ else {
5897
+ if (isMarketOrder) {
5898
+ throw new errors.InvalidOrder(this.id + ' trailingPercent orders are not supported for ' + symbol + ' ' + type + ' orders');
5899
+ }
5900
+ const stopLossOrTakeProfit = this.safeString(params, 'stopLossOrTakeProfit');
5901
+ params = this.omit(params, 'stopLossOrTakeProfit');
5902
+ if (stopLossOrTakeProfit !== 'stopLoss' && stopLossOrTakeProfit !== 'takeProfit') {
5903
+ throw new errors.InvalidOrder(this.id + symbol + ' trailingPercent orders require a stopLossOrTakeProfit parameter of either stopLoss or takeProfit');
5904
+ }
5905
+ if (stopLossOrTakeProfit === 'stopLoss') {
5906
+ uppercaseType = 'STOP_LOSS_LIMIT';
5907
+ }
5908
+ else if (stopLossOrTakeProfit === 'takeProfit') {
5909
+ uppercaseType = 'TAKE_PROFIT_LIMIT';
5910
+ }
5911
+ if (trailingTriggerPrice !== undefined) {
5912
+ stopPrice = this.priceToPrecision(symbol, trailingTriggerPrice);
5913
+ }
5914
+ const trailingPercentConverted = Precise["default"].stringMul(trailingPercent, '100');
5915
+ request['trailingDelta'] = trailingPercentConverted;
5892
5916
  }
5893
5917
  }
5894
5918
  else if (isStopLoss) {
@@ -6075,8 +6099,8 @@ class binance extends binance$1 {
6075
6099
  }
6076
6100
  else {
6077
6101
  // check for delta price as well
6078
- if (trailingDelta === undefined && stopPrice === undefined) {
6079
- throw new errors.InvalidOrder(this.id + ' createOrder() requires a stopPrice or trailingDelta param for a ' + type + ' order');
6102
+ if (trailingDelta === undefined && stopPrice === undefined && trailingPercent === undefined) {
6103
+ throw new errors.InvalidOrder(this.id + ' createOrder() requires a stopPrice, trailingDelta or trailingPercent param for a ' + type + ' order');
6080
6104
  }
6081
6105
  }
6082
6106
  if (stopPrice !== undefined) {
@@ -860,7 +860,7 @@ class bitfinex extends bitfinex$1 {
860
860
  const response = await this.publicGetTickers(params);
861
861
  const result = {};
862
862
  for (let i = 0; i < response.length; i++) {
863
- const ticker = this.parseTicker(response[i]);
863
+ const ticker = this.parseTicker({ 'result': response[i] });
864
864
  const symbol = ticker['symbol'];
865
865
  result[symbol] = ticker;
866
866
  }
@@ -882,9 +882,33 @@ class bitfinex extends bitfinex$1 {
882
882
  'symbol': market['id'],
883
883
  };
884
884
  const ticker = await this.publicGetPubtickerSymbol(this.extend(request, params));
885
+ //
886
+ // {
887
+ // mid: '63560.5',
888
+ // bid: '63560.0',
889
+ // ask: '63561.0',
890
+ // last_price: '63547.0',
891
+ // low: '62812.0',
892
+ // high: '64480.0',
893
+ // volume: '517.25634977',
894
+ // timestamp: '1715102384.9849467'
895
+ // }
896
+ //
885
897
  return this.parseTicker(ticker, market);
886
898
  }
887
899
  parseTicker(ticker, market = undefined) {
900
+ //
901
+ // {
902
+ // mid: '63560.5',
903
+ // bid: '63560.0',
904
+ // ask: '63561.0',
905
+ // last_price: '63547.0',
906
+ // low: '62812.0',
907
+ // high: '64480.0',
908
+ // volume: '517.25634977',
909
+ // timestamp: '1715102384.9849467'
910
+ // }
911
+ //
888
912
  const timestamp = this.safeTimestamp(ticker, 'timestamp');
889
913
  const marketId = this.safeString(ticker, 'pair');
890
914
  market = this.safeMarket(marketId, market);