ccxt 4.4.75 → 4.4.78
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 +3 -3
- package/dist/ccxt.browser.min.js +7 -7
- package/dist/cjs/ccxt.js +8 -4
- package/dist/cjs/src/abstract/apex.js +9 -0
- package/dist/cjs/src/apex.js +1949 -0
- package/dist/cjs/src/base/Exchange.js +49 -3
- package/dist/cjs/src/binance.js +44 -220
- package/dist/cjs/src/bitget.js +139 -71
- package/dist/cjs/src/bitmex.js +4 -4
- package/dist/cjs/src/bitrue.js +48 -0
- package/dist/cjs/src/cex.js +1 -1
- package/dist/cjs/src/coinbase.js +32 -3
- package/dist/cjs/src/coincatch.js +68 -0
- package/dist/cjs/src/coinex.js +3 -0
- package/dist/cjs/src/coinlist.js +85 -1
- package/dist/cjs/src/hitbtc.js +3 -0
- package/dist/cjs/src/hyperliquid.js +13 -4
- package/dist/cjs/src/mexc.js +50 -57
- package/dist/cjs/src/okx.js +23 -8
- package/dist/cjs/src/paradex.js +3 -12
- package/dist/cjs/src/phemex.js +2 -1
- package/dist/cjs/src/poloniex.js +1 -1
- package/dist/cjs/src/pro/apex.js +1043 -0
- package/dist/cjs/src/pro/coinbase.js +4 -8
- package/dist/cjs/src/pro/gate.js +27 -2
- package/dist/cjs/src/pro/hollaex.js +2 -2
- package/dist/cjs/src/pro/hyperliquid.js +1 -1
- package/dist/cjs/src/pro/p2b.js +2 -2
- package/dist/cjs/src/pro/tradeogre.js +283 -0
- package/dist/cjs/src/probit.js +1 -0
- package/dist/cjs/src/static_dependencies/zklink/zklink-sdk-web.js +2645 -0
- package/dist/cjs/src/tradeogre.js +2 -1
- package/dist/cjs/src/upbit.js +299 -93
- package/dist/cjs/src/whitebit.js +1 -0
- package/dist/cjs/src/woo.js +3 -1
- package/dist/cjs/src/xt.js +131 -4
- package/js/ccxt.d.ts +11 -5
- package/js/ccxt.js +8 -4
- package/js/src/abstract/apex.d.ts +34 -0
- package/js/src/abstract/myokx.d.ts +4 -0
- package/js/src/abstract/okx.d.ts +4 -0
- package/js/src/abstract/upbit.d.ts +15 -1
- package/js/src/abstract/xt.d.ts +3 -0
- package/js/src/apex.d.ts +333 -0
- package/js/src/apex.js +1951 -0
- package/js/src/ascendex.d.ts +3 -3
- package/js/src/base/Exchange.d.ts +3 -0
- package/js/src/base/Exchange.js +49 -2
- package/js/src/binance.d.ts +9 -7
- package/js/src/binance.js +44 -220
- package/js/src/bitfinex.d.ts +3 -3
- package/js/src/bitflyer.d.ts +2 -2
- package/js/src/bitget.d.ts +2 -0
- package/js/src/bitget.js +139 -71
- package/js/src/bitmart.d.ts +4 -4
- package/js/src/bitmex.d.ts +3 -3
- package/js/src/bitmex.js +4 -4
- package/js/src/bitrue.js +48 -0
- package/js/src/cex.js +1 -1
- package/js/src/coinbase.d.ts +6 -4
- package/js/src/coinbase.js +32 -3
- package/js/src/coinbaseexchange.d.ts +1 -1
- package/js/src/coincatch.d.ts +11 -0
- package/js/src/coincatch.js +68 -0
- package/js/src/coinex.js +3 -0
- package/js/src/coinlist.d.ts +12 -1
- package/js/src/coinlist.js +85 -1
- package/js/src/cryptocom.d.ts +4 -4
- package/js/src/deribit.d.ts +4 -4
- package/js/src/derive.d.ts +3 -3
- package/js/src/digifinex.d.ts +4 -4
- package/js/src/hitbtc.js +3 -0
- package/js/src/htx.d.ts +4 -4
- package/js/src/hyperliquid.d.ts +1 -0
- package/js/src/hyperliquid.js +13 -4
- package/js/src/kraken.d.ts +3 -3
- package/js/src/krakenfutures.d.ts +2 -2
- package/js/src/kucoinfutures.d.ts +5 -5
- package/js/src/mexc.d.ts +1 -0
- package/js/src/mexc.js +50 -57
- package/js/src/okx.js +23 -8
- package/js/src/oxfun.d.ts +3 -3
- package/js/src/paradex.js +3 -12
- package/js/src/phemex.d.ts +3 -3
- package/js/src/phemex.js +2 -1
- package/js/src/poloniex.d.ts +3 -3
- package/js/src/poloniex.js +1 -1
- package/js/src/pro/apex.d.ts +160 -0
- package/js/src/pro/apex.js +1044 -0
- package/js/src/pro/coinbase.js +4 -8
- package/js/src/pro/gate.js +27 -2
- package/js/src/pro/hollaex.js +2 -2
- package/js/src/pro/hyperliquid.js +1 -1
- package/js/src/pro/p2b.js +2 -2
- package/js/src/pro/tradeogre.d.ts +49 -0
- package/js/src/pro/tradeogre.js +284 -0
- package/js/src/probit.js +1 -0
- package/js/src/static_dependencies/zklink/zklink-sdk-web.d.ts +1279 -0
- package/js/src/static_dependencies/zklink/zklink-sdk-web.js +4282 -0
- package/js/src/tradeogre.js +2 -1
- package/js/src/upbit.d.ts +34 -4
- package/js/src/upbit.js +299 -93
- package/js/src/vertex.d.ts +3 -3
- package/js/src/whitebit.js +1 -0
- package/js/src/woo.d.ts +4 -4
- package/js/src/woo.js +3 -1
- package/js/src/woofipro.d.ts +4 -4
- package/js/src/xt.d.ts +23 -4
- package/js/src/xt.js +131 -4
- package/package.json +2 -2
- package/js/src/abstract/ace.d.ts +0 -18
- package/js/src/ace.d.ts +0 -158
- package/js/src/ace.js +0 -1181
- /package/js/src/abstract/{ace.js → apex.js} +0 -0
package/js/src/vertex.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Exchange from './abstract/vertex.js';
|
|
2
|
-
import type { Market, Ticker, Tickers, TradingFees, Balances, Int, OrderBook, OHLCV, Str, Order, OrderType, OrderSide, Trade, Strings, Dict, Num, Currencies, FundingRate, FundingRates, Currency, Transaction, OpenInterests } from './base/types.js';
|
|
2
|
+
import type { Market, Ticker, Tickers, TradingFees, Balances, Int, OrderBook, OHLCV, Str, Order, OrderType, OrderSide, Trade, Strings, Dict, Num, Currencies, FundingRate, FundingRates, Currency, Transaction, OpenInterests, Position } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class vertex
|
|
5
5
|
* @augments Exchange
|
|
@@ -307,7 +307,7 @@ export default class vertex extends Exchange {
|
|
|
307
307
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
308
308
|
*/
|
|
309
309
|
fetchBalance(params?: {}): Promise<Balances>;
|
|
310
|
-
parsePosition(position: any, market?: Market):
|
|
310
|
+
parsePosition(position: any, market?: Market): Position;
|
|
311
311
|
/**
|
|
312
312
|
* @method
|
|
313
313
|
* @name vertex#fetchPositions
|
|
@@ -318,7 +318,7 @@ export default class vertex extends Exchange {
|
|
|
318
318
|
* @param {string} [params.user] user address, will default to this.walletAddress if not provided
|
|
319
319
|
* @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
320
320
|
*/
|
|
321
|
-
fetchPositions(symbols?: Strings, params?: {}): Promise<
|
|
321
|
+
fetchPositions(symbols?: Strings, params?: {}): Promise<Position[]>;
|
|
322
322
|
queryNonces(): Promise<import("./base/types.js").Dictionary<any>>;
|
|
323
323
|
/**
|
|
324
324
|
* @method
|
package/js/src/whitebit.js
CHANGED
package/js/src/woo.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Exchange from './abstract/woo.js';
|
|
2
|
-
import type { TransferEntry, Balances, Conversion, Currency, FundingRateHistory, Int, Market, MarginModification, Num, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Dict, Strings, Trade, Transaction, Leverage, Account, Currencies, TradingFees, int, FundingHistory, LedgerEntry, FundingRate, FundingRates, DepositAddress } from './base/types.js';
|
|
2
|
+
import type { TransferEntry, Balances, Conversion, Currency, FundingRateHistory, Int, Market, MarginModification, Num, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Dict, Strings, Trade, Transaction, Leverage, Account, Currencies, TradingFees, int, FundingHistory, LedgerEntry, FundingRate, FundingRates, DepositAddress, Position } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class woo
|
|
5
5
|
* @augments Exchange
|
|
@@ -628,9 +628,9 @@ export default class woo extends Exchange {
|
|
|
628
628
|
*/
|
|
629
629
|
reduceMargin(symbol: string, amount: number, params?: {}): Promise<MarginModification>;
|
|
630
630
|
modifyMarginHelper(symbol: string, amount: any, type: any, params?: {}): Promise<MarginModification>;
|
|
631
|
-
fetchPosition(symbol: Str, params?: {}): Promise<
|
|
632
|
-
fetchPositions(symbols?: Strings, params?: {}): Promise<
|
|
633
|
-
parsePosition(position: Dict, market?: Market):
|
|
631
|
+
fetchPosition(symbol: Str, params?: {}): Promise<Position>;
|
|
632
|
+
fetchPositions(symbols?: Strings, params?: {}): Promise<Position[]>;
|
|
633
|
+
parsePosition(position: Dict, market?: Market): Position;
|
|
634
634
|
/**
|
|
635
635
|
* @method
|
|
636
636
|
* @name woo#fetchConvertQuote
|
package/js/src/woo.js
CHANGED
|
@@ -574,6 +574,7 @@ export default class woo extends Exchange {
|
|
|
574
574
|
linear = true;
|
|
575
575
|
inverse = false;
|
|
576
576
|
}
|
|
577
|
+
const active = this.safeString(market, 'is_trading') === '1';
|
|
577
578
|
return {
|
|
578
579
|
'id': marketId,
|
|
579
580
|
'symbol': symbol,
|
|
@@ -589,7 +590,7 @@ export default class woo extends Exchange {
|
|
|
589
590
|
'swap': swap,
|
|
590
591
|
'future': false,
|
|
591
592
|
'option': false,
|
|
592
|
-
'active':
|
|
593
|
+
'active': active,
|
|
593
594
|
'contract': contract,
|
|
594
595
|
'linear': linear,
|
|
595
596
|
'inverse': inverse,
|
|
@@ -933,6 +934,7 @@ export default class woo extends Exchange {
|
|
|
933
934
|
'networks': resultingNetworks,
|
|
934
935
|
'deposit': undefined,
|
|
935
936
|
'withdraw': undefined,
|
|
937
|
+
'type': 'crypto',
|
|
936
938
|
'limits': {
|
|
937
939
|
'deposit': {
|
|
938
940
|
'min': undefined,
|
package/js/src/woofipro.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Exchange from './abstract/woofipro.js';
|
|
2
|
-
import type { Balances, Currency, FundingRateHistory, Int, Market, Num, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Trade, Transaction, Leverage, Currencies, TradingFees, OrderRequest, Dict, int, LedgerEntry, FundingRate, FundingRates } from './base/types.js';
|
|
2
|
+
import type { Balances, Currency, FundingRateHistory, Int, Market, Num, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Trade, Transaction, Leverage, Currencies, TradingFees, OrderRequest, Dict, int, LedgerEntry, FundingRate, FundingRates, Position } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class woofipro
|
|
5
5
|
* @augments Exchange
|
|
@@ -443,7 +443,7 @@ export default class woofipro extends Exchange {
|
|
|
443
443
|
* @returns {object} response from the exchange
|
|
444
444
|
*/
|
|
445
445
|
setLeverage(leverage: Int, symbol?: Str, params?: {}): Promise<any>;
|
|
446
|
-
parsePosition(position: Dict, market?: Market):
|
|
446
|
+
parsePosition(position: Dict, market?: Market): Position;
|
|
447
447
|
/**
|
|
448
448
|
* @method
|
|
449
449
|
* @name woofipro#fetchPosition
|
|
@@ -453,7 +453,7 @@ export default class woofipro extends Exchange {
|
|
|
453
453
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
454
454
|
* @returns {object} a [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
455
455
|
*/
|
|
456
|
-
fetchPosition(symbol: Str, params?: {}): Promise<
|
|
456
|
+
fetchPosition(symbol: Str, params?: {}): Promise<Position>;
|
|
457
457
|
/**
|
|
458
458
|
* @method
|
|
459
459
|
* @name woofipro#fetchPositions
|
|
@@ -463,7 +463,7 @@ export default class woofipro extends Exchange {
|
|
|
463
463
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
464
464
|
* @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
465
465
|
*/
|
|
466
|
-
fetchPositions(symbols?: Strings, params?: {}): Promise<
|
|
466
|
+
fetchPositions(symbols?: Strings, params?: {}): Promise<Position[]>;
|
|
467
467
|
nonce(): number;
|
|
468
468
|
sign(path: any, section?: string, method?: string, params?: {}, headers?: any, body?: any): {
|
|
469
469
|
url: string;
|
package/js/src/xt.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Exchange from './abstract/xt.js';
|
|
2
|
-
import { Currencies, Currency, Dict, FundingHistory, FundingRateHistory, Int, LeverageTier, MarginModification, Market, Num, OHLCV, Order, OrderSide, OrderType, Str, Tickers, Transaction, TransferEntry, LedgerEntry, FundingRate, DepositAddress, LeverageTiers } from './base/types.js';
|
|
2
|
+
import { Currencies, Currency, Dict, FundingHistory, FundingRateHistory, Int, LeverageTier, MarginModification, Market, Num, OHLCV, Order, OrderSide, OrderType, Str, Tickers, Transaction, TransferEntry, LedgerEntry, FundingRate, DepositAddress, LeverageTiers, Position } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class xt
|
|
5
5
|
* @augments Exchange
|
|
@@ -491,7 +491,7 @@ export default class xt extends Exchange {
|
|
|
491
491
|
* @param {object} params extra parameters specific to the xt api endpoint
|
|
492
492
|
* @returns {object} a [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
493
493
|
*/
|
|
494
|
-
fetchPosition(symbol: string, params?: {}): Promise<
|
|
494
|
+
fetchPosition(symbol: string, params?: {}): Promise<Position>;
|
|
495
495
|
/**
|
|
496
496
|
* @method
|
|
497
497
|
* @name xt#fetchPositions
|
|
@@ -501,8 +501,8 @@ export default class xt extends Exchange {
|
|
|
501
501
|
* @param {object} params extra parameters specific to the xt api endpoint
|
|
502
502
|
* @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
503
503
|
*/
|
|
504
|
-
fetchPositions(symbols?: string[], params?: {}): Promise<
|
|
505
|
-
parsePosition(position: any, market?: any):
|
|
504
|
+
fetchPositions(symbols?: string[], params?: {}): Promise<Position[]>;
|
|
505
|
+
parsePosition(position: any, market?: any): Position;
|
|
506
506
|
/**
|
|
507
507
|
* @method
|
|
508
508
|
* @name xt#transfer
|
|
@@ -539,6 +539,25 @@ export default class xt extends Exchange {
|
|
|
539
539
|
* @returns {object} response from the exchange
|
|
540
540
|
*/
|
|
541
541
|
setMarginMode(marginMode: string, symbol?: Str, params?: {}): Promise<any>;
|
|
542
|
+
/**
|
|
543
|
+
* @method
|
|
544
|
+
* @name xt#editOrder
|
|
545
|
+
* @description cancels an order and places a new order
|
|
546
|
+
* @see https://doc.xt.com/#orderorderUpdate
|
|
547
|
+
* @see https://doc.xt.com/#futures_orderupdate
|
|
548
|
+
* @see https://doc.xt.com/#futures_entrustupdateProfit
|
|
549
|
+
* @param {string} id order id
|
|
550
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
551
|
+
* @param {string} type 'market' or 'limit'
|
|
552
|
+
* @param {string} side 'buy' or 'sell'
|
|
553
|
+
* @param {float} amount how much of the currency you want to trade in units of the base currency
|
|
554
|
+
* @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
|
555
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
556
|
+
* @param {float} [params.stopLoss] price to set a stop-loss on an open position
|
|
557
|
+
* @param {float} [params.takeProfit] price to set a take-profit on an open position
|
|
558
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
559
|
+
*/
|
|
560
|
+
editOrder(id: string, symbol: string, type: OrderType, side: OrderSide, amount?: Num, price?: Num, params?: {}): Promise<Order>;
|
|
542
561
|
handleErrors(code: any, reason: any, url: any, method: any, headers: any, body: any, response: any, requestHeaders: any, requestBody: any): any;
|
|
543
562
|
sign(path: any, api?: any[], method?: string, params?: {}, headers?: any, body?: any): {
|
|
544
563
|
url: any;
|
package/js/src/xt.js
CHANGED
|
@@ -47,7 +47,7 @@ export default class xt extends Exchange {
|
|
|
47
47
|
'createOrder': true,
|
|
48
48
|
'createPostOnlyOrder': false,
|
|
49
49
|
'createReduceOnlyOrder': true,
|
|
50
|
-
'editOrder':
|
|
50
|
+
'editOrder': true,
|
|
51
51
|
'fetchAccounts': false,
|
|
52
52
|
'fetchBalance': true,
|
|
53
53
|
'fetchBidsAsks': true,
|
|
@@ -234,6 +234,9 @@ export default class xt extends Exchange {
|
|
|
234
234
|
'open-order': 1,
|
|
235
235
|
'order/{orderId}': 1,
|
|
236
236
|
},
|
|
237
|
+
'put': {
|
|
238
|
+
'order/{orderId}': 1,
|
|
239
|
+
},
|
|
237
240
|
},
|
|
238
241
|
'linear': {
|
|
239
242
|
'get': {
|
|
@@ -268,6 +271,7 @@ export default class xt extends Exchange {
|
|
|
268
271
|
'future/trade/v1/order/cancel-all': 1,
|
|
269
272
|
'future/trade/v1/order/create': 1,
|
|
270
273
|
'future/trade/v1/order/create-batch': 1,
|
|
274
|
+
'future/trade/v1/order/update': 1,
|
|
271
275
|
'future/user/v1/account/open': 1,
|
|
272
276
|
'future/user/v1/position/adjust-leverage': 1,
|
|
273
277
|
'future/user/v1/position/auto-margin': 1,
|
|
@@ -311,6 +315,7 @@ export default class xt extends Exchange {
|
|
|
311
315
|
'future/trade/v1/order/cancel-all': 1,
|
|
312
316
|
'future/trade/v1/order/create': 1,
|
|
313
317
|
'future/trade/v1/order/create-batch': 1,
|
|
318
|
+
'future/trade/v1/order/update': 1,
|
|
314
319
|
'future/user/v1/account/open': 1,
|
|
315
320
|
'future/user/v1/position/adjust-leverage': 1,
|
|
316
321
|
'future/user/v1/position/auto-margin': 1,
|
|
@@ -948,6 +953,14 @@ export default class xt extends Exchange {
|
|
|
948
953
|
},
|
|
949
954
|
};
|
|
950
955
|
}
|
|
956
|
+
const typeRaw = this.safeString(entry, 'type');
|
|
957
|
+
let type = undefined;
|
|
958
|
+
if (typeRaw === 'FT') {
|
|
959
|
+
type = 'crypto';
|
|
960
|
+
}
|
|
961
|
+
else {
|
|
962
|
+
type = 'other';
|
|
963
|
+
}
|
|
951
964
|
result[code] = {
|
|
952
965
|
'info': entry,
|
|
953
966
|
'id': currencyId,
|
|
@@ -959,6 +972,7 @@ export default class xt extends Exchange {
|
|
|
959
972
|
'deposit': deposit,
|
|
960
973
|
'withdraw': withdraw,
|
|
961
974
|
'networks': networks,
|
|
975
|
+
'type': type,
|
|
962
976
|
'limits': {
|
|
963
977
|
'amount': {
|
|
964
978
|
'min': undefined,
|
|
@@ -3512,7 +3526,7 @@ export default class xt extends Exchange {
|
|
|
3512
3526
|
// "cancelId": "208322474307982720"
|
|
3513
3527
|
// }
|
|
3514
3528
|
//
|
|
3515
|
-
// swap and future: createOrder, cancelOrder
|
|
3529
|
+
// swap and future: createOrder, cancelOrder, editOrder
|
|
3516
3530
|
//
|
|
3517
3531
|
// {
|
|
3518
3532
|
// "returnCode": 0,
|
|
@@ -3617,6 +3631,14 @@ export default class xt extends Exchange {
|
|
|
3617
3631
|
// "createdTime": 1681273420039
|
|
3618
3632
|
// }
|
|
3619
3633
|
//
|
|
3634
|
+
// spot editOrder
|
|
3635
|
+
//
|
|
3636
|
+
// {
|
|
3637
|
+
// "orderId": "484203027161892224",
|
|
3638
|
+
// "modifyId": "484203544105344000",
|
|
3639
|
+
// "clientModifyId": null
|
|
3640
|
+
// }
|
|
3641
|
+
//
|
|
3620
3642
|
const marketId = this.safeString(order, 'symbol');
|
|
3621
3643
|
const marketType = ('result' in order) || ('positionSide' in order) ? 'contract' : 'spot';
|
|
3622
3644
|
market = this.safeMarket(marketId, market, undefined, marketType);
|
|
@@ -3630,7 +3652,7 @@ export default class xt extends Exchange {
|
|
|
3630
3652
|
return this.safeOrder({
|
|
3631
3653
|
'info': order,
|
|
3632
3654
|
'id': this.safeStringN(order, ['orderId', 'result', 'cancelId', 'entrustId', 'profitId']),
|
|
3633
|
-
'clientOrderId': this.
|
|
3655
|
+
'clientOrderId': this.safeString2(order, 'clientOrderId', 'clientModifyId'),
|
|
3634
3656
|
'timestamp': timestamp,
|
|
3635
3657
|
'datetime': this.iso8601(timestamp),
|
|
3636
3658
|
'lastTradeTimestamp': lastUpdatedTimestamp,
|
|
@@ -4911,6 +4933,108 @@ export default class xt extends Exchange {
|
|
|
4911
4933
|
//
|
|
4912
4934
|
return response; // unify return type
|
|
4913
4935
|
}
|
|
4936
|
+
/**
|
|
4937
|
+
* @method
|
|
4938
|
+
* @name xt#editOrder
|
|
4939
|
+
* @description cancels an order and places a new order
|
|
4940
|
+
* @see https://doc.xt.com/#orderorderUpdate
|
|
4941
|
+
* @see https://doc.xt.com/#futures_orderupdate
|
|
4942
|
+
* @see https://doc.xt.com/#futures_entrustupdateProfit
|
|
4943
|
+
* @param {string} id order id
|
|
4944
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
4945
|
+
* @param {string} type 'market' or 'limit'
|
|
4946
|
+
* @param {string} side 'buy' or 'sell'
|
|
4947
|
+
* @param {float} amount how much of the currency you want to trade in units of the base currency
|
|
4948
|
+
* @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
|
4949
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4950
|
+
* @param {float} [params.stopLoss] price to set a stop-loss on an open position
|
|
4951
|
+
* @param {float} [params.takeProfit] price to set a take-profit on an open position
|
|
4952
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4953
|
+
*/
|
|
4954
|
+
async editOrder(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
|
|
4955
|
+
if (amount === undefined) {
|
|
4956
|
+
throw new ArgumentsRequired(this.id + ' editOrder() requires an amount argument');
|
|
4957
|
+
}
|
|
4958
|
+
await this.loadMarkets();
|
|
4959
|
+
const market = this.market(symbol);
|
|
4960
|
+
const request = {};
|
|
4961
|
+
const stopLoss = this.safeNumber2(params, 'stopLoss', 'triggerStopPrice');
|
|
4962
|
+
const takeProfit = this.safeNumber2(params, 'takeProfit', 'triggerProfitPrice');
|
|
4963
|
+
params = this.omit(params, ['stopLoss', 'takeProfit']);
|
|
4964
|
+
const isStopLoss = (stopLoss !== undefined);
|
|
4965
|
+
const isTakeProfit = (takeProfit !== undefined);
|
|
4966
|
+
if (isStopLoss || isTakeProfit) {
|
|
4967
|
+
request['profitId'] = id;
|
|
4968
|
+
}
|
|
4969
|
+
else {
|
|
4970
|
+
request['orderId'] = id;
|
|
4971
|
+
request['price'] = this.priceToPrecision(symbol, price);
|
|
4972
|
+
}
|
|
4973
|
+
let response = undefined;
|
|
4974
|
+
if (market['swap']) {
|
|
4975
|
+
if (isStopLoss) {
|
|
4976
|
+
request['triggerStopPrice'] = this.priceToPrecision(symbol, stopLoss);
|
|
4977
|
+
}
|
|
4978
|
+
else if (takeProfit !== undefined) {
|
|
4979
|
+
request['triggerProfitPrice'] = this.priceToPrecision(symbol, takeProfit);
|
|
4980
|
+
}
|
|
4981
|
+
else {
|
|
4982
|
+
request['origQty'] = this.amountToPrecision(symbol, amount);
|
|
4983
|
+
}
|
|
4984
|
+
let subType = undefined;
|
|
4985
|
+
[subType, params] = this.handleSubTypeAndParams('editOrder', market, params);
|
|
4986
|
+
if (subType === 'inverse') {
|
|
4987
|
+
if (isStopLoss || isTakeProfit) {
|
|
4988
|
+
response = await this.privateInversePostFutureTradeV1EntrustUpdateProfitStop(this.extend(request, params));
|
|
4989
|
+
}
|
|
4990
|
+
else {
|
|
4991
|
+
response = await this.privateInversePostFutureTradeV1OrderUpdate(this.extend(request, params));
|
|
4992
|
+
//
|
|
4993
|
+
// {
|
|
4994
|
+
// "returnCode": 0,
|
|
4995
|
+
// "msgInfo": "success",
|
|
4996
|
+
// "error": null,
|
|
4997
|
+
// "result": "483869474947826752"
|
|
4998
|
+
// }
|
|
4999
|
+
//
|
|
5000
|
+
}
|
|
5001
|
+
}
|
|
5002
|
+
else {
|
|
5003
|
+
if (isStopLoss || isTakeProfit) {
|
|
5004
|
+
response = await this.privateLinearPostFutureTradeV1EntrustUpdateProfitStop(this.extend(request, params));
|
|
5005
|
+
}
|
|
5006
|
+
else {
|
|
5007
|
+
response = await this.privateLinearPostFutureTradeV1OrderUpdate(this.extend(request, params));
|
|
5008
|
+
//
|
|
5009
|
+
// {
|
|
5010
|
+
// "returnCode": 0,
|
|
5011
|
+
// "msgInfo": "success",
|
|
5012
|
+
// "error": null,
|
|
5013
|
+
// "result": "483869474947826752"
|
|
5014
|
+
// }
|
|
5015
|
+
//
|
|
5016
|
+
}
|
|
5017
|
+
}
|
|
5018
|
+
}
|
|
5019
|
+
else {
|
|
5020
|
+
request['quantity'] = this.amountToPrecision(symbol, amount);
|
|
5021
|
+
response = await this.privateSpotPutOrderOrderId(this.extend(request, params));
|
|
5022
|
+
//
|
|
5023
|
+
// {
|
|
5024
|
+
// "rc": 0,
|
|
5025
|
+
// "mc": "SUCCESS",
|
|
5026
|
+
// "ma": [],
|
|
5027
|
+
// "result": {
|
|
5028
|
+
// "orderId": "484203027161892224",
|
|
5029
|
+
// "modifyId": "484203544105344000",
|
|
5030
|
+
// "clientModifyId": null
|
|
5031
|
+
// }
|
|
5032
|
+
// }
|
|
5033
|
+
//
|
|
5034
|
+
}
|
|
5035
|
+
const result = (market['swap']) ? response : this.safeDict(response, 'result', {});
|
|
5036
|
+
return this.parseOrder(result, market);
|
|
5037
|
+
}
|
|
4914
5038
|
handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
|
|
4915
5039
|
//
|
|
4916
5040
|
// spot: error
|
|
@@ -5015,7 +5139,10 @@ export default class xt extends Exchange {
|
|
|
5015
5139
|
body['media'] = id;
|
|
5016
5140
|
}
|
|
5017
5141
|
}
|
|
5018
|
-
|
|
5142
|
+
let isUndefinedBody = ((method === 'GET') || (path === 'order/{orderId}') || (path === 'ws-token'));
|
|
5143
|
+
if ((method === 'PUT') && (endpoint === 'spot')) {
|
|
5144
|
+
isUndefinedBody = false;
|
|
5145
|
+
}
|
|
5019
5146
|
body = isUndefinedBody ? undefined : this.json(body);
|
|
5020
5147
|
let payloadString = undefined;
|
|
5021
5148
|
if ((endpoint === 'spot') || (endpoint === 'user')) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ccxt",
|
|
3
|
-
"version": "4.4.
|
|
3
|
+
"version": "4.4.78",
|
|
4
4
|
"description": "A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 100+ exchanges",
|
|
5
5
|
"unpkg": "dist/ccxt.browser.min.js",
|
|
6
6
|
"type": "module",
|
|
@@ -199,7 +199,7 @@
|
|
|
199
199
|
"as-table": "^1.0.55",
|
|
200
200
|
"asciichart": "^1.5.25",
|
|
201
201
|
"assert": "^2.0.0",
|
|
202
|
-
"ast-transpiler": "^0.0.
|
|
202
|
+
"ast-transpiler": "^0.0.66",
|
|
203
203
|
"docsify": "^4.11.4",
|
|
204
204
|
"eslint": "8.22.0",
|
|
205
205
|
"eslint-config-airbnb-base": "15.0.0",
|
package/js/src/abstract/ace.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { implicitReturnType } from '../base/types.js';
|
|
2
|
-
import { Exchange as _Exchange } from '../base/Exchange.js';
|
|
3
|
-
interface Exchange {
|
|
4
|
-
publicGetOapiV2ListTradePrice(params?: {}): Promise<implicitReturnType>;
|
|
5
|
-
publicGetOapiV2ListMarketPair(params?: {}): Promise<implicitReturnType>;
|
|
6
|
-
publicGetOpenV2PublicGetOrderBook(params?: {}): Promise<implicitReturnType>;
|
|
7
|
-
privatePostV2CoinCustomerAccount(params?: {}): Promise<implicitReturnType>;
|
|
8
|
-
privatePostV2KlineGetKline(params?: {}): Promise<implicitReturnType>;
|
|
9
|
-
privatePostV2OrderOrder(params?: {}): Promise<implicitReturnType>;
|
|
10
|
-
privatePostV2OrderCancel(params?: {}): Promise<implicitReturnType>;
|
|
11
|
-
privatePostV2OrderGetOrderList(params?: {}): Promise<implicitReturnType>;
|
|
12
|
-
privatePostV2OrderShowOrderStatus(params?: {}): Promise<implicitReturnType>;
|
|
13
|
-
privatePostV2OrderShowOrderHistory(params?: {}): Promise<implicitReturnType>;
|
|
14
|
-
privatePostV2OrderGetTradeList(params?: {}): Promise<implicitReturnType>;
|
|
15
|
-
}
|
|
16
|
-
declare abstract class Exchange extends _Exchange {
|
|
17
|
-
}
|
|
18
|
-
export default Exchange;
|
package/js/src/ace.d.ts
DELETED
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
import Exchange from './abstract/ace.js';
|
|
2
|
-
import type { Balances, Dict, Int, Market, Num, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, int } from './base/types.js';
|
|
3
|
-
/**
|
|
4
|
-
* @class ace
|
|
5
|
-
* @augments Exchange
|
|
6
|
-
*/
|
|
7
|
-
export default class ace extends Exchange {
|
|
8
|
-
describe(): any;
|
|
9
|
-
/**
|
|
10
|
-
* @method
|
|
11
|
-
* @name ace#fetchMarkets
|
|
12
|
-
* @description retrieves data on all markets for ace
|
|
13
|
-
* @see https://github.com/ace-exchange/ace-official-api-docs/blob/master/api_v2.md#oapi-api---market-pair
|
|
14
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
15
|
-
* @returns {object[]} an array of objects representing market data
|
|
16
|
-
*/
|
|
17
|
-
fetchMarkets(params?: {}): Promise<Market[]>;
|
|
18
|
-
parseMarket(market: Dict): Market;
|
|
19
|
-
parseTicker(ticker: Dict, market?: Market): Ticker;
|
|
20
|
-
/**
|
|
21
|
-
* @method
|
|
22
|
-
* @name ace#fetchTicker
|
|
23
|
-
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
24
|
-
* @see https://github.com/ace-exchange/ace-official-api-docs/blob/master/api_v2.md#oapi-api---trade-data
|
|
25
|
-
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
26
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
27
|
-
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
28
|
-
*/
|
|
29
|
-
fetchTicker(symbol: string, params?: {}): Promise<Ticker>;
|
|
30
|
-
/**
|
|
31
|
-
* @method
|
|
32
|
-
* @name ace#fetchTickers
|
|
33
|
-
* @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
|
34
|
-
* @see https://github.com/ace-exchange/ace-official-api-docs/blob/master/api_v2.md#oapi-api---trade-data
|
|
35
|
-
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
36
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
37
|
-
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
38
|
-
*/
|
|
39
|
-
fetchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
|
|
40
|
-
/**
|
|
41
|
-
* @method
|
|
42
|
-
* @name ace#fetchOrderBook
|
|
43
|
-
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
44
|
-
* @see https://github.com/ace-exchange/ace-official-api-docs/blob/master/api_v2.md#open-api---order-books
|
|
45
|
-
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
46
|
-
* @param {int} [limit] the maximum amount of order book entries to return
|
|
47
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
48
|
-
* @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
|
|
49
|
-
*/
|
|
50
|
-
fetchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
|
|
51
|
-
parseOHLCV(ohlcv: any, market?: Market): OHLCV;
|
|
52
|
-
/**
|
|
53
|
-
* @method
|
|
54
|
-
* @name ace#fetchOHLCV
|
|
55
|
-
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
56
|
-
* @see https://github.com/ace-exchange/ace-official-api-docs/blob/master/api_v2.md#open-api---klinecandlestick-data
|
|
57
|
-
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
58
|
-
* @param {string} timeframe the length of time each candle represents
|
|
59
|
-
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
60
|
-
* @param {int} [limit] the maximum amount of candles to fetch
|
|
61
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
62
|
-
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
63
|
-
*/
|
|
64
|
-
fetchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>;
|
|
65
|
-
parseOrderStatus(status: Str): string;
|
|
66
|
-
parseOrder(order: Dict, market?: Market): Order;
|
|
67
|
-
/**
|
|
68
|
-
* @method
|
|
69
|
-
* @name ace#createOrder
|
|
70
|
-
* @description create a trade order
|
|
71
|
-
* @see https://github.com/ace-exchange/ace-official-api-docs/blob/master/api_v2.md#open-api---new-order
|
|
72
|
-
* @param {string} symbol unified symbol of the market to create an order in
|
|
73
|
-
* @param {string} type 'market' or 'limit'
|
|
74
|
-
* @param {string} side 'buy' or 'sell'
|
|
75
|
-
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
76
|
-
* @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
|
77
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
78
|
-
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
79
|
-
*/
|
|
80
|
-
createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
|
|
81
|
-
/**
|
|
82
|
-
* @method
|
|
83
|
-
* @name ace#cancelOrder
|
|
84
|
-
* @description cancels an open order
|
|
85
|
-
* @see https://github.com/ace-exchange/ace-official-api-docs/blob/master/api_v2.md#open-api---cancel-order
|
|
86
|
-
* @param {string} id order id
|
|
87
|
-
* @param {string} symbol unified symbol of the market the order was made in
|
|
88
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
89
|
-
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
90
|
-
*/
|
|
91
|
-
cancelOrder(id: string, symbol?: Str, params?: {}): Promise<any>;
|
|
92
|
-
/**
|
|
93
|
-
* @method
|
|
94
|
-
* @name ace#fetchOrder
|
|
95
|
-
* @description fetches information on an order made by the user
|
|
96
|
-
* @see https://github.com/ace-exchange/ace-official-api-docs/blob/master/api_v2.md#open-api---order-status
|
|
97
|
-
* @param {string} id the order id
|
|
98
|
-
* @param {string} symbol unified symbol of the market the order was made in
|
|
99
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
100
|
-
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
101
|
-
*/
|
|
102
|
-
fetchOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
|
|
103
|
-
/**
|
|
104
|
-
* @method
|
|
105
|
-
* @name ace#fetchOpenOrders
|
|
106
|
-
* @description fetch all unfilled currently open orders
|
|
107
|
-
* @see https://github.com/ace-exchange/ace-official-api-docs/blob/master/api_v2.md#open-api---order-list
|
|
108
|
-
* @param {string} symbol unified market symbol of the market orders were made in
|
|
109
|
-
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
110
|
-
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
111
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
112
|
-
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
113
|
-
*/
|
|
114
|
-
fetchOpenOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
115
|
-
parseTrade(trade: Dict, market?: Market): Trade;
|
|
116
|
-
/**
|
|
117
|
-
* @method
|
|
118
|
-
* @name ace#fetchOrderTrades
|
|
119
|
-
* @description fetch all the trades made from a single order
|
|
120
|
-
* @see https://github.com/ace-exchange/ace-official-api-docs/blob/master/api_v2.md#open-api---order-history
|
|
121
|
-
* @param {string} id order id
|
|
122
|
-
* @param {string} symbol unified market symbol
|
|
123
|
-
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
124
|
-
* @param {int} [limit] the maximum number of trades to retrieve
|
|
125
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
126
|
-
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
|
|
127
|
-
*/
|
|
128
|
-
fetchOrderTrades(id: string, symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
129
|
-
/**
|
|
130
|
-
* @method
|
|
131
|
-
* @name ace#fetchMyTrades
|
|
132
|
-
* @description fetch all trades made by the user
|
|
133
|
-
* @see https://github.com/ace-exchange/ace-official-api-docs/blob/master/api_v2.md#open-api---trade-list
|
|
134
|
-
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
135
|
-
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
136
|
-
* @param {int} [limit] the maximum amount of trades to fetch
|
|
137
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
138
|
-
* @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
139
|
-
*/
|
|
140
|
-
fetchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
141
|
-
parseBalance(response: any): Balances;
|
|
142
|
-
/**
|
|
143
|
-
* @method
|
|
144
|
-
* @name ace#fetchBalance
|
|
145
|
-
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
146
|
-
* @see https://github.com/ace-exchange/ace-official-api-docs/blob/master/api_v2.md#open-api---account-balance
|
|
147
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
148
|
-
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
149
|
-
*/
|
|
150
|
-
fetchBalance(params?: {}): Promise<Balances>;
|
|
151
|
-
sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
|
|
152
|
-
url: string;
|
|
153
|
-
method: string;
|
|
154
|
-
body: any;
|
|
155
|
-
headers: any;
|
|
156
|
-
};
|
|
157
|
-
handleErrors(code: int, reason: string, url: string, method: string, headers: Dict, body: string, response: any, requestHeaders: any, requestBody: any): any;
|
|
158
|
-
}
|