ccxt 4.2.35 → 4.2.37
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/CONTRIBUTING.md +3 -2
- package/README.md +5 -5
- package/dist/ccxt.browser.js +880 -329
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +3 -3
- package/dist/cjs/src/base/ws/Client.js +5 -2
- package/dist/cjs/src/binance.js +395 -115
- package/dist/cjs/src/bitfinex.js +21 -0
- package/dist/cjs/src/bitfinex2.js +122 -122
- package/dist/cjs/src/bitget.js +28 -39
- package/dist/cjs/src/bithumb.js +14 -0
- package/dist/cjs/src/bitmex.js +22 -3
- package/dist/cjs/src/bybit.js +13 -4
- package/dist/cjs/src/pro/binance.js +2 -2
- package/dist/cjs/src/pro/gemini.js +190 -3
- package/dist/cjs/src/woo.js +64 -35
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/base/Exchange.d.ts +1 -0
- package/js/src/base/Exchange.js +3 -3
- package/js/src/base/types.d.ts +2 -0
- package/js/src/base/ws/Client.js +5 -2
- package/js/src/binance.js +395 -115
- package/js/src/bitfinex.js +21 -0
- package/js/src/bitfinex2.js +122 -122
- package/js/src/bitget.js +28 -39
- package/js/src/bithumb.js +14 -0
- package/js/src/bitmex.js +22 -3
- package/js/src/bybit.js +13 -4
- package/js/src/pro/binance.js +2 -2
- package/js/src/pro/gemini.d.ts +5 -0
- package/js/src/pro/gemini.js +191 -4
- package/js/src/woo.js +64 -35
- package/package.json +2 -2
package/dist/cjs/src/bithumb.js
CHANGED
|
@@ -188,6 +188,7 @@ class bithumb extends bithumb$1 {
|
|
|
188
188
|
* @method
|
|
189
189
|
* @name bithumb#fetchMarkets
|
|
190
190
|
* @description retrieves data on all markets for bithumb
|
|
191
|
+
* @see https://apidocs.bithumb.com/reference/%ED%98%84%EC%9E%AC%EA%B0%80-%EC%A0%95%EB%B3%B4-%EC%A1%B0%ED%9A%8C-all
|
|
191
192
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
192
193
|
* @returns {object[]} an array of objects representing market data
|
|
193
194
|
*/
|
|
@@ -290,6 +291,7 @@ class bithumb extends bithumb$1 {
|
|
|
290
291
|
* @method
|
|
291
292
|
* @name bithumb#fetchBalance
|
|
292
293
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
294
|
+
* @see https://apidocs.bithumb.com/reference/%EB%B3%B4%EC%9C%A0%EC%9E%90%EC%82%B0-%EC%A1%B0%ED%9A%8C
|
|
293
295
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
294
296
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
295
297
|
*/
|
|
@@ -305,6 +307,7 @@ class bithumb extends bithumb$1 {
|
|
|
305
307
|
* @method
|
|
306
308
|
* @name bithumb#fetchOrderBook
|
|
307
309
|
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
310
|
+
* @see https://apidocs.bithumb.com/reference/%ED%98%B8%EA%B0%80-%EC%A0%95%EB%B3%B4-%EC%A1%B0%ED%9A%8C
|
|
308
311
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
309
312
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
310
313
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -397,6 +400,7 @@ class bithumb extends bithumb$1 {
|
|
|
397
400
|
* @method
|
|
398
401
|
* @name bithumb#fetchTickers
|
|
399
402
|
* @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
|
403
|
+
* @see https://apidocs.bithumb.com/reference/%ED%98%84%EC%9E%AC%EA%B0%80-%EC%A0%95%EB%B3%B4-%EC%A1%B0%ED%9A%8C-all
|
|
400
404
|
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
401
405
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
402
406
|
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -454,6 +458,7 @@ class bithumb extends bithumb$1 {
|
|
|
454
458
|
* @method
|
|
455
459
|
* @name bithumb#fetchTicker
|
|
456
460
|
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
461
|
+
* @see https://apidocs.bithumb.com/reference/%ED%98%84%EC%9E%AC%EA%B0%80-%EC%A0%95%EB%B3%B4-%EC%A1%B0%ED%9A%8C
|
|
457
462
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
458
463
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
459
464
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -512,6 +517,7 @@ class bithumb extends bithumb$1 {
|
|
|
512
517
|
* @method
|
|
513
518
|
* @name bithumb#fetchOHLCV
|
|
514
519
|
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
520
|
+
* @see https://apidocs.bithumb.com/reference/candlestick-rest-api
|
|
515
521
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
516
522
|
* @param {string} timeframe the length of time each candle represents
|
|
517
523
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
@@ -636,6 +642,7 @@ class bithumb extends bithumb$1 {
|
|
|
636
642
|
* @method
|
|
637
643
|
* @name bithumb#fetchTrades
|
|
638
644
|
* @description get the list of most recent trades for a particular symbol
|
|
645
|
+
* @see https://apidocs.bithumb.com/reference/%EC%B5%9C%EA%B7%BC-%EC%B2%B4%EA%B2%B0-%EB%82%B4%EC%97%AD
|
|
639
646
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
640
647
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
641
648
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
@@ -674,6 +681,9 @@ class bithumb extends bithumb$1 {
|
|
|
674
681
|
* @method
|
|
675
682
|
* @name bithumb#createOrder
|
|
676
683
|
* @description create a trade order
|
|
684
|
+
* @see https://apidocs.bithumb.com/reference/%EC%A7%80%EC%A0%95%EA%B0%80-%EC%A3%BC%EB%AC%B8%ED%95%98%EA%B8%B0
|
|
685
|
+
* @see https://apidocs.bithumb.com/reference/%EC%8B%9C%EC%9E%A5%EA%B0%80-%EB%A7%A4%EC%88%98%ED%95%98%EA%B8%B0
|
|
686
|
+
* @see https://apidocs.bithumb.com/reference/%EC%8B%9C%EC%9E%A5%EA%B0%80-%EB%A7%A4%EB%8F%84%ED%95%98%EA%B8%B0
|
|
677
687
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
678
688
|
* @param {string} type 'market' or 'limit'
|
|
679
689
|
* @param {string} side 'buy' or 'sell'
|
|
@@ -715,6 +725,7 @@ class bithumb extends bithumb$1 {
|
|
|
715
725
|
* @method
|
|
716
726
|
* @name bithumb#fetchOrder
|
|
717
727
|
* @description fetches information on an order made by the user
|
|
728
|
+
* @see https://apidocs.bithumb.com/reference/%EA%B1%B0%EB%9E%98-%EC%A3%BC%EB%AC%B8%EB%82%B4%EC%97%AD-%EC%83%81%EC%84%B8-%EC%A1%B0%ED%9A%8C
|
|
718
729
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
719
730
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
720
731
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
@@ -873,6 +884,7 @@ class bithumb extends bithumb$1 {
|
|
|
873
884
|
* @method
|
|
874
885
|
* @name bithumb#fetchOpenOrders
|
|
875
886
|
* @description fetch all unfilled currently open orders
|
|
887
|
+
* @see https://apidocs.bithumb.com/reference/%EA%B1%B0%EB%9E%98-%EC%A3%BC%EB%AC%B8%EB%82%B4%EC%97%AD-%EC%A1%B0%ED%9A%8C
|
|
876
888
|
* @param {string} symbol unified market symbol
|
|
877
889
|
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
878
890
|
* @param {int} [limit] the maximum number of open order structures to retrieve
|
|
@@ -921,6 +933,7 @@ class bithumb extends bithumb$1 {
|
|
|
921
933
|
* @method
|
|
922
934
|
* @name bithumb#cancelOrder
|
|
923
935
|
* @description cancels an open order
|
|
936
|
+
* @see https://apidocs.bithumb.com/reference/%EC%A3%BC%EB%AC%B8-%EC%B7%A8%EC%86%8C%ED%95%98%EA%B8%B0
|
|
924
937
|
* @param {string} id order id
|
|
925
938
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
926
939
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -956,6 +969,7 @@ class bithumb extends bithumb$1 {
|
|
|
956
969
|
* @method
|
|
957
970
|
* @name bithumb#withdraw
|
|
958
971
|
* @description make a withdrawal
|
|
972
|
+
* @see https://apidocs.bithumb.com/reference/%EC%BD%94%EC%9D%B8-%EC%B6%9C%EA%B8%88%ED%95%98%EA%B8%B0-%EA%B0%9C%EC%9D%B8
|
|
959
973
|
* @param {string} code unified currency code
|
|
960
974
|
* @param {float} amount the amount to withdraw
|
|
961
975
|
* @param {string} address the address to withdraw to
|
package/dist/cjs/src/bitmex.js
CHANGED
|
@@ -282,6 +282,7 @@ class bitmex extends bitmex$1 {
|
|
|
282
282
|
* @method
|
|
283
283
|
* @name bitmex#fetchCurrencies
|
|
284
284
|
* @description fetches all available currencies on an exchange
|
|
285
|
+
* @see https://www.bitmex.com/api/explorer/#!/Wallet/Wallet_getAssetsConfig
|
|
285
286
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
286
287
|
* @returns {object} an associative dictionary of currencies
|
|
287
288
|
*/
|
|
@@ -767,6 +768,7 @@ class bitmex extends bitmex$1 {
|
|
|
767
768
|
* @method
|
|
768
769
|
* @name bitmex#fetchBalance
|
|
769
770
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
771
|
+
* @see https://www.bitmex.com/api/explorer/#!/User/User_getMargin
|
|
770
772
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
771
773
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
772
774
|
*/
|
|
@@ -829,6 +831,7 @@ class bitmex extends bitmex$1 {
|
|
|
829
831
|
* @method
|
|
830
832
|
* @name bitmex#fetchOrderBook
|
|
831
833
|
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
834
|
+
* @see https://www.bitmex.com/api/explorer/#!/OrderBook/OrderBook_getL2
|
|
832
835
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
833
836
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
834
837
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -872,6 +875,7 @@ class bitmex extends bitmex$1 {
|
|
|
872
875
|
* @method
|
|
873
876
|
* @name bitmex#fetchOrder
|
|
874
877
|
* @description fetches information on an order made by the user
|
|
878
|
+
* @see https://www.bitmex.com/api/explorer/#!/Order/Order_getOrders
|
|
875
879
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
876
880
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
877
881
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
@@ -940,6 +944,7 @@ class bitmex extends bitmex$1 {
|
|
|
940
944
|
* @method
|
|
941
945
|
* @name bitmex#fetchOpenOrders
|
|
942
946
|
* @description fetch all unfilled currently open orders
|
|
947
|
+
* @see https://www.bitmex.com/api/explorer/#!/Order/Order_getOrders
|
|
943
948
|
* @param {string} symbol unified market symbol
|
|
944
949
|
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
945
950
|
* @param {int} [limit] the maximum number of open orders structures to retrieve
|
|
@@ -958,6 +963,7 @@ class bitmex extends bitmex$1 {
|
|
|
958
963
|
* @method
|
|
959
964
|
* @name bitmex#fetchClosedOrders
|
|
960
965
|
* @description fetches information on multiple closed orders made by the user
|
|
966
|
+
* @see https://www.bitmex.com/api/explorer/#!/Order/Order_getOrders
|
|
961
967
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
962
968
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
963
969
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
@@ -972,8 +978,8 @@ class bitmex extends bitmex$1 {
|
|
|
972
978
|
/**
|
|
973
979
|
* @method
|
|
974
980
|
* @name bitmex#fetchMyTrades
|
|
975
|
-
* @see https://www.bitmex.com/api/explorer/#!/Execution/Execution_getTradeHistory
|
|
976
981
|
* @description fetch all trades made by the user
|
|
982
|
+
* @see https://www.bitmex.com/api/explorer/#!/Execution/Execution_getTradeHistory
|
|
977
983
|
* @param {string} symbol unified market symbol
|
|
978
984
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
979
985
|
* @param {int} [limit] the maximum number of trades structures to retrieve
|
|
@@ -1182,6 +1188,7 @@ class bitmex extends bitmex$1 {
|
|
|
1182
1188
|
* @method
|
|
1183
1189
|
* @name bitmex#fetchLedger
|
|
1184
1190
|
* @description fetch the history of changes, actions done by the user or operations that altered balance of the user
|
|
1191
|
+
* @see https://www.bitmex.com/api/explorer/#!/User/User_getWalletHistory
|
|
1185
1192
|
* @param {string} code unified currency code, default is undefined
|
|
1186
1193
|
* @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
|
|
1187
1194
|
* @param {int} [limit] max number of ledger entrys to return, default is undefined
|
|
@@ -1233,6 +1240,7 @@ class bitmex extends bitmex$1 {
|
|
|
1233
1240
|
* @method
|
|
1234
1241
|
* @name bitmex#fetchDepositsWithdrawals
|
|
1235
1242
|
* @description fetch history of deposits and withdrawals
|
|
1243
|
+
* @see https://www.bitmex.com/api/explorer/#!/User/User_getWalletHistory
|
|
1236
1244
|
* @param {string} [code] unified currency code for the currency of the deposit/withdrawals, default is undefined
|
|
1237
1245
|
* @param {int} [since] timestamp in ms of the earliest deposit/withdrawal, default is undefined
|
|
1238
1246
|
* @param {int} [limit] max number of deposit/withdrawals to return, default is undefined
|
|
@@ -1351,6 +1359,7 @@ class bitmex extends bitmex$1 {
|
|
|
1351
1359
|
* @method
|
|
1352
1360
|
* @name bitmex#fetchTicker
|
|
1353
1361
|
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
1362
|
+
* @see https://www.bitmex.com/api/explorer/#!/Instrument/Instrument_get
|
|
1354
1363
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
1355
1364
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1356
1365
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -1372,6 +1381,7 @@ class bitmex extends bitmex$1 {
|
|
|
1372
1381
|
* @method
|
|
1373
1382
|
* @name bitmex#fetchTickers
|
|
1374
1383
|
* @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
|
1384
|
+
* @see https://www.bitmex.com/api/explorer/#!/Instrument/Instrument_getActiveAndIndices
|
|
1375
1385
|
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
1376
1386
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1377
1387
|
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -1454,8 +1464,8 @@ class bitmex extends bitmex$1 {
|
|
|
1454
1464
|
/**
|
|
1455
1465
|
* @method
|
|
1456
1466
|
* @name bitmex#fetchOHLCV
|
|
1457
|
-
* @see https://www.bitmex.com/api/explorer/#!/Trade/Trade_getBucketed
|
|
1458
1467
|
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
1468
|
+
* @see https://www.bitmex.com/api/explorer/#!/Trade/Trade_getBucketed
|
|
1459
1469
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
1460
1470
|
* @param {string} timeframe the length of time each candle represents
|
|
1461
1471
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
@@ -1770,8 +1780,8 @@ class bitmex extends bitmex$1 {
|
|
|
1770
1780
|
/**
|
|
1771
1781
|
* @method
|
|
1772
1782
|
* @name bitmex#fetchTrades
|
|
1773
|
-
* @see https://www.bitmex.com/api/explorer/#!/Trade/Trade_get
|
|
1774
1783
|
* @description get the list of most recent trades for a particular symbol
|
|
1784
|
+
* @see https://www.bitmex.com/api/explorer/#!/Trade/Trade_get
|
|
1775
1785
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
1776
1786
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
1777
1787
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
@@ -1992,6 +2002,7 @@ class bitmex extends bitmex$1 {
|
|
|
1992
2002
|
* @method
|
|
1993
2003
|
* @name bitmex#cancelOrder
|
|
1994
2004
|
* @description cancels an open order
|
|
2005
|
+
* @see https://www.bitmex.com/api/explorer/#!/Order/Order_cancel
|
|
1995
2006
|
* @param {string} id order id
|
|
1996
2007
|
* @param {string} symbol not used by bitmex cancelOrder ()
|
|
1997
2008
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -2023,6 +2034,7 @@ class bitmex extends bitmex$1 {
|
|
|
2023
2034
|
* @method
|
|
2024
2035
|
* @name bitmex#cancelOrders
|
|
2025
2036
|
* @description cancel multiple orders
|
|
2037
|
+
* @see https://www.bitmex.com/api/explorer/#!/Order/Order_cancel
|
|
2026
2038
|
* @param {string[]} ids order ids
|
|
2027
2039
|
* @param {string} symbol not used by bitmex cancelOrders ()
|
|
2028
2040
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -2048,6 +2060,7 @@ class bitmex extends bitmex$1 {
|
|
|
2048
2060
|
* @method
|
|
2049
2061
|
* @name bitmex#cancelAllOrders
|
|
2050
2062
|
* @description cancel all open orders
|
|
2063
|
+
* @see https://www.bitmex.com/api/explorer/#!/Order/Order_cancelAll
|
|
2051
2064
|
* @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
|
|
2052
2065
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2053
2066
|
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
@@ -2106,6 +2119,7 @@ class bitmex extends bitmex$1 {
|
|
|
2106
2119
|
* @method
|
|
2107
2120
|
* @name bitmex#fetchPositions
|
|
2108
2121
|
* @description fetch all open positions
|
|
2122
|
+
* @see https://www.bitmex.com/api/explorer/#!/Position/Position_get
|
|
2109
2123
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
2110
2124
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2111
2125
|
* @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
@@ -2364,6 +2378,7 @@ class bitmex extends bitmex$1 {
|
|
|
2364
2378
|
* @method
|
|
2365
2379
|
* @name bitmex#withdraw
|
|
2366
2380
|
* @description make a withdrawal
|
|
2381
|
+
* @see https://www.bitmex.com/api/explorer/#!/User/User_requestWithdrawal
|
|
2367
2382
|
* @param {string} code unified currency code
|
|
2368
2383
|
* @param {float} amount the amount to withdraw
|
|
2369
2384
|
* @param {string} address the address to withdraw to
|
|
@@ -2411,6 +2426,7 @@ class bitmex extends bitmex$1 {
|
|
|
2411
2426
|
* @method
|
|
2412
2427
|
* @name bitmex#fetchFundingRates
|
|
2413
2428
|
* @description fetch the funding rate for multiple markets
|
|
2429
|
+
* @see https://www.bitmex.com/api/explorer/#!/Instrument/Instrument_getActiveAndIndices
|
|
2414
2430
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
2415
2431
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2416
2432
|
* @returns {object} a dictionary of [funding rates structures]{@link https://docs.ccxt.com/#/?id=funding-rates-structure}, indexe by market symbols
|
|
@@ -2462,6 +2478,7 @@ class bitmex extends bitmex$1 {
|
|
|
2462
2478
|
* @method
|
|
2463
2479
|
* @name bitmex#fetchFundingRateHistory
|
|
2464
2480
|
* @description Fetches the history of funding rates
|
|
2481
|
+
* @see https://www.bitmex.com/api/explorer/#!/Funding/Funding_get
|
|
2465
2482
|
* @param {string} symbol unified symbol of the market to fetch the funding rate history for
|
|
2466
2483
|
* @param {int} [since] timestamp in ms of the earliest funding rate to fetch
|
|
2467
2484
|
* @param {int} [limit] the maximum amount of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-history-structure} to fetch
|
|
@@ -2545,6 +2562,7 @@ class bitmex extends bitmex$1 {
|
|
|
2545
2562
|
* @method
|
|
2546
2563
|
* @name bitmex#setLeverage
|
|
2547
2564
|
* @description set the level of leverage for a market
|
|
2565
|
+
* @see https://www.bitmex.com/api/explorer/#!/Position/Position_updateLeverage
|
|
2548
2566
|
* @param {float} leverage the rate of leverage
|
|
2549
2567
|
* @param {string} symbol unified market symbol
|
|
2550
2568
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -2572,6 +2590,7 @@ class bitmex extends bitmex$1 {
|
|
|
2572
2590
|
* @method
|
|
2573
2591
|
* @name bitmex#setMarginMode
|
|
2574
2592
|
* @description set margin mode to 'cross' or 'isolated'
|
|
2593
|
+
* @see https://www.bitmex.com/api/explorer/#!/Position/Position_isolateMargin
|
|
2575
2594
|
* @param {string} marginMode 'cross' or 'isolated'
|
|
2576
2595
|
* @param {string} symbol unified market symbol
|
|
2577
2596
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
package/dist/cjs/src/bybit.js
CHANGED
|
@@ -3738,10 +3738,22 @@ class bybit extends bybit$1 {
|
|
|
3738
3738
|
if (isStopLoss) {
|
|
3739
3739
|
const slTriggerPrice = this.safeValue2(stopLoss, 'triggerPrice', 'stopPrice', stopLoss);
|
|
3740
3740
|
request['stopLoss'] = this.priceToPrecision(symbol, slTriggerPrice);
|
|
3741
|
+
const slLimitPrice = this.safeValue(stopLoss, 'price');
|
|
3742
|
+
if (slLimitPrice !== undefined) {
|
|
3743
|
+
request['tpslMode'] = 'Partial';
|
|
3744
|
+
request['slOrderType'] = 'Limit';
|
|
3745
|
+
request['slLimitPrice'] = this.priceToPrecision(symbol, slLimitPrice);
|
|
3746
|
+
}
|
|
3741
3747
|
}
|
|
3742
3748
|
if (isTakeProfit) {
|
|
3743
3749
|
const tpTriggerPrice = this.safeValue2(takeProfit, 'triggerPrice', 'stopPrice', takeProfit);
|
|
3744
3750
|
request['takeProfit'] = this.priceToPrecision(symbol, tpTriggerPrice);
|
|
3751
|
+
const tpLimitPrice = this.safeValue(takeProfit, 'price');
|
|
3752
|
+
if (tpLimitPrice !== undefined) {
|
|
3753
|
+
request['tpslMode'] = 'Partial';
|
|
3754
|
+
request['tpOrderType'] = 'Limit';
|
|
3755
|
+
request['tpLimitPrice'] = this.priceToPrecision(symbol, tpLimitPrice);
|
|
3756
|
+
}
|
|
3745
3757
|
}
|
|
3746
3758
|
}
|
|
3747
3759
|
if (market['spot']) {
|
|
@@ -6023,9 +6035,6 @@ class bybit extends bybit$1 {
|
|
|
6023
6035
|
if (timestamp === undefined) {
|
|
6024
6036
|
timestamp = this.safeIntegerN(position, ['updatedTime', 'updatedAt']);
|
|
6025
6037
|
}
|
|
6026
|
-
// default to cross of USDC margined positions
|
|
6027
|
-
const tradeMode = this.safeInteger(position, 'tradeMode', 0);
|
|
6028
|
-
const marginMode = tradeMode ? 'isolated' : 'cross';
|
|
6029
6038
|
let collateralString = this.safeString(position, 'positionBalance');
|
|
6030
6039
|
const entryPrice = this.omitZero(this.safeString2(position, 'entryPrice', 'avgPrice'));
|
|
6031
6040
|
const liquidationPrice = this.omitZero(this.safeString(position, 'liqPrice'));
|
|
@@ -6089,7 +6098,7 @@ class bybit extends bybit$1 {
|
|
|
6089
6098
|
'markPrice': this.safeNumber(position, 'markPrice'),
|
|
6090
6099
|
'lastPrice': undefined,
|
|
6091
6100
|
'collateral': this.parseNumber(collateralString),
|
|
6092
|
-
'marginMode':
|
|
6101
|
+
'marginMode': undefined,
|
|
6093
6102
|
'side': side,
|
|
6094
6103
|
'percentage': undefined,
|
|
6095
6104
|
'stopLossPrice': this.safeNumber2(position, 'stop_loss', 'stopLoss'),
|
|
@@ -51,8 +51,8 @@ class binance extends binance$1 {
|
|
|
51
51
|
},
|
|
52
52
|
'api': {
|
|
53
53
|
'ws': {
|
|
54
|
-
'spot': 'wss://stream.binance.com/ws',
|
|
55
|
-
'margin': 'wss://stream.binance.com/ws',
|
|
54
|
+
'spot': 'wss://stream.binance.com:9443/ws',
|
|
55
|
+
'margin': 'wss://stream.binance.com:9443/ws',
|
|
56
56
|
'future': 'wss://fstream.binance.com/ws',
|
|
57
57
|
'delivery': 'wss://dstream.binance.com/ws',
|
|
58
58
|
'ws': 'wss://ws-api.binance.com:443/ws-api/v3',
|
|
@@ -16,9 +16,11 @@ class gemini extends gemini$1 {
|
|
|
16
16
|
'watchTicker': false,
|
|
17
17
|
'watchTickers': false,
|
|
18
18
|
'watchTrades': true,
|
|
19
|
+
'watchTradesForSymbols': true,
|
|
19
20
|
'watchMyTrades': false,
|
|
20
21
|
'watchOrders': true,
|
|
21
22
|
'watchOrderBook': true,
|
|
23
|
+
'watchOrderBookForSymbols': true,
|
|
22
24
|
'watchOHLCV': true,
|
|
23
25
|
},
|
|
24
26
|
'hostname': 'api.gemini.com',
|
|
@@ -67,7 +69,29 @@ class gemini extends gemini$1 {
|
|
|
67
69
|
}
|
|
68
70
|
return this.filterBySinceLimit(trades, since, limit, 'timestamp', true);
|
|
69
71
|
}
|
|
72
|
+
async watchTradesForSymbols(symbols, since = undefined, limit = undefined, params = {}) {
|
|
73
|
+
/**
|
|
74
|
+
* @method
|
|
75
|
+
* @name gemini#watchTradesForSymbols
|
|
76
|
+
* @see https://docs.gemini.com/websocket-api/#multi-market-data
|
|
77
|
+
* @description get the list of most recent trades for a list of symbols
|
|
78
|
+
* @param {string[]} symbols unified symbol of the market to fetch trades for
|
|
79
|
+
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
80
|
+
* @param {int} [limit] the maximum amount of trades to fetch
|
|
81
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
82
|
+
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
83
|
+
*/
|
|
84
|
+
const trades = await this.helperForWatchMultipleConstruct('trades', symbols, params);
|
|
85
|
+
if (this.newUpdates) {
|
|
86
|
+
const first = this.safeList(trades, 0);
|
|
87
|
+
const tradeSymbol = this.safeString(first, 'symbol');
|
|
88
|
+
limit = trades.getLimit(tradeSymbol, limit);
|
|
89
|
+
}
|
|
90
|
+
return this.filterBySinceLimit(trades, since, limit, 'timestamp', true);
|
|
91
|
+
}
|
|
70
92
|
parseWsTrade(trade, market = undefined) {
|
|
93
|
+
//
|
|
94
|
+
// regular v2 trade
|
|
71
95
|
//
|
|
72
96
|
// {
|
|
73
97
|
// "type": "trade",
|
|
@@ -79,11 +103,31 @@ class gemini extends gemini$1 {
|
|
|
79
103
|
// "side": "buy"
|
|
80
104
|
// }
|
|
81
105
|
//
|
|
106
|
+
// multi data trade
|
|
107
|
+
//
|
|
108
|
+
// {
|
|
109
|
+
// "type": "trade",
|
|
110
|
+
// "symbol": "ETHUSD",
|
|
111
|
+
// "tid": "1683002242170204", // this is not TS, but somewhat ID
|
|
112
|
+
// "price": "2299.24",
|
|
113
|
+
// "amount": "0.002662",
|
|
114
|
+
// "makerSide": "bid"
|
|
115
|
+
// }
|
|
116
|
+
//
|
|
82
117
|
const timestamp = this.safeInteger(trade, 'timestamp');
|
|
83
|
-
const id = this.
|
|
118
|
+
const id = this.safeString2(trade, 'event_id', 'tid');
|
|
84
119
|
const priceString = this.safeString(trade, 'price');
|
|
85
|
-
const amountString = this.
|
|
86
|
-
|
|
120
|
+
const amountString = this.safeString2(trade, 'quantity', 'amount');
|
|
121
|
+
let side = this.safeStringLower(trade, 'side');
|
|
122
|
+
if (side === undefined) {
|
|
123
|
+
const marketSide = this.safeStringLower(trade, 'makerSide');
|
|
124
|
+
if (marketSide === 'bid') {
|
|
125
|
+
side = 'sell';
|
|
126
|
+
}
|
|
127
|
+
else if (marketSide === 'ask') {
|
|
128
|
+
side = 'buy';
|
|
129
|
+
}
|
|
130
|
+
}
|
|
87
131
|
const marketId = this.safeStringLower(trade, 'symbol');
|
|
88
132
|
const symbol = this.safeSymbol(marketId, market);
|
|
89
133
|
return this.safeTrade({
|
|
@@ -183,6 +227,34 @@ class gemini extends gemini$1 {
|
|
|
183
227
|
client.resolve(stored, messageHash);
|
|
184
228
|
}
|
|
185
229
|
}
|
|
230
|
+
handleTradesForMultidata(client, trades, timestamp) {
|
|
231
|
+
if (trades !== undefined) {
|
|
232
|
+
const tradesLimit = this.safeInteger(this.options, 'tradesLimit', 1000);
|
|
233
|
+
const storesForSymbols = {};
|
|
234
|
+
for (let i = 0; i < trades.length; i++) {
|
|
235
|
+
const marketId = trades[i]['symbol'];
|
|
236
|
+
const market = this.safeMarket(marketId.toLowerCase());
|
|
237
|
+
const symbol = market['symbol'];
|
|
238
|
+
const trade = this.parseWsTrade(trades[i], market);
|
|
239
|
+
trade['timestamp'] = timestamp;
|
|
240
|
+
trade['datetime'] = this.iso8601(timestamp);
|
|
241
|
+
let stored = this.safeValue(this.trades, symbol);
|
|
242
|
+
if (stored === undefined) {
|
|
243
|
+
stored = new Cache.ArrayCache(tradesLimit);
|
|
244
|
+
this.trades[symbol] = stored;
|
|
245
|
+
}
|
|
246
|
+
stored.append(trade);
|
|
247
|
+
storesForSymbols[symbol] = stored;
|
|
248
|
+
}
|
|
249
|
+
const symbols = Object.keys(storesForSymbols);
|
|
250
|
+
for (let i = 0; i < symbols.length; i++) {
|
|
251
|
+
const symbol = symbols[i];
|
|
252
|
+
const stored = storesForSymbols[symbol];
|
|
253
|
+
const messageHash = 'trades:' + symbol;
|
|
254
|
+
client.resolve(stored, messageHash);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
186
258
|
async watchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
|
|
187
259
|
/**
|
|
188
260
|
* @method
|
|
@@ -328,6 +400,93 @@ class gemini extends gemini$1 {
|
|
|
328
400
|
this.orderbooks[symbol] = orderbook;
|
|
329
401
|
client.resolve(orderbook, messageHash);
|
|
330
402
|
}
|
|
403
|
+
async watchOrderBookForSymbols(symbols, limit = undefined, params = {}) {
|
|
404
|
+
/**
|
|
405
|
+
* @method
|
|
406
|
+
* @name gemini#watchOrderBookForSymbols
|
|
407
|
+
* @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
408
|
+
* @see https://docs.gemini.com/websocket-api/#multi-market-data
|
|
409
|
+
* @param {string[]} symbols unified array of symbols
|
|
410
|
+
* @param {int} [limit] the maximum amount of order book entries to return
|
|
411
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
412
|
+
* @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
|
|
413
|
+
*/
|
|
414
|
+
const orderbook = await this.helperForWatchMultipleConstruct('orderbook', symbols, params);
|
|
415
|
+
return orderbook.limit();
|
|
416
|
+
}
|
|
417
|
+
async helperForWatchMultipleConstruct(itemHashName, symbols, params = {}) {
|
|
418
|
+
await this.loadMarkets();
|
|
419
|
+
symbols = this.marketSymbols(symbols, undefined, false, true, true);
|
|
420
|
+
const firstMarket = this.market(symbols[0]);
|
|
421
|
+
if (!firstMarket['spot'] && !firstMarket['linear']) {
|
|
422
|
+
throw new errors.NotSupported(this.id + ' watchMultiple supports only spot or linear-swap symbols');
|
|
423
|
+
}
|
|
424
|
+
const messageHashes = [];
|
|
425
|
+
const marketIds = [];
|
|
426
|
+
for (let i = 0; i < symbols.length; i++) {
|
|
427
|
+
const symbol = symbols[i];
|
|
428
|
+
const messageHash = itemHashName + ':' + symbol;
|
|
429
|
+
messageHashes.push(messageHash);
|
|
430
|
+
const market = this.market(symbol);
|
|
431
|
+
marketIds.push(market['id']);
|
|
432
|
+
}
|
|
433
|
+
const queryStr = marketIds.join(',');
|
|
434
|
+
let url = this.urls['api']['ws'] + '/v1/multimarketdata?symbols=' + queryStr + '&heartbeat=true&';
|
|
435
|
+
if (itemHashName === 'orderbook') {
|
|
436
|
+
url += 'trades=false&bids=true&offers=true';
|
|
437
|
+
}
|
|
438
|
+
else if (itemHashName === 'trades') {
|
|
439
|
+
url += 'trades=true&bids=false&offers=false';
|
|
440
|
+
}
|
|
441
|
+
return await this.watchMultiple(url, messageHashes, undefined);
|
|
442
|
+
}
|
|
443
|
+
handleOrderBookForMultidata(client, rawOrderBookChanges, timestamp, nonce) {
|
|
444
|
+
//
|
|
445
|
+
// rawOrderBookChanges
|
|
446
|
+
//
|
|
447
|
+
// [
|
|
448
|
+
// {
|
|
449
|
+
// delta: "4105123935484.817624",
|
|
450
|
+
// price: "0.000000001",
|
|
451
|
+
// reason: "initial", // initial|cancel|place
|
|
452
|
+
// remaining: "4105123935484.817624",
|
|
453
|
+
// side: "bid", // bid|ask
|
|
454
|
+
// symbol: "SHIBUSD",
|
|
455
|
+
// type: "change", // seems always change
|
|
456
|
+
// },
|
|
457
|
+
// ...
|
|
458
|
+
//
|
|
459
|
+
const marketId = rawOrderBookChanges[0]['symbol'];
|
|
460
|
+
const market = this.safeMarket(marketId.toLowerCase());
|
|
461
|
+
const symbol = market['symbol'];
|
|
462
|
+
const messageHash = 'orderbook:' + symbol;
|
|
463
|
+
let orderbook = this.safeDict(this.orderbooks, symbol);
|
|
464
|
+
if (orderbook === undefined) {
|
|
465
|
+
orderbook = this.orderBook();
|
|
466
|
+
}
|
|
467
|
+
const bids = orderbook['bids'];
|
|
468
|
+
const asks = orderbook['asks'];
|
|
469
|
+
for (let i = 0; i < rawOrderBookChanges.length; i++) {
|
|
470
|
+
const entry = rawOrderBookChanges[i];
|
|
471
|
+
const price = this.safeNumber(entry, 'price');
|
|
472
|
+
const size = this.safeNumber(entry, 'remaining');
|
|
473
|
+
const rawSide = this.safeString(entry, 'side');
|
|
474
|
+
if (rawSide === 'bid') {
|
|
475
|
+
bids.store(price, size);
|
|
476
|
+
}
|
|
477
|
+
else {
|
|
478
|
+
asks.store(price, size);
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
orderbook['bids'] = bids;
|
|
482
|
+
orderbook['asks'] = asks;
|
|
483
|
+
orderbook['symbol'] = symbol;
|
|
484
|
+
orderbook['nonce'] = nonce;
|
|
485
|
+
orderbook['timestamp'] = timestamp;
|
|
486
|
+
orderbook['datetime'] = this.iso8601(timestamp);
|
|
487
|
+
this.orderbooks[symbol] = orderbook;
|
|
488
|
+
client.resolve(orderbook, messageHash);
|
|
489
|
+
}
|
|
331
490
|
handleL2Updates(client, message) {
|
|
332
491
|
//
|
|
333
492
|
// {
|
|
@@ -408,6 +567,7 @@ class gemini extends gemini$1 {
|
|
|
408
567
|
// "socket_sequence": 7
|
|
409
568
|
// }
|
|
410
569
|
//
|
|
570
|
+
client.lastPong = this.milliseconds();
|
|
411
571
|
return message;
|
|
412
572
|
}
|
|
413
573
|
handleSubscription(client, message) {
|
|
@@ -610,6 +770,33 @@ class gemini extends gemini$1 {
|
|
|
610
770
|
if (method !== undefined) {
|
|
611
771
|
method.call(this, client, message);
|
|
612
772
|
}
|
|
773
|
+
// handle multimarketdata
|
|
774
|
+
if (type === 'update') {
|
|
775
|
+
const ts = this.safeInteger(message, 'timestampms', this.milliseconds());
|
|
776
|
+
const eventId = this.safeInteger(message, 'eventId');
|
|
777
|
+
const events = this.safeList(message, 'events');
|
|
778
|
+
const orderBookItems = [];
|
|
779
|
+
const collectedEventsOfTrades = [];
|
|
780
|
+
for (let i = 0; i < events.length; i++) {
|
|
781
|
+
const event = events[i];
|
|
782
|
+
const eventType = this.safeString(event, 'type');
|
|
783
|
+
const isOrderBook = (eventType === 'change') && ('side' in event) && this.inArray(event['side'], ['ask', 'bid']);
|
|
784
|
+
if (isOrderBook) {
|
|
785
|
+
orderBookItems.push(event);
|
|
786
|
+
}
|
|
787
|
+
else if (eventType === 'trade') {
|
|
788
|
+
collectedEventsOfTrades.push(events[i]);
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
const lengthOb = orderBookItems.length;
|
|
792
|
+
if (lengthOb > 0) {
|
|
793
|
+
this.handleOrderBookForMultidata(client, orderBookItems, ts, eventId);
|
|
794
|
+
}
|
|
795
|
+
const lengthTrades = collectedEventsOfTrades.length;
|
|
796
|
+
if (lengthTrades > 0) {
|
|
797
|
+
this.handleTradesForMultidata(client, collectedEventsOfTrades, ts);
|
|
798
|
+
}
|
|
799
|
+
}
|
|
613
800
|
}
|
|
614
801
|
async authenticate(params = {}) {
|
|
615
802
|
const url = this.safeString(params, 'url');
|