ccxt 4.4.59__py2.py3-none-any.whl → 4.4.61__py2.py3-none-any.whl

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.
ccxt/__init__.py CHANGED
@@ -22,7 +22,7 @@
22
22
 
23
23
  # ----------------------------------------------------------------------------
24
24
 
25
- __version__ = '4.4.59'
25
+ __version__ = '4.4.61'
26
26
 
27
27
  # ----------------------------------------------------------------------------
28
28
 
ccxt/alpaca.py CHANGED
@@ -1138,9 +1138,9 @@ class alpaca(Exchange, ImplicitAPI):
1138
1138
  until = self.safe_integer(params, 'until')
1139
1139
  if until is not None:
1140
1140
  params = self.omit(params, 'until')
1141
- request['endTime'] = until
1141
+ request['endTime'] = self.iso8601(until)
1142
1142
  if since is not None:
1143
- request['after'] = since
1143
+ request['after'] = self.iso8601(since)
1144
1144
  if limit is not None:
1145
1145
  request['limit'] = limit
1146
1146
  response = self.traderPrivateGetV2Orders(self.extend(request, params))
@@ -1374,6 +1374,7 @@ class alpaca(Exchange, ImplicitAPI):
1374
1374
  :param int [limit]: the maximum number of trade structures to retrieve
1375
1375
  :param dict [params]: extra parameters specific to the exchange API endpoint
1376
1376
  :param int [params.until]: the latest time in ms to fetch trades for
1377
+ :param str [params.page_token]: page_token - used for paging
1377
1378
  :returns Trade[]: a list of `trade structures <https://docs.ccxt.com/#/?id=trade-structure>`
1378
1379
  """
1379
1380
  self.load_markets()
@@ -1383,8 +1384,12 @@ class alpaca(Exchange, ImplicitAPI):
1383
1384
  }
1384
1385
  if symbol is not None:
1385
1386
  market = self.market(symbol)
1387
+ until = self.safe_integer(params, 'until')
1388
+ if until is not None:
1389
+ params = self.omit(params, 'until')
1390
+ request['until'] = self.iso8601(until)
1386
1391
  if since is not None:
1387
- request['after'] = since
1392
+ request['after'] = self.iso8601(since)
1388
1393
  if limit is not None:
1389
1394
  request['page_size'] = limit
1390
1395
  request, params = self.handle_until_option('until', request, params)
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.4.59'
7
+ __version__ = '4.4.61'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -1138,9 +1138,9 @@ class alpaca(Exchange, ImplicitAPI):
1138
1138
  until = self.safe_integer(params, 'until')
1139
1139
  if until is not None:
1140
1140
  params = self.omit(params, 'until')
1141
- request['endTime'] = until
1141
+ request['endTime'] = self.iso8601(until)
1142
1142
  if since is not None:
1143
- request['after'] = since
1143
+ request['after'] = self.iso8601(since)
1144
1144
  if limit is not None:
1145
1145
  request['limit'] = limit
1146
1146
  response = await self.traderPrivateGetV2Orders(self.extend(request, params))
@@ -1374,6 +1374,7 @@ class alpaca(Exchange, ImplicitAPI):
1374
1374
  :param int [limit]: the maximum number of trade structures to retrieve
1375
1375
  :param dict [params]: extra parameters specific to the exchange API endpoint
1376
1376
  :param int [params.until]: the latest time in ms to fetch trades for
1377
+ :param str [params.page_token]: page_token - used for paging
1377
1378
  :returns Trade[]: a list of `trade structures <https://docs.ccxt.com/#/?id=trade-structure>`
1378
1379
  """
1379
1380
  await self.load_markets()
@@ -1383,8 +1384,12 @@ class alpaca(Exchange, ImplicitAPI):
1383
1384
  }
1384
1385
  if symbol is not None:
1385
1386
  market = self.market(symbol)
1387
+ until = self.safe_integer(params, 'until')
1388
+ if until is not None:
1389
+ params = self.omit(params, 'until')
1390
+ request['until'] = self.iso8601(until)
1386
1391
  if since is not None:
