ccxt 4.2.47 → 4.2.49
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.
- package/README.md +3 -3
- package/build.sh +7 -0
- package/dist/ccxt.browser.js +681 -84
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/binance.js +10 -4
- package/dist/cjs/src/bitmart.js +30 -4
- package/dist/cjs/src/bitstamp.js +8 -0
- package/dist/cjs/src/btcalpha.js +4 -0
- package/dist/cjs/src/btcmarkets.js +4 -0
- package/dist/cjs/src/btcturk.js +4 -0
- package/dist/cjs/src/bybit.js +138 -6
- package/dist/cjs/src/idex.js +52 -1
- package/dist/cjs/src/independentreserve.js +48 -0
- package/dist/cjs/src/indodax.js +120 -19
- package/dist/cjs/src/latoken.js +16 -0
- package/dist/cjs/src/luno.js +18 -0
- package/dist/cjs/src/lykke.js +19 -0
- package/dist/cjs/src/ndax.js +18 -0
- package/dist/cjs/src/okx.js +32 -5
- package/dist/cjs/src/pro/ascendex.js +22 -7
- package/dist/cjs/src/pro/bitget.js +28 -7
- package/dist/cjs/src/pro/bitstamp.js +1 -1
- package/dist/cjs/src/pro/hitbtc.js +6 -11
- package/dist/cjs/src/pro/mexc.js +2 -1
- package/dist/cjs/src/upbit.js +100 -17
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bitstamp.d.ts +8 -0
- package/js/src/abstract/indodax.d.ts +9 -8
- package/js/src/binance.js +10 -4
- package/js/src/bitmart.js +30 -4
- package/js/src/bitstamp.js +8 -0
- package/js/src/btcalpha.js +4 -0
- package/js/src/btcmarkets.js +4 -0
- package/js/src/btcturk.js +4 -0
- package/js/src/bybit.d.ts +3 -1
- package/js/src/bybit.js +138 -6
- package/js/src/idex.d.ts +7 -0
- package/js/src/idex.js +52 -1
- package/js/src/independentreserve.d.ts +15 -1
- package/js/src/independentreserve.js +48 -0
- package/js/src/indodax.d.ts +3 -1
- package/js/src/indodax.js +120 -19
- package/js/src/latoken.js +16 -0
- package/js/src/luno.js +18 -0
- package/js/src/lykke.js +19 -0
- package/js/src/ndax.js +18 -0
- package/js/src/okx.js +32 -5
- package/js/src/pro/ascendex.d.ts +1 -0
- package/js/src/pro/ascendex.js +22 -7
- package/js/src/pro/bitget.js +28 -7
- package/js/src/pro/bitstamp.js +1 -1
- package/js/src/pro/hitbtc.js +6 -11
- package/js/src/pro/mexc.js +2 -1
- package/js/src/upbit.d.ts +2 -0
- package/js/src/upbit.js +100 -17
- package/package.json +3 -1
- package/skip-tests.json +4 -2
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
|
package/js/src/okx.js
CHANGED
|
@@ -5231,6 +5231,7 @@ export default class okx extends Exchange {
|
|
|
5231
5231
|
* @method
|
|
5232
5232
|
* @name okx#fetchPositions
|
|
5233
5233
|
* @see https://www.okx.com/docs-v5/en/#rest-api-account-get-positions
|
|
5234
|
+
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-positions-history history
|
|
5234
5235
|
* @description fetch all open positions
|
|
5235
5236
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
5236
5237
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -5371,13 +5372,38 @@ export default class okx extends Exchange {
|
|
|
5371
5372
|
// "vegaBS": "",
|
|
5372
5373
|
// "vegaPA": ""
|
|
5373
5374
|
// }
|
|
5375
|
+
// history
|
|
5376
|
+
// {
|
|
5377
|
+
// "cTime":"1708351230102",
|
|
5378
|
+
// "ccy":"USDT",
|
|
5379
|
+
// "closeAvgPx":"1.2567",
|
|
5380
|
+
// "closeTotalPos":"40",
|
|
5381
|
+
// "direction":"short",
|
|
5382
|
+
// "fee":"-0.0351036",
|
|
5383
|
+
// "fundingFee":"0",
|
|
5384
|
+
// "instId":"SUSHI-USDT-SWAP",
|
|
5385
|
+
// "instType":"SWAP",
|
|
5386
|
+
// "lever":"10.0",
|
|
5387
|
+
// "liqPenalty":"0",
|
|
5388
|
+
// "mgnMode":"isolated",
|
|
5389
|
+
// "openAvgPx":"1.2462",
|
|
5390
|
+
// "openMaxPos":"40",
|
|
5391
|
+
// "pnl":"-0.42",
|
|
5392
|
+
// "pnlRatio":"-0.0912982667308618",
|
|
5393
|
+
// "posId":"666159086676836352",
|
|
5394
|
+
// "realizedPnl":"-0.4551036",
|
|
5395
|
+
// "triggerPx":"",
|
|
5396
|
+
// "type":"2",
|
|
5397
|
+
// "uTime":"1708354805699",
|
|
5398
|
+
// "uly":"SUSHI-USDT"
|
|
5399
|
+
// }
|
|
5374
5400
|
//
|
|
5375
5401
|
const marketId = this.safeString(position, 'instId');
|
|
5376
5402
|
market = this.safeMarket(marketId, market);
|
|
5377
5403
|
const symbol = market['symbol'];
|
|
5378
5404
|
const pos = this.safeString(position, 'pos'); // 'pos' field: One way mode: 0 if position is not open, 1 if open | Two way (hedge) mode: -1 if short, 1 if long, 0 if position is not open
|
|
5379
5405
|
const contractsAbs = Precise.stringAbs(pos);
|
|
5380
|
-
let side = this.
|
|
5406
|
+
let side = this.safeString2(position, 'posSide', 'direction');
|
|
5381
5407
|
const hedged = side !== 'net';
|
|
5382
5408
|
const contracts = this.parseNumber(contractsAbs);
|
|
5383
5409
|
if (market['margin']) {
|
|
@@ -5418,7 +5444,7 @@ export default class okx extends Exchange {
|
|
|
5418
5444
|
const notional = this.parseNumber(notionalString);
|
|
5419
5445
|
const marginMode = this.safeString(position, 'mgnMode');
|
|
5420
5446
|
let initialMarginString = undefined;
|
|
5421
|
-
const entryPriceString = this.
|
|
5447
|
+
const entryPriceString = this.safeString2(position, 'avgPx', 'openAvgPx');
|
|
5422
5448
|
const unrealizedPnlString = this.safeString(position, 'upl');
|
|
5423
5449
|
const leverageString = this.safeString(position, 'lever');
|
|
5424
5450
|
let initialMarginPercentage = undefined;
|
|
@@ -5449,23 +5475,24 @@ export default class okx extends Exchange {
|
|
|
5449
5475
|
const marginRatio = this.parseNumber(Precise.stringDiv(maintenanceMarginString, collateralString, 4));
|
|
5450
5476
|
return this.safePosition({
|
|
5451
5477
|
'info': position,
|
|
5452
|
-
'id':
|
|
5478
|
+
'id': this.safeString(position, 'posId'),
|
|
5453
5479
|
'symbol': symbol,
|
|
5454
5480
|
'notional': notional,
|
|
5455
5481
|
'marginMode': marginMode,
|
|
5456
5482
|
'liquidationPrice': liquidationPrice,
|
|
5457
5483
|
'entryPrice': this.parseNumber(entryPriceString),
|
|
5458
5484
|
'unrealizedPnl': this.parseNumber(unrealizedPnlString),
|
|
5485
|
+
'realizedPnl': this.safeNumber(position, 'realizedPnl'),
|
|
5459
5486
|
'percentage': percentage,
|
|
5460
5487
|
'contracts': contracts,
|
|
5461
5488
|
'contractSize': contractSize,
|
|
5462
5489
|
'markPrice': this.parseNumber(markPriceString),
|
|
5463
|
-
'lastPrice':
|
|
5490
|
+
'lastPrice': this.safeNumber(position, 'closeAvgPx'),
|
|
5464
5491
|
'side': side,
|
|
5465
5492
|
'hedged': hedged,
|
|
5466
5493
|
'timestamp': timestamp,
|
|
5467
5494
|
'datetime': this.iso8601(timestamp),
|
|
5468
|
-
'lastUpdateTimestamp':
|
|
5495
|
+
'lastUpdateTimestamp': this.safeInteger(position, 'uTime'),
|
|
5469
5496
|
'maintenanceMargin': maintenanceMargin,
|
|
5470
5497
|
'maintenanceMarginPercentage': maintenanceMarginPercentage,
|
|
5471
5498
|
'collateral': this.parseNumber(collateralString),
|
package/js/src/pro/ascendex.d.ts
CHANGED
|
@@ -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;
|
package/js/src/pro/ascendex.js
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
873
|
-
'depth-snapshot
|
|
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-
|
|
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
|
|
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
|
-
|
|
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
|
//
|
package/js/src/pro/bitget.js
CHANGED
|
@@ -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':
|
|
1271
|
+
'type': type,
|
|
1251
1272
|
'timeInForce': this.safeStringUpper(order, 'force'),
|
|
1252
1273
|
'postOnly': undefined,
|
|
1253
|
-
'side':
|
|
1254
|
-
'price':
|
|
1274
|
+
'side': side,
|
|
1275
|
+
'price': price,
|
|
1255
1276
|
'stopPrice': triggerPrice,
|
|
1256
1277
|
'triggerPrice': triggerPrice,
|
|
1257
|
-
'amount':
|
|
1258
|
-
'cost':
|
|
1259
|
-
'average':
|
|
1260
|
-
'filled':
|
|
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,
|
package/js/src/pro/bitstamp.js
CHANGED
|
@@ -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;
|
package/js/src/pro/hitbtc.js
CHANGED
|
@@ -223,7 +223,7 @@ export default class hitbtc extends hitbtcRest {
|
|
|
223
223
|
'symbols': [market['id']],
|
|
224
224
|
},
|
|
225
225
|
};
|
|
226
|
-
const orderbook = await this.subscribePublic(name,
|
|
226
|
+
const orderbook = await this.subscribePublic(name, 'orderbooks', [symbol], this.deepExtend(request, params));
|
|
227
227
|
return orderbook.limit();
|
|
228
228
|
}
|
|
229
229
|
handleOrderBook(client, message) {
|
|
@@ -252,13 +252,12 @@ export default class hitbtc extends hitbtcRest {
|
|
|
252
252
|
//
|
|
253
253
|
const data = this.safeValue2(message, 'snapshot', 'update', {});
|
|
254
254
|
const marketIds = Object.keys(data);
|
|
255
|
-
const channel = this.safeString(message, 'ch');
|
|
256
255
|
for (let i = 0; i < marketIds.length; i++) {
|
|
257
256
|
const marketId = marketIds[i];
|
|
258
257
|
const market = this.safeMarket(marketId);
|
|
259
258
|
const symbol = market['symbol'];
|
|
260
259
|
const item = data[marketId];
|
|
261
|
-
const messageHash =
|
|
260
|
+
const messageHash = 'orderbooks::' + symbol;
|
|
262
261
|
if (!(symbol in this.orderbooks)) {
|
|
263
262
|
const subscription = this.safeValue(client.subscriptions, messageHash, {});
|
|
264
263
|
const limit = this.safeInteger(subscription, 'limit');
|
|
@@ -316,7 +315,7 @@ export default class hitbtc extends hitbtcRest {
|
|
|
316
315
|
'symbols': [market['id']],
|
|
317
316
|
},
|
|
318
317
|
};
|
|
319
|
-
const result = await this.subscribePublic(name, '
|
|
318
|
+
const result = await this.subscribePublic(name, 'tickers', [symbol], this.deepExtend(request, params));
|
|
320
319
|
return this.safeValue(result, symbol);
|
|
321
320
|
}
|
|
322
321
|
async watchTickers(symbols = undefined, params = {}) {
|
|
@@ -399,7 +398,6 @@ export default class hitbtc extends hitbtcRest {
|
|
|
399
398
|
//
|
|
400
399
|
const data = this.safeValue(message, 'data', {});
|
|
401
400
|
const marketIds = Object.keys(data);
|
|
402
|
-
const channel = this.safeString(message, 'ch');
|
|
403
401
|
const newTickers = {};
|
|
404
402
|
for (let i = 0; i < marketIds.length; i++) {
|
|
405
403
|
const marketId = marketIds[i];
|
|
@@ -408,8 +406,6 @@ export default class hitbtc extends hitbtcRest {
|
|
|
408
406
|
const ticker = this.parseWsTicker(data[marketId], market);
|
|
409
407
|
this.tickers[symbol] = ticker;
|
|
410
408
|
newTickers[symbol] = ticker;
|
|
411
|
-
const messageHash = channel + '::' + symbol;
|
|
412
|
-
client.resolve(newTickers, messageHash);
|
|
413
409
|
}
|
|
414
410
|
client.resolve(newTickers, 'tickers');
|
|
415
411
|
const messageHashes = this.findMessageHashes(client, 'tickers::');
|
|
@@ -425,7 +421,6 @@ export default class hitbtc extends hitbtcRest {
|
|
|
425
421
|
client.resolve(tickers, messageHash);
|
|
426
422
|
}
|
|
427
423
|
}
|
|
428
|
-
client.resolve(this.tickers, channel);
|
|
429
424
|
return message;
|
|
430
425
|
}
|
|
431
426
|
parseWsTicker(ticker, market = undefined) {
|
|
@@ -506,7 +501,7 @@ export default class hitbtc extends hitbtcRest {
|
|
|
506
501
|
request['limit'] = limit;
|
|
507
502
|
}
|
|
508
503
|
const name = 'trades';
|
|
509
|
-
const trades = await this.subscribePublic(name,
|
|
504
|
+
const trades = await this.subscribePublic(name, 'trades', [symbol], this.deepExtend(request, params));
|
|
510
505
|
if (this.newUpdates) {
|
|
511
506
|
limit = trades.getLimit(symbol, limit);
|
|
512
507
|
}
|
|
@@ -635,7 +630,7 @@ export default class hitbtc extends hitbtcRest {
|
|
|
635
630
|
if (limit !== undefined) {
|
|
636
631
|
request['params']['limit'] = limit;
|
|
637
632
|
}
|
|
638
|
-
const ohlcv = await this.subscribePublic(name,
|
|
633
|
+
const ohlcv = await this.subscribePublic(name, 'candles', [symbol], this.deepExtend(request, params));
|
|
639
634
|
if (this.newUpdates) {
|
|
640
635
|
limit = ohlcv.getLimit(symbol, limit);
|
|
641
636
|
}
|
|
@@ -696,7 +691,7 @@ export default class hitbtc extends hitbtcRest {
|
|
|
696
691
|
for (let j = 0; j < ohlcvs.length; j++) {
|
|
697
692
|
stored.append(ohlcvs[j]);
|
|
698
693
|
}
|
|
699
|
-
const messageHash =
|
|
694
|
+
const messageHash = 'candles::' + symbol;
|
|
700
695
|
client.resolve(stored, messageHash);
|
|
701
696
|
}
|
|
702
697
|
return message;
|
package/js/src/pro/mexc.js
CHANGED
|
@@ -453,6 +453,7 @@ export default class mexc extends mexcRest {
|
|
|
453
453
|
const symbol = this.safeSymbol(marketId);
|
|
454
454
|
const messageHash = 'orderbook:' + symbol;
|
|
455
455
|
const subscription = this.safeValue(client.subscriptions, messageHash);
|
|
456
|
+
const limit = this.safeInteger(subscription, 'limit');
|
|
456
457
|
if (subscription === true) {
|
|
457
458
|
// we set client.subscriptions[messageHash] to 1
|
|
458
459
|
// once we have received the first delta and initialized the orderbook
|
|
@@ -465,7 +466,7 @@ export default class mexc extends mexcRest {
|
|
|
465
466
|
const cacheLength = storedOrderBook.cache.length;
|
|
466
467
|
const snapshotDelay = this.handleOption('watchOrderBook', 'snapshotDelay', 25);
|
|
467
468
|
if (cacheLength === snapshotDelay) {
|
|
468
|
-
this.spawn(this.loadOrderBook, client, messageHash, symbol);
|
|
469
|
+
this.spawn(this.loadOrderBook, client, messageHash, symbol, limit, {});
|
|
469
470
|
}
|
|
470
471
|
storedOrderBook.cache.push(data);
|
|
471
472
|
return;
|
package/js/src/upbit.d.ts
CHANGED
|
@@ -62,7 +62,9 @@ export default class upbit extends Exchange {
|
|
|
62
62
|
createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: number, params?: {}): Promise<Order>;
|
|
63
63
|
cancelOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
|
|
64
64
|
fetchDeposits(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
|
|
65
|
+
fetchDeposit(id: string, code?: Str, params?: {}): Promise<Transaction>;
|
|
65
66
|
fetchWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
|
|
67
|
+
fetchWithdrawal(id: string, code?: Str, params?: {}): Promise<Transaction>;
|
|
66
68
|
parseTransactionStatus(status: any): string;
|
|
67
69
|
parseTransaction(transaction: any, currency?: Currency): Transaction;
|
|
68
70
|
parseOrderStatus(status: any): string;
|