ccxt 4.4.33 → 4.4.35
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 +495 -153
- 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 +3 -1
- package/dist/cjs/src/bitopro.js +3 -0
- package/dist/cjs/src/bitrue.js +3 -2
- package/dist/cjs/src/btcmarkets.js +5 -3
- package/dist/cjs/src/btcturk.js +19 -19
- 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 +145 -41
- package/dist/cjs/src/hyperliquid.js +75 -11
- package/dist/cjs/src/idex.js +3 -3
- package/dist/cjs/src/kraken.js +71 -54
- package/dist/cjs/src/krakenfutures.js +3 -1
- package/dist/cjs/src/kucoin.js +1 -1
- package/dist/cjs/src/okcoin.js +2 -0
- package/dist/cjs/src/okx.js +16 -11
- package/dist/cjs/src/onetrading.js +34 -396
- 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/bitrue.js +13 -11
- package/dist/cjs/src/pro/idex.js +5 -0
- package/dist/cjs/src/pro/probit.js +62 -68
- 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/dist/cjs/src/xt.js +5 -5
- 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 +17 -0
- package/js/src/abstract/bitbank.d.ts +5 -0
- package/js/src/abstract/bitfinex2.d.ts +1 -0
- package/js/src/abstract/bitpanda.d.ts +0 -12
- package/js/src/abstract/bitrue.d.ts +3 -3
- package/js/src/abstract/ellipx.d.ts +28 -0
- package/js/src/abstract/ellipx.js +11 -0
- package/js/src/abstract/okx.d.ts +1 -0
- package/js/src/abstract/onetrading.d.ts +0 -12
- 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 +11 -1
- package/js/src/bingx.js +495 -153
- 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 +3 -1
- package/js/src/bitopro.d.ts +1 -0
- package/js/src/bitopro.js +3 -0
- package/js/src/bitrue.js +3 -2
- package/js/src/btcmarkets.d.ts +1 -0
- package/js/src/btcmarkets.js +5 -3
- package/js/src/btcturk.js +19 -19
- 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 +7 -7
- package/js/src/gate.js +145 -41
- package/js/src/hyperliquid.d.ts +10 -0
- package/js/src/hyperliquid.js +77 -13
- package/js/src/idex.js +4 -4
- package/js/src/kraken.d.ts +11 -8
- package/js/src/kraken.js +71 -54
- package/js/src/krakenfutures.js +3 -1
- package/js/src/kucoin.js +1 -1
- package/js/src/okcoin.js +2 -0
- package/js/src/okx.d.ts +1 -1
- package/js/src/okx.js +16 -11
- package/js/src/onetrading.d.ts +20 -67
- package/js/src/onetrading.js +35 -397
- 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/bitrue.js +13 -11
- package/js/src/pro/idex.d.ts +5 -0
- package/js/src/pro/idex.js +5 -0
- package/js/src/pro/probit.d.ts +2 -1
- package/js/src/pro/probit.js +62 -68
- 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/js/src/xt.js +5 -5
- package/package.json +4 -3
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
|
// ---------------------------------------------------------------------------
|
|
@@ -37,7 +37,7 @@ export default class onetrading extends Exchange {
|
|
|
37
37
|
'cancelOrders': true,
|
|
38
38
|
'closeAllPositions': false,
|
|
39
39
|
'closePosition': false,
|
|
40
|
-
'createDepositAddress':
|
|
40
|
+
'createDepositAddress': false,
|
|
41
41
|
'createOrder': true,
|
|
42
42
|
'createReduceOnlyOrder': false,
|
|
43
43
|
'createStopLimitOrder': true,
|
|
@@ -52,10 +52,10 @@ export default class onetrading extends Exchange {
|
|
|
52
52
|
'fetchCrossBorrowRates': false,
|
|
53
53
|
'fetchCurrencies': true,
|
|
54
54
|
'fetchDeposit': false,
|
|
55
|
-
'fetchDepositAddress':
|
|
55
|
+
'fetchDepositAddress': false,
|
|
56
56
|
'fetchDepositAddresses': false,
|
|
57
57
|
'fetchDepositAddressesByNetwork': false,
|
|
58
|
-
'fetchDeposits':
|
|
58
|
+
'fetchDeposits': false,
|
|
59
59
|
'fetchDepositsWithdrawals': false,
|
|
60
60
|
'fetchFundingHistory': false,
|
|
61
61
|
'fetchFundingRate': false,
|
|
@@ -88,7 +88,7 @@ export default class onetrading extends Exchange {
|
|
|
88
88
|
'fetchTicker': true,
|
|
89
89
|
'fetchTickers': true,
|
|
90
90
|
'fetchTime': true,
|
|
91
|
-
'fetchTrades':
|
|
91
|
+
'fetchTrades': false,
|
|
92
92
|
'fetchTradingFee': false,
|
|
93
93
|
'fetchTradingFees': true,
|
|
94
94
|
'fetchTransactionFee': false,
|
|
@@ -97,14 +97,14 @@ export default class onetrading extends Exchange {
|
|
|
97
97
|
'fetchTransfer': false,
|
|
98
98
|
'fetchTransfers': false,
|
|
99
99
|
'fetchWithdrawal': false,
|
|
100
|
-
'fetchWithdrawals':
|
|
100
|
+
'fetchWithdrawals': false,
|
|
101
101
|
'reduceMargin': false,
|
|
102
102
|
'setLeverage': false,
|
|
103
103
|
'setMargin': false,
|
|
104
104
|
'setMarginMode': false,
|
|
105
105
|
'setPositionMode': false,
|
|
106
106
|
'transfer': false,
|
|
107
|
-
'withdraw':
|
|
107
|
+
'withdraw': false,
|
|
108
108
|
},
|
|
109
109
|
'timeframes': {
|
|
110
110
|
'1m': '1/MINUTES',
|
|
@@ -139,32 +139,20 @@ export default class onetrading extends Exchange {
|
|
|
139
139
|
'order-book/{instrument_code}',
|
|
140
140
|
'market-ticker',
|
|
141
141
|
'market-ticker/{instrument_code}',
|
|
142
|
-
'price-ticks/{instrument_code}',
|
|
143
142
|
'time',
|
|
144
143
|
],
|
|
145
144
|
},
|
|
146
145
|
'private': {
|
|
147
146
|
'get': [
|
|
148
147
|
'account/balances',
|
|
149
|
-
'account/deposit/crypto/{currency_code}',
|
|
150
|
-
'account/deposit/fiat/EUR',
|
|
151
|
-
'account/deposits',
|
|
152
|
-
'account/deposits/bitpanda',
|
|
153
|
-
'account/withdrawals',
|
|
154
|
-
'account/withdrawals/bitpanda',
|
|
155
148
|
'account/fees',
|
|
156
149
|
'account/orders',
|
|
157
150
|
'account/orders/{order_id}',
|
|
158
151
|
'account/orders/{order_id}/trades',
|
|
159
152
|
'account/trades',
|
|
160
153
|
'account/trades/{trade_id}',
|
|
161
|
-
'account/trading-volume',
|
|
162
154
|
],
|
|
163
155
|
'post': [
|
|
164
|
-
'account/deposit/crypto',
|
|
165
|
-
'account/withdraw/crypto',
|
|
166
|
-
'account/withdraw/fiat',
|
|
167
|
-
'account/fees',
|
|
168
156
|
'account/orders',
|
|
169
157
|
],
|
|
170
158
|
'delete': [
|
|
@@ -308,6 +296,7 @@ export default class onetrading extends Exchange {
|
|
|
308
296
|
* @method
|
|
309
297
|
* @name onetrading#fetchTime
|
|
310
298
|
* @description fetches the current integer timestamp in milliseconds from the exchange server
|
|
299
|
+
* @see https://docs.onetrading.com/#time
|
|
311
300
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
312
301
|
* @returns {int} the current integer timestamp in milliseconds from the exchange server
|
|
313
302
|
*/
|
|
@@ -325,6 +314,7 @@ export default class onetrading extends Exchange {
|
|
|
325
314
|
* @method
|
|
326
315
|
* @name onetrading#fetchCurrencies
|
|
327
316
|
* @description fetches all available currencies on an exchange
|
|
317
|
+
* @see https://docs.onetrading.com/#currencies
|
|
328
318
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
329
319
|
* @returns {object} an associative dictionary of currencies
|
|
330
320
|
*/
|
|
@@ -366,6 +356,7 @@ export default class onetrading extends Exchange {
|
|
|
366
356
|
* @method
|
|
367
357
|
* @name onetrading#fetchMarkets
|
|
368
358
|
* @description retrieves data on all markets for onetrading
|
|
359
|
+
* @see https://docs.onetrading.com/#instruments
|
|
369
360
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
370
361
|
* @returns {object[]} an array of objects representing market data
|
|
371
362
|
*/
|
|
@@ -448,6 +439,8 @@ export default class onetrading extends Exchange {
|
|
|
448
439
|
* @method
|
|
449
440
|
* @name onetrading#fetchTradingFees
|
|
450
441
|
* @description fetch the trading fees for multiple markets
|
|
442
|
+
* @see https://docs.onetrading.com/#fee-groups
|
|
443
|
+
* @see https://docs.onetrading.com/#fees
|
|
451
444
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
452
445
|
* @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
|
|
453
446
|
*/
|
|
@@ -458,7 +451,15 @@ export default class onetrading extends Exchange {
|
|
|
458
451
|
const options = this.safeValue(this.options, 'fetchTradingFees', {});
|
|
459
452
|
method = this.safeString(options, 'method', 'fetchPrivateTradingFees');
|
|
460
453
|
}
|
|
461
|
-
|
|
454
|
+
if (method === 'fetchPrivateTradingFees') {
|
|
455
|
+
return await this.fetchPrivateTradingFees(params);
|
|
456
|
+
}
|
|
457
|
+
else if (method === 'fetchPublicTradingFees') {
|
|
458
|
+
return await this.fetchPublicTradingFees(params);
|
|
459
|
+
}
|
|
460
|
+
else {
|
|
461
|
+
throw new NotSupported(this.id + ' fetchTradingFees() does not support ' + method + ', fetchPrivateTradingFees and fetchPublicTradingFees are supported');
|
|
462
|
+
}
|
|
462
463
|
}
|
|
463
464
|
async fetchPublicTradingFees(params = {}) {
|
|
464
465
|
await this.loadMarkets();
|
|
@@ -621,6 +622,7 @@ export default class onetrading extends Exchange {
|
|
|
621
622
|
* @method
|
|
622
623
|
* @name onetrading#fetchTicker
|
|
623
624
|
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
625
|
+
* @see https://docs.onetrading.com/#market-ticker-for-instrument
|
|
624
626
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
625
627
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
626
628
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -656,7 +658,8 @@ export default class onetrading extends Exchange {
|
|
|
656
658
|
* @method
|
|
657
659
|
* @name onetrading#fetchTickers
|
|
658
660
|
* @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
|
659
|
-
* @
|
|
661
|
+
* @see https://docs.onetrading.com/#market-ticker
|
|
662
|
+
* @param {string[]} [symbols] unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
660
663
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
661
664
|
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
662
665
|
*/
|
|
@@ -696,6 +699,7 @@ export default class onetrading extends Exchange {
|
|
|
696
699
|
* @method
|
|
697
700
|
* @name onetrading#fetchOrderBook
|
|
698
701
|
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
702
|
+
* @see https://docs.onetrading.com/#order-book
|
|
699
703
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
700
704
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
701
705
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -821,6 +825,7 @@ export default class onetrading extends Exchange {
|
|
|
821
825
|
* @method
|
|
822
826
|
* @name onetrading#fetchOHLCV
|
|
823
827
|
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
828
|
+
* @see https://docs.onetrading.com/#candlesticks
|
|
824
829
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
825
830
|
* @param {string} timeframe the length of time each candle represents
|
|
826
831
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
@@ -945,47 +950,6 @@ export default class onetrading extends Exchange {
|
|
|
945
950
|
'info': trade,
|
|
946
951
|
}, market);
|
|
947
952
|
}
|
|
948
|
-
/**
|
|
949
|
-
* @method
|
|
950
|
-
* @name onetrading#fetchTrades
|
|
951
|
-
* @description get the list of most recent trades for a particular symbol
|
|
952
|
-
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
953
|
-
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
954
|
-
* @param {int} [limit] the maximum amount of trades to fetch
|
|
955
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
956
|
-
* @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
957
|
-
*/
|
|
958
|
-
async fetchTrades(symbol, since = undefined, limit = undefined, params = {}) {
|
|
959
|
-
await this.loadMarkets();
|
|
960
|
-
const market = this.market(symbol);
|
|
961
|
-
const request = {
|
|
962
|
-
'instrument_code': market['id'],
|
|
963
|
-
// 'from': this.iso8601 (since),
|
|
964
|
-
// 'to': this.iso8601 (this.milliseconds ()),
|
|
965
|
-
};
|
|
966
|
-
if (since !== undefined) {
|
|
967
|
-
// returns price ticks for a specific market with an interval of maximum of 4 hours
|
|
968
|
-
// sorted by latest first
|
|
969
|
-
request['from'] = this.iso8601(since);
|
|
970
|
-
request['to'] = this.iso8601(this.sum(since, 14400000));
|
|
971
|
-
}
|
|
972
|
-
const response = await this.publicGetPriceTicksInstrumentCode(this.extend(request, params));
|
|
973
|
-
//
|
|
974
|
-
// [
|
|
975
|
-
// {
|
|
976
|
-
// "instrument_code":"BTC_EUR",
|
|
977
|
-
// "price":"8137.28",
|
|
978
|
-
// "amount":"0.22269",
|
|
979
|
-
// "taker_side":"BUY",
|
|
980
|
-
// "volume":"1812.0908832",
|
|
981
|
-
// "time":"2020-07-10T14:44:32.299Z",
|
|
982
|
-
// "trade_timestamp":1594392272299,
|
|
983
|
-
// "sequence":603047
|
|
984
|
-
// }
|
|
985
|
-
// ]
|
|
986
|
-
//
|
|
987
|
-
return this.parseTrades(response, market, since, limit);
|
|
988
|
-
}
|
|
989
953
|
parseBalance(response) {
|
|
990
954
|
const balances = this.safeValue(response, 'balances', []);
|
|
991
955
|
const result = { 'info': response };
|
|
@@ -1004,6 +968,7 @@ export default class onetrading extends Exchange {
|
|
|
1004
968
|
* @method
|
|
1005
969
|
* @name onetrading#fetchBalance
|
|
1006
970
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
971
|
+
* @see https://docs.onetrading.com/#balances
|
|
1007
972
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1008
973
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
1009
974
|
*/
|
|
@@ -1028,341 +993,6 @@ export default class onetrading extends Exchange {
|
|
|
1028
993
|
//
|
|
1029
994
|
return this.parseBalance(response);
|
|
1030
995
|
}
|
|
1031
|
-
parseDepositAddress(depositAddress, currency = undefined) {
|
|
1032
|
-
let code = undefined;
|
|
1033
|
-
if (currency !== undefined) {
|
|
1034
|
-
code = currency['code'];
|
|
1035
|
-
}
|
|
1036
|
-
const address = this.safeString(depositAddress, 'address');
|
|
1037
|
-
const tag = this.safeString(depositAddress, 'destination_tag');
|
|
1038
|
-
this.checkAddress(address);
|
|
1039
|
-
return {
|
|
1040
|
-
'info': depositAddress,
|
|
1041
|
-
'currency': code,
|
|
1042
|
-
'network': undefined,
|
|
1043
|
-
'address': address,
|
|
1044
|
-
'tag': tag,
|
|
1045
|
-
};
|
|
1046
|
-
}
|
|
1047
|
-
/**
|
|
1048
|
-
* @method
|
|
1049
|
-
* @name onetrading#createDepositAddress
|
|
1050
|
-
* @description create a currency deposit address
|
|
1051
|
-
* @param {string} code unified currency code of the currency for the deposit address
|
|
1052
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1053
|
-
* @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
|
|
1054
|
-
*/
|
|
1055
|
-
async createDepositAddress(code, params = {}) {
|
|
1056
|
-
await this.loadMarkets();
|
|
1057
|
-
const currency = this.currency(code);
|
|
1058
|
-
const request = {
|
|
1059
|
-
'currency': currency['id'],
|
|
1060
|
-
};
|
|
1061
|
-
const response = await this.privatePostAccountDepositCrypto(this.extend(request, params));
|
|
1062
|
-
//
|
|
1063
|
-
// {
|
|
1064
|
-
// "address":"rBnNhk95FrdNisZtXcStzriFS8vEzz53DM",
|
|
1065
|
-
// "destination_tag":"865690307",
|
|
1066
|
-
// "enabled":true,
|
|
1067
|
-
// "is_smart_contract":false
|
|
1068
|
-
// }
|
|
1069
|
-
//
|
|
1070
|
-
return this.parseDepositAddress(response, currency);
|
|
1071
|
-
}
|
|
1072
|
-
/**
|
|
1073
|
-
* @method
|
|
1074
|
-
* @name onetrading#fetchDepositAddress
|
|
1075
|
-
* @description fetch the deposit address for a currency associated with this account
|
|
1076
|
-
* @param {string} code unified currency code
|
|
1077
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1078
|
-
* @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
|
|
1079
|
-
*/
|
|
1080
|
-
async fetchDepositAddress(code, params = {}) {
|
|
1081
|
-
await this.loadMarkets();
|
|
1082
|
-
const currency = this.currency(code);
|
|
1083
|
-
const request = {
|
|
1084
|
-
'currency_code': currency['id'],
|
|
1085
|
-
};
|
|
1086
|
-
const response = await this.privateGetAccountDepositCryptoCurrencyCode(this.extend(request, params));
|
|
1087
|
-
//
|
|
1088
|
-
// {
|
|
1089
|
-
// "address":"rBnNhk95FrdNisZtXcStzriFS8vEzz53DM",
|
|
1090
|
-
// "destination_tag":"865690307",
|
|
1091
|
-
// "enabled":true,
|
|
1092
|
-
// "is_smart_contract":false,
|
|
1093
|
-
// "can_create_more":false
|
|
1094
|
-
// }
|
|
1095
|
-
//
|
|
1096
|
-
return this.parseDepositAddress(response, currency);
|
|
1097
|
-
}
|
|
1098
|
-
/**
|
|
1099
|
-
* @method
|
|
1100
|
-
* @name onetrading#fetchDeposits
|
|
1101
|
-
* @description fetch all deposits made to an account
|
|
1102
|
-
* @param {string} code unified currency code
|
|
1103
|
-
* @param {int} [since] the earliest time in ms to fetch deposits for
|
|
1104
|
-
* @param {int} [limit] the maximum number of deposits structures to retrieve
|
|
1105
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1106
|
-
* @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
1107
|
-
*/
|
|
1108
|
-
async fetchDeposits(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
1109
|
-
await this.loadMarkets();
|
|
1110
|
-
const request = {
|
|
1111
|
-
// 'cursor': 'string', // pointer specifying the position from which the next pages should be returned
|
|
1112
|
-
};
|
|
1113
|
-
let currency = undefined;
|
|
1114
|
-
if (code !== undefined) {
|
|
1115
|
-
currency = this.currency(code);
|
|
1116
|
-
request['currency_code'] = currency['id'];
|
|
1117
|
-
}
|
|
1118
|
-
if (limit !== undefined) {
|
|
1119
|
-
request['max_page_size'] = limit;
|
|
1120
|
-
}
|
|
1121
|
-
if (since !== undefined) {
|
|
1122
|
-
const to = this.safeString(params, 'to');
|
|
1123
|
-
if (to === undefined) {
|
|
1124
|
-
throw new ArgumentsRequired(this.id + ' fetchDeposits() requires a "to" iso8601 string param with the since argument is specified');
|
|
1125
|
-
}
|
|
1126
|
-
request['from'] = this.iso8601(since);
|
|
1127
|
-
}
|
|
1128
|
-
const response = await this.privateGetAccountDeposits(this.extend(request, params));
|
|
1129
|
-
//
|
|
1130
|
-
// {
|
|
1131
|
-
// "deposit_history": [
|
|
1132
|
-
// {
|
|
1133
|
-
// "transaction_id": "e5342efcd-d5b7-4a56-8e12-b69ffd68c5ef",
|
|
1134
|
-
// "account_id": "c2d0076a-c20d-41f8-9e9a-1a1d028b2b58",
|
|
1135
|
-
// "amount": "100",
|
|
1136
|
-
// "type": "CRYPTO",
|
|
1137
|
-
// "funds_source": "INTERNAL",
|
|
1138
|
-
// "time": "2020-04-22T09:57:47Z",
|
|
1139
|
-
// "currency": "BTC",
|
|
1140
|
-
// "fee_amount": "0.0",
|
|
1141
|
-
// "fee_currency": "BTC"
|
|
1142
|
-
// },
|
|
1143
|
-
// {
|
|
1144
|
-
// "transaction_id": "79793d00-2899-4a4d-95b7-73ae6b31384f",
|
|
1145
|
-
// "account_id": "c2d0076a-c20d-41f8-9e9a-1a1d028b2b58",
|
|
1146
|
-
// "time": "2020-05-05T11:22:07.925Z",
|
|
1147
|
-
// "currency": "EUR",
|
|
1148
|
-
// "funds_source": "EXTERNAL",
|
|
1149
|
-
// "type": "FIAT",
|
|
1150
|
-
// "amount": "50.0",
|
|
1151
|
-
// "fee_amount": "0.01",
|
|
1152
|
-
// "fee_currency": "EUR"
|
|
1153
|
-
// }
|
|
1154
|
-
// ],
|
|
1155
|
-
// "max_page_size": 2,
|
|
1156
|
-
// "cursor": "eyJhY2NvdW50X2lkIjp7InMiOiJlMzY5YWM4MC00NTc3LTExZTktYWUwOC05YmVkYzQ3OTBiODQiLCJzcyI6W10sIm5zIjpbXSwiYnMiOltdLCJtIjp7fSwibCI6W119LCJpdGVtX2tleSI6eyJzIjoiV0lUSERSQVdBTDo6MmFlMjYwY2ItOTk3MC00YmNiLTgxNmEtZGY4MDVmY2VhZTY1Iiwic3MiOltdLCJucyI6W10sImJzIjpbXSwibSI6e30sImwiOltdfSwiZ2xvYmFsX3dpdGhkcmF3YWxfaW5kZXhfaGFzaF9rZXkiOnsicyI6ImUzNjlhYzgwLTQ1NzctMTFlOS1hZTA4LTliZWRjNDc5MGI4NCIsInNzIjpbXSwibnMiOltdLCJicyI6W10sIm0iOnt9LCJsIjpbXX0sInRpbWVzdGFtcCI6eyJuIjoiMTU4ODA1ODc2Nzk0OCIsInNzIjpbXSwibnMiOltdLCJicyI6W10sIm0iOnt9LCJsIjpbXX19"
|
|
1157
|
-
// }
|
|
1158
|
-
//
|
|
1159
|
-
const depositHistory = this.safeList(response, 'deposit_history', []);
|
|
1160
|
-
return this.parseTransactions(depositHistory, currency, since, limit, { 'type': 'deposit' });
|
|
1161
|
-
}
|
|
1162
|
-
/**
|
|
1163
|
-
* @method
|
|
1164
|
-
* @name onetrading#fetchWithdrawals
|
|
1165
|
-
* @description fetch all withdrawals made from an account
|
|
1166
|
-
* @param {string} code unified currency code
|
|
1167
|
-
* @param {int} [since] the earliest time in ms to fetch withdrawals for
|
|
1168
|
-
* @param {int} [limit] the maximum number of withdrawals structures to retrieve
|
|
1169
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1170
|
-
* @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
1171
|
-
*/
|
|
1172
|
-
async fetchWithdrawals(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
1173
|
-
await this.loadMarkets();
|
|
1174
|
-
const request = {
|
|
1175
|
-
// 'cursor': 'string', // pointer specifying the position from which the next pages should be returned
|
|
1176
|
-
};
|
|
1177
|
-
let currency = undefined;
|
|
1178
|
-
if (code !== undefined) {
|
|
1179
|
-
currency = this.currency(code);
|
|
1180
|
-
request['currency_code'] = currency['id'];
|
|
1181
|
-
}
|
|
1182
|
-
if (limit !== undefined) {
|
|
1183
|
-
request['max_page_size'] = limit;
|
|
1184
|
-
}
|
|
1185
|
-
if (since !== undefined) {
|
|
1186
|
-
const to = this.safeString(params, 'to');
|
|
1187
|
-
if (to === undefined) {
|
|
1188
|
-
throw new ArgumentsRequired(this.id + ' fetchWithdrawals() requires a "to" iso8601 string param with the since argument is specified');
|
|
1189
|
-
}
|
|
1190
|
-
request['from'] = this.iso8601(since);
|
|
1191
|
-
}
|
|
1192
|
-
const response = await this.privateGetAccountWithdrawals(this.extend(request, params));
|
|
1193
|
-
//
|
|
1194
|
-
// {
|
|
1195
|
-
// "withdrawal_history": [
|
|
1196
|
-
// {
|
|
1197
|
-
// "account_id": "e369ac80-4577-11e9-ae08-9bedc4790b84",
|
|
1198
|
-
// "amount": "0.1",
|
|
1199
|
-
// "currency": "BTC",
|
|
1200
|
-
// "fee_amount": "0.00002",
|
|
1201
|
-
// "fee_currency": "BTC",
|
|
1202
|
-
// "funds_source": "EXTERNAL",
|
|
1203
|
-
// "related_transaction_id": "e298341a-3855-405e-bce3-92db368a3157",
|
|
1204
|
-
// "time": "2020-05-05T11:11:32.110Z",
|
|
1205
|
-
// "transaction_id": "6693ff40-bb10-4dcf-ada7-3b287727c882",
|
|
1206
|
-
// "type": "CRYPTO"
|
|
1207
|
-
// },
|
|
1208
|
-
// {
|
|
1209
|
-
// "account_id": "e369ac80-4577-11e9-ae08-9bedc4790b84",
|
|
1210
|
-
// "amount": "0.1",
|
|
1211
|
-
// "currency": "BTC",
|
|
1212
|
-
// "fee_amount": "0.0",
|
|
1213
|
-
// "fee_currency": "BTC",
|
|
1214
|
-
// "funds_source": "INTERNAL",
|
|
1215
|
-
// "time": "2020-05-05T10:29:53.464Z",
|
|
1216
|
-
// "transaction_id": "ec9703b1-954b-4f76-adea-faac66eabc0b",
|
|
1217
|
-
// "type": "CRYPTO"
|
|
1218
|
-
// }
|
|
1219
|
-
// ],
|
|
1220
|
-
// "cursor": "eyJhY2NvdW50X2lkIjp7InMiOiJlMzY5YWM4MC00NTc3LTExZTktYWUwOC05YmVkYzQ3OTBiODQiLCJzcyI6W10sIm5zIjpbXSwiYnMiOltdLCJtIjp7fSwibCI6W119LCJpdGVtX2tleSI6eyJzIjoiV0lUSERSQVdBTDo6ZWM5NzAzYjEtOTU0Yi00Zjc2LWFkZWEtZmFhYzY2ZWFiYzBiIiwic3MiOltdLCJucyI6W10sImJzIjpbXSwibSI6e30sImwiOltdfSwiZ2xvYmFsX3dpdGhkcmF3YWxfaW5kZXhfaGFzaF9rZXkiOnsicyI6ImUzNjlhYzgwLTQ1NzctMTFlOS1hZTA4LTliZWRjNDc5MGI4NCIsInNzIjpbXSwibnMiOltdLCJicyI6W10sIm0iOnt9LCJsIjpbXX0sInRpbWVzdGFtcCI6eyJuIjoiMTU4ODY3NDU5MzQ2NCIsInNzIjpbXSwibnMiOltdLCJicyI6W10sIm0iOnt9LCJsIjpbXX19",
|
|
1221
|
-
// "max_page_size": 2
|
|
1222
|
-
// }
|
|
1223
|
-
//
|
|
1224
|
-
const withdrawalHistory = this.safeList(response, 'withdrawal_history', []);
|
|
1225
|
-
return this.parseTransactions(withdrawalHistory, currency, since, limit, { 'type': 'withdrawal' });
|
|
1226
|
-
}
|
|
1227
|
-
/**
|
|
1228
|
-
* @method
|
|
1229
|
-
* @name onetrading#withdraw
|
|
1230
|
-
* @description make a withdrawal
|
|
1231
|
-
* @param {string} code unified currency code
|
|
1232
|
-
* @param {float} amount the amount to withdraw
|
|
1233
|
-
* @param {string} address the address to withdraw to
|
|
1234
|
-
* @param {string} tag
|
|
1235
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1236
|
-
* @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
1237
|
-
*/
|
|
1238
|
-
async withdraw(code, amount, address, tag = undefined, params = {}) {
|
|
1239
|
-
[tag, params] = this.handleWithdrawTagAndParams(tag, params);
|
|
1240
|
-
this.checkAddress(address);
|
|
1241
|
-
await this.loadMarkets();
|
|
1242
|
-
const currency = this.currency(code);
|
|
1243
|
-
const request = {
|
|
1244
|
-
'currency': code,
|
|
1245
|
-
'amount': this.currencyToPrecision(code, amount),
|
|
1246
|
-
// 'payout_account_id': '66756a10-3e86-48f4-9678-b634c4b135b2', // fiat only
|
|
1247
|
-
// 'recipient': { // crypto only
|
|
1248
|
-
// 'address': address,
|
|
1249
|
-
// // 'destination_tag': '',
|
|
1250
|
-
// },
|
|
1251
|
-
};
|
|
1252
|
-
const options = this.safeValue(this.options, 'fiat', []);
|
|
1253
|
-
const isFiat = this.inArray(code, options);
|
|
1254
|
-
const method = isFiat ? 'privatePostAccountWithdrawFiat' : 'privatePostAccountWithdrawCrypto';
|
|
1255
|
-
if (isFiat) {
|
|
1256
|
-
const payoutAccountId = this.safeString(params, 'payout_account_id');
|
|
1257
|
-
if (payoutAccountId === undefined) {
|
|
1258
|
-
throw new ArgumentsRequired(this.id + ' withdraw() requires a payout_account_id param for fiat ' + code + ' withdrawals');
|
|
1259
|
-
}
|
|
1260
|
-
}
|
|
1261
|
-
else {
|
|
1262
|
-
const recipient = { 'address': address };
|
|
1263
|
-
if (tag !== undefined) {
|
|
1264
|
-
recipient['destination_tag'] = tag;
|
|
1265
|
-
}
|
|
1266
|
-
request['recipient'] = recipient;
|
|
1267
|
-
}
|
|
1268
|
-
const response = await this[method](this.extend(request, params));
|
|
1269
|
-
//
|
|
1270
|
-
// crypto
|
|
1271
|
-
//
|
|
1272
|
-
// {
|
|
1273
|
-
// "amount": "1234.5678",
|
|
1274
|
-
// "fee": "1234.5678",
|
|
1275
|
-
// "recipient": "3NacQ7rzZdhfyAtfJ5a11k8jFPdcMP2Bq7",
|
|
1276
|
-
// "destination_tag": "",
|
|
1277
|
-
// "transaction_id": "d0f8529f-f832-4e6a-9dc5-b8d5797badb2"
|
|
1278
|
-
// }
|
|
1279
|
-
//
|
|
1280
|
-
// fiat
|
|
1281
|
-
//
|
|
1282
|
-
// {
|
|
1283
|
-
// "transaction_id": "54236cd0-4413-11e9-93fb-5fea7e5b5df6"
|
|
1284
|
-
// }
|
|
1285
|
-
//
|
|
1286
|
-
return this.parseTransaction(response, currency);
|
|
1287
|
-
}
|
|
1288
|
-
parseTransaction(transaction, currency = undefined) {
|
|
1289
|
-
//
|
|
1290
|
-
// fetchDeposits, fetchWithdrawals
|
|
1291
|
-
//
|
|
1292
|
-
// {
|
|
1293
|
-
// "transaction_id": "C2b42efcd-d5b7-4a56-8e12-b69ffd68c5ef",
|
|
1294
|
-
// "type": "FIAT",
|
|
1295
|
-
// "account_id": "c2d0076a-c20d-41f8-9e9a-1a1d028b2b58",
|
|
1296
|
-
// "amount": "1234.5678",
|
|
1297
|
-
// "time": "2019-08-24T14:15:22Z",
|
|
1298
|
-
// "funds_source": "INTERNAL",
|
|
1299
|
-
// "currency": "BTC",
|
|
1300
|
-
// "fee_amount": "1234.5678",
|
|
1301
|
-
// "fee_currency": "BTC",
|
|
1302
|
-
// "blockchain_transaction_id": "f4184fc596403b9d638783cf57adfe4c75c605f6356fbc91338530e9831e9e16",
|
|
1303
|
-
// "related_transaction_id": "e298341a-3855-405e-bce3-92db368a3157"
|
|
1304
|
-
// }
|
|
1305
|
-
//
|
|
1306
|
-
// withdraw
|
|
1307
|
-
//
|
|
1308
|
-
//
|
|
1309
|
-
// crypto
|
|
1310
|
-
//
|
|
1311
|
-
// {
|
|
1312
|
-
// "amount": "1234.5678",
|
|
1313
|
-
// "fee": "1234.5678",
|
|
1314
|
-
// "recipient": "3NacQ7rzZdhfyAtfJ5a11k8jFPdcMP2Bq7",
|
|
1315
|
-
// "destination_tag": "",
|
|
1316
|
-
// "transaction_id": "d0f8529f-f832-4e6a-9dc5-b8d5797badb2"
|
|
1317
|
-
// }
|
|
1318
|
-
//
|
|
1319
|
-
// fiat
|
|
1320
|
-
//
|
|
1321
|
-
// {
|
|
1322
|
-
// "transaction_id": "54236cd0-4413-11e9-93fb-5fea7e5b5df6"
|
|
1323
|
-
// }
|
|
1324
|
-
//
|
|
1325
|
-
const id = this.safeString(transaction, 'transaction_id');
|
|
1326
|
-
const amount = this.safeNumber(transaction, 'amount');
|
|
1327
|
-
const timestamp = this.parse8601(this.safeString(transaction, 'time'));
|
|
1328
|
-
const currencyId = this.safeString(transaction, 'currency');
|
|
1329
|
-
currency = this.safeCurrency(currencyId, currency);
|
|
1330
|
-
const status = 'ok'; // the exchange returns cleared transactions only
|
|
1331
|
-
const feeCost = this.safeNumber2(transaction, 'fee_amount', 'fee');
|
|
1332
|
-
let fee = undefined;
|
|
1333
|
-
const addressTo = this.safeString(transaction, 'recipient');
|
|
1334
|
-
const tagTo = this.safeString(transaction, 'destination_tag');
|
|
1335
|
-
if (feeCost !== undefined) {
|
|
1336
|
-
const feeCurrencyId = this.safeString(transaction, 'fee_currency', currencyId);
|
|
1337
|
-
const feeCurrencyCode = this.safeCurrencyCode(feeCurrencyId);
|
|
1338
|
-
fee = {
|
|
1339
|
-
'cost': feeCost,
|
|
1340
|
-
'currency': feeCurrencyCode,
|
|
1341
|
-
};
|
|
1342
|
-
}
|
|
1343
|
-
return {
|
|
1344
|
-
'info': transaction,
|
|
1345
|
-
'id': id,
|
|
1346
|
-
'currency': currency['code'],
|
|
1347
|
-
'amount': amount,
|
|
1348
|
-
'network': undefined,
|
|
1349
|
-
'address': addressTo,
|
|
1350
|
-
'addressFrom': undefined,
|
|
1351
|
-
'addressTo': addressTo,
|
|
1352
|
-
'tag': tagTo,
|
|
1353
|
-
'tagFrom': undefined,
|
|
1354
|
-
'tagTo': tagTo,
|
|
1355
|
-
'status': status,
|
|
1356
|
-
'type': undefined,
|
|
1357
|
-
'updated': undefined,
|
|
1358
|
-
'txid': this.safeString(transaction, 'blockchain_transaction_id'),
|
|
1359
|
-
'comment': undefined,
|
|
1360
|
-
'internal': undefined,
|
|
1361
|
-
'timestamp': timestamp,
|
|
1362
|
-
'datetime': this.iso8601(timestamp),
|
|
1363
|
-
'fee': fee,
|
|
1364
|
-
};
|
|
1365
|
-
}
|
|
1366
996
|
parseOrderStatus(status) {
|
|
1367
997
|
const statuses = {
|
|
1368
998
|
'FILLED': 'open',
|
|
@@ -1571,6 +1201,7 @@ export default class onetrading extends Exchange {
|
|
|
1571
1201
|
* @method
|
|
1572
1202
|
* @name onetrading#cancelOrder
|
|
1573
1203
|
* @description cancels an open order
|
|
1204
|
+
* @see https://docs.onetrading.com/#close-order-by-order-id
|
|
1574
1205
|
* @param {string} id order id
|
|
1575
1206
|
* @param {string} symbol not used by bitmex cancelOrder ()
|
|
1576
1207
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -1599,6 +1230,7 @@ export default class onetrading extends Exchange {
|
|
|
1599
1230
|
* @method
|
|
1600
1231
|
* @name onetrading#cancelAllOrders
|
|
1601
1232
|
* @description cancel all open orders
|
|
1233
|
+
* @see https://docs.onetrading.com/#close-all-orders
|
|
1602
1234
|
* @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
|
|
1603
1235
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1604
1236
|
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
@@ -1622,6 +1254,7 @@ export default class onetrading extends Exchange {
|
|
|
1622
1254
|
* @method
|
|
1623
1255
|
* @name onetrading#cancelOrders
|
|
1624
1256
|
* @description cancel multiple orders
|
|
1257
|
+
* @see https://docs.onetrading.com/#close-all-orders
|
|
1625
1258
|
* @param {string[]} ids order ids
|
|
1626
1259
|
* @param {string} symbol unified market symbol, default is undefined
|
|
1627
1260
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -1644,6 +1277,7 @@ export default class onetrading extends Exchange {
|
|
|
1644
1277
|
* @method
|
|
1645
1278
|
* @name onetrading#fetchOrder
|
|
1646
1279
|
* @description fetches information on an order made by the user
|
|
1280
|
+
* @see https://docs.onetrading.com/#get-order
|
|
1647
1281
|
* @param {string} id the order id
|
|
1648
1282
|
* @param {string} symbol not used by onetrading fetchOrder
|
|
1649
1283
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -1702,6 +1336,7 @@ export default class onetrading extends Exchange {
|
|
|
1702
1336
|
* @method
|
|
1703
1337
|
* @name onetrading#fetchOpenOrders
|
|
1704
1338
|
* @description fetch all unfilled currently open orders
|
|
1339
|
+
* @see https://docs.onetrading.com/#get-orders
|
|
1705
1340
|
* @param {string} symbol unified market symbol
|
|
1706
1341
|
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
1707
1342
|
* @param {int} [limit] the maximum number of open orders structures to retrieve
|
|
@@ -1822,6 +1457,7 @@ export default class onetrading extends Exchange {
|
|
|
1822
1457
|
* @method
|
|
1823
1458
|
* @name onetrading#fetchClosedOrders
|
|
1824
1459
|
* @description fetches information on multiple closed orders made by the user
|
|
1460
|
+
* @see https://docs.onetrading.com/#get-orders
|
|
1825
1461
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
1826
1462
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
1827
1463
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
@@ -1838,6 +1474,7 @@ export default class onetrading extends Exchange {
|
|
|
1838
1474
|
* @method
|
|
1839
1475
|
* @name onetrading#fetchOrderTrades
|
|
1840
1476
|
* @description fetch all the trades made from a single order
|
|
1477
|
+
* @see https://docs.onetrading.com/#trades-for-order
|
|
1841
1478
|
* @param {string} id order id
|
|
1842
1479
|
* @param {string} symbol unified market symbol
|
|
1843
1480
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
@@ -1897,6 +1534,7 @@ export default class onetrading extends Exchange {
|
|
|
1897
1534
|
* @method
|
|
1898
1535
|
* @name onetrading#fetchMyTrades
|
|
1899
1536
|
* @description fetch all trades made by the user
|
|
1537
|
+
* @see https://docs.onetrading.com/#all-trades
|
|
1900
1538
|
* @param {string} symbol unified market symbol
|
|
1901
1539
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
1902
1540
|
* @param {int} [limit] the maximum number of trades structures to retrieve
|
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) {
|