ccxt 4.1.98 → 4.1.99
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.js +438 -176
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +29 -0
- package/dist/cjs/src/binance.js +84 -59
- package/dist/cjs/src/bingx.js +24 -7
- package/dist/cjs/src/bitget.js +95 -38
- package/dist/cjs/src/bitmart.js +71 -17
- package/dist/cjs/src/bitvavo.js +52 -14
- package/dist/cjs/src/coinex.js +58 -21
- package/dist/cjs/src/kraken.js +21 -16
- package/dist/cjs/src/pro/binance.js +1 -1
- package/dist/cjs/src/pro/bitget.js +1 -1
- package/dist/cjs/src/pro/bybit.js +1 -1
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/binance.d.ts +16 -0
- package/js/src/abstract/binancecoinm.d.ts +16 -0
- package/js/src/abstract/binanceus.d.ts +16 -0
- package/js/src/abstract/binanceusdm.d.ts +16 -0
- package/js/src/abstract/coinex.d.ts +14 -1
- package/js/src/base/Exchange.d.ts +4 -0
- package/js/src/base/Exchange.js +29 -0
- package/js/src/binance.js +84 -59
- package/js/src/bingx.js +24 -7
- package/js/src/bitget.js +95 -38
- package/js/src/bitmart.js +71 -17
- package/js/src/bitvavo.js +52 -14
- package/js/src/coinex.js +58 -21
- package/js/src/kraken.js +21 -16
- package/js/src/pro/binance.js +1 -1
- package/js/src/pro/bitget.js +1 -1
- package/js/src/pro/bybit.js +1 -1
- package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +1 -1
- package/package.json +1 -1
package/js/src/coinex.js
CHANGED
|
@@ -211,6 +211,8 @@ export default class coinex extends Exchange {
|
|
|
211
211
|
},
|
|
212
212
|
'put': {
|
|
213
213
|
'balance/deposit/address/{coin_type}': 40,
|
|
214
|
+
'sub_account/unfrozen': 40,
|
|
215
|
+
'sub_account/frozen': 40,
|
|
214
216
|
'sub_account/auth/api/{user_auth_id}': 40,
|
|
215
217
|
'v1/account/settings': 40,
|
|
216
218
|
},
|
|
@@ -220,7 +222,10 @@ export default class coinex extends Exchange {
|
|
|
220
222
|
'order/pending': 13.334,
|
|
221
223
|
'order/stop/pending': 40,
|
|
222
224
|
'order/stop/pending/{id}': 13.334,
|
|
225
|
+
'order/pending/by_client_id': 40,
|
|
226
|
+
'order/stop/pending/by_client_id': 40,
|
|
223
227
|
'sub_account/auth/api/{user_auth_id}': 40,
|
|
228
|
+
'sub_account/authorize/{id}': 40,
|
|
224
229
|
},
|
|
225
230
|
},
|
|
226
231
|
'perpetualPublic': {
|
|
@@ -234,12 +239,12 @@ export default class coinex extends Exchange {
|
|
|
234
239
|
'market/depth': 1,
|
|
235
240
|
'market/deals': 1,
|
|
236
241
|
'market/funding_history': 1,
|
|
237
|
-
'market/user_deals': 1,
|
|
238
242
|
'market/kline': 1,
|
|
239
243
|
},
|
|
240
244
|
},
|
|
241
245
|
'perpetualPrivate': {
|
|
242
246
|
'get': {
|
|
247
|
+
'market/user_deals': 1,
|
|
243
248
|
'asset/query': 40,
|
|
244
249
|
'order/pending': 8,
|
|
245
250
|
'order/finished': 40,
|
|
@@ -247,8 +252,13 @@ export default class coinex extends Exchange {
|
|
|
247
252
|
'order/stop_pending': 8,
|
|
248
253
|
'order/status': 8,
|
|
249
254
|
'order/stop_status': 8,
|
|
255
|
+
'position/finished': 40,
|
|
250
256
|
'position/pending': 40,
|
|
251
257
|
'position/funding': 40,
|
|
258
|
+
'position/adl_history': 40,
|
|
259
|
+
'market/preference': 40,
|
|
260
|
+
'position/margin_history': 40,
|
|
261
|
+
'position/settle_history': 40,
|
|
252
262
|
},
|
|
253
263
|
'post': {
|
|
254
264
|
'market/adjust_leverage': 1,
|
|
@@ -270,6 +280,9 @@ export default class coinex extends Exchange {
|
|
|
270
280
|
'position/stop_loss': 20,
|
|
271
281
|
'position/take_profit': 20,
|
|
272
282
|
'position/market_close': 20,
|
|
283
|
+
'order/cancel/by_client_id': 20,
|
|
284
|
+
'order/cancel_stop/by_client_id': 20,
|
|
285
|
+
'market/preference': 20,
|
|
273
286
|
},
|
|
274
287
|
},
|
|
275
288
|
},
|
|
@@ -1090,9 +1103,10 @@ export default class coinex extends Exchange {
|
|
|
1090
1103
|
const priceString = this.safeString(trade, 'price');
|
|
1091
1104
|
const amountString = this.safeString(trade, 'amount');
|
|
1092
1105
|
const marketId = this.safeString(trade, 'market');
|
|
1093
|
-
const
|
|
1106
|
+
const marketType = this.safeString(trade, 'market_type');
|
|
1107
|
+
const defaultType = (marketType === undefined) ? 'spot' : 'swap';
|
|
1094
1108
|
market = this.safeMarket(marketId, market, undefined, defaultType);
|
|
1095
|
-
const symbol =
|
|
1109
|
+
const symbol = market['symbol'];
|
|
1096
1110
|
const costString = this.safeString(trade, 'deal_money');
|
|
1097
1111
|
let fee = undefined;
|
|
1098
1112
|
const feeCostString = this.safeString2(trade, 'fee', 'deal_fee');
|
|
@@ -2590,11 +2604,17 @@ export default class coinex extends Exchange {
|
|
|
2590
2604
|
* @description cancels an open order
|
|
2591
2605
|
* @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade018_cancle_stop_pending_order
|
|
2592
2606
|
* @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade015_cancel_order
|
|
2607
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade024_cancel_order_by_client_id
|
|
2608
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade025_cancel_stop_order_by_client_id
|
|
2593
2609
|
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http023_cancel_stop_order
|
|
2594
2610
|
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http021_cancel_order
|
|
2611
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http042_cancel_order_by_client_id
|
|
2612
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http043_cancel_stop_order_by_client_id
|
|
2595
2613
|
* @param {string} id order id
|
|
2596
2614
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
2597
2615
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2616
|
+
* @param {string} [params.clientOrderId] client order id, defaults to id if not passed
|
|
2617
|
+
* @param {boolean} [params.stop] if stop order = true, default = false
|
|
2598
2618
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
2599
2619
|
*/
|
|
2600
2620
|
if (symbol === undefined) {
|
|
@@ -2607,32 +2627,54 @@ export default class coinex extends Exchange {
|
|
|
2607
2627
|
const request = {
|
|
2608
2628
|
'market': market['id'],
|
|
2609
2629
|
};
|
|
2610
|
-
const idRequest = swap ? 'order_id' : 'id';
|
|
2611
|
-
request[idRequest] = id;
|
|
2612
2630
|
const accountId = this.safeInteger(params, 'account_id');
|
|
2613
2631
|
const defaultType = this.safeString(this.options, 'defaultType');
|
|
2632
|
+
const clientOrderId = this.safeString2(params, 'client_id', 'clientOrderId');
|
|
2614
2633
|
if (defaultType === 'margin') {
|
|
2615
2634
|
if (accountId === undefined) {
|
|
2616
2635
|
throw new BadRequest(this.id + ' cancelOrder() requires an account_id parameter for margin orders');
|
|
2617
2636
|
}
|
|
2618
2637
|
request['account_id'] = accountId;
|
|
2619
2638
|
}
|
|
2620
|
-
const query = this.omit(params, ['stop', 'account_id']);
|
|
2639
|
+
const query = this.omit(params, ['stop', 'account_id', 'clientOrderId']);
|
|
2621
2640
|
let response = undefined;
|
|
2622
|
-
if (
|
|
2623
|
-
|
|
2624
|
-
|
|
2641
|
+
if (clientOrderId !== undefined) {
|
|
2642
|
+
request['client_id'] = clientOrderId;
|
|
2643
|
+
if (stop) {
|
|
2644
|
+
if (swap) {
|
|
2645
|
+
response = await this.perpetualPrivatePostOrderCancelStopByClientId(this.extend(request, query));
|
|
2646
|
+
}
|
|
2647
|
+
else {
|
|
2648
|
+
response = await this.privateDeleteOrderStopPendingByClientId(this.extend(request, query));
|
|
2649
|
+
}
|
|
2625
2650
|
}
|
|
2626
2651
|
else {
|
|
2627
|
-
|
|
2652
|
+
if (swap) {
|
|
2653
|
+
response = await this.perpetualPrivatePostOrderCancelByClientId(this.extend(request, query));
|
|
2654
|
+
}
|
|
2655
|
+
else {
|
|
2656
|
+
response = await this.privateDeleteOrderPendingByClientId(this.extend(request, query));
|
|
2657
|
+
}
|
|
2628
2658
|
}
|
|
2629
2659
|
}
|
|
2630
2660
|
else {
|
|
2631
|
-
|
|
2632
|
-
|
|
2661
|
+
const idRequest = swap ? 'order_id' : 'id';
|
|
2662
|
+
request[idRequest] = id;
|
|
2663
|
+
if (stop) {
|
|
2664
|
+
if (swap) {
|
|
2665
|
+
response = await this.perpetualPrivatePostOrderCancelStop(this.extend(request, query));
|
|
2666
|
+
}
|
|
2667
|
+
else {
|
|
2668
|
+
response = await this.privateDeleteOrderStopPendingId(this.extend(request, query));
|
|
2669
|
+
}
|
|
2633
2670
|
}
|
|
2634
2671
|
else {
|
|
2635
|
-
|
|
2672
|
+
if (swap) {
|
|
2673
|
+
response = await this.perpetualPrivatePostOrderCancel(this.extend(request, query));
|
|
2674
|
+
}
|
|
2675
|
+
else {
|
|
2676
|
+
response = await this.privateDeleteOrderPending(this.extend(request, query));
|
|
2677
|
+
}
|
|
2636
2678
|
}
|
|
2637
2679
|
}
|
|
2638
2680
|
//
|
|
@@ -3374,16 +3416,11 @@ export default class coinex extends Exchange {
|
|
|
3374
3416
|
}
|
|
3375
3417
|
let response = undefined;
|
|
3376
3418
|
if (swap) {
|
|
3377
|
-
const side = this.safeInteger(params, 'side');
|
|
3378
|
-
if (side === undefined) {
|
|
3379
|
-
throw new ArgumentsRequired(this.id + ' fetchMyTrades() requires a side parameter for swap markets');
|
|
3380
|
-
}
|
|
3381
3419
|
if (since !== undefined) {
|
|
3382
3420
|
request['start_time'] = since;
|
|
3383
3421
|
}
|
|
3384
|
-
request['side'] =
|
|
3385
|
-
|
|
3386
|
-
response = await this.perpetualPublicGetMarketUserDeals(this.extend(request, params));
|
|
3422
|
+
request['side'] = 0;
|
|
3423
|
+
response = await this.perpetualPrivateGetMarketUserDeals(this.extend(request, params));
|
|
3387
3424
|
}
|
|
3388
3425
|
else {
|
|
3389
3426
|
request['page'] = 1;
|
|
@@ -5312,7 +5349,7 @@ export default class coinex extends Exchange {
|
|
|
5312
5349
|
}
|
|
5313
5350
|
}
|
|
5314
5351
|
}
|
|
5315
|
-
if (api === 'perpetualPrivate'
|
|
5352
|
+
if (api === 'perpetualPrivate') {
|
|
5316
5353
|
this.checkRequiredCredentials();
|
|
5317
5354
|
query = this.extend({
|
|
5318
5355
|
'access_id': this.apiKey,
|
package/js/src/kraken.js
CHANGED
|
@@ -1360,7 +1360,9 @@ export default class kraken extends Exchange {
|
|
|
1360
1360
|
* @param {bool} [params.reduceOnly] *margin only* indicates if this order is to reduce the size of a position
|
|
1361
1361
|
* @param {float} [params.stopLossPrice] *margin only* the price that a stop loss order is triggered at
|
|
1362
1362
|
* @param {float} [params.takeProfitPrice] *margin only* the price that a take profit order is triggered at
|
|
1363
|
-
* @param {string} [params.
|
|
1363
|
+
* @param {string} [params.trailingAmount] *margin only* the quote amount to trail away from the current market price
|
|
1364
|
+
* @param {string} [params.trailingLimitAmount] *margin only* the quote amount away from the trailingAmount
|
|
1365
|
+
* @param {string} [params.offset] *margin only* '+' or '-' whether you want the trailingLimitAmount value to be positive or negative, default is negative '-'
|
|
1364
1366
|
* @param {string} [params.trigger] *margin only* the activation price type, 'last' or 'index', default is 'last'
|
|
1365
1367
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1366
1368
|
*/
|
|
@@ -1621,9 +1623,10 @@ export default class kraken extends Exchange {
|
|
|
1621
1623
|
const isStopLossTriggerOrder = stopLossTriggerPrice !== undefined;
|
|
1622
1624
|
const isTakeProfitTriggerOrder = takeProfitTriggerPrice !== undefined;
|
|
1623
1625
|
const isStopLossOrTakeProfitTrigger = isStopLossTriggerOrder || isTakeProfitTriggerOrder;
|
|
1624
|
-
const
|
|
1625
|
-
const
|
|
1626
|
-
|
|
1626
|
+
const trailingAmount = this.safeString(params, 'trailingAmount');
|
|
1627
|
+
const trailingLimitAmount = this.safeString(params, 'trailingLimitAmount');
|
|
1628
|
+
const isTrailingAmountOrder = trailingAmount !== undefined;
|
|
1629
|
+
if ((type === 'limit') && !isTrailingAmountOrder) {
|
|
1627
1630
|
request['price'] = this.priceToPrecision(symbol, price);
|
|
1628
1631
|
}
|
|
1629
1632
|
let reduceOnly = this.safeValue2(params, 'reduceOnly', 'reduce_only');
|
|
@@ -1639,19 +1642,19 @@ export default class kraken extends Exchange {
|
|
|
1639
1642
|
request['price2'] = this.priceToPrecision(symbol, price);
|
|
1640
1643
|
reduceOnly = true;
|
|
1641
1644
|
}
|
|
1642
|
-
else if (
|
|
1643
|
-
const
|
|
1644
|
-
const
|
|
1645
|
-
request['trigger'] =
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
const
|
|
1649
|
-
request['price'] =
|
|
1650
|
-
request['price2'] =
|
|
1645
|
+
else if (isTrailingAmountOrder) {
|
|
1646
|
+
const trailingActivationPriceType = this.safeString(params, 'trigger', 'last');
|
|
1647
|
+
const trailingAmountString = '+' + trailingAmount;
|
|
1648
|
+
request['trigger'] = trailingActivationPriceType;
|
|
1649
|
+
if ((type === 'limit') || (trailingLimitAmount !== undefined)) {
|
|
1650
|
+
const offset = this.safeString(params, 'offset', '-');
|
|
1651
|
+
const trailingLimitAmountString = offset + this.numberToString(trailingLimitAmount);
|
|
1652
|
+
request['price'] = trailingAmountString;
|
|
1653
|
+
request['price2'] = trailingLimitAmountString;
|
|
1651
1654
|
request['ordertype'] = 'trailing-stop-limit';
|
|
1652
1655
|
}
|
|
1653
1656
|
else {
|
|
1654
|
-
request['price'] =
|
|
1657
|
+
request['price'] = trailingAmountString;
|
|
1655
1658
|
request['ordertype'] = 'trailing-stop';
|
|
1656
1659
|
}
|
|
1657
1660
|
}
|
|
@@ -1681,7 +1684,7 @@ export default class kraken extends Exchange {
|
|
|
1681
1684
|
if (postOnly) {
|
|
1682
1685
|
request['oflags'] = 'post';
|
|
1683
1686
|
}
|
|
1684
|
-
params = this.omit(params, ['timeInForce', 'reduceOnly', 'stopLossPrice', 'takeProfitPrice', '
|
|
1687
|
+
params = this.omit(params, ['timeInForce', 'reduceOnly', 'stopLossPrice', 'takeProfitPrice', 'trailingAmount', 'trailingLimitAmount', 'offset']);
|
|
1685
1688
|
return [request, params];
|
|
1686
1689
|
}
|
|
1687
1690
|
async editOrder(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
|
|
@@ -1699,7 +1702,9 @@ export default class kraken extends Exchange {
|
|
|
1699
1702
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1700
1703
|
* @param {float} [params.stopLossPrice] *margin only* the price that a stop loss order is triggered at
|
|
1701
1704
|
* @param {float} [params.takeProfitPrice] *margin only* the price that a take profit order is triggered at
|
|
1702
|
-
* @param {string} [params.
|
|
1705
|
+
* @param {string} [params.trailingAmount] *margin only* the quote price away from the current market price
|
|
1706
|
+
* @param {string} [params.trailingLimitAmount] *margin only* the quote amount away from the trailingAmount
|
|
1707
|
+
* @param {string} [params.offset] *margin only* '+' or '-' whether you want the trailingLimitAmount value to be positive or negative, default is negative '-'
|
|
1703
1708
|
* @param {string} [params.trigger] *margin only* the activation price type, 'last' or 'index', default is 'last'
|
|
1704
1709
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1705
1710
|
*/
|
package/js/src/pro/binance.js
CHANGED
|
@@ -22,7 +22,7 @@ export default class binance extends binanceRest {
|
|
|
22
22
|
'watchBalance': true,
|
|
23
23
|
'watchMyTrades': true,
|
|
24
24
|
'watchOHLCV': true,
|
|
25
|
-
'watchOHLCVForSymbols':
|
|
25
|
+
'watchOHLCVForSymbols': false,
|
|
26
26
|
'watchOrderBook': true,
|
|
27
27
|
'watchOrderBookForSymbols': true,
|
|
28
28
|
'watchOrders': true,
|
package/js/src/pro/bitget.js
CHANGED
|
@@ -31,7 +31,7 @@ export default class bitget extends bitgetRest {
|
|
|
31
31
|
'watchBalance': true,
|
|
32
32
|
'watchMyTrades': true,
|
|
33
33
|
'watchOHLCV': true,
|
|
34
|
-
'watchOHLCVForSymbols':
|
|
34
|
+
'watchOHLCVForSymbols': false,
|
|
35
35
|
'watchOrderBook': true,
|
|
36
36
|
'watchOrderBookForSymbols': true,
|
|
37
37
|
'watchOrders': true,
|
package/js/src/pro/bybit.js
CHANGED
|
@@ -27,7 +27,7 @@ export default class bybit extends bybitRest {
|
|
|
27
27
|
'watchBalance': true,
|
|
28
28
|
'watchMyTrades': true,
|
|
29
29
|
'watchOHLCV': true,
|
|
30
|
-
'watchOHLCVForSymbols':
|
|
30
|
+
'watchOHLCVForSymbols': false,
|
|
31
31
|
'watchOrderBook': true,
|
|
32
32
|
'watchOrderBookForSymbols': true,
|
|
33
33
|
'watchOrders': true,
|
|
@@ -15,7 +15,7 @@ export declare class BigInteger {
|
|
|
15
15
|
protected intValue(): number;
|
|
16
16
|
protected byteValue(): number;
|
|
17
17
|
protected shortValue(): number;
|
|
18
|
-
protected signum():
|
|
18
|
+
protected signum(): 0 | 1 | -1;
|
|
19
19
|
toByteArray(): number[];
|
|
20
20
|
protected equals(a: BigInteger): boolean;
|
|
21
21
|
protected min(a: BigInteger): BigInteger;
|
package/package.json
CHANGED