ccxt 4.5.38 → 4.5.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -7
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -6
- package/dist/cjs/src/base/Exchange.js +62 -5
- package/dist/cjs/src/binance.js +151 -2
- package/dist/cjs/src/bingx.js +137 -120
- package/dist/cjs/src/bitget.js +47 -1
- package/dist/cjs/src/bitmart.js +23 -8
- package/dist/cjs/src/bitmex.js +416 -0
- package/dist/cjs/src/bitstamp.js +264 -43
- package/dist/cjs/src/bitvavo.js +10 -0
- package/dist/cjs/src/blofin.js +85 -0
- package/dist/cjs/src/btcmarkets.js +1 -1
- package/dist/cjs/src/bybit.js +135 -0
- package/dist/cjs/src/coinspot.js +77 -7
- package/dist/cjs/src/delta.js +367 -0
- package/dist/cjs/src/htx.js +265 -2
- package/dist/cjs/src/hyperliquid.js +37 -8
- package/dist/cjs/src/krakenfutures.js +4 -0
- package/dist/cjs/src/kucoinfutures.js +121 -0
- package/dist/cjs/src/mexc.js +9 -1
- package/dist/cjs/src/phemex.js +359 -0
- package/dist/cjs/src/poloniex.js +5 -0
- package/dist/cjs/src/pro/binance.js +111 -26
- package/dist/cjs/src/pro/bingx.js +33 -33
- package/dist/cjs/src/pro/bitget.js +48 -90
- package/dist/cjs/src/pro/bitmart.js +68 -0
- package/dist/cjs/src/pro/blofin.js +52 -1
- package/dist/cjs/src/pro/bybit.js +2 -2
- package/dist/cjs/src/pro/coinbaseinternational.js +5 -2
- package/dist/cjs/src/pro/mexc.js +72 -0
- package/dist/cjs/src/pro/okx.js +8 -5
- package/dist/cjs/src/pro/paradex.js +137 -0
- package/dist/cjs/src/pro/woo.js +43 -0
- package/dist/cjs/src/tokocrypto.js +23 -0
- package/dist/cjs/src/toobit.js +20 -0
- package/dist/cjs/src/whitebit.js +11 -10
- package/dist/cjs/src/woo.js +103 -3
- package/js/ccxt.d.ts +3 -9
- package/js/ccxt.js +2 -6
- package/js/src/abstract/binance.d.ts +5 -0
- package/js/src/abstract/binancecoinm.d.ts +5 -0
- package/js/src/abstract/binanceus.d.ts +5 -0
- package/js/src/abstract/binanceusdm.d.ts +5 -0
- package/js/src/abstract/bitget.d.ts +47 -1
- package/js/src/abstract/bitstamp.d.ts +1 -1
- package/js/src/abstract/bitvavo.d.ts +10 -0
- package/js/src/abstract/coinspot.d.ts +45 -0
- package/js/src/base/Exchange.d.ts +11 -8
- package/js/src/base/Exchange.js +65 -5
- package/js/src/base/types.d.ts +9 -0
- package/js/src/binance.d.ts +26 -1
- package/js/src/binance.js +151 -2
- package/js/src/bingx.d.ts +113 -108
- package/js/src/bingx.js +137 -120
- package/js/src/bitget.js +47 -1
- package/js/src/bitmart.js +23 -8
- package/js/src/bitmex.d.ts +50 -1
- package/js/src/bitmex.js +416 -0
- package/js/src/bitstamp.d.ts +52 -1
- package/js/src/bitstamp.js +264 -43
- package/js/src/bitvavo.js +10 -0
- package/js/src/blofin.d.ts +12 -1
- package/js/src/blofin.js +85 -0
- package/js/src/btcmarkets.js +1 -1
- package/js/src/bybit.d.ts +12 -1
- package/js/src/bybit.js +135 -0
- package/js/src/coinspot.js +77 -7
- package/js/src/delta.d.ts +12 -1
- package/js/src/delta.js +367 -0
- package/js/src/htx.d.ts +15 -1
- package/js/src/htx.js +265 -2
- package/js/src/hyperliquid.js +37 -8
- package/js/src/krakenfutures.js +4 -0
- package/js/src/kucoinfutures.d.ts +12 -1
- package/js/src/kucoinfutures.js +121 -0
- package/js/src/mexc.js +9 -1
- package/js/src/phemex.d.ts +16 -1
- package/js/src/phemex.js +359 -0
- package/js/src/poloniex.js +5 -0
- package/js/src/pro/binance.d.ts +13 -0
- package/js/src/pro/binance.js +111 -26
- package/js/src/pro/bingx.d.ts +33 -33
- package/js/src/pro/bingx.js +33 -33
- package/js/src/pro/bitget.d.ts +6 -6
- package/js/src/pro/bitget.js +48 -90
- package/js/src/pro/bitmart.d.ts +22 -1
- package/js/src/pro/bitmart.js +69 -1
- package/js/src/pro/blofin.d.ts +12 -1
- package/js/src/pro/blofin.js +52 -1
- package/js/src/pro/bybit.d.ts +1 -1
- package/js/src/pro/bybit.js +2 -2
- package/js/src/pro/coinbaseinternational.d.ts +2 -2
- package/js/src/pro/coinbaseinternational.js +6 -3
- package/js/src/pro/mexc.d.ts +22 -1
- package/js/src/pro/mexc.js +72 -0
- package/js/src/pro/okx.d.ts +4 -4
- package/js/src/pro/okx.js +8 -5
- package/js/src/pro/paradex.d.ts +23 -1
- package/js/src/pro/paradex.js +137 -0
- package/js/src/pro/woo.d.ts +12 -1
- package/js/src/pro/woo.js +43 -0
- package/js/src/tokocrypto.js +23 -0
- package/js/src/toobit.js +20 -0
- package/js/src/whitebit.js +8 -8
- package/js/src/woo.d.ts +12 -1
- package/js/src/woo.js +103 -3
- package/package.json +1 -1
- package/dist/cjs/src/abstract/probit.js +0 -11
- package/dist/cjs/src/pro/probit.js +0 -594
- package/dist/cjs/src/probit.js +0 -1936
- package/js/src/abstract/probit.d.ts +0 -26
- package/js/src/abstract/probit.js +0 -11
- package/js/src/pro/probit.d.ts +0 -91
- package/js/src/pro/probit.js +0 -593
- package/js/src/probit.d.ts +0 -283
- package/js/src/probit.js +0 -1935
package/js/src/bitstamp.js
CHANGED
|
@@ -170,7 +170,7 @@ export default class bitstamp extends Exchange {
|
|
|
170
170
|
'currencies/': 1,
|
|
171
171
|
'eur_usd/': 1,
|
|
172
172
|
'travel_rule/vasps/': 1,
|
|
173
|
-
'funding_rate/{
|
|
173
|
+
'funding_rate/{market_symbol}/': 1,
|
|
174
174
|
'funding_rate_history/{pair}/': 1,
|
|
175
175
|
},
|
|
176
176
|
},
|
|
@@ -612,51 +612,97 @@ export default class bitstamp extends Exchange {
|
|
|
612
612
|
async fetchMarkets(params = {}) {
|
|
613
613
|
const response = await this.fetchMarketsFromCache(params);
|
|
614
614
|
//
|
|
615
|
-
//
|
|
615
|
+
// [
|
|
616
|
+
//
|
|
617
|
+
// spot:
|
|
618
|
+
//
|
|
619
|
+
// {
|
|
620
|
+
// "name": "BTC/USD",
|
|
621
|
+
// "market_symbol": "btcusd",
|
|
622
|
+
// "base_currency": "BTC",
|
|
623
|
+
// "base_decimals": 8,
|
|
624
|
+
// "counter_currency": "USD",
|
|
625
|
+
// "counter_decimals": 0,
|
|
626
|
+
// "minimum_order_value": "10",
|
|
627
|
+
// "trading": "Enabled",
|
|
628
|
+
// "instant_order_counter_decimals": 2,
|
|
629
|
+
// "instant_and_market_orders": "Enabled",
|
|
630
|
+
// "description": "Bitcoin / U.S. dollar",
|
|
631
|
+
// "market_type": "SPOT"
|
|
632
|
+
// },
|
|
633
|
+
// ...
|
|
634
|
+
//
|
|
635
|
+
// perp:
|
|
636
|
+
//
|
|
616
637
|
// {
|
|
638
|
+
// "name": "BTC/USD-PERP",
|
|
639
|
+
// "market_symbol": "btcusd-perp",
|
|
640
|
+
// "base_currency": "BTC",
|
|
641
|
+
// "base_decimals": 5,
|
|
642
|
+
// "counter_currency": "USD",
|
|
643
|
+
// "counter_decimals": 0,
|
|
644
|
+
// "minimum_order_value": "10",
|
|
645
|
+
// "maximum_order_value": "500000.00000000",
|
|
646
|
+
// "minimum_order_amount": "0.00001000",
|
|
647
|
+
// "maximum_order_amount": "10.00000000",
|
|
617
648
|
// "trading": "Enabled",
|
|
618
|
-
// "
|
|
619
|
-
// "url_symbol": "btcusd",
|
|
620
|
-
// "name": "BTC/USD",
|
|
649
|
+
// "instant_order_counter_decimals": 2,
|
|
621
650
|
// "instant_and_market_orders": "Enabled",
|
|
622
|
-
// "
|
|
623
|
-
// "
|
|
624
|
-
// "
|
|
651
|
+
// "description": "Bitcoin / U.S. dollar Perpetual",
|
|
652
|
+
// "market_type": "PERPETUAL",
|
|
653
|
+
// "underlying_asset": "Kaiko BTC Benchmark Reference Rate",
|
|
654
|
+
// "payoff_type": "Linear",
|
|
655
|
+
// "contract_size": "1.00000000",
|
|
656
|
+
// "isin": "EZHKD4DNKHY3"
|
|
625
657
|
// }
|
|
626
|
-
// ]
|
|
627
658
|
//
|
|
628
659
|
const result = [];
|
|
629
660
|
for (let i = 0; i < response.length; i++) {
|
|
630
661
|
const market = response[i];
|
|
631
|
-
const
|
|
632
|
-
|
|
633
|
-
const
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
662
|
+
const [baseId, quoteId] = [this.safeString(market, 'base_currency'), this.safeString(market, 'counter_currency')];
|
|
663
|
+
const base = this.safeCurrencyCode(baseId);
|
|
664
|
+
const quote = this.safeCurrencyCode(quoteId);
|
|
665
|
+
let settleId = undefined;
|
|
666
|
+
const marketTypeRaw = this.safeString(market, 'market_type');
|
|
667
|
+
let symbol = base + '/' + quote;
|
|
668
|
+
let type = undefined;
|
|
669
|
+
let subType = undefined;
|
|
670
|
+
if (marketTypeRaw === 'SPOT') {
|
|
671
|
+
type = 'spot';
|
|
672
|
+
}
|
|
673
|
+
else if (marketTypeRaw === 'PERPETUAL') {
|
|
674
|
+
type = 'swap';
|
|
675
|
+
settleId = quoteId;
|
|
676
|
+
symbol = base + '/' + quote + ':' + settleId;
|
|
677
|
+
const payoffType = this.safeString(market, 'payoff_type');
|
|
678
|
+
if (payoffType === 'Linear') {
|
|
679
|
+
subType = 'linear';
|
|
680
|
+
}
|
|
681
|
+
else if (payoffType === 'Inverse') {
|
|
682
|
+
subType = 'inverse';
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
const isSpot = (type === 'spot');
|
|
640
686
|
result.push({
|
|
641
|
-
'id': this.safeString(market, '
|
|
642
|
-
'
|
|
643
|
-
'symbol': base + '/' + quote,
|
|
687
|
+
'id': this.safeString(market, 'market_symbol'),
|
|
688
|
+
'symbol': symbol,
|
|
644
689
|
'base': base,
|
|
645
690
|
'quote': quote,
|
|
646
|
-
'settle': undefined,
|
|
691
|
+
'settle': settleId ? this.safeCurrencyCode(settleId) : undefined,
|
|
647
692
|
'baseId': baseId,
|
|
648
693
|
'quoteId': quoteId,
|
|
649
|
-
'settleId':
|
|
650
|
-
'type':
|
|
651
|
-
'
|
|
694
|
+
'settleId': settleId,
|
|
695
|
+
'type': type,
|
|
696
|
+
'subType': subType,
|
|
697
|
+
'spot': isSpot,
|
|
652
698
|
'margin': false,
|
|
653
699
|
'future': false,
|
|
654
|
-
'swap':
|
|
700
|
+
'swap': !isSpot,
|
|
655
701
|
'option': false,
|
|
656
|
-
'active': (
|
|
657
|
-
'contract':
|
|
658
|
-
'linear': undefined,
|
|
659
|
-
'inverse': undefined,
|
|
702
|
+
'active': (this.safeString(market, 'trading') === 'Enabled'),
|
|
703
|
+
'contract': !isSpot,
|
|
704
|
+
'linear': isSpot ? undefined : true,
|
|
705
|
+
'inverse': isSpot ? undefined : false,
|
|
660
706
|
'contractSize': undefined,
|
|
661
707
|
'expiry': undefined,
|
|
662
708
|
'expiryDatetime': undefined,
|
|
@@ -672,16 +718,16 @@ export default class bitstamp extends Exchange {
|
|
|
672
718
|
'max': undefined,
|
|
673
719
|
},
|
|
674
720
|
'amount': {
|
|
675
|
-
'min':
|
|
676
|
-
'max':
|
|
721
|
+
'min': this.safeNumber(market, 'minimum_order_amount'),
|
|
722
|
+
'max': this.safeNumber(market, 'maximum_order_amount'),
|
|
677
723
|
},
|
|
678
724
|
'price': {
|
|
679
725
|
'min': undefined,
|
|
680
726
|
'max': undefined,
|
|
681
727
|
},
|
|
682
728
|
'cost': {
|
|
683
|
-
'min': this.safeNumber(
|
|
684
|
-
'max':
|
|
729
|
+
'min': this.safeNumber(market, 'minimum_order_value'),
|
|
730
|
+
'max': this.safeNumber(market, 'maximum_order_value'),
|
|
685
731
|
},
|
|
686
732
|
},
|
|
687
733
|
'created': undefined,
|
|
@@ -737,7 +783,24 @@ export default class bitstamp extends Exchange {
|
|
|
737
783
|
const expires = this.safeInteger(options, 'expires', 1000);
|
|
738
784
|
const now = this.milliseconds();
|
|
739
785
|
if ((timestamp === undefined) || ((now - timestamp) > expires)) {
|
|
740
|
-
const response = await this.
|
|
786
|
+
const response = await this.publicGetMarkets(params);
|
|
787
|
+
//
|
|
788
|
+
// [
|
|
789
|
+
// {
|
|
790
|
+
// "name": "BTC/USD",
|
|
791
|
+
// "market_symbol": "btcusd",
|
|
792
|
+
// "base_currency": "BTC",
|
|
793
|
+
// "base_decimals": 8,
|
|
794
|
+
// "counter_currency": "USD",
|
|
795
|
+
// "counter_decimals": 0,
|
|
796
|
+
// "minimum_order_value": "10",
|
|
797
|
+
// "trading": "Enabled",
|
|
798
|
+
// "instant_order_counter_decimals": 2,
|
|
799
|
+
// "instant_and_market_orders": "Enabled",
|
|
800
|
+
// "description": "Bitcoin / U.S. dollar",
|
|
801
|
+
// "market_type": "SPOT"
|
|
802
|
+
// },
|
|
803
|
+
//
|
|
741
804
|
this.options['fetchMarkets'] = this.extend(options, {
|
|
742
805
|
'response': response,
|
|
743
806
|
'timestamp': now,
|
|
@@ -772,15 +835,12 @@ export default class bitstamp extends Exchange {
|
|
|
772
835
|
const result = {};
|
|
773
836
|
for (let i = 0; i < response.length; i++) {
|
|
774
837
|
const market = response[i];
|
|
775
|
-
const
|
|
776
|
-
|
|
777
|
-
const
|
|
778
|
-
const quoteId = quote.toLowerCase();
|
|
779
|
-
base = this.safeCurrencyCode(base);
|
|
780
|
-
quote = this.safeCurrencyCode(quote);
|
|
838
|
+
const [baseId, quoteId] = [this.safeString(market, 'base_currency'), this.safeString(market, 'counter_currency')];
|
|
839
|
+
const base = this.safeCurrencyCode(baseId);
|
|
840
|
+
const quote = this.safeCurrencyCode(quoteId);
|
|
781
841
|
const description = this.safeString(market, 'description');
|
|
782
842
|
const [baseDescription, quoteDescription] = description.split(' / ');
|
|
783
|
-
const minimumOrder = this.safeString(market, '
|
|
843
|
+
const minimumOrder = this.safeString(market, 'minimum_order_value');
|
|
784
844
|
const parts = minimumOrder.split(' ');
|
|
785
845
|
const cost = parts[0];
|
|
786
846
|
if (!(base in result)) {
|
|
@@ -1074,7 +1134,7 @@ export default class bitstamp extends Exchange {
|
|
|
1074
1134
|
}
|
|
1075
1135
|
const feeCostString = this.safeString(trade, 'fee');
|
|
1076
1136
|
const feeCurrency = market['quote'];
|
|
1077
|
-
const priceId = (rawMarketId !== undefined) ? rawMarketId : market['
|
|
1137
|
+
const priceId = (rawMarketId !== undefined) ? rawMarketId : market['id'];
|
|
1078
1138
|
priceString = this.safeString(trade, priceId, priceString);
|
|
1079
1139
|
amountString = this.safeString(trade, market['baseId'], amountString);
|
|
1080
1140
|
costString = this.safeString(trade, market['quoteId'], costString);
|
|
@@ -1540,6 +1600,43 @@ export default class bitstamp extends Exchange {
|
|
|
1540
1600
|
order['type'] = type;
|
|
1541
1601
|
return order;
|
|
1542
1602
|
}
|
|
1603
|
+
/**
|
|
1604
|
+
* @method
|
|
1605
|
+
* @name bitstamp#editOrder
|
|
1606
|
+
* @description edit a trade order
|
|
1607
|
+
* @see https://www.bitstamp.net/api/#tag/Orders/operation/ReplaceOrder
|
|
1608
|
+
* @param {string} id order id
|
|
1609
|
+
* @param {string} [symbol] unified symbol of the market to create an order in
|
|
1610
|
+
* @param {string} [type] 'market', 'limit' or 'stop_limit'
|
|
1611
|
+
* @param {string} [side] 'buy' or 'sell'
|
|
1612
|
+
* @param {float} [amount] how much of the currency you want to trade in units of the base currency
|
|
1613
|
+
* @param {float} [price] the price for the order, in units of the quote currency, ignored in market orders
|
|
1614
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1615
|
+
* @param {string} [params.triggerPrice] the price to trigger a stop order
|
|
1616
|
+
* @param {string} [params.timeInForce] for crypto trading either 'gtc' or 'ioc' can be used
|
|
1617
|
+
* @param {string} [params.clientOrderId] a unique identifier for the order, automatically generated if not sent
|
|
1618
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/?id=order-structure}
|
|
1619
|
+
*/
|
|
1620
|
+
async editOrder(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
|
|
1621
|
+
await this.loadMarkets();
|
|
1622
|
+
const market = this.market(symbol);
|
|
1623
|
+
const request = {
|
|
1624
|
+
'amount': this.amountToPrecision(symbol, amount),
|
|
1625
|
+
'price': this.priceToPrecision(symbol, price),
|
|
1626
|
+
};
|
|
1627
|
+
const clientOrderId = this.safeString2(params, 'client_order_id', 'clientOrderId');
|
|
1628
|
+
if (clientOrderId !== undefined) {
|
|
1629
|
+
request['client_order_id'] = clientOrderId;
|
|
1630
|
+
params = this.omit(params, ['clientOrderId']);
|
|
1631
|
+
}
|
|
1632
|
+
else {
|
|
1633
|
+
request['id'] = id;
|
|
1634
|
+
}
|
|
1635
|
+
const response = await this.privatePostReplaceOrder(this.extend(request, params));
|
|
1636
|
+
const order = this.parseOrder(response, market);
|
|
1637
|
+
order['type'] = type;
|
|
1638
|
+
return order;
|
|
1639
|
+
}
|
|
1543
1640
|
/**
|
|
1544
1641
|
* @method
|
|
1545
1642
|
* @name bitstamp#cancelOrder
|
|
@@ -1707,6 +1804,71 @@ export default class bitstamp extends Exchange {
|
|
|
1707
1804
|
const result = this.filterBy(response, 'type', '2');
|
|
1708
1805
|
return this.parseTrades(result, market, since, limit);
|
|
1709
1806
|
}
|
|
1807
|
+
/**
|
|
1808
|
+
* @method
|
|
1809
|
+
* @name bitstamp#fetchFundingRateHistory
|
|
1810
|
+
* @description fetches historical funding rate prices
|
|
1811
|
+
* @see https://www.bitstamp.net/api/#tag/Market-info/operation/GetFundingRateHistory
|
|
1812
|
+
* @param {string} symbol unified symbol of the market to fetch the funding rate history for
|
|
1813
|
+
* @param {int} [since] timestamp in ms of the earliest funding rate to fetch
|
|
1814
|
+
* @param {int} [limit] the maximum amount of [funding rate structures]{@link https://docs.ccxt.com/?id=funding-rate-history-structure} to fetch
|
|
1815
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1816
|
+
* @param {int} [params.until] timestamp in ms of the latest funding rate
|
|
1817
|
+
* @param {boolean} [params.paginate] 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)
|
|
1818
|
+
* @param {string} [params.subType] "linear" or "inverse"
|
|
1819
|
+
* @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/?id=funding-rate-history-structure}
|
|
1820
|
+
*/
|
|
1821
|
+
async fetchFundingRateHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
1822
|
+
let paginate = false;
|
|
1823
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchFundingRateHistory', 'paginate');
|
|
1824
|
+
if (paginate) {
|
|
1825
|
+
return await this.fetchPaginatedCallDeterministic('fetchFundingRateHistory', symbol, since, limit, '8h', params);
|
|
1826
|
+
}
|
|
1827
|
+
await this.loadMarkets();
|
|
1828
|
+
let request = {};
|
|
1829
|
+
let market = undefined;
|
|
1830
|
+
if (symbol !== undefined) {
|
|
1831
|
+
market = this.market(symbol);
|
|
1832
|
+
request['pair'] = market['id'];
|
|
1833
|
+
}
|
|
1834
|
+
if (since !== undefined) {
|
|
1835
|
+
request['since_timestamp'] = Math.round(since / 1000);
|
|
1836
|
+
}
|
|
1837
|
+
[request, params] = this.handleUntilOption('until_timestamp', request, params, 0.001);
|
|
1838
|
+
if (limit !== undefined) {
|
|
1839
|
+
request['limit'] = limit;
|
|
1840
|
+
}
|
|
1841
|
+
const response = await this.publicGetFundingRateHistoryPair(this.extend(request, params));
|
|
1842
|
+
//
|
|
1843
|
+
// {
|
|
1844
|
+
// "market": "BTC/USD-PERP",
|
|
1845
|
+
// "funding_rate_history": [
|
|
1846
|
+
// {
|
|
1847
|
+
// "funding_rate": "0.0024",
|
|
1848
|
+
// "timestamp": "1644406050"
|
|
1849
|
+
// }
|
|
1850
|
+
// ]
|
|
1851
|
+
// }
|
|
1852
|
+
//
|
|
1853
|
+
const values = this.safeValue(response, 'funding_rate_history', []);
|
|
1854
|
+
return this.parseFundingRateHistories(values, market, since, limit);
|
|
1855
|
+
}
|
|
1856
|
+
parseFundingRateHistory(contract, market = undefined) {
|
|
1857
|
+
//
|
|
1858
|
+
// {
|
|
1859
|
+
// "funding_rate": "0.0024",
|
|
1860
|
+
// "timestamp": "1644406050"
|
|
1861
|
+
// }
|
|
1862
|
+
//
|
|
1863
|
+
const timestamp = this.safeIntegerProduct(contract, 'timestamp', 0.001);
|
|
1864
|
+
return {
|
|
1865
|
+
'info': contract,
|
|
1866
|
+
'symbol': undefined,
|
|
1867
|
+
'fundingRate': this.safeNumber(contract, 'funding_rate'),
|
|
1868
|
+
'timestamp': timestamp,
|
|
1869
|
+
'datetime': this.iso8601(timestamp),
|
|
1870
|
+
};
|
|
1871
|
+
}
|
|
1710
1872
|
/**
|
|
1711
1873
|
* @method
|
|
1712
1874
|
* @name bitstamp#fetchDepositsWithdrawals
|
|
@@ -2160,6 +2322,65 @@ export default class bitstamp extends Exchange {
|
|
|
2160
2322
|
}
|
|
2161
2323
|
return this.parseLedger(response, currency, since, limit);
|
|
2162
2324
|
}
|
|
2325
|
+
/**
|
|
2326
|
+
* @method
|
|
2327
|
+
* @name bitstamp#fetchFundingRate
|
|
2328
|
+
* @description fetch the current funding rate
|
|
2329
|
+
* @see https://www.bitstamp.net/api/#tag/Market-info/operation/GetFundingRate
|
|
2330
|
+
* @param {string} symbol unified market symbol
|
|
2331
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2332
|
+
* @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
2333
|
+
*/
|
|
2334
|
+
async fetchFundingRate(symbol, params = {}) {
|
|
2335
|
+
await this.loadMarkets();
|
|
2336
|
+
const market = this.market(symbol);
|
|
2337
|
+
const request = {
|
|
2338
|
+
'market_symbol': market['id'],
|
|
2339
|
+
};
|
|
2340
|
+
const response = await this.publicGetFundingRateMarketSymbol(this.extend(request, params));
|
|
2341
|
+
//
|
|
2342
|
+
// {
|
|
2343
|
+
// "funding_rate": "0.0024",
|
|
2344
|
+
// "timestamp": "1644406050",
|
|
2345
|
+
// "market": "BTC/USD-PERP",
|
|
2346
|
+
// "next_funding_time": "1644406050"
|
|
2347
|
+
// }
|
|
2348
|
+
//
|
|
2349
|
+
return this.parseFundingRate(response, market);
|
|
2350
|
+
}
|
|
2351
|
+
parseFundingRate(fundingRate, market = undefined) {
|
|
2352
|
+
//
|
|
2353
|
+
// {
|
|
2354
|
+
// "funding_rate": "0.0024",
|
|
2355
|
+
// "timestamp": "1644406050",
|
|
2356
|
+
// "market": "BTC/USD-PERP",
|
|
2357
|
+
// "next_funding_time": "1644406050"
|
|
2358
|
+
// }
|
|
2359
|
+
//
|
|
2360
|
+
const currentTime = this.safeIntegerProduct(fundingRate, 'timestamp', 1000);
|
|
2361
|
+
const nextFundingRateTimestamp = this.safeIntegerProduct(fundingRate, 'next_funding_time', 1000);
|
|
2362
|
+
const marketId = this.safeString(fundingRate, 'market');
|
|
2363
|
+
return {
|
|
2364
|
+
'info': fundingRate,
|
|
2365
|
+
'symbol': this.safeSymbol(marketId, market),
|
|
2366
|
+
'markPrice': undefined,
|
|
2367
|
+
'indexPrice': undefined,
|
|
2368
|
+
'interestRate': undefined,
|
|
2369
|
+
'estimatedSettlePrice': undefined,
|
|
2370
|
+
'timestamp': currentTime,
|
|
2371
|
+
'datetime': this.iso8601(currentTime),
|
|
2372
|
+
'previousFundingRate': undefined,
|
|
2373
|
+
'nextFundingRate': undefined,
|
|
2374
|
+
'previousFundingTimestamp': undefined,
|
|
2375
|
+
'nextFundingTimestamp': undefined,
|
|
2376
|
+
'previousFundingDatetime': undefined,
|
|
2377
|
+
'nextFundingDatetime': undefined,
|
|
2378
|
+
'fundingRate': this.safeNumber(fundingRate, 'funding_rate'),
|
|
2379
|
+
'fundingTimestamp': nextFundingRateTimestamp,
|
|
2380
|
+
'fundingDatetime': this.iso8601(nextFundingRateTimestamp),
|
|
2381
|
+
'interval': undefined,
|
|
2382
|
+
};
|
|
2383
|
+
}
|
|
2163
2384
|
/**
|
|
2164
2385
|
* @method
|
|
2165
2386
|
* @name bitstamp#fetchOpenOrders
|
package/js/src/bitvavo.js
CHANGED
|
@@ -181,10 +181,18 @@ export default class bitvavo extends Exchange {
|
|
|
181
181
|
'deposit': 1,
|
|
182
182
|
'depositHistory': 5,
|
|
183
183
|
'withdrawalHistory': 5,
|
|
184
|
+
'subaccounts': 5,
|
|
185
|
+
'subaccounts/transfers': 5,
|
|
186
|
+
'subaccounts/transfers/{transferId}': 5,
|
|
187
|
+
'institutional/subaccounts/balance': 5,
|
|
188
|
+
'institutional/subaccounts/history': 5,
|
|
189
|
+
'institutional/subaccounts/orders/open': { 'cost': 1, 'noMarket': 25 },
|
|
184
190
|
},
|
|
185
191
|
'post': {
|
|
186
192
|
'order': 1,
|
|
187
193
|
'withdrawal': 1,
|
|
194
|
+
'subaccounts': 5,
|
|
195
|
+
'subaccounts/transfers': 5,
|
|
188
196
|
},
|
|
189
197
|
'put': {
|
|
190
198
|
'order': 1,
|
|
@@ -192,6 +200,8 @@ export default class bitvavo extends Exchange {
|
|
|
192
200
|
'delete': {
|
|
193
201
|
'order': 1,
|
|
194
202
|
'orders': 1,
|
|
203
|
+
'institutional/subaccounts/order': 1,
|
|
204
|
+
'institutional/subaccounts/orders': 1,
|
|
195
205
|
},
|
|
196
206
|
},
|
|
197
207
|
},
|
package/js/src/blofin.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Exchange from './abstract/blofin.js';
|
|
2
|
-
import type { Int, OrderSide, OrderType, Trade, OHLCV, Order, FundingRateHistory, OrderRequest, Str, Transaction, Ticker, OrderBook, Balances, Tickers, Market, Strings, Currency, Position, TransferEntry, Leverage, Leverages, MarginMode, Num, TradingFeeInterface, Dict, int, LedgerEntry, FundingRate } from './base/types.js';
|
|
2
|
+
import type { Int, OrderSide, OrderType, Trade, OHLCV, Order, FundingRateHistory, OrderRequest, Str, Transaction, Ticker, OrderBook, Balances, Tickers, Market, Strings, Currency, Position, TransferEntry, Leverage, Leverages, MarginMode, Num, TradingFeeInterface, Dict, int, LedgerEntry, FundingRate, ADL } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class blofin
|
|
5
5
|
* @augments Exchange
|
|
@@ -429,6 +429,17 @@ export default class blofin extends Exchange {
|
|
|
429
429
|
* @returns {object} response from the exchange
|
|
430
430
|
*/
|
|
431
431
|
setPositionMode(hedged: boolean, symbol?: Str, params?: {}): Promise<any>;
|
|
432
|
+
/**
|
|
433
|
+
* @method
|
|
434
|
+
* @name blofin#fetchPositionsADLRank
|
|
435
|
+
* @description fetches the auto deleveraging rank and risk percentage for a list of symbols
|
|
436
|
+
* @see https://docs.blofin.com/index.html#get-positions
|
|
437
|
+
* @param {string[]} [symbols] a list of unified market symbols
|
|
438
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
439
|
+
* @returns {object[]} an array of [auto de leverage structures]{@link https://docs.ccxt.com/?id=auto-de-leverage-structure}
|
|
440
|
+
*/
|
|
441
|
+
fetchPositionsADLRank(symbols?: Strings, params?: {}): Promise<ADL[]>;
|
|
442
|
+
parseADLRank(info: Dict, market?: Market): ADL;
|
|
432
443
|
handleErrors(httpCode: int, reason: string, url: string, method: string, headers: Dict, body: string, response: any, requestHeaders: any, requestBody: any): any;
|
|
433
444
|
sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
|
|
434
445
|
url: string;
|
package/js/src/blofin.js
CHANGED
|
@@ -105,6 +105,8 @@ export default class blofin extends Exchange {
|
|
|
105
105
|
'fetchOrders': false,
|
|
106
106
|
'fetchOrderTrades': true,
|
|
107
107
|
'fetchPosition': true,
|
|
108
|
+
'fetchPositionADLRank': true,
|
|
109
|
+
'fetchPositionsADLRank': true,
|
|
108
110
|
'fetchPositionMode': true,
|
|
109
111
|
'fetchPositions': true,
|
|
110
112
|
'fetchPositionsForSymbol': false,
|
|
@@ -2502,6 +2504,89 @@ export default class blofin extends Exchange {
|
|
|
2502
2504
|
//
|
|
2503
2505
|
return await this.privatePostAccountSetPositionMode(this.extend(request, params));
|
|
2504
2506
|
}
|
|
2507
|
+
/**
|
|
2508
|
+
* @method
|
|
2509
|
+
* @name blofin#fetchPositionsADLRank
|
|
2510
|
+
* @description fetches the auto deleveraging rank and risk percentage for a list of symbols
|
|
2511
|
+
* @see https://docs.blofin.com/index.html#get-positions
|
|
2512
|
+
* @param {string[]} [symbols] a list of unified market symbols
|
|
2513
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2514
|
+
* @returns {object[]} an array of [auto de leverage structures]{@link https://docs.ccxt.com/?id=auto-de-leverage-structure}
|
|
2515
|
+
*/
|
|
2516
|
+
async fetchPositionsADLRank(symbols = undefined, params = {}) {
|
|
2517
|
+
await this.loadMarkets();
|
|
2518
|
+
symbols = this.marketSymbols(symbols, undefined, true, true, true);
|
|
2519
|
+
const response = await this.privateGetAccountPositions(params);
|
|
2520
|
+
//
|
|
2521
|
+
// {
|
|
2522
|
+
// "code": "0",
|
|
2523
|
+
// "msg": "success",
|
|
2524
|
+
// "data": [
|
|
2525
|
+
// {
|
|
2526
|
+
// "positionId": "756786",
|
|
2527
|
+
// "instId": "BTC-USDT",
|
|
2528
|
+
// "instType": "SWAP",
|
|
2529
|
+
// "marginMode": "cross",
|
|
2530
|
+
// "positionSide": "net",
|
|
2531
|
+
// "adl": "1",
|
|
2532
|
+
// "positions": "0.1",
|
|
2533
|
+
// "availablePositions": "0.1",
|
|
2534
|
+
// "averagePrice": "88564.9",
|
|
2535
|
+
// "markPrice": "88546.3696492756",
|
|
2536
|
+
// "marginRatio": "822.305183525552961566",
|
|
2537
|
+
// "liquidationPrice": "",
|
|
2538
|
+
// "unrealizedPnl": "-0.00185303507244",
|
|
2539
|
+
// "unrealizedPnlRatio": "-0.000627687178252332",
|
|
2540
|
+
// "initialMargin": "2.951545654975853333",
|
|
2541
|
+
// "maintenanceMargin": "0.02656391089478268",
|
|
2542
|
+
// "createTime": "1767169876207",
|
|
2543
|
+
// "updateTime": "1767169876207",
|
|
2544
|
+
// "leverage": "3"
|
|
2545
|
+
// }
|
|
2546
|
+
// ]
|
|
2547
|
+
// }
|
|
2548
|
+
//
|
|
2549
|
+
const data = this.safeList(response, 'data', []);
|
|
2550
|
+
return this.parseADLRanks(data, symbols);
|
|
2551
|
+
}
|
|
2552
|
+
parseADLRank(info, market = undefined) {
|
|
2553
|
+
//
|
|
2554
|
+
// fetchPositionsADLRank
|
|
2555
|
+
//
|
|
2556
|
+
// {
|
|
2557
|
+
// "positionId": "756786",
|
|
2558
|
+
// "instId": "BTC-USDT",
|
|
2559
|
+
// "instType": "SWAP",
|
|
2560
|
+
// "marginMode": "cross",
|
|
2561
|
+
// "positionSide": "net",
|
|
2562
|
+
// "adl": "1",
|
|
2563
|
+
// "positions": "0.1",
|
|
2564
|
+
// "availablePositions": "0.1",
|
|
2565
|
+
// "averagePrice": "88564.9",
|
|
2566
|
+
// "markPrice": "88546.3696492756",
|
|
2567
|
+
// "marginRatio": "822.305183525552961566",
|
|
2568
|
+
// "liquidationPrice": "",
|
|
2569
|
+
// "unrealizedPnl": "-0.00185303507244",
|
|
2570
|
+
// "unrealizedPnlRatio": "-0.000627687178252332",
|
|
2571
|
+
// "initialMargin": "2.951545654975853333",
|
|
2572
|
+
// "maintenanceMargin": "0.02656391089478268",
|
|
2573
|
+
// "createTime": "1767169876207",
|
|
2574
|
+
// "updateTime": "1767169876207",
|
|
2575
|
+
// "leverage": "3"
|
|
2576
|
+
// }
|
|
2577
|
+
//
|
|
2578
|
+
const marketId = this.safeString(info, 'instId');
|
|
2579
|
+
const timestamp = this.safeIntegerOmitZero(info, 'createTime');
|
|
2580
|
+
return {
|
|
2581
|
+
'info': info,
|
|
2582
|
+
'symbol': this.safeSymbol(marketId, market, undefined, 'contract'),
|
|
2583
|
+
'rank': this.safeInteger(info, 'adl'),
|
|
2584
|
+
'rating': undefined,
|
|
2585
|
+
'percentage': undefined,
|
|
2586
|
+
'timestamp': timestamp,
|
|
2587
|
+
'datetime': this.iso8601(timestamp),
|
|
2588
|
+
};
|
|
2589
|
+
}
|
|
2505
2590
|
handleErrors(httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody) {
|
|
2506
2591
|
if (response === undefined) {
|
|
2507
2592
|
return undefined; // fallback to default error handler
|
package/js/src/btcmarkets.js
CHANGED
|
@@ -1332,7 +1332,7 @@ export default class btcmarkets extends Exchange {
|
|
|
1332
1332
|
await this.loadMarkets();
|
|
1333
1333
|
const currency = this.currency(code);
|
|
1334
1334
|
const request = {
|
|
1335
|
-
'
|
|
1335
|
+
'assetName': currency['id'],
|
|
1336
1336
|
'amount': this.currencyToPrecision(code, amount),
|
|
1337
1337
|
};
|
|
1338
1338
|
if (code !== 'AUD') {
|
package/js/src/bybit.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Exchange from './abstract/bybit.js';
|
|
2
|
-
import type { Int, OrderSide, OrderType, Trade, Order, OHLCV, FundingRateHistory, OpenInterest, OrderRequest, Balances, Str, Transaction, Ticker, OrderBook, Tickers, Greeks, Strings, Market, Currency, MarketInterface, TransferEntry, Liquidation, Leverage, Num, FundingHistory, Option, OptionChain, TradingFeeInterface, Currencies, TradingFees, CancellationRequest, Position, CrossBorrowRate, Dict, LeverageTier, LeverageTiers, int, LedgerEntry, Conversion, FundingRate, FundingRates, DepositAddress, LongShortRatio, BorrowInterest, MarginMode } from './base/types.js';
|
|
2
|
+
import type { Int, OrderSide, OrderType, Trade, Order, OHLCV, FundingRateHistory, OpenInterest, OrderRequest, Balances, Str, Transaction, Ticker, OrderBook, Tickers, Greeks, Strings, Market, Currency, MarketInterface, TransferEntry, Liquidation, Leverage, Num, FundingHistory, Option, OptionChain, TradingFeeInterface, Currencies, TradingFees, CancellationRequest, Position, CrossBorrowRate, Dict, LeverageTier, LeverageTiers, int, LedgerEntry, Conversion, FundingRate, FundingRates, DepositAddress, LongShortRatio, BorrowInterest, MarginMode, ADL } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class bybit
|
|
5
5
|
* @augments Exchange
|
|
@@ -1099,6 +1099,17 @@ export default class bybit extends Exchange {
|
|
|
1099
1099
|
*/
|
|
1100
1100
|
fetchLongShortRatioHistory(symbol?: Str, timeframe?: Str, since?: Int, limit?: Int, params?: {}): Promise<LongShortRatio[]>;
|
|
1101
1101
|
parseLongShortRatio(info: Dict, market?: Market): LongShortRatio;
|
|
1102
|
+
/**
|
|
1103
|
+
* @method
|
|
1104
|
+
* @name bybit#fetchPositionsADLRank
|
|
1105
|
+
* @description fetches the auto deleveraging rank and risk percentage for a list of symbols
|
|
1106
|
+
* @see https://bybit-exchange.github.io/docs/v5/position#response-parameters
|
|
1107
|
+
* @param {string[]} [symbols] list of unified market symbols
|
|
1108
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1109
|
+
* @returns {object[]} an array of [auto de leverage structures]{@link https://docs.ccxt.com/?id=auto-de-leverage-structure}
|
|
1110
|
+
*/
|
|
1111
|
+
fetchPositionsADLRank(symbols?: Strings, params?: {}): Promise<ADL[]>;
|
|
1112
|
+
parseADLRank(info: Dict, market?: Market): ADL;
|
|
1102
1113
|
/**
|
|
1103
1114
|
* @method
|
|
1104
1115
|
* @name bybit#fetchMarginMode
|