ccxt 4.4.32 → 4.4.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -7
- package/dist/ccxt.browser.min.js +6 -6
- package/dist/cjs/ccxt.js +4 -1
- package/dist/cjs/src/abstract/ellipx.js +9 -0
- package/dist/cjs/src/alpaca.js +2 -0
- package/dist/cjs/src/base/Exchange.js +116 -1
- package/dist/cjs/src/binance.js +164 -6
- package/dist/cjs/src/bingx.js +156 -9
- package/dist/cjs/src/bitbank.js +5 -0
- package/dist/cjs/src/bitbns.js +2 -0
- package/dist/cjs/src/bitfinex2.js +2 -1
- package/dist/cjs/src/bitget.js +177 -44
- package/dist/cjs/src/bitmex.js +2 -0
- package/dist/cjs/src/bitopro.js +3 -0
- package/dist/cjs/src/bitrue.js +1 -0
- package/dist/cjs/src/btcmarkets.js +2 -0
- package/dist/cjs/src/bybit.js +148 -13
- package/dist/cjs/src/cex.js +16 -6
- package/dist/cjs/src/coinbase.js +5 -24
- package/dist/cjs/src/coinbaseexchange.js +2 -1
- package/dist/cjs/src/coinex.js +2 -0
- package/dist/cjs/src/coinone.js +7 -7
- package/dist/cjs/src/coinsph.js +7 -7
- package/dist/cjs/src/coinspot.js +39 -39
- package/dist/cjs/src/cryptocom.js +36 -34
- package/dist/cjs/src/ellipx.js +1871 -0
- package/dist/cjs/src/gate.js +2 -1
- package/dist/cjs/src/hyperliquid.js +16 -2
- package/dist/cjs/src/kraken.js +1 -0
- package/dist/cjs/src/krakenfutures.js +3 -1
- package/dist/cjs/src/kucoinfutures.js +1 -1
- package/dist/cjs/src/lbank.js +1 -0
- package/dist/cjs/src/okcoin.js +2 -0
- package/dist/cjs/src/okx.js +104 -9
- package/dist/cjs/src/onetrading.js +14 -1
- package/dist/cjs/src/paradex.js +2 -0
- package/dist/cjs/src/phemex.js +35 -7
- package/dist/cjs/src/poloniex.js +3 -1
- package/dist/cjs/src/poloniexfutures.js +3 -1
- package/dist/cjs/src/pro/idex.js +5 -0
- package/dist/cjs/src/pro/okx.js +11 -1
- package/dist/cjs/src/pro/probit.js +4 -2
- package/dist/cjs/src/pro/woo.js +15 -15
- package/dist/cjs/src/vertex.js +2 -0
- package/dist/cjs/src/woo.js +69 -69
- package/examples/js/cli.js +1 -1
- package/js/ccxt.d.ts +5 -2
- package/js/ccxt.js +4 -2
- package/js/src/abstract/bingx.d.ts +16 -0
- package/js/src/abstract/bitbank.d.ts +5 -0
- package/js/src/abstract/bitfinex2.d.ts +1 -0
- package/js/src/abstract/coinbaseexchange.d.ts +1 -0
- package/js/src/abstract/ellipx.d.ts +28 -0
- package/js/src/abstract/ellipx.js +11 -0
- package/js/src/abstract/kraken.d.ts +1 -0
- package/js/src/alpaca.js +2 -0
- package/js/src/base/Exchange.d.ts +11 -0
- package/js/src/base/Exchange.js +116 -1
- package/js/src/binance.js +164 -6
- package/js/src/bingx.d.ts +3 -1
- package/js/src/bingx.js +156 -9
- package/js/src/bitbank.js +5 -0
- package/js/src/bitbns.js +2 -0
- package/js/src/bitfinex2.js +2 -1
- package/js/src/bitget.d.ts +4 -4
- package/js/src/bitget.js +177 -44
- package/js/src/bitmex.js +2 -0
- package/js/src/bitopro.d.ts +1 -0
- package/js/src/bitopro.js +3 -0
- package/js/src/bitrue.js +1 -0
- package/js/src/btcmarkets.d.ts +1 -0
- package/js/src/btcmarkets.js +2 -0
- package/js/src/bybit.d.ts +3 -2
- package/js/src/bybit.js +149 -14
- package/js/src/cex.d.ts +1 -0
- package/js/src/cex.js +17 -7
- package/js/src/coinbase.d.ts +2 -1
- package/js/src/coinbase.js +5 -24
- package/js/src/coinbaseexchange.js +2 -1
- package/js/src/coinex.js +2 -0
- package/js/src/coinone.js +7 -7
- package/js/src/coinsph.js +7 -7
- package/js/src/coinspot.js +39 -39
- package/js/src/cryptocom.d.ts +1 -1
- package/js/src/cryptocom.js +36 -34
- package/js/src/ellipx.d.ts +236 -0
- package/js/src/ellipx.js +1874 -0
- package/js/src/gate.d.ts +2 -2
- package/js/src/gate.js +2 -1
- package/js/src/hyperliquid.d.ts +2 -1
- package/js/src/hyperliquid.js +16 -2
- package/js/src/kraken.js +1 -0
- package/js/src/krakenfutures.js +3 -1
- package/js/src/kucoinfutures.d.ts +1 -1
- package/js/src/kucoinfutures.js +1 -1
- package/js/src/lbank.js +1 -0
- package/js/src/okcoin.js +2 -0
- package/js/src/okx.d.ts +1 -1
- package/js/src/okx.js +104 -9
- package/js/src/onetrading.d.ts +5 -0
- package/js/src/onetrading.js +15 -2
- package/js/src/paradex.js +2 -0
- package/js/src/phemex.d.ts +4 -0
- package/js/src/phemex.js +35 -7
- package/js/src/poloniex.d.ts +1 -1
- package/js/src/poloniex.js +3 -1
- package/js/src/poloniexfutures.d.ts +1 -1
- package/js/src/poloniexfutures.js +3 -1
- package/js/src/pro/idex.d.ts +5 -0
- package/js/src/pro/idex.js +5 -0
- package/js/src/pro/okx.js +11 -1
- package/js/src/pro/probit.js +4 -2
- package/js/src/pro/woo.d.ts +11 -11
- package/js/src/pro/woo.js +15 -15
- package/js/src/vertex.js +2 -0
- package/js/src/woo.d.ts +60 -60
- package/js/src/woo.js +69 -69
- package/package.json +3 -3
package/dist/cjs/src/gate.js
CHANGED
|
@@ -898,7 +898,7 @@ class gate extends gate$1 {
|
|
|
898
898
|
}
|
|
899
899
|
/**
|
|
900
900
|
* @method
|
|
901
|
-
* @name gate#
|
|
901
|
+
* @name gate#loadUnifiedStatus
|
|
902
902
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
903
903
|
* @description returns unifiedAccount so the user can check if the unified account is enabled
|
|
904
904
|
* @see https://www.gate.io/docs/developers/apiv4/#get-account-detail
|
|
@@ -930,6 +930,7 @@ class gate extends gate$1 {
|
|
|
930
930
|
this.options['unifiedAccount'] = false;
|
|
931
931
|
}
|
|
932
932
|
}
|
|
933
|
+
return this.options['unifiedAccount'];
|
|
933
934
|
}
|
|
934
935
|
async upgradeUnifiedTradeAccount(params = {}) {
|
|
935
936
|
return await this.privateUnifiedPutUnifiedMode(params);
|
|
@@ -48,6 +48,8 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
48
48
|
'createOrder': true,
|
|
49
49
|
'createOrders': true,
|
|
50
50
|
'createReduceOnlyOrder': true,
|
|
51
|
+
'createStopOrder': true,
|
|
52
|
+
'createTriggerOrder': true,
|
|
51
53
|
'editOrder': true,
|
|
52
54
|
'fetchAccounts': false,
|
|
53
55
|
'fetchBalance': true,
|
|
@@ -727,15 +729,27 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
727
729
|
* @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
|
728
730
|
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-perpetuals-asset-contexts-includes-mark-price-current-funding-open-interest-etc
|
|
729
731
|
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/spot#retrieve-spot-asset-contexts
|
|
730
|
-
* @param {string[]
|
|
732
|
+
* @param {string[]} [symbols] unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
731
733
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
734
|
+
* @param {string} [params.type] 'spot' or 'swap', by default fetches both
|
|
732
735
|
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
733
736
|
*/
|
|
734
737
|
async fetchTickers(symbols = undefined, params = {}) {
|
|
735
738
|
await this.loadMarkets();
|
|
736
739
|
symbols = this.marketSymbols(symbols);
|
|
737
740
|
// at this stage, to get tickers data, we use fetchMarkets endpoints
|
|
738
|
-
|
|
741
|
+
let response = [];
|
|
742
|
+
const type = this.safeString(params, 'type');
|
|
743
|
+
params = this.omit(params, 'type');
|
|
744
|
+
if (type === 'spot') {
|
|
745
|
+
response = await this.fetchSpotMarkets(params);
|
|
746
|
+
}
|
|
747
|
+
else if (type === 'swap') {
|
|
748
|
+
response = await this.fetchSwapMarkets(params);
|
|
749
|
+
}
|
|
750
|
+
else {
|
|
751
|
+
response = await this.fetchMarkets(params);
|
|
752
|
+
}
|
|
739
753
|
// same response as under "fetchMarkets"
|
|
740
754
|
const result = {};
|
|
741
755
|
for (let i = 0; i < response.length; i++) {
|
package/dist/cjs/src/kraken.js
CHANGED
|
@@ -36,6 +36,8 @@ class krakenfutures extends krakenfutures$1 {
|
|
|
36
36
|
'cancelOrders': true,
|
|
37
37
|
'createMarketOrder': false,
|
|
38
38
|
'createOrder': true,
|
|
39
|
+
'createStopOrder': true,
|
|
40
|
+
'createTriggerOrder': true,
|
|
39
41
|
'editOrder': true,
|
|
40
42
|
'fetchBalance': true,
|
|
41
43
|
'fetchBorrowRateHistories': false,
|
|
@@ -201,7 +203,7 @@ class krakenfutures extends krakenfutures$1 {
|
|
|
201
203
|
'invalidAmount': errors.BadRequest,
|
|
202
204
|
'insufficientFunds': errors.InsufficientFunds,
|
|
203
205
|
'Bad Request': errors.BadRequest,
|
|
204
|
-
'Unavailable': errors.
|
|
206
|
+
'Unavailable': errors.ExchangeNotAvailable,
|
|
205
207
|
'invalidUnit': errors.BadRequest,
|
|
206
208
|
'Json Parse Error': errors.ExchangeError,
|
|
207
209
|
'nonceBelowThreshold': errors.InvalidNonce,
|
|
@@ -1444,7 +1444,7 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
1444
1444
|
* @param {string} [params.postOnly] Post only flag, invalid when timeInForce is IOC or FOK
|
|
1445
1445
|
* @param {float} [params.cost] the cost of the order in units of USDT
|
|
1446
1446
|
* ----------------- Exchange Specific Parameters -----------------
|
|
1447
|
-
* @param {float} [params.leverage] Leverage size of the order
|
|
1447
|
+
* @param {float} [params.leverage] Leverage size of the order (mandatory param in request, default is 1)
|
|
1448
1448
|
* @param {string} [params.clientOid] client order id, defaults to uuid if not passed
|
|
1449
1449
|
* @param {string} [params.remark] remark for the order, length cannot exceed 100 utf8 characters
|
|
1450
1450
|
* @param {string} [params.stop] 'up' or 'down', the direction the stopPrice is triggered from, requires stopPrice. down: Triggers when the price reaches or goes below the stopPrice. up: Triggers when the price reaches or goes above the stopPrice.
|
package/dist/cjs/src/lbank.js
CHANGED
package/dist/cjs/src/okcoin.js
CHANGED
|
@@ -35,6 +35,8 @@ class okcoin extends okcoin$1 {
|
|
|
35
35
|
'createMarketOrderWithCost': false,
|
|
36
36
|
'createMarketSellOrderWithCost': false,
|
|
37
37
|
'createOrder': true,
|
|
38
|
+
'createStopOrder': true,
|
|
39
|
+
'createTriggerOrder': true,
|
|
38
40
|
'fetchBalance': true,
|
|
39
41
|
'fetchBorrowInterest': false,
|
|
40
42
|
'fetchBorrowRate': false,
|
package/dist/cjs/src/okx.js
CHANGED
|
@@ -1173,6 +1173,98 @@ class okx extends okx$1 {
|
|
|
1173
1173
|
},
|
|
1174
1174
|
'brokerId': 'e847386590ce4dBC',
|
|
1175
1175
|
},
|
|
1176
|
+
'features': {
|
|
1177
|
+
// https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-place-order
|
|
1178
|
+
'default': {
|
|
1179
|
+
'sandbox': true,
|
|
1180
|
+
'createOrder': {
|
|
1181
|
+
'marginMode': true,
|
|
1182
|
+
'triggerPrice': true,
|
|
1183
|
+
'triggerPriceType': {
|
|
1184
|
+
'last': true,
|
|
1185
|
+
'mark': true,
|
|
1186
|
+
'index': true,
|
|
1187
|
+
},
|
|
1188
|
+
'triggerDirection': false,
|
|
1189
|
+
'stopLossPrice': true,
|
|
1190
|
+
'takeProfitPrice': true,
|
|
1191
|
+
'attachedStopLossTakeProfit': {
|
|
1192
|
+
'triggerPriceType': {
|
|
1193
|
+
'last': true,
|
|
1194
|
+
'mark': true,
|
|
1195
|
+
'index': true,
|
|
1196
|
+
},
|
|
1197
|
+
'limitPrice': true,
|
|
1198
|
+
},
|
|
1199
|
+
'timeInForce': {
|
|
1200
|
+
'GTC': true,
|
|
1201
|
+
'IOC': true,
|
|
1202
|
+
'FOK': true,
|
|
1203
|
+
'PO': true,
|
|
1204
|
+
'GTD': false,
|
|
1205
|
+
},
|
|
1206
|
+
'hedged': true,
|
|
1207
|
+
// even though the below params not unified yet, it's useful metadata for users to know that exchange supports them
|
|
1208
|
+
'selfTradePrevention': true,
|
|
1209
|
+
'trailing': true,
|
|
1210
|
+
'twap': true,
|
|
1211
|
+
'iceberg': true,
|
|
1212
|
+
'oco': true,
|
|
1213
|
+
},
|
|
1214
|
+
'createOrders': {
|
|
1215
|
+
'max': 20,
|
|
1216
|
+
},
|
|
1217
|
+
'fetchMyTrades': {
|
|
1218
|
+
'marginMode': false,
|
|
1219
|
+
'daysBack': 90,
|
|
1220
|
+
'limit': 100,
|
|
1221
|
+
'untilDays': 10000,
|
|
1222
|
+
},
|
|
1223
|
+
'fetchOrder': {
|
|
1224
|
+
'marginMode': false,
|
|
1225
|
+
'trigger': true,
|
|
1226
|
+
'trailing': true,
|
|
1227
|
+
},
|
|
1228
|
+
'fetchOpenOrders': {
|
|
1229
|
+
'marginMode': false,
|
|
1230
|
+
'limit': 100,
|
|
1231
|
+
'trigger': true,
|
|
1232
|
+
'trailing': true,
|
|
1233
|
+
},
|
|
1234
|
+
'fetchOrders': undefined,
|
|
1235
|
+
'fetchClosedOrders': {
|
|
1236
|
+
'marginMode': false,
|
|
1237
|
+
'limit': 100,
|
|
1238
|
+
'daysBackClosed': 90,
|
|
1239
|
+
'daysBackCanceled': 1 / 12,
|
|
1240
|
+
'untilDays': undefined,
|
|
1241
|
+
'trigger': true,
|
|
1242
|
+
'trailing': true,
|
|
1243
|
+
},
|
|
1244
|
+
'fetchOHLCV': {
|
|
1245
|
+
'limit': 300,
|
|
1246
|
+
},
|
|
1247
|
+
},
|
|
1248
|
+
'spot': {
|
|
1249
|
+
'extends': 'default',
|
|
1250
|
+
},
|
|
1251
|
+
'swap': {
|
|
1252
|
+
'linear': {
|
|
1253
|
+
'extends': 'default',
|
|
1254
|
+
},
|
|
1255
|
+
'inverse': {
|
|
1256
|
+
'extends': 'default',
|
|
1257
|
+
},
|
|
1258
|
+
},
|
|
1259
|
+
'future': {
|
|
1260
|
+
'linear': {
|
|
1261
|
+
'extends': 'default',
|
|
1262
|
+
},
|
|
1263
|
+
'inverse': {
|
|
1264
|
+
'extends': 'default',
|
|
1265
|
+
},
|
|
1266
|
+
},
|
|
1267
|
+
},
|
|
1176
1268
|
'commonCurrencies': {
|
|
1177
1269
|
// the exchange refers to ERC20 version of Aeternity (AEToken)
|
|
1178
1270
|
'AE': 'AET',
|
|
@@ -1723,7 +1815,7 @@ class okx extends okx$1 {
|
|
|
1723
1815
|
'active': active,
|
|
1724
1816
|
'deposit': canDeposit,
|
|
1725
1817
|
'withdraw': canWithdraw,
|
|
1726
|
-
'fee': this.safeNumber(chain, '
|
|
1818
|
+
'fee': this.safeNumber(chain, 'fee'),
|
|
1727
1819
|
'precision': this.parseNumber(precision),
|
|
1728
1820
|
'limits': {
|
|
1729
1821
|
'withdraw': {
|
|
@@ -3218,7 +3310,7 @@ class okx extends okx$1 {
|
|
|
3218
3310
|
request['newPx'] = this.priceToPrecision(symbol, price);
|
|
3219
3311
|
}
|
|
3220
3312
|
}
|
|
3221
|
-
params = this.omit(params, ['clOrdId', 'clientOrderId', 'takeProfitPrice', 'stopLossPrice', 'stopLoss', 'takeProfit']);
|
|
3313
|
+
params = this.omit(params, ['clOrdId', 'clientOrderId', 'takeProfitPrice', 'stopLossPrice', 'stopLoss', 'takeProfit', 'postOnly']);
|
|
3222
3314
|
return this.extend(request, params);
|
|
3223
3315
|
}
|
|
3224
3316
|
/**
|
|
@@ -6398,7 +6490,7 @@ class okx extends okx$1 {
|
|
|
6398
6490
|
* @param {string} symbol unified market symbol
|
|
6399
6491
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6400
6492
|
* @param {string} [params.marginMode] 'cross' or 'isolated'
|
|
6401
|
-
* @param {string} [params.posSide] 'long' or 'short' for isolated margin long/short mode on futures and swap markets
|
|
6493
|
+
* @param {string} [params.posSide] 'long' or 'short' or 'net' for isolated margin long/short mode on futures and swap markets, default is 'net'
|
|
6402
6494
|
* @returns {object} response from the exchange
|
|
6403
6495
|
*/
|
|
6404
6496
|
async setLeverage(leverage, symbol = undefined, params = {}) {
|
|
@@ -6425,14 +6517,12 @@ class okx extends okx$1 {
|
|
|
6425
6517
|
'mgnMode': marginMode,
|
|
6426
6518
|
'instId': market['id'],
|
|
6427
6519
|
};
|
|
6428
|
-
const posSide = this.safeString(params, 'posSide');
|
|
6520
|
+
const posSide = this.safeString(params, 'posSide', 'net');
|
|
6429
6521
|
if (marginMode === 'isolated') {
|
|
6430
|
-
if (posSide === undefined) {
|
|
6431
|
-
throw new errors.ArgumentsRequired(this.id + ' setLeverage() requires a posSide argument for isolated margin');
|
|
6432
|
-
}
|
|
6433
6522
|
if (posSide !== 'long' && posSide !== 'short' && posSide !== 'net') {
|
|
6434
6523
|
throw new errors.BadRequest(this.id + ' setLeverage() requires the posSide argument to be either "long", "short" or "net"');
|
|
6435
6524
|
}
|
|
6525
|
+
request['posSide'] = posSide;
|
|
6436
6526
|
}
|
|
6437
6527
|
const response = await this.privatePostAccountSetLeverage(this.extend(request, params));
|
|
6438
6528
|
//
|
|
@@ -7383,7 +7473,12 @@ class okx extends okx$1 {
|
|
|
7383
7473
|
*/
|
|
7384
7474
|
async fetchDepositWithdrawFees(codes = undefined, params = {}) {
|
|
7385
7475
|
await this.loadMarkets();
|
|
7386
|
-
const
|
|
7476
|
+
const request = {};
|
|
7477
|
+
if (codes !== undefined) {
|
|
7478
|
+
const ids = this.currencyIds(codes);
|
|
7479
|
+
request['ccy'] = ids.join(',');
|
|
7480
|
+
}
|
|
7481
|
+
const response = await this.privateGetAssetCurrencies(this.extend(request, params));
|
|
7387
7482
|
//
|
|
7388
7483
|
// {
|
|
7389
7484
|
// "code": "0",
|
|
@@ -7470,7 +7565,7 @@ class okx extends okx$1 {
|
|
|
7470
7565
|
}
|
|
7471
7566
|
const chainSplit = chain.split('-');
|
|
7472
7567
|
const networkId = this.safeValue(chainSplit, 1);
|
|
7473
|
-
const withdrawFee = this.safeNumber(feeInfo, '
|
|
7568
|
+
const withdrawFee = this.safeNumber(feeInfo, 'fee');
|
|
7474
7569
|
const withdrawResult = {
|
|
7475
7570
|
'fee': withdrawFee,
|
|
7476
7571
|
'percentage': (withdrawFee !== undefined) ? false : undefined,
|
|
@@ -305,6 +305,7 @@ class onetrading extends onetrading$1 {
|
|
|
305
305
|
* @method
|
|
306
306
|
* @name onetrading#fetchTime
|
|
307
307
|
* @description fetches the current integer timestamp in milliseconds from the exchange server
|
|
308
|
+
* @see https://docs.onetrading.com/#time
|
|
308
309
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
309
310
|
* @returns {int} the current integer timestamp in milliseconds from the exchange server
|
|
310
311
|
*/
|
|
@@ -322,6 +323,7 @@ class onetrading extends onetrading$1 {
|
|
|
322
323
|
* @method
|
|
323
324
|
* @name onetrading#fetchCurrencies
|
|
324
325
|
* @description fetches all available currencies on an exchange
|
|
326
|
+
* @see https://docs.onetrading.com/#currencies
|
|
325
327
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
326
328
|
* @returns {object} an associative dictionary of currencies
|
|
327
329
|
*/
|
|
@@ -363,6 +365,7 @@ class onetrading extends onetrading$1 {
|
|
|
363
365
|
* @method
|
|
364
366
|
* @name onetrading#fetchMarkets
|
|
365
367
|
* @description retrieves data on all markets for onetrading
|
|
368
|
+
* @see https://docs.onetrading.com/#instruments
|
|
366
369
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
367
370
|
* @returns {object[]} an array of objects representing market data
|
|
368
371
|
*/
|
|
@@ -445,6 +448,8 @@ class onetrading extends onetrading$1 {
|
|
|
445
448
|
* @method
|
|
446
449
|
* @name onetrading#fetchTradingFees
|
|
447
450
|
* @description fetch the trading fees for multiple markets
|
|
451
|
+
* @see https://docs.onetrading.com/#fee-groups
|
|
452
|
+
* @see https://docs.onetrading.com/#fees
|
|
448
453
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
449
454
|
* @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
|
|
450
455
|
*/
|
|
@@ -455,7 +460,15 @@ class onetrading extends onetrading$1 {
|
|
|
455
460
|
const options = this.safeValue(this.options, 'fetchTradingFees', {});
|
|
456
461
|
method = this.safeString(options, 'method', 'fetchPrivateTradingFees');
|
|
457
462
|
}
|
|
458
|
-
|
|
463
|
+
if (method === 'fetchPrivateTradingFees') {
|
|
464
|
+
return await this.fetchPrivateTradingFees(params);
|
|
465
|
+
}
|
|
466
|
+
else if (method === 'fetchPublicTradingFees') {
|
|
467
|
+
return await this.fetchPublicTradingFees(params);
|
|
468
|
+
}
|
|
469
|
+
else {
|
|
470
|
+
throw new errors.NotSupported(this.id + ' fetchTradingFees() does not support ' + method + ', fetchPrivateTradingFees and fetchPublicTradingFees are supported');
|
|
471
|
+
}
|
|
459
472
|
}
|
|
460
473
|
async fetchPublicTradingFees(params = {}) {
|
|
461
474
|
await this.loadMarkets();
|
package/dist/cjs/src/paradex.js
CHANGED
package/dist/cjs/src/phemex.js
CHANGED
|
@@ -510,7 +510,7 @@ class phemex extends phemex$1 {
|
|
|
510
510
|
parseSwapMarket(market) {
|
|
511
511
|
//
|
|
512
512
|
// {
|
|
513
|
-
// "symbol":"BTCUSD",
|
|
513
|
+
// "symbol":"BTCUSD", //
|
|
514
514
|
// "code":"1",
|
|
515
515
|
// "type":"Perpetual",
|
|
516
516
|
// "displaySymbol":"BTC / USD",
|
|
@@ -518,7 +518,7 @@ class phemex extends phemex$1 {
|
|
|
518
518
|
// "markSymbol":".MBTC",
|
|
519
519
|
// "fundingRateSymbol":".BTCFR",
|
|
520
520
|
// "fundingRate8hSymbol":".BTCFR8H",
|
|
521
|
-
// "contractUnderlyingAssets":"USD",
|
|
521
|
+
// "contractUnderlyingAssets":"USD", // or eg. `1000 SHIB`
|
|
522
522
|
// "settleCurrency":"BTC",
|
|
523
523
|
// "quoteCurrency":"USD",
|
|
524
524
|
// "contractSize":"1 USD",
|
|
@@ -561,7 +561,8 @@ class phemex extends phemex$1 {
|
|
|
561
561
|
const baseId = this.safeString2(market, 'baseCurrency', 'contractUnderlyingAssets');
|
|
562
562
|
const quoteId = this.safeString(market, 'quoteCurrency');
|
|
563
563
|
const settleId = this.safeString(market, 'settleCurrency');
|
|
564
|
-
|
|
564
|
+
let base = this.safeCurrencyCode(baseId);
|
|
565
|
+
base = base.replace(' ', ''); // replace space for junction codes, eg. `1000 SHIB`
|
|
565
566
|
const quote = this.safeCurrencyCode(quoteId);
|
|
566
567
|
const settle = this.safeCurrencyCode(settleId);
|
|
567
568
|
let inverse = false;
|
|
@@ -2636,12 +2637,35 @@ class phemex extends phemex$1 {
|
|
|
2636
2637
|
if (triggerPrice !== undefined) {
|
|
2637
2638
|
const triggerType = this.safeString(params, 'triggerType', 'ByMarkPrice');
|
|
2638
2639
|
request['triggerType'] = triggerType;
|
|
2640
|
+
// set direction & exchange specific order type
|
|
2641
|
+
let triggerDirection = undefined;
|
|
2642
|
+
[triggerDirection, params] = this.handleParamString(params, 'triggerDirection');
|
|
2643
|
+
if (triggerDirection === undefined) {
|
|
2644
|
+
throw new errors.ArgumentsRequired(this.id + " createOrder() also requires a 'triggerDirection' parameter with either 'up' or 'down' value");
|
|
2645
|
+
}
|
|
2646
|
+
// the flow defined per https://phemex-docs.github.io/#more-order-type-examples
|
|
2647
|
+
if (triggerDirection === 'up') {
|
|
2648
|
+
if (side === 'sell') {
|
|
2649
|
+
request['ordType'] = (type === 'Market') ? 'MarketIfTouched' : 'LimitIfTouched';
|
|
2650
|
+
}
|
|
2651
|
+
else if (side === 'buy') {
|
|
2652
|
+
request['ordType'] = (type === 'Market') ? 'Stop' : 'StopLimit';
|
|
2653
|
+
}
|
|
2654
|
+
}
|
|
2655
|
+
else if (triggerDirection === 'down') {
|
|
2656
|
+
if (side === 'sell') {
|
|
2657
|
+
request['ordType'] = (type === 'Market') ? 'Stop' : 'StopLimit';
|
|
2658
|
+
}
|
|
2659
|
+
else if (side === 'buy') {
|
|
2660
|
+
request['ordType'] = (type === 'Market') ? 'MarketIfTouched' : 'LimitIfTouched';
|
|
2661
|
+
}
|
|
2662
|
+
}
|
|
2639
2663
|
}
|
|
2640
2664
|
if (stopLossDefined || takeProfitDefined) {
|
|
2641
2665
|
if (stopLossDefined) {
|
|
2642
2666
|
const stopLossTriggerPrice = this.safeValue2(stopLoss, 'triggerPrice', 'stopPrice');
|
|
2643
2667
|
if (stopLossTriggerPrice === undefined) {
|
|
2644
|
-
throw new errors.InvalidOrder(this.id + ' createOrder() requires a trigger price in params["stopLoss"]["triggerPrice"]
|
|
2668
|
+
throw new errors.InvalidOrder(this.id + ' createOrder() requires a trigger price in params["stopLoss"]["triggerPrice"] for a stop loss order');
|
|
2645
2669
|
}
|
|
2646
2670
|
if (market['settle'] === 'USDT') {
|
|
2647
2671
|
request['stopLossRp'] = this.priceToPrecision(symbol, stopLossTriggerPrice);
|
|
@@ -2661,7 +2685,7 @@ class phemex extends phemex$1 {
|
|
|
2661
2685
|
if (takeProfitDefined) {
|
|
2662
2686
|
const takeProfitTriggerPrice = this.safeValue2(takeProfit, 'triggerPrice', 'stopPrice');
|
|
2663
2687
|
if (takeProfitTriggerPrice === undefined) {
|
|
2664
|
-
throw new errors.InvalidOrder(this.id + ' createOrder() requires a trigger price in params["takeProfit"]["triggerPrice"]
|
|
2688
|
+
throw new errors.InvalidOrder(this.id + ' createOrder() requires a trigger price in params["takeProfit"]["triggerPrice"] for a take profit order');
|
|
2665
2689
|
}
|
|
2666
2690
|
if (market['settle'] === 'USDT') {
|
|
2667
2691
|
request['takeProfitRp'] = this.priceToPrecision(symbol, takeProfitTriggerPrice);
|
|
@@ -2851,7 +2875,7 @@ class phemex extends phemex$1 {
|
|
|
2851
2875
|
request['baseQtyEV'] = this.toEv(amount, market);
|
|
2852
2876
|
}
|
|
2853
2877
|
}
|
|
2854
|
-
const stopPrice = this.
|
|
2878
|
+
const stopPrice = this.safeStringN(params, ['triggerPrice', 'stopPx', 'stopPrice']);
|
|
2855
2879
|
if (stopPrice !== undefined) {
|
|
2856
2880
|
if (isUSDTSettled) {
|
|
2857
2881
|
request['stopPxRp'] = this.priceToPrecision(symbol, stopPrice);
|
|
@@ -2860,7 +2884,7 @@ class phemex extends phemex$1 {
|
|
|
2860
2884
|
request['stopPxEp'] = this.toEp(stopPrice, market);
|
|
2861
2885
|
}
|
|
2862
2886
|
}
|
|
2863
|
-
params = this.omit(params, ['stopPx', 'stopPrice']);
|
|
2887
|
+
params = this.omit(params, ['triggerPrice', 'stopPx', 'stopPrice']);
|
|
2864
2888
|
let response = undefined;
|
|
2865
2889
|
if (isUSDTSettled) {
|
|
2866
2890
|
const posSide = this.safeString(params, 'posSide');
|
|
@@ -4204,6 +4228,7 @@ class phemex extends phemex$1 {
|
|
|
4204
4228
|
* @method
|
|
4205
4229
|
* @name phemex#setMarginMode
|
|
4206
4230
|
* @description set margin mode to 'cross' or 'isolated'
|
|
4231
|
+
* @see https://phemex-docs.github.io/#set-leverage
|
|
4207
4232
|
* @param {string} marginMode 'cross' or 'isolated'
|
|
4208
4233
|
* @param {string} symbol unified market symbol
|
|
4209
4234
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -4494,6 +4519,8 @@ class phemex extends phemex$1 {
|
|
|
4494
4519
|
* @method
|
|
4495
4520
|
* @name phemex#transfer
|
|
4496
4521
|
* @description transfer currency internally between wallets on the same account
|
|
4522
|
+
* @see https://phemex-docs.github.io/#transfer-between-spot-and-futures
|
|
4523
|
+
* @see https://phemex-docs.github.io/#universal-transfer-main-account-only-transfer-between-sub-to-main-main-to-sub-or-sub-to-sub
|
|
4497
4524
|
* @param {string} code unified currency code
|
|
4498
4525
|
* @param {float} amount amount to transfer
|
|
4499
4526
|
* @param {string} fromAccount account to transfer from
|
|
@@ -4581,6 +4608,7 @@ class phemex extends phemex$1 {
|
|
|
4581
4608
|
* @method
|
|
4582
4609
|
* @name phemex#fetchTransfers
|
|
4583
4610
|
* @description fetch a history of internal transfers made on an account
|
|
4611
|
+
* @see https://phemex-docs.github.io/#query-transfer-history
|
|
4584
4612
|
* @param {string} code unified currency code of the currency transferred
|
|
4585
4613
|
* @param {int} [since] the earliest time in ms to fetch transfers for
|
|
4586
4614
|
* @param {int} [limit] the maximum number of transfers structures to retrieve
|
package/dist/cjs/src/poloniex.js
CHANGED
|
@@ -36,6 +36,8 @@ class poloniex extends poloniex$1 {
|
|
|
36
36
|
'createMarketOrderWithCost': false,
|
|
37
37
|
'createMarketSellOrderWithCost': false,
|
|
38
38
|
'createOrder': true,
|
|
39
|
+
'createStopOrder': true,
|
|
40
|
+
'createTriggerOrder': true,
|
|
39
41
|
'editOrder': true,
|
|
40
42
|
'fetchBalance': true,
|
|
41
43
|
'fetchClosedOrder': false,
|
|
@@ -1266,7 +1268,7 @@ class poloniex extends poloniex$1 {
|
|
|
1266
1268
|
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
1267
1269
|
* @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
|
1268
1270
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1269
|
-
* @param {float} [params.triggerPrice]
|
|
1271
|
+
* @param {float} [params.triggerPrice] the price at which a trigger order is triggered at
|
|
1270
1272
|
* @param {float} [params.cost] *spot market buy only* the quote quantity that can be used as an alternative for the amount
|
|
1271
1273
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1272
1274
|
*/
|
|
@@ -31,6 +31,8 @@ class poloniexfutures extends poloniexfutures$1 {
|
|
|
31
31
|
'future': false,
|
|
32
32
|
'option': undefined,
|
|
33
33
|
'createOrder': true,
|
|
34
|
+
'createStopOrder': true,
|
|
35
|
+
'createTriggerOrder': true,
|
|
34
36
|
'fetchBalance': true,
|
|
35
37
|
'fetchClosedOrders': true,
|
|
36
38
|
'fetchCurrencies': false,
|
|
@@ -835,7 +837,7 @@ class poloniexfutures extends poloniexfutures$1 {
|
|
|
835
837
|
* @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
|
836
838
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
837
839
|
* @param {float} [params.leverage] Leverage size of the order
|
|
838
|
-
* @param {float} [params.
|
|
840
|
+
* @param {float} [params.triggerPrice] The price at which a trigger order is triggered at
|
|
839
841
|
* @param {bool} [params.reduceOnly] A mark to reduce the position size only. Set to false by default. Need to set the position size when reduceOnly is true.
|
|
840
842
|
* @param {string} [params.timeInForce] GTC, GTT, IOC, or FOK, default is GTC, limit orders only
|
|
841
843
|
* @param {string} [params.postOnly] Post only flag, invalid when timeInForce is IOC or FOK
|
package/dist/cjs/src/pro/idex.js
CHANGED
|
@@ -67,6 +67,7 @@ class idex extends idex$1 {
|
|
|
67
67
|
* @method
|
|
68
68
|
* @name idex#watchTicker
|
|
69
69
|
* @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
70
|
+
* @see https://api-docs-v4.idex.io/#tickers
|
|
70
71
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
71
72
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
72
73
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -139,6 +140,7 @@ class idex extends idex$1 {
|
|
|
139
140
|
* @method
|
|
140
141
|
* @name idex#watchTrades
|
|
141
142
|
* @description get the list of most recent trades for a particular symbol
|
|
143
|
+
* @see https://api-docs-v4.idex.io/#trades
|
|
142
144
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
143
145
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
144
146
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
@@ -233,6 +235,7 @@ class idex extends idex$1 {
|
|
|
233
235
|
* @method
|
|
234
236
|
* @name idex#watchOHLCV
|
|
235
237
|
* @description watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
238
|
+
* @see https://api-docs-v4.idex.io/#candles
|
|
236
239
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
237
240
|
* @param {string} timeframe the length of time each candle represents
|
|
238
241
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
@@ -403,6 +406,7 @@ class idex extends idex$1 {
|
|
|
403
406
|
* @method
|
|
404
407
|
* @name idex#watchOrderBook
|
|
405
408
|
* @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
409
|
+
* @see https://api-docs-v4.idex.io/#l2-order-book
|
|
406
410
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
407
411
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
408
412
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -506,6 +510,7 @@ class idex extends idex$1 {
|
|
|
506
510
|
* @method
|
|
507
511
|
* @name idex#watchOrders
|
|
508
512
|
* @description watches information on multiple orders made by the user
|
|
513
|
+
* @see https://api-docs-v4.idex.io/#orders
|
|
509
514
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
510
515
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
511
516
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
package/dist/cjs/src/pro/okx.js
CHANGED
|
@@ -2252,6 +2252,7 @@ class okx extends okx$1 {
|
|
|
2252
2252
|
//
|
|
2253
2253
|
// { event: 'error', msg: "Illegal request: {"op":"subscribe","args":["spot/ticker:BTC-USDT"]}", code: "60012" }
|
|
2254
2254
|
// { event: 'error", msg: "channel:ticker,instId:BTC-USDT doesn"t exist", code: "60018" }
|
|
2255
|
+
// {"event":"error","msg":"Illegal request: {\\"id\\":\\"17321173472466905\\",\\"op\\":\\"amend-order\\",\\"args\\":[{\\"instId\\":\\"ETH-USDC\\",\\"ordId\\":\\"2000345622407479296\\",\\"newSz\\":\\"0.050857\\",\\"newPx\\":\\"2949.4\\",\\"postOnly\\":true}],\\"postOnly\\":true}","code":"60012","connId":"0808af6c"}
|
|
2255
2256
|
//
|
|
2256
2257
|
let errorCode = this.safeString(message, 'code');
|
|
2257
2258
|
try {
|
|
@@ -2284,7 +2285,16 @@ class okx extends okx$1 {
|
|
|
2284
2285
|
catch (e) {
|
|
2285
2286
|
// if the message contains an id, it means it is a response to a request
|
|
2286
2287
|
// so we only reject that promise, instead of deleting all futures, destroying the authentication future
|
|
2287
|
-
|
|
2288
|
+
let id = this.safeString(message, 'id');
|
|
2289
|
+
if (id === undefined) {
|
|
2290
|
+
// try to parse it from the stringified json inside msg
|
|
2291
|
+
const msg = this.safeString(message, 'msg');
|
|
2292
|
+
if (msg !== undefined && msg.startsWith('Illegal request: {')) {
|
|
2293
|
+
const stringifiedJson = msg.replace('Illegal request: ', '');
|
|
2294
|
+
const parsedJson = this.parseJson(stringifiedJson);
|
|
2295
|
+
id = this.safeString(parsedJson, 'id');
|
|
2296
|
+
}
|
|
2297
|
+
}
|
|
2288
2298
|
if (id !== undefined) {
|
|
2289
2299
|
client.reject(e, id);
|
|
2290
2300
|
return false;
|
|
@@ -523,11 +523,13 @@ class probit extends probit$1 {
|
|
|
523
523
|
this.handleTicker(client, message);
|
|
524
524
|
}
|
|
525
525
|
const trades = this.safeValue(message, 'recent_trades', []);
|
|
526
|
-
|
|
526
|
+
const tradesLength = trades.length;
|
|
527
|
+
if (tradesLength) {
|
|
527
528
|
this.handleTrades(client, message);
|
|
528
529
|
}
|
|
529
530
|
const orderBook = this.safeValueN(message, ['order_books', 'order_books_l1', 'order_books_l2', 'order_books_l3', 'order_books_l4'], []);
|
|
530
|
-
|
|
531
|
+
const orderBookLength = orderBook.length;
|
|
532
|
+
if (orderBookLength) {
|
|
531
533
|
this.handleOrderBook(client, message, orderBook);
|
|
532
534
|
}
|
|
533
535
|
}
|