ccxt 4.3.20 → 4.3.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/functions/platform.js +3 -1
- package/dist/cjs/src/base/functions.js +1 -0
- package/dist/cjs/src/binance.js +10 -1
- package/dist/cjs/src/bitmex.js +1 -0
- package/dist/cjs/src/coinex.js +142 -179
- package/dist/cjs/src/hyperliquid.js +24 -2
- package/dist/cjs/src/okx.js +3 -0
- package/dist/cjs/src/phemex.js +39 -4
- package/dist/cjs/src/pro/kucoinfutures.js +92 -0
- package/dist/cjs/src/pro/woo.js +52 -24
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/binance.d.ts +1 -0
- package/js/src/abstract/binancecoinm.d.ts +1 -0
- package/js/src/abstract/binanceus.d.ts +1 -0
- package/js/src/abstract/binanceusdm.d.ts +1 -0
- package/js/src/abstract/okx.d.ts +3 -0
- package/js/src/ascendex.d.ts +1 -1
- package/js/src/base/Exchange.d.ts +1 -1
- package/js/src/base/functions/platform.d.ts +2 -1
- package/js/src/base/functions/platform.js +3 -2
- package/js/src/binance.d.ts +1 -1
- package/js/src/binance.js +10 -1
- package/js/src/bingx.d.ts +1 -1
- package/js/src/bitget.d.ts +1 -1
- package/js/src/bitmex.js +1 -0
- package/js/src/coinex.d.ts +1 -1
- package/js/src/coinex.js +142 -179
- package/js/src/delta.d.ts +1 -1
- package/js/src/digifinex.d.ts +1 -1
- package/js/src/exmo.d.ts +1 -1
- package/js/src/gate.d.ts +1 -1
- package/js/src/hitbtc.d.ts +1 -1
- package/js/src/hyperliquid.d.ts +1 -1
- package/js/src/hyperliquid.js +24 -2
- package/js/src/okx.d.ts +1 -1
- package/js/src/okx.js +3 -0
- package/js/src/phemex.d.ts +1 -1
- package/js/src/phemex.js +39 -4
- package/js/src/pro/kucoinfutures.d.ts +3 -1
- package/js/src/pro/kucoinfutures.js +93 -1
- package/js/src/pro/woo.d.ts +2 -1
- package/js/src/pro/woo.js +52 -24
- package/package.json +1 -1
package/dist/cjs/src/phemex.js
CHANGED
|
@@ -1704,6 +1704,26 @@ class phemex extends phemex$1 {
|
|
|
1704
1704
|
// "execId": "8718cae",
|
|
1705
1705
|
// "execStatus": 6
|
|
1706
1706
|
// }
|
|
1707
|
+
// spot with fees paid using PT token
|
|
1708
|
+
// "createdAt": "1714990724076",
|
|
1709
|
+
// "symbol": "BTCUSDT",
|
|
1710
|
+
// "currency": "USDT",
|
|
1711
|
+
// "action": "1",
|
|
1712
|
+
// "tradeType": "1",
|
|
1713
|
+
// "execQtyRq": "0.003",
|
|
1714
|
+
// "execPriceRp": "64935",
|
|
1715
|
+
// "side": "2",
|
|
1716
|
+
// "orderQtyRq": "0.003",
|
|
1717
|
+
// "priceRp": "51600",
|
|
1718
|
+
// "execValueRv": "194.805",
|
|
1719
|
+
// "feeRateRr": "0.000495",
|
|
1720
|
+
// "execFeeRv": "0",
|
|
1721
|
+
// "ordType": "3",
|
|
1722
|
+
// "execId": "XXXXXX",
|
|
1723
|
+
// "execStatus": "7",
|
|
1724
|
+
// "posSide": "1",
|
|
1725
|
+
// "ptFeeRv": "0.110012249248",
|
|
1726
|
+
// "ptPriceRp": "0.876524893"
|
|
1707
1727
|
//
|
|
1708
1728
|
let priceString;
|
|
1709
1729
|
let amountString;
|
|
@@ -1760,10 +1780,19 @@ class phemex extends phemex$1 {
|
|
|
1760
1780
|
priceString = this.safeString(trade, 'execPriceRp');
|
|
1761
1781
|
amountString = this.safeString(trade, 'execQtyRq');
|
|
1762
1782
|
costString = this.safeString(trade, 'execValueRv');
|
|
1763
|
-
feeCostString = this.safeString(trade, 'execFeeRv');
|
|
1783
|
+
feeCostString = this.omitZero(this.safeString(trade, 'execFeeRv'));
|
|
1764
1784
|
feeRateString = this.safeString(trade, 'feeRateRr');
|
|
1765
|
-
|
|
1766
|
-
|
|
1785
|
+
if (feeCostString !== undefined) {
|
|
1786
|
+
const currencyId = this.safeString(trade, 'currency');
|
|
1787
|
+
feeCurrencyCode = this.safeCurrencyCode(currencyId);
|
|
1788
|
+
}
|
|
1789
|
+
else {
|
|
1790
|
+
const ptFeeRv = this.omitZero(this.safeString(trade, 'ptFeeRv'));
|
|
1791
|
+
if (ptFeeRv !== undefined) {
|
|
1792
|
+
feeCostString = ptFeeRv;
|
|
1793
|
+
feeCurrencyCode = 'PT';
|
|
1794
|
+
}
|
|
1795
|
+
}
|
|
1767
1796
|
}
|
|
1768
1797
|
else {
|
|
1769
1798
|
side = this.safeStringLower(trade, 'side');
|
|
@@ -1776,7 +1805,7 @@ class phemex extends phemex$1 {
|
|
|
1776
1805
|
amountString = this.fromEv(this.safeString(trade, 'execBaseQtyEv'), market);
|
|
1777
1806
|
amountString = this.safeString(trade, 'execQty', amountString);
|
|
1778
1807
|
costString = this.fromEr(this.safeString2(trade, 'execQuoteQtyEv', 'execValueEv'), market);
|
|
1779
|
-
feeCostString = this.fromEr(this.safeString(trade, 'execFeeEv'), market);
|
|
1808
|
+
feeCostString = this.fromEr(this.omitZero(this.safeString(trade, 'execFeeEv')), market);
|
|
1780
1809
|
if (feeCostString !== undefined) {
|
|
1781
1810
|
feeRateString = this.fromEr(this.safeString(trade, 'feeRateEr'), market);
|
|
1782
1811
|
if (market['spot']) {
|
|
@@ -1790,6 +1819,12 @@ class phemex extends phemex$1 {
|
|
|
1790
1819
|
}
|
|
1791
1820
|
}
|
|
1792
1821
|
}
|
|
1822
|
+
else {
|
|
1823
|
+
feeCostString = this.safeString(trade, 'ptFeeRv');
|
|
1824
|
+
if (feeCostString !== undefined) {
|
|
1825
|
+
feeCurrencyCode = 'PT';
|
|
1826
|
+
}
|
|
1827
|
+
}
|
|
1793
1828
|
}
|
|
1794
1829
|
fee = {
|
|
1795
1830
|
'cost': feeCostString,
|
|
@@ -15,6 +15,7 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
15
15
|
'watchTickers': true,
|
|
16
16
|
'watchBidsAsks': true,
|
|
17
17
|
'watchTrades': true,
|
|
18
|
+
'watchOHLCV': true,
|
|
18
19
|
'watchOrderBook': true,
|
|
19
20
|
'watchOrders': true,
|
|
20
21
|
'watchBalance': true,
|
|
@@ -25,6 +26,21 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
25
26
|
'watchOrderBookForSymbols': true,
|
|
26
27
|
},
|
|
27
28
|
'options': {
|
|
29
|
+
'timeframes': {
|
|
30
|
+
'1m': '1min',
|
|
31
|
+
'3m': '1min',
|
|
32
|
+
'5m': '5min',
|
|
33
|
+
'15m': '15min',
|
|
34
|
+
'30m': '30min',
|
|
35
|
+
'1h': '1hour',
|
|
36
|
+
'2h': '2hour',
|
|
37
|
+
'4h': '4hour',
|
|
38
|
+
'8h': '8hour',
|
|
39
|
+
'12h': '12hour',
|
|
40
|
+
'1d': '1day',
|
|
41
|
+
'1w': '1week',
|
|
42
|
+
'1M': '1month',
|
|
43
|
+
},
|
|
28
44
|
'accountsByType': {
|
|
29
45
|
'swap': 'future',
|
|
30
46
|
'cross': 'margin',
|
|
@@ -567,6 +583,81 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
567
583
|
client.resolve(trades, messageHash);
|
|
568
584
|
return message;
|
|
569
585
|
}
|
|
586
|
+
async watchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
|
|
587
|
+
/**
|
|
588
|
+
* @method
|
|
589
|
+
* @name kucoinfutures#watchOHLCV
|
|
590
|
+
* @see https://www.kucoin.com/docs/websocket/futures-trading/public-channels/klines
|
|
591
|
+
* @description watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
592
|
+
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
593
|
+
* @param {string} timeframe the length of time each candle represents
|
|
594
|
+
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
595
|
+
* @param {int} [limit] the maximum amount of candles to fetch
|
|
596
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
597
|
+
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
598
|
+
*/
|
|
599
|
+
await this.loadMarkets();
|
|
600
|
+
symbol = this.symbol(symbol);
|
|
601
|
+
const url = await this.negotiate(false);
|
|
602
|
+
const marketId = this.marketId(symbol);
|
|
603
|
+
const timeframes = this.safeDict(this.options, 'timeframes');
|
|
604
|
+
const timeframeId = this.safeString(timeframes, timeframe, timeframe);
|
|
605
|
+
const topic = '/contractMarket/limitCandle:' + marketId + '_' + timeframeId;
|
|
606
|
+
const messageHash = 'ohlcv::' + symbol + '_' + timeframe;
|
|
607
|
+
const ohlcv = await this.subscribe(url, messageHash, topic, undefined, params);
|
|
608
|
+
if (this.newUpdates) {
|
|
609
|
+
limit = ohlcv.getLimit(symbol, limit);
|
|
610
|
+
}
|
|
611
|
+
return this.filterBySinceLimit(ohlcv, since, limit, 0, true);
|
|
612
|
+
}
|
|
613
|
+
handleOHLCV(client, message) {
|
|
614
|
+
//
|
|
615
|
+
// {
|
|
616
|
+
// "topic":"/contractMarket/limitCandle:LTCUSDTM_1min",
|
|
617
|
+
// "type":"message",
|
|
618
|
+
// "data":{
|
|
619
|
+
// "symbol":"LTCUSDTM",
|
|
620
|
+
// "candles":[
|
|
621
|
+
// "1715470980",
|
|
622
|
+
// "81.38",
|
|
623
|
+
// "81.38",
|
|
624
|
+
// "81.38",
|
|
625
|
+
// "81.38",
|
|
626
|
+
// "61.0",
|
|
627
|
+
// "61"
|
|
628
|
+
// ],
|
|
629
|
+
// "time":1715470994801
|
|
630
|
+
// },
|
|
631
|
+
// "subject":"candle.stick"
|
|
632
|
+
// }
|
|
633
|
+
//
|
|
634
|
+
const topic = this.safeString(message, 'topic');
|
|
635
|
+
const parts = topic.split('_');
|
|
636
|
+
const timeframeId = this.safeString(parts, 1);
|
|
637
|
+
const data = this.safeDict(message, 'data');
|
|
638
|
+
const timeframes = this.safeDict(this.options, 'timeframes');
|
|
639
|
+
const timeframe = this.findTimeframe(timeframeId, timeframes);
|
|
640
|
+
const marketId = this.safeString(data, 'symbol');
|
|
641
|
+
const symbol = this.safeSymbol(marketId);
|
|
642
|
+
const messageHash = 'ohlcv::' + symbol + '_' + timeframe;
|
|
643
|
+
const ohlcv = this.safeList(data, 'candles');
|
|
644
|
+
const parsed = [
|
|
645
|
+
this.safeInteger(ohlcv, 0),
|
|
646
|
+
this.safeNumber(ohlcv, 1),
|
|
647
|
+
this.safeNumber(ohlcv, 2),
|
|
648
|
+
this.safeNumber(ohlcv, 3),
|
|
649
|
+
this.safeNumber(ohlcv, 4),
|
|
650
|
+
this.safeNumber(ohlcv, 6), // Note value 5 is incorrect and will be fixed in subsequent versions of kucoin
|
|
651
|
+
];
|
|
652
|
+
this.ohlcvs[symbol] = this.safeDict(this.ohlcvs, symbol, {});
|
|
653
|
+
if (!(timeframe in this.ohlcvs[symbol])) {
|
|
654
|
+
const limit = this.safeInteger(this.options, 'OHLCVLimit', 1000);
|
|
655
|
+
this.ohlcvs[symbol][timeframe] = new Cache.ArrayCacheByTimestamp(limit);
|
|
656
|
+
}
|
|
657
|
+
const stored = this.ohlcvs[symbol][timeframe];
|
|
658
|
+
stored.append(parsed);
|
|
659
|
+
client.resolve(stored, messageHash);
|
|
660
|
+
}
|
|
570
661
|
async watchOrderBook(symbol, limit = undefined, params = {}) {
|
|
571
662
|
/**
|
|
572
663
|
* @method
|
|
@@ -983,6 +1074,7 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
983
1074
|
const methods = {
|
|
984
1075
|
'level2': this.handleOrderBook,
|
|
985
1076
|
'ticker': this.handleTicker,
|
|
1077
|
+
'candle.stick': this.handleOHLCV,
|
|
986
1078
|
'tickerV2': this.handleBidAsk,
|
|
987
1079
|
'availableBalance.change': this.handleBalance,
|
|
988
1080
|
'match': this.handleTrade,
|
package/dist/cjs/src/pro/woo.js
CHANGED
|
@@ -547,6 +547,16 @@ class woo extends woo$1 {
|
|
|
547
547
|
const request = this.extend(subscribe, message);
|
|
548
548
|
return await this.watch(url, messageHash, request, messageHash, subscribe);
|
|
549
549
|
}
|
|
550
|
+
async watchPrivateMultiple(messageHashes, message, params = {}) {
|
|
551
|
+
await this.authenticate(params);
|
|
552
|
+
const url = this.urls['api']['ws']['private'] + '/' + this.uid;
|
|
553
|
+
const requestId = this.requestId(url);
|
|
554
|
+
const subscribe = {
|
|
555
|
+
'id': requestId,
|
|
556
|
+
};
|
|
557
|
+
const request = this.extend(subscribe, message);
|
|
558
|
+
return await this.watchMultiple(url, messageHashes, request, messageHashes, subscribe);
|
|
559
|
+
}
|
|
550
560
|
async watchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
551
561
|
/**
|
|
552
562
|
* @method
|
|
@@ -558,10 +568,13 @@ class woo extends woo$1 {
|
|
|
558
568
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
559
569
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
560
570
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
571
|
+
* @param {bool} [params.trigger] true if trigger order
|
|
561
572
|
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
562
573
|
*/
|
|
563
574
|
await this.loadMarkets();
|
|
564
|
-
const
|
|
575
|
+
const trigger = this.safeBool2(params, 'stop', 'trigger', false);
|
|
576
|
+
const topic = (trigger) ? 'algoexecutionreportv2' : 'executionreport';
|
|
577
|
+
params = this.omit(params, ['stop', 'trigger']);
|
|
565
578
|
let messageHash = topic;
|
|
566
579
|
if (symbol !== undefined) {
|
|
567
580
|
const market = this.market(symbol);
|
|
@@ -584,15 +597,19 @@ class woo extends woo$1 {
|
|
|
584
597
|
* @method
|
|
585
598
|
* @name woo#watchOrders
|
|
586
599
|
* @see https://docs.woo.org/#executionreport
|
|
600
|
+
* @see https://docs.woo.org/#algoexecutionreportv2
|
|
587
601
|
* @description watches information on multiple trades made by the user
|
|
588
602
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
589
603
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
590
604
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
591
605
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
606
|
+
* @param {bool} [params.trigger] true if trigger order
|
|
592
607
|
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
593
608
|
*/
|
|
594
609
|
await this.loadMarkets();
|
|
595
|
-
const
|
|
610
|
+
const trigger = this.safeBool2(params, 'stop', 'trigger', false);
|
|
611
|
+
const topic = (trigger) ? 'algoexecutionreportv2' : 'executionreport';
|
|
612
|
+
params = this.omit(params, ['stop', 'trigger']);
|
|
596
613
|
let messageHash = 'myTrades';
|
|
597
614
|
if (symbol !== undefined) {
|
|
598
615
|
const market = this.market(symbol);
|
|
@@ -718,15 +735,29 @@ class woo extends woo$1 {
|
|
|
718
735
|
// }
|
|
719
736
|
// }
|
|
720
737
|
//
|
|
721
|
-
const
|
|
722
|
-
const
|
|
723
|
-
if ((
|
|
724
|
-
|
|
738
|
+
const topic = this.safeString(message, 'topic');
|
|
739
|
+
const data = this.safeValue(message, 'data');
|
|
740
|
+
if (Array.isArray(data)) {
|
|
741
|
+
// algoexecutionreportv2
|
|
742
|
+
for (let i = 0; i < data.length; i++) {
|
|
743
|
+
const order = data[i];
|
|
744
|
+
const tradeId = this.omitZero(this.safeString(data, 'tradeId'));
|
|
745
|
+
if (tradeId !== undefined) {
|
|
746
|
+
this.handleMyTrade(client, order);
|
|
747
|
+
}
|
|
748
|
+
this.handleOrder(client, order, topic);
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
else {
|
|
752
|
+
// executionreport
|
|
753
|
+
const tradeId = this.omitZero(this.safeString(data, 'tradeId'));
|
|
754
|
+
if (tradeId !== undefined) {
|
|
755
|
+
this.handleMyTrade(client, data);
|
|
756
|
+
}
|
|
757
|
+
this.handleOrder(client, data, topic);
|
|
725
758
|
}
|
|
726
|
-
this.handleOrder(client, order);
|
|
727
759
|
}
|
|
728
|
-
handleOrder(client, message) {
|
|
729
|
-
const topic = 'executionreport';
|
|
760
|
+
handleOrder(client, message, topic) {
|
|
730
761
|
const parsed = this.parseWsOrder(message);
|
|
731
762
|
const symbol = this.safeString(parsed, 'symbol');
|
|
732
763
|
const orderId = this.safeString(parsed, 'id');
|
|
@@ -811,12 +842,17 @@ class woo extends woo$1 {
|
|
|
811
842
|
* @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/en/latest/manual.html#position-structure}
|
|
812
843
|
*/
|
|
813
844
|
await this.loadMarkets();
|
|
814
|
-
|
|
845
|
+
const messageHashes = [];
|
|
815
846
|
symbols = this.marketSymbols(symbols);
|
|
816
847
|
if (!this.isEmpty(symbols)) {
|
|
817
|
-
|
|
848
|
+
for (let i = 0; i < symbols.length; i++) {
|
|
849
|
+
const symbol = symbols[i];
|
|
850
|
+
messageHashes.push('positions::' + symbol);
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
else {
|
|
854
|
+
messageHashes.push('positions');
|
|
818
855
|
}
|
|
819
|
-
messageHash = 'positions' + messageHash;
|
|
820
856
|
const url = this.urls['api']['ws']['private'] + '/' + this.uid;
|
|
821
857
|
const client = this.client(url);
|
|
822
858
|
this.setPositionsCache(client, symbols);
|
|
@@ -830,7 +866,7 @@ class woo extends woo$1 {
|
|
|
830
866
|
'event': 'subscribe',
|
|
831
867
|
'topic': 'position',
|
|
832
868
|
};
|
|
833
|
-
const newPositions = await this.
|
|
869
|
+
const newPositions = await this.watchPrivateMultiple(messageHashes, request, params);
|
|
834
870
|
if (this.newUpdates) {
|
|
835
871
|
return newPositions;
|
|
836
872
|
}
|
|
@@ -906,17 +942,8 @@ class woo extends woo$1 {
|
|
|
906
942
|
const position = this.parsePosition(rawPosition, market);
|
|
907
943
|
newPositions.push(position);
|
|
908
944
|
cache.append(position);
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
for (let i = 0; i < messageHashes.length; i++) {
|
|
912
|
-
const messageHash = messageHashes[i];
|
|
913
|
-
const parts = messageHash.split('::');
|
|
914
|
-
const symbolsString = parts[1];
|
|
915
|
-
const symbols = symbolsString.split(',');
|
|
916
|
-
const positions = this.filterByArray(newPositions, 'symbol', symbols, false);
|
|
917
|
-
if (!this.isEmpty(positions)) {
|
|
918
|
-
client.resolve(positions, messageHash);
|
|
919
|
-
}
|
|
945
|
+
const messageHash = 'positions::' + market['symbol'];
|
|
946
|
+
client.resolve(position, messageHash);
|
|
920
947
|
}
|
|
921
948
|
client.resolve(newPositions, 'positions');
|
|
922
949
|
}
|
|
@@ -1037,6 +1064,7 @@ class woo extends woo$1 {
|
|
|
1037
1064
|
'kline': this.handleOHLCV,
|
|
1038
1065
|
'auth': this.handleAuth,
|
|
1039
1066
|
'executionreport': this.handleOrderUpdate,
|
|
1067
|
+
'algoexecutionreportv2': this.handleOrderUpdate,
|
|
1040
1068
|
'trade': this.handleTrade,
|
|
1041
1069
|
'balance': this.handleBalance,
|
|
1042
1070
|
'position': this.handlePositions,
|
package/js/ccxt.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import * as functions from './src/base/functions.js';
|
|
|
4
4
|
import * as errors from './src/base/errors.js';
|
|
5
5
|
import type { Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation, FundingHistory, MarginMode, Greeks, Leverage, Leverages, Option, OptionChain, Conversion } from './src/base/types.js';
|
|
6
6
|
import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, ProxyError, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout } from './src/base/errors.js';
|
|
7
|
-
declare const version = "4.3.
|
|
7
|
+
declare const version = "4.3.21";
|
|
8
8
|
import ace from './src/ace.js';
|
|
9
9
|
import alpaca from './src/alpaca.js';
|
|
10
10
|
import ascendex from './src/ascendex.js';
|
package/js/ccxt.js
CHANGED
|
@@ -38,7 +38,7 @@ import * as errors from './src/base/errors.js';
|
|
|
38
38
|
import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, ProxyError, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout } from './src/base/errors.js';
|
|
39
39
|
//-----------------------------------------------------------------------------
|
|
40
40
|
// this is updated by vss.js when building
|
|
41
|
-
const version = '4.3.
|
|
41
|
+
const version = '4.3.22';
|
|
42
42
|
Exchange.ccxtVersion = version;
|
|
43
43
|
//-----------------------------------------------------------------------------
|
|
44
44
|
import ace from './src/ace.js';
|
|
@@ -464,6 +464,7 @@ interface Exchange {
|
|
|
464
464
|
fapiPublicGetContinuousKlines(params?: {}): Promise<implicitReturnType>;
|
|
465
465
|
fapiPublicGetMarkPriceKlines(params?: {}): Promise<implicitReturnType>;
|
|
466
466
|
fapiPublicGetIndexPriceKlines(params?: {}): Promise<implicitReturnType>;
|
|
467
|
+
fapiPublicGetPremiumIndexKlines(params?: {}): Promise<implicitReturnType>;
|
|
467
468
|
fapiPublicGetFundingRate(params?: {}): Promise<implicitReturnType>;
|
|
468
469
|
fapiPublicGetFundingInfo(params?: {}): Promise<implicitReturnType>;
|
|
469
470
|
fapiPublicGetPremiumIndex(params?: {}): Promise<implicitReturnType>;
|
|
@@ -464,6 +464,7 @@ interface binance {
|
|
|
464
464
|
fapiPublicGetContinuousKlines(params?: {}): Promise<implicitReturnType>;
|
|
465
465
|
fapiPublicGetMarkPriceKlines(params?: {}): Promise<implicitReturnType>;
|
|
466
466
|
fapiPublicGetIndexPriceKlines(params?: {}): Promise<implicitReturnType>;
|
|
467
|
+
fapiPublicGetPremiumIndexKlines(params?: {}): Promise<implicitReturnType>;
|
|
467
468
|
fapiPublicGetFundingRate(params?: {}): Promise<implicitReturnType>;
|
|
468
469
|
fapiPublicGetFundingInfo(params?: {}): Promise<implicitReturnType>;
|
|
469
470
|
fapiPublicGetPremiumIndex(params?: {}): Promise<implicitReturnType>;
|
|
@@ -516,6 +516,7 @@ interface binance {
|
|
|
516
516
|
fapiPublicGetContinuousKlines(params?: {}): Promise<implicitReturnType>;
|
|
517
517
|
fapiPublicGetMarkPriceKlines(params?: {}): Promise<implicitReturnType>;
|
|
518
518
|
fapiPublicGetIndexPriceKlines(params?: {}): Promise<implicitReturnType>;
|
|
519
|
+
fapiPublicGetPremiumIndexKlines(params?: {}): Promise<implicitReturnType>;
|
|
519
520
|
fapiPublicGetFundingRate(params?: {}): Promise<implicitReturnType>;
|
|
520
521
|
fapiPublicGetFundingInfo(params?: {}): Promise<implicitReturnType>;
|
|
521
522
|
fapiPublicGetPremiumIndex(params?: {}): Promise<implicitReturnType>;
|
|
@@ -464,6 +464,7 @@ interface binance {
|
|
|
464
464
|
fapiPublicGetContinuousKlines(params?: {}): Promise<implicitReturnType>;
|
|
465
465
|
fapiPublicGetMarkPriceKlines(params?: {}): Promise<implicitReturnType>;
|
|
466
466
|
fapiPublicGetIndexPriceKlines(params?: {}): Promise<implicitReturnType>;
|
|
467
|
+
fapiPublicGetPremiumIndexKlines(params?: {}): Promise<implicitReturnType>;
|
|
467
468
|
fapiPublicGetFundingRate(params?: {}): Promise<implicitReturnType>;
|
|
468
469
|
fapiPublicGetFundingInfo(params?: {}): Promise<implicitReturnType>;
|
|
469
470
|
fapiPublicGetPremiumIndex(params?: {}): Promise<implicitReturnType>;
|
package/js/src/abstract/okx.d.ts
CHANGED
|
@@ -58,6 +58,9 @@ interface Exchange {
|
|
|
58
58
|
publicGetSprdBooks(params?: {}): Promise<implicitReturnType>;
|
|
59
59
|
publicGetSprdTicker(params?: {}): Promise<implicitReturnType>;
|
|
60
60
|
publicGetSprdPublicTrades(params?: {}): Promise<implicitReturnType>;
|
|
61
|
+
publicGetMarketSprdTicker(params?: {}): Promise<implicitReturnType>;
|
|
62
|
+
publicGetMarketSprdCandles(params?: {}): Promise<implicitReturnType>;
|
|
63
|
+
publicGetMarketSprdHistoryCandles(params?: {}): Promise<implicitReturnType>;
|
|
61
64
|
publicGetTradingBotGridAiParam(params?: {}): Promise<implicitReturnType>;
|
|
62
65
|
publicGetTradingBotGridMinInvestment(params?: {}): Promise<implicitReturnType>;
|
|
63
66
|
publicGetTradingBotPublicRsiBackTesting(params?: {}): Promise<implicitReturnType>;
|
package/js/src/ascendex.d.ts
CHANGED
|
@@ -71,7 +71,7 @@ export default class ascendex extends Exchange {
|
|
|
71
71
|
};
|
|
72
72
|
fetchFundingRates(symbols?: Strings, params?: {}): Promise<any>;
|
|
73
73
|
modifyMarginHelper(symbol: string, amount: any, type: any, params?: {}): Promise<MarginModification>;
|
|
74
|
-
parseMarginModification(data:
|
|
74
|
+
parseMarginModification(data: Dict, market?: Market): MarginModification;
|
|
75
75
|
reduceMargin(symbol: string, amount: number, params?: {}): Promise<MarginModification>;
|
|
76
76
|
addMargin(symbol: string, amount: number, params?: {}): Promise<MarginModification>;
|
|
77
77
|
setLeverage(leverage: Int, symbol?: Str, params?: {}): Promise<any>;
|
|
@@ -1091,7 +1091,7 @@ export default class Exchange {
|
|
|
1091
1091
|
convertMarketIdExpireDate(date: string): string;
|
|
1092
1092
|
fetchPositionHistory(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Position>;
|
|
1093
1093
|
fetchPositionsHistory(symbols?: Strings, since?: Int, limit?: Int, params?: {}): Promise<Position[]>;
|
|
1094
|
-
parseMarginModification(data:
|
|
1094
|
+
parseMarginModification(data: Dict, market?: Market): MarginModification;
|
|
1095
1095
|
parseMarginModifications(response: object[], symbols?: string[], symbolKey?: Str, marketType?: MarketType): MarginModification[];
|
|
1096
1096
|
fetchTransfer(id: string, code?: Str, params?: {}): Promise<TransferEntry>;
|
|
1097
1097
|
fetchTransfers(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<TransferEntries>;
|
|
@@ -2,5 +2,6 @@ declare const isBrowser: boolean;
|
|
|
2
2
|
declare const isElectron: boolean;
|
|
3
3
|
declare const isWebWorker: boolean;
|
|
4
4
|
declare const isWindows: boolean;
|
|
5
|
+
declare const isDeno: boolean;
|
|
5
6
|
declare const isNode: boolean;
|
|
6
|
-
export { isBrowser, isElectron, isWebWorker, isNode, isWindows, };
|
|
7
|
+
export { isBrowser, isElectron, isWebWorker, isNode, isDeno, isWindows, };
|
|
@@ -21,6 +21,7 @@ const isElectron = typeof process !== 'undefined' &&
|
|
|
21
21
|
typeof process.versions.electron !== 'undefined';
|
|
22
22
|
const isWebWorker = typeof WorkerGlobalScope !== 'undefined' && (self instanceof WorkerGlobalScope);
|
|
23
23
|
const isWindows = typeof process !== 'undefined' && process.platform === "win32";
|
|
24
|
-
const
|
|
24
|
+
const isDeno = typeof Deno !== 'undefined';
|
|
25
|
+
const isNode = !(isBrowser || isWebWorker || isDeno);
|
|
25
26
|
// ----------------------------------------------------------------------------
|
|
26
|
-
export { isBrowser, isElectron, isWebWorker, isNode, isWindows, };
|
|
27
|
+
export { isBrowser, isElectron, isWebWorker, isNode, isDeno, isWindows, };
|
package/js/src/binance.d.ts
CHANGED
|
@@ -280,7 +280,7 @@ export default class binance extends Exchange {
|
|
|
280
280
|
calculateRateLimiterCost(api: any, method: any, path: any, params: any, config?: {}): any;
|
|
281
281
|
request(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any, config?: {}): Promise<any>;
|
|
282
282
|
modifyMarginHelper(symbol: string, amount: any, addOrReduce: any, params?: {}): Promise<any>;
|
|
283
|
-
parseMarginModification(data:
|
|
283
|
+
parseMarginModification(data: Dict, market?: Market): MarginModification;
|
|
284
284
|
reduceMargin(symbol: string, amount: number, params?: {}): Promise<MarginModification>;
|
|
285
285
|
addMargin(symbol: string, amount: number, params?: {}): Promise<MarginModification>;
|
|
286
286
|
fetchCrossBorrowRate(code: string, params?: {}): Promise<CrossBorrowRate>;
|
package/js/src/binance.js
CHANGED
|
@@ -133,7 +133,7 @@ export default class binance extends Exchange {
|
|
|
133
133
|
'fetchPositions': true,
|
|
134
134
|
'fetchPositionsHistory': false,
|
|
135
135
|
'fetchPositionsRisk': true,
|
|
136
|
-
'fetchPremiumIndexOHLCV':
|
|
136
|
+
'fetchPremiumIndexOHLCV': true,
|
|
137
137
|
'fetchSettlementHistory': true,
|
|
138
138
|
'fetchStatus': true,
|
|
139
139
|
'fetchTicker': true,
|
|
@@ -782,6 +782,7 @@ export default class binance extends Exchange {
|
|
|
782
782
|
'continuousKlines': { 'cost': 1, 'byLimit': [[99, 1], [499, 2], [1000, 5], [10000, 10]] },
|
|
783
783
|
'markPriceKlines': { 'cost': 1, 'byLimit': [[99, 1], [499, 2], [1000, 5], [10000, 10]] },
|
|
784
784
|
'indexPriceKlines': { 'cost': 1, 'byLimit': [[99, 1], [499, 2], [1000, 5], [10000, 10]] },
|
|
785
|
+
'premiumIndexKlines': { 'cost': 1, 'byLimit': [[99, 1], [499, 2], [1000, 5], [10000, 10]] },
|
|
785
786
|
'fundingRate': 1,
|
|
786
787
|
'fundingInfo': 1,
|
|
787
788
|
'premiumIndex': 1,
|
|
@@ -4299,6 +4300,14 @@ export default class binance extends Exchange {
|
|
|
4299
4300
|
response = await this.fapiPublicGetIndexPriceKlines(this.extend(request, params));
|
|
4300
4301
|
}
|
|
4301
4302
|
}
|
|
4303
|
+
else if (price === 'premiumIndex') {
|
|
4304
|
+
if (market['inverse']) {
|
|
4305
|
+
response = await this.dapiPublicGetPremiumIndexKlines(this.extend(request, params));
|
|
4306
|
+
}
|
|
4307
|
+
else {
|
|
4308
|
+
response = await this.fapiPublicGetPremiumIndexKlines(this.extend(request, params));
|
|
4309
|
+
}
|
|
4310
|
+
}
|
|
4302
4311
|
else if (market['linear']) {
|
|
4303
4312
|
response = await this.fapiPublicGetKlines(this.extend(request, params));
|
|
4304
4313
|
}
|
package/js/src/bingx.d.ts
CHANGED
|
@@ -104,7 +104,7 @@ export default class bingx extends Exchange {
|
|
|
104
104
|
addMargin(symbol: string, amount: number, params?: {}): Promise<MarginModification>;
|
|
105
105
|
reduceMargin(symbol: string, amount: number, params?: {}): Promise<MarginModification>;
|
|
106
106
|
setMargin(symbol: string, amount: number, params?: {}): Promise<MarginModification>;
|
|
107
|
-
parseMarginModification(data:
|
|
107
|
+
parseMarginModification(data: Dict, market?: Market): MarginModification;
|
|
108
108
|
fetchLeverage(symbol: string, params?: {}): Promise<Leverage>;
|
|
109
109
|
parseLeverage(leverage: Dict, market?: Market): Leverage;
|
|
110
110
|
setLeverage(leverage: Int, symbol?: Str, params?: {}): Promise<any>;
|
package/js/src/bitget.d.ts
CHANGED
|
@@ -144,7 +144,7 @@ export default class bitget extends Exchange {
|
|
|
144
144
|
};
|
|
145
145
|
parseFundingHistories(contracts: any, market?: any, since?: Int, limit?: Int): FundingHistory[];
|
|
146
146
|
modifyMarginHelper(symbol: string, amount: any, type: any, params?: {}): Promise<MarginModification>;
|
|
147
|
-
parseMarginModification(data:
|
|
147
|
+
parseMarginModification(data: Dict, market?: Market): MarginModification;
|
|
148
148
|
reduceMargin(symbol: string, amount: number, params?: {}): Promise<MarginModification>;
|
|
149
149
|
addMargin(symbol: string, amount: number, params?: {}): Promise<MarginModification>;
|
|
150
150
|
fetchLeverage(symbol: string, params?: {}): Promise<Leverage>;
|
package/js/src/bitmex.js
CHANGED
|
@@ -244,6 +244,7 @@ export default class bitmex extends Exchange {
|
|
|
244
244
|
'orderQty is invalid': InvalidOrder,
|
|
245
245
|
'Invalid price': InvalidOrder,
|
|
246
246
|
'Invalid stopPx for ordType': InvalidOrder,
|
|
247
|
+
'Account is restricted': PermissionDenied, // {"error":{"message":"Account is restricted","name":"HTTPError"}}
|
|
247
248
|
},
|
|
248
249
|
'broad': {
|
|
249
250
|
'Signature not valid': AuthenticationError,
|
package/js/src/coinex.d.ts
CHANGED
|
@@ -73,7 +73,7 @@ export default class coinex extends Exchange {
|
|
|
73
73
|
fetchLeverageTiers(symbols?: Strings, params?: {}): Promise<{}>;
|
|
74
74
|
parseMarketLeverageTiers(info: any, market?: Market): any[];
|
|
75
75
|
modifyMarginHelper(symbol: string, amount: any, addOrReduce: any, params?: {}): Promise<any>;
|
|
76
|
-
parseMarginModification(data:
|
|
76
|
+
parseMarginModification(data: Dict, market?: Market): MarginModification;
|
|
77
77
|
addMargin(symbol: string, amount: number, params?: {}): Promise<MarginModification>;
|
|
78
78
|
reduceMargin(symbol: string, amount: number, params?: {}): Promise<MarginModification>;
|
|
79
79
|
fetchFundingHistory(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<FundingHistory[]>;
|