ccxt 4.2.44 → 4.2.45

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/js/src/binance.js CHANGED
@@ -102,7 +102,7 @@ export default class binance extends Exchange {
102
102
  'fetchOHLCV': true,
103
103
  'fetchOpenInterest': true,
104
104
  'fetchOpenInterestHistory': true,
105
- 'fetchOpenOrder': false,
105
+ 'fetchOpenOrder': true,
106
106
  'fetchOpenOrders': true,
107
107
  'fetchOrder': true,
108
108
  'fetchOrderBook': true,
@@ -5171,7 +5171,7 @@ export default class binance extends Exchange {
5171
5171
  // "status": "NEW"
5172
5172
  // }
5173
5173
  //
5174
- // createOrder, fetchOpenOrders: portfolio margin linear swap and future conditional
5174
+ // createOrder, fetchOpenOrders, fetchOpenOrder: portfolio margin linear swap and future conditional
5175
5175
  //
5176
5176
  // {
5177
5177
  // "newClientStrategyId": "x-xcKtGhcu27f109953d6e4dc0974006",
@@ -5310,6 +5310,130 @@ export default class binance extends Exchange {
5310
5310
  // "selfTradePreventionMode": "NONE"
5311
5311
  // }
5312
5312
  //
5313
+ // fetchOpenOrder: linear swap
5314
+ //
5315
+ // {
5316
+ // "orderId": 3697213934,
5317
+ // "symbol": "BTCUSDT",
5318
+ // "status": "NEW",
5319
+ // "clientOrderId": "x-xcKtGhcufb20c5a7761a4aa09aa156",
5320
+ // "price": "33000.00",
5321
+ // "avgPrice": "0.00000",
5322
+ // "origQty": "0.010",
5323
+ // "executedQty": "0.000",
5324
+ // "cumQuote": "0.00000",
5325
+ // "timeInForce": "GTC",
5326
+ // "type": "LIMIT",
5327
+ // "reduceOnly": false,
5328
+ // "closePosition": false,
5329
+ // "side": "BUY",
5330
+ // "positionSide": "BOTH",
5331
+ // "stopPrice": "0.00",
5332
+ // "workingType": "CONTRACT_PRICE",
5333
+ // "priceProtect": false,
5334
+ // "origType": "LIMIT",
5335
+ // "priceMatch": "NONE",
5336
+ // "selfTradePreventionMode": "NONE",
5337
+ // "goodTillDate": 0,
5338
+ // "time": 1707892893502,
5339
+ // "updateTime": 1707892893515
5340
+ // }
5341
+ //
5342
+ // fetchOpenOrder: inverse swap
5343
+ //
5344
+ // {
5345
+ // "orderId": 597368542,
5346
+ // "symbol": "BTCUSD_PERP",
5347
+ // "pair": "BTCUSD",
5348
+ // "status": "NEW",
5349
+ // "clientOrderId": "x-xcKtGhcubbde7ba93b1a4ab881eff3",
5350
+ // "price": "35000",
5351
+ // "avgPrice": "0",
5352
+ // "origQty": "1",
5353
+ // "executedQty": "0",
5354
+ // "cumBase": "0",
5355
+ // "timeInForce": "GTC",
5356
+ // "type": "LIMIT",
5357
+ // "reduceOnly": false,
5358
+ // "closePosition": false,
5359
+ // "side": "BUY",
5360
+ // "positionSide": "BOTH",
5361
+ // "stopPrice": "0",
5362
+ // "workingType": "CONTRACT_PRICE",
5363
+ // "priceProtect": false,
5364
+ // "origType": "LIMIT",
5365
+ // "time": 1707893453199,
5366
+ // "updateTime": 1707893453199
5367
+ // }
5368
+ //
5369
+ // fetchOpenOrder: linear portfolio margin
5370
+ //
5371
+ // {
5372
+ // "orderId": 264895013409,
5373
+ // "symbol": "BTCUSDT",
5374
+ // "status": "NEW",
5375
+ // "clientOrderId": "x-xcKtGhcu6278f1adbdf14f74ab432e",
5376
+ // "price": "35000",
5377
+ // "avgPrice": "0",
5378
+ // "origQty": "0.010",
5379
+ // "executedQty": "0",
5380
+ // "cumQuote": "0",
5381
+ // "timeInForce": "GTC",
5382
+ // "type": "LIMIT",
5383
+ // "reduceOnly": false,
5384
+ // "side": "BUY",
5385
+ // "positionSide": "LONG",
5386
+ // "origType": "LIMIT",
5387
+ // "time": 1707893839364,
5388
+ // "updateTime": 1707893839364,
5389
+ // "goodTillDate": 0,
5390
+ // "selfTradePreventionMode": "NONE"
5391
+ // }
5392
+ //
5393
+ // fetchOpenOrder: inverse portfolio margin
5394
+ //
5395
+ // {
5396
+ // "orderId": 71790316950,
5397
+ // "symbol": "ETHUSD_PERP",
5398
+ // "pair": "ETHUSD",
5399
+ // "status": "NEW",
5400
+ // "clientOrderId": "x-xcKtGhcuec11030474204ab08ba2c2",
5401
+ // "price": "2500",
5402
+ // "avgPrice": "0",
5403
+ // "origQty": "1",
5404
+ // "executedQty": "0",
5405
+ // "cumBase": "0",
5406
+ // "timeInForce": "GTC",
5407
+ // "type": "LIMIT",
5408
+ // "reduceOnly": false,
5409
+ // "side": "BUY",
5410
+ // "positionSide": "LONG",
5411
+ // "origType": "LIMIT",
5412
+ // "time": 1707894181694,
5413
+ // "updateTime": 1707894181694
5414
+ // }
5415
+ //
5416
+ // fetchOpenOrder: inverse portfolio margin conditional
5417
+ //
5418
+ // {
5419
+ // "newClientStrategyId": "x-xcKtGhcu2da9c765294b433994ffce",
5420
+ // "strategyId": 1423501,
5421
+ // "strategyStatus": "NEW",
5422
+ // "strategyType": "STOP",
5423
+ // "origQty": "1",
5424
+ // "price": "2500",
5425
+ // "reduceOnly": false,
5426
+ // "side": "BUY",
5427
+ // "positionSide": "LONG",
5428
+ // "stopPrice": "4000",
5429
+ // "symbol": "ETHUSD_PERP",
5430
+ // "bookTime": 1707894782679,
5431
+ // "updateTime": 1707894782679,
5432
+ // "timeInForce": "GTC",
5433
+ // "workingType": "CONTRACT_PRICE",
5434
+ // "priceProtect": false
5435
+ // }
5436
+ //
5313
5437
  const code = this.safeString(order, 'code');
5314
5438
  if (code !== undefined) {
5315
5439
  // cancelOrders/createOrders might have a partial success
@@ -6309,7 +6433,7 @@ export default class binance extends Exchange {
6309
6433
  [marginMode, params] = this.handleMarginModeAndParams('fetchOpenOrders', params);
6310
6434
  let isPortfolioMargin = undefined;
6311
6435
  [isPortfolioMargin, params] = this.handleOptionAndParams2(params, 'fetchOpenOrders', 'papi', 'portfolioMargin', false);
6312
- const isConditional = this.safeBool2(params, 'stop', 'conditional');
6436
+ const isConditional = this.safeBoolN(params, ['stop', 'conditional', 'trigger']);
6313
6437
  if (symbol !== undefined) {
6314
6438
  market = this.market(symbol);
6315
6439
  request['symbol'] = market['id'];
@@ -6329,7 +6453,7 @@ export default class binance extends Exchange {
6329
6453
  }
6330
6454
  let subType = undefined;
6331
6455
  [subType, params] = this.handleSubTypeAndParams('fetchOpenOrders', market, params);
6332
- params = this.omit(params, ['type', 'stop', 'conditional']);
6456
+ params = this.omit(params, ['type', 'stop', 'conditional', 'trigger']);
6333
6457
  let response = undefined;
6334
6458
  if (type === 'option') {
6335
6459
  if (since !== undefined) {
@@ -6385,6 +6509,223 @@ export default class binance extends Exchange {
6385
6509
  }
6386
6510
  return this.parseOrders(response, market, since, limit);
6387
6511
  }
6512
+ async fetchOpenOrder(id, symbol = undefined, params = {}) {
6513
+ /**
6514
+ * @method
6515
+ * @name binance#fetchOpenOrder
6516
+ * @description fetch an open order by the id
6517
+ * @see https://binance-docs.github.io/apidocs/futures/en/#query-current-open-order-user_data
6518
+ * @see https://binance-docs.github.io/apidocs/delivery/en/#query-current-open-order-user_data
6519
+ * @see https://binance-docs.github.io/apidocs/pm/en/#query-current-um-open-order-user_data
6520
+ * @see https://binance-docs.github.io/apidocs/pm/en/#query-current-cm-open-order-user_data
6521
+ * @see https://binance-docs.github.io/apidocs/pm/en/#query-current-um-open-conditional-order-user_data
6522
+ * @see https://binance-docs.github.io/apidocs/pm/en/#query-current-cm-open-conditional-order-user_data
6523
+ * @param {string} id order id
6524
+ * @param {string} symbol unified market symbol
6525
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
6526
+ * @param {string} [params.trigger] set to true if you would like to fetch portfolio margin account stop or conditional orders
6527
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
6528
+ */
6529
+ if (symbol === undefined) {
6530
+ throw new ArgumentsRequired(this.id + ' fetchOpenOrder() requires a symbol argument');
6531
+ }
6532
+ await this.loadMarkets();
6533
+ const market = this.market(symbol);
6534
+ const request = {
6535
+ 'symbol': market['id'],
6536
+ };
6537
+ let isPortfolioMargin = undefined;
6538
+ [isPortfolioMargin, params] = this.handleOptionAndParams2(params, 'fetchOpenOrder', 'papi', 'portfolioMargin', false);
6539
+ const isConditional = this.safeBoolN(params, ['stop', 'conditional', 'trigger']);
6540
+ params = this.omit(params, ['stop', 'conditional', 'trigger']);
6541
+ const isPortfolioMarginConditional = (isPortfolioMargin && isConditional);
6542
+ const orderIdRequest = isPortfolioMarginConditional ? 'strategyId' : 'orderId';
6543
+ request[orderIdRequest] = id;
6544
+ let response = undefined;
6545
+ if (market['linear']) {
6546
+ if (isPortfolioMargin) {
6547
+ if (isConditional) {
6548
+ response = await this.papiGetUmConditionalOpenOrder(this.extend(request, params));
6549
+ }
6550
+ else {
6551
+ response = await this.papiGetUmOpenOrder(this.extend(request, params));
6552
+ }
6553
+ }
6554
+ else {
6555
+ response = await this.fapiPrivateGetOpenOrder(this.extend(request, params));
6556
+ }
6557
+ }
6558
+ else if (market['inverse']) {
6559
+ if (isPortfolioMargin) {
6560
+ if (isConditional) {
6561
+ response = await this.papiGetCmConditionalOpenOrder(this.extend(request, params));
6562
+ }
6563
+ else {
6564
+ response = await this.papiGetCmOpenOrder(this.extend(request, params));
6565
+ }
6566
+ }
6567
+ else {
6568
+ response = await this.dapiPrivateGetOpenOrder(this.extend(request, params));
6569
+ }
6570
+ }
6571
+ else {
6572
+ if (market['option']) {
6573
+ throw new NotSupported(this.id + ' fetchOpenOrder() does not support option markets');
6574
+ }
6575
+ else if (market['spot']) {
6576
+ throw new NotSupported(this.id + ' fetchOpenOrder() does not support spot markets');
6577
+ }
6578
+ }
6579
+ //
6580
+ // linear swap
6581
+ //
6582
+ // {
6583
+ // "orderId": 3697213934,
6584
+ // "symbol": "BTCUSDT",
6585
+ // "status": "NEW",
6586
+ // "clientOrderId": "x-xcKtGhcufb20c5a7761a4aa09aa156",
6587
+ // "price": "33000.00",
6588
+ // "avgPrice": "0.00000",
6589
+ // "origQty": "0.010",
6590
+ // "executedQty": "0.000",
6591
+ // "cumQuote": "0.00000",
6592
+ // "timeInForce": "GTC",
6593
+ // "type": "LIMIT",
6594
+ // "reduceOnly": false,
6595
+ // "closePosition": false,
6596
+ // "side": "BUY",
6597
+ // "positionSide": "BOTH",
6598
+ // "stopPrice": "0.00",
6599
+ // "workingType": "CONTRACT_PRICE",
6600
+ // "priceProtect": false,
6601
+ // "origType": "LIMIT",
6602
+ // "priceMatch": "NONE",
6603
+ // "selfTradePreventionMode": "NONE",
6604
+ // "goodTillDate": 0,
6605
+ // "time": 1707892893502,
6606
+ // "updateTime": 1707892893515
6607
+ // }
6608
+ //
6609
+ // inverse swap
6610
+ //
6611
+ // {
6612
+ // "orderId": 597368542,
6613
+ // "symbol": "BTCUSD_PERP",
6614
+ // "pair": "BTCUSD",
6615
+ // "status": "NEW",
6616
+ // "clientOrderId": "x-xcKtGhcubbde7ba93b1a4ab881eff3",
6617
+ // "price": "35000",
6618
+ // "avgPrice": "0",
6619
+ // "origQty": "1",
6620
+ // "executedQty": "0",
6621
+ // "cumBase": "0",
6622
+ // "timeInForce": "GTC",
6623
+ // "type": "LIMIT",
6624
+ // "reduceOnly": false,
6625
+ // "closePosition": false,
6626
+ // "side": "BUY",
6627
+ // "positionSide": "BOTH",
6628
+ // "stopPrice": "0",
6629
+ // "workingType": "CONTRACT_PRICE",
6630
+ // "priceProtect": false,
6631
+ // "origType": "LIMIT",
6632
+ // "time": 1707893453199,
6633
+ // "updateTime": 1707893453199
6634
+ // }
6635
+ //
6636
+ // linear portfolio margin
6637
+ //
6638
+ // {
6639
+ // "orderId": 264895013409,
6640
+ // "symbol": "BTCUSDT",
6641
+ // "status": "NEW",
6642
+ // "clientOrderId": "x-xcKtGhcu6278f1adbdf14f74ab432e",
6643
+ // "price": "35000",
6644
+ // "avgPrice": "0",
6645
+ // "origQty": "0.010",
6646
+ // "executedQty": "0",
6647
+ // "cumQuote": "0",
6648
+ // "timeInForce": "GTC",
6649
+ // "type": "LIMIT",
6650
+ // "reduceOnly": false,
6651
+ // "side": "BUY",
6652
+ // "positionSide": "LONG",
6653
+ // "origType": "LIMIT",
6654
+ // "time": 1707893839364,
6655
+ // "updateTime": 1707893839364,
6656
+ // "goodTillDate": 0,
6657
+ // "selfTradePreventionMode": "NONE"
6658
+ // }
6659
+ //
6660
+ // inverse portfolio margin
6661
+ //
6662
+ // {
6663
+ // "orderId": 71790316950,
6664
+ // "symbol": "ETHUSD_PERP",
6665
+ // "pair": "ETHUSD",
6666
+ // "status": "NEW",
6667
+ // "clientOrderId": "x-xcKtGhcuec11030474204ab08ba2c2",
6668
+ // "price": "2500",
6669
+ // "avgPrice": "0",
6670
+ // "origQty": "1",
6671
+ // "executedQty": "0",
6672
+ // "cumBase": "0",
6673
+ // "timeInForce": "GTC",
6674
+ // "type": "LIMIT",
6675
+ // "reduceOnly": false,
6676
+ // "side": "BUY",
6677
+ // "positionSide": "LONG",
6678
+ // "origType": "LIMIT",
6679
+ // "time": 1707894181694,
6680
+ // "updateTime": 1707894181694
6681
+ // }
6682
+ //
6683
+ // linear portfolio margin conditional
6684
+ //
6685
+ // {
6686
+ // "newClientStrategyId": "x-xcKtGhcu2205fde44418483ca21874",
6687
+ // "strategyId": 4084339,
6688
+ // "strategyStatus": "NEW",
6689
+ // "strategyType": "STOP",
6690
+ // "origQty": "0.010",
6691
+ // "price": "35000",
6692
+ // "reduceOnly": false,
6693
+ // "side": "BUY",
6694
+ // "positionSide": "LONG",
6695
+ // "stopPrice": "60000",
6696
+ // "symbol": "BTCUSDT",
6697
+ // "bookTime": 1707894490094,
6698
+ // "updateTime": 1707894490094,
6699
+ // "timeInForce": "GTC",
6700
+ // "workingType": "CONTRACT_PRICE",
6701
+ // "priceProtect": false,
6702
+ // "goodTillDate": 0,
6703
+ // "selfTradePreventionMode": "NONE"
6704
+ // }
6705
+ //
6706
+ // inverse portfolio margin conditional
6707
+ //
6708
+ // {
6709
+ // "newClientStrategyId": "x-xcKtGhcu2da9c765294b433994ffce",
6710
+ // "strategyId": 1423501,
6711
+ // "strategyStatus": "NEW",
6712
+ // "strategyType": "STOP",
6713
+ // "origQty": "1",
6714
+ // "price": "2500",
6715
+ // "reduceOnly": false,
6716
+ // "side": "BUY",
6717
+ // "positionSide": "LONG",
6718
+ // "stopPrice": "4000",
6719
+ // "symbol": "ETHUSD_PERP",
6720
+ // "bookTime": 1707894782679,
6721
+ // "updateTime": 1707894782679,
6722
+ // "timeInForce": "GTC",
6723
+ // "workingType": "CONTRACT_PRICE",
6724
+ // "priceProtect": false
6725
+ // }
6726
+ //
6727
+ return this.parseOrder(response, market);
6728
+ }
6388
6729
  async fetchClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
6389
6730
  /**
6390
6731
  * @method
@@ -11298,12 +11639,16 @@ export default class binance extends Exchange {
11298
11639
  * @see https://binance-docs.github.io/apidocs/spot/en/#get-force-liquidation-record-user_data
11299
11640
  * @see https://binance-docs.github.io/apidocs/futures/en/#user-39-s-force-orders-user_data
11300
11641
  * @see https://binance-docs.github.io/apidocs/delivery/en/#user-39-s-force-orders-user_data
11642
+ * @see https://binance-docs.github.io/apidocs/pm/en/#query-user-39-s-margin-force-orders-user_data
11643
+ * @see https://binance-docs.github.io/apidocs/pm/en/#query-user-39-s-um-force-orders-user_data
11644
+ * @see https://binance-docs.github.io/apidocs/pm/en/#query-user-39-s-cm-force-orders-user_data
11301
11645
  * @param {string} [symbol] unified CCXT market symbol
11302
11646
  * @param {int} [since] the earliest time in ms to fetch liquidations for
11303
11647
  * @param {int} [limit] the maximum number of liquidation structures to retrieve
11304
11648
  * @param {object} [params] exchange specific parameters for the binance api endpoint
11305
11649
  * @param {int} [params.until] timestamp in ms of the latest liquidation
11306
11650
  * @param {boolean} [params.paginate] *spot only* default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
11651
+ * @param {boolean} [params.portfolioMargin] set to true if you would like to fetch liquidations in a portfolio margin account
11307
11652
  * @returns {object} an array of [liquidation structures]{@link https://docs.ccxt.com/#/?id=liquidation-structure}
11308
11653
  */
11309
11654
  await this.loadMarkets();
@@ -11320,13 +11665,17 @@ export default class binance extends Exchange {
11320
11665
  [type, params] = this.handleMarketTypeAndParams('fetchMyLiquidations', market, params);
11321
11666
  let subType = undefined;
11322
11667
  [subType, params] = this.handleSubTypeAndParams('fetchMyLiquidations', market, params, 'linear');
11668
+ let isPortfolioMargin = undefined;
11669
+ [isPortfolioMargin, params] = this.handleOptionAndParams2(params, 'fetchMyLiquidations', 'papi', 'portfolioMargin', false);
11323
11670
  let request = {};
11324
11671
  if (type !== 'spot') {
11325
11672
  request['autoCloseType'] = 'LIQUIDATION';
11326
11673
  }
11327
11674
  if (market !== undefined) {
11328
11675
  const symbolKey = market['spot'] ? 'isolatedSymbol' : 'symbol';
11329
- request[symbolKey] = market['id'];
11676
+ if (!isPortfolioMargin) {
11677
+ request[symbolKey] = market['id'];
11678
+ }
11330
11679
  }
11331
11680
  if (since !== undefined) {
11332
11681
  request['startTime'] = since;
@@ -11342,13 +11691,28 @@ export default class binance extends Exchange {
11342
11691
  [request, params] = this.handleUntilOption('endTime', request, params);
11343
11692
  let response = undefined;
11344
11693
  if (type === 'spot') {
11345
- response = await this.sapiGetMarginForceLiquidationRec(this.extend(request, params));
11694
+ if (isPortfolioMargin) {
11695
+ response = await this.papiGetMarginForceOrders(this.extend(request, params));
11696
+ }
11697
+ else {
11698
+ response = await this.sapiGetMarginForceLiquidationRec(this.extend(request, params));
11699
+ }
11346
11700
  }
11347
11701
  else if (subType === 'linear') {
11348
- response = await this.fapiPrivateGetForceOrders(this.extend(request, params));
11702
+ if (isPortfolioMargin) {
11703
+ response = await this.papiGetUmForceOrders(this.extend(request, params));
11704
+ }
11705
+ else {
11706
+ response = await this.fapiPrivateGetForceOrders(this.extend(request, params));
11707
+ }
11349
11708
  }
11350
11709
  else if (subType === 'inverse') {
11351
- response = await this.dapiPrivateGetForceOrders(this.extend(request, params));
11710
+ if (isPortfolioMargin) {
11711
+ response = await this.papiGetCmForceOrders(this.extend(request, params));
11712
+ }
11713
+ else {
11714
+ response = await this.dapiPrivateGetForceOrders(this.extend(request, params));
11715
+ }
11352
11716
  }
11353
11717
  else {
11354
11718
  throw new NotSupported(this.id + ' fetchMyLiquidations() does not support ' + market['type'] + ' markets');
@@ -11430,7 +11794,7 @@ export default class binance extends Exchange {
11430
11794
  // },
11431
11795
  // ]
11432
11796
  //
11433
- const liquidations = this.safeValue(response, 'rows', response);
11797
+ const liquidations = this.safeList(response, 'rows', response);
11434
11798
  return this.parseLiquidations(liquidations, market, since, limit);
11435
11799
  }
11436
11800
  parseLiquidation(liquidation, market = undefined) {
package/js/src/bingx.d.ts CHANGED
@@ -95,7 +95,8 @@ export default class bingx extends Exchange {
95
95
  toAccount: string;
96
96
  status: string;
97
97
  };
98
- fetchDepositAddress(code: string, params?: {}): Promise<{}>;
98
+ fetchDepositAddressesByNetwork(code: string, params?: {}): Promise<{}>;
99
+ fetchDepositAddress(code: string, params?: {}): Promise<import("./base/types.js").Dictionary<any>>;
99
100
  parseDepositAddress(depositAddress: any, currency?: Currency): {
100
101
  currency: string;
101
102
  address: string;
package/js/src/bingx.js CHANGED
@@ -53,6 +53,7 @@ export default class bingx extends Exchange {
53
53
  'fetchClosedOrders': true,
54
54
  'fetchCurrencies': true,
55
55
  'fetchDepositAddress': true,
56
+ 'fetchDepositAddressesByNetwork': true,
56
57
  'fetchDeposits': true,
57
58
  'fetchDepositWithdrawFee': 'emulated',
58
59
  'fetchDepositWithdrawFees': true,
@@ -405,6 +406,13 @@ export default class bingx extends Exchange {
405
406
  },
406
407
  'recvWindow': 5 * 1000,
407
408
  'broker': 'CCXT',
409
+ 'defaultNetworks': {
410
+ 'ETH': 'ETH',
411
+ 'USDT': 'ERC20',
412
+ 'USDC': 'ERC20',
413
+ 'BTC': 'BTC',
414
+ 'LTC': 'LTC',
415
+ },
408
416
  },
409
417
  });
410
418
  }
@@ -3088,15 +3096,15 @@ export default class bingx extends Exchange {
3088
3096
  'status': status,
3089
3097
  };
3090
3098
  }
3091
- async fetchDepositAddress(code, params = {}) {
3099
+ async fetchDepositAddressesByNetwork(code, params = {}) {
3092
3100
  /**
3093
3101
  * @method
3094
- * @name bingx#fetchDepositAddress
3095
- * @description fetch the deposit address for a currency associated with this account
3096
- * @see https://bingx-api.github.io/docs/#/common/sub-account#Query%20Main%20Account%20Deposit%20Address
3102
+ * @name bingx#fetchDepositAddressesByNetwork
3103
+ * @description fetch the deposit addresses for a currency associated with this account
3104
+ * @see https://bingx-api.github.io/docs/#/en-us/common/wallet-api.html#Query%20Main%20Account%20Deposit%20Address
3097
3105
  * @param {string} code unified currency code
3098
3106
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3099
- * @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
3107
+ * @returns {object} a dictionary [address structures]{@link https://docs.ccxt.com/#/?id=address-structure}, indexed by the network
3100
3108
  */
3101
3109
  await this.loadMarkets();
3102
3110
  const currency = this.currency(code);
@@ -3131,6 +3139,36 @@ export default class bingx extends Exchange {
3131
3139
  const parsed = this.parseDepositAddresses(data, [currency['code']], false);
3132
3140
  return this.indexBy(parsed, 'network');
3133
3141
  }
3142
+ async fetchDepositAddress(code, params = {}) {
3143
+ /**
3144
+ * @method
3145
+ * @name bingx#fetchDepositAddress
3146
+ * @description fetch the deposit address for a currency associated with this account
3147
+ * @see https://bingx-api.github.io/docs/#/en-us/common/wallet-api.html#Query%20Main%20Account%20Deposit%20Address
3148
+ * @param {string} code unified currency code
3149
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3150
+ * @param {string} [params.network] The chain of currency. This only apply for multi-chain currency, and there is no need for single chain currency
3151
+ * @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
3152
+ */
3153
+ const network = this.safeString(params, 'network');
3154
+ params = this.omit(params, ['network']);
3155
+ const addressStructures = await this.fetchDepositAddressesByNetwork(code, params);
3156
+ if (network !== undefined) {
3157
+ return this.safeDict(addressStructures, network);
3158
+ }
3159
+ else {
3160
+ const options = this.safeDict(this.options, 'defaultNetworks');
3161
+ const defaultNetworkForCurrency = this.safeString(options, code);
3162
+ if (defaultNetworkForCurrency !== undefined) {
3163
+ return this.safeDict(addressStructures, defaultNetworkForCurrency);
3164
+ }
3165
+ else {
3166
+ const keys = Object.keys(addressStructures);
3167
+ const key = this.safeString(keys, 0);
3168
+ return this.safeDict(addressStructures, key);
3169
+ }
3170
+ }
3171
+ }
3134
3172
  parseDepositAddress(depositAddress, currency = undefined) {
3135
3173
  //
3136
3174
  // {
@@ -821,7 +821,7 @@ export default class bitstamp extends Exchange {
821
821
  for (let i = 0; i < ids.length; i++) {
822
822
  const id = ids[i];
823
823
  if (id.indexOf('_') < 0) {
824
- const value = this.safeNumber(transaction, id);
824
+ const value = this.safeInteger(transaction, id);
825
825
  if ((value !== undefined) && (value !== 0)) {
826
826
  return id;
827
827
  }
package/js/src/bybit.d.ts CHANGED
@@ -56,7 +56,6 @@ export default class bybit extends Exchange {
56
56
  parseOrderStatus(status: any): string;
57
57
  parseTimeInForce(timeInForce: any): string;
58
58
  parseOrder(order: any, market?: Market): Order;
59
- fetchOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
60
59
  createMarketBuyOrderWithCost(symbol: string, cost: number, params?: {}): Promise<Order>;
61
60
  createMarketSellOrderWithCost(symbol: string, cost: number, params?: {}): Promise<Order>;
62
61
  createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: number, params?: {}): Promise<Order>;
@@ -70,7 +69,11 @@ export default class bybit extends Exchange {
70
69
  cancelAllUsdcOrders(symbol?: Str, params?: {}): Promise<any>;
71
70
  cancelAllOrders(symbol?: Str, params?: {}): Promise<any>;
72
71
  fetchUsdcOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
72
+ fetchOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
73
73
  fetchOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
74
+ fetchClosedOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
75
+ fetchOpenOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
76
+ fetchCanceledAndClosedOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
74
77
  fetchClosedOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
75
78
  fetchCanceledOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
76
79
  fetchUsdcOpenOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;