ccxt 4.1.23 → 4.1.25

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.
Files changed (68) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.js +1249 -232
  3. package/dist/ccxt.browser.min.js +4 -4
  4. package/dist/cjs/ccxt.js +1 -1
  5. package/dist/cjs/src/ace.js +1 -1
  6. package/dist/cjs/src/base/Exchange.js +7 -3
  7. package/dist/cjs/src/base/functions/crypto.js +11 -2
  8. package/dist/cjs/src/base/functions/generic.js +5 -3
  9. package/dist/cjs/src/base/functions.js +1 -0
  10. package/dist/cjs/src/binance.js +112 -34
  11. package/dist/cjs/src/bitget.js +289 -21
  12. package/dist/cjs/src/bitmart.js +1 -1
  13. package/dist/cjs/src/bybit.js +132 -15
  14. package/dist/cjs/src/cryptocom.js +262 -15
  15. package/dist/cjs/src/gate.js +191 -88
  16. package/dist/cjs/src/krakenfutures.js +158 -22
  17. package/dist/cjs/src/oceanex.js +0 -12
  18. package/dist/cjs/src/okx.js +60 -1
  19. package/dist/cjs/src/pro/bybit.js +1 -1
  20. package/dist/cjs/src/static_dependencies/noble-curves/abstract/edwards.js +8 -6
  21. package/dist/cjs/src/wavesexchange.js +6 -6
  22. package/js/ccxt.d.ts +1 -1
  23. package/js/ccxt.js +1 -1
  24. package/js/src/abstract/binance.d.ts +1 -14
  25. package/js/src/abstract/binancecoinm.d.ts +1 -14
  26. package/js/src/abstract/binanceus.d.ts +1 -14
  27. package/js/src/abstract/binanceusdm.d.ts +1 -14
  28. package/js/src/abstract/gate.d.ts +2 -7
  29. package/js/src/abstract/gateio.d.ts +2 -7
  30. package/js/src/ace.js +1 -1
  31. package/js/src/base/Exchange.d.ts +4 -2
  32. package/js/src/base/Exchange.js +7 -3
  33. package/js/src/base/functions/crypto.d.ts +3 -2
  34. package/js/src/base/functions/crypto.js +11 -3
  35. package/js/src/base/functions/generic.d.ts +1 -1
  36. package/js/src/base/functions/generic.js +5 -3
  37. package/js/src/base/types.d.ts +8 -0
  38. package/js/src/binance.d.ts +2 -1
  39. package/js/src/binance.js +112 -34
  40. package/js/src/bitget.d.ts +15 -1
  41. package/js/src/bitget.js +289 -21
  42. package/js/src/bitmart.js +1 -1
  43. package/js/src/bybit.d.ts +4 -2
  44. package/js/src/bybit.js +132 -15
  45. package/js/src/cryptocom.d.ts +4 -1
  46. package/js/src/cryptocom.js +262 -15
  47. package/js/src/gate.d.ts +3 -1
  48. package/js/src/gate.js +191 -88
  49. package/js/src/krakenfutures.d.ts +4 -1
  50. package/js/src/krakenfutures.js +158 -22
  51. package/js/src/oceanex.d.ts +0 -1
  52. package/js/src/oceanex.js +0 -12
  53. package/js/src/okx.d.ts +2 -1
  54. package/js/src/okx.js +60 -1
  55. package/js/src/pro/bybit.js +1 -1
  56. package/js/src/static_dependencies/noble-curves/abstract/edwards.d.ts +1 -0
  57. package/js/src/static_dependencies/noble-curves/abstract/edwards.js +5 -3
  58. package/js/src/wavesexchange.js +7 -7
  59. package/package.json +1 -1
  60. package/skip-tests.json +2 -3
  61. package/js/src/bkex.d.ts +0 -95
  62. package/js/src/bkex.js +0 -1962
  63. package/js/src/pro/btcex.d.ts +0 -32
  64. package/js/src/pro/btcex.js +0 -776
  65. package/js/src/pro/ripio.d.ts +0 -18
  66. package/js/src/pro/ripio.js +0 -296
  67. package/js/src/pro/zb.d.ts +0 -22
  68. package/js/src/pro/zb.js +0 -605
