ccxt 4.4.33 → 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 +32 -6
- package/dist/cjs/src/binance.js +19 -14
- 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 +14 -11
- package/dist/cjs/src/cex.js +13 -4
- package/dist/cjs/src/coinbase.js +3 -2
- package/dist/cjs/src/coinex.js +1 -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 +2 -0
- package/dist/cjs/src/krakenfutures.js +3 -1
- package/dist/cjs/src/okcoin.js +2 -0
- package/dist/cjs/src/okx.js +15 -11
- package/dist/cjs/src/onetrading.js +14 -1
- package/dist/cjs/src/paradex.js +2 -0
- package/dist/cjs/src/phemex.js +23 -0
- 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/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/ellipx.d.ts +28 -0
- package/js/src/abstract/ellipx.js +11 -0
- package/js/src/alpaca.js +2 -0
- package/js/src/base/Exchange.d.ts +8 -0
- package/js/src/base/Exchange.js +32 -6
- package/js/src/binance.js +19 -14
- 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 +14 -11
- package/js/src/cex.d.ts +1 -0
- package/js/src/cex.js +13 -4
- package/js/src/coinbase.d.ts +2 -1
- package/js/src/coinbase.js +3 -2
- package/js/src/coinex.js +1 -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.js +2 -0
- package/js/src/krakenfutures.js +3 -1
- package/js/src/okcoin.js +2 -0
- package/js/src/okx.d.ts +1 -1
- package/js/src/okx.js +15 -11
- 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.js +23 -0
- 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/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/js/src/gate.d.ts
CHANGED
|
@@ -9,13 +9,13 @@ export default class gate extends Exchange {
|
|
|
9
9
|
setSandboxMode(enable: boolean): void;
|
|
10
10
|
/**
|
|
11
11
|
* @method
|
|
12
|
-
* @name gate#
|
|
12
|
+
* @name gate#loadUnifiedStatus
|
|
13
13
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
14
14
|
* @description returns unifiedAccount so the user can check if the unified account is enabled
|
|
15
15
|
* @see https://www.gate.io/docs/developers/apiv4/#get-account-detail
|
|
16
16
|
* @returns {boolean} true or false if the enabled unified account is enabled or not and sets the unifiedAccount option if it is undefined
|
|
17
17
|
*/
|
|
18
|
-
loadUnifiedStatus(params?: {}): Promise<
|
|
18
|
+
loadUnifiedStatus(params?: {}): Promise<any>;
|
|
19
19
|
upgradeUnifiedTradeAccount(params?: {}): Promise<any>;
|
|
20
20
|
/**
|
|
21
21
|
* @method
|
package/js/src/gate.js
CHANGED
|
@@ -901,7 +901,7 @@ export default class gate extends Exchange {
|
|
|
901
901
|
}
|
|
902
902
|
/**
|
|
903
903
|
* @method
|
|
904
|
-
* @name gate#
|
|
904
|
+
* @name gate#loadUnifiedStatus
|
|
905
905
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
906
906
|
* @description returns unifiedAccount so the user can check if the unified account is enabled
|
|
907
907
|
* @see https://www.gate.io/docs/developers/apiv4/#get-account-detail
|
|
@@ -933,6 +933,7 @@ export default class gate extends Exchange {
|
|
|
933
933
|
this.options['unifiedAccount'] = false;
|
|
934
934
|
}
|
|
935
935
|
}
|
|
936
|
+
return this.options['unifiedAccount'];
|
|
936
937
|
}
|
|
937
938
|
async upgradeUnifiedTradeAccount(params = {}) {
|
|
938
939
|
return await this.privateUnifiedPutUnifiedMode(params);
|
package/js/src/hyperliquid.js
CHANGED
|
@@ -51,6 +51,8 @@ export default class hyperliquid extends Exchange {
|
|
|
51
51
|
'createOrder': true,
|
|
52
52
|
'createOrders': true,
|
|
53
53
|
'createReduceOnlyOrder': true,
|
|
54
|
+
'createStopOrder': true,
|
|
55
|
+
'createTriggerOrder': true,
|
|
54
56
|
'editOrder': true,
|
|
55
57
|
'fetchAccounts': false,
|
|
56
58
|
'fetchBalance': true,
|
package/js/src/krakenfutures.js
CHANGED
|
@@ -39,6 +39,8 @@ export default class krakenfutures extends Exchange {
|
|
|
39
39
|
'cancelOrders': true,
|
|
40
40
|
'createMarketOrder': false,
|
|
41
41
|
'createOrder': true,
|
|
42
|
+
'createStopOrder': true,
|
|
43
|
+
'createTriggerOrder': true,
|
|
42
44
|
'editOrder': true,
|
|
43
45
|
'fetchBalance': true,
|
|
44
46
|
'fetchBorrowRateHistories': false,
|
|
@@ -204,7 +206,7 @@ export default class krakenfutures extends Exchange {
|
|
|
204
206
|
'invalidAmount': BadRequest,
|
|
205
207
|
'insufficientFunds': InsufficientFunds,
|
|
206
208
|
'Bad Request': BadRequest,
|
|
207
|
-
'Unavailable':
|
|
209
|
+
'Unavailable': ExchangeNotAvailable,
|
|
208
210
|
'invalidUnit': BadRequest,
|
|
209
211
|
'Json Parse Error': ExchangeError,
|
|
210
212
|
'nonceBelowThreshold': InvalidNonce,
|
package/js/src/okcoin.js
CHANGED
|
@@ -38,6 +38,8 @@ export default class okcoin extends Exchange {
|
|
|
38
38
|
'createMarketOrderWithCost': false,
|
|
39
39
|
'createMarketSellOrderWithCost': false,
|
|
40
40
|
'createOrder': true,
|
|
41
|
+
'createStopOrder': true,
|
|
42
|
+
'createTriggerOrder': true,
|
|
41
43
|
'fetchBalance': true,
|
|
42
44
|
'fetchBorrowInterest': false,
|
|
43
45
|
'fetchBorrowRate': false,
|
package/js/src/okx.d.ts
CHANGED
|
@@ -662,7 +662,7 @@ export default class okx extends Exchange {
|
|
|
662
662
|
* @param {string} symbol unified market symbol
|
|
663
663
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
664
664
|
* @param {string} [params.marginMode] 'cross' or 'isolated'
|
|
665
|
-
* @param {string} [params.posSide] 'long' or 'short' for isolated margin long/short mode on futures and swap markets
|
|
665
|
+
* @param {string} [params.posSide] 'long' or 'short' or 'net' for isolated margin long/short mode on futures and swap markets, default is 'net'
|
|
666
666
|
* @returns {object} response from the exchange
|
|
667
667
|
*/
|
|
668
668
|
setLeverage(leverage: Int, symbol?: Str, params?: {}): Promise<any>;
|
package/js/src/okx.js
CHANGED
|
@@ -1181,6 +1181,7 @@ export default class okx extends Exchange {
|
|
|
1181
1181
|
'default': {
|
|
1182
1182
|
'sandbox': true,
|
|
1183
1183
|
'createOrder': {
|
|
1184
|
+
'marginMode': true,
|
|
1184
1185
|
'triggerPrice': true,
|
|
1185
1186
|
'triggerPriceType': {
|
|
1186
1187
|
'last': true,
|
|
@@ -1190,7 +1191,6 @@ export default class okx extends Exchange {
|
|
|
1190
1191
|
'triggerDirection': false,
|
|
1191
1192
|
'stopLossPrice': true,
|
|
1192
1193
|
'takeProfitPrice': true,
|
|
1193
|
-
'marginMode': true,
|
|
1194
1194
|
'attachedStopLossTakeProfit': {
|
|
1195
1195
|
'triggerPriceType': {
|
|
1196
1196
|
'last': true,
|
|
@@ -1218,6 +1218,7 @@ export default class okx extends Exchange {
|
|
|
1218
1218
|
'max': 20,
|
|
1219
1219
|
},
|
|
1220
1220
|
'fetchMyTrades': {
|
|
1221
|
+
'marginMode': false,
|
|
1221
1222
|
'daysBack': 90,
|
|
1222
1223
|
'limit': 100,
|
|
1223
1224
|
'untilDays': 10000,
|
|
@@ -1228,18 +1229,18 @@ export default class okx extends Exchange {
|
|
|
1228
1229
|
'trailing': true,
|
|
1229
1230
|
},
|
|
1230
1231
|
'fetchOpenOrders': {
|
|
1231
|
-
'limit': 100,
|
|
1232
1232
|
'marginMode': false,
|
|
1233
|
+
'limit': 100,
|
|
1233
1234
|
'trigger': true,
|
|
1234
1235
|
'trailing': true,
|
|
1235
1236
|
},
|
|
1236
1237
|
'fetchOrders': undefined,
|
|
1237
1238
|
'fetchClosedOrders': {
|
|
1239
|
+
'marginMode': false,
|
|
1238
1240
|
'limit': 100,
|
|
1239
1241
|
'daysBackClosed': 90,
|
|
1240
1242
|
'daysBackCanceled': 1 / 12,
|
|
1241
1243
|
'untilDays': undefined,
|
|
1242
|
-
'marginMode': false,
|
|
1243
1244
|
'trigger': true,
|
|
1244
1245
|
'trailing': true,
|
|
1245
1246
|
},
|
|
@@ -1817,7 +1818,7 @@ export default class okx extends Exchange {
|
|
|
1817
1818
|
'active': active,
|
|
1818
1819
|
'deposit': canDeposit,
|
|
1819
1820
|
'withdraw': canWithdraw,
|
|
1820
|
-
'fee': this.safeNumber(chain, '
|
|
1821
|
+
'fee': this.safeNumber(chain, 'fee'),
|
|
1821
1822
|
'precision': this.parseNumber(precision),
|
|
1822
1823
|
'limits': {
|
|
1823
1824
|
'withdraw': {
|
|
@@ -6492,7 +6493,7 @@ export default class okx extends Exchange {
|
|
|
6492
6493
|
* @param {string} symbol unified market symbol
|
|
6493
6494
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6494
6495
|
* @param {string} [params.marginMode] 'cross' or 'isolated'
|
|
6495
|
-
* @param {string} [params.posSide] 'long' or 'short' for isolated margin long/short mode on futures and swap markets
|
|
6496
|
+
* @param {string} [params.posSide] 'long' or 'short' or 'net' for isolated margin long/short mode on futures and swap markets, default is 'net'
|
|
6496
6497
|
* @returns {object} response from the exchange
|
|
6497
6498
|
*/
|
|
6498
6499
|
async setLeverage(leverage, symbol = undefined, params = {}) {
|
|
@@ -6519,14 +6520,12 @@ export default class okx extends Exchange {
|
|
|
6519
6520
|
'mgnMode': marginMode,
|
|
6520
6521
|
'instId': market['id'],
|
|
6521
6522
|
};
|
|
6522
|
-
const posSide = this.safeString(params, 'posSide');
|
|
6523
|
+
const posSide = this.safeString(params, 'posSide', 'net');
|
|
6523
6524
|
if (marginMode === 'isolated') {
|
|
6524
|
-
if (posSide === undefined) {
|
|
6525
|
-
throw new ArgumentsRequired(this.id + ' setLeverage() requires a posSide argument for isolated margin');
|
|
6526
|
-
}
|
|
6527
6525
|
if (posSide !== 'long' && posSide !== 'short' && posSide !== 'net') {
|
|
6528
6526
|
throw new BadRequest(this.id + ' setLeverage() requires the posSide argument to be either "long", "short" or "net"');
|
|
6529
6527
|
}
|
|
6528
|
+
request['posSide'] = posSide;
|
|
6530
6529
|
}
|
|
6531
6530
|
const response = await this.privatePostAccountSetLeverage(this.extend(request, params));
|
|
6532
6531
|
//
|
|
@@ -7477,7 +7476,12 @@ export default class okx extends Exchange {
|
|
|
7477
7476
|
*/
|
|
7478
7477
|
async fetchDepositWithdrawFees(codes = undefined, params = {}) {
|
|
7479
7478
|
await this.loadMarkets();
|
|
7480
|
-
const
|
|
7479
|
+
const request = {};
|
|
7480
|
+
if (codes !== undefined) {
|
|
7481
|
+
const ids = this.currencyIds(codes);
|
|
7482
|
+
request['ccy'] = ids.join(',');
|
|
7483
|
+
}
|
|
7484
|
+
const response = await this.privateGetAssetCurrencies(this.extend(request, params));
|
|
7481
7485
|
//
|
|
7482
7486
|
// {
|
|
7483
7487
|
// "code": "0",
|
|
@@ -7564,7 +7568,7 @@ export default class okx extends Exchange {
|
|
|
7564
7568
|
}
|
|
7565
7569
|
const chainSplit = chain.split('-');
|
|
7566
7570
|
const networkId = this.safeValue(chainSplit, 1);
|
|
7567
|
-
const withdrawFee = this.safeNumber(feeInfo, '
|
|
7571
|
+
const withdrawFee = this.safeNumber(feeInfo, 'fee');
|
|
7568
7572
|
const withdrawResult = {
|
|
7569
7573
|
'fee': withdrawFee,
|
|
7570
7574
|
'percentage': (withdrawFee !== undefined) ? false : undefined,
|
package/js/src/onetrading.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export default class onetrading extends Exchange {
|
|
|
10
10
|
* @method
|
|
11
11
|
* @name onetrading#fetchTime
|
|
12
12
|
* @description fetches the current integer timestamp in milliseconds from the exchange server
|
|
13
|
+
* @see https://docs.onetrading.com/#time
|
|
13
14
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
14
15
|
* @returns {int} the current integer timestamp in milliseconds from the exchange server
|
|
15
16
|
*/
|
|
@@ -18,6 +19,7 @@ export default class onetrading extends Exchange {
|
|
|
18
19
|
* @method
|
|
19
20
|
* @name onetrading#fetchCurrencies
|
|
20
21
|
* @description fetches all available currencies on an exchange
|
|
22
|
+
* @see https://docs.onetrading.com/#currencies
|
|
21
23
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
22
24
|
* @returns {object} an associative dictionary of currencies
|
|
23
25
|
*/
|
|
@@ -26,6 +28,7 @@ export default class onetrading extends Exchange {
|
|
|
26
28
|
* @method
|
|
27
29
|
* @name onetrading#fetchMarkets
|
|
28
30
|
* @description retrieves data on all markets for onetrading
|
|
31
|
+
* @see https://docs.onetrading.com/#instruments
|
|
29
32
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
30
33
|
* @returns {object[]} an array of objects representing market data
|
|
31
34
|
*/
|
|
@@ -35,6 +38,8 @@ export default class onetrading extends Exchange {
|
|
|
35
38
|
* @method
|
|
36
39
|
* @name onetrading#fetchTradingFees
|
|
37
40
|
* @description fetch the trading fees for multiple markets
|
|
41
|
+
* @see https://docs.onetrading.com/#fee-groups
|
|
42
|
+
* @see https://docs.onetrading.com/#fees
|
|
38
43
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
39
44
|
* @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
|
|
40
45
|
*/
|
package/js/src/onetrading.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
// ---------------------------------------------------------------------------
|
|
8
8
|
import Exchange from './abstract/onetrading.js';
|
|
9
|
-
import { AuthenticationError, ExchangeError, PermissionDenied, BadRequest, ArgumentsRequired, OrderNotFound, InsufficientFunds, ExchangeNotAvailable, DDoSProtection, InvalidAddress, InvalidOrder } from './base/errors.js';
|
|
9
|
+
import { AuthenticationError, ExchangeError, PermissionDenied, BadRequest, ArgumentsRequired, OrderNotFound, InsufficientFunds, ExchangeNotAvailable, DDoSProtection, InvalidAddress, InvalidOrder, NotSupported } from './base/errors.js';
|
|
10
10
|
import { Precise } from './base/Precise.js';
|
|
11
11
|
import { TICK_SIZE } from './base/functions/number.js';
|
|
12
12
|
// ---------------------------------------------------------------------------
|
|
@@ -308,6 +308,7 @@ export default class onetrading extends Exchange {
|
|
|
308
308
|
* @method
|
|
309
309
|
* @name onetrading#fetchTime
|
|
310
310
|
* @description fetches the current integer timestamp in milliseconds from the exchange server
|
|
311
|
+
* @see https://docs.onetrading.com/#time
|
|
311
312
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
312
313
|
* @returns {int} the current integer timestamp in milliseconds from the exchange server
|
|
313
314
|
*/
|
|
@@ -325,6 +326,7 @@ export default class onetrading extends Exchange {
|
|
|
325
326
|
* @method
|
|
326
327
|
* @name onetrading#fetchCurrencies
|
|
327
328
|
* @description fetches all available currencies on an exchange
|
|
329
|
+
* @see https://docs.onetrading.com/#currencies
|
|
328
330
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
329
331
|
* @returns {object} an associative dictionary of currencies
|
|
330
332
|
*/
|
|
@@ -366,6 +368,7 @@ export default class onetrading extends Exchange {
|
|
|
366
368
|
* @method
|
|
367
369
|
* @name onetrading#fetchMarkets
|
|
368
370
|
* @description retrieves data on all markets for onetrading
|
|
371
|
+
* @see https://docs.onetrading.com/#instruments
|
|
369
372
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
370
373
|
* @returns {object[]} an array of objects representing market data
|
|
371
374
|
*/
|
|
@@ -448,6 +451,8 @@ export default class onetrading extends Exchange {
|
|
|
448
451
|
* @method
|
|
449
452
|
* @name onetrading#fetchTradingFees
|
|
450
453
|
* @description fetch the trading fees for multiple markets
|
|
454
|
+
* @see https://docs.onetrading.com/#fee-groups
|
|
455
|
+
* @see https://docs.onetrading.com/#fees
|
|
451
456
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
452
457
|
* @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
|
|
453
458
|
*/
|
|
@@ -458,7 +463,15 @@ export default class onetrading extends Exchange {
|
|
|
458
463
|
const options = this.safeValue(this.options, 'fetchTradingFees', {});
|
|
459
464
|
method = this.safeString(options, 'method', 'fetchPrivateTradingFees');
|
|
460
465
|
}
|
|
461
|
-
|
|
466
|
+
if (method === 'fetchPrivateTradingFees') {
|
|
467
|
+
return await this.fetchPrivateTradingFees(params);
|
|
468
|
+
}
|
|
469
|
+
else if (method === 'fetchPublicTradingFees') {
|
|
470
|
+
return await this.fetchPublicTradingFees(params);
|
|
471
|
+
}
|
|
472
|
+
else {
|
|
473
|
+
throw new NotSupported(this.id + ' fetchTradingFees() does not support ' + method + ', fetchPrivateTradingFees and fetchPublicTradingFees are supported');
|
|
474
|
+
}
|
|
462
475
|
}
|
|
463
476
|
async fetchPublicTradingFees(params = {}) {
|
|
464
477
|
await this.loadMarkets();
|
package/js/src/paradex.js
CHANGED
|
@@ -51,6 +51,8 @@ export default class paradex extends Exchange {
|
|
|
51
51
|
'createOrder': true,
|
|
52
52
|
'createOrders': false,
|
|
53
53
|
'createReduceOnlyOrder': false,
|
|
54
|
+
'createStopOrder': true,
|
|
55
|
+
'createTriggerOrder': true,
|
|
54
56
|
'editOrder': false,
|
|
55
57
|
'fetchAccounts': false,
|
|
56
58
|
'fetchBalance': true,
|
package/js/src/phemex.js
CHANGED
|
@@ -2640,6 +2640,29 @@ export default class phemex extends Exchange {
|
|
|
2640
2640
|
if (triggerPrice !== undefined) {
|
|
2641
2641
|
const triggerType = this.safeString(params, 'triggerType', 'ByMarkPrice');
|
|
2642
2642
|
request['triggerType'] = triggerType;
|
|
2643
|
+
// set direction & exchange specific order type
|
|
2644
|
+
let triggerDirection = undefined;
|
|
2645
|
+
[triggerDirection, params] = this.handleParamString(params, 'triggerDirection');
|
|
2646
|
+
if (triggerDirection === undefined) {
|
|
2647
|
+
throw new ArgumentsRequired(this.id + " createOrder() also requires a 'triggerDirection' parameter with either 'up' or 'down' value");
|
|
2648
|
+
}
|
|
2649
|
+
// the flow defined per https://phemex-docs.github.io/#more-order-type-examples
|
|
2650
|
+
if (triggerDirection === 'up') {
|
|
2651
|
+
if (side === 'sell') {
|
|
2652
|
+
request['ordType'] = (type === 'Market') ? 'MarketIfTouched' : 'LimitIfTouched';
|
|
2653
|
+
}
|
|
2654
|
+
else if (side === 'buy') {
|
|
2655
|
+
request['ordType'] = (type === 'Market') ? 'Stop' : 'StopLimit';
|
|
2656
|
+
}
|
|
2657
|
+
}
|
|
2658
|
+
else if (triggerDirection === 'down') {
|
|
2659
|
+
if (side === 'sell') {
|
|
2660
|
+
request['ordType'] = (type === 'Market') ? 'Stop' : 'StopLimit';
|
|
2661
|
+
}
|
|
2662
|
+
else if (side === 'buy') {
|
|
2663
|
+
request['ordType'] = (type === 'Market') ? 'MarketIfTouched' : 'LimitIfTouched';
|
|
2664
|
+
}
|
|
2665
|
+
}
|
|
2643
2666
|
}
|
|
2644
2667
|
if (stopLossDefined || takeProfitDefined) {
|
|
2645
2668
|
if (stopLossDefined) {
|
package/js/src/poloniex.d.ts
CHANGED
|
@@ -129,7 +129,7 @@ export default class poloniex extends Exchange {
|
|
|
129
129
|
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
130
130
|
* @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
|
131
131
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
132
|
-
* @param {float} [params.triggerPrice]
|
|
132
|
+
* @param {float} [params.triggerPrice] the price at which a trigger order is triggered at
|
|
133
133
|
* @param {float} [params.cost] *spot market buy only* the quote quantity that can be used as an alternative for the amount
|
|
134
134
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
135
135
|
*/
|
package/js/src/poloniex.js
CHANGED
|
@@ -39,6 +39,8 @@ export default class poloniex extends Exchange {
|
|
|
39
39
|
'createMarketOrderWithCost': false,
|
|
40
40
|
'createMarketSellOrderWithCost': false,
|
|
41
41
|
'createOrder': true,
|
|
42
|
+
'createStopOrder': true,
|
|
43
|
+
'createTriggerOrder': true,
|
|
42
44
|
'editOrder': true,
|
|
43
45
|
'fetchBalance': true,
|
|
44
46
|
'fetchClosedOrder': false,
|
|
@@ -1269,7 +1271,7 @@ export default class poloniex extends Exchange {
|
|
|
1269
1271
|
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
1270
1272
|
* @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
|
1271
1273
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1272
|
-
* @param {float} [params.triggerPrice]
|
|
1274
|
+
* @param {float} [params.triggerPrice] the price at which a trigger order is triggered at
|
|
1273
1275
|
* @param {float} [params.cost] *spot market buy only* the quote quantity that can be used as an alternative for the amount
|
|
1274
1276
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1275
1277
|
*/
|
|
@@ -117,7 +117,7 @@ export default class poloniexfutures extends Exchange {
|
|
|
117
117
|
* @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
|
118
118
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
119
119
|
* @param {float} [params.leverage] Leverage size of the order
|
|
120
|
-
* @param {float} [params.
|
|
120
|
+
* @param {float} [params.triggerPrice] The price at which a trigger order is triggered at
|
|
121
121
|
* @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.
|
|
122
122
|
* @param {string} [params.timeInForce] GTC, GTT, IOC, or FOK, default is GTC, limit orders only
|
|
123
123
|
* @param {string} [params.postOnly] Post only flag, invalid when timeInForce is IOC or FOK
|
|
@@ -34,6 +34,8 @@ export default class poloniexfutures extends Exchange {
|
|
|
34
34
|
'future': false,
|
|
35
35
|
'option': undefined,
|
|
36
36
|
'createOrder': true,
|
|
37
|
+
'createStopOrder': true,
|
|
38
|
+
'createTriggerOrder': true,
|
|
37
39
|
'fetchBalance': true,
|
|
38
40
|
'fetchClosedOrders': true,
|
|
39
41
|
'fetchCurrencies': false,
|
|
@@ -838,7 +840,7 @@ export default class poloniexfutures extends Exchange {
|
|
|
838
840
|
* @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
|
839
841
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
840
842
|
* @param {float} [params.leverage] Leverage size of the order
|
|
841
|
-
* @param {float} [params.
|
|
843
|
+
* @param {float} [params.triggerPrice] The price at which a trigger order is triggered at
|
|
842
844
|
* @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.
|
|
843
845
|
* @param {string} [params.timeInForce] GTC, GTT, IOC, or FOK, default is GTC, limit orders only
|
|
844
846
|
* @param {string} [params.postOnly] Post only flag, invalid when timeInForce is IOC or FOK
|
package/js/src/pro/idex.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export default class idex extends idexRest {
|
|
|
9
9
|
* @method
|
|
10
10
|
* @name idex#watchTicker
|
|
11
11
|
* @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
12
|
+
* @see https://api-docs-v4.idex.io/#tickers
|
|
12
13
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
13
14
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
14
15
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -19,6 +20,7 @@ export default class idex extends idexRest {
|
|
|
19
20
|
* @method
|
|
20
21
|
* @name idex#watchTrades
|
|
21
22
|
* @description get the list of most recent trades for a particular symbol
|
|
23
|
+
* @see https://api-docs-v4.idex.io/#trades
|
|
22
24
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
23
25
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
24
26
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
@@ -32,6 +34,7 @@ export default class idex extends idexRest {
|
|
|
32
34
|
* @method
|
|
33
35
|
* @name idex#watchOHLCV
|
|
34
36
|
* @description watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
37
|
+
* @see https://api-docs-v4.idex.io/#candles
|
|
35
38
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
36
39
|
* @param {string} timeframe the length of time each candle represents
|
|
37
40
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
@@ -47,6 +50,7 @@ export default class idex extends idexRest {
|
|
|
47
50
|
* @method
|
|
48
51
|
* @name idex#watchOrderBook
|
|
49
52
|
* @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
53
|
+
* @see https://api-docs-v4.idex.io/#l2-order-book
|
|
50
54
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
51
55
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
52
56
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -62,6 +66,7 @@ export default class idex extends idexRest {
|
|
|
62
66
|
* @method
|
|
63
67
|
* @name idex#watchOrders
|
|
64
68
|
* @description watches information on multiple orders made by the user
|
|
69
|
+
* @see https://api-docs-v4.idex.io/#orders
|
|
65
70
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
66
71
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
67
72
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
package/js/src/pro/idex.js
CHANGED
|
@@ -70,6 +70,7 @@ export default class idex extends idexRest {
|
|
|
70
70
|
* @method
|
|
71
71
|
* @name idex#watchTicker
|
|
72
72
|
* @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
73
|
+
* @see https://api-docs-v4.idex.io/#tickers
|
|
73
74
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
74
75
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
75
76
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -142,6 +143,7 @@ export default class idex extends idexRest {
|
|
|
142
143
|
* @method
|
|
143
144
|
* @name idex#watchTrades
|
|
144
145
|
* @description get the list of most recent trades for a particular symbol
|
|
146
|
+
* @see https://api-docs-v4.idex.io/#trades
|
|
145
147
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
146
148
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
147
149
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
@@ -236,6 +238,7 @@ export default class idex extends idexRest {
|
|
|
236
238
|
* @method
|
|
237
239
|
* @name idex#watchOHLCV
|
|
238
240
|
* @description watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
241
|
+
* @see https://api-docs-v4.idex.io/#candles
|
|
239
242
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
240
243
|
* @param {string} timeframe the length of time each candle represents
|
|
241
244
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
@@ -406,6 +409,7 @@ export default class idex extends idexRest {
|
|
|
406
409
|
* @method
|
|
407
410
|
* @name idex#watchOrderBook
|
|
408
411
|
* @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
412
|
+
* @see https://api-docs-v4.idex.io/#l2-order-book
|
|
409
413
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
410
414
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
411
415
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -509,6 +513,7 @@ export default class idex extends idexRest {
|
|
|
509
513
|
* @method
|
|
510
514
|
* @name idex#watchOrders
|
|
511
515
|
* @description watches information on multiple orders made by the user
|
|
516
|
+
* @see https://api-docs-v4.idex.io/#orders
|
|
512
517
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
513
518
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
514
519
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
package/js/src/pro/probit.js
CHANGED
|
@@ -526,11 +526,13 @@ export default class probit extends probitRest {
|
|
|
526
526
|
this.handleTicker(client, message);
|
|
527
527
|
}
|
|
528
528
|
const trades = this.safeValue(message, 'recent_trades', []);
|
|
529
|
-
|
|
529
|
+
const tradesLength = trades.length;
|
|
530
|
+
if (tradesLength) {
|
|
530
531
|
this.handleTrades(client, message);
|
|
531
532
|
}
|
|
532
533
|
const orderBook = this.safeValueN(message, ['order_books', 'order_books_l1', 'order_books_l2', 'order_books_l3', 'order_books_l4'], []);
|
|
533
|
-
|
|
534
|
+
const orderBookLength = orderBook.length;
|
|
535
|
+
if (orderBookLength) {
|
|
534
536
|
this.handleOrderBook(client, message, orderBook);
|
|
535
537
|
}
|
|
536
538
|
}
|
package/js/src/pro/woo.d.ts
CHANGED
|
@@ -8,8 +8,8 @@ export default class woo extends wooRest {
|
|
|
8
8
|
/**
|
|
9
9
|
* @method
|
|
10
10
|
* @name woo#watchOrderBook
|
|
11
|
-
* @see https://docs.
|
|
12
|
-
* @see https://docs.
|
|
11
|
+
* @see https://docs.woox.io/#orderbookupdate
|
|
12
|
+
* @see https://docs.woox.io/#orderbook
|
|
13
13
|
* @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
14
14
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
15
15
|
* @param {int} [limit] the maximum amount of order book entries to return.
|
|
@@ -38,7 +38,7 @@ export default class woo extends wooRest {
|
|
|
38
38
|
/**
|
|
39
39
|
* @method
|
|
40
40
|
* @name woo#watchTickers
|
|
41
|
-
* @see https://docs.
|
|
41
|
+
* @see https://docs.woox.io/#24h-tickers
|
|
42
42
|
* @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
|
|
43
43
|
* @param {string[]} symbols unified symbol of the market to fetch the ticker for
|
|
44
44
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -62,7 +62,7 @@ export default class woo extends wooRest {
|
|
|
62
62
|
* @method
|
|
63
63
|
* @name woo#watchOHLCV
|
|
64
64
|
* @description watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
65
|
-
* @see https://docs.
|
|
65
|
+
* @see https://docs.woox.io/#k-line
|
|
66
66
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
67
67
|
* @param {string} timeframe the length of time each candle represents
|
|
68
68
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
@@ -76,7 +76,7 @@ export default class woo extends wooRest {
|
|
|
76
76
|
* @method
|
|
77
77
|
* @name woo#watchTrades
|
|
78
78
|
* @description watches information on multiple trades made in a market
|
|
79
|
-
* @see https://docs.
|
|
79
|
+
* @see https://docs.woox.io/#trade
|
|
80
80
|
* @param {string} symbol unified market symbol of the market trades were made in
|
|
81
81
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
82
82
|
* @param {int} [limit] the maximum number of trade structures to retrieve
|
|
@@ -93,8 +93,8 @@ export default class woo extends wooRest {
|
|
|
93
93
|
/**
|
|
94
94
|
* @method
|
|
95
95
|
* @name woo#watchOrders
|
|
96
|
-
* @see https://docs.
|
|
97
|
-
* @see https://docs.
|
|
96
|
+
* @see https://docs.woox.io/#executionreport
|
|
97
|
+
* @see https://docs.woox.io/#algoexecutionreportv2
|
|
98
98
|
* @description watches information on multiple orders made by the user
|
|
99
99
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
100
100
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
@@ -107,8 +107,8 @@ export default class woo extends wooRest {
|
|
|
107
107
|
/**
|
|
108
108
|
* @method
|
|
109
109
|
* @name woo#watchMyTrades
|
|
110
|
-
* @see https://docs.
|
|
111
|
-
* @see https://docs.
|
|
110
|
+
* @see https://docs.woox.io/#executionreport
|
|
111
|
+
* @see https://docs.woox.io/#algoexecutionreportv2
|
|
112
112
|
* @description watches information on multiple trades made by the user
|
|
113
113
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
114
114
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
@@ -125,7 +125,7 @@ export default class woo extends wooRest {
|
|
|
125
125
|
/**
|
|
126
126
|
* @method
|
|
127
127
|
* @name woo#watchPositions
|
|
128
|
-
* @see https://docs.
|
|
128
|
+
* @see https://docs.woox.io/#position-push
|
|
129
129
|
* @description watch all open positions
|
|
130
130
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
131
131
|
* @param since
|
|
@@ -139,7 +139,7 @@ export default class woo extends wooRest {
|
|
|
139
139
|
handlePositions(client: any, message: any): void;
|
|
140
140
|
/**
|
|
141
141
|
* @method
|
|
142
|
-
* @see https://docs.
|
|
142
|
+
* @see https://docs.woox.io/#balance
|
|
143
143
|
* @name woo#watchBalance
|
|
144
144
|
* @description watch balance and get the amount of funds available for trading or funds locked in orders
|
|
145
145
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|