ccxt 4.2.3 → 4.2.5
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 +4 -4
- package/dist/ccxt.browser.js +247 -47
- package/dist/ccxt.browser.min.js +5 -5
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/alpaca.js +7 -1
- package/dist/cjs/src/base/Exchange.js +5 -2
- package/dist/cjs/src/bingx.js +17 -18
- package/dist/cjs/src/bitmart.js +18 -8
- package/dist/cjs/src/bybit.js +4 -0
- package/dist/cjs/src/coinsph.js +20 -2
- package/dist/cjs/src/delta.js +2 -2
- package/dist/cjs/src/htx.js +166 -12
- package/dist/cjs/src/okx.js +5 -0
- package/dist/cjs/src/phemex.js +3 -2
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bitmart.d.ts +1 -0
- package/js/src/abstract/bybit.d.ts +2 -0
- package/js/src/alpaca.js +7 -1
- package/js/src/base/Exchange.js +5 -2
- package/js/src/binance.d.ts +1 -1
- package/js/src/bingx.d.ts +1 -1
- package/js/src/bingx.js +17 -18
- package/js/src/bitmart.js +18 -8
- package/js/src/bybit.js +4 -0
- package/js/src/coinsph.js +20 -2
- package/js/src/delta.js +2 -2
- package/js/src/htx.js +166 -12
- package/js/src/okx.js +5 -0
- package/js/src/phemex.js +3 -2
- package/package.json +1 -1
- package/skip-tests.json +4 -1
package/dist/cjs/ccxt.js
CHANGED
|
@@ -169,7 +169,7 @@ var woo$1 = require('./src/pro/woo.js');
|
|
|
169
169
|
|
|
170
170
|
//-----------------------------------------------------------------------------
|
|
171
171
|
// this is updated by vss.js when building
|
|
172
|
-
const version = '4.2.
|
|
172
|
+
const version = '4.2.5';
|
|
173
173
|
Exchange["default"].ccxtVersion = version;
|
|
174
174
|
const exchanges = {
|
|
175
175
|
'ace': ace,
|
package/dist/cjs/src/alpaca.js
CHANGED
|
@@ -349,10 +349,16 @@ class alpaca extends alpaca$1 {
|
|
|
349
349
|
//
|
|
350
350
|
const marketId = this.safeString(asset, 'symbol');
|
|
351
351
|
const parts = marketId.split('/');
|
|
352
|
+
const assetClass = this.safeString(asset, 'class');
|
|
352
353
|
const baseId = this.safeString(parts, 0);
|
|
353
354
|
const quoteId = this.safeString(parts, 1);
|
|
354
355
|
const base = this.safeCurrencyCode(baseId);
|
|
355
|
-
|
|
356
|
+
let quote = this.safeCurrencyCode(quoteId);
|
|
357
|
+
// Us equity markets do not include quote in symbol.
|
|
358
|
+
// We can safely coerce us_equity quote to USD
|
|
359
|
+
if (quote === undefined && assetClass === 'us_equity') {
|
|
360
|
+
quote = 'USD';
|
|
361
|
+
}
|
|
356
362
|
const symbol = base + '/' + quote;
|
|
357
363
|
const status = this.safeString(asset, 'status');
|
|
358
364
|
const active = (status === 'active');
|
|
@@ -757,8 +757,11 @@ class Exchange {
|
|
|
757
757
|
// proxy agents
|
|
758
758
|
const [httpProxy, httpsProxy, socksProxy] = this.checkProxySettings(url, method, headers, body);
|
|
759
759
|
this.checkConflictingProxies(httpProxy || httpsProxy || socksProxy, proxyUrl);
|
|
760
|
-
if (
|
|
761
|
-
|
|
760
|
+
if (isNode) {
|
|
761
|
+
// skip this on the browser
|
|
762
|
+
if (!this.proxyModulesLoaded) {
|
|
763
|
+
await this.loadProxyModules(); // this is needed in JS, independently whether proxy properties were set or not, we have to load them because of necessity in WS, which would happen beyond 'fetch' method (WS/etc)
|
|
764
|
+
}
|
|
762
765
|
}
|
|
763
766
|
const chosenAgent = this.setProxyAgents(httpProxy, httpsProxy, socksProxy);
|
|
764
767
|
// user-agent
|
package/dist/cjs/src/bingx.js
CHANGED
|
@@ -1331,18 +1331,11 @@ class bingx extends bingx$1 {
|
|
|
1331
1331
|
const close = this.safeString(ticker, 'lastPrice');
|
|
1332
1332
|
const quoteVolume = this.safeString(ticker, 'quoteVolume');
|
|
1333
1333
|
const baseVolume = this.safeString(ticker, 'volume');
|
|
1334
|
-
let percentage =
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
change = this.safeString(ticker, 'priceChange');
|
|
1340
|
-
}
|
|
1341
|
-
// let percentage = this.safeString (ticker, 'priceChangePercent');
|
|
1342
|
-
// if (percentage !== undefined) {
|
|
1343
|
-
// percentage = percentage.replace ('%', '');
|
|
1344
|
-
// } similarly to change, it's not ccxt's percentage because it does priceChange/open, and priceChange is high-low
|
|
1345
|
-
// const change = this.safeString (ticker, 'priceChange'); // this is not ccxt's change because it does high-low instead of last-open
|
|
1334
|
+
let percentage = this.safeString(ticker, 'priceChangePercent');
|
|
1335
|
+
if (percentage !== undefined) {
|
|
1336
|
+
percentage = percentage.replace('%', '');
|
|
1337
|
+
}
|
|
1338
|
+
const change = this.safeString(ticker, 'priceChange');
|
|
1346
1339
|
const ts = this.safeInteger(ticker, 'closeTime');
|
|
1347
1340
|
const datetime = this.iso8601(ts);
|
|
1348
1341
|
const bid = this.safeString(ticker, 'bidPrice');
|
|
@@ -1671,6 +1664,11 @@ class bingx extends bingx$1 {
|
|
|
1671
1664
|
};
|
|
1672
1665
|
const isMarketOrder = type === 'MARKET';
|
|
1673
1666
|
const isSpot = marketType === 'spot';
|
|
1667
|
+
const exchangeClientOrderId = isSpot ? 'newClientOrderId' : 'clientOrderID';
|
|
1668
|
+
const clientOrderId = this.safeString2(params, exchangeClientOrderId, 'clientOrderId');
|
|
1669
|
+
if (clientOrderId !== undefined) {
|
|
1670
|
+
request[exchangeClientOrderId] = clientOrderId;
|
|
1671
|
+
}
|
|
1674
1672
|
const timeInForce = this.safeStringUpper(params, 'timeInForce');
|
|
1675
1673
|
if (timeInForce === 'IOC') {
|
|
1676
1674
|
request['timeInForce'] = 'IOC';
|
|
@@ -1815,7 +1813,7 @@ class bingx extends bingx$1 {
|
|
|
1815
1813
|
}
|
|
1816
1814
|
request['positionSide'] = positionSide;
|
|
1817
1815
|
request['quantity'] = this.parseToNumeric(this.amountToPrecision(symbol, amount));
|
|
1818
|
-
params = this.omit(params, ['reduceOnly', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice', 'trailingAmount', 'trailingPercent', 'takeProfit', 'stopLoss']);
|
|
1816
|
+
params = this.omit(params, ['reduceOnly', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice', 'trailingAmount', 'trailingPercent', 'takeProfit', 'stopLoss', 'clientOrderId']);
|
|
1819
1817
|
}
|
|
1820
1818
|
return this.extend(request, params);
|
|
1821
1819
|
}
|
|
@@ -1832,6 +1830,7 @@ class bingx extends bingx$1 {
|
|
|
1832
1830
|
* @param {float} amount how much you want to trade in units of the base currency
|
|
1833
1831
|
* @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
1834
1832
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1833
|
+
* @param {string} [params.clientOrderId] a unique id for the order
|
|
1835
1834
|
* @param {bool} [params.postOnly] true to place a post only order
|
|
1836
1835
|
* @param {string} [params.timeInForce] spot supports 'PO' and 'IOC', swap supports 'PO', 'GTC', 'IOC' and 'FOK'
|
|
1837
1836
|
* @param {bool} [params.reduceOnly] *swap only* true or false whether the order is reduce only
|
|
@@ -1896,7 +1895,7 @@ class bingx extends bingx$1 {
|
|
|
1896
1895
|
// }
|
|
1897
1896
|
//
|
|
1898
1897
|
if (typeof response === 'string') {
|
|
1899
|
-
response =
|
|
1898
|
+
response = this.parseJson(response);
|
|
1900
1899
|
}
|
|
1901
1900
|
const data = this.safeValue(response, 'data', {});
|
|
1902
1901
|
const order = this.safeValue(data, 'order', data);
|
|
@@ -2157,7 +2156,7 @@ class bingx extends bingx$1 {
|
|
|
2157
2156
|
'currency': feeCurrencyCode,
|
|
2158
2157
|
'cost': Precise["default"].stringAbs(feeCost),
|
|
2159
2158
|
};
|
|
2160
|
-
const clientOrderId = this.
|
|
2159
|
+
const clientOrderId = this.safeStringN(order, ['clientOrderID', 'origClientOrderId', 'c']);
|
|
2161
2160
|
let stopLoss = this.safeValue(order, 'stopLoss');
|
|
2162
2161
|
let stopLossPrice = undefined;
|
|
2163
2162
|
if (stopLoss !== undefined) {
|
|
@@ -2166,7 +2165,7 @@ class bingx extends bingx$1 {
|
|
|
2166
2165
|
if ((stopLoss !== undefined) && (typeof stopLoss !== 'number')) {
|
|
2167
2166
|
// stopLoss: '{"stopPrice":50,"workingType":"MARK_PRICE","type":"STOP_MARKET","quantity":1}',
|
|
2168
2167
|
if (typeof stopLoss === 'string') {
|
|
2169
|
-
stopLoss =
|
|
2168
|
+
stopLoss = this.parseJson(stopLoss);
|
|
2170
2169
|
}
|
|
2171
2170
|
stopLossPrice = this.safeNumber(stopLoss, 'stopPrice');
|
|
2172
2171
|
}
|
|
@@ -2178,7 +2177,7 @@ class bingx extends bingx$1 {
|
|
|
2178
2177
|
if ((takeProfit !== undefined) && (typeof takeProfit !== 'number')) {
|
|
2179
2178
|
// takeProfit: '{"stopPrice":150,"workingType":"MARK_PRICE","type":"TAKE_PROFIT_MARKET","quantity":1}',
|
|
2180
2179
|
if (typeof takeProfit === 'string') {
|
|
2181
|
-
takeProfit =
|
|
2180
|
+
takeProfit = this.parseJson(takeProfit);
|
|
2182
2181
|
}
|
|
2183
2182
|
takeProfitPrice = this.safeNumber(takeProfit, 'stopPrice');
|
|
2184
2183
|
}
|
|
@@ -2418,7 +2417,7 @@ class bingx extends bingx$1 {
|
|
|
2418
2417
|
}
|
|
2419
2418
|
let response = undefined;
|
|
2420
2419
|
if (market['spot']) {
|
|
2421
|
-
const spotReqKey = areClientOrderIds ? '
|
|
2420
|
+
const spotReqKey = areClientOrderIds ? 'clientOrderIDs' : 'orderIds';
|
|
2422
2421
|
request[spotReqKey] = parsedIds.join(',');
|
|
2423
2422
|
response = await this.spotV1PrivatePostTradeCancelOrders(this.extend(request, params));
|
|
2424
2423
|
}
|
package/dist/cjs/src/bitmart.js
CHANGED
|
@@ -196,6 +196,7 @@ class bitmart extends bitmart$1 {
|
|
|
196
196
|
'contract/private/order-history': 10,
|
|
197
197
|
'contract/private/position': 10,
|
|
198
198
|
'contract/private/get-open-orders': 1.2,
|
|
199
|
+
'contract/private/current-plan-order': 1.2,
|
|
199
200
|
'contract/private/trades': 10,
|
|
200
201
|
},
|
|
201
202
|
'post': {
|
|
@@ -2678,6 +2679,7 @@ class bitmart extends bitmart$1 {
|
|
|
2678
2679
|
* @name bitmart#fetchOpenOrders
|
|
2679
2680
|
* @see https://developer-pro.bitmart.com/en/spot/#current-open-orders-v4-signed
|
|
2680
2681
|
* @see https://developer-pro.bitmart.com/en/futures/#get-all-open-orders-keyed
|
|
2682
|
+
* @see https://developer-pro.bitmart.com/en/futures/#get-all-current-plan-orders-keyed
|
|
2681
2683
|
* @description fetch all unfilled currently open orders
|
|
2682
2684
|
* @param {string} symbol unified market symbol
|
|
2683
2685
|
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
@@ -2689,6 +2691,7 @@ class bitmart extends bitmart$1 {
|
|
|
2689
2691
|
* @param {string} [params.order_state] *swap* the order state, 'all' or 'partially_filled', default is 'all'
|
|
2690
2692
|
* @param {string} [params.orderType] *swap only* 'limit', 'market', or 'trailing'
|
|
2691
2693
|
* @param {boolean} [params.trailing] *swap only* set to true if you want to fetch trailing orders
|
|
2694
|
+
* @param {boolean} [params.trigger] *swap only* set to true if you want to fetch trigger orders
|
|
2692
2695
|
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
2693
2696
|
*/
|
|
2694
2697
|
await this.loadMarkets();
|
|
@@ -2721,16 +2724,23 @@ class bitmart extends bitmart$1 {
|
|
|
2721
2724
|
response = await this.privatePostSpotV4QueryOpenOrders(this.extend(request, params));
|
|
2722
2725
|
}
|
|
2723
2726
|
else if (type === 'swap') {
|
|
2724
|
-
const
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
orderType = 'trailing';
|
|
2727
|
+
const isStop = this.safeValue2(params, 'stop', 'trigger');
|
|
2728
|
+
params = this.omit(params, ['stop', 'trigger']);
|
|
2729
|
+
if (isStop) {
|
|
2730
|
+
response = await this.privateGetContractPrivateCurrentPlanOrder(this.extend(request, params));
|
|
2729
2731
|
}
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
+
else {
|
|
2733
|
+
const trailing = this.safeValue(params, 'trailing', false);
|
|
2734
|
+
let orderType = this.safeString(params, 'orderType');
|
|
2735
|
+
params = this.omit(params, ['orderType', 'trailing']);
|
|
2736
|
+
if (trailing) {
|
|
2737
|
+
orderType = 'trailing';
|
|
2738
|
+
}
|
|
2739
|
+
if (orderType !== undefined) {
|
|
2740
|
+
request['type'] = orderType;
|
|
2741
|
+
}
|
|
2742
|
+
response = await this.privateGetContractPrivateGetOpenOrders(this.extend(request, params));
|
|
2732
2743
|
}
|
|
2733
|
-
response = await this.privateGetContractPrivateGetOpenOrders(this.extend(request, params));
|
|
2734
2744
|
}
|
|
2735
2745
|
else {
|
|
2736
2746
|
throw new errors.NotSupported(this.id + ' fetchOpenOrders() does not support ' + type + ' orders, only spot and swap orders are accepted');
|
package/dist/cjs/src/bybit.js
CHANGED
|
@@ -280,6 +280,7 @@ class bybit extends bybit$1 {
|
|
|
280
280
|
'v5/position/list': 5,
|
|
281
281
|
'v5/execution/list': 5,
|
|
282
282
|
'v5/position/closed-pnl': 5,
|
|
283
|
+
'v5/position/move-history': 5,
|
|
283
284
|
// pre-upgrade
|
|
284
285
|
'v5/pre-upgrade/order/history': 5,
|
|
285
286
|
'v5/pre-upgrade/execution/list': 5,
|
|
@@ -444,6 +445,7 @@ class bybit extends bybit$1 {
|
|
|
444
445
|
'v5/position/trading-stop': 5,
|
|
445
446
|
'v5/position/set-auto-add-margin': 5,
|
|
446
447
|
'v5/position/add-margin': 5,
|
|
448
|
+
'v5/position/move-positions': 5,
|
|
447
449
|
'v5/position/confirm-pending-mmr': 5,
|
|
448
450
|
// account
|
|
449
451
|
'v5/account/upgrade-to-uta': 5,
|
|
@@ -626,6 +628,8 @@ class bybit extends bybit$1 {
|
|
|
626
628
|
'131215': errors.BadRequest,
|
|
627
629
|
'131216': errors.ExchangeError,
|
|
628
630
|
'131217': errors.ExchangeError,
|
|
631
|
+
'131231': errors.NotSupported,
|
|
632
|
+
'131232': errors.NotSupported,
|
|
629
633
|
'131002': errors.BadRequest,
|
|
630
634
|
'131003': errors.ExchangeError,
|
|
631
635
|
'131004': errors.AuthenticationError,
|
package/dist/cjs/src/coinsph.js
CHANGED
|
@@ -628,7 +628,16 @@ class coinsph extends coinsph$1 {
|
|
|
628
628
|
const defaultMethod = 'publicGetOpenapiQuoteV1Ticker24hr';
|
|
629
629
|
const options = this.safeValue(this.options, 'fetchTickers', {});
|
|
630
630
|
const method = this.safeString(options, 'method', defaultMethod);
|
|
631
|
-
|
|
631
|
+
let tickers = undefined;
|
|
632
|
+
if (method === 'publicGetOpenapiQuoteV1TickerPrice') {
|
|
633
|
+
tickers = await this.publicGetOpenapiQuoteV1TickerPrice(this.extend(request, params));
|
|
634
|
+
}
|
|
635
|
+
else if (method === 'publicGetOpenapiQuoteV1TickerBookTicker') {
|
|
636
|
+
tickers = await this.publicGetOpenapiQuoteV1TickerBookTicker(this.extend(request, params));
|
|
637
|
+
}
|
|
638
|
+
else {
|
|
639
|
+
tickers = await this.publicGetOpenapiQuoteV1Ticker24hr(this.extend(request, params));
|
|
640
|
+
}
|
|
632
641
|
return this.parseTickers(tickers, symbols, params);
|
|
633
642
|
}
|
|
634
643
|
async fetchTicker(symbol, params = {}) {
|
|
@@ -648,7 +657,16 @@ class coinsph extends coinsph$1 {
|
|
|
648
657
|
const defaultMethod = 'publicGetOpenapiQuoteV1Ticker24hr';
|
|
649
658
|
const options = this.safeValue(this.options, 'fetchTicker', {});
|
|
650
659
|
const method = this.safeString(options, 'method', defaultMethod);
|
|
651
|
-
|
|
660
|
+
let ticker = undefined;
|
|
661
|
+
if (method === 'publicGetOpenapiQuoteV1TickerPrice') {
|
|
662
|
+
ticker = await this.publicGetOpenapiQuoteV1TickerPrice(this.extend(request, params));
|
|
663
|
+
}
|
|
664
|
+
else if (method === 'publicGetOpenapiQuoteV1TickerBookTicker') {
|
|
665
|
+
ticker = await this.publicGetOpenapiQuoteV1TickerBookTicker(this.extend(request, params));
|
|
666
|
+
}
|
|
667
|
+
else {
|
|
668
|
+
ticker = await this.publicGetOpenapiQuoteV1Ticker24hr(this.extend(request, params));
|
|
669
|
+
}
|
|
652
670
|
return this.parseTicker(ticker, market);
|
|
653
671
|
}
|
|
654
672
|
parseTicker(ticker, market = undefined) {
|
package/dist/cjs/src/delta.js
CHANGED
|
@@ -327,14 +327,14 @@ class delta extends delta$1 {
|
|
|
327
327
|
const markets = this.markets_by_id[symbol];
|
|
328
328
|
return markets[0];
|
|
329
329
|
}
|
|
330
|
-
else if ((symbol.
|
|
330
|
+
else if ((symbol.endsWith('-C')) || (symbol.endsWith('-P')) || (symbol.startsWith('C-')) || (symbol.startsWith('P-'))) {
|
|
331
331
|
return this.createExpiredOptionMarket(symbol);
|
|
332
332
|
}
|
|
333
333
|
}
|
|
334
334
|
throw new errors.BadSymbol(this.id + ' does not have market symbol ' + symbol);
|
|
335
335
|
}
|
|
336
336
|
safeMarket(marketId = undefined, market = undefined, delimiter = undefined, marketType = undefined) {
|
|
337
|
-
const isOption = (marketId !== undefined) && ((marketId.
|
|
337
|
+
const isOption = (marketId !== undefined) && ((marketId.endsWith('-C')) || (marketId.endsWith('-P')) || (marketId.startsWith('C-')) || (marketId.startsWith('P-')));
|
|
338
338
|
if (isOption && !(marketId in this.markets_by_id)) {
|
|
339
339
|
// handle expired option contracts
|
|
340
340
|
return this.createExpiredOptionMarket(marketId);
|