ccxt 4.2.37 → 4.2.39

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 (113) hide show
  1. package/README.md +6 -5
  2. package/dist/ccxt.browser.js +3015 -509
  3. package/dist/ccxt.browser.min.js +7 -7
  4. package/dist/cjs/ccxt.js +4 -1
  5. package/dist/cjs/src/abstract/blofin.js +9 -0
  6. package/dist/cjs/src/base/Exchange.js +14 -2
  7. package/dist/cjs/src/binance.js +156 -35
  8. package/dist/cjs/src/bitget.js +1 -1
  9. package/dist/cjs/src/bitso.js +18 -2
  10. package/dist/cjs/src/bitstamp.js +24 -2
  11. package/dist/cjs/src/bl3p.js +6 -0
  12. package/dist/cjs/src/blockchaincom.js +21 -0
  13. package/dist/cjs/src/blofin.js +2103 -0
  14. package/dist/cjs/src/btcalpha.js +9 -0
  15. package/dist/cjs/src/btcbox.js +9 -0
  16. package/dist/cjs/src/btcmarkets.js +19 -0
  17. package/dist/cjs/src/coinbase.js +13 -2
  18. package/dist/cjs/src/krakenfutures.js +7 -14
  19. package/dist/cjs/src/luno.js +1 -1
  20. package/dist/cjs/src/okx.js +2 -2
  21. package/dist/cjs/src/poloniexfutures.js +11 -5
  22. package/dist/cjs/src/pro/bitmart.js +110 -35
  23. package/dist/cjs/src/pro/kucoin.js +93 -40
  24. package/dist/cjs/src/pro/mexc.js +1 -1
  25. package/dist/cjs/src/wavesexchange.js +1 -1
  26. package/dist/cjs/src/woo.js +1 -1
  27. package/js/ccxt.d.ts +5 -2
  28. package/js/ccxt.js +4 -2
  29. package/js/src/abstract/blofin.d.ts +36 -0
  30. package/js/src/abstract/blofin.js +11 -0
  31. package/js/src/abstract/coinbase.d.ts +1 -0
  32. package/js/src/abstract/okx.d.ts +1 -0
  33. package/js/src/ascendex.d.ts +2 -2
  34. package/js/src/base/Exchange.d.ts +4 -0
  35. package/js/src/base/Exchange.js +14 -2
  36. package/js/src/base/types.d.ts +2 -0
  37. package/js/src/bigone.d.ts +2 -2
  38. package/js/src/binance.d.ts +8 -8
  39. package/js/src/binance.js +156 -35
  40. package/js/src/bingx.d.ts +5 -5
  41. package/js/src/bitfinex.d.ts +3 -3
  42. package/js/src/bitfinex2.d.ts +2 -2
  43. package/js/src/bitget.d.ts +5 -5
  44. package/js/src/bitget.js +1 -1
  45. package/js/src/bitmart.d.ts +2 -2
  46. package/js/src/bitmex.d.ts +2 -2
  47. package/js/src/bitrue.d.ts +2 -2
  48. package/js/src/bitso.d.ts +1 -1
  49. package/js/src/bitso.js +18 -2
  50. package/js/src/bitstamp.d.ts +1 -1
  51. package/js/src/bitstamp.js +24 -2
  52. package/js/src/bitvavo.d.ts +1 -1
  53. package/js/src/bl3p.js +6 -0
  54. package/js/src/blockchaincom.js +21 -0
  55. package/js/src/blofin.d.ts +124 -0
  56. package/js/src/blofin.js +2104 -0
  57. package/js/src/btcalpha.js +9 -0
  58. package/js/src/btcbox.js +9 -0
  59. package/js/src/btcmarkets.js +19 -0
  60. package/js/src/bybit.d.ts +7 -7
  61. package/js/src/cex.d.ts +1 -1
  62. package/js/src/coinbase.d.ts +2 -2
  63. package/js/src/coinbase.js +13 -2
  64. package/js/src/coinex.d.ts +4 -4
  65. package/js/src/coinlist.d.ts +2 -2
  66. package/js/src/coinone.d.ts +1 -1
  67. package/js/src/delta.d.ts +2 -2
  68. package/js/src/deribit.d.ts +3 -3
  69. package/js/src/digifinex.d.ts +3 -3
  70. package/js/src/exmo.d.ts +2 -2
  71. package/js/src/gate.d.ts +6 -6
  72. package/js/src/hitbtc.d.ts +2 -2
  73. package/js/src/hollaex.d.ts +1 -1
  74. package/js/src/htx.d.ts +3 -3
  75. package/js/src/huobijp.d.ts +1 -1
  76. package/js/src/kraken.d.ts +2 -2
  77. package/js/src/krakenfutures.d.ts +2 -2
  78. package/js/src/krakenfutures.js +7 -14
  79. package/js/src/kucoin.d.ts +5 -5
  80. package/js/src/kucoinfutures.d.ts +2 -2
  81. package/js/src/latoken.d.ts +1 -1
  82. package/js/src/lbank.d.ts +2 -2
  83. package/js/src/luno.d.ts +1 -1
  84. package/js/src/luno.js +1 -1
  85. package/js/src/mexc.d.ts +4 -4
  86. package/js/src/ndax.d.ts +1 -1
  87. package/js/src/novadax.d.ts +1 -1
  88. package/js/src/okcoin.d.ts +2 -2
  89. package/js/src/okx.d.ts +7 -7
  90. package/js/src/okx.js +2 -2
  91. package/js/src/paymium.d.ts +2 -2
  92. package/js/src/phemex.d.ts +4 -4
  93. package/js/src/poloniex.d.ts +2 -2
  94. package/js/src/poloniexfutures.d.ts +2 -2
  95. package/js/src/poloniexfutures.js +11 -5
  96. package/js/src/pro/bitmart.d.ts +2 -0
  97. package/js/src/pro/bitmart.js +110 -35
  98. package/js/src/pro/bitvavo.d.ts +1 -1
  99. package/js/src/pro/cex.d.ts +2 -2
  100. package/js/src/pro/coinbase.d.ts +2 -2
  101. package/js/src/pro/coinex.d.ts +1 -1
  102. package/js/src/pro/kucoin.js +93 -40
  103. package/js/src/pro/lbank.d.ts +1 -1
  104. package/js/src/pro/mexc.js +1 -1
  105. package/js/src/probit.d.ts +1 -1
  106. package/js/src/timex.d.ts +1 -1
  107. package/js/src/upbit.d.ts +1 -1
  108. package/js/src/wavesexchange.js +1 -1
  109. package/js/src/whitebit.d.ts +2 -2
  110. package/js/src/woo.d.ts +3 -3
  111. package/js/src/woo.js +1 -1
  112. package/js/src/zonda.d.ts +3 -3
  113. package/package.json +2 -2
