ccxt 4.4.31 → 4.4.32
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 +9 -3
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/binance.js +1 -0
- package/dist/cjs/src/bitvavo.js +0 -4
- package/dist/cjs/src/cex.js +1 -1
- package/dist/cjs/src/coincatch.js +3 -3
- package/dist/cjs/src/coinex.js +1 -1
- package/dist/cjs/src/deribit.js +2 -2
- package/dist/cjs/src/gate.js +19 -3
- package/dist/cjs/src/hitbtc.js +3 -3
- package/dist/cjs/src/htx.js +1 -1
- package/dist/cjs/src/indodax.js +1 -1
- package/dist/cjs/src/kraken.js +4 -2
- package/dist/cjs/src/krakenfutures.js +2 -0
- package/dist/cjs/src/kucoin.js +5 -3
- package/dist/cjs/src/kucoinfutures.js +98 -27
- package/dist/cjs/src/okx.js +2 -2
- package/dist/cjs/src/phemex.js +19 -23
- package/dist/cjs/src/pro/binance.js +8 -8
- package/dist/cjs/src/pro/bitget.js +4 -4
- package/dist/cjs/src/pro/bitmart.js +2 -2
- package/dist/cjs/src/pro/bitmex.js +2 -2
- package/dist/cjs/src/pro/bitvavo.js +46 -48
- package/dist/cjs/src/pro/blofin.js +2 -2
- package/dist/cjs/src/pro/bybit.js +2 -2
- package/dist/cjs/src/pro/coincatch.js +1 -1
- package/dist/cjs/src/pro/cryptocom.js +4 -4
- package/dist/cjs/src/pro/gate.js +4 -4
- package/dist/cjs/src/pro/hashkey.js +3 -3
- package/dist/cjs/src/pro/mexc.js +1 -2
- package/dist/cjs/src/wavesexchange.js +1 -0
- package/dist/cjs/src/woofipro.js +2 -2
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/binance.d.ts +1 -0
- package/js/src/binance.js +1 -0
- package/js/src/bitvavo.js +0 -4
- package/js/src/cex.d.ts +1 -1
- package/js/src/cex.js +1 -1
- package/js/src/coincatch.d.ts +1 -1
- package/js/src/coincatch.js +3 -3
- package/js/src/coinex.d.ts +1 -1
- package/js/src/coinex.js +1 -1
- package/js/src/deribit.d.ts +2 -2
- package/js/src/deribit.js +2 -2
- package/js/src/gate.d.ts +3 -1
- package/js/src/gate.js +19 -3
- package/js/src/hitbtc.d.ts +3 -3
- package/js/src/hitbtc.js +3 -3
- package/js/src/htx.d.ts +1 -1
- package/js/src/htx.js +1 -1
- package/js/src/indodax.js +1 -1
- package/js/src/kraken.d.ts +4 -2
- package/js/src/kraken.js +4 -2
- package/js/src/krakenfutures.d.ts +2 -0
- package/js/src/krakenfutures.js +2 -0
- package/js/src/kucoin.d.ts +3 -3
- package/js/src/kucoin.js +5 -3
- package/js/src/kucoinfutures.d.ts +8 -4
- package/js/src/kucoinfutures.js +98 -27
- package/js/src/okx.d.ts +2 -2
- package/js/src/okx.js +2 -2
- package/js/src/phemex.js +19 -23
- package/js/src/pro/binance.d.ts +8 -8
- package/js/src/pro/binance.js +8 -8
- package/js/src/pro/bitget.d.ts +3 -3
- package/js/src/pro/bitget.js +4 -4
- package/js/src/pro/bitmart.d.ts +2 -2
- package/js/src/pro/bitmart.js +2 -2
- package/js/src/pro/bitmex.d.ts +2 -2
- package/js/src/pro/bitmex.js +2 -2
- package/js/src/pro/bitvavo.d.ts +1 -1
- package/js/src/pro/bitvavo.js +46 -48
- package/js/src/pro/blofin.d.ts +2 -2
- package/js/src/pro/blofin.js +2 -2
- package/js/src/pro/bybit.d.ts +2 -2
- package/js/src/pro/bybit.js +2 -2
- package/js/src/pro/coincatch.d.ts +1 -1
- package/js/src/pro/coincatch.js +1 -1
- package/js/src/pro/cryptocom.d.ts +4 -4
- package/js/src/pro/cryptocom.js +4 -4
- package/js/src/pro/gate.d.ts +4 -4
- package/js/src/pro/gate.js +4 -4
- package/js/src/pro/hashkey.d.ts +3 -3
- package/js/src/pro/hashkey.js +3 -3
- package/js/src/pro/mexc.js +1 -2
- package/js/src/wavesexchange.d.ts +1 -0
- package/js/src/wavesexchange.js +1 -0
- package/js/src/woofipro.d.ts +2 -2
- package/js/src/woofipro.js +2 -2
- package/package.json +1 -1
package/js/src/hitbtc.d.ts
CHANGED
|
@@ -158,7 +158,7 @@ export default class hitbtc extends Exchange {
|
|
|
158
158
|
* @name hitbtc#fetchOrderBooks
|
|
159
159
|
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data for multiple markets
|
|
160
160
|
* @see https://api.hitbtc.com/#order-books
|
|
161
|
-
* @param {string[]
|
|
161
|
+
* @param {string[]} [symbols] list of unified market symbols, all symbols fetched if undefined, default is undefined
|
|
162
162
|
* @param {int} [limit] max number of entries per orderbook to return, default is undefined
|
|
163
163
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
164
164
|
* @returns {object} a dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbol
|
|
@@ -535,8 +535,8 @@ export default class hitbtc extends Exchange {
|
|
|
535
535
|
* @name hitbtc#closePosition
|
|
536
536
|
* @description closes open positions for a market
|
|
537
537
|
* @see https://api.hitbtc.com/#close-all-futures-margin-positions
|
|
538
|
-
* @param symbol
|
|
539
|
-
* @param side
|
|
538
|
+
* @param {string} symbol unified ccxt market symbol
|
|
539
|
+
* @param {string} side 'buy' or 'sell'
|
|
540
540
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
541
541
|
* @param {string} [params.symbol] *required* unified market symbol
|
|
542
542
|
* @param {string} [params.marginMode] 'cross' or 'isolated', default is 'cross'
|
package/js/src/hitbtc.js
CHANGED
|
@@ -1559,7 +1559,7 @@ export default class hitbtc extends Exchange {
|
|
|
1559
1559
|
* @name hitbtc#fetchOrderBooks
|
|
1560
1560
|
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data for multiple markets
|
|
1561
1561
|
* @see https://api.hitbtc.com/#order-books
|
|
1562
|
-
* @param {string[]
|
|
1562
|
+
* @param {string[]} [symbols] list of unified market symbols, all symbols fetched if undefined, default is undefined
|
|
1563
1563
|
* @param {int} [limit] max number of entries per orderbook to return, default is undefined
|
|
1564
1564
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1565
1565
|
* @returns {object} a dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbol
|
|
@@ -3580,8 +3580,8 @@ export default class hitbtc extends Exchange {
|
|
|
3580
3580
|
* @name hitbtc#closePosition
|
|
3581
3581
|
* @description closes open positions for a market
|
|
3582
3582
|
* @see https://api.hitbtc.com/#close-all-futures-margin-positions
|
|
3583
|
-
* @param symbol
|
|
3584
|
-
* @param side
|
|
3583
|
+
* @param {string} symbol unified ccxt market symbol
|
|
3584
|
+
* @param {string} side 'buy' or 'sell'
|
|
3585
3585
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
3586
3586
|
* @param {string} [params.symbol] *required* unified market symbol
|
|
3587
3587
|
* @param {string} [params.marginMode] 'cross' or 'isolated', default is 'cross'
|
package/js/src/htx.d.ts
CHANGED
|
@@ -264,7 +264,7 @@ export default class htx extends Exchange {
|
|
|
264
264
|
* @see https://huobiapi.github.io/docs/spot/v1/en/#get-all-accounts-of-the-current-user
|
|
265
265
|
* @param {string} type 'spot', 'swap' or 'future
|
|
266
266
|
* @param {string} [marginMode] 'cross' or 'isolated'
|
|
267
|
-
* @param symbol
|
|
267
|
+
* @param {string} [symbol] unified ccxt market symbol
|
|
268
268
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
269
269
|
* @returns {object} a dictionary of [account structures]{@link https://docs.ccxt.com/#/?id=account-structure} indexed by the account type
|
|
270
270
|
*/
|
package/js/src/htx.js
CHANGED
|
@@ -3215,7 +3215,7 @@ export default class htx extends Exchange {
|
|
|
3215
3215
|
* @see https://huobiapi.github.io/docs/spot/v1/en/#get-all-accounts-of-the-current-user
|
|
3216
3216
|
* @param {string} type 'spot', 'swap' or 'future
|
|
3217
3217
|
* @param {string} [marginMode] 'cross' or 'isolated'
|
|
3218
|
-
* @param symbol
|
|
3218
|
+
* @param {string} [symbol] unified ccxt market symbol
|
|
3219
3219
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3220
3220
|
* @returns {object} a dictionary of [account structures]{@link https://docs.ccxt.com/#/?id=account-structure} indexed by the account type
|
|
3221
3221
|
*/
|
package/js/src/indodax.js
CHANGED
|
@@ -23,7 +23,7 @@ export default class indodax extends Exchange {
|
|
|
23
23
|
'countries': ['ID'],
|
|
24
24
|
// 10 requests per second for making trades => 1000ms / 10 = 100ms
|
|
25
25
|
// 180 requests per minute (public endpoints) = 2 requests per second => cost = (1000ms / rateLimit) / 2 = 5
|
|
26
|
-
'rateLimit':
|
|
26
|
+
'rateLimit': 50,
|
|
27
27
|
'has': {
|
|
28
28
|
'CORS': undefined,
|
|
29
29
|
'spot': true,
|
package/js/src/kraken.d.ts
CHANGED
|
@@ -253,8 +253,8 @@ export default class kraken extends Exchange {
|
|
|
253
253
|
* @name kraken#fetchOrdersByIds
|
|
254
254
|
* @description fetch orders by the list of order id
|
|
255
255
|
* @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getClosedOrders
|
|
256
|
-
* @param {string[]
|
|
257
|
-
* @param symbol
|
|
256
|
+
* @param {string[]} [ids] list of order id
|
|
257
|
+
* @param {string} [symbol] unified ccxt market symbol
|
|
258
258
|
* @param {object} [params] extra parameters specific to the kraken api endpoint
|
|
259
259
|
* @returns {object[]} a list of [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
260
260
|
*/
|
|
@@ -440,6 +440,8 @@ export default class kraken extends Exchange {
|
|
|
440
440
|
parsePosition(position: Dict, market?: Market): import("./base/types.js").Position;
|
|
441
441
|
parseAccountType(account: any): string;
|
|
442
442
|
/**
|
|
443
|
+
* @method
|
|
444
|
+
* @name kraken#transferOut
|
|
443
445
|
* @description transfer from spot wallet to futures wallet
|
|
444
446
|
* @see https://docs.kraken.com/rest/#tag/User-Funding/operation/walletTransfer
|
|
445
447
|
* @param {str} code Unified currency code
|
package/js/src/kraken.js
CHANGED
|
@@ -2147,8 +2147,8 @@ export default class kraken extends Exchange {
|
|
|
2147
2147
|
* @name kraken#fetchOrdersByIds
|
|
2148
2148
|
* @description fetch orders by the list of order id
|
|
2149
2149
|
* @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getClosedOrders
|
|
2150
|
-
* @param {string[]
|
|
2151
|
-
* @param symbol
|
|
2150
|
+
* @param {string[]} [ids] list of order id
|
|
2151
|
+
* @param {string} [symbol] unified ccxt market symbol
|
|
2152
2152
|
* @param {object} [params] extra parameters specific to the kraken api endpoint
|
|
2153
2153
|
* @returns {object[]} a list of [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
2154
2154
|
*/
|
|
@@ -3071,6 +3071,8 @@ export default class kraken extends Exchange {
|
|
|
3071
3071
|
return this.safeString(accountByType, account, account);
|
|
3072
3072
|
}
|
|
3073
3073
|
/**
|
|
3074
|
+
* @method
|
|
3075
|
+
* @name kraken#transferOut
|
|
3074
3076
|
* @description transfer from spot wallet to futures wallet
|
|
3075
3077
|
* @see https://docs.kraken.com/rest/#tag/User-Funding/operation/walletTransfer
|
|
3076
3078
|
* @param {str} code Unified currency code
|
|
@@ -297,6 +297,8 @@ export default class krakenfutures extends Exchange {
|
|
|
297
297
|
parseTransfer(transfer: Dict, currency?: Currency): TransferEntry;
|
|
298
298
|
parseAccount(account: any): any;
|
|
299
299
|
/**
|
|
300
|
+
* @method
|
|
301
|
+
* @name krakenfutures#transferOut
|
|
300
302
|
* @description transfer from futures wallet to spot wallet
|
|
301
303
|
* @param {str} code Unified currency code
|
|
302
304
|
* @param {float} amount Size of the transfer
|
package/js/src/krakenfutures.js
CHANGED
|
@@ -2577,6 +2577,8 @@ export default class krakenfutures extends Exchange {
|
|
|
2577
2577
|
}
|
|
2578
2578
|
}
|
|
2579
2579
|
/**
|
|
2580
|
+
* @method
|
|
2581
|
+
* @name krakenfutures#transferOut
|
|
2580
2582
|
* @description transfer from futures wallet to spot wallet
|
|
2581
2583
|
* @param {str} code Unified currency code
|
|
2582
2584
|
* @param {float} amount Size of the transfer
|
package/js/src/kucoin.d.ts
CHANGED
|
@@ -42,9 +42,9 @@ export default class kucoin extends Exchange {
|
|
|
42
42
|
*/
|
|
43
43
|
fetchMarkets(params?: {}): Promise<Market[]>;
|
|
44
44
|
/**
|
|
45
|
-
* @param force
|
|
46
45
|
* @method
|
|
47
46
|
* @name kucoin#loadMigrationStatus
|
|
47
|
+
* @param {boolean} force load account state for non hf
|
|
48
48
|
* @description loads the migration status for the account (hf or not)
|
|
49
49
|
* @see https://www.kucoin.com/docs/rest/spot-trading/spot-hf-trade-pro-account/get-user-type
|
|
50
50
|
*/
|
|
@@ -742,8 +742,8 @@ export default class kucoin extends Exchange {
|
|
|
742
742
|
* @name kucoin#setLeverage
|
|
743
743
|
* @description set the level of leverage for a market
|
|
744
744
|
* @see https://www.kucoin.com/docs/rest/margin-trading/margin-trading-v3-/modify-leverage-multiplier
|
|
745
|
-
* @param leverage
|
|
746
|
-
* @param {string} symbol unified market symbol
|
|
745
|
+
* @param {int } [leverage] New leverage multiplier. Must be greater than 1 and up to two decimal places, and cannot be less than the user's current debt leverage or greater than the system's maximum leverage
|
|
746
|
+
* @param {string} [symbol] unified market symbol
|
|
747
747
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
748
748
|
* @returns {object} response from the exchange
|
|
749
749
|
*/
|
package/js/src/kucoin.js
CHANGED
|
@@ -574,6 +574,8 @@ export default class kucoin extends Exchange {
|
|
|
574
574
|
'400303': PermissionDenied,
|
|
575
575
|
'500000': ExchangeNotAvailable,
|
|
576
576
|
'260220': InvalidAddress,
|
|
577
|
+
'600100': InsufficientFunds,
|
|
578
|
+
'600101': InvalidOrder,
|
|
577
579
|
'900014': BadRequest, // {"code":"900014","msg":"Invalid chainId"}
|
|
578
580
|
},
|
|
579
581
|
'broad': {
|
|
@@ -1231,9 +1233,9 @@ export default class kucoin extends Exchange {
|
|
|
1231
1233
|
return result;
|
|
1232
1234
|
}
|
|
1233
1235
|
/**
|
|
1234
|
-
* @param force
|
|
1235
1236
|
* @method
|
|
1236
1237
|
* @name kucoin#loadMigrationStatus
|
|
1238
|
+
* @param {boolean} force load account state for non hf
|
|
1237
1239
|
* @description loads the migration status for the account (hf or not)
|
|
1238
1240
|
* @see https://www.kucoin.com/docs/rest/spot-trading/spot-hf-trade-pro-account/get-user-type
|
|
1239
1241
|
*/
|
|
@@ -4950,8 +4952,8 @@ export default class kucoin extends Exchange {
|
|
|
4950
4952
|
* @name kucoin#setLeverage
|
|
4951
4953
|
* @description set the level of leverage for a market
|
|
4952
4954
|
* @see https://www.kucoin.com/docs/rest/margin-trading/margin-trading-v3-/modify-leverage-multiplier
|
|
4953
|
-
* @param leverage
|
|
4954
|
-
* @param {string} symbol unified market symbol
|
|
4955
|
+
* @param {int } [leverage] New leverage multiplier. Must be greater than 1 and up to two decimal places, and cannot be less than the user's current debt leverage or greater than the system's maximum leverage
|
|
4956
|
+
* @param {string} [symbol] unified market symbol
|
|
4955
4957
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4956
4958
|
* @returns {object} response from the exchange
|
|
4957
4959
|
*/
|
|
@@ -154,8 +154,8 @@ export default class kucoinfutures extends kucoin {
|
|
|
154
154
|
* @description fetches historical positions
|
|
155
155
|
* @see https://www.kucoin.com/docs/rest/futures-trading/positions/get-positions-history
|
|
156
156
|
* @param {string[]} [symbols] list of unified market symbols
|
|
157
|
-
* @param since
|
|
158
|
-
* @param limit
|
|
157
|
+
* @param {int} [since] the earliest time in ms to fetch position history for
|
|
158
|
+
* @param {int} [limit] the maximum number of entries to retrieve
|
|
159
159
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
160
160
|
* @param {int} [params.until] closing end time
|
|
161
161
|
* @param {int} [params.pageId] page id
|
|
@@ -167,7 +167,7 @@ export default class kucoinfutures extends kucoin {
|
|
|
167
167
|
* @method
|
|
168
168
|
* @name kucoinfutures#createOrder
|
|
169
169
|
* @description Create an order on the exchange
|
|
170
|
-
* @see https://
|
|
170
|
+
* @see https://www.kucoin.com/docs/rest/futures-trading/orders/place-order
|
|
171
171
|
* @see https://www.kucoin.com/docs/rest/futures-trading/orders/place-take-profit-and-stop-loss-order#http-request
|
|
172
172
|
* @param {string} symbol Unified CCXT market symbol
|
|
173
173
|
* @param {string} type 'limit' or 'market'
|
|
@@ -183,6 +183,7 @@ export default class kucoinfutures extends kucoin {
|
|
|
183
183
|
* @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.
|
|
184
184
|
* @param {string} [params.timeInForce] GTC, GTT, IOC, or FOK, default is GTC, limit orders only
|
|
185
185
|
* @param {string} [params.postOnly] Post only flag, invalid when timeInForce is IOC or FOK
|
|
186
|
+
* @param {float} [params.cost] the cost of the order in units of USDT
|
|
186
187
|
* ----------------- Exchange Specific Parameters -----------------
|
|
187
188
|
* @param {float} [params.leverage] Leverage size of the order
|
|
188
189
|
* @param {string} [params.clientOid] client order id, defaults to uuid if not passed
|
|
@@ -355,6 +356,8 @@ export default class kucoinfutures extends kucoin {
|
|
|
355
356
|
* @method
|
|
356
357
|
* @name kucoinfutures#transfer
|
|
357
358
|
* @description transfer currency internally between wallets on the same account
|
|
359
|
+
* @see https://www.kucoin.com/docs/rest/funding/transfer/transfer-to-main-or-trade-account
|
|
360
|
+
* @see https://www.kucoin.com/docs/rest/funding/transfer/transfer-to-futures-account
|
|
358
361
|
* @param {string} code unified currency code
|
|
359
362
|
* @param {float} amount amount to transfer
|
|
360
363
|
* @param {string} fromAccount account to transfer from
|
|
@@ -365,6 +368,7 @@ export default class kucoinfutures extends kucoin {
|
|
|
365
368
|
transfer(code: string, amount: number, fromAccount: string, toAccount: string, params?: {}): Promise<TransferEntry>;
|
|
366
369
|
parseTransfer(transfer: Dict, currency?: Currency): TransferEntry;
|
|
367
370
|
parseTransferStatus(status: Str): Str;
|
|
371
|
+
parseTransferType(transferType: Str): Str;
|
|
368
372
|
/**
|
|
369
373
|
* @method
|
|
370
374
|
* @name kucoinfutures#fetchMyTrades
|
|
@@ -491,7 +495,7 @@ export default class kucoinfutures extends kucoin {
|
|
|
491
495
|
setMarginMode(marginMode: string, symbol?: Str, params?: {}): Promise<MarginMode>;
|
|
492
496
|
/**
|
|
493
497
|
* @method
|
|
494
|
-
* @name
|
|
498
|
+
* @name kucoinfutures#fetchLeverage
|
|
495
499
|
* @description fetch the set leverage for a market
|
|
496
500
|
* @see https://www.kucoin.com/docs/rest/futures-trading/positions/get-cross-margin-leverage
|
|
497
501
|
* @param {string} symbol unified market symbol
|
package/js/src/kucoinfutures.js
CHANGED
|
@@ -1226,8 +1226,8 @@ export default class kucoinfutures extends kucoin {
|
|
|
1226
1226
|
* @description fetches historical positions
|
|
1227
1227
|
* @see https://www.kucoin.com/docs/rest/futures-trading/positions/get-positions-history
|
|
1228
1228
|
* @param {string[]} [symbols] list of unified market symbols
|
|
1229
|
-
* @param since
|
|
1230
|
-
* @param limit
|
|
1229
|
+
* @param {int} [since] the earliest time in ms to fetch position history for
|
|
1230
|
+
* @param {int} [limit] the maximum number of entries to retrieve
|
|
1231
1231
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1232
1232
|
* @param {int} [params.until] closing end time
|
|
1233
1233
|
* @param {int} [params.pageId] page id
|
|
@@ -1429,7 +1429,7 @@ export default class kucoinfutures extends kucoin {
|
|
|
1429
1429
|
* @method
|
|
1430
1430
|
* @name kucoinfutures#createOrder
|
|
1431
1431
|
* @description Create an order on the exchange
|
|
1432
|
-
* @see https://
|
|
1432
|
+
* @see https://www.kucoin.com/docs/rest/futures-trading/orders/place-order
|
|
1433
1433
|
* @see https://www.kucoin.com/docs/rest/futures-trading/orders/place-take-profit-and-stop-loss-order#http-request
|
|
1434
1434
|
* @param {string} symbol Unified CCXT market symbol
|
|
1435
1435
|
* @param {string} type 'limit' or 'market'
|
|
@@ -1445,6 +1445,7 @@ export default class kucoinfutures extends kucoin {
|
|
|
1445
1445
|
* @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.
|
|
1446
1446
|
* @param {string} [params.timeInForce] GTC, GTT, IOC, or FOK, default is GTC, limit orders only
|
|
1447
1447
|
* @param {string} [params.postOnly] Post only flag, invalid when timeInForce is IOC or FOK
|
|
1448
|
+
* @param {float} [params.cost] the cost of the order in units of USDT
|
|
1448
1449
|
* ----------------- Exchange Specific Parameters -----------------
|
|
1449
1450
|
* @param {float} [params.leverage] Leverage size of the order
|
|
1450
1451
|
* @param {string} [params.clientOid] client order id, defaults to uuid if not passed
|
|
@@ -1540,18 +1541,24 @@ export default class kucoinfutures extends kucoin {
|
|
|
1540
1541
|
// required param, cannot be used twice
|
|
1541
1542
|
const clientOrderId = this.safeString2(params, 'clientOid', 'clientOrderId', this.uuid());
|
|
1542
1543
|
params = this.omit(params, ['clientOid', 'clientOrderId']);
|
|
1543
|
-
if (amount < 1) {
|
|
1544
|
-
throw new InvalidOrder(this.id + ' createOrder() minimum contract order amount is 1');
|
|
1545
|
-
}
|
|
1546
|
-
const preciseAmount = parseInt(this.amountToPrecision(symbol, amount));
|
|
1547
1544
|
const request = {
|
|
1548
1545
|
'clientOid': clientOrderId,
|
|
1549
1546
|
'side': side,
|
|
1550
1547
|
'symbol': market['id'],
|
|
1551
1548
|
'type': type,
|
|
1552
|
-
'size': preciseAmount,
|
|
1553
1549
|
'leverage': 1,
|
|
1554
1550
|
};
|
|
1551
|
+
const cost = this.safeString(params, 'cost');
|
|
1552
|
+
params = this.omit(params, 'cost');
|
|
1553
|
+
if (cost !== undefined) {
|
|
1554
|
+
request['valueQty'] = this.costToPrecision(symbol, cost);
|
|
1555
|
+
}
|
|
1556
|
+
else {
|
|
1557
|
+
if (amount < 1) {
|
|
1558
|
+
throw new InvalidOrder(this.id + ' createOrder() minimum contract order amount is 1');
|
|
1559
|
+
}
|
|
1560
|
+
request['size'] = parseInt(this.amountToPrecision(symbol, amount));
|
|
1561
|
+
}
|
|
1555
1562
|
const [triggerPrice, stopLossPrice, takeProfitPrice] = this.handleTriggerPrices(params);
|
|
1556
1563
|
const stopLoss = this.safeDict(params, 'stopLoss');
|
|
1557
1564
|
const takeProfit = this.safeDict(params, 'takeProfit');
|
|
@@ -2426,6 +2433,8 @@ export default class kucoinfutures extends kucoin {
|
|
|
2426
2433
|
* @method
|
|
2427
2434
|
* @name kucoinfutures#transfer
|
|
2428
2435
|
* @description transfer currency internally between wallets on the same account
|
|
2436
|
+
* @see https://www.kucoin.com/docs/rest/funding/transfer/transfer-to-main-or-trade-account
|
|
2437
|
+
* @see https://www.kucoin.com/docs/rest/funding/transfer/transfer-to-futures-account
|
|
2429
2438
|
* @param {string} code unified currency code
|
|
2430
2439
|
* @param {float} amount amount to transfer
|
|
2431
2440
|
* @param {string} fromAccount account to transfer from
|
|
@@ -2434,9 +2443,6 @@ export default class kucoinfutures extends kucoin {
|
|
|
2434
2443
|
* @returns {object} a [transfer structure]{@link https://docs.ccxt.com/#/?id=transfer-structure}
|
|
2435
2444
|
*/
|
|
2436
2445
|
async transfer(code, amount, fromAccount, toAccount, params = {}) {
|
|
2437
|
-
if ((toAccount !== 'main' && toAccount !== 'funding') || (fromAccount !== 'futures' && fromAccount !== 'future' && fromAccount !== 'contract')) {
|
|
2438
|
-
throw new BadRequest(this.id + ' transfer() only supports transfers from contract(future) account to main(funding) account');
|
|
2439
|
-
}
|
|
2440
2446
|
await this.loadMarkets();
|
|
2441
2447
|
const currency = this.currency(code);
|
|
2442
2448
|
const amountToPrecision = this.currencyToPrecision(code, amount);
|
|
@@ -2444,38 +2450,95 @@ export default class kucoinfutures extends kucoin {
|
|
|
2444
2450
|
'currency': this.safeString(currency, 'id'),
|
|
2445
2451
|
'amount': amountToPrecision,
|
|
2446
2452
|
};
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2453
|
+
const toAccountString = this.parseTransferType(toAccount);
|
|
2454
|
+
let response = undefined;
|
|
2455
|
+
if (toAccountString === 'TRADE' || toAccountString === 'MAIN') {
|
|
2456
|
+
request['recAccountType'] = toAccountString;
|
|
2457
|
+
response = await this.futuresPrivatePostTransferOut(this.extend(request, params));
|
|
2458
|
+
//
|
|
2459
|
+
// {
|
|
2460
|
+
// "code": "200000",
|
|
2461
|
+
// "data": {
|
|
2462
|
+
// "applyId": "6738754373ceee00011ec3f8",
|
|
2463
|
+
// "bizNo": "6738754373ceee00011ec3f7",
|
|
2464
|
+
// "payAccountType": "CONTRACT",
|
|
2465
|
+
// "payTag": "DEFAULT",
|
|
2466
|
+
// "remark": "",
|
|
2467
|
+
// "recAccountType": "MAIN",
|
|
2468
|
+
// "recTag": "DEFAULT",
|
|
2469
|
+
// "recRemark": "",
|
|
2470
|
+
// "recSystem": "KUCOIN",
|
|
2471
|
+
// "status": "PROCESSING",
|
|
2472
|
+
// "currency": "USDT",
|
|
2473
|
+
// "amount": "5",
|
|
2474
|
+
// "fee": "0",
|
|
2475
|
+
// "sn": 1519769124846692,
|
|
2476
|
+
// "reason": "",
|
|
2477
|
+
// "createdAt": 1731753283000,
|
|
2478
|
+
// "updatedAt": 1731753283000
|
|
2479
|
+
// }
|
|
2480
|
+
// }
|
|
2481
|
+
//
|
|
2482
|
+
}
|
|
2483
|
+
else if (toAccount === 'future' || toAccount === 'swap' || toAccount === 'contract') {
|
|
2484
|
+
request['payAccountType'] = this.parseTransferType(fromAccount);
|
|
2485
|
+
response = await this.futuresPrivatePostTransferIn(this.extend(request, params));
|
|
2486
|
+
//
|
|
2487
|
+
// {
|
|
2488
|
+
// "code": "200000",
|
|
2489
|
+
// "data": {
|
|
2490
|
+
// "applyId": "5bffb63303aa675e8bbe18f9" // Transfer-out request ID
|
|
2491
|
+
// }
|
|
2492
|
+
// }
|
|
2493
|
+
//
|
|
2494
|
+
}
|
|
2495
|
+
else {
|
|
2496
|
+
throw new BadRequest(this.id + ' transfer() only supports transfers between future/swap, spot and funding accounts');
|
|
2497
|
+
}
|
|
2498
|
+
const data = this.safeDict(response, 'data', {});
|
|
2458
2499
|
return this.extend(this.parseTransfer(data, currency), {
|
|
2459
2500
|
'amount': this.parseNumber(amountToPrecision),
|
|
2460
|
-
'fromAccount':
|
|
2461
|
-
'toAccount':
|
|
2501
|
+
'fromAccount': fromAccount,
|
|
2502
|
+
'toAccount': toAccount,
|
|
2462
2503
|
});
|
|
2463
2504
|
}
|
|
2464
2505
|
parseTransfer(transfer, currency = undefined) {
|
|
2465
2506
|
//
|
|
2466
|
-
// transfer
|
|
2507
|
+
// transfer to spot or funding account
|
|
2467
2508
|
//
|
|
2468
2509
|
// {
|
|
2469
2510
|
// "applyId": "5bffb63303aa675e8bbe18f9" // Transfer-out request ID
|
|
2470
2511
|
// }
|
|
2471
2512
|
//
|
|
2513
|
+
// transfer to future account
|
|
2514
|
+
//
|
|
2515
|
+
// {
|
|
2516
|
+
// "applyId": "6738754373ceee00011ec3f8",
|
|
2517
|
+
// "bizNo": "6738754373ceee00011ec3f7",
|
|
2518
|
+
// "payAccountType": "CONTRACT",
|
|
2519
|
+
// "payTag": "DEFAULT",
|
|
2520
|
+
// "remark": "",
|
|
2521
|
+
// "recAccountType": "MAIN",
|
|
2522
|
+
// "recTag": "DEFAULT",
|
|
2523
|
+
// "recRemark": "",
|
|
2524
|
+
// "recSystem": "KUCOIN",
|
|
2525
|
+
// "status": "PROCESSING",
|
|
2526
|
+
// "currency": "USDT",
|
|
2527
|
+
// "amount": "5",
|
|
2528
|
+
// "fee": "0",
|
|
2529
|
+
// "sn": 1519769124846692,
|
|
2530
|
+
// "reason": "",
|
|
2531
|
+
// "createdAt": 1731753283000,
|
|
2532
|
+
// "updatedAt": 1731753283000
|
|
2533
|
+
// }
|
|
2534
|
+
//
|
|
2472
2535
|
const timestamp = this.safeInteger(transfer, 'updatedAt');
|
|
2473
2536
|
return {
|
|
2474
2537
|
'id': this.safeString(transfer, 'applyId'),
|
|
2475
2538
|
'timestamp': timestamp,
|
|
2476
2539
|
'datetime': this.iso8601(timestamp),
|
|
2477
2540
|
'currency': this.safeCurrencyCode(undefined, currency),
|
|
2478
|
-
'amount':
|
|
2541
|
+
'amount': this.safeNumber(transfer, 'amount'),
|
|
2479
2542
|
'fromAccount': undefined,
|
|
2480
2543
|
'toAccount': undefined,
|
|
2481
2544
|
'status': this.safeString(transfer, 'status'),
|
|
@@ -2488,6 +2551,13 @@ export default class kucoinfutures extends kucoin {
|
|
|
2488
2551
|
};
|
|
2489
2552
|
return this.safeString(statuses, status, status);
|
|
2490
2553
|
}
|
|
2554
|
+
parseTransferType(transferType) {
|
|
2555
|
+
const transferTypes = {
|
|
2556
|
+
'spot': 'TRADE',
|
|
2557
|
+
'funding': 'MAIN',
|
|
2558
|
+
};
|
|
2559
|
+
return this.safeStringUpper(transferTypes, transferType, transferType);
|
|
2560
|
+
}
|
|
2491
2561
|
/**
|
|
2492
2562
|
* @method
|
|
2493
2563
|
* @name kucoinfutures#fetchMyTrades
|
|
@@ -2889,6 +2959,7 @@ export default class kucoinfutures extends kucoin {
|
|
|
2889
2959
|
/**
|
|
2890
2960
|
* @ignore
|
|
2891
2961
|
* @method
|
|
2962
|
+
* @name kucoinfutures#parseMarketLeverageTiers
|
|
2892
2963
|
* @param {object} info Exchange market response for 1 market
|
|
2893
2964
|
* @param {object} market CCXT market
|
|
2894
2965
|
*/
|
|
@@ -3130,7 +3201,7 @@ export default class kucoinfutures extends kucoin {
|
|
|
3130
3201
|
}
|
|
3131
3202
|
/**
|
|
3132
3203
|
* @method
|
|
3133
|
-
* @name
|
|
3204
|
+
* @name kucoinfutures#fetchLeverage
|
|
3134
3205
|
* @description fetch the set leverage for a market
|
|
3135
3206
|
* @see https://www.kucoin.com/docs/rest/futures-trading/positions/get-cross-margin-leverage
|
|
3136
3207
|
* @param {string} symbol unified market symbol
|
package/js/src/okx.d.ts
CHANGED
|
@@ -1042,8 +1042,8 @@ export default class okx extends Exchange {
|
|
|
1042
1042
|
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-bills-details-last-3-months
|
|
1043
1043
|
* @param {string} [symbol] not used by okx fetchMarginAdjustmentHistory
|
|
1044
1044
|
* @param {string} [type] "add" or "reduce"
|
|
1045
|
-
* @param since
|
|
1046
|
-
* @param limit
|
|
1045
|
+
* @param {int} [since] the earliest time in ms to fetch margin adjustment history for
|
|
1046
|
+
* @param {int} [limit] the maximum number of entries to retrieve
|
|
1047
1047
|
* @param {object} params extra parameters specific to the exchange api endpoint
|
|
1048
1048
|
* @param {boolean} [params.auto] true if fetching auto margin increases
|
|
1049
1049
|
* @returns {object[]} a list of [margin structures]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
package/js/src/okx.js
CHANGED
|
@@ -8332,8 +8332,8 @@ export default class okx extends Exchange {
|
|
|
8332
8332
|
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-bills-details-last-3-months
|
|
8333
8333
|
* @param {string} [symbol] not used by okx fetchMarginAdjustmentHistory
|
|
8334
8334
|
* @param {string} [type] "add" or "reduce"
|
|
8335
|
-
* @param since
|
|
8336
|
-
* @param limit
|
|
8335
|
+
* @param {int} [since] the earliest time in ms to fetch margin adjustment history for
|
|
8336
|
+
* @param {int} [limit] the maximum number of entries to retrieve
|
|
8337
8337
|
* @param {object} params extra parameters specific to the exchange api endpoint
|
|
8338
8338
|
* @param {boolean} [params.auto] true if fetching auto margin increases
|
|
8339
8339
|
* @returns {object[]} a list of [margin structures]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
package/js/src/phemex.js
CHANGED
|
@@ -491,6 +491,13 @@ export default class phemex extends Exchange {
|
|
|
491
491
|
'transfer': {
|
|
492
492
|
'fillResponseFromRequest': true,
|
|
493
493
|
},
|
|
494
|
+
'triggerPriceTypesMap': {
|
|
495
|
+
'last': 'ByLastPrice',
|
|
496
|
+
'mark': 'ByMarkPrice',
|
|
497
|
+
'index': 'ByIndexPrice',
|
|
498
|
+
'ask': 'ByAskPrice',
|
|
499
|
+
'bid': 'ByBidPrice',
|
|
500
|
+
},
|
|
494
501
|
},
|
|
495
502
|
});
|
|
496
503
|
}
|
|
@@ -2140,6 +2147,7 @@ export default class phemex extends Exchange {
|
|
|
2140
2147
|
'PartiallyFilled': 'open',
|
|
2141
2148
|
'Filled': 'closed',
|
|
2142
2149
|
'Canceled': 'canceled',
|
|
2150
|
+
'Suspended': 'canceled',
|
|
2143
2151
|
'1': 'open',
|
|
2144
2152
|
'2': 'canceled',
|
|
2145
2153
|
'3': 'closed',
|
|
@@ -2646,17 +2654,11 @@ export default class phemex extends Exchange {
|
|
|
2646
2654
|
}
|
|
2647
2655
|
const stopLossTriggerPriceType = this.safeString2(stopLoss, 'triggerPriceType', 'slTrigger');
|
|
2648
2656
|
if (stopLossTriggerPriceType !== undefined) {
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
else {
|
|
2655
|
-
if ((stopLossTriggerPriceType !== 'ByMarkPrice') && (stopLossTriggerPriceType !== 'ByLastPrice')) {
|
|
2656
|
-
throw new InvalidOrder(this.id + ' createOrder() take profit trigger price type must be one of "ByMarkPrice", or "ByLastPrice"');
|
|
2657
|
-
}
|
|
2658
|
-
}
|
|
2659
|
-
request['slTrigger'] = stopLossTriggerPriceType;
|
|
2657
|
+
request['slTrigger'] = this.safeString(this.options['triggerPriceTypesMap'], stopLossTriggerPriceType, stopLossTriggerPriceType);
|
|
2658
|
+
}
|
|
2659
|
+
const slLimitPrice = this.safeString(stopLoss, 'price');
|
|
2660
|
+
if (slLimitPrice !== undefined) {
|
|
2661
|
+
request['slPxRp'] = this.priceToPrecision(symbol, slLimitPrice);
|
|
2660
2662
|
}
|
|
2661
2663
|
}
|
|
2662
2664
|
if (takeProfitDefined) {
|
|
@@ -2670,19 +2672,13 @@ export default class phemex extends Exchange {
|
|
|
2670
2672
|
else {
|
|
2671
2673
|
request['takeProfitEp'] = this.toEp(takeProfitTriggerPrice, market);
|
|
2672
2674
|
}
|
|
2673
|
-
const takeProfitTriggerPriceType = this.safeString2(
|
|
2675
|
+
const takeProfitTriggerPriceType = this.safeString2(takeProfit, 'triggerPriceType', 'tpTrigger');
|
|
2674
2676
|
if (takeProfitTriggerPriceType !== undefined) {
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
else {
|
|
2681
|
-
if ((takeProfitTriggerPriceType !== 'ByMarkPrice') && (takeProfitTriggerPriceType !== 'ByLastPrice')) {
|
|
2682
|
-
throw new InvalidOrder(this.id + ' createOrder() take profit trigger price type must be one of "ByMarkPrice", or "ByLastPrice"');
|
|
2683
|
-
}
|
|
2684
|
-
}
|
|
2685
|
-
request['tpTrigger'] = takeProfitTriggerPriceType;
|
|
2677
|
+
request['tpTrigger'] = this.safeString(this.options['triggerPriceTypesMap'], takeProfitTriggerPriceType, takeProfitTriggerPriceType);
|
|
2678
|
+
}
|
|
2679
|
+
const tpLimitPrice = this.safeString(takeProfit, 'price');
|
|
2680
|
+
if (tpLimitPrice !== undefined) {
|
|
2681
|
+
request['tpPxRp'] = this.priceToPrecision(symbol, tpLimitPrice);
|
|
2686
2682
|
}
|
|
2687
2683
|
}
|
|
2688
2684
|
}
|
package/js/src/pro/binance.d.ts
CHANGED
|
@@ -167,7 +167,7 @@ export default class binance extends binanceRest {
|
|
|
167
167
|
* @description watch the public liquidations of a trading pair
|
|
168
168
|
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/All-Market-Liquidation-Order-Streams
|
|
169
169
|
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/websocket-market-streams/All-Market-Liquidation-Order-Streams
|
|
170
|
-
* @param {string[]} symbols
|
|
170
|
+
* @param {string[]} symbols list of unified market symbols
|
|
171
171
|
* @param {int} [since] the earliest time in ms to fetch liquidations for
|
|
172
172
|
* @param {int} [limit] the maximum number of liquidation structures to retrieve
|
|
173
173
|
* @param {object} [params] exchange specific parameters for the bitmex api endpoint
|
|
@@ -195,7 +195,7 @@ export default class binance extends binanceRest {
|
|
|
195
195
|
* @description watch the private liquidations of a trading pair
|
|
196
196
|
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/user-data-streams/Event-Order-Update
|
|
197
197
|
* @see https://developers.binance.com/docs/derivatives/coin-margined-futures/user-data-streams/Event-Order-Update
|
|
198
|
-
* @param symbols
|
|
198
|
+
* @param {string[]} symbols list of unified market symbols
|
|
199
199
|
* @param {int} [since] the earliest time in ms to fetch liquidations for
|
|
200
200
|
* @param {int} [limit] the maximum number of liquidation structures to retrieve
|
|
201
201
|
* @param {object} [params] exchange specific parameters for the bitmex api endpoint
|
|
@@ -636,7 +636,7 @@ export default class binance extends binanceRest {
|
|
|
636
636
|
* @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api#cancel-order-trade
|
|
637
637
|
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/websocket-api/Cancel-Order
|
|
638
638
|
* @param {string} id order id
|
|
639
|
-
* @param {string} symbol unified market symbol, default is undefined
|
|
639
|
+
* @param {string} [symbol] unified market symbol, default is undefined
|
|
640
640
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
641
641
|
* @param {string|undefined} [params.cancelRestrictions] Supported values: ONLY_NEW - Cancel will succeed if the order status is NEW. ONLY_PARTIALLY_FILLED - Cancel will succeed if order status is PARTIALLY_FILLED.
|
|
642
642
|
* @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
@@ -647,7 +647,7 @@ export default class binance extends binanceRest {
|
|
|
647
647
|
* @name binance#cancelAllOrdersWs
|
|
648
648
|
* @description cancel all open orders in a market
|
|
649
649
|
* @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api#cancel-open-orders-trade
|
|
650
|
-
* @param {string} symbol unified market symbol of the market to cancel orders in
|
|
650
|
+
* @param {string} [symbol] unified market symbol of the market to cancel orders in
|
|
651
651
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
652
652
|
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
653
653
|
*/
|
|
@@ -659,8 +659,8 @@ export default class binance extends binanceRest {
|
|
|
659
659
|
* @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api#query-order-user_data
|
|
660
660
|
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/websocket-api/Query-Order
|
|
661
661
|
* @param {string} id order id
|
|
662
|
-
* @param {string} symbol unified symbol of the market the order was made in
|
|
663
|
-
* @param {object} params extra parameters specific to the exchange API endpoint
|
|
662
|
+
* @param {string} [symbol] unified symbol of the market the order was made in
|
|
663
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
664
664
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
665
665
|
*/
|
|
666
666
|
fetchOrderWs(id: string, symbol?: Str, params?: {}): Promise<Order>;
|
|
@@ -727,8 +727,8 @@ export default class binance extends binanceRest {
|
|
|
727
727
|
* @name binance#watchPositions
|
|
728
728
|
* @description watch all open positions
|
|
729
729
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
730
|
-
* @param since
|
|
731
|
-
* @param limit
|
|
730
|
+
* @param {number} [since] since timestamp
|
|
731
|
+
* @param {number} [limit] limit
|
|
732
732
|
* @param {object} params extra parameters specific to the exchange API endpoint
|
|
733
733
|
* @param {boolean} [params.portfolioMargin] set to true if you would like to watch positions in a portfolio margin account
|
|
734
734
|
* @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/en/latest/manual.html#position-structure}
|