ccxt 4.2.31 → 4.2.34
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/.gitattributes +1 -0
- package/CONTRIBUTING.md +20 -1
- package/README.md +8 -7
- package/build.sh +9 -2
- package/cleanup.sh +3 -0
- package/dist/ccxt.browser.js +639 -483
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/ace.js +3 -2
- package/dist/cjs/src/ascendex.js +1 -1
- package/dist/cjs/src/base/Exchange.js +54 -20
- package/dist/cjs/src/bigone.js +21 -1
- package/dist/cjs/src/binance.js +5 -4
- package/dist/cjs/src/bingx.js +4 -3
- package/dist/cjs/src/bit2c.js +12 -0
- package/dist/cjs/src/bitget.js +3 -3
- package/dist/cjs/src/bitmart.js +1 -1
- package/dist/cjs/src/bitrue.js +3 -3
- package/dist/cjs/src/blockchaincom.js +1 -1
- package/dist/cjs/src/bybit.js +1 -1
- package/dist/cjs/src/coinbase.js +2 -2
- package/dist/cjs/src/coinex.js +1 -1
- package/dist/cjs/src/cryptocom.js +10 -10
- package/dist/cjs/src/gate.js +34 -29
- package/dist/cjs/src/kraken.js +39 -0
- package/dist/cjs/src/kucoin.js +1 -1
- package/dist/cjs/src/mexc.js +2 -1
- package/dist/cjs/src/okx.js +4 -3
- package/dist/cjs/src/phemex.js +8 -8
- package/dist/cjs/src/pro/alpaca.js +8 -4
- package/dist/cjs/src/pro/ascendex.js +1 -2
- package/dist/cjs/src/pro/binance.js +14 -10
- package/dist/cjs/src/pro/bingx.js +1 -1
- package/dist/cjs/src/pro/bitfinex.js +21 -24
- package/dist/cjs/src/pro/bitfinex2.js +13 -17
- package/dist/cjs/src/pro/bitget.js +3 -1
- package/dist/cjs/src/pro/bitmart.js +3 -8
- package/dist/cjs/src/pro/bitmex.js +4 -7
- package/dist/cjs/src/pro/bitopro.js +2 -5
- package/dist/cjs/src/pro/bitrue.js +1 -1
- package/dist/cjs/src/pro/bitstamp.js +2 -3
- package/dist/cjs/src/pro/bitvavo.js +12 -5
- package/dist/cjs/src/pro/blockchaincom.js +22 -23
- package/dist/cjs/src/pro/bybit.js +5 -5
- package/dist/cjs/src/pro/cex.js +7 -7
- package/dist/cjs/src/pro/coinbase.js +3 -2
- package/dist/cjs/src/pro/coinbasepro.js +1 -1
- package/dist/cjs/src/pro/coinex.js +15 -13
- package/dist/cjs/src/pro/currencycom.js +5 -7
- package/dist/cjs/src/pro/deribit.js +4 -4
- package/dist/cjs/src/pro/exmo.js +15 -13
- package/dist/cjs/src/pro/gate.js +1 -1
- package/dist/cjs/src/pro/gemini.js +4 -2
- package/dist/cjs/src/pro/hitbtc.js +9 -8
- package/dist/cjs/src/pro/hollaex.js +2 -2
- package/dist/cjs/src/pro/htx.js +6 -7
- package/dist/cjs/src/pro/huobijp.js +3 -5
- package/dist/cjs/src/pro/idex.js +1 -1
- package/dist/cjs/src/pro/independentreserve.js +14 -13
- package/dist/cjs/src/pro/kraken.js +10 -16
- package/dist/cjs/src/pro/krakenfutures.js +10 -6
- package/dist/cjs/src/pro/kucoin.js +10 -11
- package/dist/cjs/src/pro/kucoinfutures.js +12 -11
- package/dist/cjs/src/pro/lbank.js +10 -10
- package/dist/cjs/src/pro/luno.js +12 -14
- package/dist/cjs/src/pro/mexc.js +3 -2
- package/dist/cjs/src/pro/ndax.js +7 -13
- package/dist/cjs/src/pro/okcoin.js +7 -12
- package/dist/cjs/src/pro/okx.js +6 -11
- package/dist/cjs/src/pro/onetrading.js +16 -15
- package/dist/cjs/src/pro/p2b.js +5 -3
- package/dist/cjs/src/pro/phemex.js +16 -11
- package/dist/cjs/src/pro/poloniex.js +6 -4
- package/dist/cjs/src/pro/poloniexfutures.js +14 -9
- package/dist/cjs/src/pro/probit.js +15 -11
- package/dist/cjs/src/pro/upbit.js +8 -8
- package/dist/cjs/src/pro/wazirx.js +6 -3
- package/dist/cjs/src/pro/woo.js +8 -6
- package/dist/cjs/src/probit.js +3 -3
- package/dist/cjs/src/tokocrypto.js +2 -2
- package/dist/cjs/src/wavesexchange.js +2 -1
- package/dist/cjs/src/woo.js +1 -1
- package/dist/cjs/src/yobit.js +39 -0
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/ace.d.ts +1 -1
- package/js/src/ace.js +3 -2
- package/js/src/alpaca.d.ts +1 -1
- package/js/src/ascendex.d.ts +5 -15
- package/js/src/ascendex.js +1 -1
- package/js/src/base/Exchange.d.ts +87 -78
- package/js/src/base/Exchange.js +54 -20
- package/js/src/base/types.d.ts +90 -6
- package/js/src/bigone.d.ts +5 -15
- package/js/src/bigone.js +21 -1
- package/js/src/binance.d.ts +13 -23
- package/js/src/binance.js +5 -4
- package/js/src/bingx.d.ts +6 -16
- package/js/src/bingx.js +4 -3
- package/js/src/bit2c.d.ts +1 -1
- package/js/src/bit2c.js +12 -0
- package/js/src/bitbank.d.ts +2 -2
- package/js/src/bitbns.d.ts +1 -1
- package/js/src/bitfinex.d.ts +5 -5
- package/js/src/bitfinex2.d.ts +7 -17
- package/js/src/bitflyer.d.ts +5 -5
- package/js/src/bitforex.d.ts +1 -1
- package/js/src/bitget.d.ts +8 -38
- package/js/src/bitget.js +3 -3
- package/js/src/bithumb.d.ts +2 -2
- package/js/src/bitmart.d.ts +10 -21
- package/js/src/bitmart.js +1 -1
- package/js/src/bitmex.d.ts +3 -3
- package/js/src/bitopro.d.ts +2 -2
- package/js/src/bitrue.d.ts +5 -15
- package/js/src/bitrue.js +3 -3
- package/js/src/bitso.d.ts +4 -4
- package/js/src/bitstamp.d.ts +2 -2
- package/js/src/bitteam.d.ts +1 -1
- package/js/src/bitvavo.d.ts +3 -3
- package/js/src/bl3p.d.ts +1 -1
- package/js/src/blockchaincom.d.ts +2 -2
- package/js/src/blockchaincom.js +1 -1
- package/js/src/btcalpha.d.ts +1 -1
- package/js/src/btcbox.d.ts +1 -1
- package/js/src/btcmarkets.d.ts +3 -3
- package/js/src/btcturk.d.ts +1 -1
- package/js/src/bybit.d.ts +8 -8
- package/js/src/bybit.js +1 -1
- package/js/src/cex.d.ts +1 -1
- package/js/src/coinbase.d.ts +6 -50
- package/js/src/coinbase.js +2 -2
- package/js/src/coinbasepro.d.ts +2 -2
- package/js/src/coincheck.d.ts +1 -1
- package/js/src/coinex.d.ts +8 -8
- package/js/src/coinex.js +1 -1
- package/js/src/coinlist.d.ts +4 -14
- package/js/src/coinmate.d.ts +2 -2
- package/js/src/coinmetro.d.ts +2 -2
- package/js/src/coinone.d.ts +1 -1
- package/js/src/coinsph.d.ts +2 -2
- package/js/src/coinspot.d.ts +1 -1
- package/js/src/cryptocom.d.ts +4 -4
- package/js/src/cryptocom.js +10 -10
- package/js/src/currencycom.d.ts +2 -2
- package/js/src/delta.d.ts +2 -2
- package/js/src/deribit.d.ts +4 -14
- package/js/src/digifinex.d.ts +10 -38
- package/js/src/exmo.d.ts +2 -2
- package/js/src/gate.d.ts +8 -18
- package/js/src/gate.js +34 -29
- package/js/src/gemini.d.ts +2 -2
- package/js/src/hitbtc.d.ts +6 -16
- package/js/src/hollaex.d.ts +2 -2
- package/js/src/htx.d.ts +11 -21
- package/js/src/huobijp.d.ts +4 -4
- package/js/src/idex.d.ts +3 -3
- package/js/src/independentreserve.d.ts +2 -2
- package/js/src/indodax.d.ts +2 -2
- package/js/src/kraken.d.ts +5 -5
- package/js/src/kraken.js +39 -0
- package/js/src/krakenfutures.d.ts +7 -7
- package/js/src/kucoin.d.ts +8 -29
- package/js/src/kucoin.js +1 -1
- package/js/src/kucoinfutures.d.ts +4 -4
- package/js/src/kuna.d.ts +2 -2
- package/js/src/latoken.d.ts +4 -14
- package/js/src/lbank.d.ts +2 -5
- package/js/src/luno.d.ts +1 -1
- package/js/src/lykke.d.ts +2 -2
- package/js/src/mercado.d.ts +2 -2
- package/js/src/mexc.d.ts +6 -6
- package/js/src/mexc.js +2 -1
- package/js/src/ndax.d.ts +2 -2
- package/js/src/novadax.d.ts +4 -15
- package/js/src/oceanex.d.ts +1 -1
- package/js/src/okcoin.d.ts +5 -15
- package/js/src/okx.d.ts +8 -18
- package/js/src/okx.js +4 -3
- package/js/src/onetrading.d.ts +2 -2
- package/js/src/p2b.d.ts +1 -1
- package/js/src/paymium.d.ts +3 -13
- package/js/src/phemex.d.ts +5 -5
- package/js/src/phemex.js +8 -8
- package/js/src/poloniex.d.ts +4 -14
- package/js/src/poloniexfutures.d.ts +1 -1
- package/js/src/pro/alpaca.d.ts +2 -2
- package/js/src/pro/alpaca.js +8 -4
- package/js/src/pro/ascendex.d.ts +2 -2
- package/js/src/pro/ascendex.js +1 -2
- package/js/src/pro/binance.d.ts +3 -3
- package/js/src/pro/binance.js +14 -10
- package/js/src/pro/bingx.d.ts +1 -1
- package/js/src/pro/bingx.js +1 -1
- package/js/src/pro/bitfinex.d.ts +2 -2
- package/js/src/pro/bitfinex.js +21 -24
- package/js/src/pro/bitfinex2.d.ts +2 -2
- package/js/src/pro/bitfinex2.js +13 -17
- package/js/src/pro/bitget.js +3 -1
- package/js/src/pro/bitmart.d.ts +3 -3
- package/js/src/pro/bitmart.js +3 -8
- package/js/src/pro/bitmex.d.ts +1 -1
- package/js/src/pro/bitmex.js +4 -7
- package/js/src/pro/bitopro.d.ts +1 -1
- package/js/src/pro/bitopro.js +2 -5
- package/js/src/pro/bitrue.js +1 -1
- package/js/src/pro/bitstamp.d.ts +1 -1
- package/js/src/pro/bitstamp.js +2 -3
- package/js/src/pro/bitvavo.d.ts +3 -3
- package/js/src/pro/bitvavo.js +12 -5
- package/js/src/pro/blockchaincom.d.ts +8 -8
- package/js/src/pro/blockchaincom.js +22 -23
- package/js/src/pro/bybit.d.ts +2 -2
- package/js/src/pro/bybit.js +5 -5
- package/js/src/pro/cex.d.ts +1 -1
- package/js/src/pro/cex.js +7 -7
- package/js/src/pro/coinbase.d.ts +1 -1
- package/js/src/pro/coinbase.js +3 -2
- package/js/src/pro/coinbasepro.d.ts +1 -1
- package/js/src/pro/coinbasepro.js +1 -1
- package/js/src/pro/coinex.d.ts +2 -2
- package/js/src/pro/coinex.js +15 -13
- package/js/src/pro/currencycom.d.ts +1 -1
- package/js/src/pro/currencycom.js +5 -7
- package/js/src/pro/deribit.d.ts +2 -2
- package/js/src/pro/deribit.js +4 -4
- package/js/src/pro/exmo.d.ts +2 -2
- package/js/src/pro/exmo.js +15 -13
- package/js/src/pro/gate.js +1 -1
- package/js/src/pro/gemini.d.ts +1 -1
- package/js/src/pro/gemini.js +4 -2
- package/js/src/pro/hitbtc.d.ts +2 -2
- package/js/src/pro/hitbtc.js +9 -8
- package/js/src/pro/hollaex.d.ts +2 -2
- package/js/src/pro/hollaex.js +2 -2
- package/js/src/pro/htx.d.ts +2 -2
- package/js/src/pro/htx.js +6 -7
- package/js/src/pro/huobijp.d.ts +1 -1
- package/js/src/pro/huobijp.js +3 -5
- package/js/src/pro/idex.js +1 -1
- package/js/src/pro/independentreserve.d.ts +1 -1
- package/js/src/pro/independentreserve.js +14 -13
- package/js/src/pro/kraken.d.ts +2 -2
- package/js/src/pro/kraken.js +10 -16
- package/js/src/pro/krakenfutures.d.ts +1 -1
- package/js/src/pro/krakenfutures.js +10 -6
- package/js/src/pro/kucoin.d.ts +3 -3
- package/js/src/pro/kucoin.js +10 -11
- package/js/src/pro/kucoinfutures.d.ts +3 -3
- package/js/src/pro/kucoinfutures.js +12 -11
- package/js/src/pro/lbank.d.ts +1 -1
- package/js/src/pro/lbank.js +10 -10
- package/js/src/pro/luno.d.ts +2 -2
- package/js/src/pro/luno.js +12 -14
- package/js/src/pro/mexc.d.ts +2 -2
- package/js/src/pro/mexc.js +3 -2
- package/js/src/pro/ndax.d.ts +3 -3
- package/js/src/pro/ndax.js +7 -13
- package/js/src/pro/okcoin.d.ts +1 -1
- package/js/src/pro/okcoin.js +7 -12
- package/js/src/pro/okx.d.ts +1 -1
- package/js/src/pro/okx.js +6 -11
- package/js/src/pro/onetrading.d.ts +1 -1
- package/js/src/pro/onetrading.js +16 -15
- package/js/src/pro/p2b.d.ts +1 -1
- package/js/src/pro/p2b.js +5 -3
- package/js/src/pro/phemex.d.ts +3 -3
- package/js/src/pro/phemex.js +16 -11
- package/js/src/pro/poloniex.d.ts +1 -1
- package/js/src/pro/poloniex.js +6 -4
- package/js/src/pro/poloniexfutures.d.ts +4 -4
- package/js/src/pro/poloniexfutures.js +13 -10
- package/js/src/pro/probit.d.ts +1 -1
- package/js/src/pro/probit.js +14 -12
- package/js/src/pro/upbit.js +8 -8
- package/js/src/pro/wazirx.d.ts +1 -1
- package/js/src/pro/wazirx.js +6 -3
- package/js/src/pro/woo.d.ts +3 -3
- package/js/src/pro/woo.js +8 -6
- package/js/src/probit.d.ts +3 -3
- package/js/src/probit.js +3 -3
- package/js/src/timex.d.ts +1 -1
- package/js/src/tokocrypto.d.ts +3 -3
- package/js/src/tokocrypto.js +2 -2
- package/js/src/upbit.d.ts +2 -2
- package/js/src/wavesexchange.d.ts +3 -4
- package/js/src/wavesexchange.js +2 -1
- package/js/src/wazirx.d.ts +1 -1
- package/js/src/whitebit.d.ts +5 -15
- package/js/src/woo.d.ts +5 -15
- package/js/src/woo.js +1 -1
- package/js/src/yobit.d.ts +21 -6
- package/js/src/yobit.js +39 -0
- package/js/src/zaif.d.ts +2 -2
- package/js/src/zonda.d.ts +4 -14
- package/package.json +22 -8
- package/skip-tests.json +9 -1
- package/tests-manager.sh +1 -2
package/dist/cjs/src/bybit.js
CHANGED
|
@@ -3692,7 +3692,7 @@ class bybit extends bybit$1 {
|
|
|
3692
3692
|
const takeProfitTriggerPrice = this.safeValue(params, 'takeProfitPrice');
|
|
3693
3693
|
const stopLoss = this.safeValue(params, 'stopLoss');
|
|
3694
3694
|
const takeProfit = this.safeValue(params, 'takeProfit');
|
|
3695
|
-
const trailingTriggerPrice = this.safeString2(params, 'trailingTriggerPrice', 'activePrice', price);
|
|
3695
|
+
const trailingTriggerPrice = this.safeString2(params, 'trailingTriggerPrice', 'activePrice', this.numberToString(price));
|
|
3696
3696
|
const trailingAmount = this.safeString2(params, 'trailingAmount', 'trailingStop');
|
|
3697
3697
|
const isTrailingAmountOrder = trailingAmount !== undefined;
|
|
3698
3698
|
const isStopLossTriggerOrder = stopLossTriggerPrice !== undefined;
|
package/dist/cjs/src/coinbase.js
CHANGED
|
@@ -1622,7 +1622,7 @@ class coinbase extends coinbase$1 {
|
|
|
1622
1622
|
'info': ticker,
|
|
1623
1623
|
}, market);
|
|
1624
1624
|
}
|
|
1625
|
-
|
|
1625
|
+
parseCustomBalance(response, params = {}) {
|
|
1626
1626
|
const balances = this.safeValue2(response, 'data', 'accounts', []);
|
|
1627
1627
|
const accounts = this.safeValue(params, 'type', this.options['accounts']);
|
|
1628
1628
|
const v3Accounts = this.safeValue(params, 'type', this.options['v3Accounts']);
|
|
@@ -1773,7 +1773,7 @@ class coinbase extends coinbase$1 {
|
|
|
1773
1773
|
// "size": 9
|
|
1774
1774
|
// }
|
|
1775
1775
|
//
|
|
1776
|
-
return this.
|
|
1776
|
+
return this.parseCustomBalance(response, params);
|
|
1777
1777
|
}
|
|
1778
1778
|
async fetchLedger(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
1779
1779
|
/**
|
package/dist/cjs/src/coinex.js
CHANGED
|
@@ -4370,7 +4370,7 @@ class coinex extends coinex$1 {
|
|
|
4370
4370
|
const request = {
|
|
4371
4371
|
'coin_type': currency['id'],
|
|
4372
4372
|
'coin_address': address,
|
|
4373
|
-
'actual_amount': parseFloat(amount),
|
|
4373
|
+
'actual_amount': parseFloat(this.numberToString(amount)),
|
|
4374
4374
|
'transfer_method': 'onchain', // onchain, local
|
|
4375
4375
|
};
|
|
4376
4376
|
if (networkCode !== undefined) {
|
|
@@ -1067,10 +1067,10 @@ class cryptocom extends cryptocom$1 {
|
|
|
1067
1067
|
const isTakeProfitTrigger = (takeProfitPrice !== undefined);
|
|
1068
1068
|
if (isTrigger) {
|
|
1069
1069
|
request['ref_price'] = this.priceToPrecision(symbol, triggerPrice);
|
|
1070
|
-
|
|
1070
|
+
const priceString = this.numberToString(price);
|
|
1071
1071
|
if ((uppercaseType === 'LIMIT') || (uppercaseType === 'STOP_LIMIT') || (uppercaseType === 'TAKE_PROFIT_LIMIT')) {
|
|
1072
1072
|
if (side === 'buy') {
|
|
1073
|
-
if (Precise["default"].stringLt(
|
|
1073
|
+
if (Precise["default"].stringLt(priceString, triggerPrice)) {
|
|
1074
1074
|
request['type'] = 'TAKE_PROFIT_LIMIT';
|
|
1075
1075
|
}
|
|
1076
1076
|
else {
|
|
@@ -1078,7 +1078,7 @@ class cryptocom extends cryptocom$1 {
|
|
|
1078
1078
|
}
|
|
1079
1079
|
}
|
|
1080
1080
|
else {
|
|
1081
|
-
if (Precise["default"].stringLt(
|
|
1081
|
+
if (Precise["default"].stringLt(priceString, triggerPrice)) {
|
|
1082
1082
|
request['type'] = 'STOP_LIMIT';
|
|
1083
1083
|
}
|
|
1084
1084
|
else {
|
|
@@ -1088,7 +1088,7 @@ class cryptocom extends cryptocom$1 {
|
|
|
1088
1088
|
}
|
|
1089
1089
|
else {
|
|
1090
1090
|
if (side === 'buy') {
|
|
1091
|
-
if (Precise["default"].stringLt(
|
|
1091
|
+
if (Precise["default"].stringLt(priceString, triggerPrice)) {
|
|
1092
1092
|
request['type'] = 'TAKE_PROFIT';
|
|
1093
1093
|
}
|
|
1094
1094
|
else {
|
|
@@ -1096,7 +1096,7 @@ class cryptocom extends cryptocom$1 {
|
|
|
1096
1096
|
}
|
|
1097
1097
|
}
|
|
1098
1098
|
else {
|
|
1099
|
-
if (Precise["default"].stringLt(
|
|
1099
|
+
if (Precise["default"].stringLt(priceString, triggerPrice)) {
|
|
1100
1100
|
request['type'] = 'STOP_LOSS';
|
|
1101
1101
|
}
|
|
1102
1102
|
else {
|
|
@@ -1287,10 +1287,10 @@ class cryptocom extends cryptocom$1 {
|
|
|
1287
1287
|
const isStopLossTrigger = (stopLossPrice !== undefined);
|
|
1288
1288
|
const isTakeProfitTrigger = (takeProfitPrice !== undefined);
|
|
1289
1289
|
if (isTrigger) {
|
|
1290
|
-
|
|
1290
|
+
const priceString = this.numberToString(price);
|
|
1291
1291
|
if ((uppercaseType === 'LIMIT') || (uppercaseType === 'STOP_LIMIT') || (uppercaseType === 'TAKE_PROFIT_LIMIT')) {
|
|
1292
1292
|
if (side === 'buy') {
|
|
1293
|
-
if (Precise["default"].stringLt(
|
|
1293
|
+
if (Precise["default"].stringLt(priceString, triggerPrice)) {
|
|
1294
1294
|
request['type'] = 'TAKE_PROFIT_LIMIT';
|
|
1295
1295
|
}
|
|
1296
1296
|
else {
|
|
@@ -1298,7 +1298,7 @@ class cryptocom extends cryptocom$1 {
|
|
|
1298
1298
|
}
|
|
1299
1299
|
}
|
|
1300
1300
|
else {
|
|
1301
|
-
if (Precise["default"].stringLt(
|
|
1301
|
+
if (Precise["default"].stringLt(priceString, triggerPrice)) {
|
|
1302
1302
|
request['type'] = 'STOP_LIMIT';
|
|
1303
1303
|
}
|
|
1304
1304
|
else {
|
|
@@ -1308,7 +1308,7 @@ class cryptocom extends cryptocom$1 {
|
|
|
1308
1308
|
}
|
|
1309
1309
|
else {
|
|
1310
1310
|
if (side === 'buy') {
|
|
1311
|
-
if (Precise["default"].stringLt(
|
|
1311
|
+
if (Precise["default"].stringLt(priceString, triggerPrice)) {
|
|
1312
1312
|
request['type'] = 'TAKE_PROFIT';
|
|
1313
1313
|
}
|
|
1314
1314
|
else {
|
|
@@ -1316,7 +1316,7 @@ class cryptocom extends cryptocom$1 {
|
|
|
1316
1316
|
}
|
|
1317
1317
|
}
|
|
1318
1318
|
else {
|
|
1319
|
-
if (Precise["default"].stringLt(
|
|
1319
|
+
if (Precise["default"].stringLt(priceString, triggerPrice)) {
|
|
1320
1320
|
request['type'] = 'STOP_LOSS';
|
|
1321
1321
|
}
|
|
1322
1322
|
else {
|
package/dist/cjs/src/gate.js
CHANGED
|
@@ -1618,32 +1618,34 @@ class gate extends gate$1 {
|
|
|
1618
1618
|
let withdrawAvailable = this.safeValue(result[code], 'withdraw');
|
|
1619
1619
|
withdrawAvailable = (withdrawEnabled) ? withdrawEnabled : withdrawAvailable;
|
|
1620
1620
|
const networks = this.safeValue(result[code], 'networks', {});
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
'
|
|
1634
|
-
'
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
'
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
'
|
|
1643
|
-
|
|
1621
|
+
if (networkCode !== undefined) {
|
|
1622
|
+
networks[networkCode] = {
|
|
1623
|
+
'info': entry,
|
|
1624
|
+
'id': networkId,
|
|
1625
|
+
'network': networkCode,
|
|
1626
|
+
'currencyId': currencyId,
|
|
1627
|
+
'lowerCaseCurrencyId': currencyIdLower,
|
|
1628
|
+
'deposit': depositEnabled,
|
|
1629
|
+
'withdraw': withdrawEnabled,
|
|
1630
|
+
'active': active,
|
|
1631
|
+
'fee': undefined,
|
|
1632
|
+
'precision': this.parseNumber('1e-4'),
|
|
1633
|
+
'limits': {
|
|
1634
|
+
'amount': {
|
|
1635
|
+
'min': undefined,
|
|
1636
|
+
'max': undefined,
|
|
1637
|
+
},
|
|
1638
|
+
'withdraw': {
|
|
1639
|
+
'min': undefined,
|
|
1640
|
+
'max': undefined,
|
|
1641
|
+
},
|
|
1642
|
+
'deposit': {
|
|
1643
|
+
'min': undefined,
|
|
1644
|
+
'max': undefined,
|
|
1645
|
+
},
|
|
1644
1646
|
},
|
|
1645
|
-
}
|
|
1646
|
-
}
|
|
1647
|
+
};
|
|
1648
|
+
}
|
|
1647
1649
|
result[code]['networks'] = networks;
|
|
1648
1650
|
const info = this.safeValue(result[code], 'info', []);
|
|
1649
1651
|
info.push(entry);
|
|
@@ -2599,6 +2601,7 @@ class gate extends gate$1 {
|
|
|
2599
2601
|
const [type, query] = this.handleMarketTypeAndParams('fetchTickers', market, params);
|
|
2600
2602
|
const [request, requestParams] = this.prepareRequest(undefined, type, query);
|
|
2601
2603
|
let response = undefined;
|
|
2604
|
+
request['timezone'] = 'utc0'; // default to utc
|
|
2602
2605
|
if (type === 'spot' || type === 'margin') {
|
|
2603
2606
|
response = await this.publicSpotGetTickers(this.extend(request, requestParams));
|
|
2604
2607
|
}
|
|
@@ -2616,7 +2619,7 @@ class gate extends gate$1 {
|
|
|
2616
2619
|
response = await this.publicOptionsGetTickers(this.extend(request, requestParams));
|
|
2617
2620
|
}
|
|
2618
2621
|
else {
|
|
2619
|
-
throw new errors.NotSupported(this.id + ' fetchTickers() not support this market type');
|
|
2622
|
+
throw new errors.NotSupported(this.id + ' fetchTickers() not support this market type, provide symbols or set params["defaultType"] to one from spot/margin/swap/future/option');
|
|
2620
2623
|
}
|
|
2621
2624
|
return this.parseTickers(response, symbols);
|
|
2622
2625
|
}
|
|
@@ -5187,16 +5190,17 @@ class gate extends gate$1 {
|
|
|
5187
5190
|
const defaultMarginMode = this.safeString2(this.options, 'marginMode', 'defaultMarginMode');
|
|
5188
5191
|
const crossLeverageLimit = this.safeString(query, 'cross_leverage_limit');
|
|
5189
5192
|
let marginMode = this.safeString(query, 'marginMode', defaultMarginMode);
|
|
5193
|
+
let stringifiedMargin = this.numberToString(leverage);
|
|
5190
5194
|
if (crossLeverageLimit !== undefined) {
|
|
5191
5195
|
marginMode = 'cross';
|
|
5192
|
-
|
|
5196
|
+
stringifiedMargin = crossLeverageLimit;
|
|
5193
5197
|
}
|
|
5194
5198
|
if (marginMode === 'cross' || marginMode === 'cross_margin') {
|
|
5195
|
-
request['cross_leverage_limit'] =
|
|
5199
|
+
request['cross_leverage_limit'] = stringifiedMargin;
|
|
5196
5200
|
request['leverage'] = '0';
|
|
5197
5201
|
}
|
|
5198
5202
|
else {
|
|
5199
|
-
request['leverage'] =
|
|
5203
|
+
request['leverage'] = stringifiedMargin;
|
|
5200
5204
|
}
|
|
5201
5205
|
let response = undefined;
|
|
5202
5206
|
if (market['swap']) {
|
|
@@ -6931,6 +6935,7 @@ class gate extends gate$1 {
|
|
|
6931
6935
|
return this.parseGreeks(entry, market);
|
|
6932
6936
|
}
|
|
6933
6937
|
}
|
|
6938
|
+
return undefined;
|
|
6934
6939
|
}
|
|
6935
6940
|
parseGreeks(greeks, market = undefined) {
|
|
6936
6941
|
//
|
package/dist/cjs/src/kraken.js
CHANGED
|
@@ -1509,6 +1509,41 @@ class kraken extends kraken$1 {
|
|
|
1509
1509
|
// "txid": "OTI672-HJFAO-XOIPPK"
|
|
1510
1510
|
// }
|
|
1511
1511
|
//
|
|
1512
|
+
// {
|
|
1513
|
+
// "error": [],
|
|
1514
|
+
// "result": {
|
|
1515
|
+
// "open": {
|
|
1516
|
+
// "OXVPSU-Q726F-L3SDEP": {
|
|
1517
|
+
// "refid": null,
|
|
1518
|
+
// "userref": 0,
|
|
1519
|
+
// "status": "open",
|
|
1520
|
+
// "opentm": 1706893367.4656649,
|
|
1521
|
+
// "starttm": 0,
|
|
1522
|
+
// "expiretm": 0,
|
|
1523
|
+
// "descr": {
|
|
1524
|
+
// "pair": "XRPEUR",
|
|
1525
|
+
// "type": "sell",
|
|
1526
|
+
// "ordertype": "trailing-stop",
|
|
1527
|
+
// "price": "+50.0000%",
|
|
1528
|
+
// "price2": "0",
|
|
1529
|
+
// "leverage": "none",
|
|
1530
|
+
// "order": "sell 10.00000000 XRPEUR @ trailing stop +50.0000%",
|
|
1531
|
+
// "close": ""
|
|
1532
|
+
// },
|
|
1533
|
+
// "vol": "10.00000000",
|
|
1534
|
+
// "vol_exec": "0.00000000",
|
|
1535
|
+
// "cost": "0.00000000",
|
|
1536
|
+
// "fee": "0.00000000",
|
|
1537
|
+
// "price": "0.00000000",
|
|
1538
|
+
// "stopprice": "0.23424000",
|
|
1539
|
+
// "limitprice": "0.46847000",
|
|
1540
|
+
// "misc": "",
|
|
1541
|
+
// "oflags": "fciq",
|
|
1542
|
+
// "trigger": "index"
|
|
1543
|
+
// }
|
|
1544
|
+
// }
|
|
1545
|
+
// }
|
|
1546
|
+
//
|
|
1512
1547
|
const description = this.safeValue(order, 'descr', {});
|
|
1513
1548
|
const orderDescription = this.safeString(description, 'order', description);
|
|
1514
1549
|
let side = undefined;
|
|
@@ -1550,6 +1585,10 @@ class kraken extends kraken$1 {
|
|
|
1550
1585
|
// kraken truncates the cost in the api response so we will ignore it and calculate it from average & filled
|
|
1551
1586
|
// const cost = this.safeString (order, 'cost');
|
|
1552
1587
|
price = this.safeString(description, 'price', price);
|
|
1588
|
+
// when type = trailling stop returns price = '+50.0000%'
|
|
1589
|
+
if ((price !== undefined) && price.endsWith('%')) {
|
|
1590
|
+
price = undefined; // this is not the price we want
|
|
1591
|
+
}
|
|
1553
1592
|
if ((price === undefined) || Precise["default"].stringEquals(price, '0')) {
|
|
1554
1593
|
price = this.safeString(description, 'price2');
|
|
1555
1594
|
}
|
package/dist/cjs/src/kucoin.js
CHANGED
|
@@ -4422,7 +4422,7 @@ class kucoin extends kucoin$1 {
|
|
|
4422
4422
|
let endpart = '';
|
|
4423
4423
|
headers = (headers !== undefined) ? headers : {};
|
|
4424
4424
|
let url = this.urls['api'][api];
|
|
4425
|
-
if (
|
|
4425
|
+
if (!this.isEmpty(query)) {
|
|
4426
4426
|
if ((method === 'GET') || (method === 'DELETE')) {
|
|
4427
4427
|
endpoint += '?' + this.rawencode(query);
|
|
4428
4428
|
}
|
package/dist/cjs/src/mexc.js
CHANGED
|
@@ -1355,7 +1355,8 @@ class mexc extends mexc$1 {
|
|
|
1355
1355
|
}
|
|
1356
1356
|
return orderbook;
|
|
1357
1357
|
}
|
|
1358
|
-
parseBidAsk(bidask, priceKey = 0, amountKey = 1,
|
|
1358
|
+
parseBidAsk(bidask, priceKey = 0, amountKey = 1, countOrIdKey = 2) {
|
|
1359
|
+
const countKey = 2;
|
|
1359
1360
|
const price = this.safeNumber(bidask, priceKey);
|
|
1360
1361
|
const amount = this.safeNumber(bidask, amountKey);
|
|
1361
1362
|
const count = this.safeNumber(bidask, countKey);
|
package/dist/cjs/src/okx.js
CHANGED
|
@@ -1521,8 +1521,8 @@ class okx extends okx$1 {
|
|
|
1521
1521
|
// "msg": ""
|
|
1522
1522
|
// }
|
|
1523
1523
|
//
|
|
1524
|
-
const
|
|
1525
|
-
return this.parseMarkets(
|
|
1524
|
+
const dataResponse = this.safeValue(response, 'data', []);
|
|
1525
|
+
return this.parseMarkets(dataResponse);
|
|
1526
1526
|
}
|
|
1527
1527
|
safeNetwork(networkId) {
|
|
1528
1528
|
const networksById = {
|
|
@@ -3149,7 +3149,7 @@ class okx extends okx$1 {
|
|
|
3149
3149
|
* @param {string[]|string} ids order ids
|
|
3150
3150
|
* @returns {string[]} list of order ids
|
|
3151
3151
|
*/
|
|
3152
|
-
if (typeof ids === 'string') {
|
|
3152
|
+
if ((ids !== undefined) && typeof ids === 'string') {
|
|
3153
3153
|
return ids.split(',');
|
|
3154
3154
|
}
|
|
3155
3155
|
else {
|
|
@@ -7228,6 +7228,7 @@ class okx extends okx$1 {
|
|
|
7228
7228
|
return this.parseGreeks(entry, market);
|
|
7229
7229
|
}
|
|
7230
7230
|
}
|
|
7231
|
+
return undefined;
|
|
7231
7232
|
}
|
|
7232
7233
|
parseGreeks(greeks, market = undefined) {
|
|
7233
7234
|
//
|
package/dist/cjs/src/phemex.js
CHANGED
|
@@ -1130,7 +1130,7 @@ class phemex extends phemex$1 {
|
|
|
1130
1130
|
return orderbook;
|
|
1131
1131
|
}
|
|
1132
1132
|
toEn(n, scale) {
|
|
1133
|
-
const stringN =
|
|
1133
|
+
const stringN = this.numberToString(n);
|
|
1134
1134
|
const precise = new Precise["default"](stringN);
|
|
1135
1135
|
precise.decimals = precise.decimals - scale;
|
|
1136
1136
|
precise.reduce();
|
|
@@ -2523,11 +2523,11 @@ class phemex extends phemex$1 {
|
|
|
2523
2523
|
}
|
|
2524
2524
|
}
|
|
2525
2525
|
cost = (cost === undefined) ? amount : cost;
|
|
2526
|
-
const costString =
|
|
2526
|
+
const costString = this.numberToString(cost);
|
|
2527
2527
|
request['quoteQtyEv'] = this.toEv(costString, market);
|
|
2528
2528
|
}
|
|
2529
2529
|
else {
|
|
2530
|
-
const amountString =
|
|
2530
|
+
const amountString = this.numberToString(amount);
|
|
2531
2531
|
request['baseQtyEv'] = this.toEv(amountString, market);
|
|
2532
2532
|
}
|
|
2533
2533
|
}
|
|
@@ -2545,7 +2545,7 @@ class phemex extends phemex$1 {
|
|
|
2545
2545
|
request['orderQtyRq'] = amount;
|
|
2546
2546
|
}
|
|
2547
2547
|
else {
|
|
2548
|
-
request['orderQty'] =
|
|
2548
|
+
request['orderQty'] = this.parseToInt(amount);
|
|
2549
2549
|
}
|
|
2550
2550
|
if (stopPrice !== undefined) {
|
|
2551
2551
|
const triggerType = this.safeString(params, 'triggerType', 'ByMarkPrice');
|
|
@@ -4342,10 +4342,10 @@ class phemex extends phemex$1 {
|
|
|
4342
4342
|
request['leverageRr'] = leverage;
|
|
4343
4343
|
}
|
|
4344
4344
|
else {
|
|
4345
|
-
const
|
|
4346
|
-
const
|
|
4347
|
-
request['longLeverageRr'] =
|
|
4348
|
-
request['shortLeverageRr'] =
|
|
4345
|
+
const longVar = (longLeverageRr !== undefined) ? longLeverageRr : leverage;
|
|
4346
|
+
const shortVar = (shortLeverageRr !== undefined) ? shortLeverageRr : leverage;
|
|
4347
|
+
request['longLeverageRr'] = longVar;
|
|
4348
|
+
request['shortLeverageRr'] = shortVar;
|
|
4349
4349
|
}
|
|
4350
4350
|
response = await this.privatePutGPositionsLeverage(this.extend(request, params));
|
|
4351
4351
|
}
|
|
@@ -612,13 +612,16 @@ class alpaca extends alpaca$1 {
|
|
|
612
612
|
const T = this.safeString(data, 'T');
|
|
613
613
|
const msg = this.safeValue(data, 'msg', {});
|
|
614
614
|
if (T === 'subscription') {
|
|
615
|
-
|
|
615
|
+
this.handleSubscription(client, data);
|
|
616
|
+
return;
|
|
616
617
|
}
|
|
617
618
|
if (T === 'success' && msg === 'connected') {
|
|
618
|
-
|
|
619
|
+
this.handleConnected(client, data);
|
|
620
|
+
return;
|
|
619
621
|
}
|
|
620
622
|
if (T === 'success' && msg === 'authenticated') {
|
|
621
|
-
|
|
623
|
+
this.handleAuthenticate(client, data);
|
|
624
|
+
return;
|
|
622
625
|
}
|
|
623
626
|
const methods = {
|
|
624
627
|
'error': this.handleErrorMessage,
|
|
@@ -647,7 +650,8 @@ class alpaca extends alpaca$1 {
|
|
|
647
650
|
}
|
|
648
651
|
handleMessage(client, message) {
|
|
649
652
|
if (Array.isArray(message)) {
|
|
650
|
-
|
|
653
|
+
this.handleCryptoMessage(client, message);
|
|
654
|
+
return;
|
|
651
655
|
}
|
|
652
656
|
this.handleTradingMessage(client, message);
|
|
653
657
|
}
|
|
@@ -886,7 +886,6 @@ class ascendex extends ascendex$1 {
|
|
|
886
886
|
this.handleBalance(client, message);
|
|
887
887
|
}
|
|
888
888
|
}
|
|
889
|
-
return message;
|
|
890
889
|
}
|
|
891
890
|
handleSubscriptionStatus(client, message) {
|
|
892
891
|
//
|
|
@@ -926,7 +925,7 @@ class ascendex extends ascendex$1 {
|
|
|
926
925
|
handlePing(client, message) {
|
|
927
926
|
this.spawn(this.pong, client, message);
|
|
928
927
|
}
|
|
929
|
-
authenticate(url, params = {}) {
|
|
928
|
+
async authenticate(url, params = {}) {
|
|
930
929
|
this.checkRequiredCredentials();
|
|
931
930
|
const messageHash = 'authenticated';
|
|
932
931
|
const client = this.client(url);
|
|
@@ -537,7 +537,7 @@ class binance extends binance$1 {
|
|
|
537
537
|
*/
|
|
538
538
|
return await this.watchTradesForSymbols([symbol], since, limit, params);
|
|
539
539
|
}
|
|
540
|
-
|
|
540
|
+
parseWsTrade(trade, market = undefined) {
|
|
541
541
|
//
|
|
542
542
|
// public watchTrades
|
|
543
543
|
//
|
|
@@ -645,7 +645,7 @@ class binance extends binance$1 {
|
|
|
645
645
|
const executionType = this.safeString(trade, 'x');
|
|
646
646
|
const isTradeExecution = (executionType === 'TRADE');
|
|
647
647
|
if (!isTradeExecution) {
|
|
648
|
-
return
|
|
648
|
+
return this.parseTrade(trade, market);
|
|
649
649
|
}
|
|
650
650
|
const id = this.safeString2(trade, 't', 'a');
|
|
651
651
|
const timestamp = this.safeInteger(trade, 'T');
|
|
@@ -710,7 +710,7 @@ class binance extends binance$1 {
|
|
|
710
710
|
const lowerCaseId = this.safeStringLower(message, 's');
|
|
711
711
|
const event = this.safeString(message, 'e');
|
|
712
712
|
const messageHash = lowerCaseId + '@' + event;
|
|
713
|
-
const trade = this.
|
|
713
|
+
const trade = this.parseWsTrade(message, market);
|
|
714
714
|
let tradesArray = this.safeValue(this.trades, symbol);
|
|
715
715
|
if (tradesArray === undefined) {
|
|
716
716
|
const limit = this.safeInteger(this.options, 'tradesLimit', 1000);
|
|
@@ -1260,14 +1260,15 @@ class binance extends binance$1 {
|
|
|
1260
1260
|
for (let j = 0; j < subscriptionKeys.length; j++) {
|
|
1261
1261
|
const subscribeType = subscriptionKeys[j];
|
|
1262
1262
|
if (subscribeType === type) {
|
|
1263
|
-
|
|
1263
|
+
this.delay(listenKeyRefreshRate, this.keepAliveListenKey, params);
|
|
1264
|
+
return;
|
|
1264
1265
|
}
|
|
1265
1266
|
}
|
|
1266
1267
|
}
|
|
1267
1268
|
}
|
|
1268
1269
|
setBalanceCache(client, type) {
|
|
1269
1270
|
if (type in client.subscriptions) {
|
|
1270
|
-
return
|
|
1271
|
+
return;
|
|
1271
1272
|
}
|
|
1272
1273
|
const options = this.safeValue(this.options, 'watchBalance');
|
|
1273
1274
|
const fetchBalanceSnapshot = this.safeBool(options, 'fetchBalanceSnapshot', false);
|
|
@@ -1368,7 +1369,7 @@ class binance extends binance$1 {
|
|
|
1368
1369
|
//
|
|
1369
1370
|
const messageHash = this.safeString(message, 'id');
|
|
1370
1371
|
const result = this.safeValue(message, 'result', {});
|
|
1371
|
-
const parsedBalances = this.parseBalance(result
|
|
1372
|
+
const parsedBalances = this.parseBalance(result);
|
|
1372
1373
|
client.resolve(parsedBalances, messageHash);
|
|
1373
1374
|
}
|
|
1374
1375
|
async watchBalance(params = {}) {
|
|
@@ -2741,13 +2742,15 @@ class binance extends binance$1 {
|
|
|
2741
2742
|
const status = this.safeString(message, 'status');
|
|
2742
2743
|
const error = this.safeValue(message, 'error');
|
|
2743
2744
|
if ((error !== undefined) || (status !== undefined && status !== '200')) {
|
|
2744
|
-
|
|
2745
|
+
this.handleWsError(client, message);
|
|
2746
|
+
return;
|
|
2745
2747
|
}
|
|
2746
2748
|
const id = this.safeString(message, 'id');
|
|
2747
2749
|
const subscriptions = this.safeValue(client.subscriptions, id);
|
|
2748
2750
|
let method = this.safeValue(subscriptions, 'method');
|
|
2749
2751
|
if (method !== undefined) {
|
|
2750
|
-
|
|
2752
|
+
method.call(this, client, message);
|
|
2753
|
+
return;
|
|
2751
2754
|
}
|
|
2752
2755
|
// handle other APIs
|
|
2753
2756
|
const methods = {
|
|
@@ -2777,7 +2780,8 @@ class binance extends binance$1 {
|
|
|
2777
2780
|
if (method === undefined) {
|
|
2778
2781
|
const requestId = this.safeString(message, 'id');
|
|
2779
2782
|
if (requestId !== undefined) {
|
|
2780
|
-
|
|
2783
|
+
this.handleSubscriptionStatus(client, message);
|
|
2784
|
+
return;
|
|
2781
2785
|
}
|
|
2782
2786
|
// special case for the real-time bookTicker, since it comes without an event identifier
|
|
2783
2787
|
//
|
|
@@ -2796,7 +2800,7 @@ class binance extends binance$1 {
|
|
|
2796
2800
|
}
|
|
2797
2801
|
}
|
|
2798
2802
|
else {
|
|
2799
|
-
|
|
2803
|
+
method.call(this, client, message);
|
|
2800
2804
|
}
|
|
2801
2805
|
}
|
|
2802
2806
|
}
|
|
@@ -717,7 +717,7 @@ class bingx extends bingx$1 {
|
|
|
717
717
|
}
|
|
718
718
|
setBalanceCache(client, type, subscriptionHash, params) {
|
|
719
719
|
if (subscriptionHash in client.subscriptions) {
|
|
720
|
-
return
|
|
720
|
+
return;
|
|
721
721
|
}
|
|
722
722
|
const fetchBalanceSnapshot = this.handleOptionAndParams(params, 'watchBalance', 'fetchBalanceSnapshot', true);
|
|
723
723
|
if (fetchBalanceSnapshot) {
|
|
@@ -132,7 +132,6 @@ class bitfinex extends bitfinex$1 {
|
|
|
132
132
|
stored.append(trade);
|
|
133
133
|
}
|
|
134
134
|
client.resolve(stored, messageHash);
|
|
135
|
-
return message;
|
|
136
135
|
}
|
|
137
136
|
parseTrade(trade, market = undefined) {
|
|
138
137
|
//
|
|
@@ -322,8 +321,9 @@ class bitfinex extends bitfinex$1 {
|
|
|
322
321
|
const delta = deltas[i];
|
|
323
322
|
const id = this.safeString(delta, 0);
|
|
324
323
|
const price = this.safeFloat(delta, 1);
|
|
325
|
-
const
|
|
326
|
-
const
|
|
324
|
+
const delta2Value = delta[2];
|
|
325
|
+
const size = (delta2Value < 0) ? -delta2Value : delta2Value;
|
|
326
|
+
const side = (delta2Value < 0) ? 'asks' : 'bids';
|
|
327
327
|
const bookside = orderbook[side];
|
|
328
328
|
bookside.store(price, size, id);
|
|
329
329
|
}
|
|
@@ -332,10 +332,11 @@ class bitfinex extends bitfinex$1 {
|
|
|
332
332
|
const deltas = message[1];
|
|
333
333
|
for (let i = 0; i < deltas.length; i++) {
|
|
334
334
|
const delta = deltas[i];
|
|
335
|
-
const
|
|
336
|
-
const
|
|
337
|
-
const
|
|
338
|
-
|
|
335
|
+
const delta2 = delta[2];
|
|
336
|
+
const size = (delta2 < 0) ? -delta2 : delta2;
|
|
337
|
+
const side = (delta2 < 0) ? 'asks' : 'bids';
|
|
338
|
+
const countedBookSide = orderbook[side];
|
|
339
|
+
countedBookSide.store(delta[0], size, delta[1]);
|
|
339
340
|
}
|
|
340
341
|
}
|
|
341
342
|
client.resolve(orderbook, messageHash);
|
|
@@ -345,18 +346,20 @@ class bitfinex extends bitfinex$1 {
|
|
|
345
346
|
if (isRaw) {
|
|
346
347
|
const id = this.safeString(message, 1);
|
|
347
348
|
const price = this.safeString(message, 2);
|
|
348
|
-
const
|
|
349
|
-
const
|
|
349
|
+
const message3 = message[3];
|
|
350
|
+
const size = (message3 < 0) ? -message3 : message3;
|
|
351
|
+
const side = (message3 < 0) ? 'asks' : 'bids';
|
|
350
352
|
const bookside = orderbook[side];
|
|
351
353
|
// price = 0 means that you have to remove the order from your book
|
|
352
354
|
const amount = Precise["default"].stringGt(price, '0') ? size : '0';
|
|
353
355
|
bookside.store(this.parseNumber(price), this.parseNumber(amount), id);
|
|
354
356
|
}
|
|
355
357
|
else {
|
|
356
|
-
const
|
|
357
|
-
const
|
|
358
|
-
const
|
|
359
|
-
|
|
358
|
+
const message3Value = message[3];
|
|
359
|
+
const size = (message3Value < 0) ? -message3Value : message3Value;
|
|
360
|
+
const side = (message3Value < 0) ? 'asks' : 'bids';
|
|
361
|
+
const countedBookSide = orderbook[side];
|
|
362
|
+
countedBookSide.store(message[1], size, message[2]);
|
|
360
363
|
}
|
|
361
364
|
client.resolve(orderbook, messageHash);
|
|
362
365
|
}
|
|
@@ -617,7 +620,7 @@ class bitfinex extends bitfinex$1 {
|
|
|
617
620
|
// ]
|
|
618
621
|
//
|
|
619
622
|
if (message[1] === 'hb') {
|
|
620
|
-
return
|
|
623
|
+
return; // skip heartbeats within subscription channels for now
|
|
621
624
|
}
|
|
622
625
|
const subscription = this.safeValue(client.subscriptions, channelId, {});
|
|
623
626
|
const channel = this.safeString(subscription, 'channel');
|
|
@@ -632,11 +635,8 @@ class bitfinex extends bitfinex$1 {
|
|
|
632
635
|
'oc': this.handleOrders,
|
|
633
636
|
};
|
|
634
637
|
const method = this.safeValue2(methods, channel, name);
|
|
635
|
-
if (method
|
|
636
|
-
|
|
637
|
-
}
|
|
638
|
-
else {
|
|
639
|
-
return method.call(this, client, message, subscription);
|
|
638
|
+
if (method !== undefined) {
|
|
639
|
+
method.call(this, client, message, subscription);
|
|
640
640
|
}
|
|
641
641
|
}
|
|
642
642
|
else {
|
|
@@ -658,11 +658,8 @@ class bitfinex extends bitfinex$1 {
|
|
|
658
658
|
'auth': this.handleAuthenticationMessage,
|
|
659
659
|
};
|
|
660
660
|
const method = this.safeValue(methods, event);
|
|
661
|
-
if (method
|
|
662
|
-
|
|
663
|
-
}
|
|
664
|
-
else {
|
|
665
|
-
return method.call(this, client, message);
|
|
661
|
+
if (method !== undefined) {
|
|
662
|
+
method.call(this, client, message);
|
|
666
663
|
}
|
|
667
664
|
}
|
|
668
665
|
}
|