ccxt 4.5.56 → 4.5.57

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 (261) hide show
  1. package/README.md +10 -9
  2. package/dist/ccxt.browser.min.js +10 -10
  3. package/dist/cjs/ccxt.js +6 -11
  4. package/dist/cjs/src/apex.js +1 -1
  5. package/dist/cjs/src/arkham.js +3 -3
  6. package/dist/cjs/src/ascendex.js +2 -2
  7. package/dist/cjs/src/aster.js +7 -4
  8. package/dist/cjs/src/backpack.js +4 -4
  9. package/dist/cjs/src/base/Exchange.js +69 -32
  10. package/dist/cjs/src/base/functions/io.js +25 -0
  11. package/dist/cjs/src/base/functions.js +1 -0
  12. package/dist/cjs/src/bigone.js +3 -3
  13. package/dist/cjs/src/binance.js +192 -194
  14. package/dist/cjs/src/bingx.js +3 -3
  15. package/dist/cjs/src/bitfinex.js +71 -58
  16. package/dist/cjs/src/bitget.js +2 -2
  17. package/dist/cjs/src/bitmart.js +13 -6
  18. package/dist/cjs/src/bitmex.js +1 -1
  19. package/dist/cjs/src/bitopro.js +1 -1
  20. package/dist/cjs/src/bitrue.js +2 -2
  21. package/dist/cjs/src/bitso.js +1 -1
  22. package/dist/cjs/src/bitstamp.js +2 -1
  23. package/dist/cjs/src/bitteam.js +1 -1
  24. package/dist/cjs/src/bittrade.js +0 -1
  25. package/dist/cjs/src/bitvavo.js +457 -34
  26. package/dist/cjs/src/blofin.js +26 -3
  27. package/dist/cjs/src/bullish.js +6 -5
  28. package/dist/cjs/src/bydfi.js +1 -1
  29. package/dist/cjs/src/cex.js +3 -3
  30. package/dist/cjs/src/coinbase.js +75 -65
  31. package/dist/cjs/src/coinbaseexchange.js +2 -2
  32. package/dist/cjs/src/coinbaseinternational.js +2 -1
  33. package/dist/cjs/src/coinex.js +74 -74
  34. package/dist/cjs/src/coinmetro.js +1 -1
  35. package/dist/cjs/src/coinsph.js +1 -1
  36. package/dist/cjs/src/cryptocom.js +46 -48
  37. package/dist/cjs/src/cryptomus.js +43 -39
  38. package/dist/cjs/src/deepcoin.js +3 -2
  39. package/dist/cjs/src/delta.js +51 -52
  40. package/dist/cjs/src/deribit.js +31 -33
  41. package/dist/cjs/src/derive.js +26 -28
  42. package/dist/cjs/src/digifinex.js +43 -44
  43. package/dist/cjs/src/exmo.js +92 -83
  44. package/dist/cjs/src/extended.js +3497 -0
  45. package/dist/cjs/src/foxbit.js +71 -75
  46. package/dist/cjs/src/gate.js +53 -53
  47. package/dist/cjs/src/gemini.js +41 -43
  48. package/dist/cjs/src/grvt.js +4 -4
  49. package/dist/cjs/src/hashkey.js +52 -54
  50. package/dist/cjs/src/hitbtc.js +3 -13
  51. package/dist/cjs/src/hollaex.js +51 -54
  52. package/dist/cjs/src/htx.js +75 -67
  53. package/dist/cjs/src/hyperliquid.js +41 -42
  54. package/dist/cjs/src/indodax.js +2 -2
  55. package/dist/cjs/src/kraken.js +57 -58
  56. package/dist/cjs/src/kucoin.js +3 -2
  57. package/dist/cjs/src/latoken.js +30 -32
  58. package/dist/cjs/src/lbank.js +56 -56
  59. package/dist/cjs/src/lighter.js +35 -37
  60. package/dist/cjs/src/luno.js +35 -43
  61. package/dist/cjs/src/mexc.js +48 -49
  62. package/dist/cjs/src/modetrade.js +50 -52
  63. package/dist/cjs/src/ndax.js +35 -37
  64. package/dist/cjs/src/okx.js +17 -2
  65. package/dist/cjs/src/onetrading.js +21 -23
  66. package/dist/cjs/src/phemex.js +43 -45
  67. package/dist/cjs/src/poloniex.js +17 -12
  68. package/dist/cjs/src/pro/alpaca.js +1 -1
  69. package/dist/cjs/src/pro/apex.js +1 -1
  70. package/dist/cjs/src/pro/arkham.js +1 -1
  71. package/dist/cjs/src/pro/backpack.js +1 -1
  72. package/dist/cjs/src/pro/binance.js +3 -3
  73. package/dist/cjs/src/pro/bitget.js +1 -1
  74. package/dist/cjs/src/pro/bithumb.js +1 -1
  75. package/dist/cjs/src/pro/bitstamp.js +1 -1
  76. package/dist/cjs/src/pro/blockchaincom.js +1 -1
  77. package/dist/cjs/src/pro/bybit.js +1 -1
  78. package/dist/cjs/src/pro/cex.js +1 -1
  79. package/dist/cjs/src/pro/coinex.js +1 -1
  80. package/dist/cjs/src/pro/coinone.js +1 -1
  81. package/dist/cjs/src/pro/cryptocom.js +3 -1
  82. package/dist/cjs/src/pro/dydx.js +1 -1
  83. package/dist/cjs/src/pro/exmo.js +1 -1
  84. package/dist/cjs/src/pro/extended.js +865 -0
  85. package/dist/cjs/src/pro/gate.js +1 -1
  86. package/dist/cjs/src/pro/independentreserve.js +1 -1
  87. package/dist/cjs/src/pro/kucoin.js +1 -1
  88. package/dist/cjs/src/pro/luno.js +3 -3
  89. package/dist/cjs/src/pro/onetrading.js +1 -1
  90. package/dist/cjs/src/pro/toobit.js +1 -1
  91. package/dist/cjs/src/pro/weex.js +1 -1
  92. package/dist/cjs/src/static_dependencies/starknet/utils/hash/classHash.js +7 -7
  93. package/dist/cjs/src/tokocrypto.js +1 -1
  94. package/dist/cjs/src/toobit.js +2 -2
  95. package/dist/cjs/src/upbit.js +3 -3
  96. package/dist/cjs/src/weex.js +57 -62
  97. package/dist/cjs/src/whitebit.js +61 -63
  98. package/dist/cjs/src/woo.js +65 -54
  99. package/dist/cjs/src/woofipro.js +53 -47
  100. package/dist/cjs/src/xt.js +1 -1
  101. package/dist/cjs/src/zebpay.js +70 -72
  102. package/js/ccxt.d.ts +8 -14
  103. package/js/ccxt.js +6 -10
  104. package/js/src/abstract/bitvavo.d.ts +15 -7
  105. package/js/src/abstract/extended.d.ts +58 -0
  106. package/js/src/apex.js +1 -1
  107. package/js/src/arkham.js +3 -3
  108. package/js/src/ascendex.js +2 -2
  109. package/js/src/aster.js +7 -4
  110. package/js/src/backpack.js +4 -4
  111. package/js/src/base/Exchange.d.ts +10 -6
  112. package/js/src/base/Exchange.js +69 -32
  113. package/js/src/base/functions/io.d.ts +7 -0
  114. package/js/src/base/functions/io.js +24 -0
  115. package/js/src/bigone.js +3 -3
  116. package/js/src/binance.d.ts +2 -0
  117. package/js/src/binance.js +196 -198
  118. package/js/src/bingx.js +3 -3
  119. package/js/src/bitfinex.d.ts +2 -0
  120. package/js/src/bitfinex.js +71 -58
  121. package/js/src/bitget.js +2 -2
  122. package/js/src/bitmart.js +13 -6
  123. package/js/src/bitmex.js +1 -1
  124. package/js/src/bitopro.js +1 -1
  125. package/js/src/bitrue.js +2 -2
  126. package/js/src/bitso.js +1 -1
  127. package/js/src/bitstamp.js +2 -1
  128. package/js/src/bitteam.js +1 -1
  129. package/js/src/bittrade.js +0 -1
  130. package/js/src/bitvavo.d.ts +114 -21
  131. package/js/src/bitvavo.js +457 -34
  132. package/js/src/blofin.d.ts +1 -0
  133. package/js/src/blofin.js +26 -3
  134. package/js/src/bullish.js +6 -5
  135. package/js/src/bydfi.js +1 -1
  136. package/js/src/cex.js +3 -3
  137. package/js/src/coinbase.d.ts +63 -56
  138. package/js/src/coinbase.js +75 -65
  139. package/js/src/coinbaseexchange.js +2 -2
  140. package/js/src/coinbaseinternational.js +2 -1
  141. package/js/src/coinex.d.ts +1 -0
  142. package/js/src/coinex.js +74 -74
  143. package/js/src/coinmetro.d.ts +1 -1
  144. package/js/src/coinmetro.js +1 -1
  145. package/js/src/coinsph.js +1 -1
  146. package/js/src/cryptocom.d.ts +1 -0
  147. package/js/src/cryptocom.js +46 -48
  148. package/js/src/cryptomus.d.ts +2 -1
  149. package/js/src/cryptomus.js +43 -39
  150. package/js/src/deepcoin.js +3 -2
  151. package/js/src/delta.d.ts +1 -0
  152. package/js/src/delta.js +51 -52
  153. package/js/src/deribit.d.ts +1 -0
  154. package/js/src/deribit.js +31 -33
  155. package/js/src/derive.d.ts +1 -0
  156. package/js/src/derive.js +26 -28
  157. package/js/src/digifinex.d.ts +1 -0
  158. package/js/src/digifinex.js +43 -44
  159. package/js/src/exmo.d.ts +1 -0
  160. package/js/src/exmo.js +92 -83
  161. package/js/src/extended.d.ts +554 -0
  162. package/js/src/extended.js +3490 -0
  163. package/js/src/foxbit.d.ts +1 -0
  164. package/js/src/foxbit.js +71 -75
  165. package/js/src/gate.d.ts +1 -0
  166. package/js/src/gate.js +53 -53
  167. package/js/src/gemini.d.ts +2 -1
  168. package/js/src/gemini.js +41 -43
  169. package/js/src/grvt.js +4 -4
  170. package/js/src/hashkey.d.ts +1 -0
  171. package/js/src/hashkey.js +52 -54
  172. package/js/src/hitbtc.d.ts +0 -1
  173. package/js/src/hitbtc.js +3 -13
  174. package/js/src/hollaex.d.ts +1 -0
  175. package/js/src/hollaex.js +51 -54
  176. package/js/src/htx.d.ts +1 -0
  177. package/js/src/htx.js +75 -67
  178. package/js/src/hyperliquid.d.ts +1 -0
  179. package/js/src/hyperliquid.js +41 -42
  180. package/js/src/indodax.js +2 -2
  181. package/js/src/kraken.d.ts +2 -1
  182. package/js/src/kraken.js +57 -58
  183. package/js/src/kucoin.js +3 -2
  184. package/js/src/latoken.d.ts +1 -0
  185. package/js/src/latoken.js +30 -32
  186. package/js/src/lbank.d.ts +1 -0
  187. package/js/src/lbank.js +56 -56
  188. package/js/src/lighter.d.ts +1 -0
  189. package/js/src/lighter.js +35 -37
  190. package/js/src/luno.d.ts +1 -0
  191. package/js/src/luno.js +35 -43
  192. package/js/src/mexc.d.ts +2 -1
  193. package/js/src/mexc.js +48 -49
  194. package/js/src/modetrade.d.ts +1 -0
  195. package/js/src/modetrade.js +50 -52
  196. package/js/src/ndax.d.ts +1 -0
  197. package/js/src/ndax.js +35 -37
  198. package/js/src/okx.js +17 -2
  199. package/js/src/onetrading.d.ts +2 -1
  200. package/js/src/onetrading.js +21 -23
  201. package/js/src/phemex.d.ts +1 -0
  202. package/js/src/phemex.js +43 -45
  203. package/js/src/poloniex.js +17 -12
  204. package/js/src/pro/alpaca.js +1 -1
  205. package/js/src/pro/apex.js +1 -1
  206. package/js/src/pro/arkham.js +1 -1
  207. package/js/src/pro/backpack.js +1 -1
  208. package/js/src/pro/binance.js +3 -3
  209. package/js/src/pro/bitget.js +1 -1
  210. package/js/src/pro/bithumb.js +1 -1
  211. package/js/src/pro/bitstamp.js +1 -1
  212. package/js/src/pro/blockchaincom.js +1 -1
  213. package/js/src/pro/bybit.js +1 -1
  214. package/js/src/pro/cex.js +1 -1
  215. package/js/src/pro/coinex.js +1 -1
  216. package/js/src/pro/coinone.js +1 -1
  217. package/js/src/pro/cryptocom.js +3 -1
  218. package/js/src/pro/dydx.js +1 -1
  219. package/js/src/pro/exmo.js +1 -1
  220. package/js/src/pro/extended.d.ts +126 -0
  221. package/js/src/pro/extended.js +858 -0
  222. package/js/src/pro/gate.js +1 -1
  223. package/js/src/pro/independentreserve.js +1 -1
  224. package/js/src/pro/kucoin.js +1 -1
  225. package/js/src/pro/luno.d.ts +1 -1
  226. package/js/src/pro/luno.js +3 -3
  227. package/js/src/pro/onetrading.js +1 -1
  228. package/js/src/pro/toobit.js +1 -1
  229. package/js/src/pro/weex.js +1 -1
  230. package/js/src/tokocrypto.js +1 -1
  231. package/js/src/toobit.js +2 -2
  232. package/js/src/upbit.js +3 -3
  233. package/js/src/weex.d.ts +1 -0
  234. package/js/src/weex.js +57 -62
  235. package/js/src/whitebit.d.ts +1 -0
  236. package/js/src/whitebit.js +61 -63
  237. package/js/src/woo.d.ts +1 -0
  238. package/js/src/woo.js +65 -54
  239. package/js/src/woofipro.d.ts +1 -0
  240. package/js/src/woofipro.js +53 -47
  241. package/js/src/xt.js +1 -1
  242. package/js/src/zebpay.d.ts +2 -1
  243. package/js/src/zebpay.js +70 -72
  244. package/package.json +7 -7
  245. package/dist/cjs/src/gateio.js +0 -18
  246. package/dist/cjs/src/oxfun.js +0 -2933
  247. package/dist/cjs/src/pro/gateio.js +0 -18
  248. package/dist/cjs/src/pro/oxfun.js +0 -1113
  249. package/js/src/abstract/gateio.d.ts +0 -346
  250. package/js/src/abstract/gateio.js +0 -5
  251. package/js/src/abstract/oxfun.d.ts +0 -37
  252. package/js/src/gateio.d.ts +0 -4
  253. package/js/src/gateio.js +0 -11
  254. package/js/src/oxfun.d.ts +0 -442
  255. package/js/src/oxfun.js +0 -2926
  256. package/js/src/pro/gateio.d.ts +0 -4
  257. package/js/src/pro/gateio.js +0 -11
  258. package/js/src/pro/oxfun.d.ts +0 -234
  259. package/js/src/pro/oxfun.js +0 -1106
  260. /package/dist/cjs/src/abstract/{oxfun.js → extended.js} +0 -0
  261. /package/js/src/abstract/{oxfun.js → extended.js} +0 -0