1387
- request['after'] = since
1392
+ request['after'] = self.iso8601(since)
1388
1393
  if limit is not None:
1389
1394
  request['page_size'] = limit
1390
1395
  request, params = self.handle_until_option('until', request, params)
@@ -2,7 +2,7 @@
2
2
 
3
3
  # -----------------------------------------------------------------------------
4
4
 
5
- __version__ = '4.4.59'
5
+ __version__ = '4.4.61'
6
6
 
7
7
  # -----------------------------------------------------------------------------
8
8
 
@@ -1440,6 +1440,9 @@ class Exchange(BaseExchange):
1440
1440
  async def create_orders(self, orders: List[OrderRequest], params={}):
1441
1441
  raise NotSupported(self.id + ' createOrders() is not supported yet')
1442
1442
 
1443
+ async def edit_orders(self, orders: List[OrderRequest], params={}):
1444
+ raise NotSupported(self.id + ' editOrders() is not supported yet')
1445
+
1443
1446
  async def create_order_ws(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
1444
1447
  raise NotSupported(self.id + ' createOrderWs() is not supported yet')
1445
1448
 
@@ -86,6 +86,7 @@ class binance(Exchange, ImplicitAPI):
86
86
  'createTrailingPercentOrder': True,
87
87
  'createTriggerOrder': True,
88
88
  'editOrder': True,
89
+ 'editOrders': True,
89
90
  'fetchAccounts': None,
90
91
  'fetchBalance': True,
91
92
  'fetchBidsAsks': True,
@@ -5393,6 +5394,85 @@ class binance(Exchange, ImplicitAPI):
5393
5394
  else:
5394
5395
  return await self.edit_contract_order(id, symbol, type, side, amount, price, params)
5395
5396
 
5397
+ async def edit_orders(self, orders: List[OrderRequest], params={}):
5398
+ """
5399
+ edit a list of trade orders
5400
+
5401
+ https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Modify-Multiple-Orders
5402
+ https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/Modify-Multiple-Orders
5403
+
5404
+ :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
5405
+ :param dict [params]: extra parameters specific to the exchange API endpoint
5406
+ :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
5407
+ """
5408
+ await self.load_markets()
5409
+ ordersRequests = []
5410
+ orderSymbols = []
5411
+ for i in range(0, len(orders)):
5412
+ rawOrder = orders[i]
5413
+ marketId = self.safe_string(rawOrder, 'symbol')
5414
+ orderSymbols.append(marketId)
5415
+ id = self.safe_string(rawOrder, 'id')
5416
+ type = self.safe_string(rawOrder, 'type')
5417
+ side = self.safe_string(rawOrder, 'side')
5418
+ amount = self.safe_value(rawOrder, 'amount')
5419
+ price = self.safe_value(rawOrder, 'price')
5420
+ orderParams = self.safe_dict(rawOrder, 'params', {})
5421
+ isPortfolioMargin = None
5422
+ isPortfolioMargin, orderParams = self.handle_option_and_params_2(orderParams, 'editOrders', 'papi', 'portfolioMargin', False)
5423
+ if isPortfolioMargin:
5424
+ raise NotSupported(self.id + ' editOrders() does not support portfolio margin orders')
5425
+ orderRequest = self.edit_contract_order_request(id, marketId, type, side, amount, price, orderParams)
5426
+ ordersRequests.append(orderRequest)
5427
+ orderSymbols = self.market_symbols(orderSymbols, None, False, True, True)
5428
+ market = self.market(orderSymbols[0])
5429
+ if market['spot'] or market['option']:
5430
+ raise NotSupported(self.id + ' editOrders() does not support ' + market['type'] + ' orders')
5431
+ response = None
5432
+ request: dict = {
5433
+ 'batchOrders': ordersRequests,
5434
+ }
5435
+ request = self.extend(request, params)
5436
+ if market['linear']:
5437
+ response = await self.fapiPrivatePutBatchOrders(request)
5438
+ elif market['inverse']:
5439
+ response = await self.dapiPrivatePutBatchOrders(request)
5440
+ #
5441
+ # [
5442
+ # {
5443
+ # "code": -4005,
5444
+ # "msg": "Quantity greater than max quantity."
5445
+ # },
5446
+ # {
5447
+ # "orderId": 650640530,
5448
+ # "symbol": "LTCUSDT",
5449
+ # "status": "NEW",
5450
+ # "clientOrderId": "x-xcKtGhcu32184eb13585491289bbaf",
5451
+ # "price": "54.00",
5452
+ # "avgPrice": "0.00",
5453
+ # "origQty": "0.100",
5454
+ # "executedQty": "0.000",
5455
+ # "cumQty": "0.000",
5456
+ # "cumQuote": "0.00000",
5457
+ # "timeInForce": "GTC",
5458
+ # "type": "LIMIT",
5459
+ # "reduceOnly": False,
5460
+ # "closePosition": False,
5461
+ # "side": "BUY",
5462
+ # "positionSide": "BOTH",
5463
+ # "stopPrice": "0.00",
5464
+ # "workingType": "CONTRACT_PRICE",
5465
+ # "priceProtect": False,
5466
+ # "origType": "LIMIT",
5467
+ # "priceMatch": "NONE",
5468
+ # "selfTradePreventionMode": "NONE",
5469
+ # "goodTillDate": 0,
5470
+ # "updateTime": 1698073926929
5471
+ # }
5472
+ # ]
5473
+ #
5474
+ return self.parse_orders(response)
5475
+
5396
5476
  def parse_order_status(self, status: Str):
5397
5477
  statuses: dict = {
5398
5478
  'NEW': 'open',
@@ -11243,7 +11323,7 @@ class binance(Exchange, ImplicitAPI):
11243
11323
  params['newClientOrderId'] = brokerId + self.uuid22()
11244
11324
  query = None
11245
11325
  # handle batchOrders
11246
- if (path == 'batchOrders') and (method == 'POST'):
11326
+ if (path == 'batchOrders') and ((method == 'POST') or (method == 'PUT')):
11247
11327
  batchOrders = self.safe_value(params, 'batchOrders')
11248
11328
  queryBatch = (self.json(batchOrders))
11249
11329
  params['batchOrders'] = queryBatch
@@ -8856,7 +8856,8 @@ class bitget(Exchange, ImplicitAPI):
8856
8856
  if method == 'POST':
8857
8857
  headers['Content-Type'] = 'application/json'
8858
8858
  sandboxMode = self.safe_bool(self.options, 'sandboxMode', False)
8859
- if sandboxMode:
8859
+ if sandboxMode and (path != 'v2/public/time'):
8860
+ # https://github.com/ccxt/ccxt/issues/25252#issuecomment-2662742336
8860
8861
  if headers is None:
8861
8862
  headers = {}
8862
8863
  headers['PAPTRADING'] = '1'
@@ -6525,10 +6525,13 @@ classic accounts only/ spot not supported* fetches information on an order made
6525
6525
  # }
6526
6526
  #
6527
6527
  timestamp = self.safe_integer(interest, 'timestamp')
6528
- value = self.safe_number_2(interest, 'open_interest', 'openInterest')
6528
+ openInterest = self.safe_number_2(interest, 'open_interest', 'openInterest')
6529
+ # the openInterest is in the base asset for linear and quote asset for inverse
6530
+ amount = openInterest if market['linear'] else None
6531
+ value = openInterest if market['inverse'] else None
6529
6532
  return self.safe_open_interest({
6530
6533
  'symbol': market['symbol'],
6531
- 'openInterestAmount': None,
6534
+ 'openInterestAmount': amount,
6532
6535
  'openInterestValue': value,
6533
6536
  'timestamp': timestamp,
6534
6537
  'datetime': self.iso8601(timestamp),
@@ -675,23 +675,67 @@ class gate(Exchange, ImplicitAPI):
675
675
  },
676
676
  'createMarketBuyOrderRequiresPrice': True,
677
677
  'networks': {
678
- 'LINEA': 'LINEAETH',
679
- 'KON': 'KONET',
680
- 'AVAXC': 'AVAX_C',
678
+ 'BTC': 'BTC',
679
+ 'BRC20': 'BTCBRC', # for eg: ORDI, RATS, ...
680
+ 'ETH': 'ETH',
681
+ 'ERC20': 'ETH',
682
+ 'TRX': 'TRX',
683
+ 'TRC20': 'TRX',
684
+ 'HECO': 'HT',
685
+ 'HRC20': 'HT',
686
+ 'BSC': 'BSC',
681
687
  'BEP20': 'BSC',
688
+ 'SOL': 'SOL',
689
+ 'POLYGON': 'POL',
690
+ 'MATIC': 'POL',
691
+ 'OP': 'OPETH',
692
+ 'OPTIMISM': 'OPETH',
693
+ 'ADA': 'ADA', # CARDANO
694
+ 'AVAXC': 'AVAX_C',
695
+ 'NEAR': 'NEAR',
696
+ 'ARBONE': 'ARBEVM',
697
+ 'BASE': 'BASEEVM',
698
+ 'SUI': 'SUI',
699
+ 'CRONOS': 'CRO',
700
+ 'CRO': 'CRO',
701
+ 'APT': 'APT',
702
+ 'SCROLL': 'SCROLLETH',
703
+ 'TAIKO': 'TAIKOETH',
704
+ 'HYPE': 'HYPE',
705
+ 'ALGO': 'ALGO',
706
+ # KAVA: ['KAVA', 'KAVAEVM']
707
+ # SEI: ['SEI', 'SEIEVM']
708
+ 'LINEA': 'LINEAETH',
709
+ 'BLAST': 'BLASTETH',
710
+ 'XLM': 'XLM',
711
+ 'RSK': 'RBTC',
712
+ 'TON': 'TON',
713
+ 'MNT': 'MNT',
714
+ # 'RUNE': 'BTCRUNES', probably, cant verify atm
715
+ 'CELO': 'CELO',
716
+ 'HBAR': 'HBAR',
717
+ # 'FTM': SONIC REBRAND, todo
718
+ 'ZKSERA': 'ZKSERA',
719
+ 'KLAY': 'KLAY',
682
720
  'EOS': 'EOS',
683
- 'ERC20': 'ETH',
721
+ 'ACA': 'ACA',
722
+ # TLOS: ['TLOS', 'TLOSEVM']
723
+ # ASTR: ['ASTR', 'ASTREVM']
724
+ # CFX: ['CFX', 'CFXEVM']
725
+ 'XTZ': 'XTZ',
726
+ 'EGLD': 'EGLD',
727
+ 'GLMR': 'GLMR',
728
+ 'AURORA': 'AURORAEVM',
729
+ # others
730
+ 'KON': 'KONET',
684
731
  'GATECHAIN': 'GTEVM',
685
- 'HRC20': 'HT',
686
732
  'KUSAMA': 'KSMSM',
687
- 'NEAR': 'NEAR',
688
733
  'OKC': 'OKT',
689
- 'OPTIMISM': 'OPETH',
690
- 'POLKADOT': 'DOTSM',
691
- 'TRC20': 'TRX',
734
+ 'POLKADOT': 'DOTSM', # todo: DOT for main DOT
692
735
  'LUNA': 'LUNC',
693
- 'BASE': 'BASEEVM',
694
- 'BRC20': 'BTCBRC',
736
+ },
737
+ 'networksById': {
738
+ 'OPETH': 'OP',
695
739
  },
696
740
  'timeInForce': {
697
741
  'GTC': 'gtc',
@@ -3526,6 +3570,7 @@ class gate(Exchange, ImplicitAPI):
3526
3570
  #
3527
3571
  # public
3528
3572
  #
3573
+ # spot:
3529
3574
  # {
3530
3575
  # "id": "1334253759",
3531
3576
  # "create_time": "1626342738",
@@ -3536,6 +3581,18 @@ class gate(Exchange, ImplicitAPI):
3536
3581
  # "price": "32452.16"
3537
3582
  # }
3538
3583
  #
3584
+ # swap:
3585
+ #
3586
+ # {
3587
+ # "id": "442288327",
3588
+ # "contract": "BTC_USDT",
3589
+ # "create_time": "1739814676.707",
3590
+ # "create_time_ms": "1739814676.707",
3591
+ # "size": "-105",
3592
+ # "price": "95594.8"
3593
+ # }
3594
+ #
3595
+ #
3539
3596
  # public ws
3540
3597
  #
3541
3598
  # {
@@ -3612,8 +3669,14 @@ class gate(Exchange, ImplicitAPI):
3612
3669
  # }
3613
3670
  #
3614
3671
  id = self.safe_string_2(trade, 'id', 'trade_id')
3615
- timestamp = self.safe_timestamp_2(trade, 'time', 'create_time')
3616
- timestamp = self.safe_integer(trade, 'create_time_ms', timestamp)
3672
+ timestamp: Int = None
3673
+ msString = self.safe_string(trade, 'create_time_ms')
3674
+ if msString is not None:
3675
+ msString = Precise.string_mul(msString, '1000')
3676
+ msString = msString[0:13]
3677
+ timestamp = self.parse_to_int(msString)
3678
+ else:
3679
+ timestamp = self.safe_timestamp_2(trade, 'time', 'create_time')
3617
3680
  marketId = self.safe_string_2(trade, 'currency_pair', 'contract')
3618
3681
  marketType = 'contract' if ('contract' in trade) else 'spot'
3619
3682
  market = self.safe_market(marketId, market, '_', marketType)
@@ -1882,7 +1882,7 @@ class hollaex(Exchange, ImplicitAPI):
1882
1882
  # "network":"https://api.hollaex.network"
1883
1883
  # }
1884
1884
  #
1885
- coins = self.safe_list(response, 'coins')
1885
+ coins = self.safe_dict(response, 'coins', {})
1886
1886
  return self.parse_deposit_withdraw_fees(coins, codes, 'symbol')
1887
1887
 
1888
1888
  def normalize_number_if_needed(self, number):
@@ -2885,7 +2885,7 @@ class oxfun(Exchange, ImplicitAPI):
2885
2885
  'AccessKey': self.apiKey,
2886
2886
  'Timestamp': datetime,
2887
2887
  'Signature': signature,
2888
- 'Nonce': nonce,
2888
+ 'Nonce': str(nonce),
2889
2889
  }
2890
2890
  return {'url': url, 'method': method, 'body': body, 'headers': headers}
2891
2891
 
@@ -1078,7 +1078,7 @@ class phemex(Exchange, ImplicitAPI):
1078
1078
  for i in range(0, len(products)):
1079
1079
  market = products[i]
1080
1080
  type = self.safe_string_lower(market, 'type')
1081
- if (type == 'perpetual') or (type == 'perpetualv2'):
1081
+ if (type == 'perpetual') or (type == 'perpetualv2') or (type == 'PerpetualPilot'):
1082
1082
  id = self.safe_string(market, 'symbol')
1083
1083
  riskLimitValues = self.safe_value(riskLimitsById, id, {})
1084
1084
  market = self.extend(market, riskLimitValues)
ccxt/async_support/xt.py CHANGED
@@ -1394,9 +1394,15 @@ class xt(Exchange, ImplicitAPI):
1394
1394
  :param int [since]: timestamp in ms of the earliest candle to fetch
1395
1395
  :param int [limit]: the maximum amount of candles to fetch
1396
1396
  :param dict params: extra parameters specific to the xt api endpoint
1397
+ :param int [params.until]: timestamp in ms of the latest candle to fetch
1398
+ :param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
1397
1399
  :returns int[][]: A list of candles ordered, open, high, low, close, volume
1398
1400
  """
1399
1401
  await self.load_markets()
1402
+ paginate = False
1403
+ paginate, params = self.handle_option_and_params(params, 'fetchOHLCV', 'paginate', False)
1404
+ if paginate:
1405
+ return await self.fetch_paginated_call_deterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 1000)
1400
1406
  market = self.market(symbol)
1401
1407
  request = {
1402
1408
  'symbol': market['id'],
@@ -1406,6 +1412,12 @@ class xt(Exchange, ImplicitAPI):
1406
1412
  request['startTime'] = since
1407
1413
  if limit is not None:
1408
1414
  request['limit'] = limit
1415
+ else:
1416
+ request['limit'] = 1000
1417
+ until = self.safe_integer(params, 'until')
1418
+ params = self.omit(params, ['until'])
1419
+ if until is not None:
1420
+ request['endTime'] = until
1409
1421
  response = None
1410
1422
  if market['linear']:
1411
1423
  response = await self.publicLinearGetFutureMarketV1PublicQKline(self.extend(request, params))
ccxt/base/exchange.py CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.4.59'
7
+ __version__ = '4.4.61'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -1871,6 +1871,7 @@ class Exchange(object):
1871
1871
  'createTriggerOrderWs': None,
1872
1872
  'deposit': None,
1873
1873
  'editOrder': 'emulated',
1874
+ 'editOrders': None,
1874
1875
  'editOrderWs': None,
1875
1876
  'fetchAccounts': None,
1876
1877
  'fetchBalance': True,
@@ -5178,6 +5179,9 @@ class Exchange(object):
5178
5179
  def create_orders(self, orders: List[OrderRequest], params={}):
5179
5180
  raise NotSupported(self.id + ' createOrders() is not supported yet')
5180
5181
 
5182
+ def edit_orders(self, orders: List[OrderRequest], params={}):
5183
+ raise NotSupported(self.id + ' editOrders() is not supported yet')
5184
+
5181
5185
  def create_order_ws(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
5182
5186
  raise NotSupported(self.id + ' createOrderWs() is not supported yet')
5183
5187
 
ccxt/binance.py CHANGED
@@ -85,6 +85,7 @@ class binance(Exchange, ImplicitAPI):
85
85
  'createTrailingPercentOrder': True,
86
86
  'createTriggerOrder': True,
87
87
  'editOrder': True,
88
+ 'editOrders': True,
88
89
  'fetchAccounts': None,
89
90
  'fetchBalance': True,
90
91
  'fetchBidsAsks': True,
@@ -5392,6 +5393,85 @@ class binance(Exchange, ImplicitAPI):
5392
5393
  else:
5393
5394
  return self.edit_contract_order(id, symbol, type, side, amount, price, params)
5394
5395
 
5396
+ def edit_orders(self, orders: List[OrderRequest], params={}):
5397
+ """
5398
+ edit a list of trade orders
5399
+
5400
+ https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Modify-Multiple-Orders
5401
+ https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/Modify-Multiple-Orders
5402
+
5403
+ :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
5404
+ :param dict [params]: extra parameters specific to the exchange API endpoint
5405
+ :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
5406
+ """
5407
+ self.load_markets()
5408
+ ordersRequests = []
5409
+ orderSymbols = []
5410
+ for i in range(0, len(orders)):
5411
+ rawOrder = orders[i]
5412
+ marketId = self.safe_string(rawOrder, 'symbol')
5413
+ orderSymbols.append(marketId)
5414
+ id = self.safe_string(rawOrder, 'id')
5415
+ type = self.safe_string(rawOrder, 'type')
5416
+ side = self.safe_string(rawOrder, 'side')
5417
+ amount = self.safe_value(rawOrder, 'amount')
5418
+ price = self.safe_value(rawOrder, 'price')
5419
+ orderParams = self.safe_dict(rawOrder, 'params', {})
5420
+ isPortfolioMargin = None
5421
+ isPortfolioMargin, orderParams = self.handle_option_and_params_2(orderParams, 'editOrders', 'papi', 'portfolioMargin', False)
5422
+ if isPortfolioMargin:
5423
+ raise NotSupported(self.id + ' editOrders() does not support portfolio margin orders')
5424
+ orderRequest = self.edit_contract_order_request(id, marketId, type, side, amount, price, orderParams)
5425
+ ordersRequests.append(orderRequest)
5426
+ orderSymbols = self.market_symbols(orderSymbols, None, False, True, True)
5427
+ market = self.market(orderSymbols[0])
5428
+ if market['spot'] or market['option']:
5429
+ raise NotSupported(self.id + ' editOrders() does not support ' + market['type'] + ' orders')
5430
+ response = None
5431
+ request: dict = {
5432
+ 'batchOrders': ordersRequests,
5433
+ }
5434
+ request = self.extend(request, params)
5435
+ if market['linear']:
5436
+ response = self.fapiPrivatePutBatchOrders(request)
5437
+ elif market['inverse']:
5438
+ response = self.dapiPrivatePutBatchOrders(request)
5439
+ #
5440
+ # [
5441
+ # {
5442
+ # "code": -4005,
5443
+ # "msg": "Quantity greater than max quantity."
5444
+ # },
5445
+ # {
5446
+ # "orderId": 650640530,
5447
+ # "symbol": "LTCUSDT",
5448
+ # "status": "NEW",
5449
+ # "clientOrderId": "x-xcKtGhcu32184eb13585491289bbaf",
5450
+ # "price": "54.00",
5451
+ # "avgPrice": "0.00",
5452
+ # "origQty": "0.100",
5453
+ # "executedQty": "0.000",
5454
+ # "cumQty": "0.000",
5455
+ # "cumQuote": "0.00000",
5456
+ # "timeInForce": "GTC",
5457
+ # "type": "LIMIT",
5458
+ # "reduceOnly": False,
5459
+ # "closePosition": False,
5460
+ # "side": "BUY",
5461
+ # "positionSide": "BOTH",
5462
+ # "stopPrice": "0.00",
5463
+ # "workingType": "CONTRACT_PRICE",
5464
+ # "priceProtect": False,
5465
+ # "origType": "LIMIT",
5466
+ # "priceMatch": "NONE",
5467
+ # "selfTradePreventionMode": "NONE",
5468
+ # "goodTillDate": 0,
5469
+ # "updateTime": 1698073926929
5470
+ # }
5471
+ # ]
5472
+ #
5473
+ return self.parse_orders(response)
5474
+
5395
5475
  def parse_order_status(self, status: Str):
5396
5476
  statuses: dict = {
5397
5477
  'NEW': 'open',
@@ -11242,7 +11322,7 @@ class binance(Exchange, ImplicitAPI):
11242
11322
  params['newClientOrderId'] = brokerId + self.uuid22()
11243
11323
  query = None
11244
11324
  # handle batchOrders
11245
- if (path == 'batchOrders') and (method == 'POST'):
11325
+ if (path == 'batchOrders') and ((method == 'POST') or (method == 'PUT')):
11246
11326
  batchOrders = self.safe_value(params, 'batchOrders')
11247
11327
  queryBatch = (self.json(batchOrders))
11248
11328
  params['batchOrders'] = queryBatch
ccxt/bitget.py CHANGED
@@ -8855,7 +8855,8 @@ class bitget(Exchange, ImplicitAPI):
8855
8855
  if method == 'POST':
8856
8856
  headers['Content-Type'] = 'application/json'
8857
8857
  sandboxMode = self.safe_bool(self.options, 'sandboxMode', False)
8858
- if sandboxMode:
8858
+ if sandboxMode and (path != 'v2/public/time'):
8859
+ # https://github.com/ccxt/ccxt/issues/25252#issuecomment-2662742336
8859
8860
  if headers is None:
8860
8861
  headers = {}
8861
8862
  headers['PAPTRADING'] = '1'
ccxt/bybit.py CHANGED
@@ -6524,10 +6524,13 @@ classic accounts only/ spot not supported* fetches information on an order made
6524
6524
  # }
6525
6525
  #
6526
6526
  timestamp = self.safe_integer(interest, 'timestamp')
6527
- value = self.safe_number_2(interest, 'open_interest', 'openInterest')
6527
+ openInterest = self.safe_number_2(interest, 'open_interest', 'openInterest')
6528
+ # the openInterest is in the base asset for linear and quote asset for inverse
6529
+ amount = openInterest if market['linear'] else None
6530
+ value = openInterest if market['inverse'] else None
6528
6531
  return self.safe_open_interest({
6529
6532
  'symbol': market['symbol'],
6530
- 'openInterestAmount': None,
6533
+ 'openInterestAmount': amount,
6531
6534
  'openInterestValue': value,
6532
6535
  'timestamp': timestamp,
6533
6536
  'datetime': self.iso8601(timestamp),