ccxt 4.2.48 → 4.2.50

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 (67) hide show
  1. package/README.md +3 -3
  2. package/build.sh +7 -0
  3. package/dist/ccxt.browser.js +598 -48
  4. package/dist/ccxt.browser.min.js +3 -3
  5. package/dist/cjs/ccxt.js +1 -1
  6. package/dist/cjs/src/base/Exchange.js +5 -0
  7. package/dist/cjs/src/binance.js +9 -4
  8. package/dist/cjs/src/bitmart.js +30 -4
  9. package/dist/cjs/src/bitstamp.js +8 -0
  10. package/dist/cjs/src/bl3p.js +47 -0
  11. package/dist/cjs/src/btcalpha.js +4 -0
  12. package/dist/cjs/src/btcmarkets.js +4 -0
  13. package/dist/cjs/src/btcturk.js +4 -0
  14. package/dist/cjs/src/bybit.js +138 -6
  15. package/dist/cjs/src/independentreserve.js +48 -0
  16. package/dist/cjs/src/latoken.js +16 -0
  17. package/dist/cjs/src/luno.js +18 -0
  18. package/dist/cjs/src/lykke.js +19 -0
  19. package/dist/cjs/src/ndax.js +18 -0
  20. package/dist/cjs/src/pro/ascendex.js +22 -7
  21. package/dist/cjs/src/pro/bequant.js +3 -4
  22. package/dist/cjs/src/pro/binance.js +29 -2
  23. package/dist/cjs/src/pro/bitget.js +28 -7
  24. package/dist/cjs/src/pro/bitstamp.js +1 -1
  25. package/dist/cjs/src/pro/gemini.js +89 -1
  26. package/dist/cjs/src/pro/mexc.js +2 -1
  27. package/dist/cjs/src/pro/whitebit.js +9 -8
  28. package/dist/cjs/src/timex.js +35 -1
  29. package/dist/cjs/src/upbit.js +11 -2
  30. package/js/ccxt.d.ts +1 -1
  31. package/js/ccxt.js +1 -1
  32. package/js/src/abstract/bitstamp.d.ts +8 -0
  33. package/js/src/base/Exchange.d.ts +1 -0
  34. package/js/src/base/Exchange.js +5 -0
  35. package/js/src/binance.js +9 -4
  36. package/js/src/bitmart.js +30 -4
  37. package/js/src/bitstamp.js +8 -0
  38. package/js/src/bl3p.d.ts +15 -1
  39. package/js/src/bl3p.js +47 -0
  40. package/js/src/btcalpha.js +4 -0
  41. package/js/src/btcmarkets.js +4 -0
  42. package/js/src/btcturk.js +4 -0
  43. package/js/src/bybit.d.ts +3 -1
  44. package/js/src/bybit.js +138 -6
  45. package/js/src/independentreserve.d.ts +15 -1
  46. package/js/src/independentreserve.js +48 -0
  47. package/js/src/latoken.js +16 -0
  48. package/js/src/luno.js +18 -0
  49. package/js/src/lykke.js +19 -0
  50. package/js/src/ndax.js +18 -0
  51. package/js/src/pro/ascendex.d.ts +1 -0
  52. package/js/src/pro/ascendex.js +22 -7
  53. package/js/src/pro/bequant.js +3 -4
  54. package/js/src/pro/binance.d.ts +1 -0
  55. package/js/src/pro/binance.js +29 -2
  56. package/js/src/pro/bitget.js +28 -7
  57. package/js/src/pro/bitstamp.js +1 -1
  58. package/js/src/pro/gemini.d.ts +3 -1
  59. package/js/src/pro/gemini.js +89 -1
  60. package/js/src/pro/mexc.js +2 -1
  61. package/js/src/pro/whitebit.js +9 -8
  62. package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +1 -1
  63. package/js/src/timex.d.ts +1 -0
  64. package/js/src/timex.js +35 -1
  65. package/js/src/upbit.js +11 -2
  66. package/package.json +3 -1
  67. package/skip-tests.json +4 -3
