ccxt 4.5.11 → 4.5.12
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 +30 -30
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/apex.js +9 -0
- package/dist/cjs/src/base/Exchange.js +1 -1
- package/dist/cjs/src/base/functions/throttle.js +1 -1
- package/dist/cjs/src/binance.js +1 -1
- package/dist/cjs/src/bitget.js +15 -0
- package/dist/cjs/src/bitmart.js +2 -2
- package/dist/cjs/src/bybit.js +28 -7
- package/dist/cjs/src/coincatch.js +2 -1
- package/dist/cjs/src/krakenfutures.js +26 -5
- package/dist/cjs/src/okx.js +18 -9
- package/dist/cjs/src/pro/alpaca.js +17 -1
- package/dist/cjs/src/pro/apex.js +17 -0
- package/dist/cjs/src/pro/binance.js +5 -5
- package/dist/cjs/src/pro/bitget.js +9 -3
- package/dist/cjs/src/pro/coinbase.js +8 -7
- package/dist/cjs/src/pro/hyperliquid.js +4 -0
- package/dist/cjs/src/pro/mexc.js +1 -1
- package/dist/cjs/src/pro/woo.js +48 -4
- package/dist/cjs/src/woo.js +20 -2
- package/dist/cjs/src/xt.js +1 -1
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/xt.d.ts +1 -1
- package/js/src/apex.js +9 -0
- package/js/src/base/Exchange.js +1 -1
- package/js/src/base/functions/throttle.js +1 -1
- package/js/src/binance.js +1 -1
- package/js/src/bitget.d.ts +14 -1
- package/js/src/bitget.js +15 -0
- package/js/src/bitmart.js +2 -2
- package/js/src/bybit.js +28 -7
- package/js/src/coincatch.js +2 -1
- package/js/src/krakenfutures.js +26 -5
- package/js/src/okx.js +18 -9
- package/js/src/pro/alpaca.js +17 -1
- package/js/src/pro/apex.d.ts +2 -0
- package/js/src/pro/apex.js +18 -1
- package/js/src/pro/binance.js +5 -5
- package/js/src/pro/bitget.js +9 -3
- package/js/src/pro/coinbase.js +8 -7
- package/js/src/pro/hyperliquid.js +4 -0
- package/js/src/pro/mexc.js +1 -1
- package/js/src/pro/woo.js +48 -4
- package/js/src/woo.js +20 -2
- package/js/src/xt.js +1 -1
- package/package.json +1 -1
package/dist/cjs/ccxt.js
CHANGED
|
@@ -187,7 +187,7 @@ var xt$1 = require('./src/pro/xt.js');
|
|
|
187
187
|
// ----------------------------------------------------------------------------
|
|
188
188
|
//-----------------------------------------------------------------------------
|
|
189
189
|
// this is updated by vss.js when building
|
|
190
|
-
const version = '4.5.
|
|
190
|
+
const version = '4.5.12';
|
|
191
191
|
Exchange["default"].ccxtVersion = version;
|
|
192
192
|
const exchanges = {
|
|
193
193
|
'alpaca': alpaca["default"],
|
package/dist/cjs/src/apex.js
CHANGED
|
@@ -35,6 +35,7 @@ class apex extends apex$1["default"] {
|
|
|
35
35
|
'addMargin': false,
|
|
36
36
|
'borrowCrossMargin': false,
|
|
37
37
|
'borrowIsolatedMargin': false,
|
|
38
|
+
'borrowMargin': false,
|
|
38
39
|
'cancelAllOrders': true,
|
|
39
40
|
'cancelAllOrdersAfter': false,
|
|
40
41
|
'cancelOrder': true,
|
|
@@ -53,10 +54,14 @@ class apex extends apex$1["default"] {
|
|
|
53
54
|
'createTriggerOrder': true,
|
|
54
55
|
'editOrder': false,
|
|
55
56
|
'fetchAccounts': true,
|
|
57
|
+
'fetchAllGreeks': false,
|
|
56
58
|
'fetchBalance': true,
|
|
57
59
|
'fetchBorrowInterest': false,
|
|
60
|
+
'fetchBorrowRate': false,
|
|
58
61
|
'fetchBorrowRateHistories': false,
|
|
59
62
|
'fetchBorrowRateHistory': false,
|
|
63
|
+
'fetchBorrowRates': false,
|
|
64
|
+
'fetchBorrowRatesPerSymbol': false,
|
|
60
65
|
'fetchCanceledAndClosedOrders': false,
|
|
61
66
|
'fetchCanceledOrders': false,
|
|
62
67
|
'fetchClosedOrders': false,
|
|
@@ -72,6 +77,7 @@ class apex extends apex$1["default"] {
|
|
|
72
77
|
'fetchFundingRate': false,
|
|
73
78
|
'fetchFundingRateHistory': true,
|
|
74
79
|
'fetchFundingRates': false,
|
|
80
|
+
'fetchGreeks': false,
|
|
75
81
|
'fetchIndexOHLCV': false,
|
|
76
82
|
'fetchIsolatedBorrowRate': false,
|
|
77
83
|
'fetchIsolatedBorrowRates': false,
|
|
@@ -90,6 +96,8 @@ class apex extends apex$1["default"] {
|
|
|
90
96
|
'fetchOpenInterestHistory': false,
|
|
91
97
|
'fetchOpenInterests': false,
|
|
92
98
|
'fetchOpenOrders': true,
|
|
99
|
+
'fetchOption': false,
|
|
100
|
+
'fetchOptionChain': false,
|
|
93
101
|
'fetchOrder': true,
|
|
94
102
|
'fetchOrderBook': true,
|
|
95
103
|
'fetchOrders': true,
|
|
@@ -107,6 +115,7 @@ class apex extends apex$1["default"] {
|
|
|
107
115
|
'fetchTradingFees': false,
|
|
108
116
|
'fetchTransfer': true,
|
|
109
117
|
'fetchTransfers': true,
|
|
118
|
+
'fetchVolatilityHistory': false,
|
|
110
119
|
'fetchWithdrawal': false,
|
|
111
120
|
'fetchWithdrawals': false,
|
|
112
121
|
'reduceMargin': false,
|
|
@@ -2556,7 +2556,7 @@ class Exchange {
|
|
|
2556
2556
|
'delay': 0.001,
|
|
2557
2557
|
'capacity': 1,
|
|
2558
2558
|
'cost': 1,
|
|
2559
|
-
'maxCapacity': 1000,
|
|
2559
|
+
'maxCapacity': this.safeInteger(this.options, 'maxRequestsQueue', 1000),
|
|
2560
2560
|
'refillRate': refillRate,
|
|
2561
2561
|
};
|
|
2562
2562
|
const existingBucket = (this.tokenBucket === undefined) ? {} : this.tokenBucket;
|
|
@@ -50,7 +50,7 @@ class Throttler {
|
|
|
50
50
|
resolver = resolve;
|
|
51
51
|
});
|
|
52
52
|
if (this.queue.length > this.config['maxCapacity']) {
|
|
53
|
-
throw new Error('throttle queue is over maxCapacity (' + this.config['maxCapacity'].toString() + '), see https://
|
|
53
|
+
throw new Error('throttle queue is over maxCapacity (' + this.config['maxCapacity'].toString() + '), see https://docs.ccxt.com/#/README?id=maximum-requests-capacity');
|
|
54
54
|
}
|
|
55
55
|
cost = (cost === undefined) ? this.config['cost'] : cost;
|
|
56
56
|
this.queue.push({ resolver, cost });
|
package/dist/cjs/src/binance.js
CHANGED
|
@@ -246,7 +246,7 @@ class binance extends binance$1["default"] {
|
|
|
246
246
|
},
|
|
247
247
|
'www': 'https://www.binance.com',
|
|
248
248
|
'referral': {
|
|
249
|
-
'url': 'https://accounts.binance.com/
|
|
249
|
+
'url': 'https://accounts.binance.com/register?ref=CCXTCOM',
|
|
250
250
|
'discount': 0.1,
|
|
251
251
|
},
|
|
252
252
|
'doc': [
|
package/dist/cjs/src/bitget.js
CHANGED
|
@@ -1778,9 +1778,24 @@ class bitget extends bitget$1["default"] {
|
|
|
1778
1778
|
},
|
|
1779
1779
|
});
|
|
1780
1780
|
}
|
|
1781
|
+
/**
|
|
1782
|
+
* @method
|
|
1783
|
+
* @name bitget#setSandboxMode
|
|
1784
|
+
* @description enables or disables demo trading mode, if enabled will send PAPTRADING=1 in headers
|
|
1785
|
+
* @param enabled
|
|
1786
|
+
*/
|
|
1781
1787
|
setSandboxMode(enabled) {
|
|
1782
1788
|
this.options['sandboxMode'] = enabled;
|
|
1783
1789
|
}
|
|
1790
|
+
/**
|
|
1791
|
+
* @method
|
|
1792
|
+
* @name bitget#enableDemoTrading
|
|
1793
|
+
* @description enables or disables demo trading mode, if enabled will send PAPTRADING=1 in headers
|
|
1794
|
+
* @param enabled
|
|
1795
|
+
*/
|
|
1796
|
+
enableDemoTrading(enabled) {
|
|
1797
|
+
this.setSandboxMode(enabled);
|
|
1798
|
+
}
|
|
1784
1799
|
handleProductTypeAndParams(market = undefined, params = {}) {
|
|
1785
1800
|
let subType = undefined;
|
|
1786
1801
|
[subType, params] = this.handleSubTypeAndParams('handleProductTypeAndParams', undefined, params);
|
package/dist/cjs/src/bitmart.js
CHANGED
|
@@ -1013,7 +1013,7 @@ class bitmart extends bitmart$1["default"] {
|
|
|
1013
1013
|
'swap': false,
|
|
1014
1014
|
'future': false,
|
|
1015
1015
|
'option': false,
|
|
1016
|
-
'active':
|
|
1016
|
+
'active': this.safeStringLower2(market, 'status', 'trade_status') === 'trading',
|
|
1017
1017
|
'contract': false,
|
|
1018
1018
|
'linear': undefined,
|
|
1019
1019
|
'inverse': undefined,
|
|
@@ -1130,7 +1130,7 @@ class bitmart extends bitmart$1["default"] {
|
|
|
1130
1130
|
'swap': isSwap,
|
|
1131
1131
|
'future': isFutures,
|
|
1132
1132
|
'option': false,
|
|
1133
|
-
'active':
|
|
1133
|
+
'active': this.safeStringLower(market, 'status') === 'trading',
|
|
1134
1134
|
'contract': true,
|
|
1135
1135
|
'linear': true,
|
|
1136
1136
|
'inverse': false,
|
package/dist/cjs/src/bybit.js
CHANGED
|
@@ -184,7 +184,7 @@ class bybit extends bybit$1["default"] {
|
|
|
184
184
|
'https://github.com/bybit-exchange',
|
|
185
185
|
],
|
|
186
186
|
'fees': 'https://help.bybit.com/hc/en-us/articles/360039261154',
|
|
187
|
-
'referral': 'https://www.bybit.com/
|
|
187
|
+
'referral': 'https://www.bybit.com/invite?ref=XDK12WP',
|
|
188
188
|
},
|
|
189
189
|
'api': {
|
|
190
190
|
'public': {
|
|
@@ -4107,7 +4107,7 @@ class bybit extends bybit$1["default"] {
|
|
|
4107
4107
|
if (triggerPrice !== undefined) {
|
|
4108
4108
|
request['orderFilter'] = 'StopOrder';
|
|
4109
4109
|
}
|
|
4110
|
-
else if (
|
|
4110
|
+
else if (isStopLossTriggerOrder || isTakeProfitTriggerOrder) {
|
|
4111
4111
|
request['orderFilter'] = 'tpslOrder';
|
|
4112
4112
|
}
|
|
4113
4113
|
}
|
|
@@ -4130,7 +4130,8 @@ class bybit extends bybit$1["default"] {
|
|
|
4130
4130
|
params = this.omit(params, 'cost');
|
|
4131
4131
|
// if the cost is inferable, let's keep the old logic and ignore marketUnit, to minimize the impact of the changes
|
|
4132
4132
|
const isMarketBuyAndCostInferable = (lowerCaseType === 'market') && (side === 'buy') && ((price !== undefined) || (cost !== undefined));
|
|
4133
|
-
|
|
4133
|
+
const isMarketOrder = lowerCaseType === 'market';
|
|
4134
|
+
if (market['spot'] && isMarketOrder && isUTA && !isMarketBuyAndCostInferable) {
|
|
4134
4135
|
// UTA account can specify the cost of the order on both sides
|
|
4135
4136
|
if ((cost !== undefined) || (price !== undefined)) {
|
|
4136
4137
|
request['marketUnit'] = 'quoteCoin';
|
|
@@ -4149,7 +4150,7 @@ class bybit extends bybit$1["default"] {
|
|
|
4149
4150
|
request['qty'] = amountString;
|
|
4150
4151
|
}
|
|
4151
4152
|
}
|
|
4152
|
-
else if (market['spot'] &&
|
|
4153
|
+
else if (market['spot'] && isMarketOrder && (side === 'buy')) {
|
|
4153
4154
|
// classic accounts
|
|
4154
4155
|
// for market buy it requires the amount of quote currency to spend
|
|
4155
4156
|
let createMarketBuyOrderRequiresPrice = true;
|
|
@@ -4225,6 +4226,16 @@ class bybit extends bybit$1["default"] {
|
|
|
4225
4226
|
request['slOrderType'] = 'Limit';
|
|
4226
4227
|
request['slLimitPrice'] = this.getPrice(symbol, slLimitPrice);
|
|
4227
4228
|
}
|
|
4229
|
+
else {
|
|
4230
|
+
// for spot market, we need to add this
|
|
4231
|
+
if (market['spot']) {
|
|
4232
|
+
request['slOrderType'] = 'Market';
|
|
4233
|
+
}
|
|
4234
|
+
}
|
|
4235
|
+
// for spot market, we need to add this
|
|
4236
|
+
if (market['spot'] && isMarketOrder) {
|
|
4237
|
+
throw new errors.InvalidOrder(this.id + ' createOrder(): attached stopLoss is not supported for spot market orders');
|
|
4238
|
+
}
|
|
4228
4239
|
}
|
|
4229
4240
|
if (isTakeProfit) {
|
|
4230
4241
|
const tpTriggerPrice = this.safeValue2(takeProfit, 'triggerPrice', 'stopPrice', takeProfit);
|
|
@@ -4235,6 +4246,16 @@ class bybit extends bybit$1["default"] {
|
|
|
4235
4246
|
request['tpOrderType'] = 'Limit';
|
|
4236
4247
|
request['tpLimitPrice'] = this.getPrice(symbol, tpLimitPrice);
|
|
4237
4248
|
}
|
|
4249
|
+
else {
|
|
4250
|
+
// for spot market, we need to add this
|
|
4251
|
+
if (market['spot']) {
|
|
4252
|
+
request['tpOrderType'] = 'Market';
|
|
4253
|
+
}
|
|
4254
|
+
}
|
|
4255
|
+
// for spot market, we need to add this
|
|
4256
|
+
if (market['spot'] && isMarketOrder) {
|
|
4257
|
+
throw new errors.InvalidOrder(this.id + ' createOrder(): attached takeProfit is not supported for spot market orders');
|
|
4258
|
+
}
|
|
4238
4259
|
}
|
|
4239
4260
|
}
|
|
4240
4261
|
if (!market['spot'] && hedged) {
|
|
@@ -6629,7 +6650,7 @@ class bybit extends bybit$1["default"] {
|
|
|
6629
6650
|
}
|
|
6630
6651
|
const notional = this.safeString2(position, 'positionValue', 'cumExitValue');
|
|
6631
6652
|
const unrealisedPnl = this.omitZero(this.safeString(position, 'unrealisedPnl'));
|
|
6632
|
-
let initialMarginString = this.
|
|
6653
|
+
let initialMarginString = this.safeString2(position, 'positionIM', 'cumEntryValue');
|
|
6633
6654
|
let maintenanceMarginString = this.safeString(position, 'positionMM');
|
|
6634
6655
|
const timestamp = this.safeIntegerN(position, ['createdTime', 'createdAt']);
|
|
6635
6656
|
let lastUpdateTimestamp = this.parse8601(this.safeString(position, 'updated_at'));
|
|
@@ -6666,7 +6687,7 @@ class bybit extends bybit$1["default"] {
|
|
|
6666
6687
|
const maintenanceMarginPriceDifference = Precise["default"].stringAbs(Precise["default"].stringSub(liquidationPrice, bustPrice));
|
|
6667
6688
|
maintenanceMarginString = Precise["default"].stringMul(maintenanceMarginPriceDifference, size);
|
|
6668
6689
|
// Initial Margin = Contracts x Entry Price / Leverage
|
|
6669
|
-
if (entryPrice !== undefined) {
|
|
6690
|
+
if ((entryPrice !== undefined) && (initialMarginString === undefined)) {
|
|
6670
6691
|
initialMarginString = Precise["default"].stringDiv(Precise["default"].stringMul(size, entryPrice), leverage);
|
|
6671
6692
|
}
|
|
6672
6693
|
}
|
|
@@ -6679,7 +6700,7 @@ class bybit extends bybit$1["default"] {
|
|
|
6679
6700
|
const multiply = Precise["default"].stringMul(bustPrice, liquidationPrice);
|
|
6680
6701
|
maintenanceMarginString = Precise["default"].stringDiv(Precise["default"].stringMul(size, difference), multiply);
|
|
6681
6702
|
// Initial Margin = Leverage x Contracts / EntryPrice
|
|
6682
|
-
if (entryPrice !== undefined) {
|
|
6703
|
+
if ((entryPrice !== undefined) && (initialMarginString === undefined)) {
|
|
6683
6704
|
initialMarginString = Precise["default"].stringDiv(size, Precise["default"].stringMul(entryPrice, leverage));
|
|
6684
6705
|
}
|
|
6685
6706
|
}
|
|
@@ -372,7 +372,8 @@ class coincatch extends coincatch$1["default"] {
|
|
|
372
372
|
'StratisEVM': 'STRAT',
|
|
373
373
|
'ChilizChain': 'ChilizChain',
|
|
374
374
|
'StellarLumens': 'XLM',
|
|
375
|
-
'CronosChain': 'CRO',
|
|
375
|
+
'CronosChain': 'CRO',
|
|
376
|
+
'Optimism': 'Optimism',
|
|
376
377
|
},
|
|
377
378
|
},
|
|
378
379
|
'features': {
|
|
@@ -1840,6 +1840,22 @@ class krakenfutures extends krakenfutures$1["default"] {
|
|
|
1840
1840
|
// }
|
|
1841
1841
|
// }
|
|
1842
1842
|
//
|
|
1843
|
+
// {
|
|
1844
|
+
// uid: '85805e01-9eed-4395-8360-ed1a228237c9',
|
|
1845
|
+
// accountUid: '406142dd-7c5c-4a8b-acbc-5f16eca30009',
|
|
1846
|
+
// tradeable: 'PF_LTCUSD',
|
|
1847
|
+
// direction: 'Buy',
|
|
1848
|
+
// quantity: '0',
|
|
1849
|
+
// filled: '0.1',
|
|
1850
|
+
// timestamp: '1707258274849',
|
|
1851
|
+
// limitPrice: '69.2200000000',
|
|
1852
|
+
// orderType: 'IoC',
|
|
1853
|
+
// clientId: '',
|
|
1854
|
+
// reduceOnly: false,
|
|
1855
|
+
// lastUpdateTimestamp: '1707258274849',
|
|
1856
|
+
// status: 'closed'
|
|
1857
|
+
// }
|
|
1858
|
+
//
|
|
1843
1859
|
const orderEvents = this.safeValue(order, 'orderEvents', []);
|
|
1844
1860
|
const errorStatus = this.safeString(order, 'status');
|
|
1845
1861
|
const orderEventsLength = orderEvents.length;
|
|
@@ -1961,20 +1977,25 @@ class krakenfutures extends krakenfutures$1["default"] {
|
|
|
1961
1977
|
if (type === 'ioc' || this.parseOrderType(type) === 'market') {
|
|
1962
1978
|
timeInForce = 'ioc';
|
|
1963
1979
|
}
|
|
1980
|
+
let symbol = this.safeString(market, 'symbol');
|
|
1981
|
+
if ('tradeable' in details) {
|
|
1982
|
+
symbol = this.safeSymbol(this.safeString(details, 'tradeable'), market);
|
|
1983
|
+
}
|
|
1984
|
+
const ts = this.safeInteger(details, 'timestamp', timestamp);
|
|
1964
1985
|
return this.safeOrder({
|
|
1965
1986
|
'info': order,
|
|
1966
1987
|
'id': id,
|
|
1967
1988
|
'clientOrderId': this.safeStringN(details, ['clientOrderId', 'clientId', 'cliOrdId']),
|
|
1968
|
-
'timestamp':
|
|
1969
|
-
'datetime': this.iso8601(
|
|
1989
|
+
'timestamp': ts,
|
|
1990
|
+
'datetime': this.iso8601(ts),
|
|
1970
1991
|
'lastTradeTimestamp': undefined,
|
|
1971
|
-
'lastUpdateTimestamp': lastUpdateTimestamp,
|
|
1972
|
-
'symbol':
|
|
1992
|
+
'lastUpdateTimestamp': this.safeInteger(details, 'lastUpdateTimestamp', lastUpdateTimestamp),
|
|
1993
|
+
'symbol': symbol,
|
|
1973
1994
|
'type': this.parseOrderType(type),
|
|
1974
1995
|
'timeInForce': timeInForce,
|
|
1975
1996
|
'postOnly': type === 'post',
|
|
1976
1997
|
'reduceOnly': this.safeBool2(details, 'reduceOnly', 'reduce_only'),
|
|
1977
|
-
'side': this.
|
|
1998
|
+
'side': this.safeStringLower2(details, 'side', 'direction'),
|
|
1978
1999
|
'price': price,
|
|
1979
2000
|
'triggerPrice': this.safeString(details, 'triggerPrice'),
|
|
1980
2001
|
'amount': amount,
|
package/dist/cjs/src/okx.js
CHANGED
|
@@ -184,7 +184,7 @@ class okx extends okx$1["default"] {
|
|
|
184
184
|
'referral': {
|
|
185
185
|
// old reflink 0% discount https://www.okx.com/join/1888677
|
|
186
186
|
// new reflink 20% discount https://www.okx.com/join/CCXT2023
|
|
187
|
-
'url': 'https://www.okx.com/join/
|
|
187
|
+
'url': 'https://www.okx.com/join/CCXTCOM',
|
|
188
188
|
'discount': 0.2,
|
|
189
189
|
},
|
|
190
190
|
'test': {
|
|
@@ -1302,7 +1302,8 @@ class okx extends okx$1["default"] {
|
|
|
1302
1302
|
},
|
|
1303
1303
|
'fetchOHLCV': {
|
|
1304
1304
|
'limit': 300,
|
|
1305
|
-
'
|
|
1305
|
+
'mark': 100,
|
|
1306
|
+
'index': 100,
|
|
1306
1307
|
},
|
|
1307
1308
|
},
|
|
1308
1309
|
'spot': {
|
|
@@ -1328,6 +1329,12 @@ class okx extends okx$1["default"] {
|
|
|
1328
1329
|
},
|
|
1329
1330
|
},
|
|
1330
1331
|
},
|
|
1332
|
+
'currencies': {
|
|
1333
|
+
'USD': this.safeCurrencyStructure({ 'id': 'USD', 'code': 'USD', 'precision': this.parseNumber('0.0001') }),
|
|
1334
|
+
'EUR': this.safeCurrencyStructure({ 'id': 'EUR', 'code': 'EUR', 'precision': this.parseNumber('0.0001') }),
|
|
1335
|
+
'AED': this.safeCurrencyStructure({ 'id': 'AED', 'code': 'AED', 'precision': this.parseNumber('0.0001') }),
|
|
1336
|
+
'GBP': this.safeCurrencyStructure({ 'id': 'GBP', 'code': 'GBP', 'precision': this.parseNumber('0.0001') }),
|
|
1337
|
+
},
|
|
1331
1338
|
'commonCurrencies': {
|
|
1332
1339
|
// the exchange refers to ERC20 version of Aeternity (AEToken)
|
|
1333
1340
|
'AE': 'AET',
|
|
@@ -2470,16 +2477,18 @@ class okx extends okx$1["default"] {
|
|
|
2470
2477
|
if (paginate) {
|
|
2471
2478
|
return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 200);
|
|
2472
2479
|
}
|
|
2473
|
-
const
|
|
2480
|
+
const priceType = this.safeString(params, 'price');
|
|
2481
|
+
const isMarkOrIndex = this.inArray(priceType, ['mark', 'index']);
|
|
2474
2482
|
params = this.omit(params, 'price');
|
|
2475
2483
|
const options = this.safeDict(this.options, 'fetchOHLCV', {});
|
|
2476
2484
|
const timezone = this.safeString(options, 'timezone', 'UTC');
|
|
2477
2485
|
const limitIsUndefined = (limit === undefined);
|
|
2478
2486
|
if (limit === undefined) {
|
|
2479
|
-
limit = 100; // default 100, max
|
|
2487
|
+
limit = 100; // default 100, max 300
|
|
2480
2488
|
}
|
|
2481
2489
|
else {
|
|
2482
|
-
|
|
2490
|
+
const maxLimit = isMarkOrIndex ? 100 : 300; // default 300, only 100 if 'mark' or 'index'
|
|
2491
|
+
limit = Math.min(limit, maxLimit);
|
|
2483
2492
|
}
|
|
2484
2493
|
const duration = this.parseTimeframe(timeframe);
|
|
2485
2494
|
let bar = this.safeString(this.timeframes, timeframe, timeframe);
|
|
@@ -2499,8 +2508,8 @@ class okx extends okx$1["default"] {
|
|
|
2499
2508
|
const historyBorder = now - ((1440 - 1) * durationInMilliseconds);
|
|
2500
2509
|
if (since < historyBorder) {
|
|
2501
2510
|
defaultType = 'HistoryCandles';
|
|
2502
|
-
const maxLimit =
|
|
2503
|
-
limit = Math.min(limit, maxLimit);
|
|
2511
|
+
const maxLimit = isMarkOrIndex ? 100 : 300;
|
|
2512
|
+
limit = Math.min(limit, maxLimit);
|
|
2504
2513
|
}
|
|
2505
2514
|
const startTime = Math.max(since - 1, 0);
|
|
2506
2515
|
request['before'] = startTime;
|
|
@@ -2516,7 +2525,7 @@ class okx extends okx$1["default"] {
|
|
|
2516
2525
|
params = this.omit(params, 'type');
|
|
2517
2526
|
const isHistoryCandles = (type === 'HistoryCandles');
|
|
2518
2527
|
let response = undefined;
|
|
2519
|
-
if (
|
|
2528
|
+
if (priceType === 'mark') {
|
|
2520
2529
|
if (isHistoryCandles) {
|
|
2521
2530
|
response = await this.publicGetMarketHistoryMarkPriceCandles(this.extend(request, params));
|
|
2522
2531
|
}
|
|
@@ -2524,7 +2533,7 @@ class okx extends okx$1["default"] {
|
|
|
2524
2533
|
response = await this.publicGetMarketMarkPriceCandles(this.extend(request, params));
|
|
2525
2534
|
}
|
|
2526
2535
|
}
|
|
2527
|
-
else if (
|
|
2536
|
+
else if (priceType === 'index') {
|
|
2528
2537
|
request['instId'] = market['info']['instFamily']; // okx index candles require instFamily instead of instId
|
|
2529
2538
|
if (isHistoryCandles) {
|
|
2530
2539
|
response = await this.publicGetMarketHistoryIndexCandles(this.extend(request, params));
|
|
@@ -13,15 +13,31 @@ class alpaca extends alpaca$1["default"] {
|
|
|
13
13
|
return this.deepExtend(super.describe(), {
|
|
14
14
|
'has': {
|
|
15
15
|
'ws': true,
|
|
16
|
+
'createOrderWithTakeProfitAndStopLossWs': false,
|
|
17
|
+
'createReduceOnlyOrderWs': false,
|
|
18
|
+
'createStopLossOrderWs': false,
|
|
19
|
+
'createTakeProfitOrderWs': false,
|
|
20
|
+
'fetchPositionForSymbolWs': false,
|
|
21
|
+
'fetchPositionsForSymbolWs': false,
|
|
22
|
+
'fetchPositionsWs': false,
|
|
23
|
+
'fetchPositionWs': false,
|
|
24
|
+
'unWatchPositions': false,
|
|
16
25
|
'watchBalance': false,
|
|
26
|
+
'watchLiquidations': false,
|
|
27
|
+
'watchLiquidationsForSymbols': false,
|
|
28
|
+
'watchMarkPrice': false,
|
|
29
|
+
'watchMarkPrices': false,
|
|
30
|
+
'watchMyLiquidations': false,
|
|
31
|
+
'watchMyLiquidationsForSymbols': false,
|
|
17
32
|
'watchMyTrades': true,
|
|
18
33
|
'watchOHLCV': true,
|
|
19
34
|
'watchOrderBook': true,
|
|
20
35
|
'watchOrders': true,
|
|
36
|
+
'watchPosition': false,
|
|
37
|
+
'watchPositions': false,
|
|
21
38
|
'watchTicker': true,
|
|
22
39
|
'watchTickers': false,
|
|
23
40
|
'watchTrades': true,
|
|
24
|
-
'watchPosition': false,
|
|
25
41
|
},
|
|
26
42
|
'urls': {
|
|
27
43
|
'api': {
|
package/dist/cjs/src/pro/apex.js
CHANGED
|
@@ -944,6 +944,7 @@ class apex extends apex$1["default"] {
|
|
|
944
944
|
'recentlyTrade': this.handleTrades,
|
|
945
945
|
'pong': this.handlePong,
|
|
946
946
|
'auth': this.handleAuthenticate,
|
|
947
|
+
'ping': this.handlePing,
|
|
947
948
|
};
|
|
948
949
|
const exacMethod = this.safeValue(methods, topic);
|
|
949
950
|
if (exacMethod !== undefined) {
|
|
@@ -973,6 +974,19 @@ class apex extends apex$1["default"] {
|
|
|
973
974
|
'op': 'ping',
|
|
974
975
|
};
|
|
975
976
|
}
|
|
977
|
+
async pong(client, message) {
|
|
978
|
+
//
|
|
979
|
+
// {"op": "ping", "args": ["1761069137485"]}
|
|
980
|
+
//
|
|
981
|
+
const timeStamp = this.milliseconds();
|
|
982
|
+
try {
|
|
983
|
+
await client.send({ 'args': [timeStamp.toString()], 'op': 'pong' });
|
|
984
|
+
}
|
|
985
|
+
catch (e) {
|
|
986
|
+
const error = new errors.NetworkError(this.id + ' handlePing failed with error ' + this.json(e));
|
|
987
|
+
client.reset(error);
|
|
988
|
+
}
|
|
989
|
+
}
|
|
976
990
|
handlePong(client, message) {
|
|
977
991
|
//
|
|
978
992
|
// {
|
|
@@ -987,6 +1001,9 @@ class apex extends apex$1["default"] {
|
|
|
987
1001
|
client.lastPong = this.safeInteger(message, 'pong');
|
|
988
1002
|
return message;
|
|
989
1003
|
}
|
|
1004
|
+
handlePing(client, message) {
|
|
1005
|
+
this.spawn(this.pong, client, message);
|
|
1006
|
+
}
|
|
990
1007
|
handleAccount(client, message) {
|
|
991
1008
|
const contents = this.safeDict(message, 'contents', {});
|
|
992
1009
|
const fills = this.safeList(contents, 'fills', []);
|
|
@@ -424,7 +424,7 @@ class binance extends binance$1["default"] {
|
|
|
424
424
|
// }
|
|
425
425
|
//
|
|
426
426
|
const marketId = this.safeString(liquidation, 's');
|
|
427
|
-
market = this.safeMarket(marketId, market);
|
|
427
|
+
market = this.safeMarket(marketId, market, undefined, 'swap');
|
|
428
428
|
const timestamp = this.safeInteger(liquidation, 'T');
|
|
429
429
|
return this.safeLiquidation({
|
|
430
430
|
'info': liquidation,
|
|
@@ -546,8 +546,8 @@ class binance extends binance$1["default"] {
|
|
|
546
546
|
return;
|
|
547
547
|
}
|
|
548
548
|
const marketId = this.safeString(message, 's');
|
|
549
|
-
const market = this.safeMarket(marketId);
|
|
550
|
-
const symbol = this.safeSymbol(marketId);
|
|
549
|
+
const market = this.safeMarket(marketId, undefined, undefined, 'swap');
|
|
550
|
+
const symbol = this.safeSymbol(marketId, market);
|
|
551
551
|
const liquidation = this.parseWsLiquidation(message, market);
|
|
552
552
|
let myLiquidations = this.safeValue(this.myLiquidations, symbol);
|
|
553
553
|
if (myLiquidations === undefined) {
|
|
@@ -921,7 +921,7 @@ class binance extends binance$1["default"] {
|
|
|
921
921
|
// }
|
|
922
922
|
//
|
|
923
923
|
const isSpot = this.isSpotUrl(client);
|
|
924
|
-
const marketType = (isSpot) ? 'spot' : '
|
|
924
|
+
const marketType = (isSpot) ? 'spot' : 'swap';
|
|
925
925
|
const marketId = this.safeString(message, 's');
|
|
926
926
|
const market = this.safeMarket(marketId, undefined, undefined, marketType);
|
|
927
927
|
const symbol = market['symbol'];
|
|
@@ -4025,7 +4025,7 @@ class binance extends binance$1["default"] {
|
|
|
4025
4025
|
return this.safePosition({
|
|
4026
4026
|
'info': position,
|
|
4027
4027
|
'id': undefined,
|
|
4028
|
-
'symbol': this.safeSymbol(marketId, undefined, undefined, '
|
|
4028
|
+
'symbol': this.safeSymbol(marketId, undefined, undefined, 'swap'),
|
|
4029
4029
|
'notional': undefined,
|
|
4030
4030
|
'marginMode': this.safeString(position, 'mt'),
|
|
4031
4031
|
'liquidationPrice': undefined,
|
|
@@ -2744,7 +2744,9 @@ class bitget extends bitget$1["default"] {
|
|
|
2744
2744
|
delete client.subscriptions[messageHash];
|
|
2745
2745
|
}
|
|
2746
2746
|
const error = new errors.UnsubscribeError(this.id + ' orderbook ' + symbol);
|
|
2747
|
-
client.
|
|
2747
|
+
if (subMessageHash in client.futures) {
|
|
2748
|
+
client.reject(error, subMessageHash);
|
|
2749
|
+
}
|
|
2748
2750
|
client.resolve(true, messageHash);
|
|
2749
2751
|
}
|
|
2750
2752
|
handleTradesUnSubscription(client, message) {
|
|
@@ -2769,7 +2771,9 @@ class bitget extends bitget$1["default"] {
|
|
|
2769
2771
|
delete client.subscriptions[messageHash];
|
|
2770
2772
|
}
|
|
2771
2773
|
const error = new errors.UnsubscribeError(this.id + ' trades ' + symbol);
|
|
2772
|
-
client.
|
|
2774
|
+
if (subMessageHash in client.futures) {
|
|
2775
|
+
client.reject(error, subMessageHash);
|
|
2776
|
+
}
|
|
2773
2777
|
client.resolve(true, messageHash);
|
|
2774
2778
|
}
|
|
2775
2779
|
handleTickerUnSubscription(client, message) {
|
|
@@ -2794,7 +2798,9 @@ class bitget extends bitget$1["default"] {
|
|
|
2794
2798
|
delete client.subscriptions[messageHash];
|
|
2795
2799
|
}
|
|
2796
2800
|
const error = new errors.UnsubscribeError(this.id + ' ticker ' + symbol);
|
|
2797
|
-
client.
|
|
2801
|
+
if (subMessageHash in client.futures) {
|
|
2802
|
+
client.reject(error, subMessageHash);
|
|
2803
|
+
}
|
|
2798
2804
|
client.resolve(true, messageHash);
|
|
2799
2805
|
}
|
|
2800
2806
|
handleOHLCVUnSubscription(client, message) {
|
|
@@ -773,8 +773,9 @@ class coinbase extends coinbase$1["default"] {
|
|
|
773
773
|
const id = this.safeString(order, 'order_id');
|
|
774
774
|
const clientOrderId = this.safeString(order, 'client_order_id');
|
|
775
775
|
const marketId = this.safeString(order, 'product_id');
|
|
776
|
-
const datetime = this.
|
|
776
|
+
const datetime = this.safeString2(order, 'time', 'creation_time');
|
|
777
777
|
market = this.safeMarket(marketId, market);
|
|
778
|
+
const stopPrice = this.safeString(order, 'stop_price');
|
|
778
779
|
return this.safeOrder({
|
|
779
780
|
'info': order,
|
|
780
781
|
'symbol': this.safeString(market, 'symbol'),
|
|
@@ -786,12 +787,12 @@ class coinbase extends coinbase$1["default"] {
|
|
|
786
787
|
'type': this.safeString(order, 'order_type'),
|
|
787
788
|
'timeInForce': undefined,
|
|
788
789
|
'postOnly': undefined,
|
|
789
|
-
'side': this.
|
|
790
|
-
'price':
|
|
791
|
-
'stopPrice':
|
|
792
|
-
'triggerPrice':
|
|
793
|
-
'amount':
|
|
794
|
-
'cost':
|
|
790
|
+
'side': this.safeString2(order, 'side', 'order_side'),
|
|
791
|
+
'price': this.safeString(order, 'limit_price'),
|
|
792
|
+
'stopPrice': stopPrice,
|
|
793
|
+
'triggerPrice': stopPrice,
|
|
794
|
+
'amount': this.safeString(order, 'cumulative_quantity'),
|
|
795
|
+
'cost': this.omitZero(this.safeString(order, 'filled_value')),
|
|
795
796
|
'average': this.safeString(order, 'avg_price'),
|
|
796
797
|
'filled': this.safeString(order, 'cumulative_quantity'),
|
|
797
798
|
'remaining': this.safeString(order, 'leaves_quantity'),
|
|
@@ -453,8 +453,10 @@ class hyperliquid extends hyperliquid$1["default"] {
|
|
|
453
453
|
const assetObject = spotAssets[i];
|
|
454
454
|
const marketId = this.safeString(assetObject, 'coin');
|
|
455
455
|
const market = this.safeMarket(marketId, undefined, undefined, 'spot');
|
|
456
|
+
const symbol = market['symbol'];
|
|
456
457
|
const ticker = this.parseWsTicker(assetObject, market);
|
|
457
458
|
parsedTickers.push(ticker);
|
|
459
|
+
this.tickers[symbol] = ticker;
|
|
458
460
|
}
|
|
459
461
|
// perpetuals
|
|
460
462
|
const meta = this.safeDict(rawData, 'meta', {});
|
|
@@ -464,7 +466,9 @@ class hyperliquid extends hyperliquid$1["default"] {
|
|
|
464
466
|
const data = this.extend(this.safeDict(universe, i, {}), this.safeDict(assetCtxs, i, {}));
|
|
465
467
|
const id = data['name'] + '/USDC:USDC';
|
|
466
468
|
const market = this.safeMarket(id, undefined, undefined, 'swap');
|
|
469
|
+
const symbol = market['symbol'];
|
|
467
470
|
const ticker = this.parseWsTicker(data, market);
|
|
471
|
+
this.tickers[symbol] = ticker;
|
|
468
472
|
parsedTickers.push(ticker);
|
|
469
473
|
}
|
|
470
474
|
const tickers = this.indexBy(parsedTickers, 'symbol');
|
package/dist/cjs/src/pro/mexc.js
CHANGED
|
@@ -113,7 +113,7 @@ class mexc extends mexc$1["default"] {
|
|
|
113
113
|
// "symbol": "BTC_USDT",
|
|
114
114
|
// "data": {
|
|
115
115
|
// "symbol": "BTC_USDT",
|
|
116
|
-
// "lastPrice": 76376.
|
|
116
|
+
// "lastPrice": 76376.1,
|
|
117
117
|
// "riseFallRate": -0.0006,
|
|
118
118
|
// "fairPrice": 76374.4,
|
|
119
119
|
// "indexPrice": 76385.8,
|