package/js/src/bitvavo.js CHANGED
@@ -31,18 +31,23 @@ export default class bitvavo extends Exchange {
31
31
  'borrowIsolatedMargin': false,
32
32
  'borrowMargin': false,
33
33
  'cancelAllOrders': true,
34
+ 'cancelAllOrdersAfter': true,
34
35
  'cancelOrder': true,
35
36
  'closeAllPositions': false,
36
37
  'closePosition': false,
38
+ 'createLimitOrder': true,
39
+ 'createMarketOrder': true,
40
+ 'createMarketOrderWithCost': true,
37
41
  'createOrder': true,
38
42
  'createOrderWithTakeProfitAndStopLoss': false,
39
43
  'createOrderWithTakeProfitAndStopLossWs': false,
40
- 'createPostOnlyOrder': false,
44
+ 'createPostOnlyOrder': true,
41
45
  'createReduceOnlyOrder': false,
42
46
  'createStopLimitOrder': true,
43
47
  'createStopMarketOrder': true,
44
48
  'createStopOrder': true,
45
49
  'editOrder': true,
50
+ 'fetchAccounts': true,
46
51
  'fetchBalance': true,
47
52
  'fetchBorrowInterest': false,
48
53
  'fetchBorrowRate': false,
@@ -70,6 +75,8 @@ export default class bitvavo extends Exchange {
70
75
  'fetchIsolatedBorrowRate': false,
71
76
  'fetchIsolatedBorrowRates': false,
72
77
  'fetchIsolatedPositions': false,
78
+ 'fetchLedger': true,
79
+ 'fetchLedgerEntry': false,
73
80
  'fetchLeverage': false,
74
81
  'fetchLeverages': false,
75
82
  'fetchLeverageTiers': false,
@@ -109,10 +116,11 @@ export default class bitvavo extends Exchange {
109
116
  'fetchTickers': true,
110
117
  'fetchTime': true,
111
118
  'fetchTrades': true,
112
- 'fetchTradingFee': false,
119
+ 'fetchTradingFee': true,
113
120
  'fetchTradingFees': true,
114
- 'fetchTransfer': false,
115
- 'fetchTransfers': false,
121
+ 'fetchTransactions': false,
122
+ 'fetchTransfer': true,
123
+ 'fetchTransfers': true,
116
124
  'fetchVolatilityHistory': false,
117
125
  'fetchWithdrawals': true,
118
126
  'reduceMargin': false,
@@ -123,7 +131,7 @@ export default class bitvavo extends Exchange {
123
131
  'setMargin': false,
124
132
  'setMarginMode': false,
125
133
  'setPositionMode': false,
126
- 'transfer': false,
134
+ 'transfer': true,
127
135
  'withdraw': true,
128
136
  },
129
137
  'timeframes': {
@@ -153,38 +161,45 @@ export default class bitvavo extends Exchange {
153
161
  'api': {
154
162
  'public': {
155
163
  'get': {
156
- 'time': 1,
157
- 'markets': 1,
158
- 'assets': 1,
159
164
  '{market}/book': 1,
165
+ 'report/{market}/book': 1,
160
166
  '{market}/trades': 5,
161
- '{market}/candles': 1,
167
+ 'report/{market}/trades': 5,
162
168
  'ticker/price': 1,
163
169
  'ticker/book': 1,
170
+ '{market}/candles': 1,
164
171
  'ticker/24h': { 'cost': 1, 'noMarket': 25 },
172
+ 'time': 1,
173
+ 'markets': 1,
174
+ 'assets': 1,
165
175
  },
166
176
  },
167
177
  'private': {
168
178
  'get': {
169
- 'account': 1,
170
179
  'order': 1,
171
- 'orders': 5,
172
180
  'ordersOpen': { 'cost': 5, 'noMarket': 100 },
173
181
  'trades': 5,
174
- 'balance': 5,
182
+ 'orders': 5,
175
183
  'deposit': 1,
176
184
  'depositHistory': 5,
177
185
  'withdrawalHistory': 5,
186
+ 'account': 1,
187
+ 'balance': 5,
188
+ 'stakingBalance': 1,
189
+ 'account/fees': 1,
190
+ 'account/history': 1,
178
191
  'subaccounts': 5,
179
192
  'subaccounts/transfers': 5,
180
193
  'subaccounts/transfers/{transferId}': 5,
181
194
  'institutional/subaccounts/balance': 5,
182
195
  'institutional/subaccounts/history': 5,
183
- 'institutional/subaccounts/orders/open': { 'cost': 1, 'noMarket': 25 },
196
+ 'institutional/subaccounts/orders/open': { 'cost': 5, 'noMarket': 100 },
184
197
  },
185
198
  'post': {
186
199
  'order': 1,
200
+ 'cancelOrdersAfter': 5,
187
201
  'withdrawal': 1,
202
+ 'crypto/withdrawal': 25,
188
203
  'subaccounts': 5,
189
204
  'subaccounts/transfers': 5,
190
205
  },
@@ -194,6 +209,7 @@ export default class bitvavo extends Exchange {
194
209
  'delete': {
195
210
  'order': 1,
196
211
  'orders': { 'cost': 25, 'noMarket': 100 },
212
+ 'atomic/orders': 100,
197
213
  'institutional/subaccounts/order': 1,
198
214
  'institutional/subaccounts/orders': { 'cost': 25, 'noMarket': 100 },
199
215
  },
@@ -402,6 +418,7 @@ export default class bitvavo extends Exchange {
402
418
  /**
403
419
  * @method
404
420
  * @name bitvavo#fetchTime
421
+ * @see https://docs.bitvavo.com/docs/rest-api/get-server-time/
405
422
  * @description fetches the current integer timestamp in milliseconds from the exchange server
406
423
  * @param {object} [params] extra parameters specific to the exchange API endpoint
407
424
  * @returns {int} the current integer timestamp in milliseconds from the exchange server
@@ -416,7 +433,7 @@ export default class bitvavo extends Exchange {
416
433
  /**
417
434
  * @method
418
435
  * @name bitvavo#fetchMarkets
419
- * @see https://docs.bitvavo.com/#tag/General/paths/~1markets/get
436
+ * @see https://docs.bitvavo.com/docs/rest-api/get-markets/
420
437
  * @description retrieves data on all markets for bitvavo
421
438
  * @param {object} [params] extra parameters specific to the exchange API endpoint
422
439
  * @returns {object[]} an array of objects representing market data
@@ -513,7 +530,7 @@ export default class bitvavo extends Exchange {
513
530
  /**
514
531
  * @method
515
532
  * @name bitvavo#fetchCurrencies
516
- * @see https://docs.bitvavo.com/#tag/General/paths/~1assets/get
533
+ * @see https://docs.bitvavo.com/docs/rest-api/get-asset-data/
517
534
  * @description fetches all available currencies on an exchange
518
535
  * @param {object} [params] extra parameters specific to the exchange API endpoint
519
536
  * @returns {object} an associative dictionary of currencies
@@ -604,7 +621,7 @@ export default class bitvavo extends Exchange {
604
621
  // btw, absolutely all of them have 1 network atm
605
622
  for (let j = 0; j < networksArray.length; j++) {
606
623
  const networkId = networksArray[j];
607
- const networkCode = this.networkIdToCode(networkId);
624
+ const networkCode = this.networkIdToCode(networkId, code);
608
625
  networks[networkCode] = {
609
626
  'info': rawCurrency,
610
627
  'id': networkId,
@@ -653,7 +670,7 @@ export default class bitvavo extends Exchange {
653
670
  /**
654
671
  * @method
655
672
  * @name bitvavo#fetchTicker
656
- * @see https://docs.bitvavo.com/#tag/Market-Data/paths/~1ticker~124h/get
673
+ * @see https://docs.bitvavo.com/docs/rest-api/get-candlestick-data-24-h/
657
674
  * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
658
675
  * @param {string} symbol unified symbol of the market to fetch the ticker for
659
676
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -736,6 +753,7 @@ export default class bitvavo extends Exchange {
736
753
  /**
737
754
  * @method
738
755
  * @name bitvavo#fetchTickers
756
+ * @see https://docs.bitvavo.com/docs/rest-api/get-candlestick-data-24-h/
739
757
  * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
740
758
  * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
741
759
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -767,7 +785,7 @@ export default class bitvavo extends Exchange {
767
785
  /**
768
786
  * @method
769
787
  * @name bitvavo#fetchTrades
770
- * @see https://docs.bitvavo.com/#tag/Market-Data/paths/~1{market}~1trades/get
788
+ * @see https://docs.bitvavo.com/docs/rest-api/get-trades/
771
789
  * @description get the list of most recent trades for a particular symbol
772
790
  * @param {string} symbol unified symbol of the market to fetch trades for
773
791
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
@@ -913,7 +931,7 @@ export default class bitvavo extends Exchange {
913
931
  /**
914
932
  * @method
915
933
  * @name bitvavo#fetchTradingFees
916
- * @see https://docs.bitvavo.com/#tag/Account/paths/~1account/get
934
+ * @see https://docs.bitvavo.com/docs/rest-api/get-account-fees/
917
935
  * @description fetch the trading fees for multiple markets
918
936
  * @param {object} [params] extra parameters specific to the exchange API endpoint
919
937
  * @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/?id=fee-structure} indexed by market symbols
@@ -959,10 +977,46 @@ export default class bitvavo extends Exchange {
959
977
  }
960
978
  return result;
961
979
  }
980
+ /**
981
+ * @method
982
+ * @name bitvavo#fetchTradingFee
983
+ * @see https://docs.bitvavo.com/docs/rest-api/get-market-fees/
984
+ * @description fetch the trading fees for a market
985
+ * @param {string} symbol unified market symbol
986
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
987
+ * @returns {object} a [fee structure]{@link https://docs.ccxt.com/?id=fee-structure}
988
+ */
989
+ async fetchTradingFee(symbol, params = {}) {
990
+ await this.loadMarkets();
991
+ const market = this.market(symbol);
992
+ const request = {
993
+ 'market': market['id'],
994
+ };
995
+ const response = await this.privateGetAccountFees(this.extend(request, params));
996
+ //
997
+ // {
998
+ // "tier": "0",
999
+ // "volume": "10000.00",
1000
+ // "taker": "0.0025",
1001
+ // "maker": "0.0015"
1002
+ // }
1003
+ //
1004
+ return this.parseTradingFee(response, market);
1005
+ }
1006
+ parseTradingFee(fee, market = undefined) {
1007
+ return {
1008
+ 'info': fee,
1009
+ 'symbol': this.safeSymbol(undefined, market),
1010
+ 'maker': this.safeNumber(fee, 'maker'),
1011
+ 'taker': this.safeNumber(fee, 'taker'),
1012
+ 'percentage': true,
1013
+ 'tierBased': true,
1014
+ };
1015
+ }
962
1016
  /**
963
1017
  * @method
964
1018
  * @name bitvavo#fetchOrderBook
965
- * @see https://docs.bitvavo.com/#tag/Market-Data/paths/~1{market}~1book/get
1019
+ * @see https://docs.bitvavo.com/docs/rest-api/get-order-book/
966
1020
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
967
1021
  * @param {string} symbol unified symbol of the market to fetch the order book for
968
1022
  * @param {int} [limit] the maximum amount of order book entries to return
@@ -1049,7 +1103,7 @@ export default class bitvavo extends Exchange {
1049
1103
  /**
1050
1104
  * @method
1051
1105
  * @name bitvavo#fetchOHLCV
1052
- * @see https://docs.bitvavo.com/#tag/Market-Data/paths/~1{market}~1candles/get
1106
+ * @see https://docs.bitvavo.com/docs/rest-api/get-candlestick-data/
1053
1107
  * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
1054
1108
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
1055
1109
  * @param {string} timeframe the length of time each candle represents
@@ -1099,7 +1153,7 @@ export default class bitvavo extends Exchange {
1099
1153
  /**
1100
1154
  * @method
1101
1155
  * @name bitvavo#fetchBalance
1102
- * @see https://docs.bitvavo.com/#tag/Account/paths/~1balance/get
1156
+ * @see https://docs.bitvavo.com/docs/rest-api/get-account-balance/
1103
1157
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
1104
1158
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1105
1159
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/?id=balance-structure}
@@ -1118,9 +1172,237 @@ export default class bitvavo extends Exchange {
1118
1172
  //
1119
1173
  return this.parseBalance(response);
1120
1174
  }
1175
+ /**
1176
+ * @method
1177
+ * @name bitvavo#fetchAccounts
1178
+ * @see https://docs.bitvavo.com/docs/institutional-api/get-subaccounts/
1179
+ * @description fetch all the accounts associated with a profile
1180
+ * @param {object} [params] extra parameters specific to the bitvavo api endpoint
1181
+ * @returns {object[]} a list of [account structures]{@link https://docs.ccxt.com/#/?id=account-structure}
1182
+ */
1183
+ async fetchAccounts(params = {}) {
1184
+ await this.loadMarkets();
1185
+ const response = await this.privateGetSubaccounts(params);
1186
+ //
1187
+ // {
1188
+ // "items": [
1189
+ // {
1190
+ // "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
1191
+ // "type": "spot",
1192
+ // "status": "open",
1193
+ // "label": "string"
1194
+ // }
1195
+ // ],
1196
+ // "currentPage": 0,
1197
+ // "totalPages": 0,
1198
+ // "maxItems": 0
1199
+ // }
1200
+ //
1201
+ const accounts = this.safeList(response, 'items', []);
1202
+ return this.parseAccounts(accounts);
1203
+ }
1204
+ parseAccount(account) {
1205
+ return {
1206
+ 'id': this.safeString(account, 'id'),
1207
+ 'type': this.safeString(account, 'type'),
1208
+ 'code': undefined,
1209
+ 'info': account,
1210
+ };
1211
+ }
1212
+ /**
1213
+ * @method
1214
+ * @name bitvavo#transfer
1215
+ * @see https://docs.bitvavo.com/docs/institutional-api/create-transfer/
1216
+ * @description transfer currency internally between the master account and a subaccount
1217
+ * @param {string} code unified currency code
1218
+ * @param {float} amount amount to transfer
1219
+ * @param {string} fromAccount account to transfer from, either 'master' or the subaccount id
1220
+ * @param {string} toAccount account to transfer to, either 'master' or the subaccount id
1221
+ * @param {object} [params] extra parameters specific to the bitvavo api endpoint
1222
+ * @param {string} [params.subaccountId] the unique identifier for the subaccount
1223
+ * @param {string} [params.clientRequestId] client defined unique id
1224
+ * @returns {object} a [transfer structure]{@link https://docs.ccxt.com/#/?id=transfer-structure}
1225
+ */
1226
+ async transfer(code, amount, fromAccount, toAccount, params = {}) {
1227
+ await this.loadMarkets();
1228
+ const currency = this.currency(code);
1229
+ let subaccountId = this.safeString(params, 'subaccountId');
1230
+ params = this.omit(params, 'subaccountId');
1231
+ let direction = undefined;
1232
+ if ((fromAccount === 'master') && (toAccount === 'master')) {
1233
+ throw new ArgumentsRequired(this.id + ' transfer() requires fromAccount and toAccount to be different (one master and one subaccount id)');
1234
+ }
1235
+ else if (fromAccount === 'master') {
1236
+ direction = 'masterToSub';
1237
+ if (subaccountId === undefined) {
1238
+ subaccountId = toAccount;
1239
+ }
1240
+ }
1241
+ else if (toAccount === 'master') {
1242
+ direction = 'subToMaster';
1243
+ if (subaccountId === undefined) {
1244
+ subaccountId = fromAccount;
1245
+ }
1246
+ }
1247
+ else {
1248
+ throw new ArgumentsRequired(this.id + ' transfer() requires either fromAccount or toAccount to be master');
1249
+ }
1250
+ if (subaccountId === undefined) {
1251
+ throw new ArgumentsRequired(this.id + ' transfer() requires a subaccount id (provide it as fromAccount/toAccount or params.subaccountId)');
1252
+ }
1253
+ const request = {
1254
+ 'subaccountId': subaccountId,
1255
+ 'direction': direction,
1256
+ 'symbol': currency['id'],
1257
+ 'amount': this.currencyToPrecision(code, amount),
1258
+ };
1259
+ const response = await this.privatePostSubaccountsTransfers(this.extend(request, params));
1260
+ //
1261
+ // {
1262
+ // "transferId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
1263
+ // "clientRequestId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
1264
+ // "subaccountId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
1265
+ // "direction": "masterToSub",
1266
+ // "symbol": "BTC",
1267
+ // "amount": "0.1",
1268
+ // "status": "completed",
1269
+ // "createdAt": "1700000000000"
1270
+ // }
1271
+ //
1272
+ return this.parseTransfer(response, currency);
1273
+ }
1274
+ /**
1275
+ * @method
1276
+ * @name bitvavo#fetchTransfers
1277
+ * @see https://docs.bitvavo.com/docs/institutional-api/get-transfers/
1278
+ * @description fetch a history of internal transfers made on an account
1279
+ * @param {string} [code] unified currency code of the currency transferred
1280
+ * @param {int} [since] the earliest time in ms to fetch transfers for
1281
+ * @param {int} [limit] the maximum number of transfers structures to retrieve
1282
+ * @param {object} [params] extra parameters specific to the bitvavo api endpoint
1283
+ * @param {string} [params.subaccountId] the unique identifier for the subaccount
1284
+ * @param {int} [params.until] the latest time in ms to fetch transfers for
1285
+ * @returns {object[]} a list of [transfer structures]{@link https://docs.ccxt.com/#/?id=transfer-structure}
1286
+ */
1287
+ async fetchTransfers(code = undefined, since = undefined, limit = undefined, params = {}) {
1288
+ await this.loadMarkets();
1289
+ let request = {};
1290
+ let currency = undefined;
1291
+ if (code !== undefined) {
1292
+ currency = this.currency(code);
1293
+ request['symbol'] = currency['id'];
1294
+ }
1295
+ const subaccountId = this.safeString(params, 'subaccountId');
1296
+ if (subaccountId === undefined) {
1297
+ throw new ArgumentsRequired(this.id + ' fetchTransfers() requires a subaccountId parameter');
1298
+ }
1299
+ if (since !== undefined) {
1300
+ request['start'] = since;
1301
+ }
1302
+ if (limit !== undefined) {
1303
+ request['limit'] = limit;
1304
+ }
1305
+ [request, params] = this.handleUntilOption('end', request, params);
1306
+ const response = await this.privateGetSubaccountsTransfers(this.extend(request, params));
1307
+ //
1308
+ // {
1309
+ // "items": [
1310
+ // {
1311
+ // "transferId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
1312
+ // "clientRequestId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
1313
+ // "subaccountId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
1314
+ // "direction": "masterToSub",
1315
+ // "symbol": "BTC",
1316
+ // "amount": "0.1",
1317
+ // "status": "completed",
1318
+ // "createdAt": "1700000000000"
1319
+ // }
1320
+ // ],
1321
+ // "start": 0,
1322
+ // "end": 0,
1323
+ // "limit": 25
1324
+ // }
1325
+ //
1326
+ const items = this.safeList(response, 'items', []);
1327
+ return this.parseTransfers(items, currency, since, limit);
1328
+ }
1329
+ /**
1330
+ * @method
1331
+ * @name bitvavo#fetchTransfer
1332
+ * @see https://docs.bitvavo.com/docs/institutional-api/get-transfer/
1333
+ * @description fetches a transfer
1334
+ * @param {string} id transfer id
1335
+ * @param {string} [code] unified currency code of the currency transferred
1336
+ * @param {object} [params] extra parameters specific to the bitvavo api endpoint
1337
+ * @returns {object} a [transfer structure]{@link https://docs.ccxt.com/#/?id=transfer-structure}
1338
+ */
1339
+ async fetchTransfer(id, code = undefined, params = {}) {
1340
+ await this.loadMarkets();
1341
+ let currency = undefined;
1342
+ if (code !== undefined) {
1343
+ currency = this.currency(code);
1344
+ }
1345
+ const request = {
1346
+ 'transferId': id,
1347
+ };
1348
+ const response = await this.privateGetSubaccountsTransfersTransferId(this.extend(request, params));
1349
+ //
1350
+ // {
1351
+ // "transferId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
1352
+ // "clientRequestId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
1353
+ // "subaccountId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
1354
+ // "direction": "masterToSub",
1355
+ // "symbol": "BTC",
1356
+ // "amount": "0.1",
1357
+ // "status": "completed",
1358
+ // "createdAt": "1700000000000"
1359
+ // }
1360
+ //
1361
+ return this.parseTransfer(response, currency);
1362
+ }
1363
+ parseTransferStatus(status) {
1364
+ const statuses = {
1365
+ 'completed': 'ok',
1366
+ 'pending': 'pending',
1367
+ 'failed': 'failed',
1368
+ };
1369
+ return this.safeString(statuses, status, status);
1370
+ }
1371
+ parseTransfer(transfer, currency = undefined) {
1372
+ const currencyId = this.safeString(transfer, 'symbol');
1373
+ const code = this.safeCurrencyCode(currencyId, currency);
1374
+ const subaccountId = this.safeString(transfer, 'subaccountId');
1375
+ const direction = this.safeString(transfer, 'direction');
1376
+ let fromAccount = undefined;
1377
+ let toAccount = undefined;
1378
+ if (direction === 'masterToSub') {
1379
+ fromAccount = 'master';
1380
+ toAccount = subaccountId;
1381
+ }
1382
+ else if (direction === 'subToMaster') {
1383
+ fromAccount = subaccountId;
1384
+ toAccount = 'master';
1385
+ }
1386
+ let timestamp = this.safeInteger(transfer, 'createdAt');
1387
+ if (timestamp === undefined) {
1388
+ timestamp = this.parse8601(this.safeString(transfer, 'createdAt'));
1389
+ }
1390
+ return {
1391
+ 'info': transfer,
1392
+ 'id': this.safeString(transfer, 'transferId'),
1393
+ 'timestamp': timestamp,
1394
+ 'datetime': this.iso8601(timestamp),
1395
+ 'currency': code,
1396
+ 'amount': this.safeNumber(transfer, 'amount'),
1397
+ 'fromAccount': fromAccount,
1398
+ 'toAccount': toAccount,
1399
+ 'status': this.parseTransferStatus(this.safeString(transfer, 'status')),
1400
+ };
1401
+ }
1121
1402
  /**
1122
1403
  * @method
1123
1404
  * @name bitvavo#fetchDepositAddress
1405
+ * @see https://docs.bitvavo.com/docs/rest-api/get-deposit-data/
1124
1406
  * @description fetch the deposit address for a currency associated with this account
1125
1407
  * @param {string} code unified currency code
1126
1408
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -1238,7 +1520,7 @@ export default class bitvavo extends Exchange {
1238
1520
  * @method
1239
1521
  * @name bitvavo#createOrder
1240
1522
  * @description create a trade order
1241
- * @see https://docs.bitvavo.com/#tag/Trading-endpoints/paths/~1order/post
1523
+ * @see https://docs.bitvavo.com/docs/rest-api/create-order/
1242
1524
  * @param {string} symbol unified symbol of the market to create an order in
1243
1525
  * @param {string} type 'market' or 'limit'
1244
1526
  * @param {string} side 'buy' or 'sell'
@@ -1346,7 +1628,7 @@ export default class bitvavo extends Exchange {
1346
1628
  * @method
1347
1629
  * @name bitvavo#editOrder
1348
1630
  * @description edit a trade order
1349
- * @see https://docs.bitvavo.com/#tag/Orders/paths/~1order/put
1631
+ * @see https://docs.bitvavo.com/docs/rest-api/update-order/
1350
1632
  * @param {string} id cancel order id
1351
1633
  * @param {string} symbol unified symbol of the market to create an order in
1352
1634
  * @param {string} type 'market' or 'limit'
@@ -1388,9 +1670,8 @@ export default class bitvavo extends Exchange {
1388
1670
  /**
1389
1671
  * @method
1390
1672
  * @name bitvavo#cancelOrder
1391
- * @see https://docs.bitvavo.com/#tag/Orders/paths/~1order/delete
1392
1673
  * @description cancels an open order
1393
- * @see https://docs.bitvavo.com/#tag/Trading-endpoints/paths/~1order/delete
1674
+ * @see https://docs.bitvavo.com/docs/rest-api/cancel-order/
1394
1675
  * @param {string} id order id
1395
1676
  * @param {string} symbol unified symbol of the market the order was made in
1396
1677
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -1411,7 +1692,7 @@ export default class bitvavo extends Exchange {
1411
1692
  /**
1412
1693
  * @method
1413
1694
  * @name bitvavo#cancelAllOrders
1414
- * @see https://docs.bitvavo.com/#tag/Orders/paths/~1orders/delete
1695
+ * @see https://docs.bitvavo.com/docs/rest-api/cancel-orders/
1415
1696
  * @description cancel all open orders
1416
1697
  * @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
1417
1698
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -1443,11 +1724,44 @@ export default class bitvavo extends Exchange {
1443
1724
  //
1444
1725
  return this.parseOrders(response, market);
1445
1726
  }
1727
+ /**
1728
+ * @method
1729
+ * @name bitvavo#cancelAllOrdersAfter
1730
+ * @description dead man's switch, cancel all orders after the given timeout
1731
+ * @see https://docs.bitvavo.com/docs/rest-api/cancel-orders-after/
1732
+ * @param {number} timeout time in milliseconds, 0 represents cancel the timer
1733
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1734
+ * @param {int} [params.codGroupId] your identifier for a group of orders, default is 1
1735
+ * @returns {object} the api result
1736
+ */
1737
+ async cancelAllOrdersAfter(timeout, params = {}) {
1738
+ if (timeout > 300000) {
1739
+ throw new BadRequest(this.id + ' cancelAllOrdersAfter() timeout should be less than or equal to 300000 milliseconds');
1740
+ }
1741
+ if ((timeout > 0) && (timeout < 10000)) {
1742
+ throw new BadRequest(this.id + ' cancelAllOrdersAfter() timeout should be 0 or greater than or equal to 10000 milliseconds');
1743
+ }
1744
+ await this.loadMarkets();
1745
+ let codGroupId = undefined;
1746
+ [codGroupId, params] = this.handleOptionAndParams(params, 'cancelAllOrdersAfter', 'codGroupId', 1);
1747
+ const request = {
1748
+ 'codGroupId': codGroupId,
1749
+ 'expiryAfterSeconds': (timeout > 0) ? this.parseToInt(timeout / 1000) : 0,
1750
+ };
1751
+ const response = await this.privatePostCancelOrdersAfter(this.extend(request, params));
1752
+ //
1753
+ // {
1754
+ // "codGroupId": 1,
1755
+ // "timeOfExpirySeconds": 17202139111
1756
+ // }
1757
+ //
1758
+ return response;
1759
+ }
1446
1760
  /**
1447
1761
  * @method
1448
1762
  * @name bitvavo#fetchOrder
1449
1763
  * @description fetches information on an order made by the user
1450
- * @see https://docs.bitvavo.com/#tag/Trading-endpoints/paths/~1order/get
1764
+ * @see https://docs.bitvavo.com/docs/rest-api/get-order/
1451
1765
  * @param {string} id the order id
1452
1766
  * @param {string} symbol unified symbol of the market the order was made in
1453
1767
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -1525,7 +1839,7 @@ export default class bitvavo extends Exchange {
1525
1839
  /**
1526
1840
  * @method
1527
1841
  * @name bitvavo#fetchOrders
1528
- * @see https://docs.bitvavo.com/#tag/Trading-endpoints/paths/~1orders/get
1842
+ * @see https://docs.bitvavo.com/docs/rest-api/get-orders/
1529
1843
  * @description fetches information on multiple orders made by the user
1530
1844
  * @param {string} symbol unified market symbol of the market orders were made in
1531
1845
  * @param {int} [since] the earliest time in ms to fetch orders for
@@ -1589,7 +1903,7 @@ export default class bitvavo extends Exchange {
1589
1903
  /**
1590
1904
  * @method
1591
1905
  * @name bitvavo#fetchOpenOrders
1592
- * @see https://docs.bitvavo.com/#tag/Trading-endpoints/paths/~1ordersOpen/get
1906
+ * @see https://docs.bitvavo.com/docs/rest-api/get-open-orders/
1593
1907
  * @description fetch all unfilled currently open orders
1594
1908
  * @param {string} symbol unified market symbol
1595
1909
  * @param {int} [since] the earliest time in ms to fetch open orders for
@@ -1788,7 +2102,7 @@ export default class bitvavo extends Exchange {
1788
2102
  /**
1789
2103
  * @method
1790
2104
  * @name bitvavo#fetchMyTrades
1791
- * @see https://docs.bitvavo.com/#tag/Trading-endpoints/paths/~1trades/get
2105
+ * @see https://docs.bitvavo.com/docs/rest-api/get-trade-history/
1792
2106
  * @description fetch all trades made by the user
1793
2107
  * @param {string} symbol unified market symbol
1794
2108
  * @param {int} [since] the earliest time in ms to fetch trades for
@@ -1830,6 +2144,114 @@ export default class bitvavo extends Exchange {
1830
2144
  //
1831
2145
  return this.parseTrades(response, market, since, limit);
1832
2146
  }
2147
+ /**
2148
+ * @method
2149
+ * @name bitvavo#fetchLedger
2150
+ * @see https://docs.bitvavo.com/docs/rest-api/get-transaction-history/
2151
+ * @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
2152
+ * @param {string} [code] unified currency code
2153
+ * @param {int} [since] timestamp in ms of the earliest ledger entry
2154
+ * @param {int} [limit] max number of ledger entries to return
2155
+ * @param {object} [params] extra parameters specific to the bitvavo api endpoint
2156
+ * @param {int} [params.until] timestamp in ms of the latest ledger entry
2157
+ * @param {int} [params.page] the page number for the transaction history
2158
+ * @returns {object[]} a list of [ledger structures]{@link https://docs.ccxt.com/?id=ledger}
2159
+ */
2160
+ async fetchLedger(code = undefined, since = undefined, limit = undefined, params = {}) {
2161
+ await this.loadMarkets();
2162
+ let request = {};
2163
+ let currency = undefined;
2164
+ if (code !== undefined) {
2165
+ currency = this.currency(code);
2166
+ }
2167
+ if (since !== undefined) {
2168
+ request['fromDate'] = since;
2169
+ }
2170
+ if (limit !== undefined) {
2171
+ request['maxItems'] = Math.min(limit, 100);
2172
+ }
2173
+ [request, params] = this.handleUntilOption('toDate', request, params);
2174
+ const response = await this.privateGetAccountHistory(this.extend(request, params));
2175
+ //
2176
+ // {
2177
+ // "items": [
2178
+ // {
2179
+ // "transactionId": "5f5e7b3b-4f5b-4b2d-8b2f-4f2b5b3f5e5f",
2180
+ // "executedAt": "2021-01-01T00:00:00.000Z",
2181
+ // "type": "sell",
2182
+ // "priceCurrency": "EUR",
2183
+ // "priceAmount": "1000.00",
2184
+ // "sentCurrency": "EUR",
2185
+ // "sentAmount": "0.1",
2186
+ // "receivedCurrency": "BTC",
2187
+ // "receivedAmount": "0.0001",
2188
+ // "feesCurrency": "EUR",
2189
+ // "feesAmount": "0.01",
2190
+ // "address": "string"
2191
+ // }
2192
+ // ],
2193
+ // "currentPage": 1,
2194
+ // "totalPages": 1,
2195
+ // "maxItems": 100
2196
+ // }
2197
+ //
2198
+ const items = this.safeList(response, 'items', []);
2199
+ return this.parseLedger(items, currency, since, limit);
2200
+ }
2201
+ parseLedgerEntryType(type) {
2202
+ const types = {
2203
+ 'buy': 'trade',
2204
+ 'sell': 'trade',
2205
+ 'deposit': 'transaction',
2206
+ 'withdrawal': 'transaction',
2207
+ 'withdrawal_cancelled': 'transaction',
2208
+ 'internal_transfer': 'transaction',
2209
+ 'external_transferred_funds': 'transaction',
2210
+ };
2211
+ return this.safeString(types, type, type);
2212
+ }
2213
+ parseLedgerEntry(item, currency = undefined) {
2214
+ const rawType = this.safeString(item, 'type');
2215
+ const type = this.parseLedgerEntryType(rawType);
2216
+ let currencyId = this.safeString(item, 'receivedCurrency');
2217
+ let amount = this.safeString(item, 'receivedAmount');
2218
+ let direction = 'in';
2219
+ if (amount === undefined) {
2220
+ currencyId = this.safeString(item, 'sentCurrency');
2221
+ amount = this.safeString(item, 'sentAmount');
2222
+ direction = 'out';
2223
+ }
2224
+ const code = this.safeCurrencyCode(currencyId);
2225
+ currency = this.safeCurrency(currencyId, currency);
2226
+ const timestamp = this.parse8601(this.safeString(item, 'executedAt'));
2227
+ let fee = undefined;
2228
+ const feeCost = this.safeString(item, 'feesAmount');
2229
+ if (feeCost !== undefined) {
2230
+ const feeCurrencyId = this.safeString(item, 'feesCurrency');
2231
+ const feeCurrencyCode = this.safeCurrencyCode(feeCurrencyId);
2232
+ fee = {
2233
+ 'cost': feeCost,
2234
+ 'currency': feeCurrencyCode,
2235
+ };
2236
+ }
2237
+ return this.safeLedgerEntry({
2238
+ 'info': item,
2239
+ 'id': this.safeString(item, 'transactionId'),
2240
+ 'direction': direction,
2241
+ 'account': undefined,
2242
+ 'referenceId': this.safeString(item, 'transactionId'),
2243
+ 'referenceAccount': this.safeString(item, 'address'),
2244
+ 'type': type,
2245
+ 'currency': code,
2246
+ 'amount': amount,
2247
+ 'timestamp': timestamp,
2248
+ 'datetime': this.iso8601(timestamp),
2249
+ 'before': undefined,
2250
+ 'after': undefined,
2251
+ 'status': 'ok',
2252
+ 'fee': fee,
2253
+ }, currency);
2254
+ }
1833
2255
  withdrawRequest(code, amount, address, tag = undefined, params = {}) {
1834
2256
  const currency = this.currency(code);
1835
2257
  const request = {
@@ -1847,6 +2269,7 @@ export default class bitvavo extends Exchange {
1847
2269
  /**
1848
2270
  * @method
1849
2271
  * @name bitvavo#withdraw
2272
+ * @see https://docs.bitvavo.com/docs/rest-api/withdraw-assets/
1850
2273
  * @description make a withdrawal
1851
2274
  * @param {string} code unified currency code
1852
2275
  * @param {float} amount the amount to withdraw
@@ -1894,7 +2317,7 @@ export default class bitvavo extends Exchange {
1894
2317
  /**
1895
2318
  * @method
1896
2319
  * @name bitvavo#fetchWithdrawals
1897
- * @see https://docs.bitvavo.com/#tag/Account/paths/~1withdrawalHistory/get
2320
+ * @see https://docs.bitvavo.com/docs/rest-api/get-withdrawal-history/
1898
2321
  * @description fetch all withdrawals made from an account
1899
2322
  * @param {string} code unified currency code
1900
2323
  * @param {int} [since] the earliest time in ms to fetch withdrawals for
@@ -1949,7 +2372,7 @@ export default class bitvavo extends Exchange {
1949
2372
  /**
1950
2373
  * @method
1951
2374
  * @name bitvavo#fetchDeposits
1952
- * @see https://docs.bitvavo.com/#tag/Account/paths/~1depositHistory/get
2375
+ * @see https://docs.bitvavo.com/docs/rest-api/get-deposit-history/
1953
2376
  * @description fetch all deposits made to an account
1954
2377
  * @param {string} code unified currency code
1955
2378
  * @param {int} [since] the earliest time in ms to fetch deposits for
@@ -2121,7 +2544,7 @@ export default class bitvavo extends Exchange {
2121
2544
  * @method
2122
2545
  * @name bitvavo#fetchDepositWithdrawFees
2123
2546
  * @description fetch deposit and withdraw fees
2124
- * @see https://docs.bitvavo.com/#tag/General/paths/~1assets/get
2547
+ * @see https://docs.bitvavo.com/docs/rest-api/get-asset-data/
2125
2548
  * @param {string[]|undefined} codes list of unified currency codes
2126
2549
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2127
2550
  * @returns {object} a list of [fee structures]{@link https://docs.ccxt.com/?id=fee-structure}