ccxt 4.1.55 → 4.1.57
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/.git-templates/hooks/pre-push +2 -2
- package/CONTRIBUTING.md +1 -1
- package/README.md +6 -6
- package/build.sh +30 -8
- package/dist/ccxt.browser.js +5592 -4907
- package/dist/ccxt.browser.min.js +13 -13
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/ace.js +17 -13
- package/dist/cjs/src/alpaca.js +6 -6
- package/dist/cjs/src/ascendex.js +35 -29
- package/dist/cjs/src/base/Exchange.js +39 -26
- package/dist/cjs/src/base/Precise.js +1 -3
- package/dist/cjs/src/bigone.js +24 -20
- package/dist/cjs/src/binance.js +97 -76
- package/dist/cjs/src/bingx.js +63 -44
- package/dist/cjs/src/bit2c.js +18 -15
- package/dist/cjs/src/bitbank.js +17 -15
- package/dist/cjs/src/bitbns.js +28 -18
- package/dist/cjs/src/bitfinex.js +23 -21
- package/dist/cjs/src/bitfinex2.js +32 -28
- package/dist/cjs/src/bitflyer.js +28 -20
- package/dist/cjs/src/bitforex.js +25 -18
- package/dist/cjs/src/bitget.js +184 -147
- package/dist/cjs/src/bithumb.js +23 -16
- package/dist/cjs/src/bitmart.js +129 -94
- package/dist/cjs/src/bitmex.js +104 -64
- package/dist/cjs/src/bitopro.js +38 -26
- package/dist/cjs/src/bitpanda.js +24 -23
- package/dist/cjs/src/bitrue.js +33 -24
- package/dist/cjs/src/bitso.js +24 -23
- package/dist/cjs/src/bitstamp.js +24 -23
- package/dist/cjs/src/bittrex.js +30 -29
- package/dist/cjs/src/bitvavo.js +38 -30
- package/dist/cjs/src/bl3p.js +11 -10
- package/dist/cjs/src/blockchaincom.js +20 -20
- package/dist/cjs/src/btcalpha.js +18 -17
- package/dist/cjs/src/btcbox.js +13 -12
- package/dist/cjs/src/btcmarkets.js +20 -19
- package/dist/cjs/src/btcturk.js +14 -13
- package/dist/cjs/src/bybit.js +84 -54
- package/dist/cjs/src/cex.js +16 -14
- package/dist/cjs/src/coinbase.js +29 -27
- package/dist/cjs/src/coinbasepro.js +27 -25
- package/dist/cjs/src/coincheck.js +15 -14
- package/dist/cjs/src/coinex.js +101 -78
- package/dist/cjs/src/coinlist.js +28 -27
- package/dist/cjs/src/coinmate.js +20 -17
- package/dist/cjs/src/coinone.js +21 -16
- package/dist/cjs/src/coinsph.js +37 -28
- package/dist/cjs/src/coinspot.js +12 -11
- package/dist/cjs/src/cryptocom.js +40 -202
- package/dist/cjs/src/currencycom.js +32 -25
- package/dist/cjs/src/delta.js +34 -28
- package/dist/cjs/src/deribit.js +39 -36
- package/dist/cjs/src/digifinex.js +64 -44
- package/dist/cjs/src/exmo.js +29 -27
- package/dist/cjs/src/gate.js +67 -53
- package/dist/cjs/src/gemini.js +23 -20
- package/dist/cjs/src/hitbtc.js +65 -56
- package/dist/cjs/src/hollaex.js +30 -27
- package/dist/cjs/src/htx.js +135 -143
- package/dist/cjs/src/huobijp.js +22 -20
- package/dist/cjs/src/idex.js +22 -21
- package/dist/cjs/src/independentreserve.js +15 -14
- package/dist/cjs/src/indodax.js +30 -26
- package/dist/cjs/src/kraken.js +29 -27
- package/dist/cjs/src/krakenfutures.js +29 -22
- package/dist/cjs/src/kucoin.js +48 -43
- package/dist/cjs/src/kucoinfutures.js +33 -28
- package/dist/cjs/src/kuna.js +25 -24
- package/dist/cjs/src/latoken.js +24 -22
- package/dist/cjs/src/lbank.js +45 -30
- package/dist/cjs/src/luno.js +22 -19
- package/dist/cjs/src/lykke.js +19 -17
- package/dist/cjs/src/mercado.js +30 -19
- package/dist/cjs/src/mexc.js +60 -49
- package/dist/cjs/src/ndax.js +23 -22
- package/dist/cjs/src/novadax.js +23 -22
- package/dist/cjs/src/oceanex.js +22 -19
- package/dist/cjs/src/okcoin.js +29 -23
- package/dist/cjs/src/okx.js +92 -84
- package/dist/cjs/src/p2b.js +80 -83
- package/dist/cjs/src/paymium.js +10 -10
- package/dist/cjs/src/phemex.js +63 -40
- package/dist/cjs/src/poloniex.js +22 -22
- package/dist/cjs/src/poloniexfutures.js +23 -19
- package/dist/cjs/src/pro/alpaca.js +5 -5
- package/dist/cjs/src/pro/ascendex.js +4 -4
- package/dist/cjs/src/pro/binance.js +16 -16
- package/dist/cjs/src/pro/bingx.js +1 -1
- package/dist/cjs/src/pro/bitfinex.js +4 -4
- package/dist/cjs/src/pro/bitfinex2.js +6 -6
- package/dist/cjs/src/pro/bitget.js +7 -7
- package/dist/cjs/src/pro/bitmart.js +7 -5
- package/dist/cjs/src/pro/bitmex.js +6 -6
- package/dist/cjs/src/pro/bitopro.js +4 -4
- package/dist/cjs/src/pro/bitpanda.js +6 -6
- package/dist/cjs/src/pro/bitrue.js +2 -2
- package/dist/cjs/src/pro/bitstamp.js +6 -4
- package/dist/cjs/src/pro/bittrex.js +6 -6
- package/dist/cjs/src/pro/bitvavo.js +11 -7
- package/dist/cjs/src/pro/blockchaincom.js +8 -8
- package/dist/cjs/src/pro/bybit.js +7 -7
- package/dist/cjs/src/pro/cex.js +13 -9
- package/dist/cjs/src/pro/coinbase.js +5 -5
- package/dist/cjs/src/pro/coinbasepro.js +11 -10
- package/dist/cjs/src/pro/coinex.js +7 -9
- package/dist/cjs/src/pro/cryptocom.js +9 -9
- package/dist/cjs/src/pro/currencycom.js +4 -4
- package/dist/cjs/src/pro/deribit.js +6 -6
- package/dist/cjs/src/pro/exmo.js +12 -14
- package/dist/cjs/src/pro/gate.js +7 -7
- package/dist/cjs/src/pro/gemini.js +3 -3
- package/dist/cjs/src/pro/hitbtc.js +263 -4
- package/dist/cjs/src/pro/hollaex.js +5 -5
- package/dist/cjs/src/pro/htx.js +6 -6
- package/dist/cjs/src/pro/huobijp.js +3 -3
- package/dist/cjs/src/pro/idex.js +4 -4
- package/dist/cjs/src/pro/independentreserve.js +2 -2
- package/dist/cjs/src/pro/kraken.js +10 -10
- package/dist/cjs/src/pro/krakenfutures.js +41 -17
- package/dist/cjs/src/pro/kucoin.js +7 -7
- package/dist/cjs/src/pro/kucoinfutures.js +8 -6
- package/dist/cjs/src/pro/luno.js +2 -2
- package/dist/cjs/src/pro/mexc.js +6 -6
- package/dist/cjs/src/pro/ndax.js +3 -3
- package/dist/cjs/src/pro/okcoin.js +5 -5
- package/dist/cjs/src/pro/okx.js +12 -12
- package/dist/cjs/src/pro/phemex.js +6 -6
- package/dist/cjs/src/pro/poloniex.js +7 -7
- package/dist/cjs/src/pro/poloniexfutures.js +5 -5
- package/dist/cjs/src/pro/probit.js +6 -6
- package/dist/cjs/src/pro/upbit.js +3 -3
- package/dist/cjs/src/pro/wazirx.js +8 -8
- package/dist/cjs/src/pro/whitebit.js +12 -8
- package/dist/cjs/src/pro/woo.js +1 -1
- package/dist/cjs/src/probit.js +28 -23
- package/dist/cjs/src/tidex.js +16 -15
- package/dist/cjs/src/timex.js +19 -18
- package/dist/cjs/src/tokocrypto.js +27 -22
- package/dist/cjs/src/upbit.js +19 -19
- package/dist/cjs/src/wavesexchange.js +22 -19
- package/dist/cjs/src/wazirx.js +24 -17
- package/dist/cjs/src/whitebit.js +33 -27
- package/dist/cjs/src/woo.js +44 -34
- package/dist/cjs/src/yobit.js +25 -20
- package/dist/cjs/src/zaif.js +9 -9
- package/dist/cjs/src/zonda.js +18 -17
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bitbank.d.ts +1 -0
- package/js/src/abstract/bybit.d.ts +1 -0
- package/js/src/abstract/cryptocom.d.ts +0 -20
- package/js/src/abstract/htx.d.ts +3 -0
- package/js/src/abstract/huobi.d.ts +3 -0
- package/js/src/abstract/huobipro.d.ts +3 -0
- package/js/src/abstract/okex.d.ts +3 -1
- package/js/src/abstract/okex5.d.ts +3 -1
- package/js/src/abstract/okx.d.ts +3 -1
- package/js/src/ace.js +18 -14
- package/js/src/alpaca.js +6 -6
- package/js/src/ascendex.js +35 -29
- package/js/src/base/Exchange.d.ts +37 -34
- package/js/src/base/Exchange.js +39 -26
- package/js/src/base/Precise.d.ts +4 -4
- package/js/src/base/Precise.js +1 -3
- package/js/src/base/functions/type.d.ts +25 -25
- package/js/src/base/types.d.ts +21 -14
- package/js/src/bigone.js +25 -21
- package/js/src/binance.d.ts +2 -2
- package/js/src/binance.js +97 -76
- package/js/src/bingx.js +63 -44
- package/js/src/bit2c.js +19 -16
- package/js/src/bitbank.js +17 -15
- package/js/src/bitbns.js +28 -18
- package/js/src/bitfinex.js +23 -21
- package/js/src/bitfinex2.js +32 -28
- package/js/src/bitflyer.js +28 -20
- package/js/src/bitforex.js +26 -19
- package/js/src/bitget.d.ts +25 -3
- package/js/src/bitget.js +184 -147
- package/js/src/bithumb.js +23 -16
- package/js/src/bitmart.d.ts +1 -1
- package/js/src/bitmart.js +129 -94
- package/js/src/bitmex.d.ts +2 -2
- package/js/src/bitmex.js +104 -64
- package/js/src/bitopro.js +38 -26
- package/js/src/bitpanda.js +24 -23
- package/js/src/bitrue.js +33 -24
- package/js/src/bitso.js +24 -23
- package/js/src/bitstamp.d.ts +2 -2
- package/js/src/bitstamp.js +24 -23
- package/js/src/bittrex.js +30 -29
- package/js/src/bitvavo.js +38 -30
- package/js/src/bl3p.js +11 -10
- package/js/src/blockchaincom.js +20 -20
- package/js/src/btcalpha.js +18 -17
- package/js/src/btcbox.js +13 -12
- package/js/src/btcmarkets.js +20 -19
- package/js/src/btcturk.js +14 -13
- package/js/src/bybit.d.ts +1 -1
- package/js/src/bybit.js +84 -54
- package/js/src/cex.js +16 -14
- package/js/src/coinbase.js +29 -27
- package/js/src/coinbasepro.js +27 -25
- package/js/src/coincheck.js +15 -14
- package/js/src/coinex.d.ts +1 -1
- package/js/src/coinex.js +101 -78
- package/js/src/coinlist.js +28 -27
- package/js/src/coinmate.js +21 -18
- package/js/src/coinone.js +21 -16
- package/js/src/coinsph.js +37 -28
- package/js/src/coinspot.js +12 -11
- package/js/src/cryptocom.d.ts +0 -23
- package/js/src/cryptocom.js +40 -202
- package/js/src/currencycom.js +32 -25
- package/js/src/delta.js +35 -29
- package/js/src/deribit.js +39 -36
- package/js/src/digifinex.d.ts +2 -2
- package/js/src/digifinex.js +65 -45
- package/js/src/exmo.js +29 -27
- package/js/src/gate.d.ts +1 -1
- package/js/src/gate.js +67 -53
- package/js/src/gemini.js +23 -20
- package/js/src/hitbtc.d.ts +1 -0
- package/js/src/hitbtc.js +65 -56
- package/js/src/hollaex.js +30 -27
- package/js/src/htx.d.ts +11 -3
- package/js/src/htx.js +135 -143
- package/js/src/huobijp.js +23 -21
- package/js/src/idex.js +22 -21
- package/js/src/independentreserve.js +15 -14
- package/js/src/indodax.js +30 -26
- package/js/src/kraken.js +29 -27
- package/js/src/krakenfutures.js +29 -22
- package/js/src/kucoin.d.ts +1 -1
- package/js/src/kucoin.js +48 -43
- package/js/src/kucoinfutures.js +33 -28
- package/js/src/kuna.js +25 -24
- package/js/src/latoken.js +25 -23
- package/js/src/lbank.js +46 -31
- package/js/src/luno.js +22 -19
- package/js/src/lykke.js +19 -17
- package/js/src/mercado.js +30 -19
- package/js/src/mexc.d.ts +1 -1
- package/js/src/mexc.js +60 -49
- package/js/src/ndax.js +23 -22
- package/js/src/novadax.js +23 -22
- package/js/src/oceanex.js +22 -19
- package/js/src/okcoin.js +29 -23
- package/js/src/okx.d.ts +2 -2
- package/js/src/okx.js +92 -84
- package/js/src/p2b.d.ts +8 -7
- package/js/src/p2b.js +80 -82
- package/js/src/paymium.js +10 -10
- package/js/src/phemex.js +63 -40
- package/js/src/poloniex.js +22 -22
- package/js/src/poloniexfutures.js +23 -19
- package/js/src/pro/alpaca.js +5 -5
- package/js/src/pro/ascendex.js +4 -4
- package/js/src/pro/binance.js +16 -16
- package/js/src/pro/bingx.js +1 -1
- package/js/src/pro/bitfinex.js +4 -4
- package/js/src/pro/bitfinex2.d.ts +1 -1
- package/js/src/pro/bitfinex2.js +6 -6
- package/js/src/pro/bitget.js +7 -7
- package/js/src/pro/bitmart.js +7 -5
- package/js/src/pro/bitmex.js +6 -6
- package/js/src/pro/bitopro.js +4 -4
- package/js/src/pro/bitpanda.js +6 -6
- package/js/src/pro/bitrue.js +2 -2
- package/js/src/pro/bitstamp.js +7 -5
- package/js/src/pro/bittrex.js +6 -6
- package/js/src/pro/bitvavo.js +12 -8
- package/js/src/pro/blockchaincom.js +8 -8
- package/js/src/pro/bybit.js +7 -7
- package/js/src/pro/cex.js +14 -10
- package/js/src/pro/coinbase.js +5 -5
- package/js/src/pro/coinbasepro.js +12 -11
- package/js/src/pro/coinex.js +7 -9
- package/js/src/pro/cryptocom.js +9 -9
- package/js/src/pro/currencycom.js +4 -4
- package/js/src/pro/deribit.js +6 -6
- package/js/src/pro/exmo.js +12 -14
- package/js/src/pro/gate.js +7 -7
- package/js/src/pro/gemini.js +3 -3
- package/js/src/pro/hitbtc.d.ts +8 -1
- package/js/src/pro/hitbtc.js +264 -5
- package/js/src/pro/hollaex.js +5 -5
- package/js/src/pro/htx.js +6 -6
- package/js/src/pro/huobijp.js +3 -3
- package/js/src/pro/idex.js +4 -4
- package/js/src/pro/independentreserve.js +2 -2
- package/js/src/pro/kraken.js +10 -10
- package/js/src/pro/krakenfutures.d.ts +1 -0
- package/js/src/pro/krakenfutures.js +42 -18
- package/js/src/pro/kucoin.js +7 -7
- package/js/src/pro/kucoinfutures.js +8 -6
- package/js/src/pro/luno.js +2 -2
- package/js/src/pro/mexc.js +6 -6
- package/js/src/pro/ndax.js +3 -3
- package/js/src/pro/okcoin.js +5 -5
- package/js/src/pro/okx.js +12 -12
- package/js/src/pro/phemex.js +6 -6
- package/js/src/pro/poloniex.js +7 -7
- package/js/src/pro/poloniexfutures.js +5 -5
- package/js/src/pro/probit.js +6 -6
- package/js/src/pro/upbit.js +3 -3
- package/js/src/pro/wazirx.js +8 -8
- package/js/src/pro/whitebit.js +13 -9
- package/js/src/pro/woo.js +1 -1
- package/js/src/probit.js +29 -24
- package/js/src/tidex.js +16 -15
- package/js/src/timex.js +19 -18
- package/js/src/tokocrypto.js +28 -23
- package/js/src/upbit.js +19 -19
- package/js/src/wavesexchange.js +23 -20
- package/js/src/wazirx.js +25 -18
- package/js/src/whitebit.js +33 -27
- package/js/src/woo.js +45 -35
- package/js/src/yobit.js +25 -20
- package/js/src/zaif.js +9 -9
- package/js/src/zonda.js +18 -17
- package/package.json +2 -2
- package/js/src/bitstamp1.d.ts +0 -28
- package/js/src/bitstamp1.js +0 -430
- package/js/src/lbank2.d.ts +0 -90
- package/js/src/lbank2.js +0 -2779
package/js/src/binance.js
CHANGED
|
@@ -53,14 +53,13 @@ export default class binance extends Exchange {
|
|
|
53
53
|
'fetchBalance': true,
|
|
54
54
|
'fetchBidsAsks': true,
|
|
55
55
|
'fetchBorrowInterest': true,
|
|
56
|
-
'fetchBorrowRate': true,
|
|
57
56
|
'fetchBorrowRateHistories': false,
|
|
58
57
|
'fetchBorrowRateHistory': true,
|
|
59
|
-
'fetchBorrowRates': false,
|
|
60
|
-
'fetchBorrowRatesPerSymbol': false,
|
|
61
58
|
'fetchCanceledOrders': 'emulated',
|
|
62
59
|
'fetchClosedOrder': false,
|
|
63
60
|
'fetchClosedOrders': 'emulated',
|
|
61
|
+
'fetchCrossBorrowRate': true,
|
|
62
|
+
'fetchCrossBorrowRates': false,
|
|
64
63
|
'fetchCurrencies': true,
|
|
65
64
|
'fetchDeposit': false,
|
|
66
65
|
'fetchDepositAddress': true,
|
|
@@ -76,6 +75,8 @@ export default class binance extends Exchange {
|
|
|
76
75
|
'fetchFundingRates': true,
|
|
77
76
|
'fetchGreeks': true,
|
|
78
77
|
'fetchIndexOHLCV': true,
|
|
78
|
+
'fetchIsolatedBorrowRate': false,
|
|
79
|
+
'fetchIsolatedBorrowRates': false,
|
|
79
80
|
'fetchL3OrderBook': false,
|
|
80
81
|
'fetchLastPrices': true,
|
|
81
82
|
'fetchLedger': true,
|
|
@@ -2549,7 +2550,7 @@ export default class binance extends Exchange {
|
|
|
2549
2550
|
* @param {string} [params.type] 'future', 'delivery', 'savings', 'funding', or 'spot'
|
|
2550
2551
|
* @param {string} [params.marginMode] 'cross' or 'isolated', for margin trading, uses this.options.defaultMarginMode if not passed, defaults to undefined/None/null
|
|
2551
2552
|
* @param {string[]|undefined} [params.symbols] unified market symbols, only used in isolated margin mode
|
|
2552
|
-
* @returns {object} a [balance structure]{@link https://
|
|
2553
|
+
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
2553
2554
|
*/
|
|
2554
2555
|
await this.loadMarkets();
|
|
2555
2556
|
const defaultType = this.safeString2(this.options, 'fetchBalance', 'defaultType', 'spot');
|
|
@@ -2800,7 +2801,7 @@ export default class binance extends Exchange {
|
|
|
2800
2801
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
2801
2802
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
2802
2803
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
2803
|
-
* @returns {object} A dictionary of [order book structures]{@link https://
|
|
2804
|
+
* @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
|
|
2804
2805
|
*/
|
|
2805
2806
|
await this.loadMarkets();
|
|
2806
2807
|
const market = this.market(symbol);
|
|
@@ -3020,7 +3021,7 @@ export default class binance extends Exchange {
|
|
|
3020
3021
|
* @description the latest known information on the availability of the exchange API
|
|
3021
3022
|
* @see https://binance-docs.github.io/apidocs/spot/en/#system-status-system
|
|
3022
3023
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
3023
|
-
* @returns {object} a [status structure]{@link https://
|
|
3024
|
+
* @returns {object} a [status structure]{@link https://docs.ccxt.com/#/?id=exchange-status-structure}
|
|
3024
3025
|
*/
|
|
3025
3026
|
const response = await this.sapiGetSystemStatus(params);
|
|
3026
3027
|
//
|
|
@@ -3051,7 +3052,7 @@ export default class binance extends Exchange {
|
|
|
3051
3052
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
3052
3053
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
3053
3054
|
* @param {boolean} [params.rolling] (spot only) default false, if true, uses the rolling 24 hour ticker endpoint /api/v3/ticker
|
|
3054
|
-
* @returns {object} a [ticker structure]{@link https://
|
|
3055
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
3055
3056
|
*/
|
|
3056
3057
|
await this.loadMarkets();
|
|
3057
3058
|
const market = this.market(symbol);
|
|
@@ -3094,7 +3095,7 @@ export default class binance extends Exchange {
|
|
|
3094
3095
|
* @see https://binance-docs.github.io/apidocs/delivery/en/#symbol-order-book-ticker // future
|
|
3095
3096
|
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the bids and asks for, all markets are returned if not assigned
|
|
3096
3097
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
3097
|
-
* @returns {object} a dictionary of [ticker structures]{@link https://
|
|
3098
|
+
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
3098
3099
|
*/
|
|
3099
3100
|
await this.loadMarkets();
|
|
3100
3101
|
symbols = this.marketSymbols(symbols);
|
|
@@ -3129,7 +3130,7 @@ export default class binance extends Exchange {
|
|
|
3129
3130
|
* @see https://binance-docs.github.io/apidocs/delivery/en/#symbol-price-ticker // future
|
|
3130
3131
|
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the last prices
|
|
3131
3132
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
3132
|
-
* @returns {object} a dictionary of [ticker structures]{@link https://
|
|
3133
|
+
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
3133
3134
|
*/
|
|
3134
3135
|
await this.loadMarkets();
|
|
3135
3136
|
symbols = this.marketSymbols(symbols);
|
|
@@ -3234,7 +3235,7 @@ export default class binance extends Exchange {
|
|
|
3234
3235
|
* @see https://binance-docs.github.io/apidocs/voptions/en/#24hr-ticker-price-change-statistics // option
|
|
3235
3236
|
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
3236
3237
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
3237
|
-
* @returns {object} a dictionary of [ticker structures]{@link https://
|
|
3238
|
+
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
3238
3239
|
*/
|
|
3239
3240
|
await this.loadMarkets();
|
|
3240
3241
|
let type = undefined;
|
|
@@ -3694,7 +3695,7 @@ export default class binance extends Exchange {
|
|
|
3694
3695
|
*
|
|
3695
3696
|
* EXCHANGE SPECIFIC PARAMETERS
|
|
3696
3697
|
* @param {int} [params.fromId] trade id to fetch from, default gets most recent trades, not used when fetchTradesMethod is 'publicGetTrades', 'fapiPublicGetTrades', 'dapiPublicGetTrades', or 'eapiPublicGetTrades'
|
|
3697
|
-
* @returns {Trade[]} a list of [trade structures]{@link https://
|
|
3698
|
+
* @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
3698
3699
|
*/
|
|
3699
3700
|
await this.loadMarkets();
|
|
3700
3701
|
let paginate = false;
|
|
@@ -3826,7 +3827,7 @@ export default class binance extends Exchange {
|
|
|
3826
3827
|
* @param {float} [price] the price at which the order is to be fullfilled, in units of the base currency, ignored in market orders
|
|
3827
3828
|
* @param {string} [params.marginMode] 'cross' or 'isolated', for spot margin trading
|
|
3828
3829
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
3829
|
-
* @returns {object} an [order structure]{@link https://
|
|
3830
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3830
3831
|
*/
|
|
3831
3832
|
await this.loadMarkets();
|
|
3832
3833
|
const market = this.market(symbol);
|
|
@@ -4028,7 +4029,7 @@ export default class binance extends Exchange {
|
|
|
4028
4029
|
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
4029
4030
|
* @param {float} [price] the price at which the order is to be fullfilled, in units of the base currency, ignored in market orders
|
|
4030
4031
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
4031
|
-
* @returns {object} an [order structure]{@link https://
|
|
4032
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4032
4033
|
*/
|
|
4033
4034
|
await this.loadMarkets();
|
|
4034
4035
|
const market = this.market(symbol);
|
|
@@ -4100,7 +4101,7 @@ export default class binance extends Exchange {
|
|
|
4100
4101
|
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
4101
4102
|
* @param {float} [price] the price at which the order is to be fullfilled, in units of the base currency, ignored in market orders
|
|
4102
4103
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
4103
|
-
* @returns {object} an [order structure]{@link https://
|
|
4104
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4104
4105
|
*/
|
|
4105
4106
|
await this.loadMarkets();
|
|
4106
4107
|
const market = this.market(symbol);
|
|
@@ -4387,7 +4388,7 @@ export default class binance extends Exchange {
|
|
|
4387
4388
|
* @description *contract only* create a list of trade orders
|
|
4388
4389
|
* @see https://binance-docs.github.io/apidocs/futures/en/#place-multiple-orders-trade
|
|
4389
4390
|
* @param {array} orders list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
|
|
4390
|
-
* @returns {object} an [order structure]{@link https://
|
|
4391
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4391
4392
|
*/
|
|
4392
4393
|
await this.loadMarkets();
|
|
4393
4394
|
const ordersRequests = [];
|
|
@@ -4480,7 +4481,7 @@ export default class binance extends Exchange {
|
|
|
4480
4481
|
* @param {string} [params.marginMode] 'cross' or 'isolated', for spot margin trading
|
|
4481
4482
|
* @param {boolean} [params.sor] *spot only* whether to use SOR (Smart Order Routing) or not, default is false
|
|
4482
4483
|
* @param {boolean} [params.test] *spot only* whether to use the test endpoint or not, default is false
|
|
4483
|
-
* @returns {object} an [order structure]{@link https://
|
|
4484
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4484
4485
|
*/
|
|
4485
4486
|
await this.loadMarkets();
|
|
4486
4487
|
const market = this.market(symbol);
|
|
@@ -4764,9 +4765,11 @@ export default class binance extends Exchange {
|
|
|
4764
4765
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
4765
4766
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
4766
4767
|
* @param {string} [params.marginMode] 'cross' or 'isolated', for spot margin trading
|
|
4767
|
-
* @returns {object} An [order structure]{@link https://
|
|
4768
|
+
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4768
4769
|
*/
|
|
4769
|
-
|
|
4770
|
+
if (symbol === undefined) {
|
|
4771
|
+
throw new ArgumentsRequired(this.id + ' fetchOrder() requires a symbol argument');
|
|
4772
|
+
}
|
|
4770
4773
|
await this.loadMarkets();
|
|
4771
4774
|
const market = this.market(symbol);
|
|
4772
4775
|
const defaultType = this.safeString2(this.options, 'fetchOrder', 'defaultType', 'spot');
|
|
@@ -4824,9 +4827,11 @@ export default class binance extends Exchange {
|
|
|
4824
4827
|
* @param {string} [params.marginMode] 'cross' or 'isolated', for spot margin trading
|
|
4825
4828
|
* @param {int} [params.until] the latest time in ms to fetch orders for
|
|
4826
4829
|
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
4827
|
-
* @returns {Order[]} a list of [order structures]{@link https://
|
|
4830
|
+
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4828
4831
|
*/
|
|
4829
|
-
|
|
4832
|
+
if (symbol === undefined) {
|
|
4833
|
+
throw new ArgumentsRequired(this.id + ' fetchOrders() requires a symbol argument');
|
|
4834
|
+
}
|
|
4830
4835
|
await this.loadMarkets();
|
|
4831
4836
|
let paginate = false;
|
|
4832
4837
|
[paginate, params] = this.handleOptionAndParams(params, 'fetchOrders', 'paginate');
|
|
@@ -4963,7 +4968,7 @@ export default class binance extends Exchange {
|
|
|
4963
4968
|
* @param {int} [limit] the maximum number of open orders structures to retrieve
|
|
4964
4969
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
4965
4970
|
* @param {string} [params.marginMode] 'cross' or 'isolated', for spot margin trading
|
|
4966
|
-
* @returns {Order[]} a list of [order structures]{@link https://
|
|
4971
|
+
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4967
4972
|
*/
|
|
4968
4973
|
await this.loadMarkets();
|
|
4969
4974
|
let market = undefined;
|
|
@@ -5035,7 +5040,7 @@ export default class binance extends Exchange {
|
|
|
5035
5040
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
5036
5041
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
5037
5042
|
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
5038
|
-
* @returns {Order[]} a list of [order structures]{@link https://
|
|
5043
|
+
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
5039
5044
|
*/
|
|
5040
5045
|
const orders = await this.fetchOrders(symbol, since, limit, params);
|
|
5041
5046
|
return this.filterBy(orders, 'status', 'closed');
|
|
@@ -5053,9 +5058,11 @@ export default class binance extends Exchange {
|
|
|
5053
5058
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
5054
5059
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
5055
5060
|
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
5056
|
-
* @returns {object[]} a list of [order structures]{@link https://
|
|
5061
|
+
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
5057
5062
|
*/
|
|
5058
|
-
|
|
5063
|
+
if (symbol === undefined) {
|
|
5064
|
+
throw new ArgumentsRequired(this.id + ' fetchCanceledOrders() requires a symbol argument');
|
|
5065
|
+
}
|
|
5059
5066
|
await this.loadMarkets();
|
|
5060
5067
|
const market = this.market(symbol);
|
|
5061
5068
|
if (market['swap'] || market['future']) {
|
|
@@ -5079,9 +5086,11 @@ export default class binance extends Exchange {
|
|
|
5079
5086
|
* @param {string} id order id
|
|
5080
5087
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
5081
5088
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
5082
|
-
* @returns {object} An [order structure]{@link https://
|
|
5089
|
+
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
5083
5090
|
*/
|
|
5084
|
-
|
|
5091
|
+
if (symbol === undefined) {
|
|
5092
|
+
throw new ArgumentsRequired(this.id + ' cancelOrder() requires a symbol argument');
|
|
5093
|
+
}
|
|
5085
5094
|
await this.loadMarkets();
|
|
5086
5095
|
const market = this.market(symbol);
|
|
5087
5096
|
const defaultType = this.safeString2(this.options, 'cancelOrder', 'defaultType', 'spot');
|
|
@@ -5137,9 +5146,11 @@ export default class binance extends Exchange {
|
|
|
5137
5146
|
* @param {string} symbol unified market symbol of the market to cancel orders in
|
|
5138
5147
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
5139
5148
|
* @param {string} [params.marginMode] 'cross' or 'isolated', for spot margin trading
|
|
5140
|
-
* @returns {object[]} a list of [order structures]{@link https://
|
|
5149
|
+
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
5141
5150
|
*/
|
|
5142
|
-
|
|
5151
|
+
if (symbol === undefined) {
|
|
5152
|
+
throw new ArgumentsRequired(this.id + ' cancelOrder() requires a symbol argument');
|
|
5153
|
+
}
|
|
5143
5154
|
await this.loadMarkets();
|
|
5144
5155
|
const market = this.market(symbol);
|
|
5145
5156
|
const request = {
|
|
@@ -5188,7 +5199,9 @@ export default class binance extends Exchange {
|
|
|
5188
5199
|
* @param {int[]} [params.recvWindow]
|
|
5189
5200
|
* @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
5190
5201
|
*/
|
|
5191
|
-
|
|
5202
|
+
if (symbol === undefined) {
|
|
5203
|
+
throw new ArgumentsRequired(this.id + ' cancelOrders() requires a symbol argument');
|
|
5204
|
+
}
|
|
5192
5205
|
await this.loadMarkets();
|
|
5193
5206
|
const market = this.market(symbol);
|
|
5194
5207
|
if (!market['contract']) {
|
|
@@ -5256,9 +5269,11 @@ export default class binance extends Exchange {
|
|
|
5256
5269
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
5257
5270
|
* @param {int} [limit] the maximum number of trades to retrieve
|
|
5258
5271
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
5259
|
-
* @returns {object[]} a list of [trade structures]{@link https://
|
|
5272
|
+
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
|
|
5260
5273
|
*/
|
|
5261
|
-
|
|
5274
|
+
if (symbol === undefined) {
|
|
5275
|
+
throw new ArgumentsRequired(this.id + ' fetchOrderTrades() requires a symbol argument');
|
|
5276
|
+
}
|
|
5262
5277
|
await this.loadMarkets();
|
|
5263
5278
|
const market = this.market(symbol);
|
|
5264
5279
|
const type = this.safeString(params, 'type', market['type']);
|
|
@@ -5286,7 +5301,7 @@ export default class binance extends Exchange {
|
|
|
5286
5301
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
5287
5302
|
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
5288
5303
|
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
5289
|
-
* @returns {Trade[]} a list of [trade structures]{@link https://
|
|
5304
|
+
* @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
|
|
5290
5305
|
*/
|
|
5291
5306
|
await this.loadMarkets();
|
|
5292
5307
|
let paginate = false;
|
|
@@ -5308,7 +5323,9 @@ export default class binance extends Exchange {
|
|
|
5308
5323
|
method = 'eapiPrivateGetUserTrades';
|
|
5309
5324
|
}
|
|
5310
5325
|
else {
|
|
5311
|
-
|
|
5326
|
+
if (symbol === undefined) {
|
|
5327
|
+
throw new ArgumentsRequired(this.id + ' fetchMyTrades() requires a symbol argument');
|
|
5328
|
+
}
|
|
5312
5329
|
[marginMode, params] = this.handleMarginModeAndParams('fetchMyTrades', params);
|
|
5313
5330
|
if (type === 'spot' || type === 'margin') {
|
|
5314
5331
|
method = 'privateGetMyTrades';
|
|
@@ -5431,7 +5448,7 @@ export default class binance extends Exchange {
|
|
|
5431
5448
|
* @param {int} [since] the earliest time in ms to fetch my dust trades for
|
|
5432
5449
|
* @param {int} [limit] the maximum number of dust trades to retrieve
|
|
5433
5450
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
5434
|
-
* @returns {object[]} a list of [trade structures]{@link https://
|
|
5451
|
+
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
|
|
5435
5452
|
*/
|
|
5436
5453
|
//
|
|
5437
5454
|
// Binance provides an opportunity to trade insignificant (i.e. non-tradable and non-withdrawable)
|
|
@@ -5575,7 +5592,7 @@ export default class binance extends Exchange {
|
|
|
5575
5592
|
* @param {bool} [params.fiat] if true, only fiat deposits will be returned
|
|
5576
5593
|
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
5577
5594
|
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
5578
|
-
* @returns {object[]} a list of [transaction structures]{@link https://
|
|
5595
|
+
* @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
5579
5596
|
*/
|
|
5580
5597
|
await this.loadMarkets();
|
|
5581
5598
|
let paginate = false;
|
|
@@ -5690,7 +5707,7 @@ export default class binance extends Exchange {
|
|
|
5690
5707
|
* @param {bool} [params.fiat] if true, only fiat withdrawals will be returned
|
|
5691
5708
|
* @param {int} [params.until] the latest time in ms to fetch withdrawals for
|
|
5692
5709
|
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
5693
|
-
* @returns {object[]} a list of [transaction structures]{@link https://
|
|
5710
|
+
* @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
5694
5711
|
*/
|
|
5695
5712
|
await this.loadMarkets();
|
|
5696
5713
|
let paginate = false;
|
|
@@ -6071,7 +6088,7 @@ export default class binance extends Exchange {
|
|
|
6071
6088
|
* @param {string} fromAccount account to transfer from
|
|
6072
6089
|
* @param {string} toAccount account to transfer to
|
|
6073
6090
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
6074
|
-
* @returns {object} a [transfer structure]{@link https://
|
|
6091
|
+
* @returns {object} a [transfer structure]{@link https://docs.ccxt.com/#/?id=transfer-structure}
|
|
6075
6092
|
*/
|
|
6076
6093
|
await this.loadMarkets();
|
|
6077
6094
|
const currency = this.currency(code);
|
|
@@ -6169,7 +6186,7 @@ export default class binance extends Exchange {
|
|
|
6169
6186
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
6170
6187
|
* @param {int} [params.until] the latest time in ms to fetch transfers for
|
|
6171
6188
|
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
6172
|
-
* @returns {object[]} a list of [transfer structures]{@link https://
|
|
6189
|
+
* @returns {object[]} a list of [transfer structures]{@link https://docs.ccxt.com/#/?id=transfer-structure}
|
|
6173
6190
|
*/
|
|
6174
6191
|
await this.loadMarkets();
|
|
6175
6192
|
let paginate = false;
|
|
@@ -6241,7 +6258,7 @@ export default class binance extends Exchange {
|
|
|
6241
6258
|
* @see https://binance-docs.github.io/apidocs/spot/en/#deposit-address-supporting-network-user_data
|
|
6242
6259
|
* @param {string} code unified currency code
|
|
6243
6260
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
6244
|
-
* @returns {object} an [address structure]{@link https://
|
|
6261
|
+
* @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
|
|
6245
6262
|
*/
|
|
6246
6263
|
await this.loadMarkets();
|
|
6247
6264
|
const currency = this.currency(code);
|
|
@@ -6317,7 +6334,7 @@ export default class binance extends Exchange {
|
|
|
6317
6334
|
* @see https://binance-docs.github.io/apidocs/spot/en/#all-coins-39-information-user_data
|
|
6318
6335
|
* @param {string[]|undefined} codes not used by binance fetchTransactionFees ()
|
|
6319
6336
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
6320
|
-
* @returns {object[]} a list of [fee structures]{@link https://
|
|
6337
|
+
* @returns {object[]} a list of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure}
|
|
6321
6338
|
*/
|
|
6322
6339
|
await this.loadMarkets();
|
|
6323
6340
|
const response = await this.sapiGetCapitalConfigGetall(params);
|
|
@@ -6431,7 +6448,7 @@ export default class binance extends Exchange {
|
|
|
6431
6448
|
* @see https://binance-docs.github.io/apidocs/spot/en/#all-coins-39-information-user_data
|
|
6432
6449
|
* @param {string[]|undefined} codes not used by binance fetchDepositWithdrawFees ()
|
|
6433
6450
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
6434
|
-
* @returns {object[]} a list of [fee structures]{@link https://
|
|
6451
|
+
* @returns {object[]} a list of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure}
|
|
6435
6452
|
*/
|
|
6436
6453
|
await this.loadMarkets();
|
|
6437
6454
|
const response = await this.sapiGetCapitalConfigGetall(params);
|
|
@@ -6558,7 +6575,7 @@ export default class binance extends Exchange {
|
|
|
6558
6575
|
* @param {string} address the address to withdraw to
|
|
6559
6576
|
* @param {string} tag
|
|
6560
6577
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
6561
|
-
* @returns {object} a [transaction structure]{@link https://
|
|
6578
|
+
* @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
6562
6579
|
*/
|
|
6563
6580
|
[tag, params] = this.handleWithdrawTagAndParams(tag, params);
|
|
6564
6581
|
this.checkAddress(address);
|
|
@@ -6623,7 +6640,7 @@ export default class binance extends Exchange {
|
|
|
6623
6640
|
* @see https://binance-docs.github.io/apidocs/delivery/en/#user-commission-rate-user_data
|
|
6624
6641
|
* @param {string} symbol unified market symbol
|
|
6625
6642
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
6626
|
-
* @returns {object} a [fee structure]{@link https://
|
|
6643
|
+
* @returns {object} a [fee structure]{@link https://docs.ccxt.com/#/?id=fee-structure}
|
|
6627
6644
|
*/
|
|
6628
6645
|
await this.loadMarkets();
|
|
6629
6646
|
const market = this.market(symbol);
|
|
@@ -6680,7 +6697,7 @@ export default class binance extends Exchange {
|
|
|
6680
6697
|
* @see https://binance-docs.github.io/apidocs/futures/en/#account-information-v2-user_data
|
|
6681
6698
|
* @see https://binance-docs.github.io/apidocs/delivery/en/#account-information-user_data
|
|
6682
6699
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
6683
|
-
* @returns {object} a dictionary of [fee structures]{@link https://
|
|
6700
|
+
* @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
|
|
6684
6701
|
*/
|
|
6685
6702
|
await this.loadMarkets();
|
|
6686
6703
|
let method = undefined;
|
|
@@ -6861,7 +6878,7 @@ export default class binance extends Exchange {
|
|
|
6861
6878
|
* @param {string} type 1 - transfer from spot account to USDT-Ⓜ futures account, 2 - transfer from USDT-Ⓜ futures account to spot account, 3 - transfer from spot account to COIN-Ⓜ futures account, 4 - transfer from COIN-Ⓜ futures account to spot account
|
|
6862
6879
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
6863
6880
|
* @param {float} params.recvWindow
|
|
6864
|
-
* @returns {object} a [transfer structure]{@link https://
|
|
6881
|
+
* @returns {object} a [transfer structure]{@link https://docs.ccxt.com/#/?id=futures-transfer-structure}
|
|
6865
6882
|
*/
|
|
6866
6883
|
if ((type < 1) || (type > 4)) {
|
|
6867
6884
|
throw new ArgumentsRequired(this.id + ' type must be between 1 and 4');
|
|
@@ -6890,7 +6907,7 @@ export default class binance extends Exchange {
|
|
|
6890
6907
|
* @see https://binance-docs.github.io/apidocs/delivery/en/#index-price-and-mark-price
|
|
6891
6908
|
* @param {string} symbol unified market symbol
|
|
6892
6909
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
6893
|
-
* @returns {object} a [funding rate structure]{@link https://
|
|
6910
|
+
* @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
6894
6911
|
*/
|
|
6895
6912
|
await this.loadMarkets();
|
|
6896
6913
|
const market = this.market(symbol);
|
|
@@ -6934,11 +6951,11 @@ export default class binance extends Exchange {
|
|
|
6934
6951
|
* @see https://binance-docs.github.io/apidocs/delivery/en/#get-funding-rate-history-of-perpetual-futures
|
|
6935
6952
|
* @param {string} symbol unified symbol of the market to fetch the funding rate history for
|
|
6936
6953
|
* @param {int} [since] timestamp in ms of the earliest funding rate to fetch
|
|
6937
|
-
* @param {int} [limit] the maximum amount of [funding rate structures]{@link https://
|
|
6954
|
+
* @param {int} [limit] the maximum amount of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-history-structure} to fetch
|
|
6938
6955
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
6939
6956
|
* @param {int} [params.until] timestamp in ms of the latest funding rate
|
|
6940
6957
|
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
6941
|
-
* @returns {object[]} a list of [funding rate structures]{@link https://
|
|
6958
|
+
* @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-history-structure}
|
|
6942
6959
|
*/
|
|
6943
6960
|
await this.loadMarkets();
|
|
6944
6961
|
const request = {};
|
|
@@ -7012,7 +7029,7 @@ export default class binance extends Exchange {
|
|
|
7012
7029
|
* @see https://binance-docs.github.io/apidocs/delivery/en/#index-price-and-mark-price
|
|
7013
7030
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
7014
7031
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
7015
|
-
* @returns {object} a dictionary of [funding rates structures]{@link https://
|
|
7032
|
+
* @returns {object} a dictionary of [funding rates structures]{@link https://docs.ccxt.com/#/?id=funding-rates-structure}, indexe by market symbols
|
|
7016
7033
|
*/
|
|
7017
7034
|
await this.loadMarkets();
|
|
7018
7035
|
symbols = this.marketSymbols(symbols);
|
|
@@ -7164,7 +7181,7 @@ export default class binance extends Exchange {
|
|
|
7164
7181
|
const initialMarginString = this.safeString(position, 'initialMargin');
|
|
7165
7182
|
const initialMargin = this.parseNumber(initialMarginString);
|
|
7166
7183
|
let initialMarginPercentageString = Precise.stringDiv('1', leverageString, 8);
|
|
7167
|
-
const rational = (1000 % leverage)
|
|
7184
|
+
const rational = this.isRoundNumber(1000 % leverage);
|
|
7168
7185
|
if (!rational) {
|
|
7169
7186
|
initialMarginPercentageString = Precise.stringDiv(Precise.stringAdd(initialMarginPercentageString, '1e-8'), '1', 8);
|
|
7170
7187
|
}
|
|
@@ -7450,7 +7467,7 @@ export default class binance extends Exchange {
|
|
|
7450
7467
|
const maintenanceMarginString = Precise.stringMul(maintenanceMarginPercentageString, notionalStringAbs);
|
|
7451
7468
|
const maintenanceMargin = this.parseNumber(maintenanceMarginString);
|
|
7452
7469
|
let initialMarginPercentageString = Precise.stringDiv('1', leverageString, 8);
|
|
7453
|
-
const rational = (1000 % leverage)
|
|
7470
|
+
const rational = this.isRoundNumber(1000 % leverage);
|
|
7454
7471
|
if (!rational) {
|
|
7455
7472
|
initialMarginPercentageString = Precise.stringAdd(initialMarginPercentageString, '1e-8');
|
|
7456
7473
|
}
|
|
@@ -7542,7 +7559,7 @@ export default class binance extends Exchange {
|
|
|
7542
7559
|
* @see https://binance-docs.github.io/apidocs/delivery/en/#notional-bracket-for-symbol-user_data
|
|
7543
7560
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
7544
7561
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
7545
|
-
* @returns {object} a dictionary of [leverage tiers structures]{@link https://
|
|
7562
|
+
* @returns {object} a dictionary of [leverage tiers structures]{@link https://docs.ccxt.com/#/?id=leverage-tiers-structure}, indexed by market symbols
|
|
7546
7563
|
*/
|
|
7547
7564
|
await this.loadMarkets();
|
|
7548
7565
|
const [type, query] = this.handleMarketTypeAndParams('fetchLeverageTiers', undefined, params);
|
|
@@ -7648,7 +7665,7 @@ export default class binance extends Exchange {
|
|
|
7648
7665
|
* @description fetch data on an open position
|
|
7649
7666
|
* @param {string} symbol unified market symbol of the market the position is held in
|
|
7650
7667
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
7651
|
-
* @returns {object} a [position structure]{@link https://
|
|
7668
|
+
* @returns {object} a [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
7652
7669
|
*/
|
|
7653
7670
|
await this.loadMarkets();
|
|
7654
7671
|
const market = this.market(symbol);
|
|
@@ -7692,7 +7709,7 @@ export default class binance extends Exchange {
|
|
|
7692
7709
|
* @description fetch data on open options positions
|
|
7693
7710
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
7694
7711
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
7695
|
-
* @returns {object[]} a list of [position structures]{@link https://
|
|
7712
|
+
* @returns {object[]} a list of [position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
7696
7713
|
*/
|
|
7697
7714
|
await this.loadMarkets();
|
|
7698
7715
|
symbols = this.marketSymbols(symbols);
|
|
@@ -7807,7 +7824,7 @@ export default class binance extends Exchange {
|
|
|
7807
7824
|
* @description fetch all open positions
|
|
7808
7825
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
7809
7826
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
7810
|
-
* @returns {object[]} a list of [position structure]{@link https://
|
|
7827
|
+
* @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
7811
7828
|
*/
|
|
7812
7829
|
const defaultMethod = this.safeString(this.options, 'fetchPositions', 'positionRisk');
|
|
7813
7830
|
if (defaultMethod === 'positionRisk') {
|
|
@@ -7970,7 +7987,7 @@ export default class binance extends Exchange {
|
|
|
7970
7987
|
* @param {int} [since] the earliest time in ms to fetch funding history for
|
|
7971
7988
|
* @param {int} [limit] the maximum number of funding history structures to retrieve
|
|
7972
7989
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
7973
|
-
* @returns {object} a [funding history structure]{@link https://
|
|
7990
|
+
* @returns {object} a [funding history structure]{@link https://docs.ccxt.com/#/?id=funding-history-structure}
|
|
7974
7991
|
*/
|
|
7975
7992
|
await this.loadMarkets();
|
|
7976
7993
|
let market = undefined;
|
|
@@ -8020,7 +8037,9 @@ export default class binance extends Exchange {
|
|
|
8020
8037
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
8021
8038
|
* @returns {object} response from the exchange
|
|
8022
8039
|
*/
|
|
8023
|
-
|
|
8040
|
+
if (symbol === undefined) {
|
|
8041
|
+
throw new ArgumentsRequired(this.id + ' setLeverage() requires a symbol argument');
|
|
8042
|
+
}
|
|
8024
8043
|
// WARNING: THIS WILL INCREASE LIQUIDATION PRICE FOR OPEN ISOLATED LONG POSITIONS
|
|
8025
8044
|
// AND DECREASE LIQUIDATION PRICE FOR OPEN ISOLATED SHORT POSITIONS
|
|
8026
8045
|
if ((leverage < 1) || (leverage > 125)) {
|
|
@@ -8028,7 +8047,7 @@ export default class binance extends Exchange {
|
|
|
8028
8047
|
}
|
|
8029
8048
|
await this.loadMarkets();
|
|
8030
8049
|
const market = this.market(symbol);
|
|
8031
|
-
let method
|
|
8050
|
+
let method;
|
|
8032
8051
|
if (market['linear']) {
|
|
8033
8052
|
method = 'fapiPrivatePostLeverage';
|
|
8034
8053
|
}
|
|
@@ -8056,7 +8075,9 @@ export default class binance extends Exchange {
|
|
|
8056
8075
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
8057
8076
|
* @returns {object} response from the exchange
|
|
8058
8077
|
*/
|
|
8059
|
-
|
|
8078
|
+
if (symbol === undefined) {
|
|
8079
|
+
throw new ArgumentsRequired(this.id + ' setMarginMode() requires a symbol argument');
|
|
8080
|
+
}
|
|
8060
8081
|
//
|
|
8061
8082
|
// { "code": -4048 , "msg": "Margin type cannot be changed if there exists position." }
|
|
8062
8083
|
//
|
|
@@ -8163,7 +8184,7 @@ export default class binance extends Exchange {
|
|
|
8163
8184
|
* @param {int} [since] timestamp in ms
|
|
8164
8185
|
* @param {int} [limit] number of records, default 100, max 100
|
|
8165
8186
|
* @param {object} [params] exchange specific params
|
|
8166
|
-
* @returns {object[]} a list of [settlement history objects]{@link https://
|
|
8187
|
+
* @returns {object[]} a list of [settlement history objects]{@link https://docs.ccxt.com/#/?id=settlement-history-structure}
|
|
8167
8188
|
*/
|
|
8168
8189
|
await this.loadMarkets();
|
|
8169
8190
|
const market = (symbol === undefined) ? undefined : this.market(symbol);
|
|
@@ -8349,7 +8370,7 @@ export default class binance extends Exchange {
|
|
|
8349
8370
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
8350
8371
|
* @param {int} [params.until] timestamp in ms of the latest ledger entry
|
|
8351
8372
|
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
8352
|
-
* @returns {object} a [ledger structure]{@link https://
|
|
8373
|
+
* @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
|
|
8353
8374
|
*/
|
|
8354
8375
|
await this.loadMarkets();
|
|
8355
8376
|
let paginate = false;
|
|
@@ -8805,7 +8826,7 @@ export default class binance extends Exchange {
|
|
|
8805
8826
|
* @param {string} symbol unified market symbol
|
|
8806
8827
|
* @param {float} amount the amount of margin to remove
|
|
8807
8828
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
8808
|
-
* @returns {object} a [margin structure]{@link https://
|
|
8829
|
+
* @returns {object} a [margin structure]{@link https://docs.ccxt.com/#/?id=reduce-margin-structure}
|
|
8809
8830
|
*/
|
|
8810
8831
|
return await this.modifyMarginHelper(symbol, amount, 2, params);
|
|
8811
8832
|
}
|
|
@@ -8819,19 +8840,19 @@ export default class binance extends Exchange {
|
|
|
8819
8840
|
* @param {string} symbol unified market symbol
|
|
8820
8841
|
* @param {float} amount amount of margin to add
|
|
8821
8842
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
8822
|
-
* @returns {object} a [margin structure]{@link https://
|
|
8843
|
+
* @returns {object} a [margin structure]{@link https://docs.ccxt.com/#/?id=add-margin-structure}
|
|
8823
8844
|
*/
|
|
8824
8845
|
return await this.modifyMarginHelper(symbol, amount, 1, params);
|
|
8825
8846
|
}
|
|
8826
|
-
async
|
|
8847
|
+
async fetchCrossBorrowRate(code, params = {}) {
|
|
8827
8848
|
/**
|
|
8828
8849
|
* @method
|
|
8829
|
-
* @name binance#
|
|
8850
|
+
* @name binance#fetchCrossBorrowRate
|
|
8830
8851
|
* @description fetch the rate of interest to borrow a currency for margin trading
|
|
8831
8852
|
* @see https://binance-docs.github.io/apidocs/spot/en/#query-margin-interest-rate-history-user_data
|
|
8832
8853
|
* @param {string} code unified currency code
|
|
8833
8854
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
8834
|
-
* @returns {object} a [borrow rate structure]{@link https://
|
|
8855
|
+
* @returns {object} a [borrow rate structure]{@link https://docs.ccxt.com/#/?id=borrow-rate-structure}
|
|
8835
8856
|
*/
|
|
8836
8857
|
await this.loadMarkets();
|
|
8837
8858
|
const currency = this.currency(code);
|
|
@@ -8861,9 +8882,9 @@ export default class binance extends Exchange {
|
|
|
8861
8882
|
* @see https://binance-docs.github.io/apidocs/spot/en/#query-margin-interest-rate-history-user_data
|
|
8862
8883
|
* @param {string} code unified currency code
|
|
8863
8884
|
* @param {int} [since] timestamp for the earliest borrow rate
|
|
8864
|
-
* @param {int} [limit] the maximum number of [borrow rate structures]{@link https://
|
|
8885
|
+
* @param {int} [limit] the maximum number of [borrow rate structures]{@link https://docs.ccxt.com/#/?id=borrow-rate-structure} to retrieve
|
|
8865
8886
|
* @param {object} [params] extra parameters specific to the exchange api endpoint
|
|
8866
|
-
* @returns {object[]} an array of [borrow rate structures]{@link https://
|
|
8887
|
+
* @returns {object[]} an array of [borrow rate structures]{@link https://docs.ccxt.com/#/?id=borrow-rate-structure}
|
|
8867
8888
|
*/
|
|
8868
8889
|
await this.loadMarkets();
|
|
8869
8890
|
if (limit === undefined) {
|
|
@@ -8916,7 +8937,7 @@ export default class binance extends Exchange {
|
|
|
8916
8937
|
// "vipLevel": 0
|
|
8917
8938
|
// }
|
|
8918
8939
|
//
|
|
8919
|
-
const timestamp = this.
|
|
8940
|
+
const timestamp = this.safeInteger(info, 'timestamp');
|
|
8920
8941
|
const currencyId = this.safeString(info, 'asset');
|
|
8921
8942
|
return {
|
|
8922
8943
|
'currency': this.safeCurrencyCode(currencyId, currency),
|
|
@@ -9027,7 +9048,7 @@ export default class binance extends Exchange {
|
|
|
9027
9048
|
* @param {int} [since] the earliest time in ms to fetch borrrow interest for
|
|
9028
9049
|
* @param {int} [limit] the maximum number of structures to retrieve
|
|
9029
9050
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
9030
|
-
* @returns {object[]} a list of [borrow interest structures]{@link https://
|
|
9051
|
+
* @returns {object[]} a list of [borrow interest structures]{@link https://docs.ccxt.com/#/?id=borrow-interest-structure}
|
|
9031
9052
|
*/
|
|
9032
9053
|
await this.loadMarkets();
|
|
9033
9054
|
const request = {};
|
|
@@ -9094,7 +9115,7 @@ export default class binance extends Exchange {
|
|
|
9094
9115
|
* @param {float} amount the amount to repay
|
|
9095
9116
|
* @param {string} symbol unified market symbol, required for isolated margin
|
|
9096
9117
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
9097
|
-
* @returns {object} a [margin loan structure]{@link https://
|
|
9118
|
+
* @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
9098
9119
|
*/
|
|
9099
9120
|
const [marginMode, query] = this.handleMarginModeAndParams('repayMargin', params); // cross or isolated
|
|
9100
9121
|
this.checkRequiredMarginArgument('repayMargin', symbol, marginMode);
|
|
@@ -9128,7 +9149,7 @@ export default class binance extends Exchange {
|
|
|
9128
9149
|
* @param {float} amount the amount to borrow
|
|
9129
9150
|
* @param {string} symbol unified market symbol, required for isolated margin
|
|
9130
9151
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
9131
|
-
* @returns {object} a [margin loan structure]{@link https://
|
|
9152
|
+
* @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
9132
9153
|
*/
|
|
9133
9154
|
const [marginMode, query] = this.handleMarginModeAndParams('borrowMargin', params); // cross or isolated
|
|
9134
9155
|
this.checkRequiredMarginArgument('borrowMargin', symbol, marginMode);
|
|
@@ -9182,7 +9203,7 @@ export default class binance extends Exchange {
|
|
|
9182
9203
|
* @param {int} [limit] default 30, max 500
|
|
9183
9204
|
* @param {object} [params] exchange specific parameters
|
|
9184
9205
|
* @param {int} [params.until] the time(ms) of the latest record to retrieve as a unix timestamp
|
|
9185
|
-
* @returns {object} an array of [open interest structure]{@link https://
|
|
9206
|
+
* @returns {object} an array of [open interest structure]{@link https://docs.ccxt.com/#/?id=open-interest-structure}
|
|
9186
9207
|
*/
|
|
9187
9208
|
if (timeframe === '1m') {
|
|
9188
9209
|
throw new BadRequest(this.id + 'fetchOpenInterestHistory cannot use the 1m timeframe');
|
|
@@ -9249,7 +9270,7 @@ export default class binance extends Exchange {
|
|
|
9249
9270
|
* @see https://binance-docs.github.io/apidocs/voptions/en/#open-interest
|
|
9250
9271
|
* @param {string} symbol unified CCXT market symbol
|
|
9251
9272
|
* @param {object} [params] exchange specific parameters
|
|
9252
|
-
* @returns {object} an open interest structure{@link https://
|
|
9273
|
+
* @returns {object} an open interest structure{@link https://docs.ccxt.com/#/?id=open-interest-structure}
|
|
9253
9274
|
*/
|
|
9254
9275
|
await this.loadMarkets();
|
|
9255
9276
|
const market = this.market(symbol);
|
|
@@ -9344,7 +9365,7 @@ export default class binance extends Exchange {
|
|
|
9344
9365
|
* @param {object} [params] exchange specific parameters for the binance api endpoint
|
|
9345
9366
|
* @param {int} [params.until] timestamp in ms of the latest liquidation
|
|
9346
9367
|
* @param {boolean} [params.paginate] *spot only* default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
9347
|
-
* @returns {object} an array of [liquidation structures]{@link https://
|
|
9368
|
+
* @returns {object} an array of [liquidation structures]{@link https://docs.ccxt.com/#/?id=liquidation-structure}
|
|
9348
9369
|
*/
|
|
9349
9370
|
await this.loadMarkets();
|
|
9350
9371
|
let paginate = false;
|
|
@@ -9564,7 +9585,7 @@ export default class binance extends Exchange {
|
|
|
9564
9585
|
* @see https://binance-docs.github.io/apidocs/voptions/en/#option-mark-price
|
|
9565
9586
|
* @param {string} symbol unified symbol of the market to fetch greeks for
|
|
9566
9587
|
* @param {object} [params] extra parameters specific to the binance api endpoint
|
|
9567
|
-
* @returns {object} a [greeks structure]{@link https://
|
|
9588
|
+
* @returns {object} a [greeks structure]{@link https://docs.ccxt.com/#/?id=greeks-structure}
|
|
9568
9589
|
*/
|
|
9569
9590
|
await this.loadMarkets();
|
|
9570
9591
|
const market = this.market(symbol);
|