package/js/src/luno.js CHANGED
@@ -185,6 +185,7 @@ export default class luno extends Exchange {
185
185
  * @method
186
186
  * @name luno#fetchMarkets
187
187
  * @description retrieves data on all markets for luno
188
+ * @see https://www.luno.com/en/developers/api#tag/Market/operation/Markets
188
189
  * @param {object} [params] extra parameters specific to the exchange API endpoint
189
190
  * @returns {object[]} an array of objects representing market data
190
191
  */
@@ -275,6 +276,7 @@ export default class luno extends Exchange {
275
276
  * @method
276
277
  * @name luno#fetchAccounts
277
278
  * @description fetch all the accounts associated with a profile
279
+ * @see https://www.luno.com/en/developers/api#tag/Accounts/operation/getBalances
278
280
  * @param {object} [params] extra parameters specific to the exchange API endpoint
279
281
  * @returns {object} a dictionary of [account structures]{@link https://docs.ccxt.com/#/?id=account-structure} indexed by the account type
280
282
  */
@@ -329,6 +331,7 @@ export default class luno extends Exchange {
329
331
  * @method
330
332
  * @name luno#fetchBalance
331
333
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
334
+ * @see https://www.luno.com/en/developers/api#tag/Accounts/operation/getBalances
332
335
  * @param {object} [params] extra parameters specific to the exchange API endpoint
333
336
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
334
337
  */
@@ -351,6 +354,8 @@ export default class luno extends Exchange {
351
354
  * @method
352
355
  * @name luno#fetchOrderBook
353
356
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
357
+ * @see https://www.luno.com/en/developers/api#tag/Market/operation/GetOrderBookFull
358
+ * @see https://www.luno.com/en/developers/api#tag/Market/operation/GetOrderBook
354
359
  * @param {string} symbol unified symbol of the market to fetch the order book for
355
360
  * @param {int} [limit] the maximum amount of order book entries to return
356
361
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -459,6 +464,7 @@ export default class luno extends Exchange {
459
464
  * @method
460
465
  * @name luno#fetchOrder
461
466
  * @description fetches information on an order made by the user
467
+ * @see https://www.luno.com/en/developers/api#tag/Orders/operation/GetOrder
462
468
  * @param {string} symbol not used by luno fetchOrder
463
469
  * @param {object} [params] extra parameters specific to the exchange API endpoint
464
470
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
@@ -490,6 +496,7 @@ export default class luno extends Exchange {
490
496
  * @method
491
497
  * @name luno#fetchOrders
492
498
  * @description fetches information on multiple orders made by the user
499
+ * @see https://www.luno.com/en/developers/api#tag/Orders/operation/ListOrders
493
500
  * @param {string} symbol unified market symbol of the market orders were made in
494
501
  * @param {int} [since] the earliest time in ms to fetch orders for
495
502
  * @param {int} [limit] the maximum number of order structures to retrieve
@@ -503,6 +510,7 @@ export default class luno extends Exchange {
503
510
  * @method
504
511
  * @name luno#fetchOpenOrders
505
512
  * @description fetch all unfilled currently open orders
513
+ * @see https://www.luno.com/en/developers/api#tag/Orders/operation/ListOrders
506
514
  * @param {string} symbol unified market symbol
507
515
  * @param {int} [since] the earliest time in ms to fetch open orders for
508
516
  * @param {int} [limit] the maximum number of open orders structures to retrieve
@@ -516,6 +524,7 @@ export default class luno extends Exchange {
516
524
  * @method
517
525
  * @name luno#fetchClosedOrders
518
526
  * @description fetches information on multiple closed orders made by the user
527
+ * @see https://www.luno.com/en/developers/api#tag/Orders/operation/ListOrders
519
528
  * @param {string} symbol unified market symbol of the market orders were made in
520
529
  * @param {int} [since] the earliest time in ms to fetch orders for
521
530
  * @param {int} [limit] the maximum number of order structures to retrieve
@@ -566,6 +575,7 @@ export default class luno extends Exchange {
566
575
  * @method
567
576
  * @name luno#fetchTickers
568
577
  * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
578
+ * @see https://www.luno.com/en/developers/api#tag/Market/operation/GetTickers
569
579
  * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
570
580
  * @param {object} [params] extra parameters specific to the exchange API endpoint
571
581
  * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -590,6 +600,7 @@ export default class luno extends Exchange {
590
600
  * @method
591
601
  * @name luno#fetchTicker
592
602
  * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
603
+ * @see https://www.luno.com/en/developers/api#tag/Market/operation/GetTicker
593
604
  * @param {string} symbol unified symbol of the market to fetch the ticker for
594
605
  * @param {object} [params] extra parameters specific to the exchange API endpoint
595
606
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -711,6 +722,7 @@ export default class luno extends Exchange {
711
722
  * @method
712
723
  * @name luno#fetchTrades
713
724
  * @description get the list of most recent trades for a particular symbol
725
+ * @see https://www.luno.com/en/developers/api#tag/Market/operation/ListTrades
714
726
  * @param {string} symbol unified symbol of the market to fetch trades for
715
727
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
716
728
  * @param {int} [limit] the maximum amount of trades to fetch
@@ -811,6 +823,7 @@ export default class luno extends Exchange {
811
823
  * @method
812
824
  * @name luno#fetchMyTrades
813
825
  * @description fetch all trades made by the user
826
+ * @see https://www.luno.com/en/developers/api#tag/Orders/operation/ListUserTrades
814
827
  * @param {string} symbol unified market symbol
815
828
  * @param {int} [since] the earliest time in ms to fetch trades for
816
829
  * @param {int} [limit] the maximum number of trades structures to retrieve
@@ -861,6 +874,7 @@ export default class luno extends Exchange {
861
874
  * @method
862
875
  * @name luno#fetchTradingFee
863
876
  * @description fetch the trading fees for a market
877
+ * @see https://www.luno.com/en/developers/api#tag/Orders/operation/getFeeInfo
864
878
  * @param {string} symbol unified market symbol
865
879
  * @param {object} [params] extra parameters specific to the exchange API endpoint
866
880
  * @returns {object} a [fee structure]{@link https://docs.ccxt.com/#/?id=fee-structure}
@@ -890,6 +904,8 @@ export default class luno extends Exchange {
890
904
  * @method
891
905
  * @name luno#createOrder
892
906
  * @description create a trade order
907
+ * @see https://www.luno.com/en/developers/api#tag/Orders/operation/PostMarketOrder
908
+ * @see https://www.luno.com/en/developers/api#tag/Orders/operation/PostLimitOrder
893
909
  * @param {string} symbol unified symbol of the market to create an order in
894
910
  * @param {string} type 'market' or 'limit'
895
911
  * @param {string} side 'buy' or 'sell'
@@ -931,6 +947,7 @@ export default class luno extends Exchange {
931
947
  * @method
932
948
  * @name luno#cancelOrder
933
949
  * @description cancels an open order
950
+ * @see https://www.luno.com/en/developers/api#tag/Orders/operation/StopOrder
934
951
  * @param {string} id order id
935
952
  * @param {string} symbol unified symbol of the market the order was made in
936
953
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -962,6 +979,7 @@ export default class luno extends Exchange {
962
979
  * @method
963
980
  * @name luno#fetchLedger
964
981
  * @description fetch the history of changes, actions done by the user or operations that altered balance of the user
982
+ * @see https://www.luno.com/en/developers/api#tag/Accounts/operation/ListTransactions
965
983
  * @param {string} code unified currency code, default is undefined
966
984
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
967
985
  * @param {int} [limit] max number of ledger entrys to return, default is undefined
package/js/src/lykke.js CHANGED
@@ -187,6 +187,7 @@ export default class lykke extends Exchange {
187
187
  * @method
188
188
  * @name lykke#fetchCurrencies
189
189
  * @description fetches all available currencies on an exchange
190
+ * @see https://lykkecity.github.io/Trading-API/#get-all-assets
190
191
  * @param {object} [params] extra parameters specific to the exchange API endpoint
191
192
  * @returns {object} an associative dictionary of currencies
192
193
  */
@@ -265,6 +266,7 @@ export default class lykke extends Exchange {
265
266
  * @method
266
267
  * @name lykke#fetchMarkets
267
268
  * @description retrieves data on all markets for lykke
269
+ * @see https://lykkecity.github.io/Trading-API/#get-asset-by-id
268
270
  * @param {object} [params] extra parameters specific to the exchange API endpoint
269
271
  * @returns {object[]} an array of objects representing market data
270
272
  */
@@ -424,6 +426,8 @@ export default class lykke extends Exchange {
424
426
  * @method
425
427
  * @name lykke#fetchTicker
426
428
  * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
429
+ * @see https://lykkecity.github.io/Trading-API/#get-current-prices
430
+ * @see https://lykkecity.github.io/Trading-API/#24hr-ticker-price-change-statistics
427
431
  * @param {string} symbol unified symbol of the market to fetch the ticker for
428
432
  * @param {object} [params] extra parameters specific to the exchange API endpoint
429
433
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -483,6 +487,7 @@ export default class lykke extends Exchange {
483
487
  * @method
484
488
  * @name lykke#fetchTickers
485
489
  * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
490
+ * @see https://lykkecity.github.io/Trading-API/#24hr-ticker-price-change-statistics
486
491
  * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
487
492
  * @param {object} [params] extra parameters specific to the exchange API endpoint
488
493
  * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -514,6 +519,7 @@ export default class lykke extends Exchange {
514
519
  * @method
515
520
  * @name lykke#fetchOrderBook
516
521
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
522
+ * @see https://lykkecity.github.io/Trading-API/#asset-pair-order-book-ticker
517
523
  * @param {string} symbol unified symbol of the market to fetch the order book for
518
524
  * @param {int} [limit] the maximum amount of order book entries to return
519
525
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -618,6 +624,7 @@ export default class lykke extends Exchange {
618
624
  * @method
619
625
  * @name lykke#fetchTrades
620
626
  * @description get the list of most recent trades for a particular symbol
627
+ * @see https://lykkecity.github.io/Trading-API/#get-public-trades
621
628
  * @param {string} symbol unified symbol of the market to fetch trades for
622
629
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
623
630
  * @param {int} [limit] the maximum amount of trades to fetch
@@ -682,6 +689,7 @@ export default class lykke extends Exchange {
682
689
  * @method
683
690
  * @name lykke#fetchBalance
684
691
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
692
+ * @see https://lykkecity.github.io/Trading-API/#get-the-current-balance
685
693
  * @param {object} [params] extra parameters specific to the exchange API endpoint
686
694
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
687
695
  */
@@ -777,6 +785,8 @@ export default class lykke extends Exchange {
777
785
  * @method
778
786
  * @name lykke#createOrder
779
787
  * @description create a trade order
788
+ * @see https://lykkecity.github.io/Trading-API/#place-a-limit-order
789
+ * @see https://lykkecity.github.io/Trading-API/#place-a-market-order
780
790
  * @param {string} symbol unified symbol of the market to create an order in
781
791
  * @param {string} type 'market' or 'limit'
782
792
  * @param {string} side 'buy' or 'sell'
@@ -853,6 +863,7 @@ export default class lykke extends Exchange {
853
863
  * @method
854
864
  * @name lykke#cancelOrder
855
865
  * @description cancels an open order
866
+ * @see https://lykkecity.github.io/Trading-API/#cancel-orders-by-id
856
867
  * @param {string} id order id
857
868
  * @param {string} symbol unified symbol of the market the order was made in
858
869
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -874,6 +885,7 @@ export default class lykke extends Exchange {
874
885
  * @method
875
886
  * @name lykke#cancelAllOrders
876
887
  * @description cancel all open orders
888
+ * @see https://lykkecity.github.io/Trading-API/#mass-cancel-orders
877
889
  * @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
878
890
  * @param {object} [params] extra parameters specific to the exchange API endpoint
879
891
  * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
@@ -900,6 +912,7 @@ export default class lykke extends Exchange {
900
912
  * @method
901
913
  * @name lykke#fetchOrder
902
914
  * @description fetches information on an order made by the user
915
+ * @see https://lykkecity.github.io/Trading-API/#get-order-by-id
903
916
  * @param {string} symbol not used by lykke fetchOrder
904
917
  * @param {object} [params] extra parameters specific to the exchange API endpoint
905
918
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
@@ -936,6 +949,7 @@ export default class lykke extends Exchange {
936
949
  * @method
937
950
  * @name lykke#fetchOpenOrders
938
951
  * @description fetch all unfilled currently open orders
952
+ * @see https://lykkecity.github.io/Trading-API/#get-active-or-closed-orders
939
953
  * @param {string} symbol unified market symbol
940
954
  * @param {int} [since] the earliest time in ms to fetch open orders for
941
955
  * @param {int} [limit] the maximum number of open orders structures to retrieve
@@ -984,6 +998,7 @@ export default class lykke extends Exchange {
984
998
  * @method
985
999
  * @name lykke#fetchClosedOrders
986
1000
  * @description fetches information on multiple closed orders made by the user
1001
+ * @see https://lykkecity.github.io/Trading-API/#get-active-or-closed-orders
987
1002
  * @param {string} symbol unified market symbol of the market orders were made in
988
1003
  * @param {int} [since] the earliest time in ms to fetch orders for
989
1004
  * @param {int} [limit] the maximum number of order structures to retrieve
@@ -1032,6 +1047,7 @@ export default class lykke extends Exchange {
1032
1047
  * @method
1033
1048
  * @name lykke#fetchMyTrades
1034
1049
  * @description fetch all trades made by the user
1050
+ * @see https://lykkecity.github.io/Trading-API/#get-trade-history
1035
1051
  * @param {string} symbol unified market symbol
1036
1052
  * @param {int} [since] the earliest time in ms to fetch trades for
1037
1053
  * @param {int} [limit] the maximum number of trades structures to retrieve
@@ -1091,6 +1107,7 @@ export default class lykke extends Exchange {
1091
1107
  * @method
1092
1108
  * @name lykke#fetchDepositAddress
1093
1109
  * @description fetch the deposit address for a currency associated with this account
1110
+ * @see https://lykkecity.github.io/Trading-API/#get-deposit-address-for-a-given-asset
1094
1111
  * @param {string} code unified currency code
1095
1112
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1096
1113
  * @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
@@ -1188,6 +1205,7 @@ export default class lykke extends Exchange {
1188
1205
  * @method
1189
1206
  * @name lykke#fetchDepositsWithdrawals
1190
1207
  * @description fetch history of deposits and withdrawals
1208
+ * @see https://lykkecity.github.io/Trading-API/#get-the-history-of-withdrawals-and-deposits
1191
1209
  * @param {string} [code] unified currency code for the currency of the deposit/withdrawals, default is undefined
1192
1210
  * @param {int} [since] timestamp in ms of the earliest deposit/withdrawal, default is undefined
1193
1211
  * @param {int} [limit] max number of deposit/withdrawals to return, default is undefined
@@ -1230,6 +1248,7 @@ export default class lykke extends Exchange {
1230
1248
  * @method
1231
1249
  * @name lykke#withdraw
1232
1250
  * @description make a withdrawal
1251
+ * @see https://lykkecity.github.io/Trading-API/#withdrawal
1233
1252
  * @param {string} code unified currency code
1234
1253
  * @param {float} amount the amount to withdraw
1235
1254
  * @param {string} address the address to withdraw to
package/js/src/ndax.js CHANGED
@@ -283,6 +283,7 @@ export default class ndax extends Exchange {
283
283
  * @method
284
284
  * @name ndax#signIn
285
285
  * @description sign in, must be called prior to using other authenticated methods
286
+ * @see https://apidoc.ndax.io/#authenticate2fa
286
287
  * @param {object} [params] extra parameters specific to the exchange API endpoint
287
288
  * @returns response from exchange
288
289
  */
@@ -336,6 +337,7 @@ export default class ndax extends Exchange {
336
337
  * @method
337
338
  * @name ndax#fetchCurrencies
338
339
  * @description fetches all available currencies on an exchange
340
+ * @see https://apidoc.ndax.io/#getproduct
339
341
  * @param {object} [params] extra parameters specific to the exchange API endpoint
340
342
  * @returns {object} an associative dictionary of currencies
341
343
  */
@@ -405,6 +407,7 @@ export default class ndax extends Exchange {
405
407
  * @method
406
408
  * @name ndax#fetchMarkets
407
409
  * @description retrieves data on all markets for ndax
410
+ * @see https://apidoc.ndax.io/#getinstruments
408
411
  * @param {object} [params] extra parameters specific to the exchange API endpoint
409
412
  * @returns {object[]} an array of objects representing market data
410
413
  */
@@ -564,6 +567,7 @@ export default class ndax extends Exchange {
564
567
  * @method
565
568
  * @name ndax#fetchOrderBook
566
569
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
570
+ * @see https://apidoc.ndax.io/#getl2snapshot
567
571
  * @param {string} symbol unified symbol of the market to fetch the order book for
568
572
  * @param {int} [limit] the maximum amount of order book entries to return
569
573
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -674,6 +678,7 @@ export default class ndax extends Exchange {
674
678
  * @method
675
679
  * @name ndax#fetchTicker
676
680
  * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
681
+ * @see https://apidoc.ndax.io/#getlevel1
677
682
  * @param {string} symbol unified symbol of the market to fetch the ticker for
678
683
  * @param {object} [params] extra parameters specific to the exchange API endpoint
679
684
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -746,6 +751,7 @@ export default class ndax extends Exchange {
746
751
  * @method
747
752
  * @name ndax#fetchOHLCV
748
753
  * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
754
+ * @see https://apidoc.ndax.io/#gettickerhistory
749
755
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
750
756
  * @param {string} timeframe the length of time each candle represents
751
757
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
@@ -992,6 +998,7 @@ export default class ndax extends Exchange {
992
998
  * @method
993
999
  * @name ndax#fetchAccounts
994
1000
  * @description fetch all the accounts associated with a profile
1001
+ * @see https://apidoc.ndax.io/#getuseraccounts
995
1002
  * @param {object} [params] extra parameters specific to the exchange API endpoint
996
1003
  * @returns {object} a dictionary of [account structures]{@link https://docs.ccxt.com/#/?id=account-structure} indexed by the account type
997
1004
  */
@@ -1045,6 +1052,7 @@ export default class ndax extends Exchange {
1045
1052
  * @method
1046
1053
  * @name ndax#fetchBalance
1047
1054
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
1055
+ * @see https://apidoc.ndax.io/#getaccountpositions
1048
1056
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1049
1057
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
1050
1058
  */
@@ -1172,6 +1180,7 @@ export default class ndax extends Exchange {
1172
1180
  * @method
1173
1181
  * @name ndax#fetchLedger
1174
1182
  * @description fetch the history of changes, actions done by the user or operations that altered balance of the user
1183
+ * @see https://apidoc.ndax.io/#getaccounttransactions
1175
1184
  * @param {string} code unified currency code, default is undefined
1176
1185
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
1177
1186
  * @param {int} [limit] max number of ledger entrys to return, default is undefined
@@ -1326,6 +1335,7 @@ export default class ndax extends Exchange {
1326
1335
  * @method
1327
1336
  * @name ndax#createOrder
1328
1337
  * @description create a trade order
1338
+ * @see https://apidoc.ndax.io/#sendorder
1329
1339
  * @param {string} symbol unified symbol of the market to create an order in
1330
1340
  * @param {string} type 'market' or 'limit'
1331
1341
  * @param {string} side 'buy' or 'sell'
@@ -1444,6 +1454,7 @@ export default class ndax extends Exchange {
1444
1454
  * @method
1445
1455
  * @name ndax#fetchMyTrades
1446
1456
  * @description fetch all trades made by the user
1457
+ * @see https://apidoc.ndax.io/#gettradeshistory
1447
1458
  * @param {string} symbol unified market symbol
1448
1459
  * @param {int} [since] the earliest time in ms to fetch trades for
1449
1460
  * @param {int} [limit] the maximum number of trades structures to retrieve
@@ -1531,6 +1542,7 @@ export default class ndax extends Exchange {
1531
1542
  * @method
1532
1543
  * @name ndax#cancelAllOrders
1533
1544
  * @description cancel all open orders
1545
+ * @see https://apidoc.ndax.io/#cancelallorders
1534
1546
  * @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
1535
1547
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1536
1548
  * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
@@ -1565,6 +1577,7 @@ export default class ndax extends Exchange {
1565
1577
  * @method
1566
1578
  * @name ndax#cancelOrder
1567
1579
  * @description cancels an open order
1580
+ * @see https://apidoc.ndax.io/#cancelorder
1568
1581
  * @param {string} id order id
1569
1582
  * @param {string} symbol unified symbol of the market the order was made in
1570
1583
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -1604,6 +1617,7 @@ export default class ndax extends Exchange {
1604
1617
  * @method
1605
1618
  * @name ndax#fetchOpenOrders
1606
1619
  * @description fetch all unfilled currently open orders
1620
+ * @see https://apidoc.ndax.io/#getopenorders
1607
1621
  * @param {string} symbol unified market symbol
1608
1622
  * @param {int} [since] the earliest time in ms to fetch open orders for
1609
1623
  * @param {int} [limit] the maximum number of open orders structures to retrieve
@@ -1682,6 +1696,7 @@ export default class ndax extends Exchange {
1682
1696
  * @method
1683
1697
  * @name ndax#fetchOrders
1684
1698
  * @description fetches information on multiple orders made by the user
1699
+ * @see https://apidoc.ndax.io/#getorderhistory
1685
1700
  * @param {string} symbol unified market symbol of the market orders were made in
1686
1701
  * @param {int} [since] the earliest time in ms to fetch orders for
1687
1702
  * @param {int} [limit] the maximum number of order structures to retrieve
@@ -1776,6 +1791,7 @@ export default class ndax extends Exchange {
1776
1791
  * @method
1777
1792
  * @name ndax#fetchOrder
1778
1793
  * @description fetches information on an order made by the user
1794
+ * @see https://apidoc.ndax.io/#getorderstatus
1779
1795
  * @param {string} symbol unified symbol of the market the order was made in
1780
1796
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1781
1797
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
@@ -1851,6 +1867,7 @@ export default class ndax extends Exchange {
1851
1867
  * @method
1852
1868
  * @name ndax#fetchOrderTrades
1853
1869
  * @description fetch all the trades made from a single order
1870
+ * @see https://apidoc.ndax.io/#getorderhistorybyorderid
1854
1871
  * @param {string} id order id
1855
1872
  * @param {string} symbol unified market symbol
1856
1873
  * @param {int} [since] the earliest time in ms to fetch trades for
@@ -2079,6 +2096,7 @@ export default class ndax extends Exchange {
2079
2096
  * @method
2080
2097
  * @name ndax#fetchWithdrawals
2081
2098
  * @description fetch all withdrawals made from an account
2099
+ * @see https://apidoc.ndax.io/#getwithdraws
2082
2100
  * @param {string} code unified currency code
2083
2101
  * @param {int} [since] the earliest time in ms to fetch withdrawals for
2084
2102
  * @param {int} [limit] the maximum number of withdrawals structures to retrieve
@@ -11,6 +11,7 @@ export default class ascendex extends ascendexRest {
11
11
  handleTrades(client: Client, message: any): void;
12
12
  watchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
13
13
  watchOrderBookSnapshot(symbol: string, limit?: Int, params?: {}): Promise<any>;
14
+ fetchOrderBookSnapshot(symbol: string, limit?: Int, params?: {}): Promise<import("../base/ws/OrderBook.js").OrderBook>;
14
15
  handleOrderBookSnapshot(client: Client, message: any): void;
15
16
  handleOrderBook(client: Client, message: any): void;
16
17
  handleDelta(bookside: any, delta: any): void;
@@ -211,7 +211,7 @@ export default class ascendex extends ascendexRest {
211
211
  */
212
212
  await this.loadMarkets();
213
213
  const market = this.market(symbol);
214
- const channel = 'depth-realtime' + ':' + market['id'];
214
+ const channel = 'depth' + ':' + market['id'];
215
215
  params = this.extend(params, {
216
216
  'ch': channel,
217
217
  });
@@ -221,7 +221,7 @@ export default class ascendex extends ascendexRest {
221
221
  async watchOrderBookSnapshot(symbol, limit = undefined, params = {}) {
222
222
  await this.loadMarkets();
223
223
  const market = this.market(symbol);
224
- const action = 'depth-snapshot-realtime';
224
+ const action = 'depth-snapshot';
225
225
  const channel = action + ':' + market['id'];
226
226
  params = this.extend(params, {
227
227
  'action': action,
@@ -233,6 +233,15 @@ export default class ascendex extends ascendexRest {
233
233
  const orderbook = await this.watchPublic(channel, params);
234
234
  return orderbook.limit();
235
235
  }
236
+ async fetchOrderBookSnapshot(symbol, limit = undefined, params = {}) {
237
+ const restOrderBook = await this.fetchRestOrderBookSafe(symbol, limit, params);
238
+ if (!(symbol in this.orderbooks)) {
239
+ this.orderbooks[symbol] = this.orderBook();
240
+ }
241
+ const orderbook = this.orderbooks[symbol];
242
+ orderbook.reset(restOrderBook);
243
+ return orderbook;
244
+ }
236
245
  handleOrderBookSnapshot(client, message) {
237
246
  //
238
247
  // {
@@ -869,8 +878,8 @@ export default class ascendex extends ascendexRest {
869
878
  'ping': this.handlePing,
870
879
  'auth': this.handleAuthenticate,
871
880
  'sub': this.handleSubscriptionStatus,
872
- 'depth-realtime': this.handleOrderBook,
873
- 'depth-snapshot-realtime': this.handleOrderBookSnapshot,
881
+ 'depth': this.handleOrderBook,
882
+ 'depth-snapshot': this.handleOrderBookSnapshot,
874
883
  'trades': this.handleTrades,
875
884
  'bar': this.handleOHLCV,
876
885
  'balance': this.handleBalance,
@@ -897,7 +906,7 @@ export default class ascendex extends ascendexRest {
897
906
  // { m: 'sub', id: "1647515701", ch: "depth:BTC/USDT", code: 0 }
898
907
  //
899
908
  const channel = this.safeString(message, 'ch', '');
900
- if (channel.indexOf('depth-realtime') > -1) {
909
+ if (channel.indexOf('depth') > -1 && !(channel.indexOf('depth-snapshot') > -1)) {
901
910
  this.handleOrderBookSubscription(client, message);
902
911
  }
903
912
  return message;
@@ -906,12 +915,18 @@ export default class ascendex extends ascendexRest {
906
915
  const channel = this.safeString(message, 'ch');
907
916
  const parts = channel.split(':');
908
917
  const marketId = parts[1];
909
- const symbol = this.safeSymbol(marketId);
918
+ const market = this.safeMarket(marketId);
919
+ const symbol = market['symbol'];
910
920
  if (symbol in this.orderbooks) {
911
921
  delete this.orderbooks[symbol];
912
922
  }
913
923
  this.orderbooks[symbol] = this.orderBook({});
914
- this.spawn(this.watchOrderBookSnapshot, symbol);
924
+ if (this.options['defaultType'] === 'swap' || market['contract']) {
925
+ this.spawn(this.fetchOrderBookSnapshot, symbol);
926
+ }
927
+ else {
928
+ this.spawn(this.watchOrderBookSnapshot, symbol);
929
+ }
915
930
  }
916
931
  async pong(client, message) {
917
932
  //
@@ -6,15 +6,14 @@
6
6
 
7
7
  // ---------------------------------------------------------------------------
8
8
  import hitbtc from './hitbtc.js';
9
+ import hitbtcRest from '../hitbtc.js';
9
10
  import bequantRest from '../bequant.js';
10
11
  // ---------------------------------------------------------------------------
11
12
  export default class bequant extends hitbtc {
12
13
  describe() {
13
14
  // eslint-disable-next-line new-cap
14
- const restInstance = new bequantRest();
15
- const restDescribe = restInstance.describe();
16
- const extended = this.deepExtend(super.describe(), restDescribe);
17
- return this.deepExtend(extended, {
15
+ const describeExtended = this.getDescribeForExtendedWsExchange(new bequantRest(), new hitbtcRest(), super.describe());
16
+ return this.deepExtend(describeExtended, {
18
17
  'id': 'bequant',
19
18
  'name': 'Bequant',
20
19
  'countries': ['MT'],
@@ -44,6 +44,7 @@ export default class binance extends binanceRest {
44
44
  cancelAllOrdersWs(symbol?: Str, params?: {}): Promise<any>;
45
45
  fetchOrderWs(id: string, symbol?: Str, params?: {}): Promise<Order>;
46
46
  fetchOrdersWs(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
47
+ fetchClosedOrdersWs(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
47
48
  fetchOpenOrdersWs(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
48
49
  watchOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
49
50
  parseWsOrder(order: any, market?: any): Order;
@@ -37,10 +37,15 @@ export default class binance extends binanceRest {
37
37
  'cancelOrderWs': true,
38
38
  'cancelOrdersWs': false,
39
39
  'cancelAllOrdersWs': true,
40
- 'fetchOrderWs': true,
41
- 'fetchOrdersWs': true,
42
40
  'fetchBalanceWs': true,
41
+ 'fetchDepositsWs': false,
42
+ 'fetchMarketsWs': false,
43
43
  'fetchMyTradesWs': true,
44
+ 'fetchOpenOrdersWs': true,
45
+ 'fetchOrderWs': true,
46
+ 'fetchOrdersWs': true,
47
+ 'fetchTradingFeesWs': false,
48
+ 'fetchWithdrawalsWs': false,
44
49
  },
45
50
  'urls': {
46
51
  'test': {
@@ -1941,6 +1946,28 @@ export default class binance extends binanceRest {
1941
1946
  const orders = await this.watch(url, messageHash, message, messageHash, subscription);
1942
1947
  return this.filterBySymbolSinceLimit(orders, symbol, since, limit);
1943
1948
  }
1949
+ async fetchClosedOrdersWs(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1950
+ /**
1951
+ * @method
1952
+ * @name binance#fetchClosedOrdersWs
1953
+ * @see https://binance-docs.github.io/apidocs/websocket_api/en/#account-order-history-user_data
1954
+ * @description fetch closed orders
1955
+ * @param {string} symbol unified market symbol
1956
+ * @param {int} [since] the earliest time in ms to fetch open orders for
1957
+ * @param {int} [limit] the maximum number of open orders structures to retrieve
1958
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1959
+ * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1960
+ */
1961
+ const orders = await this.fetchOrdersWs(symbol, since, limit, params);
1962
+ const closedOrders = [];
1963
+ for (let i = 0; i < orders.length; i++) {
1964
+ const order = orders[i];
1965
+ if (order['status'] === 'closed') {
1966
+ closedOrders.push(order);
1967
+ }
1968
+ }
1969
+ return closedOrders;
1970
+ }
1944
1971
  async fetchOpenOrdersWs(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1945
1972
  /**
1946
1973
  * @method
@@ -965,6 +965,7 @@ export default class bitget extends bitgetRest {
965
965
  // "clientOid": "798d1425-d31d-4ada-a51b-ec701e00a1d9",
966
966
  // "price": "35000.00",
967
967
  // "size": "7.0000",
968
+ // "newSize": "500.0000",
968
969
  // "notional": "7.000000",
969
970
  // "orderType": "limit",
970
971
  // "force": "gtc",
@@ -1132,6 +1133,7 @@ export default class bitget extends bitgetRest {
1132
1133
  // "clientOid": "798d1425-d31d-4ada-a51b-ec701e00a1d9",
1133
1134
  // "price": "35000.00",
1134
1135
  // "size": "7.0000",
1136
+ // "newSize": "500.0000",
1135
1137
  // "notional": "7.000000",
1136
1138
  // "orderType": "limit",
1137
1139
  // "force": "gtc",
@@ -1239,6 +1241,25 @@ export default class bitget extends bitgetRest {
1239
1241
  };
1240
1242
  }
1241
1243
  const triggerPrice = this.safeNumber(order, 'triggerPrice');
1244
+ const price = this.safeString(order, 'price');
1245
+ const avgPrice = this.omitZero(this.safeString2(order, 'priceAvg', 'fillPrice'));
1246
+ let cost = this.safeStringN(order, ['notional', 'notionalUsd', 'quoteSize']);
1247
+ const side = this.safeString(order, 'side');
1248
+ const type = this.safeString(order, 'orderType');
1249
+ if (side === 'buy' && market['spot'] && (type === 'market')) {
1250
+ cost = this.safeString(order, 'newSize', cost);
1251
+ }
1252
+ let filled = this.safeString2(order, 'accBaseVolume', 'baseVolume');
1253
+ if (market['spot'] && (rawStatus !== 'live')) {
1254
+ filled = Precise.stringDiv(cost, avgPrice);
1255
+ }
1256
+ let amount = this.safeString(order, 'baseVolume');
1257
+ if (!market['spot'] || !(side === 'buy' && type === 'market')) {
1258
+ amount = this.safeString(order, 'newSize', amount);
1259
+ }
1260
+ if (market['swap'] && (amount === undefined)) {
1261
+ amount = this.safeString(order, 'size');
1262
+ }
1242
1263
  return this.safeOrder({
1243
1264
  'info': order,
1244
1265
  'symbol': symbol,
@@ -1247,17 +1268,17 @@ export default class bitget extends bitgetRest {
1247
1268
  'timestamp': timestamp,
1248
1269
  'datetime': this.iso8601(timestamp),
1249
1270
  'lastTradeTimestamp': this.safeInteger(order, 'uTime'),
1250
- 'type': this.safeString(order, 'orderType'),
1271
+ 'type': type,
1251
1272
  'timeInForce': this.safeStringUpper(order, 'force'),
1252
1273
  'postOnly': undefined,
1253
- 'side': this.safeString(order, 'side'),
1254
- 'price': this.safeString(order, 'price'),
1274
+ 'side': side,
1275
+ 'price': price,
1255
1276
  'stopPrice': triggerPrice,
1256
1277
  'triggerPrice': triggerPrice,
1257
- 'amount': this.safeString(order, 'baseVolume'),
1258
- 'cost': this.safeStringN(order, ['notional', 'notionalUsd', 'quoteSize']),
1259
- 'average': this.omitZero(this.safeString2(order, 'priceAvg', 'fillPrice')),
1260
- 'filled': this.safeString2(order, 'accBaseVolume', 'baseVolume'),
1278
+ 'amount': amount,
1279
+ 'cost': cost,
1280
+ 'average': avgPrice,
1281
+ 'filled': filled,
1261
1282
  'remaining': undefined,
1262
1283
  'status': this.parseWsOrderStatus(rawStatus),
1263
1284
  'fee': feeObject,
@@ -109,7 +109,7 @@ export default class bitstamp extends bitstampRest {
109
109
  // usually it takes at least 4-5 deltas to resolve
110
110
  const snapshotDelay = this.handleOption('watchOrderBook', 'snapshotDelay', 6);
111
111
  if (cacheLength === snapshotDelay) {
112
- this.spawn(this.loadOrderBook, client, messageHash, symbol);
112
+ this.spawn(this.loadOrderBook, client, messageHash, symbol, null, {});
113
113
  }
114
114
  storedOrderBook.cache.push(delta);
115
115
  return;