ccxt 4.3.75 → 4.3.77
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/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +1 -1
- package/dist/cjs/src/binance.js +2 -2
- package/dist/cjs/src/bithumb.js +14 -14
- package/dist/cjs/src/bitmart.js +148 -82
- package/dist/cjs/src/bybit.js +6 -1
- package/dist/cjs/src/coinbase.js +8 -4
- package/dist/cjs/src/gemini.js +1 -0
- package/dist/cjs/src/htx.js +4 -0
- package/dist/cjs/src/kraken.js +3 -0
- package/dist/cjs/src/pro/binance.js +24 -0
- package/dist/cjs/src/pro/bitmart.js +9 -8
- package/dist/cjs/src/pro/bybit.js +21 -2
- package/dist/cjs/src/pro/woo.js +1 -1
- package/dist/cjs/src/xt.js +4 -0
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bitmart.d.ts +2 -0
- package/js/src/abstract/gemini.d.ts +1 -0
- package/js/src/base/Exchange.js +1 -1
- package/js/src/binance.js +2 -2
- package/js/src/bithumb.js +14 -14
- package/js/src/bitmart.js +148 -82
- package/js/src/bybit.js +6 -1
- package/js/src/coinbase.js +8 -4
- package/js/src/gemini.js +1 -0
- package/js/src/htx.js +4 -0
- package/js/src/kraken.js +3 -0
- package/js/src/pro/binance.js +24 -0
- package/js/src/pro/bitmart.js +9 -8
- package/js/src/pro/bybit.js +21 -2
- package/js/src/pro/woo.js +1 -1
- package/js/src/xt.d.ts +4 -0
- package/js/src/xt.js +4 -0
- package/package.json +1 -1
package/dist/cjs/ccxt.js
CHANGED
|
@@ -194,7 +194,7 @@ var xt$1 = require('./src/pro/xt.js');
|
|
|
194
194
|
|
|
195
195
|
//-----------------------------------------------------------------------------
|
|
196
196
|
// this is updated by vss.js when building
|
|
197
|
-
const version = '4.3.
|
|
197
|
+
const version = '4.3.77';
|
|
198
198
|
Exchange["default"].ccxtVersion = version;
|
|
199
199
|
const exchanges = {
|
|
200
200
|
'ace': ace,
|
|
@@ -2002,7 +2002,7 @@ class Exchange {
|
|
|
2002
2002
|
}
|
|
2003
2003
|
async watchLiquidations(symbol, since = undefined, limit = undefined, params = {}) {
|
|
2004
2004
|
if (this.has['watchLiquidationsForSymbols']) {
|
|
2005
|
-
return this.watchLiquidationsForSymbols([symbol], since, limit, params);
|
|
2005
|
+
return await this.watchLiquidationsForSymbols([symbol], since, limit, params);
|
|
2006
2006
|
}
|
|
2007
2007
|
throw new errors.NotSupported(this.id + ' watchLiquidations() is not supported yet');
|
|
2008
2008
|
}
|
package/dist/cjs/src/binance.js
CHANGED
|
@@ -2797,7 +2797,7 @@ class binance extends binance$1 {
|
|
|
2797
2797
|
'active': depositEnable && withdrawEnable,
|
|
2798
2798
|
'deposit': depositEnable,
|
|
2799
2799
|
'withdraw': withdrawEnable,
|
|
2800
|
-
'fee':
|
|
2800
|
+
'fee': withdrawFee,
|
|
2801
2801
|
'precision': this.parseNumber(precisionTick),
|
|
2802
2802
|
'limits': {
|
|
2803
2803
|
'withdraw': {
|
|
@@ -2805,7 +2805,7 @@ class binance extends binance$1 {
|
|
|
2805
2805
|
'max': this.safeNumber(networkItem, 'withdrawMax'),
|
|
2806
2806
|
},
|
|
2807
2807
|
'deposit': {
|
|
2808
|
-
'min':
|
|
2808
|
+
'min': this.safeNumber(networkItem, 'depositDust'),
|
|
2809
2809
|
'max': undefined,
|
|
2810
2810
|
},
|
|
2811
2811
|
},
|
package/dist/cjs/src/bithumb.js
CHANGED
|
@@ -198,7 +198,7 @@ class bithumb extends bithumb$1 {
|
|
|
198
198
|
* @method
|
|
199
199
|
* @name bithumb#fetchMarkets
|
|
200
200
|
* @description retrieves data on all markets for bithumb
|
|
201
|
-
* @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
|
|
201
|
+
* @see https://apidocs.bithumb.com/v1.2.0/reference/%ED%98%84%EC%9E%AC%EA%B0%80-%EC%A0%95%EB%B3%B4-%EC%A1%B0%ED%9A%8C-all
|
|
202
202
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
203
203
|
* @returns {object[]} an array of objects representing market data
|
|
204
204
|
*/
|
|
@@ -341,7 +341,7 @@ class bithumb extends bithumb$1 {
|
|
|
341
341
|
* @method
|
|
342
342
|
* @name bithumb#fetchBalance
|
|
343
343
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
344
|
-
* @see https://apidocs.bithumb.com/reference/%EB%B3%B4%EC%9C%A0%EC%9E%90%EC%82%B0-%EC%A1%B0%ED%9A%8C
|
|
344
|
+
* @see https://apidocs.bithumb.com/v1.2.0/reference/%EB%B3%B4%EC%9C%A0%EC%9E%90%EC%82%B0-%EC%A1%B0%ED%9A%8C
|
|
345
345
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
346
346
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
347
347
|
*/
|
|
@@ -357,7 +357,7 @@ class bithumb extends bithumb$1 {
|
|
|
357
357
|
* @method
|
|
358
358
|
* @name bithumb#fetchOrderBook
|
|
359
359
|
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
360
|
-
* @see https://apidocs.bithumb.com/reference/%ED%98%B8%EA%B0%80-%EC%A0%95%EB%B3%B4-%EC%A1%B0%ED%9A%8C
|
|
360
|
+
* @see https://apidocs.bithumb.com/v1.2.0/reference/%ED%98%B8%EA%B0%80-%EC%A0%95%EB%B3%B4-%EC%A1%B0%ED%9A%8C
|
|
361
361
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
362
362
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
363
363
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -450,7 +450,7 @@ class bithumb extends bithumb$1 {
|
|
|
450
450
|
* @method
|
|
451
451
|
* @name bithumb#fetchTickers
|
|
452
452
|
* @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
|
453
|
-
* @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
|
|
453
|
+
* @see https://apidocs.bithumb.com/v1.2.0/reference/%ED%98%84%EC%9E%AC%EA%B0%80-%EC%A0%95%EB%B3%B4-%EC%A1%B0%ED%9A%8C-all
|
|
454
454
|
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
455
455
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
456
456
|
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -512,7 +512,7 @@ class bithumb extends bithumb$1 {
|
|
|
512
512
|
* @method
|
|
513
513
|
* @name bithumb#fetchTicker
|
|
514
514
|
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
515
|
-
* @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
|
|
515
|
+
* @see https://apidocs.bithumb.com/v1.2.0/reference/%ED%98%84%EC%9E%AC%EA%B0%80-%EC%A0%95%EB%B3%B4-%EC%A1%B0%ED%9A%8C
|
|
516
516
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
517
517
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
518
518
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -571,7 +571,7 @@ class bithumb extends bithumb$1 {
|
|
|
571
571
|
* @method
|
|
572
572
|
* @name bithumb#fetchOHLCV
|
|
573
573
|
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
574
|
-
* @see https://apidocs.bithumb.com/reference/candlestick-rest-api
|
|
574
|
+
* @see https://apidocs.bithumb.com/v1.2.0/reference/candlestick-rest-api
|
|
575
575
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
576
576
|
* @param {string} timeframe the length of time each candle represents
|
|
577
577
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
@@ -696,7 +696,7 @@ class bithumb extends bithumb$1 {
|
|
|
696
696
|
* @method
|
|
697
697
|
* @name bithumb#fetchTrades
|
|
698
698
|
* @description get the list of most recent trades for a particular symbol
|
|
699
|
-
* @see https://apidocs.bithumb.com/reference/%EC%B5%9C%EA%B7%BC-%EC%B2%B4%EA%B2%B0-%EB%82%B4%EC%97%AD
|
|
699
|
+
* @see https://apidocs.bithumb.com/v1.2.0/reference/%EC%B5%9C%EA%B7%BC-%EC%B2%B4%EA%B2%B0-%EB%82%B4%EC%97%AD
|
|
700
700
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
701
701
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
702
702
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
@@ -735,9 +735,9 @@ class bithumb extends bithumb$1 {
|
|
|
735
735
|
* @method
|
|
736
736
|
* @name bithumb#createOrder
|
|
737
737
|
* @description create a trade order
|
|
738
|
-
* @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
|
|
739
|
-
* @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
|
|
740
|
-
* @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
|
|
738
|
+
* @see https://apidocs.bithumb.com/v1.2.0/reference/%EC%A7%80%EC%A0%95%EA%B0%80-%EC%A3%BC%EB%AC%B8%ED%95%98%EA%B8%B0
|
|
739
|
+
* @see https://apidocs.bithumb.com/v1.2.0/reference/%EC%8B%9C%EC%9E%A5%EA%B0%80-%EB%A7%A4%EC%88%98%ED%95%98%EA%B8%B0
|
|
740
|
+
* @see https://apidocs.bithumb.com/v1.2.0/reference/%EC%8B%9C%EC%9E%A5%EA%B0%80-%EB%A7%A4%EB%8F%84%ED%95%98%EA%B8%B0
|
|
741
741
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
742
742
|
* @param {string} type 'market' or 'limit'
|
|
743
743
|
* @param {string} side 'buy' or 'sell'
|
|
@@ -779,7 +779,7 @@ class bithumb extends bithumb$1 {
|
|
|
779
779
|
* @method
|
|
780
780
|
* @name bithumb#fetchOrder
|
|
781
781
|
* @description fetches information on an order made by the user
|
|
782
|
-
* @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
|
|
782
|
+
* @see https://apidocs.bithumb.com/v1.2.0/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
|
|
783
783
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
784
784
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
785
785
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
@@ -938,7 +938,7 @@ class bithumb extends bithumb$1 {
|
|
|
938
938
|
* @method
|
|
939
939
|
* @name bithumb#fetchOpenOrders
|
|
940
940
|
* @description fetch all unfilled currently open orders
|
|
941
|
-
* @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
|
|
941
|
+
* @see https://apidocs.bithumb.com/v1.2.0/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
|
|
942
942
|
* @param {string} symbol unified market symbol
|
|
943
943
|
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
944
944
|
* @param {int} [limit] the maximum number of open order structures to retrieve
|
|
@@ -987,7 +987,7 @@ class bithumb extends bithumb$1 {
|
|
|
987
987
|
* @method
|
|
988
988
|
* @name bithumb#cancelOrder
|
|
989
989
|
* @description cancels an open order
|
|
990
|
-
* @see https://apidocs.bithumb.com/reference/%EC%A3%BC%EB%AC%B8-%EC%B7%A8%EC%86%8C%ED%95%98%EA%B8%B0
|
|
990
|
+
* @see https://apidocs.bithumb.com/v1.2.0/reference/%EC%A3%BC%EB%AC%B8-%EC%B7%A8%EC%86%8C%ED%95%98%EA%B8%B0
|
|
991
991
|
* @param {string} id order id
|
|
992
992
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
993
993
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -1031,7 +1031,7 @@ class bithumb extends bithumb$1 {
|
|
|
1031
1031
|
* @method
|
|
1032
1032
|
* @name bithumb#withdraw
|
|
1033
1033
|
* @description make a withdrawal
|
|
1034
|
-
* @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
|
|
1034
|
+
* @see https://apidocs.bithumb.com/v1.2.0/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
|
|
1035
1035
|
* @param {string} code unified currency code
|
|
1036
1036
|
* @param {float} amount the amount to withdraw
|
|
1037
1037
|
* @param {string} address the address to withdraw to
|
package/dist/cjs/src/bitmart.js
CHANGED
|
@@ -110,7 +110,8 @@ class bitmart extends bitmart$1 {
|
|
|
110
110
|
'urls': {
|
|
111
111
|
'logo': 'https://user-images.githubusercontent.com/1294454/129991357-8f47464b-d0f4-41d6-8a82-34122f0d1398.jpg',
|
|
112
112
|
'api': {
|
|
113
|
-
'
|
|
113
|
+
'spot': 'https://api-cloud.{hostname}',
|
|
114
|
+
'swap': 'https://api-cloud-v2.{hostname}', // bitmart.info for Hong Kong users
|
|
114
115
|
},
|
|
115
116
|
'www': 'https://www.bitmart.com/',
|
|
116
117
|
'doc': 'https://developer-pro.bitmart.com/',
|
|
@@ -201,6 +202,8 @@ class bitmart extends bitmart$1 {
|
|
|
201
202
|
'contract/private/current-plan-order': 1.2,
|
|
202
203
|
'contract/private/trades': 10,
|
|
203
204
|
'contract/private/position-risk': 10,
|
|
205
|
+
'contract/private/affilate/rebate-list': 10,
|
|
206
|
+
'contract/private/affilate/trade-list': 10,
|
|
204
207
|
},
|
|
205
208
|
'post': {
|
|
206
209
|
// sub-account endpoints
|
|
@@ -494,8 +497,8 @@ class bitmart extends bitmart$1 {
|
|
|
494
497
|
'40045': errors.InvalidOrder,
|
|
495
498
|
'40046': errors.PermissionDenied,
|
|
496
499
|
'40047': errors.PermissionDenied,
|
|
497
|
-
'40048': errors.
|
|
498
|
-
'40049': errors.
|
|
500
|
+
'40048': errors.InvalidOrder,
|
|
501
|
+
'40049': errors.InvalidOrder,
|
|
499
502
|
'40050': errors.InvalidOrder, // 403, Client OrderId duplicated with existing orders
|
|
500
503
|
},
|
|
501
504
|
'broad': {},
|
|
@@ -867,36 +870,43 @@ class bitmart extends bitmart$1 {
|
|
|
867
870
|
async fetchContractMarkets(params = {}) {
|
|
868
871
|
const response = await this.publicGetContractPublicDetails(params);
|
|
869
872
|
//
|
|
870
|
-
//
|
|
871
|
-
//
|
|
872
|
-
//
|
|
873
|
-
//
|
|
874
|
-
//
|
|
875
|
-
// "symbols": [
|
|
876
|
-
//
|
|
877
|
-
//
|
|
878
|
-
//
|
|
879
|
-
//
|
|
880
|
-
//
|
|
881
|
-
//
|
|
882
|
-
//
|
|
883
|
-
//
|
|
884
|
-
//
|
|
885
|
-
//
|
|
886
|
-
//
|
|
887
|
-
//
|
|
888
|
-
//
|
|
889
|
-
//
|
|
890
|
-
//
|
|
891
|
-
//
|
|
892
|
-
//
|
|
893
|
-
//
|
|
894
|
-
//
|
|
895
|
-
//
|
|
896
|
-
//
|
|
897
|
-
//
|
|
898
|
-
//
|
|
873
|
+
// {
|
|
874
|
+
// "code": 1000,
|
|
875
|
+
// "message": "Ok",
|
|
876
|
+
// "trace": "9b92a999-9463-4c96-91a4-93ad1cad0d72",
|
|
877
|
+
// "data": {
|
|
878
|
+
// "symbols": [
|
|
879
|
+
// {
|
|
880
|
+
// "symbol": "BTCUSDT",
|
|
881
|
+
// "product_type": 1,
|
|
882
|
+
// "open_timestamp": 1594080000,
|
|
883
|
+
// "expire_timestamp": 0,
|
|
884
|
+
// "settle_timestamp": 0,
|
|
885
|
+
// "base_currency": "BTC",
|
|
886
|
+
// "quote_currency": "USDT",
|
|
887
|
+
// "last_price": "23920",
|
|
888
|
+
// "volume_24h": "18969368",
|
|
889
|
+
// "turnover_24h": "458933659.7858",
|
|
890
|
+
// "index_price": "23945.25191635",
|
|
891
|
+
// "index_name": "BTCUSDT",
|
|
892
|
+
// "contract_size": "0.001",
|
|
893
|
+
// "min_leverage": "1",
|
|
894
|
+
// "max_leverage": "100",
|
|
895
|
+
// "price_precision": "0.1",
|
|
896
|
+
// "vol_precision": "1",
|
|
897
|
+
// "max_volume": "500000",
|
|
898
|
+
// "min_volume": "1",
|
|
899
|
+
// "funding_rate": "0.0001",
|
|
900
|
+
// "expected_funding_rate": "0.00011",
|
|
901
|
+
// "open_interest": "4134180870",
|
|
902
|
+
// "open_interest_value": "94100888927.0433258",
|
|
903
|
+
// "high_24h": "23900",
|
|
904
|
+
// "low_24h": "23100",
|
|
905
|
+
// "change_24h": "0.004"
|
|
906
|
+
// },
|
|
907
|
+
// ]
|
|
899
908
|
// }
|
|
909
|
+
// }
|
|
900
910
|
//
|
|
901
911
|
const data = this.safeValue(response, 'data', {});
|
|
902
912
|
const symbols = this.safeValue(data, 'symbols', []);
|
|
@@ -975,6 +985,7 @@ class bitmart extends bitmart$1 {
|
|
|
975
985
|
/**
|
|
976
986
|
* @method
|
|
977
987
|
* @name bitmart#fetchMarkets
|
|
988
|
+
* @see https://developer-pro.bitmart.com/en/futuresv2/#get-contract-details
|
|
978
989
|
* @description retrieves data on all markets for bitmart
|
|
979
990
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
980
991
|
* @returns {object[]} an array of objects representing market data
|
|
@@ -1180,25 +1191,41 @@ class bitmart extends bitmart$1 {
|
|
|
1180
1191
|
//
|
|
1181
1192
|
// swap
|
|
1182
1193
|
//
|
|
1183
|
-
//
|
|
1184
|
-
//
|
|
1185
|
-
//
|
|
1186
|
-
//
|
|
1187
|
-
//
|
|
1188
|
-
//
|
|
1189
|
-
//
|
|
1190
|
-
//
|
|
1191
|
-
//
|
|
1192
|
-
//
|
|
1193
|
-
//
|
|
1194
|
-
//
|
|
1194
|
+
// {
|
|
1195
|
+
// "symbol": "BTCUSDT",
|
|
1196
|
+
// "product_type": 1,
|
|
1197
|
+
// "open_timestamp": 1594080000,
|
|
1198
|
+
// "expire_timestamp": 0,
|
|
1199
|
+
// "settle_timestamp": 0,
|
|
1200
|
+
// "base_currency": "BTC",
|
|
1201
|
+
// "quote_currency": "USDT",
|
|
1202
|
+
// "last_price": "23920",
|
|
1203
|
+
// "volume_24h": "18969368",
|
|
1204
|
+
// "turnover_24h": "458933659.7858",
|
|
1205
|
+
// "index_price": "23945.25191635",
|
|
1206
|
+
// "index_name": "BTCUSDT",
|
|
1207
|
+
// "contract_size": "0.001",
|
|
1208
|
+
// "min_leverage": "1",
|
|
1209
|
+
// "max_leverage": "100",
|
|
1210
|
+
// "price_precision": "0.1",
|
|
1211
|
+
// "vol_precision": "1",
|
|
1212
|
+
// "max_volume": "500000",
|
|
1213
|
+
// "min_volume": "1",
|
|
1214
|
+
// "funding_rate": "0.0001",
|
|
1215
|
+
// "expected_funding_rate": "0.00011",
|
|
1216
|
+
// "open_interest": "4134180870",
|
|
1217
|
+
// "open_interest_value": "94100888927.0433258",
|
|
1218
|
+
// "high_24h": "23900",
|
|
1219
|
+
// "low_24h": "23100",
|
|
1220
|
+
// "change_24h": "0.004"
|
|
1221
|
+
// }
|
|
1195
1222
|
//
|
|
1196
1223
|
const result = this.safeList(ticker, 'result', []);
|
|
1197
1224
|
const average = this.safeString2(ticker, 'avg_price', 'index_price');
|
|
1198
1225
|
let marketId = this.safeString2(ticker, 'symbol', 'contract_symbol');
|
|
1199
1226
|
let timestamp = this.safeInteger2(ticker, 'timestamp', 'ts');
|
|
1200
1227
|
let last = this.safeString2(ticker, 'last_price', 'last');
|
|
1201
|
-
let percentage = this.
|
|
1228
|
+
let percentage = this.safeString2(ticker, 'price_change_percent_24h', 'change_24h');
|
|
1202
1229
|
let change = this.safeString(ticker, 'fluctuation');
|
|
1203
1230
|
let high = this.safeString2(ticker, 'high_24h', 'high_price');
|
|
1204
1231
|
let low = this.safeString2(ticker, 'low_24h', 'low_price');
|
|
@@ -1207,8 +1234,8 @@ class bitmart extends bitmart$1 {
|
|
|
1207
1234
|
let ask = this.safeString2(ticker, 'best_ask', 'ask_px');
|
|
1208
1235
|
let askVolume = this.safeString2(ticker, 'best_ask_size', 'ask_sz');
|
|
1209
1236
|
let open = this.safeString(ticker, 'open_24h');
|
|
1210
|
-
let baseVolume = this.
|
|
1211
|
-
let quoteVolume = this.
|
|
1237
|
+
let baseVolume = this.safeStringN(ticker, ['base_volume_24h', 'v_24h', 'volume_24h']);
|
|
1238
|
+
let quoteVolume = this.safeStringLowerN(ticker, ['quote_volume_24h', 'qv_24h', 'turnover_24h']);
|
|
1212
1239
|
const listMarketId = this.safeString(result, 0);
|
|
1213
1240
|
if (listMarketId !== undefined) {
|
|
1214
1241
|
marketId = listMarketId;
|
|
@@ -1275,6 +1302,7 @@ class bitmart extends bitmart$1 {
|
|
|
1275
1302
|
* @name bitmart#fetchTicker
|
|
1276
1303
|
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
1277
1304
|
* @see https://developer-pro.bitmart.com/en/spot/#get-ticker-of-a-trading-pair-v3
|
|
1305
|
+
* @see https://developer-pro.bitmart.com/en/futuresv2/#get-contract-details
|
|
1278
1306
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
1279
1307
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1280
1308
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -1284,8 +1312,8 @@ class bitmart extends bitmart$1 {
|
|
|
1284
1312
|
const request = {};
|
|
1285
1313
|
let response = undefined;
|
|
1286
1314
|
if (market['swap']) {
|
|
1287
|
-
request['
|
|
1288
|
-
response = await this.
|
|
1315
|
+
request['symbol'] = market['id'];
|
|
1316
|
+
response = await this.publicGetContractPublicDetails(this.extend(request, params));
|
|
1289
1317
|
//
|
|
1290
1318
|
// {
|
|
1291
1319
|
// "message":"OK",
|
|
@@ -1340,7 +1368,6 @@ class bitmart extends bitmart$1 {
|
|
|
1340
1368
|
throw new errors.NotSupported(this.id + ' fetchTicker() does not support ' + market['type'] + ' markets, only spot and swap markets are accepted');
|
|
1341
1369
|
}
|
|
1342
1370
|
// fails in naming for contract tickers 'contract_symbol'
|
|
1343
|
-
let tickersById = undefined;
|
|
1344
1371
|
let tickers = [];
|
|
1345
1372
|
let ticker = {};
|
|
1346
1373
|
if (market['spot']) {
|
|
@@ -1348,9 +1375,8 @@ class bitmart extends bitmart$1 {
|
|
|
1348
1375
|
}
|
|
1349
1376
|
else {
|
|
1350
1377
|
const data = this.safeDict(response, 'data', {});
|
|
1351
|
-
tickers = this.safeList(data, '
|
|
1352
|
-
|
|
1353
|
-
ticker = this.safeDict(tickersById, market['id']);
|
|
1378
|
+
tickers = this.safeList(data, 'symbols', []);
|
|
1379
|
+
ticker = this.safeValue(tickers, 0, {});
|
|
1354
1380
|
}
|
|
1355
1381
|
return this.parseTicker(ticker, market);
|
|
1356
1382
|
}
|
|
@@ -1360,6 +1386,7 @@ class bitmart extends bitmart$1 {
|
|
|
1360
1386
|
* @name bitmart#fetchTickers
|
|
1361
1387
|
* @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
|
1362
1388
|
* @see https://developer-pro.bitmart.com/en/spot/#get-ticker-of-all-pairs-v3
|
|
1389
|
+
* @see https://developer-pro.bitmart.com/en/futuresv2/#get-contract-details
|
|
1363
1390
|
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
1364
1391
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1365
1392
|
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -1402,29 +1429,45 @@ class bitmart extends bitmart$1 {
|
|
|
1402
1429
|
//
|
|
1403
1430
|
}
|
|
1404
1431
|
else if (type === 'swap') {
|
|
1405
|
-
response = await this.
|
|
1432
|
+
response = await this.publicGetContractPublicDetails(params);
|
|
1406
1433
|
//
|
|
1407
|
-
//
|
|
1408
|
-
//
|
|
1409
|
-
//
|
|
1410
|
-
//
|
|
1411
|
-
//
|
|
1412
|
-
//
|
|
1413
|
-
//
|
|
1414
|
-
//
|
|
1415
|
-
//
|
|
1416
|
-
//
|
|
1417
|
-
//
|
|
1418
|
-
//
|
|
1419
|
-
//
|
|
1420
|
-
//
|
|
1421
|
-
//
|
|
1422
|
-
//
|
|
1423
|
-
//
|
|
1424
|
-
//
|
|
1425
|
-
//
|
|
1426
|
-
//
|
|
1427
|
-
//
|
|
1434
|
+
// {
|
|
1435
|
+
// "code": 1000,
|
|
1436
|
+
// "message": "Ok",
|
|
1437
|
+
// "trace": "9b92a999-9463-4c96-91a4-93ad1cad0d72",
|
|
1438
|
+
// "data": {
|
|
1439
|
+
// "symbols": [
|
|
1440
|
+
// {
|
|
1441
|
+
// "symbol": "BTCUSDT",
|
|
1442
|
+
// "product_type": 1,
|
|
1443
|
+
// "open_timestamp": 1594080000,
|
|
1444
|
+
// "expire_timestamp": 0,
|
|
1445
|
+
// "settle_timestamp": 0,
|
|
1446
|
+
// "base_currency": "BTC",
|
|
1447
|
+
// "quote_currency": "USDT",
|
|
1448
|
+
// "last_price": "23920",
|
|
1449
|
+
// "volume_24h": "18969368",
|
|
1450
|
+
// "turnover_24h": "458933659.7858",
|
|
1451
|
+
// "index_price": "23945.25191635",
|
|
1452
|
+
// "index_name": "BTCUSDT",
|
|
1453
|
+
// "contract_size": "0.001",
|
|
1454
|
+
// "min_leverage": "1",
|
|
1455
|
+
// "max_leverage": "100",
|
|
1456
|
+
// "price_precision": "0.1",
|
|
1457
|
+
// "vol_precision": "1",
|
|
1458
|
+
// "max_volume": "500000",
|
|
1459
|
+
// "min_volume": "1",
|
|
1460
|
+
// "funding_rate": "0.0001",
|
|
1461
|
+
// "expected_funding_rate": "0.00011",
|
|
1462
|
+
// "open_interest": "4134180870",
|
|
1463
|
+
// "open_interest_value": "94100888927.0433258",
|
|
1464
|
+
// "high_24h": "23900",
|
|
1465
|
+
// "low_24h": "23100",
|
|
1466
|
+
// "change_24h": "0.004"
|
|
1467
|
+
// },
|
|
1468
|
+
// ]
|
|
1469
|
+
// }
|
|
1470
|
+
// }
|
|
1428
1471
|
//
|
|
1429
1472
|
}
|
|
1430
1473
|
else {
|
|
@@ -1436,7 +1479,7 @@ class bitmart extends bitmart$1 {
|
|
|
1436
1479
|
}
|
|
1437
1480
|
else {
|
|
1438
1481
|
const data = this.safeDict(response, 'data', {});
|
|
1439
|
-
tickers = this.safeList(data, '
|
|
1482
|
+
tickers = this.safeList(data, 'symbols', []);
|
|
1440
1483
|
}
|
|
1441
1484
|
const result = {};
|
|
1442
1485
|
for (let i = 0; i < tickers.length; i++) {
|
|
@@ -1459,6 +1502,7 @@ class bitmart extends bitmart$1 {
|
|
|
1459
1502
|
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
1460
1503
|
* @see https://developer-pro.bitmart.com/en/spot/#get-depth-v3
|
|
1461
1504
|
* @see https://developer-pro.bitmart.com/en/futures/#get-market-depth
|
|
1505
|
+
* @see https://developer-pro.bitmart.com/en/futuresv2/#get-market-depth
|
|
1462
1506
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
1463
1507
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
1464
1508
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -1750,7 +1794,7 @@ class bitmart extends bitmart$1 {
|
|
|
1750
1794
|
* @name bitmart#fetchOHLCV
|
|
1751
1795
|
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
1752
1796
|
* @see https://developer-pro.bitmart.com/en/spot/#get-history-k-line-v3
|
|
1753
|
-
* @see https://developer-pro.bitmart.com/en/
|
|
1797
|
+
* @see https://developer-pro.bitmart.com/en/futuresv2/#get-k-line
|
|
1754
1798
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
1755
1799
|
* @param {string} timeframe the length of time each candle represents
|
|
1756
1800
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
@@ -2047,6 +2091,7 @@ class bitmart extends bitmart$1 {
|
|
|
2047
2091
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
2048
2092
|
* @see https://developer-pro.bitmart.com/en/spot/#get-spot-wallet-balance
|
|
2049
2093
|
* @see https://developer-pro.bitmart.com/en/futures/#get-contract-assets-detail
|
|
2094
|
+
* @see https://developer-pro.bitmart.com/en/futuresv2/#get-contract-assets-keyed
|
|
2050
2095
|
* @see https://developer-pro.bitmart.com/en/spot/#get-account-balance
|
|
2051
2096
|
* @see https://developer-pro.bitmart.com/en/spot/#get-margin-account-details-isolated
|
|
2052
2097
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -2416,6 +2461,9 @@ class bitmart extends bitmart$1 {
|
|
|
2416
2461
|
* @see https://developer-pro.bitmart.com/en/spot/#place-margin-order
|
|
2417
2462
|
* @see https://developer-pro.bitmart.com/en/futures/#submit-order-signed
|
|
2418
2463
|
* @see https://developer-pro.bitmart.com/en/futures/#submit-plan-order-signed
|
|
2464
|
+
* @see https://developer-pro.bitmart.com/en/futures/#submit-order-signed
|
|
2465
|
+
* @see https://developer-pro.bitmart.com/en/futures/#submit-plan-order-signed
|
|
2466
|
+
* @see https://developer-pro.bitmart.com/en/futuresv2/#submit-plan-order-signed
|
|
2419
2467
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
2420
2468
|
* @param {string} type 'market', 'limit' or 'trailing' for swap markets only
|
|
2421
2469
|
* @param {string} side 'buy' or 'sell'
|
|
@@ -2664,9 +2712,14 @@ class bitmart extends bitmart$1 {
|
|
|
2664
2712
|
params = this.omit(params, 'clientOrderId');
|
|
2665
2713
|
request['client_order_id'] = clientOrderId;
|
|
2666
2714
|
}
|
|
2667
|
-
const leverage = this.safeInteger(params, 'leverage'
|
|
2715
|
+
const leverage = this.safeInteger(params, 'leverage');
|
|
2668
2716
|
params = this.omit(params, ['timeInForce', 'postOnly', 'reduceOnly', 'leverage', 'trailingTriggerPrice', 'trailingPercent', 'triggerPrice', 'stopPrice']);
|
|
2669
|
-
|
|
2717
|
+
if (leverage !== undefined) {
|
|
2718
|
+
request['leverage'] = this.numberToString(leverage);
|
|
2719
|
+
}
|
|
2720
|
+
else if (isTriggerOrder) {
|
|
2721
|
+
request['leverage'] = '1'; // for plan orders leverage is required, if not available default to 1
|
|
2722
|
+
}
|
|
2670
2723
|
return this.extend(request, params);
|
|
2671
2724
|
}
|
|
2672
2725
|
createSpotOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
|
|
@@ -2757,6 +2810,8 @@ class bitmart extends bitmart$1 {
|
|
|
2757
2810
|
* @see https://developer-pro.bitmart.com/en/spot/#cancel-order-v3-signed
|
|
2758
2811
|
* @see https://developer-pro.bitmart.com/en/futures/#cancel-plan-order-signed
|
|
2759
2812
|
* @see https://developer-pro.bitmart.com/en/futures/#cancel-plan-order-signed
|
|
2813
|
+
* @see https://developer-pro.bitmart.com/en/futures/#cancel-order-signed
|
|
2814
|
+
* @see https://developer-pro.bitmart.com/en/futures/#cancel-plan-order-signed
|
|
2760
2815
|
* @param {string} id order id
|
|
2761
2816
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
2762
2817
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -2909,6 +2964,7 @@ class bitmart extends bitmart$1 {
|
|
|
2909
2964
|
* @description cancel all open orders in a market
|
|
2910
2965
|
* @see https://developer-pro.bitmart.com/en/spot/#cancel-all-orders
|
|
2911
2966
|
* @see https://developer-pro.bitmart.com/en/futures/#cancel-all-orders-signed
|
|
2967
|
+
* @see https://developer-pro.bitmart.com/en/futuresv2/#cancel-all-orders-signed
|
|
2912
2968
|
* @param {string} symbol unified market symbol of the market to cancel orders in
|
|
2913
2969
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2914
2970
|
* @param {string} [params.side] *spot only* 'buy' or 'sell'
|
|
@@ -3147,6 +3203,7 @@ class bitmart extends bitmart$1 {
|
|
|
3147
3203
|
* @name bitmart#fetchClosedOrders
|
|
3148
3204
|
* @see https://developer-pro.bitmart.com/en/spot/#account-orders-v4-signed
|
|
3149
3205
|
* @see https://developer-pro.bitmart.com/en/futures/#get-order-history-keyed
|
|
3206
|
+
* @see https://developer-pro.bitmart.com/en/futuresv2/#get-order-history-keyed
|
|
3150
3207
|
* @description fetches information on multiple closed orders made by the user
|
|
3151
3208
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
3152
3209
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
@@ -3216,6 +3273,7 @@ class bitmart extends bitmart$1 {
|
|
|
3216
3273
|
* @see https://developer-pro.bitmart.com/en/spot/#query-order-by-id-v4-signed
|
|
3217
3274
|
* @see https://developer-pro.bitmart.com/en/spot/#query-order-by-clientorderid-v4-signed
|
|
3218
3275
|
* @see https://developer-pro.bitmart.com/en/futures/#get-order-detail-keyed
|
|
3276
|
+
* @see https://developer-pro.bitmart.com/en/futuresv2/#get-order-detail-keyed
|
|
3219
3277
|
* @param {string} id the id of the order
|
|
3220
3278
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
3221
3279
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -3949,6 +4007,7 @@ class bitmart extends bitmart$1 {
|
|
|
3949
4007
|
* @description transfer currency internally between wallets on the same account, currently only supports transfer between spot and margin
|
|
3950
4008
|
* @see https://developer-pro.bitmart.com/en/spot/#margin-asset-transfer-signed
|
|
3951
4009
|
* @see https://developer-pro.bitmart.com/en/futures/#transfer-signed
|
|
4010
|
+
* @see https://developer-pro.bitmart.com/en/futuresv2/#transfer-signed
|
|
3952
4011
|
* @param {string} code unified currency code
|
|
3953
4012
|
* @param {float} amount amount to transfer
|
|
3954
4013
|
* @param {string} fromAccount account to transfer from
|
|
@@ -4233,7 +4292,7 @@ class bitmart extends bitmart$1 {
|
|
|
4233
4292
|
* @method
|
|
4234
4293
|
* @name bitmart#fetchOpenInterest
|
|
4235
4294
|
* @description Retrieves the open interest of a currency
|
|
4236
|
-
* @see https://developer-pro.bitmart.com/en/
|
|
4295
|
+
* @see https://developer-pro.bitmart.com/en/futuresv2/#get-futures-openinterest
|
|
4237
4296
|
* @param {string} symbol Unified CCXT market symbol
|
|
4238
4297
|
* @param {object} [params] exchange specific parameters
|
|
4239
4298
|
* @returns {object} an open interest structure{@link https://docs.ccxt.com/#/?id=open-interest-structure}
|
|
@@ -4289,6 +4348,7 @@ class bitmart extends bitmart$1 {
|
|
|
4289
4348
|
* @name bitmart#setLeverage
|
|
4290
4349
|
* @description set the level of leverage for a market
|
|
4291
4350
|
* @see https://developer-pro.bitmart.com/en/futures/#submit-leverage-signed
|
|
4351
|
+
* @see https://developer-pro.bitmart.com/en/futuresv2/#submit-leverage-signed
|
|
4292
4352
|
* @param {float} leverage the rate of leverage
|
|
4293
4353
|
* @param {string} symbol unified market symbol
|
|
4294
4354
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -4318,7 +4378,7 @@ class bitmart extends bitmart$1 {
|
|
|
4318
4378
|
* @method
|
|
4319
4379
|
* @name bitmart#fetchFundingRate
|
|
4320
4380
|
* @description fetch the current funding rate
|
|
4321
|
-
* @see https://developer-pro.bitmart.com/en/
|
|
4381
|
+
* @see https://developer-pro.bitmart.com/en/futuresv2/#get-current-funding-rate
|
|
4322
4382
|
* @param {string} symbol unified market symbol
|
|
4323
4383
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4324
4384
|
* @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
@@ -4385,6 +4445,7 @@ class bitmart extends bitmart$1 {
|
|
|
4385
4445
|
* @name bitmart#fetchPosition
|
|
4386
4446
|
* @description fetch data on a single open contract trade position
|
|
4387
4447
|
* @see https://developer-pro.bitmart.com/en/futures/#get-current-position-keyed
|
|
4448
|
+
* @see https://developer-pro.bitmart.com/en/futuresv2/#get-current-position-risk-details-keyed
|
|
4388
4449
|
* @param {string} symbol unified market symbol of the market the position is held in
|
|
4389
4450
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4390
4451
|
* @returns {object} a [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
@@ -4434,6 +4495,7 @@ class bitmart extends bitmart$1 {
|
|
|
4434
4495
|
* @name bitmart#fetchPositions
|
|
4435
4496
|
* @description fetch all open contract positions
|
|
4436
4497
|
* @see https://developer-pro.bitmart.com/en/futures/#get-current-position-keyed
|
|
4498
|
+
* @see https://developer-pro.bitmart.com/en/futuresv2/#get-current-position-risk-details-keyed
|
|
4437
4499
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
4438
4500
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4439
4501
|
* @returns {object[]} a list of [position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
@@ -4660,7 +4722,11 @@ class bitmart extends bitmart$1 {
|
|
|
4660
4722
|
return this.milliseconds();
|
|
4661
4723
|
}
|
|
4662
4724
|
sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
4663
|
-
const
|
|
4725
|
+
const parts = path.split('/');
|
|
4726
|
+
// to do: refactor api endpoints with spot/swap sections
|
|
4727
|
+
const category = this.safeString(parts, 0, 'spot');
|
|
4728
|
+
const market = (category === 'spot' || category === 'account') ? 'spot' : 'swap';
|
|
4729
|
+
const baseUrl = this.implodeHostname(this.urls['api'][market]);
|
|
4664
4730
|
let url = baseUrl + '/' + this.implodeParams(path, params);
|
|
4665
4731
|
const query = this.omit(params, this.extractParams(path));
|
|
4666
4732
|
let queryString = '';
|
package/dist/cjs/src/bybit.js
CHANGED
|
@@ -3786,7 +3786,12 @@ class bybit extends bybit$1 {
|
|
|
3786
3786
|
}
|
|
3787
3787
|
else {
|
|
3788
3788
|
if (!isTrailingAmountOrder && !isAlternativeEndpoint) {
|
|
3789
|
-
|
|
3789
|
+
if (market['option']) {
|
|
3790
|
+
request['qty'] = this.numberToString(amount);
|
|
3791
|
+
}
|
|
3792
|
+
else {
|
|
3793
|
+
request['qty'] = this.amountToPrecision(symbol, amount);
|
|
3794
|
+
}
|
|
3790
3795
|
}
|
|
3791
3796
|
}
|
|
3792
3797
|
if (isTrailingAmountOrder) {
|