@@ -36,6 +36,7 @@ class okx extends okx$1 {
36
36
  'cancelOrders': true,
37
37
  'createDepositAddress': false,
38
38
  'createOrder': true,
39
+ 'createOrders': true,
39
40
  'createPostOnlyOrder': true,
40
41
  'createReduceOnlyOrder': true,
41
42
  'createStopLimitOrder': true,
@@ -2769,6 +2770,55 @@ class okx extends okx$1 {
2769
2770
  order['side'] = side;
2770
2771
  return order;
2771
2772
  }
2773
+ async createOrders(orders, params = {}) {
2774
+ /**
2775
+ * @method
2776
+ * @name okx#createOrders
2777
+ * @description create a list of trade orders
2778
+ * @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-place-multiple-orders
2779
+ * @param {array} orders list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
2780
+ * @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
2781
+ */
2782
+ await this.loadMarkets();
2783
+ const ordersRequests = [];
2784
+ for (let i = 0; i < orders.length; i++) {
2785
+ const rawOrder = orders[i];
2786
+ const marketId = this.safeString(rawOrder, 'symbol');
2787
+ const type = this.safeString(rawOrder, 'type');
2788
+ const side = this.safeString(rawOrder, 'side');
2789
+ const amount = this.safeValue(rawOrder, 'amount');
2790
+ const price = this.safeValue(rawOrder, 'price');
2791
+ const orderParams = this.safeValue(rawOrder, 'params', {});
2792
+ const extendedParams = this.extend(orderParams, params); // the request does not accept extra params since it's a list, so we're extending each order with the common params
2793
+ const orderRequest = this.createOrderRequest(marketId, type, side, amount, price, extendedParams);
2794
+ ordersRequests.push(orderRequest);
2795
+ }
2796
+ const response = await this.privatePostTradeBatchOrders(ordersRequests);
2797
+ // {
2798
+ // "code": "0",
2799
+ // "data": [
2800
+ // {
2801
+ // "clOrdId": "e847386590ce4dBCc7f2a1b4c4509f82",
2802
+ // "ordId": "636305438765568000",
2803
+ // "sCode": "0",
2804
+ // "sMsg": "Order placed",
2805
+ // "tag": "e847386590ce4dBC"
2806
+ // },
2807
+ // {
2808
+ // "clOrdId": "e847386590ce4dBC0b9993fe642d8f62",
2809
+ // "ordId": "636305438765568001",
2810
+ // "sCode": "0",
2811
+ // "sMsg": "Order placed",
2812
+ // "tag": "e847386590ce4dBC"
2813
+ // }
2814
+ // ],
2815
+ // "inTime": "1697979038584486",
2816
+ // "msg": "",
2817
+ // "outTime": "1697979038586493"
2818
+ // }
2819
+ const data = this.safeValue(response, 'data', []);
2820
+ return this.parseOrders(data);
2821
+ }
2772
2822
  editOrderRequest(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
2773
2823
  const market = this.market(symbol);
2774
2824
  const request = {
@@ -3147,6 +3197,15 @@ class okx extends okx$1 {
3147
3197
  // "uly": "BTC-USDT"
3148
3198
  // }
3149
3199
  //
3200
+ const scode = this.safeString(order, 'sCode');
3201
+ if ((scode !== undefined) && (scode !== '0')) {
3202
+ return this.safeOrder({
3203
+ 'id': this.safeString(order, 'ordId'),
3204
+ 'clientOrderId': this.safeString(order, 'clOrdId'),
3205
+ 'status': 'rejected',
3206
+ 'info': order,
3207
+ });
3208
+ }
3150
3209
  const id = this.safeString2(order, 'algoId', 'ordId');
3151
3210
  const timestamp = this.safeInteger(order, 'cTime');
3152
3211
  const lastUpdateTimestamp = this.safeInteger(order, 'uTime');
@@ -6889,7 +6948,7 @@ class okx extends okx$1 {
6889
6948
  // }
6890
6949
  //
6891
6950
  const code = this.safeString(response, 'code');
6892
- if (code !== '0') {
6951
+ if ((code !== '0') && (code !== '2')) { // 2 means that bulk operation partially succeeded
6893
6952
  const feedback = this.id + ' ' + body;
6894
6953
  const data = this.safeValue(response, 'data', []);
6895
6954
  for (let i = 0; i < data.length; i++) {
@@ -316,7 +316,7 @@ class bybit extends bybit$1 {
316
316
  const topic = this.safeString(message, 'topic', '');
317
317
  const updateType = this.safeString(message, 'type', '');
318
318
  const data = this.safeValue(message, 'data', {});
319
- const isSpot = this.safeString(data, 'openInterestValue') === undefined;
319
+ const isSpot = this.safeString(data, 'fundingRate') === undefined;
320
320
  const type = isSpot ? 'spot' : 'contract';
321
321
  let symbol = undefined;
322
322
  let parsed = undefined;
@@ -354,18 +354,19 @@ function twistedEdwards(curveDef) {
354
354
  }
355
355
  /** Signs message with privateKey. RFC8032 5.1.6 */
356
356
  function sign(msg, privKey, context) {
357
- /*
358
- msg = ensureBytes('message', msg);
359
- if (preHash) msg = preHash(msg); // for ed25519ph etc.
357
+ msg = utils.ensureBytes('message', msg);
358
+ if (preHash)
359
+ msg = preHash(msg); // for ed25519ph etc.
360
360
  const { prefix, scalar, pointBytes } = getExtendedPublicKey(privKey);
361
361
  const r = hashDomainToScalar(context, prefix, msg); // r = dom2(F, C) || prefix || PH(M)
362
362
  const R = G.multiply(r).toRawBytes(); // R = rG
363
363
  const k = hashDomainToScalar(context, R, pointBytes, msg); // R || A || PH(M)
364
364
  const s = modN(r + k * scalar); // S = (r + k * s) mod L
365
365
  assertGE0(s); // 0 <= s < l
366
- const res = ut.concatBytes(R, ut.numberToBytesLE(s, Fp.BYTES));
367
- return ensureBytes('result', res, nByteLength * 2); // 64-byte signature
368
- */
366
+ const res = utils.concatBytes(R, utils.numberToBytesLE(s, Fp.BYTES));
367
+ return utils.ensureBytes('result', res, nByteLength * 2); // 64-byte signature
368
+ }
369
+ function signModified(msg, privKey, context) {
369
370
  msg = utils.ensureBytes('message', msg);
370
371
  const privKeyBytes = utils.ensureBytes('privKey', privKey);
371
372
  const privKeyNumber = utils.bytesToNumberLE(privKeyBytes);
@@ -418,6 +419,7 @@ function twistedEdwards(curveDef) {
418
419
  CURVE,
419
420
  getPublicKey,
420
421
  sign,
422
+ signModified,
421
423
  verify,
422
424
  ExtendedPoint: Point,
423
425
  utils: utils$1,
@@ -752,7 +752,7 @@ class wavesexchange extends wavesexchange$1 {
752
752
  const messageHex = this.binaryToBase16(this.encode(message));
753
753
  const payload = prefix + messageHex;
754
754
  const hexKey = this.binaryToBase16(this.base58ToBinary(this.secret));
755
- const signature = crypto.eddsa(payload, hexKey, ed25519.ed25519);
755
+ const signature = crypto.axolotl(payload, hexKey, ed25519.ed25519);
756
756
  const request = {
757
757
  'grant_type': 'password',
758
758
  'scope': 'general',
@@ -1421,7 +1421,7 @@ class wavesexchange extends wavesexchange$1 {
1421
1421
  if ((serializedOrder[0] === '"') && (serializedOrder[(serializedOrder.length - 1)] === '"')) {
1422
1422
  serializedOrder = serializedOrder.slice(1, serializedOrder.length - 1);
1423
1423
  }
1424
- const signature = crypto.eddsa(this.binaryToBase16(this.base58ToBinary(serializedOrder)), this.binaryToBase16(this.base58ToBinary(this.secret)), ed25519.ed25519);
1424
+ const signature = crypto.axolotl(this.binaryToBase16(this.base58ToBinary(serializedOrder)), this.binaryToBase16(this.base58ToBinary(this.secret)), ed25519.ed25519);
1425
1425
  body['signature'] = signature;
1426
1426
  //
1427
1427
  // {
@@ -1536,7 +1536,7 @@ class wavesexchange extends wavesexchange$1 {
1536
1536
  ];
1537
1537
  const binary = this.binaryConcatArray(byteArray);
1538
1538
  const hexSecret = this.binaryToBase16(this.base58ToBinary(this.secret));
1539
- const signature = crypto.eddsa(this.binaryToBase16(binary), hexSecret, ed25519.ed25519);
1539
+ const signature = crypto.axolotl(this.binaryToBase16(binary), hexSecret, ed25519.ed25519);
1540
1540
  const request = {
1541
1541
  'Timestamp': timestamp.toString(),
1542
1542
  'Signature': signature,
@@ -1571,7 +1571,7 @@ class wavesexchange extends wavesexchange$1 {
1571
1571
  ];
1572
1572
  const binary = this.binaryConcatArray(byteArray);
1573
1573
  const hexSecret = this.binaryToBase16(this.base58ToBinary(this.secret));
1574
- const signature = crypto.eddsa(this.binaryToBase16(binary), hexSecret, ed25519.ed25519);
1574
+ const signature = crypto.axolotl(this.binaryToBase16(binary), hexSecret, ed25519.ed25519);
1575
1575
  const request = {
1576
1576
  'Accept': 'application/json',
1577
1577
  'Timestamp': timestamp.toString(),
@@ -1935,7 +1935,7 @@ class wavesexchange extends wavesexchange$1 {
1935
1935
  ];
1936
1936
  const binary = this.binaryConcatArray(byteArray);
1937
1937
  const hexSecret = this.binaryToBase16(this.base58ToBinary(this.secret));
1938
- const signature = crypto.eddsa(this.binaryToBase16(binary), hexSecret, ed25519.ed25519);
1938
+ const signature = crypto.axolotl(this.binaryToBase16(binary), hexSecret, ed25519.ed25519);
1939
1939
  const matcherRequest = {
1940
1940
  'publicKey': this.apiKey,
1941
1941
  'signature': signature,
@@ -2533,7 +2533,7 @@ class wavesexchange extends wavesexchange$1 {
2533
2533
  ];
2534
2534
  const binary = this.binaryConcatArray(byteArray);
2535
2535
  const hexSecret = this.binaryToBase16(this.base58ToBinary(this.secret));
2536
- const signature = crypto.eddsa(this.binaryToBase16(binary), hexSecret, ed25519.ed25519);
2536
+ const signature = crypto.axolotl(this.binaryToBase16(binary), hexSecret, ed25519.ed25519);
2537
2537
  const request = {
2538
2538
  'senderPublicKey': this.apiKey,
2539
2539
  'amount': amountInteger,
package/js/ccxt.d.ts CHANGED
@@ -4,7 +4,7 @@ import * as functions from './src/base/functions.js';
4
4
  import * as errors from './src/base/errors.js';
5
5
  import { Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation } from './src/base/types.js';
6
6
  import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
7
- declare const version = "4.1.22";
7
+ declare const version = "4.1.24";
8
8
  import ace from './src/ace.js';
9
9
  import alpaca from './src/alpaca.js';
10
10
  import ascendex from './src/ascendex.js';
package/js/ccxt.js CHANGED
@@ -38,7 +38,7 @@ import * as errors from './src/base/errors.js';
38
38
  import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
39
39
  //-----------------------------------------------------------------------------
40
40
  // this is updated by vss.js when building
41
- const version = '4.1.23';
41
+ const version = '4.1.25';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import ace from './src/ace.js';
@@ -354,20 +354,6 @@ interface Exchange {
354
354
  sapiV3GetSubAccountAssets(params?: {}): Promise<implicitReturnType>;
355
355
  sapiV3PostAssetGetUserAsset(params?: {}): Promise<implicitReturnType>;
356
356
  sapiV4GetSubAccountAssets(params?: {}): Promise<implicitReturnType>;
357
- wapiPostWithdraw(params?: {}): Promise<implicitReturnType>;
358
- wapiPostSubAccountTransfer(params?: {}): Promise<implicitReturnType>;
359
- wapiGetDepositHistory(params?: {}): Promise<implicitReturnType>;
360
- wapiGetWithdrawHistory(params?: {}): Promise<implicitReturnType>;
361
- wapiGetDepositAddress(params?: {}): Promise<implicitReturnType>;
362
- wapiGetAccountStatus(params?: {}): Promise<implicitReturnType>;
363
- wapiGetSystemStatus(params?: {}): Promise<implicitReturnType>;
364
- wapiGetApiTradingStatus(params?: {}): Promise<implicitReturnType>;
365
- wapiGetUserAssetDribbletLog(params?: {}): Promise<implicitReturnType>;
366
- wapiGetTradeFee(params?: {}): Promise<implicitReturnType>;
367
- wapiGetAssetDetail(params?: {}): Promise<implicitReturnType>;
368
- wapiGetSubAccountList(params?: {}): Promise<implicitReturnType>;
369
- wapiGetSubAccountTransferHistory(params?: {}): Promise<implicitReturnType>;
370
- wapiGetSubAccountAssets(params?: {}): Promise<implicitReturnType>;
371
357
  dapiPublicGetPing(params?: {}): Promise<implicitReturnType>;
372
358
  dapiPublicGetTime(params?: {}): Promise<implicitReturnType>;
373
359
  dapiPublicGetExchangeInfo(params?: {}): Promise<implicitReturnType>;
@@ -453,6 +439,7 @@ interface Exchange {
453
439
  fapiPublicGetConstituents(params?: {}): Promise<implicitReturnType>;
454
440
  fapiPublicGetApiTradingStatus(params?: {}): Promise<implicitReturnType>;
455
441
  fapiPublicGetLvtKlines(params?: {}): Promise<implicitReturnType>;
442
+ fapiDataGetDeliveryPrice(params?: {}): Promise<implicitReturnType>;
456
443
  fapiDataGetOpenInterestHist(params?: {}): Promise<implicitReturnType>;
457
444
  fapiDataGetTopLongShortAccountRatio(params?: {}): Promise<implicitReturnType>;
458
445
  fapiDataGetTopLongShortPositionRatio(params?: {}): Promise<implicitReturnType>;
@@ -354,20 +354,6 @@ interface binance {
354
354
  sapiV3GetSubAccountAssets(params?: {}): Promise<implicitReturnType>;
355
355
  sapiV3PostAssetGetUserAsset(params?: {}): Promise<implicitReturnType>;
356
356
  sapiV4GetSubAccountAssets(params?: {}): Promise<implicitReturnType>;
357
- wapiPostWithdraw(params?: {}): Promise<implicitReturnType>;
358
- wapiPostSubAccountTransfer(params?: {}): Promise<implicitReturnType>;
359
- wapiGetDepositHistory(params?: {}): Promise<implicitReturnType>;
360
- wapiGetWithdrawHistory(params?: {}): Promise<implicitReturnType>;
361
- wapiGetDepositAddress(params?: {}): Promise<implicitReturnType>;
362
- wapiGetAccountStatus(params?: {}): Promise<implicitReturnType>;
363
- wapiGetSystemStatus(params?: {}): Promise<implicitReturnType>;
364
- wapiGetApiTradingStatus(params?: {}): Promise<implicitReturnType>;
365
- wapiGetUserAssetDribbletLog(params?: {}): Promise<implicitReturnType>;
366
- wapiGetTradeFee(params?: {}): Promise<implicitReturnType>;
367
- wapiGetAssetDetail(params?: {}): Promise<implicitReturnType>;
368
- wapiGetSubAccountList(params?: {}): Promise<implicitReturnType>;
369
- wapiGetSubAccountTransferHistory(params?: {}): Promise<implicitReturnType>;
370
- wapiGetSubAccountAssets(params?: {}): Promise<implicitReturnType>;
371
357
  dapiPublicGetPing(params?: {}): Promise<implicitReturnType>;
372
358
  dapiPublicGetTime(params?: {}): Promise<implicitReturnType>;
373
359
  dapiPublicGetExchangeInfo(params?: {}): Promise<implicitReturnType>;
@@ -453,6 +439,7 @@ interface binance {
453
439
  fapiPublicGetConstituents(params?: {}): Promise<implicitReturnType>;
454
440
  fapiPublicGetApiTradingStatus(params?: {}): Promise<implicitReturnType>;
455
441
  fapiPublicGetLvtKlines(params?: {}): Promise<implicitReturnType>;
442
+ fapiDataGetDeliveryPrice(params?: {}): Promise<implicitReturnType>;
456
443
  fapiDataGetOpenInterestHist(params?: {}): Promise<implicitReturnType>;
457
444
  fapiDataGetTopLongShortAccountRatio(params?: {}): Promise<implicitReturnType>;
458
445
  fapiDataGetTopLongShortPositionRatio(params?: {}): Promise<implicitReturnType>;
@@ -354,20 +354,6 @@ interface binance {
354
354
  sapiV3GetSubAccountAssets(params?: {}): Promise<implicitReturnType>;
355
355
  sapiV3PostAssetGetUserAsset(params?: {}): Promise<implicitReturnType>;
356
356
  sapiV4GetSubAccountAssets(params?: {}): Promise<implicitReturnType>;
357
- wapiPostWithdraw(params?: {}): Promise<implicitReturnType>;
358
- wapiPostSubAccountTransfer(params?: {}): Promise<implicitReturnType>;
359
- wapiGetDepositHistory(params?: {}): Promise<implicitReturnType>;
360
- wapiGetWithdrawHistory(params?: {}): Promise<implicitReturnType>;
361
- wapiGetDepositAddress(params?: {}): Promise<implicitReturnType>;
362
- wapiGetAccountStatus(params?: {}): Promise<implicitReturnType>;
363
- wapiGetSystemStatus(params?: {}): Promise<implicitReturnType>;
364
- wapiGetApiTradingStatus(params?: {}): Promise<implicitReturnType>;
365
- wapiGetUserAssetDribbletLog(params?: {}): Promise<implicitReturnType>;
366
- wapiGetTradeFee(params?: {}): Promise<implicitReturnType>;
367
- wapiGetAssetDetail(params?: {}): Promise<implicitReturnType>;
368
- wapiGetSubAccountList(params?: {}): Promise<implicitReturnType>;
369
- wapiGetSubAccountTransferHistory(params?: {}): Promise<implicitReturnType>;
370
- wapiGetSubAccountAssets(params?: {}): Promise<implicitReturnType>;
371
357
  dapiPublicGetPing(params?: {}): Promise<implicitReturnType>;
372
358
  dapiPublicGetTime(params?: {}): Promise<implicitReturnType>;
373
359
  dapiPublicGetExchangeInfo(params?: {}): Promise<implicitReturnType>;
@@ -453,6 +439,7 @@ interface binance {
453
439
  fapiPublicGetConstituents(params?: {}): Promise<implicitReturnType>;
454
440
  fapiPublicGetApiTradingStatus(params?: {}): Promise<implicitReturnType>;
455
441
  fapiPublicGetLvtKlines(params?: {}): Promise<implicitReturnType>;
442
+ fapiDataGetDeliveryPrice(params?: {}): Promise<implicitReturnType>;
456
443
  fapiDataGetOpenInterestHist(params?: {}): Promise<implicitReturnType>;
457
444
  fapiDataGetTopLongShortAccountRatio(params?: {}): Promise<implicitReturnType>;
458
445
  fapiDataGetTopLongShortPositionRatio(params?: {}): Promise<implicitReturnType>;
@@ -354,20 +354,6 @@ interface binance {
354
354
  sapiV3GetSubAccountAssets(params?: {}): Promise<implicitReturnType>;
355
355
  sapiV3PostAssetGetUserAsset(params?: {}): Promise<implicitReturnType>;
356
356
  sapiV4GetSubAccountAssets(params?: {}): Promise<implicitReturnType>;
357
- wapiPostWithdraw(params?: {}): Promise<implicitReturnType>;
358
- wapiPostSubAccountTransfer(params?: {}): Promise<implicitReturnType>;
359
- wapiGetDepositHistory(params?: {}): Promise<implicitReturnType>;
360
- wapiGetWithdrawHistory(params?: {}): Promise<implicitReturnType>;
361
- wapiGetDepositAddress(params?: {}): Promise<implicitReturnType>;
362
- wapiGetAccountStatus(params?: {}): Promise<implicitReturnType>;
363
- wapiGetSystemStatus(params?: {}): Promise<implicitReturnType>;
364
- wapiGetApiTradingStatus(params?: {}): Promise<implicitReturnType>;
365
- wapiGetUserAssetDribbletLog(params?: {}): Promise<implicitReturnType>;
366
- wapiGetTradeFee(params?: {}): Promise<implicitReturnType>;
367
- wapiGetAssetDetail(params?: {}): Promise<implicitReturnType>;
368
- wapiGetSubAccountList(params?: {}): Promise<implicitReturnType>;
369
- wapiGetSubAccountTransferHistory(params?: {}): Promise<implicitReturnType>;
370
- wapiGetSubAccountAssets(params?: {}): Promise<implicitReturnType>;
371
357
  dapiPublicGetPing(params?: {}): Promise<implicitReturnType>;
372
358
  dapiPublicGetTime(params?: {}): Promise<implicitReturnType>;
373
359
  dapiPublicGetExchangeInfo(params?: {}): Promise<implicitReturnType>;
@@ -453,6 +439,7 @@ interface binance {
453
439
  fapiPublicGetConstituents(params?: {}): Promise<implicitReturnType>;
454
440
  fapiPublicGetApiTradingStatus(params?: {}): Promise<implicitReturnType>;
455
441
  fapiPublicGetLvtKlines(params?: {}): Promise<implicitReturnType>;
442
+ fapiDataGetDeliveryPrice(params?: {}): Promise<implicitReturnType>;
456
443
  fapiDataGetOpenInterestHist(params?: {}): Promise<implicitReturnType>;
457
444
  fapiDataGetTopLongShortAccountRatio(params?: {}): Promise<implicitReturnType>;
458
445
  fapiDataGetTopLongShortPositionRatio(params?: {}): Promise<implicitReturnType>;
@@ -79,8 +79,6 @@ interface Exchange {
79
79
  privateSubAccountsPostSubAccountsUserIdUnlock(params?: {}): Promise<implicitReturnType>;
80
80
  privateSubAccountsPutSubAccountsUserIdKeysKey(params?: {}): Promise<implicitReturnType>;
81
81
  privateSubAccountsDeleteSubAccountsUserIdKeysKey(params?: {}): Promise<implicitReturnType>;
82
- privatePortfolioGetSpotCurrencyPairs(params?: {}): Promise<implicitReturnType>;
83
- privatePortfolioGetSpotCurrencyPairsCurrencyPair(params?: {}): Promise<implicitReturnType>;
84
82
  privatePortfolioGetAccounts(params?: {}): Promise<implicitReturnType>;
85
83
  privatePortfolioGetAccountMode(params?: {}): Promise<implicitReturnType>;
86
84
  privatePortfolioGetBorrowable(params?: {}): Promise<implicitReturnType>;
@@ -88,13 +86,8 @@ interface Exchange {
88
86
  privatePortfolioGetLoans(params?: {}): Promise<implicitReturnType>;
89
87
  privatePortfolioGetLoanRecords(params?: {}): Promise<implicitReturnType>;
90
88
  privatePortfolioGetInterestRecords(params?: {}): Promise<implicitReturnType>;
91
- privatePortfolioGetSpotOrders(params?: {}): Promise<implicitReturnType>;
92
- privatePortfolioGetSpotOrdersOrderId(params?: {}): Promise<implicitReturnType>;
93
89
  privatePortfolioPostAccountMode(params?: {}): Promise<implicitReturnType>;
94
90
  privatePortfolioPostLoans(params?: {}): Promise<implicitReturnType>;
95
- privatePortfolioPostSpotOrders(params?: {}): Promise<implicitReturnType>;
96
- privatePortfolioDeleteSpotOrdersOrderId(params?: {}): Promise<implicitReturnType>;
97
- privatePortfolioPatchSpotOrdersOrderId(params?: {}): Promise<implicitReturnType>;
98
91
  privateSpotGetFee(params?: {}): Promise<implicitReturnType>;
99
92
  privateSpotGetBatchFee(params?: {}): Promise<implicitReturnType>;
100
93
  privateSpotGetAccounts(params?: {}): Promise<implicitReturnType>;
@@ -110,6 +103,7 @@ interface Exchange {
110
103
  privateSpotPostOrders(params?: {}): Promise<implicitReturnType>;
111
104
  privateSpotPostCancelBatchOrders(params?: {}): Promise<implicitReturnType>;
112
105
  privateSpotPostCountdownCancelAll(params?: {}): Promise<implicitReturnType>;
106
+ privateSpotPostAmendBatchOrders(params?: {}): Promise<implicitReturnType>;
113
107
  privateSpotPostPriceOrders(params?: {}): Promise<implicitReturnType>;
114
108
  privateSpotDeleteOrders(params?: {}): Promise<implicitReturnType>;
115
109
  privateSpotDeleteOrdersOrderId(params?: {}): Promise<implicitReturnType>;
@@ -227,6 +221,7 @@ interface Exchange {
227
221
  privateEarnGetUniInterestsCurrency(params?: {}): Promise<implicitReturnType>;
228
222
  privateEarnGetUniInterestRecords(params?: {}): Promise<implicitReturnType>;
229
223
  privateEarnPostUniLends(params?: {}): Promise<implicitReturnType>;
224
+ privateEarnPutUniInterestReinvest(params?: {}): Promise<implicitReturnType>;
230
225
  privateEarnPatchUniLends(params?: {}): Promise<implicitReturnType>;
231
226
  privateLoanGetCollateralOrders(params?: {}): Promise<implicitReturnType>;
232
227
  privateLoanGetCollateralOrdersOrderId(params?: {}): Promise<implicitReturnType>;
@@ -79,8 +79,6 @@ interface gate {
79
79
  privateSubAccountsPostSubAccountsUserIdUnlock(params?: {}): Promise<implicitReturnType>;
80
80
  privateSubAccountsPutSubAccountsUserIdKeysKey(params?: {}): Promise<implicitReturnType>;
81
81
  privateSubAccountsDeleteSubAccountsUserIdKeysKey(params?: {}): Promise<implicitReturnType>;
82
- privatePortfolioGetSpotCurrencyPairs(params?: {}): Promise<implicitReturnType>;
83
- privatePortfolioGetSpotCurrencyPairsCurrencyPair(params?: {}): Promise<implicitReturnType>;
84
82
  privatePortfolioGetAccounts(params?: {}): Promise<implicitReturnType>;
85
83
  privatePortfolioGetAccountMode(params?: {}): Promise<implicitReturnType>;
86
84
  privatePortfolioGetBorrowable(params?: {}): Promise<implicitReturnType>;
@@ -88,13 +86,8 @@ interface gate {
88
86
  privatePortfolioGetLoans(params?: {}): Promise<implicitReturnType>;
89
87
  privatePortfolioGetLoanRecords(params?: {}): Promise<implicitReturnType>;
90
88
  privatePortfolioGetInterestRecords(params?: {}): Promise<implicitReturnType>;
91
- privatePortfolioGetSpotOrders(params?: {}): Promise<implicitReturnType>;
92
- privatePortfolioGetSpotOrdersOrderId(params?: {}): Promise<implicitReturnType>;
93
89
  privatePortfolioPostAccountMode(params?: {}): Promise<implicitReturnType>;
94
90
  privatePortfolioPostLoans(params?: {}): Promise<implicitReturnType>;
95
- privatePortfolioPostSpotOrders(params?: {}): Promise<implicitReturnType>;
96
- privatePortfolioDeleteSpotOrdersOrderId(params?: {}): Promise<implicitReturnType>;
97
- privatePortfolioPatchSpotOrdersOrderId(params?: {}): Promise<implicitReturnType>;
98
91
  privateSpotGetFee(params?: {}): Promise<implicitReturnType>;
99
92
  privateSpotGetBatchFee(params?: {}): Promise<implicitReturnType>;
100
93
  privateSpotGetAccounts(params?: {}): Promise<implicitReturnType>;
@@ -110,6 +103,7 @@ interface gate {
110
103
  privateSpotPostOrders(params?: {}): Promise<implicitReturnType>;
111
104
  privateSpotPostCancelBatchOrders(params?: {}): Promise<implicitReturnType>;
112
105
  privateSpotPostCountdownCancelAll(params?: {}): Promise<implicitReturnType>;
106
+ privateSpotPostAmendBatchOrders(params?: {}): Promise<implicitReturnType>;
113
107
  privateSpotPostPriceOrders(params?: {}): Promise<implicitReturnType>;
114
108
  privateSpotDeleteOrders(params?: {}): Promise<implicitReturnType>;
115
109
  privateSpotDeleteOrdersOrderId(params?: {}): Promise<implicitReturnType>;
@@ -227,6 +221,7 @@ interface gate {
227
221
  privateEarnGetUniInterestsCurrency(params?: {}): Promise<implicitReturnType>;
228
222
  privateEarnGetUniInterestRecords(params?: {}): Promise<implicitReturnType>;
229
223
  privateEarnPostUniLends(params?: {}): Promise<implicitReturnType>;
224
+ privateEarnPutUniInterestReinvest(params?: {}): Promise<implicitReturnType>;
230
225
  privateEarnPatchUniLends(params?: {}): Promise<implicitReturnType>;
231
226
  privateLoanGetCollateralOrders(params?: {}): Promise<implicitReturnType>;
232
227
  privateLoanGetCollateralOrdersOrderId(params?: {}): Promise<implicitReturnType>;
package/js/src/ace.js CHANGED
@@ -1017,7 +1017,7 @@ export default class ace extends Exchange {
1017
1017
  'timeStamp': nonce,
1018
1018
  }, params);
1019
1019
  const dataKeys = Object.keys(data);
1020
- const sortedDataKeys = this.sortBy(dataKeys, 0);
1020
+ const sortedDataKeys = this.sortBy(dataKeys, 0, false, '');
1021
1021
  for (let i = 0; i < sortedDataKeys.length; i++) {
1022
1022
  const key = sortedDataKeys[i];
1023
1023
  auth += this.safeString(data, key);
@@ -4,7 +4,7 @@ ExchangeError, AuthenticationError, DDoSProtection, RequestTimeout, ExchangeNotA
4
4
  import WsClient from './ws/WsClient.js';
5
5
  import { Future } from './ws/Future.js';
6
6
  import { OrderBook as WsOrderBook, IndexedOrderBook, CountedOrderBook } from './ws/OrderBook.js';
7
- import { Market, Trade, Ticker, OHLCV, OHLCVC, Order, OrderBook, Balance, Balances, Dictionary, DepositAddressResponse, Currency, MinMax, IndexType, Int, OrderType, OrderSide, Position, FundingRateHistory, OpenInterest, Liquidation } from './types.js';
7
+ import { Market, Trade, Ticker, OHLCV, OHLCVC, Order, OrderBook, Balance, Balances, Dictionary, DepositAddressResponse, Currency, MinMax, IndexType, Int, OrderType, OrderSide, Position, FundingRateHistory, OpenInterest, Liquidation, OrderRequest } from './types.js';
8
8
  export { Market, Trade, Fee, Ticker, OHLCV, OHLCVC, Order, OrderBook, Balance, Balances, Dictionary, Transaction, DepositAddressResponse, Currency, MinMax, IndexType, Int, OrderType, OrderSide, Position, FundingRateHistory, Liquidation } from './types.js';
9
9
  /**
10
10
  * @class Exchange
@@ -161,7 +161,7 @@ export default class Exchange {
161
161
  flatten: (x: any, out?: any[]) => any[];
162
162
  unique: (x: any) => any[];
163
163
  indexBy: (x: any, k: any, out?: {}) => {};
164
- sortBy: (array: any, key: any, descending?: boolean, direction?: number) => any;
164
+ sortBy: (array: any, key: any, descending?: boolean, defaultValue?: any, direction?: number) => any;
165
165
  sortBy2: (array: any, key1: any, key2: any, descending?: boolean, direction?: number) => any;
166
166
  groupBy: (x: any, k: any, out?: {}) => {};
167
167
  aggregate: typeof functions.aggregate;
@@ -285,6 +285,7 @@ export default class Exchange {
285
285
  createLimitOrder: boolean;
286
286
  createMarketOrder: boolean;
287
287
  createOrder: boolean;
288
+ createOrders: any;
288
289
  createPostOnlyOrder: any;
289
290
  createReduceOnlyOrder: any;
290
291
  createStopOrder: any;
@@ -714,6 +715,7 @@ export default class Exchange {
714
715
  fetchOrderStatus(id: string, symbol?: string, params?: {}): Promise<string>;
715
716
  fetchUnifiedOrder(order: any, params?: {}): Promise<Order>;
716
717
  createOrder(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, params?: {}): Promise<Order>;
718
+ createOrders(orders: OrderRequest[], params?: {}): Promise<Order[]>;
717
719
  createOrderWs(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: number, params?: {}): Promise<Order>;
718
720
  cancelOrder(id: string, symbol?: string, params?: {}): Promise<any>;
719
721
  cancelOrderWs(id: string, symbol?: string, params?: {}): Promise<any>;
@@ -335,6 +335,7 @@ export default class Exchange {
335
335
  'createLimitOrder': true,
336
336
  'createMarketOrder': true,
337
337
  'createOrder': true,
338
+ 'createOrders': undefined,
338
339
  'createPostOnlyOrder': undefined,
339
340
  'createReduceOnlyOrder': undefined,
340
341
  'createStopOrder': undefined,
@@ -1609,7 +1610,7 @@ export default class Exchange {
1609
1610
  this.markets_by_id = {};
1610
1611
  // handle marketId conflicts
1611
1612
  // we insert spot markets first
1612
- const marketValues = this.sortBy(this.toArray(markets), 'spot', true);
1613
+ const marketValues = this.sortBy(this.toArray(markets), 'spot', true, true);
1613
1614
  for (let i = 0; i < marketValues.length; i++) {
1614
1615
  const value = marketValues[i];
1615
1616
  if (value['id'] in this.markets_by_id) {
@@ -1659,8 +1660,8 @@ export default class Exchange {
1659
1660
  quoteCurrencies.push(currency);
1660
1661
  }
1661
1662
  }
1662
- baseCurrencies = this.sortBy(baseCurrencies, 'code');
1663
- quoteCurrencies = this.sortBy(quoteCurrencies, 'code');
1663
+ baseCurrencies = this.sortBy(baseCurrencies, 'code', false, '');
1664
+ quoteCurrencies = this.sortBy(quoteCurrencies, 'code', false, '');
1664
1665
  this.baseCurrencies = this.indexBy(baseCurrencies, 'code');
1665
1666
  this.quoteCurrencies = this.indexBy(quoteCurrencies, 'code');
1666
1667
  const allCurrencies = this.arrayConcat(baseCurrencies, quoteCurrencies);
@@ -3322,6 +3323,9 @@ export default class Exchange {
3322
3323
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
3323
3324
  throw new NotSupported(this.id + ' createOrder() is not supported yet');
3324
3325
  }
3326
+ async createOrders(orders, params = {}) {
3327
+ throw new NotSupported(this.id + ' createOrders() is not supported yet');
3328
+ }
3325
3329
  async createOrderWs(symbol, type, side, amount, price = undefined, params = {}) {
3326
3330
  throw new NotSupported(this.id + ' createOrderWs() is not supported yet');
3327
3331
  }
@@ -10,6 +10,7 @@ declare function ecdsa(request: Hex, secret: Hex, curve: CurveFn, prehash?: CHas
10
10
  s: string;
11
11
  v: number;
12
12
  };
13
- declare function eddsa(request: Hex, secret: Hex, curve: CurveFnEDDSA): string;
13
+ declare function axolotl(request: Hex, secret: Hex, curve: CurveFnEDDSA): string;
14
+ declare function eddsa(request: Hex, secret: string, curve: CurveFnEDDSA): string;
14
15
  declare function crc32(str: any, signed?: boolean): number;
15
- export { hash, hmac, crc32, ecdsa, eddsa, };
16
+ export { hash, hmac, crc32, ecdsa, eddsa, axolotl, };
@@ -7,6 +7,7 @@
7
7
  /* ------------------------------------------------------------------------ */
8
8
  import { hmac as _hmac } from '../../static_dependencies/noble-hashes/hmac.js';
9
9
  import { base16, base64, base58 } from '../../static_dependencies/scure-base/index.js';
10
+ import { Base64 } from '../../static_dependencies/jsencrypt/lib/asn1js/base64.js';
10
11
  /* ------------------------------------------------------------------------ */
11
12
  const encoders = {
12
13
  binary: x => x,
@@ -35,11 +36,18 @@ function ecdsa(request, secret, curve, prehash = null) {
35
36
  'v': signature.recovery,
36
37
  };
37
38
  }
38
- function eddsa(request, secret, curve) {
39
+ function axolotl(request, secret, curve) {
39
40
  // used for waves.exchange (that's why the output is base58)
40
- const signature = curve.sign(request, secret);
41
+ const signature = curve.signModified(request, secret);
41
42
  return base58.encode(signature);
42
43
  }
44
+ function eddsa(request, secret, curve) {
45
+ // secret is the base64 pem encoded key
46
+ // we get the last 32 bytes
47
+ const privateKey = new Uint8Array(Base64.unarmor(secret).slice(16));
48
+ const signature = curve.sign(request, privateKey);
49
+ return base64.encode(signature);
50
+ }
43
51
  /* ------------------------------------------------------------------------ */
44
52
  // source: https://stackoverflow.com/a/18639975/1067003
45
53
  function crc32(str, signed = false) {
@@ -62,5 +70,5 @@ function crc32(str, signed = false) {
62
70
  }
63
71
  }
64
72
  /* ------------------------------------------------------------------------ */
65
- export { hash, hmac, crc32, ecdsa, eddsa, };
73
+ export { hash, hmac, crc32, ecdsa, eddsa, axolotl, };
66
74
  /* ------------------------------------------------------------------------ */
@@ -16,7 +16,7 @@ declare const keysort: (x: any, out?: {}) => {};
16
16
  declare const groupBy: (x: any, k: any, out?: {}) => {};
17
17
  declare const indexBy: (x: any, k: any, out?: {}) => {};
18
18
  declare const filterBy: (x: any, k: any, value?: any, out?: any[]) => any[];
19
- declare const sortBy: (array: any, key: any, descending?: boolean, direction?: number) => any;
19
+ declare const sortBy: (array: any, key: any, descending?: boolean, defaultValue?: any, direction?: number) => any;
20
20
  declare const sortBy2: (array: any, key1: any, key2: any, descending?: boolean, direction?: number) => any;
21
21
  declare const flatten: (x: any, out?: any[]) => any[];
22
22
  declare const pluck: (x: any, k: any) => any[];
@@ -72,11 +72,13 @@ const filterBy = (x, k, value = undefined, out = []) => {
72
72
  }
73
73
  return out;
74
74
  };
75
- const sortBy = (array, key, descending = false, direction = descending ? -1 : 1) => array.sort((a, b) => {
76
- if (a[key] < b[key]) {
75
+ const sortBy = (array, key, descending = false, defaultValue = 0, direction = descending ? -1 : 1) => array.sort((a, b) => {
76
+ const first = (key in a) ? a[key] : defaultValue;
77
+ const second = (key in b) ? b[key] : defaultValue;
78
+ if (first < second) {
77
79
  return -direction;
78
80
  }
79
- else if (a[key] > b[key]) {
81
+ else if (first > second) {
80
82
  return direction;
81
83
  }
82
84
  else {
@@ -230,6 +230,14 @@ export interface Liquidation {
230
230
  baseValue?: number;
231
231
  quoteValue?: number;
232
232
  }
233
+ export interface OrderRequest {
234
+ symbol: string;
235
+ type: string;
236
+ side: string;
237
+ amount?: number;
238
+ price?: number | undefined;
239
+ params?: any;
240
+ }
233
241
  /** [ timestamp, open, high, low, close, volume ] */
234
242
  export declare type OHLCV = [number, number, number, number, number, number];
235
243
  /** [ timestamp, open, high, low, close, volume, count ] */
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/binance.js';
2
- import { Market, Int, OrderSide, Balances, OrderType, Trade, OHLCV, Order, FundingRateHistory, OpenInterest, Liquidation } from './base/types.js';
2
+ import { Market, Int, OrderSide, Balances, OrderType, Trade, OHLCV, Order, FundingRateHistory, OpenInterest, Liquidation, OrderRequest } from './base/types.js';
3
3
  /**
4
4
  * @class binance
5
5
  * @extends Exchange
@@ -124,6 +124,7 @@ export default class binance extends Exchange {
124
124
  editOrder(id: string, symbol: any, type: any, side: any, amount?: any, price?: any, params?: {}): Promise<Order>;
125
125
  parseOrderStatus(status: any): string;
126
126
  parseOrder(order: any, market?: any): Order;
127
+ createOrders(orders: OrderRequest[], params?: {}): Promise<Order[]>;
127
128
  createOrder(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, params?: {}): Promise<Order>;
128
129
  createOrderRequest(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, params?: {}): any;
129
130
  fetchOrder(id: string, symbol?: string, params?: {}): Promise<Order>;