@@ -153,6 +153,7 @@ class btcalpha extends btcalpha$1 {
153
153
  * @method
154
154
  * @name btcalpha#fetchMarkets
155
155
  * @description retrieves data on all markets for btcalpha
156
+ * @see https://btc-alpha.github.io/api-docs/#list-all-currencies
156
157
  * @param {object} [params] extra parameters specific to the exchange API endpoint
157
158
  * @returns {object[]} an array of objects representing market data
158
159
  */
@@ -423,6 +424,7 @@ class btcalpha extends btcalpha$1 {
423
424
  * @method
424
425
  * @name btcalpha#fetchTrades
425
426
  * @description get the list of most recent trades for a particular symbol
427
+ * @see https://btc-alpha.github.io/api-docs/#list-all-exchanges
426
428
  * @param {string} symbol unified symbol of the market to fetch trades for
427
429
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
428
430
  * @param {int} [limit] the maximum amount of trades to fetch
@@ -447,6 +449,7 @@ class btcalpha extends btcalpha$1 {
447
449
  * @method
448
450
  * @name btcalpha#fetchDeposits
449
451
  * @description fetch all deposits made to an account
452
+ * @see https://btc-alpha.github.io/api-docs/#list-own-deposits
450
453
  * @param {string} code unified currency code
451
454
  * @param {int} [since] the earliest time in ms to fetch deposits for
452
455
  * @param {int} [limit] the maximum number of deposits structures to retrieve
@@ -476,6 +479,7 @@ class btcalpha extends btcalpha$1 {
476
479
  * @method
477
480
  * @name btcalpha#fetchWithdrawals
478
481
  * @description fetch all withdrawals made from an account
482
+ * @see https://btc-alpha.github.io/api-docs/#list-own-made-withdraws
479
483
  * @param {string} code unified currency code
480
484
  * @param {int} [since] the earliest time in ms to fetch withdrawals for
481
485
  * @param {int} [limit] the maximum number of withdrawals structures to retrieve
@@ -583,6 +587,7 @@ class btcalpha extends btcalpha$1 {
583
587
  * @method
584
588
  * @name btcalpha#fetchOHLCV
585
589
  * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
590
+ * @see https://btc-alpha.github.io/api-docs/#charts
586
591
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
587
592
  * @param {string} timeframe the length of time each candle represents
588
593
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
@@ -630,6 +635,7 @@ class btcalpha extends btcalpha$1 {
630
635
  * @method
631
636
  * @name btcalpha#fetchBalance
632
637
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
638
+ * @see https://btc-alpha.github.io/api-docs/#list-own-wallets
633
639
  * @param {object} [params] extra parameters specific to the exchange API endpoint
634
640
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
635
641
  */
@@ -817,6 +823,7 @@ class btcalpha extends btcalpha$1 {
817
823
  * @method
818
824
  * @name btcalpha#fetchOpenOrders
819
825
  * @description fetch all unfilled currently open orders
826
+ * @see https://btc-alpha.github.io/api-docs/#list-own-orders
820
827
  * @param {string} symbol unified market symbol
821
828
  * @param {int} [since] the earliest time in ms to fetch open orders for
822
829
  * @param {int} [limit] the maximum number of open orders structures to retrieve
@@ -833,6 +840,7 @@ class btcalpha extends btcalpha$1 {
833
840
  * @method
834
841
  * @name btcalpha#fetchClosedOrders
835
842
  * @description fetches information on multiple closed orders made by the user
843
+ * @see https://btc-alpha.github.io/api-docs/#list-own-orders
836
844
  * @param {string} symbol unified market symbol of the market orders were made in
837
845
  * @param {int} [since] the earliest time in ms to fetch orders for
838
846
  * @param {int} [limit] the maximum number of order structures to retrieve
@@ -849,6 +857,7 @@ class btcalpha extends btcalpha$1 {
849
857
  * @method
850
858
  * @name btcalpha#fetchMyTrades
851
859
  * @description fetch all trades made by the user
860
+ * @see https://btc-alpha.github.io/api-docs/#list-own-exchanges
852
861
  * @param {string} symbol unified market symbol
853
862
  * @param {int} [since] the earliest time in ms to fetch trades for
854
863
  * @param {int} [limit] the maximum number of trades structures to retrieve
@@ -146,6 +146,7 @@ class btcbox extends btcbox$1 {
146
146
  * @method
147
147
  * @name btcbox#fetchBalance
148
148
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
149
+ * @see https://blog.btcbox.jp/en/archives/8762#toc13
149
150
  * @param {object} [params] extra parameters specific to the exchange API endpoint
150
151
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
151
152
  */
@@ -158,6 +159,7 @@ class btcbox extends btcbox$1 {
158
159
  * @method
159
160
  * @name btcbox#fetchOrderBook
160
161
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
162
+ * @see https://blog.btcbox.jp/en/archives/8762#toc6
161
163
  * @param {string} symbol unified symbol of the market to fetch the order book for
162
164
  * @param {int} [limit] the maximum amount of order book entries to return
163
165
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -204,6 +206,7 @@ class btcbox extends btcbox$1 {
204
206
  * @method
205
207
  * @name btcbox#fetchTicker
206
208
  * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
209
+ * @see https://blog.btcbox.jp/en/archives/8762#toc5
207
210
  * @param {string} symbol unified symbol of the market to fetch the ticker for
208
211
  * @param {object} [params] extra parameters specific to the exchange API endpoint
209
212
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -258,6 +261,7 @@ class btcbox extends btcbox$1 {
258
261
  * @method
259
262
  * @name btcbox#fetchTrades
260
263
  * @description get the list of most recent trades for a particular symbol
264
+ * @see https://blog.btcbox.jp/en/archives/8762#toc7
261
265
  * @param {string} symbol unified symbol of the market to fetch trades for
262
266
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
263
267
  * @param {int} [limit] the maximum amount of trades to fetch
@@ -290,6 +294,7 @@ class btcbox extends btcbox$1 {
290
294
  * @method
291
295
  * @name btcbox#createOrder
292
296
  * @description create a trade order
297
+ * @see https://blog.btcbox.jp/en/archives/8762#toc18
293
298
  * @param {string} symbol unified symbol of the market to create an order in
294
299
  * @param {string} type 'market' or 'limit'
295
300
  * @param {string} side 'buy' or 'sell'
@@ -320,6 +325,7 @@ class btcbox extends btcbox$1 {
320
325
  * @method
321
326
  * @name btcbox#cancelOrder
322
327
  * @description cancels an open order
328
+ * @see https://blog.btcbox.jp/en/archives/8762#toc17
323
329
  * @param {string} id order id
324
330
  * @param {string} symbol unified symbol of the market the order was made in
325
331
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -415,6 +421,7 @@ class btcbox extends btcbox$1 {
415
421
  * @method
416
422
  * @name btcbox#fetchOrder
417
423
  * @description fetches information on an order made by the user
424
+ * @see https://blog.btcbox.jp/en/archives/8762#toc16
418
425
  * @param {string} symbol unified symbol of the market the order was made in
419
426
  * @param {object} [params] extra parameters specific to the exchange API endpoint
420
427
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
@@ -483,6 +490,7 @@ class btcbox extends btcbox$1 {
483
490
  * @method
484
491
  * @name btcbox#fetchOrders
485
492
  * @description fetches information on multiple orders made by the user
493
+ * @see https://blog.btcbox.jp/en/archives/8762#toc15
486
494
  * @param {string} symbol unified market symbol of the market orders were made in
487
495
  * @param {int} [since] the earliest time in ms to fetch orders for
488
496
  * @param {int} [limit] the maximum number of order structures to retrieve
@@ -496,6 +504,7 @@ class btcbox extends btcbox$1 {
496
504
  * @method
497
505
  * @name btcbox#fetchOpenOrders
498
506
  * @description fetch all unfilled currently open orders
507
+ * @see https://blog.btcbox.jp/en/archives/8762#toc15
499
508
  * @param {string} symbol unified market symbol
500
509
  * @param {int} [since] the earliest time in ms to fetch open orders for
501
510
  * @param {int} [limit] the maximum number of open orders structures to retrieve
@@ -194,6 +194,7 @@ class btcmarkets extends btcmarkets$1 {
194
194
  * @method
195
195
  * @name btcmarkets#fetchDepositsWithdrawals
196
196
  * @description fetch history of deposits and withdrawals
197
+ * @see https://docs.btcmarkets.net/v3/#tag/Fund-Management-APIs/paths/~1v3~1transfers/get
197
198
  * @param {string} [code] unified currency code for the currency of the deposit/withdrawals, default is undefined
198
199
  * @param {int} [since] timestamp in ms of the earliest deposit/withdrawal, default is undefined
199
200
  * @param {int} [limit] max number of deposit/withdrawals to return, default is undefined
@@ -207,6 +208,7 @@ class btcmarkets extends btcmarkets$1 {
207
208
  * @method
208
209
  * @name btcmarkets#fetchDeposits
209
210
  * @description fetch all deposits made to an account
211
+ * @see https://docs.btcmarkets.net/v3/#tag/Fund-Management-APIs/paths/~1v3~1deposits/get
210
212
  * @param {string} code unified currency code
211
213
  * @param {int} [since] the earliest time in ms to fetch deposits for
212
214
  * @param {int} [limit] the maximum number of deposits structures to retrieve
@@ -220,6 +222,7 @@ class btcmarkets extends btcmarkets$1 {
220
222
  * @method
221
223
  * @name btcmarkets#fetchWithdrawals
222
224
  * @description fetch all withdrawals made from an account
225
+ * @see https://docs.btcmarkets.net/v3/#tag/Fund-Management-APIs/paths/~1v3~1withdrawals/get
223
226
  * @param {string} code unified currency code
224
227
  * @param {int} [since] the earliest time in ms to fetch withdrawals for
225
228
  * @param {int} [limit] the maximum number of withdrawals structures to retrieve
@@ -353,6 +356,7 @@ class btcmarkets extends btcmarkets$1 {
353
356
  * @method
354
357
  * @name btcmarkets#fetchMarkets
355
358
  * @description retrieves data on all markets for btcmarkets
359
+ * @see https://docs.btcmarkets.net/v3/#tag/Market-Data-APIs/paths/~1v3~1markets/get
356
360
  * @param {object} [params] extra parameters specific to the exchange API endpoint
357
361
  * @returns {object[]} an array of objects representing market data
358
362
  */
@@ -444,6 +448,7 @@ class btcmarkets extends btcmarkets$1 {
444
448
  * @method
445
449
  * @name btcmarkets#fetchTime
446
450
  * @description fetches the current integer timestamp in milliseconds from the exchange server
451
+ * @see https://docs.btcmarkets.net/v3/#tag/Misc-APIs/paths/~1v3~1time/get
447
452
  * @param {object} [params] extra parameters specific to the exchange API endpoint
448
453
  * @returns {int} the current integer timestamp in milliseconds from the exchange server
449
454
  */
@@ -473,6 +478,7 @@ class btcmarkets extends btcmarkets$1 {
473
478
  * @method
474
479
  * @name btcmarkets#fetchBalance
475
480
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
481
+ * @see https://docs.btcmarkets.net/v3/#tag/Account-APIs/paths/~1v3~1accounts~1me~1balances/get
476
482
  * @param {object} [params] extra parameters specific to the exchange API endpoint
477
483
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
478
484
  */
@@ -505,6 +511,7 @@ class btcmarkets extends btcmarkets$1 {
505
511
  * @method
506
512
  * @name btcmarkets#fetchOHLCV
507
513
  * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
514
+ * @see https://docs.btcmarkets.net/v3/#tag/Market-Data-APIs/paths/~1v3~1markets~1{marketId}~1candles/get
508
515
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
509
516
  * @param {string} timeframe the length of time each candle represents
510
517
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
@@ -544,6 +551,7 @@ class btcmarkets extends btcmarkets$1 {
544
551
  * @method
545
552
  * @name btcmarkets#fetchOrderBook
546
553
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
554
+ * @see https://docs.btcmarkets.net/v3/#tag/Market-Data-APIs/paths/~1v3~1markets~1{marketId}~1orderbook/get
547
555
  * @param {string} symbol unified symbol of the market to fetch the order book for
548
556
  * @param {int} [limit] the maximum amount of order book entries to return
549
557
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -631,6 +639,7 @@ class btcmarkets extends btcmarkets$1 {
631
639
  * @method
632
640
  * @name btcmarkets#fetchTicker
633
641
  * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
642
+ * @see https://docs.btcmarkets.net/v3/#tag/Market-Data-APIs/paths/~1v3~1markets~1{marketId}~1ticker/get
634
643
  * @param {string} symbol unified symbol of the market to fetch the ticker for
635
644
  * @param {object} [params] extra parameters specific to the exchange API endpoint
636
645
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -739,6 +748,7 @@ class btcmarkets extends btcmarkets$1 {
739
748
  * @method
740
749
  * @name btcmarkets#fetchTrades
741
750
  * @description get the list of most recent trades for a particular symbol
751
+ * @see https://docs.btcmarkets.net/v3/#tag/Market-Data-APIs/paths/~1v3~1markets~1{marketId}~1trades/get
742
752
  * @param {string} symbol unified symbol of the market to fetch trades for
743
753
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
744
754
  * @param {int} [limit] the maximum amount of trades to fetch
@@ -766,6 +776,7 @@ class btcmarkets extends btcmarkets$1 {
766
776
  * @method
767
777
  * @name btcmarkets#createOrder
768
778
  * @description create a trade order
779
+ * @see https://docs.btcmarkets.net/v3/#tag/Order-Placement-APIs/paths/~1v3~1orders/post
769
780
  * @param {string} symbol unified symbol of the market to create an order in
770
781
  * @param {string} type 'market' or 'limit'
771
782
  * @param {string} side 'buy' or 'sell'
@@ -866,6 +877,7 @@ class btcmarkets extends btcmarkets$1 {
866
877
  * @method
867
878
  * @name btcmarkets#cancelOrders
868
879
  * @description cancel multiple orders
880
+ * @see https://docs.btcmarkets.net/v3/#tag/Batch-Order-APIs/paths/~1v3~1batchorders~1{ids}/delete
869
881
  * @param {string[]} ids order ids
870
882
  * @param {string} symbol not used by btcmarkets cancelOrders ()
871
883
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -885,6 +897,7 @@ class btcmarkets extends btcmarkets$1 {
885
897
  * @method
886
898
  * @name btcmarkets#cancelOrder
887
899
  * @description cancels an open order
900
+ * @see https://docs.btcmarkets.net/v3/#operation/cancelOrder
888
901
  * @param {string} id order id
889
902
  * @param {string} symbol not used by btcmarket cancelOrder ()
890
903
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -1004,6 +1017,7 @@ class btcmarkets extends btcmarkets$1 {
1004
1017
  * @method
1005
1018
  * @name btcmarkets#fetchOrder
1006
1019
  * @description fetches information on an order made by the user
1020
+ * @see https://docs.btcmarkets.net/v3/#operation/getOrderById
1007
1021
  * @param {string} symbol not used by btcmarkets fetchOrder
1008
1022
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1009
1023
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
@@ -1020,6 +1034,7 @@ class btcmarkets extends btcmarkets$1 {
1020
1034
  * @method
1021
1035
  * @name btcmarkets#fetchOrders
1022
1036
  * @description fetches information on multiple orders made by the user
1037
+ * @see https://docs.btcmarkets.net/v3/#operation/listOrders
1023
1038
  * @param {string} symbol unified market symbol of the market orders were made in
1024
1039
  * @param {int} [since] the earliest time in ms to fetch orders for
1025
1040
  * @param {int} [limit] the maximum number of order structures to retrieve
@@ -1049,6 +1064,7 @@ class btcmarkets extends btcmarkets$1 {
1049
1064
  * @method
1050
1065
  * @name btcmarkets#fetchOpenOrders
1051
1066
  * @description fetch all unfilled currently open orders
1067
+ * @see https://docs.btcmarkets.net/v3/#operation/listOrders
1052
1068
  * @param {string} symbol unified market symbol
1053
1069
  * @param {int} [since] the earliest time in ms to fetch open orders for
1054
1070
  * @param {int} [limit] the maximum number of open orders structures to retrieve
@@ -1063,6 +1079,7 @@ class btcmarkets extends btcmarkets$1 {
1063
1079
  * @method
1064
1080
  * @name btcmarkets#fetchClosedOrders
1065
1081
  * @description fetches information on multiple closed orders made by the user
1082
+ * @see https://docs.btcmarkets.net/v3/#operation/listOrders
1066
1083
  * @param {string} symbol unified market symbol of the market orders were made in
1067
1084
  * @param {int} [since] the earliest time in ms to fetch orders for
1068
1085
  * @param {int} [limit] the maximum number of order structures to retrieve
@@ -1077,6 +1094,7 @@ class btcmarkets extends btcmarkets$1 {
1077
1094
  * @method
1078
1095
  * @name btcmarkets#fetchMyTrades
1079
1096
  * @description fetch all trades made by the user
1097
+ * @see https://docs.btcmarkets.net/v3/#operation/getTrades
1080
1098
  * @param {string} symbol unified market symbol
1081
1099
  * @param {int} [since] the earliest time in ms to fetch trades for
1082
1100
  * @param {int} [limit] the maximum number of trades structures to retrieve
@@ -1131,6 +1149,7 @@ class btcmarkets extends btcmarkets$1 {
1131
1149
  * @method
1132
1150
  * @name btcmarkets#withdraw
1133
1151
  * @description make a withdrawal
1152
+ * @see https://docs.btcmarkets.net/v3/#tag/Fund-Management-APIs/paths/~1v3~1withdrawals/post
1134
1153
  * @param {string} code unified currency code
1135
1154
  * @param {float} amount the amount to withdraw
1136
1155
  * @param {string} address the address to withdraw to
@@ -217,6 +217,7 @@ class coinbase extends coinbase$1 {
217
217
  'brokerage/orders/batch_cancel',
218
218
  'brokerage/orders/edit',
219
219
  'brokerage/orders/edit_preview',
220
+ 'brokerage/orders/preview',
220
221
  'brokerage/portfolios',
221
222
  'brokerage/portfolios/move_funds',
222
223
  'brokerage/convert/quote',
@@ -2212,11 +2213,12 @@ class coinbase extends coinbase$1 {
2212
2213
  * @param {string} [params.stop_direction] 'UNKNOWN_STOP_DIRECTION', 'STOP_DIRECTION_STOP_UP', 'STOP_DIRECTION_STOP_DOWN' the direction the stopPrice is triggered from
2213
2214
  * @param {string} [params.end_time] '2023-05-25T17:01:05.092Z' for 'GTD' orders
2214
2215
  * @param {float} [params.cost] *spot market buy only* the quote quantity that can be used as an alternative for the amount
2216
+ * @param {boolean} [params.preview] default to false, wether to use the test/preview endpoint or not
2215
2217
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
2216
2218
  */
2217
2219
  await this.loadMarkets();
2218
2220
  const market = this.market(symbol);
2219
- const request = {
2221
+ let request = {
2220
2222
  'client_order_id': this.uuid(),
2221
2223
  'product_id': market['id'],
2222
2224
  'side': side.toUpperCase(),
@@ -2351,7 +2353,16 @@ class coinbase extends coinbase$1 {
2351
2353
  }
2352
2354
  }
2353
2355
  params = this.omit(params, ['timeInForce', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice', 'stopPrice', 'stop_price', 'stopDirection', 'stop_direction', 'clientOrderId', 'postOnly', 'post_only', 'end_time']);
2354
- const response = await this.v3PrivatePostBrokerageOrders(this.extend(request, params));
2356
+ const preview = this.safeValue2(params, 'preview', 'test', false);
2357
+ let response = undefined;
2358
+ if (preview) {
2359
+ params = this.omit(params, ['preview', 'test']);
2360
+ request = this.omit(request, 'client_order_id');
2361
+ response = await this.v3PrivatePostBrokerageOrdersPreview(this.extend(request, params));
2362
+ }
2363
+ else {
2364
+ response = await this.v3PrivatePostBrokerageOrders(this.extend(request, params));
2365
+ }
2355
2366
  //
2356
2367
  // successful order
2357
2368
  //
@@ -799,37 +799,30 @@ class krakenfutures extends krakenfutures$1 {
799
799
  id = this.safeString(trade, 'executionId');
800
800
  }
801
801
  let order = this.safeString(trade, 'order_id');
802
- let symbolId = this.safeString(trade, 'symbol');
802
+ let marketId = this.safeString(trade, 'symbol');
803
803
  let side = this.safeString(trade, 'side');
804
804
  let type = undefined;
805
805
  const priorEdit = this.safeValue(trade, 'orderPriorEdit');
806
806
  const priorExecution = this.safeValue(trade, 'orderPriorExecution');
807
807
  if (priorExecution !== undefined) {
808
808
  order = this.safeString(priorExecution, 'orderId');
809
- symbolId = this.safeString(priorExecution, 'symbol');
809
+ marketId = this.safeString(priorExecution, 'symbol');
810
810
  side = this.safeString(priorExecution, 'side');
811
811
  type = this.safeString(priorExecution, 'type');
812
812
  }
813
813
  else if (priorEdit !== undefined) {
814
814
  order = this.safeString(priorEdit, 'orderId');
815
- symbolId = this.safeString(priorEdit, 'symbol');
815
+ marketId = this.safeString(priorEdit, 'symbol');
816
816
  side = this.safeString(priorEdit, 'type');
817
817
  type = this.safeString(priorEdit, 'type');
818
818
  }
819
819
  if (type !== undefined) {
820
820
  type = this.parseOrderType(type);
821
821
  }
822
- let symbol = undefined;
823
- if (symbolId !== undefined) {
824
- market = this.safeValue(this.markets_by_id, symbolId);
825
- if (market === undefined) {
826
- symbol = symbolId;
827
- }
828
- }
829
- symbol = this.safeString(market, 'symbol', symbol);
822
+ market = this.safeMarket(marketId, market);
830
823
  let cost = undefined;
824
+ const linear = this.safeBool(market, 'linear');
831
825
  if ((amount !== undefined) && (price !== undefined) && (market !== undefined)) {
832
- const linear = this.safeValue(market, 'linear');
833
826
  if (linear) {
834
827
  cost = Precise["default"].stringMul(amount, price); // in quote
835
828
  }
@@ -852,15 +845,15 @@ class krakenfutures extends krakenfutures$1 {
852
845
  return this.safeTrade({
853
846
  'info': trade,
854
847
  'id': id,
848
+ 'symbol': this.safeString(market, 'symbol'),
855
849
  'timestamp': timestamp,
856
850
  'datetime': this.iso8601(timestamp),
857
- 'symbol': symbol,
858
851
  'order': order,
859
852
  'type': type,
860
853
  'side': side,
861
854
  'takerOrMaker': takerOrMaker,
862
855
  'price': price,
863
- 'amount': amount,
856
+ 'amount': linear ? amount : undefined,
864
857
  'cost': cost,
865
858
  'fee': undefined,
866
859
  });
@@ -759,7 +759,7 @@ class luno extends luno$1 {
759
759
  'pair': market['id'],
760
760
  };
761
761
  if (since !== undefined) {
762
- request['since'] = parseInt(since);
762
+ request['since'] = this.parseToInt(since);
763
763
  }
764
764
  else {
765
765
  const duration = 1000 * 1000 * this.parseTimeframe(timeframe);
@@ -281,6 +281,7 @@ class okx extends okx$1 {
281
281
  'trade/easy-convert-history': 20,
282
282
  'trade/one-click-repay-currency-list': 20,
283
283
  'trade/one-click-repay-history': 20,
284
+ 'trade/account-rate-limit': 1,
284
285
  // asset
285
286
  'asset/currencies': 5 / 3,
286
287
  'asset/balances': 5 / 3,
@@ -1625,7 +1626,7 @@ class okx extends okx$1 {
1625
1626
  if ((networkId !== undefined) && (networkId.indexOf('-') >= 0)) {
1626
1627
  const parts = networkId.split('-');
1627
1628
  const chainPart = this.safeString(parts, 1, networkId);
1628
- const networkCode = this.safeNetwork(chainPart);
1629
+ const networkCode = this.networkIdToCode(chainPart, currency['code']);
1629
1630
  const precision = this.parsePrecision(this.safeString(chain, 'wdTickSz'));
1630
1631
  if (maxPrecision === undefined) {
1631
1632
  maxPrecision = precision;
@@ -3644,7 +3645,6 @@ class okx extends okx$1 {
3644
3645
  * @param {int} [since] the earliest time in ms to fetch open orders for
3645
3646
  * @param {int} [limit] the maximum number of open orders structures to retrieve
3646
3647
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3647
- * @param {int} [params.till] Timestamp in ms of the latest time to retrieve orders for
3648
3648
  * @param {bool} [params.stop] True if fetching trigger or conditional orders
3649
3649
  * @param {string} [params.ordType] "conditional", "oco", "trigger", "move_order_stop", "iceberg", or "twap"
3650
3650
  * @param {string} [params.algoId] Algo ID "'433845797218942976'"
@@ -1702,13 +1702,13 @@ class poloniexfutures extends poloniexfutures$1 {
1702
1702
  const trades = this.safeValue(data, 'items', {});
1703
1703
  return this.parseTrades(trades, market, since, limit);
1704
1704
  }
1705
- async setMarginMode(marginMode, symbol, params = {}) {
1705
+ async setMarginMode(marginMode, symbol = undefined, params = {}) {
1706
1706
  /**
1707
1707
  * @method
1708
1708
  * @name poloniexfutures#setMarginMode
1709
1709
  * @description set margin mode to 'cross' or 'isolated'
1710
1710
  * @see https://futures-docs.poloniex.com/#change-margin-mode
1711
- * @param {int} marginMode 0 (isolated) or 1 (cross)
1711
+ * @param {string} marginMode "0" (isolated) or "1" (cross)
1712
1712
  * @param {string} symbol unified market symbol
1713
1713
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1714
1714
  * @returns {object} response from the exchange
@@ -1716,14 +1716,20 @@ class poloniexfutures extends poloniexfutures$1 {
1716
1716
  if (symbol === undefined) {
1717
1717
  throw new errors.ArgumentsRequired(this.id + ' setMarginMode() requires a symbol argument');
1718
1718
  }
1719
- if ((marginMode !== 0) && (marginMode !== 1)) {
1720
- throw new errors.ArgumentsRequired(this.id + ' setMarginMode() marginMode must be 0 (isolated) or 1 (cross)');
1719
+ if ((marginMode !== '0') && (marginMode !== '1') && (marginMode !== 'isolated') && (marginMode !== 'cross')) {
1720
+ throw new errors.ArgumentsRequired(this.id + ' setMarginMode() marginMode must be 0/isolated or 1/cross');
1721
1721
  }
1722
1722
  await this.loadMarkets();
1723
+ if (marginMode === 'isolated') {
1724
+ marginMode = '0';
1725
+ }
1726
+ if (marginMode === 'cross') {
1727
+ marginMode = '1';
1728
+ }
1723
1729
  const market = this.market(symbol);
1724
1730
  const request = {
1725
1731
  'symbol': market['id'],
1726
- 'marginType': marginMode,
1732
+ 'marginType': this.parseToInt(marginMode),
1727
1733
  };
1728
1734
  return await this.privatePostMarginTypeChange(request);
1729
1735
  }