ccxt 4.3.59 → 4.3.60

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.
@@ -38,8 +38,8 @@ export default class bitfinex extends Exchange {
38
38
  fetchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
39
39
  createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
40
40
  editOrder(id: string, symbol: string, type: OrderType, side: OrderSide, amount?: Num, price?: Num, params?: {}): Promise<Order>;
41
- cancelOrder(id: string, symbol?: Str, params?: {}): Promise<any>;
42
- cancelAllOrders(symbol?: Str, params?: {}): Promise<any>;
41
+ cancelOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
42
+ cancelAllOrders(symbol?: Str, params?: {}): Promise<Order[]>;
43
43
  parseOrder(order: Dict, market?: Market): Order;
44
44
  fetchOpenOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
45
45
  fetchClosedOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
@@ -1158,7 +1158,33 @@ export default class bitfinex extends Exchange {
1158
1158
  const request = {
1159
1159
  'order_id': parseInt(id),
1160
1160
  };
1161
- return await this.privatePostOrderCancel(this.extend(request, params));
1161
+ const response = await this.privatePostOrderCancel(this.extend(request, params));
1162
+ //
1163
+ // {
1164
+ // id: '161236928925',
1165
+ // cid: '1720172026812',
1166
+ // cid_date: '2024-07-05',
1167
+ // gid: null,
1168
+ // symbol: 'adaust',
1169
+ // exchange: 'bitfinex',
1170
+ // price: '0.33',
1171
+ // avg_execution_price: '0.0',
1172
+ // side: 'buy',
1173
+ // type: 'exchange limit',
1174
+ // timestamp: '1720172026.813',
1175
+ // is_live: true,
1176
+ // is_cancelled: false,
1177
+ // is_hidden: false,
1178
+ // oco_order: null,
1179
+ // was_forced: false,
1180
+ // original_amount: '10.0',
1181
+ // remaining_amount: '10.0',
1182
+ // executed_amount: '0.0',
1183
+ // src: 'api',
1184
+ // meta: {}
1185
+ // }
1186
+ //
1187
+ return this.parseOrder(response);
1162
1188
  }
1163
1189
  async cancelAllOrders(symbol = undefined, params = {}) {
1164
1190
  /**
@@ -1166,11 +1192,19 @@ export default class bitfinex extends Exchange {
1166
1192
  * @name bitfinex#cancelAllOrders
1167
1193
  * @description cancel all open orders
1168
1194
  * @see https://docs.bitfinex.com/v1/reference/rest-auth-cancel-all-orders
1169
- * @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
1195
+ * @param {string} symbol not used by bitfinex cancelAllOrders
1170
1196
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1171
1197
  * @returns {object} response from exchange
1172
1198
  */
1173
- return await this.privatePostOrderCancelAll(params);
1199
+ const response = await this.privatePostOrderCancelAll(params);
1200
+ //
1201
+ // { result: 'Submitting 1 order cancellations.' }
1202
+ //
1203
+ return [
1204
+ this.safeOrder({
1205
+ 'info': response,
1206
+ }),
1207
+ ];
1174
1208
  }
1175
1209
  parseOrder(order, market = undefined) {
1176
1210
  //
@@ -1649,7 +1683,7 @@ export default class bitfinex extends Exchange {
1649
1683
  return response;
1650
1684
  }
1651
1685
  nonce() {
1652
- return this.milliseconds();
1686
+ return this.microseconds();
1653
1687
  }
1654
1688
  sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
1655
1689
  let request = '/' + this.implodeParams(path, params);
package/js/src/bitso.js CHANGED
@@ -100,7 +100,10 @@ export default class bitso extends Exchange {
100
100
  'urls': {
101
101
  'logo': 'https://user-images.githubusercontent.com/51840849/87295554-11f98280-c50e-11ea-80d6-15b3bafa8cbf.jpg',
102
102
  'api': {
103
- 'rest': 'https://api.bitso.com',
103
+ 'rest': 'https://bitso.com/api',
104
+ },
105
+ 'test': {
106
+ 'rest': 'https://stage.bitso.com/api',
104
107
  },
105
108
  'www': 'https://bitso.com',
106
109
  'doc': 'https://bitso.com/api_info',
package/js/src/bybit.js CHANGED
@@ -4449,10 +4449,8 @@ export default class bybit extends Exchange {
4449
4449
  * @name bybit#cancelOrdersForSymbols
4450
4450
  * @description cancel multiple orders for multiple symbols
4451
4451
  * @see https://bybit-exchange.github.io/docs/v5/order/batch-cancel
4452
- * @param {string[]} ids order ids
4453
- * @param {string} symbol unified symbol of the market the order was made in
4452
+ * @param {CancellationRequest[]} orders list of order ids with symbol, example [{"id": "a", "symbol": "BTC/USDT"}, {"id": "b", "symbol": "ETH/USDT"}]
4454
4453
  * @param {object} [params] extra parameters specific to the exchange API endpoint
4455
- * @param {string[]} [params.clientOrderIds] client order ids
4456
4454
  * @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
4457
4455
  */
4458
4456
  await this.loadMarkets();
@@ -817,15 +817,23 @@ export default class cryptocom extends Exchange {
817
817
  'instrument_name': market['id'],
818
818
  'timeframe': this.safeString(this.timeframes, timeframe, timeframe),
819
819
  };
820
- if (since !== undefined) {
821
- request['start_ts'] = since;
822
- }
823
820
  if (limit !== undefined) {
824
821
  request['count'] = limit;
825
822
  }
826
- const until = this.safeInteger(params, 'until');
823
+ const now = this.microseconds();
824
+ const duration = this.parseTimeframe(timeframe);
825
+ const until = this.safeInteger(params, 'until', now);
827
826
  params = this.omit(params, ['until']);
828
- if (until !== undefined) {
827
+ if (since !== undefined) {
828
+ request['start_ts'] = since;
829
+ if (limit !== undefined) {
830
+ request['end_ts'] = this.sum(since, duration * (limit + 1) * 1000) - 1;
831
+ }
832
+ else {
833
+ request['end_ts'] = until;
834
+ }
835
+ }
836
+ else {
829
837
  request['end_ts'] = until;
830
838
  }
831
839
  const response = await this.v1PublicGetPublicGetCandlestick(this.extend(request, params));
@@ -1478,7 +1486,7 @@ export default class cryptocom extends Exchange {
1478
1486
  * @name cryptocom#cancelOrdersForSymbols
1479
1487
  * @description cancel multiple orders for multiple symbols
1480
1488
  * @see https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-cancel-order-list-list
1481
- * @param {CancellationRequest[]} orders each order should contain the parameters required by cancelOrder namely id and symbol
1489
+ * @param {CancellationRequest[]} orders each order should contain the parameters required by cancelOrder namely id and symbol, example [{"id": "a", "symbol": "BTC/USDT"}, {"id": "b", "symbol": "ETH/USDT"}]
1482
1490
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1483
1491
  * @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1484
1492
  */
package/js/src/gate.js CHANGED
@@ -5140,8 +5140,7 @@ export default class gate extends Exchange {
5140
5140
  * @name gate#cancelOrdersForSymbols
5141
5141
  * @description cancel multiple orders for multiple symbols
5142
5142
  * @see https://www.gate.io/docs/developers/apiv4/en/#cancel-a-batch-of-orders-with-an-id-list
5143
- * @param {string[]} ids order ids
5144
- * @param {string} symbol unified symbol of the market the order was made in
5143
+ * @param {CancellationRequest[]} orders list of order ids with symbol, example [{"id": "a", "symbol": "BTC/USDT"}, {"id": "b", "symbol": "ETH/USDT"}]
5145
5144
  * @param {object} [params] extra parameters specific to the exchange API endpoint
5146
5145
  * @param {string[]} [params.clientOrderIds] client order ids
5147
5146
  * @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
@@ -1318,7 +1318,7 @@ export default class hyperliquid extends Exchange {
1318
1318
  * @description cancel multiple orders for multiple symbols
1319
1319
  * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s
1320
1320
  * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s-by-cloid
1321
- * @param {CancellationRequest[]} orders each order should contain the parameters required by cancelOrder namely id and symbol
1321
+ * @param {CancellationRequest[]} orders each order should contain the parameters required by cancelOrder namely id and symbol, example [{"id": "a", "symbol": "BTC/USDT"}, {"id": "b", "symbol": "ETH/USDT"}]
1322
1322
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1323
1323
  * @param {string} [params.vaultAddress] the vault address
1324
1324
  * @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
package/js/src/kraken.js CHANGED
@@ -1052,7 +1052,7 @@ export default class kraken extends Exchange {
1052
1052
  else {
1053
1053
  direction = 'in';
1054
1054
  }
1055
- const timestamp = this.safeTimestamp(item, 'time');
1055
+ const timestamp = this.safeIntegerProduct(item, 'time', 1000);
1056
1056
  return {
1057
1057
  'info': item,
1058
1058
  'id': id,
package/js/src/okx.js CHANGED
@@ -927,7 +927,16 @@ export default class okx extends Exchange {
927
927
  '64003': AccountNotEnabled,
928
928
  '70010': BadRequest,
929
929
  '70013': BadRequest,
930
- '70016': BadRequest, // Please specify your instrument settings for at least one instType.
930
+ '70016': BadRequest,
931
+ '1009': BadRequest,
932
+ '4001': AuthenticationError,
933
+ '4002': BadRequest,
934
+ '4003': RateLimitExceeded,
935
+ '4004': NetworkError,
936
+ '4005': ExchangeNotAvailable,
937
+ '4006': BadRequest,
938
+ '4007': AuthenticationError,
939
+ '4008': RateLimitExceeded, // The number of subscribed channels exceeds the maximum limit.
931
940
  },
932
941
  'broad': {
933
942
  'Internal Server Error': ExchangeNotAvailable,
@@ -3351,7 +3360,7 @@ export default class okx extends Exchange {
3351
3360
  * @description cancel multiple orders for multiple symbols
3352
3361
  * @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-cancel-multiple-orders
3353
3362
  * @see https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-post-cancel-algo-order
3354
- * @param {CancellationRequest[]} orders each order should contain the parameters required by cancelOrder namely id and symbol
3363
+ * @param {CancellationRequest[]} orders each order should contain the parameters required by cancelOrder namely id and symbol, example [{"id": "a", "symbol": "BTC/USDT"}, {"id": "b", "symbol": "ETH/USDT"}]
3355
3364
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3356
3365
  * @param {boolean} [params.trigger] whether the order is a stop/trigger order
3357
3366
  * @param {boolean} [params.trailing] set to true if you want to cancel trailing orders
package/js/src/pro/cex.js CHANGED
@@ -1015,7 +1015,7 @@ export default class cex extends cexRest {
1015
1015
  // }
1016
1016
  //
1017
1017
  const data = this.safeValue(message, 'data', {});
1018
- const incrementalId = this.safeNumber(data, 'id');
1018
+ const incrementalId = this.safeInteger(data, 'id');
1019
1019
  const pair = this.safeString(data, 'pair', '');
1020
1020
  const symbol = this.pairToSymbol(pair);
1021
1021
  const storedOrderBook = this.safeValue(this.orderbooks, symbol);
@@ -43,6 +43,9 @@ export default class kucoin extends kucoinRest {
43
43
  'snapshotMaxRetries': 3,
44
44
  'method': '/market/level2', // '/spotMarket/level2Depth5' or '/spotMarket/level2Depth50'
45
45
  },
46
+ 'watchMyTrades': {
47
+ 'method': '/spotMarket/tradeOrders', // or '/spot/tradeFills'
48
+ },
46
49
  },
47
50
  'streaming': {
48
51
  // kucoin does not support built-in ws protocol-level ping-pong
@@ -986,11 +989,14 @@ export default class kucoin extends kucoinRest {
986
989
  * @param {int} [since] the earliest time in ms to fetch trades for
987
990
  * @param {int} [limit] the maximum number of trade structures to retrieve
988
991
  * @param {object} [params] extra parameters specific to the exchange API endpoint
992
+ * @param {string} [params.method] '/spotMarket/tradeOrders' or '/spot/tradeFills' default is '/spotMarket/tradeOrders'
989
993
  * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure
990
994
  */
991
995
  await this.loadMarkets();
992
996
  const url = await this.negotiate(true);
993
- const topic = '/spotMarket/tradeOrders';
997
+ const options = this.safeDict(this.options, 'watchMyTrades');
998
+ const defaultMethod = this.safeString(params, 'method', '/spotMarket/tradeOrders');
999
+ const topic = (defaultMethod !== undefined) ? defaultMethod : this.safeString(options, 'method');
994
1000
  const request = {
995
1001
  'privateChannel': true,
996
1002
  };
@@ -1048,6 +1054,8 @@ export default class kucoin extends kucoinRest {
1048
1054
  client.resolve(this.myTrades, symbolSpecificMessageHash);
1049
1055
  }
1050
1056
  parseWsTrade(trade, market = undefined) {
1057
+ //
1058
+ // /spotMarket/tradeOrders
1051
1059
  //
1052
1060
  // {
1053
1061
  // "symbol": "KCS-USDT",
@@ -1070,6 +1078,22 @@ export default class kucoin extends kucoinRest {
1070
1078
  // "ts": 1670329987311000000
1071
1079
  // }
1072
1080
  //
1081
+ // /spot/tradeFills
1082
+ //
1083
+ // {
1084
+ // "fee": 0.00262148,
1085
+ // "feeCurrency": "USDT",
1086
+ // "feeRate": 0.001,
1087
+ // "orderId": "62417436b29df8000183df2f",
1088
+ // "orderType": "market",
1089
+ // "price": 131.074,
1090
+ // "side": "sell",
1091
+ // "size": 0.02,
1092
+ // "symbol": "LTC-USDT",
1093
+ // "time": "1648456758734571745",
1094
+ // "tradeId": "624174362e113d2f467b3043"
1095
+ // }
1096
+ //
1073
1097
  const marketId = this.safeString(trade, 'symbol');
1074
1098
  market = this.safeMarket(marketId, market, '-');
1075
1099
  const symbol = market['symbol'];
@@ -1079,7 +1103,10 @@ export default class kucoin extends kucoinRest {
1079
1103
  const price = this.safeString(trade, 'matchPrice');
1080
1104
  const amount = this.safeString(trade, 'matchSize');
1081
1105
  const order = this.safeString(trade, 'orderId');
1082
- const timestamp = this.safeIntegerProduct(trade, 'ts', 0.000001);
1106
+ const timestamp = this.safeIntegerProduct2(trade, 'ts', 'time', 0.000001);
1107
+ const feeCurrency = market['quote'];
1108
+ const feeRate = this.safeString(trade, 'feeRate');
1109
+ const feeCost = this.safeString(trade, 'fee');
1083
1110
  return this.safeTrade({
1084
1111
  'info': trade,
1085
1112
  'timestamp': timestamp,
@@ -1093,7 +1120,11 @@ export default class kucoin extends kucoinRest {
1093
1120
  'price': price,
1094
1121
  'amount': amount,
1095
1122
  'cost': undefined,
1096
- 'fee': undefined,
1123
+ 'fee': {
1124
+ 'cost': feeCost,
1125
+ 'rate': feeRate,
1126
+ 'currency': feeCurrency,
1127
+ },
1097
1128
  }, market);
1098
1129
  }
1099
1130
  async watchBalance(params = {}) {
@@ -1202,6 +1233,7 @@ export default class kucoin extends kucoinRest {
1202
1233
  'account.balance': this.handleBalance,
1203
1234
  'orderChange': this.handleOrder,
1204
1235
  'stopOrder': this.handleOrder,
1236
+ '/spot/tradeFills': this.handleMyTrade,
1205
1237
  };
1206
1238
  const method = this.safeValue(methods, subject);
1207
1239
  if (method !== undefined) {
@@ -42,7 +42,7 @@ export default class phemex extends phemexRest {
42
42
  'OHLCVLimit': 1000,
43
43
  },
44
44
  'streaming': {
45
- 'keepAlive': 10000,
45
+ 'keepAlive': 9000,
46
46
  },
47
47
  });
48
48
  }
package/js/src/pro/xt.js CHANGED
@@ -252,7 +252,11 @@ export default class xt extends xtRest {
252
252
  await this.loadMarkets();
253
253
  const market = this.market(symbol);
254
254
  const name = 'kline@' + market['id'] + ',' + timeframe;
255
- return await this.subscribe(name, 'public', 'watchOHLCV', market, undefined, params);
255
+ const ohlcv = await this.subscribe(name, 'public', 'watchOHLCV', market, undefined, params);
256
+ if (this.newUpdates) {
257
+ limit = ohlcv.getLimit(symbol, limit);
258
+ }
259
+ return this.filterBySinceLimit(ohlcv, since, limit, 0, true);
256
260
  }
257
261
  async watchTrades(symbol, since = undefined, limit = undefined, params = {}) {
258
262
  /**
package/js/src/timex.d.ts CHANGED
@@ -22,8 +22,8 @@ export default class timex extends Exchange {
22
22
  fetchBalance(params?: {}): Promise<Balances>;
23
23
  createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
24
24
  editOrder(id: string, symbol: string, type: OrderType, side: OrderSide, amount?: Num, price?: Num, params?: {}): Promise<Order>;
25
- cancelOrder(id: string, symbol?: Str, params?: {}): Promise<any>;
26
- cancelOrders(ids: any, symbol?: Str, params?: {}): Promise<any>;
25
+ cancelOrder(id: string, symbol?: Str, params?: {}): Promise<import("./base/types.js").Dictionary<any>>;
26
+ cancelOrders(ids: any, symbol?: Str, params?: {}): Promise<any[]>;
27
27
  fetchOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
28
28
  fetchOpenOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
29
29
  fetchClosedOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
package/js/src/timex.js CHANGED
@@ -879,7 +879,8 @@ export default class timex extends Exchange {
879
879
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
880
880
  */
881
881
  await this.loadMarkets();
882
- return await this.cancelOrders([id], symbol, params);
882
+ const orders = await this.cancelOrders([id], symbol, params);
883
+ return this.safeDict(orders, 0);
883
884
  }
884
885
  async cancelOrders(ids, symbol = undefined, params = {}) {
885
886
  /**
@@ -921,7 +922,22 @@ export default class timex extends Exchange {
921
922
  // ],
922
923
  // "unchangedOrders": [ "string" ],
923
924
  // }
924
- return response;
925
+ //
926
+ const changedOrders = this.safeList(response, 'changedOrders', []);
927
+ const unchangedOrders = this.safeList(response, 'unchangedOrders', []);
928
+ const orders = [];
929
+ for (let i = 0; i < changedOrders.length; i++) {
930
+ const newOrder = this.safeDict(changedOrders[i], 'newOrder');
931
+ orders.push(this.parseOrder(newOrder));
932
+ }
933
+ for (let i = 0; i < unchangedOrders.length; i++) {
934
+ orders.push(this.safeOrder({
935
+ 'info': unchangedOrders[i],
936
+ 'id': unchangedOrders[i],
937
+ 'status': 'unchanged',
938
+ }));
939
+ }
940
+ return orders;
925
941
  }
926
942
  async fetchOrder(id, symbol = undefined, params = {}) {
927
943
  /**
package/js/src/xt.js CHANGED
@@ -827,7 +827,7 @@ export default class xt extends Exchange {
827
827
  'name': this.safeString(entry, 'fullName'),
828
828
  'active': active,
829
829
  'fee': this.parseNumber(minWithdrawFeeString),
830
- 'precision': undefined,
830
+ 'precision': minPrecision,
831
831
  'deposit': deposit,
832
832
  'withdraw': withdraw,
833
833
  'networks': networks,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt",
3
- "version": "4.3.59",
3
+ "version": "4.3.60",
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",