ccxt 4.4.33__py2.py3-none-any.whl → 4.4.34__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.
Files changed (82) hide show
  1. ccxt/__init__.py +3 -1
  2. ccxt/abstract/bingx.py +16 -0
  3. ccxt/abstract/bitbank.py +5 -0
  4. ccxt/abstract/bitfinex2.py +1 -0
  5. ccxt/abstract/ellipx.py +25 -0
  6. ccxt/alpaca.py +2 -0
  7. ccxt/async_support/__init__.py +3 -1
  8. ccxt/async_support/alpaca.py +2 -0
  9. ccxt/async_support/base/exchange.py +1 -1
  10. ccxt/async_support/binance.py +19 -15
  11. ccxt/async_support/bingx.py +155 -8
  12. ccxt/async_support/bitbank.py +5 -0
  13. ccxt/async_support/bitbns.py +2 -0
  14. ccxt/async_support/bitfinex2.py +1 -0
  15. ccxt/async_support/bitget.py +174 -40
  16. ccxt/async_support/bitmex.py +2 -0
  17. ccxt/async_support/bitopro.py +3 -0
  18. ccxt/async_support/bitrue.py +1 -0
  19. ccxt/async_support/btcmarkets.py +2 -0
  20. ccxt/async_support/bybit.py +13 -10
  21. ccxt/async_support/cex.py +13 -4
  22. ccxt/async_support/coinbase.py +3 -2
  23. ccxt/async_support/coinex.py +1 -0
  24. ccxt/async_support/coinone.py +7 -7
  25. ccxt/async_support/coinsph.py +7 -7
  26. ccxt/async_support/coinspot.py +39 -39
  27. ccxt/async_support/cryptocom.py +36 -34
  28. ccxt/async_support/ellipx.py +1828 -0
  29. ccxt/async_support/gate.py +1 -0
  30. ccxt/async_support/hyperliquid.py +2 -0
  31. ccxt/async_support/krakenfutures.py +3 -1
  32. ccxt/async_support/okcoin.py +2 -0
  33. ccxt/async_support/okx.py +14 -10
  34. ccxt/async_support/onetrading.py +20 -1
  35. ccxt/async_support/paradex.py +2 -0
  36. ccxt/async_support/phemex.py +16 -0
  37. ccxt/async_support/poloniex.py +3 -1
  38. ccxt/async_support/poloniexfutures.py +3 -1
  39. ccxt/async_support/vertex.py +2 -0
  40. ccxt/async_support/woo.py +69 -69
  41. ccxt/base/exchange.py +27 -7
  42. ccxt/binance.py +19 -15
  43. ccxt/bingx.py +155 -8
  44. ccxt/bitbank.py +5 -0
  45. ccxt/bitbns.py +2 -0
  46. ccxt/bitfinex2.py +1 -0
  47. ccxt/bitget.py +174 -40
  48. ccxt/bitmex.py +2 -0
  49. ccxt/bitopro.py +3 -0
  50. ccxt/bitrue.py +1 -0
  51. ccxt/btcmarkets.py +2 -0
  52. ccxt/bybit.py +13 -10
  53. ccxt/cex.py +13 -4
  54. ccxt/coinbase.py +3 -2
  55. ccxt/coinex.py +1 -0
  56. ccxt/coinone.py +7 -7
  57. ccxt/coinsph.py +7 -7
  58. ccxt/coinspot.py +39 -39
  59. ccxt/cryptocom.py +36 -34
  60. ccxt/ellipx.py +1828 -0
  61. ccxt/gate.py +1 -0
  62. ccxt/hyperliquid.py +2 -0
  63. ccxt/krakenfutures.py +3 -1
  64. ccxt/okcoin.py +2 -0
  65. ccxt/okx.py +14 -10
  66. ccxt/onetrading.py +20 -1
  67. ccxt/paradex.py +2 -0
  68. ccxt/phemex.py +16 -0
  69. ccxt/poloniex.py +3 -1
  70. ccxt/poloniexfutures.py +3 -1
  71. ccxt/pro/__init__.py +1 -1
  72. ccxt/pro/idex.py +15 -0
  73. ccxt/pro/probit.py +4 -2
  74. ccxt/pro/woo.py +15 -15
  75. ccxt/test/tests_helpers.py +0 -2
  76. ccxt/vertex.py +2 -0
  77. ccxt/woo.py +69 -69
  78. {ccxt-4.4.33.dist-info → ccxt-4.4.34.dist-info}/METADATA +9 -8
  79. {ccxt-4.4.33.dist-info → ccxt-4.4.34.dist-info}/RECORD +82 -79
  80. {ccxt-4.4.33.dist-info → ccxt-4.4.34.dist-info}/LICENSE.txt +0 -0
  81. {ccxt-4.4.33.dist-info → ccxt-4.4.34.dist-info}/WHEEL +0 -0
  82. {ccxt-4.4.33.dist-info → ccxt-4.4.34.dist-info}/top_level.txt +0 -0
ccxt/bitget.py CHANGED
@@ -1461,6 +1461,141 @@ class bitget(Exchange, ImplicitAPI):
1461
1461
  },
1462
1462
  'defaultTimeInForce': 'GTC', # 'GTC' = Good To Cancel(default), 'IOC' = Immediate Or Cancel
1463
1463
  },
1464
+ 'features': {
1465
+ 'spot': {
1466
+ 'sandbox': True,
1467
+ 'createOrder': {
1468
+ 'marginMode': True,
1469
+ 'triggerPrice': True,
1470
+ 'triggerPriceType': {
1471
+ 'last': True,
1472
+ 'mark': True,
1473
+ 'index': False, # not on spot
1474
+ },
1475
+ 'triggerDirection': False,
1476
+ 'stopLossPrice': True, # but not yet implemented in spot
1477
+ 'takeProfitPrice': True, # but not yet implemented in spot
1478
+ 'attachedStopLossTakeProfit': {
1479
+ 'triggerPriceType': {
1480
+ 'last': False,
1481
+ 'mark': False,
1482
+ 'index': False,
1483
+ },
1484
+ 'limitPrice': True,
1485
+ },
1486
+ 'timeInForce': {
1487
+ 'GTC': True,
1488
+ 'IOC': True,
1489
+ 'FOK': True,
1490
+ 'PO': True,
1491
+ 'GTD': False,
1492
+ },
1493
+ 'hedged': False,
1494
+ 'trailing': False,
1495
+ 'marketBuyRequiresPrice': True,
1496
+ 'marketBuyByCost': True,
1497
+ # exchange-supported features
1498
+ # 'selfTradePrevention': True,
1499
+ # 'twap': False,
1500
+ # 'iceberg': False,
1501
+ # 'oco': False,
1502
+ },
1503
+ 'createOrders': {
1504
+ 'max': 50,
1505
+ },
1506
+ 'fetchMyTrades': {
1507
+ 'marginMode': True,
1508
+ 'limit': 100,
1509
+ 'daysBack': None,
1510
+ 'untilDays': 90,
1511
+ },
1512
+ 'fetchOrder': {
1513
+ 'marginMode': False,
1514
+ 'trigger': False,
1515
+ 'trailing': False,
1516
+ },
1517
+ 'fetchOpenOrders': {
1518
+ 'marginMode': True,
1519
+ 'limit': 100,
1520
+ 'trigger': True,
1521
+ 'trailing': False,
1522
+ },
1523
+ 'fetchOrders': None,
1524
+ 'fetchClosedOrders': {
1525
+ 'marginMode': True,
1526
+ 'limit': 100,
1527
+ 'daysBackClosed': None,
1528
+ 'daysBackCanceled': None,
1529
+ 'untilDays': 90,
1530
+ 'trigger': True,
1531
+ 'trailing': False,
1532
+ },
1533
+ 'fetchOHLCV': {
1534
+ 'limit': 1000, # variable timespans for recent endpoint, 200 for historical
1535
+ },
1536
+ },
1537
+ 'forPerps': {
1538
+ 'extends': 'spot',
1539
+ 'createOrder': {
1540
+ 'triggerPrice': True,
1541
+ 'triggerPriceType': {
1542
+ 'last': True,
1543
+ 'mark': True,
1544
+ 'index': False, # not on spot
1545
+ },
1546
+ 'triggerDirection': False,
1547
+ 'stopLossPrice': True,
1548
+ 'takeProfitPrice': True,
1549
+ 'attachedStopLossTakeProfit': {
1550
+ 'triggerPriceType': {
1551
+ 'last': True,
1552
+ 'mark': True,
1553
+ 'index': True,
1554
+ },
1555
+ 'limitPrice': False,
1556
+ },
1557
+ 'timeInForce': {
1558
+ 'GTC': True,
1559
+ 'IOC': True,
1560
+ 'FOK': True,
1561
+ 'PO': True,
1562
+ 'GTD': False,
1563
+ },
1564
+ 'hedged': True,
1565
+ 'trailing': True,
1566
+ 'marketBuyRequiresPrice': False,
1567
+ 'marketBuyByCost': False,
1568
+ # exchange-supported features
1569
+ # 'selfTradePrevention': True,
1570
+ # 'trailing': True,
1571
+ # 'twap': False,
1572
+ # 'iceberg': False,
1573
+ # 'oco': False,
1574
+ },
1575
+ 'fetchMyTrades': {
1576
+ 'untilDays': 7,
1577
+ },
1578
+ 'fetchClosedOrders': {
1579
+ 'trailing': True,
1580
+ },
1581
+ },
1582
+ 'swap': {
1583
+ 'linear': {
1584
+ 'extends': 'forPerps',
1585
+ },
1586
+ 'inverse': {
1587
+ 'extends': 'forPerps',
1588
+ },
1589
+ },
1590
+ 'future': {
1591
+ 'linear': {
1592
+ 'extends': 'forPerps',
1593
+ },
1594
+ 'inverse': {
1595
+ 'extends': 'forPerps',
1596
+ },
1597
+ },
1598
+ },
1464
1599
  })
1465
1600
 
1466
1601
  def set_sandbox_mode(self, enabled):
@@ -4121,7 +4256,7 @@ class bitget(Exchange, ImplicitAPI):
4121
4256
  raise ExchangeError(self.id + ' createOrder() params can only contain one of triggerPrice, stopLossPrice, takeProfitPrice, trailingPercent')
4122
4257
  if type == 'limit':
4123
4258
  request['price'] = self.price_to_precision(symbol, price)
4124
- triggerType = self.safe_string(params, 'triggerType', 'mark_price')
4259
+ triggerPriceType = self.safe_string_2(params, 'triggerPriceType', 'triggerType', 'mark_price')
4125
4260
  reduceOnly = self.safe_bool(params, 'reduceOnly', False)
4126
4261
  clientOrderId = self.safe_string_2(params, 'clientOid', 'clientOrderId')
4127
4262
  exchangeSpecificTifParam = self.safe_string_2(params, 'force', 'timeInForce')
@@ -4147,7 +4282,7 @@ class bitget(Exchange, ImplicitAPI):
4147
4282
  if clientOrderId is not None:
4148
4283
  request['clientOid'] = clientOrderId
4149
4284
  if isTriggerOrder or isStopLossOrTakeProfitTrigger or isTrailingPercentOrder:
4150
- request['triggerType'] = triggerType
4285
+ request['triggerType'] = triggerPriceType
4151
4286
  if isTrailingPercentOrder:
4152
4287
  if not isMarketOrder:
4153
4288
  raise BadRequest(self.id + ' createOrder() bitget trailing orders must be market orders')
@@ -4256,7 +4391,7 @@ class bitget(Exchange, ImplicitAPI):
4256
4391
  request['size'] = quantity
4257
4392
  if triggerPrice is not None:
4258
4393
  request['planType'] = planType
4259
- request['triggerType'] = triggerType
4394
+ request['triggerType'] = triggerPriceType
4260
4395
  request['triggerPrice'] = self.price_to_precision(symbol, triggerPrice)
4261
4396
  if price is not None:
4262
4397
  request['executePrice'] = self.price_to_precision(symbol, price)
@@ -4528,7 +4663,7 @@ class bitget(Exchange, ImplicitAPI):
4528
4663
  :param str symbol: unified symbol of the market the order was made in
4529
4664
  :param dict [params]: extra parameters specific to the exchange API endpoint
4530
4665
  :param str [params.marginMode]: 'isolated' or 'cross' for spot margin trading
4531
- :param boolean [params.stop]: set to True for canceling trigger orders
4666
+ :param boolean [params.trigger]: set to True for canceling trigger orders
4532
4667
  :param str [params.planType]: *swap only* either profit_plan, loss_plan, normal_plan, pos_profit, pos_loss, moving_plan or track_plan
4533
4668
  :param boolean [params.trailing]: set to True if you want to cancel a trailing order
4534
4669
  :returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
@@ -4548,17 +4683,17 @@ class bitget(Exchange, ImplicitAPI):
4548
4683
  marginMode, params = self.handle_margin_mode_and_params('cancelOrder', params)
4549
4684
  request: dict = {}
4550
4685
  trailing = self.safe_value(params, 'trailing')
4551
- stop = self.safe_value_2(params, 'stop', 'trigger')
4686
+ trigger = self.safe_value_2(params, 'stop', 'trigger')
4552
4687
  params = self.omit(params, ['stop', 'trigger', 'trailing'])
4553
- if not (market['spot'] and stop):
4688
+ if not (market['spot'] and trigger):
4554
4689
  request['symbol'] = market['id']
4555
- if not ((market['swap'] or market['future']) and stop):
4690
+ if not ((market['swap'] or market['future']) and trigger):
4556
4691
  request['orderId'] = id
4557
4692
  if (market['swap']) or (market['future']):
4558
4693
  productType = None
4559
4694
  productType, params = self.handle_product_type_and_params(market, params)
4560
4695
  request['productType'] = productType
4561
- if stop or trailing:
4696
+ if trigger or trailing:
4562
4697
  orderIdList = []
4563
4698
  orderId: dict = {
4564
4699
  'orderId': id,
@@ -4569,7 +4704,7 @@ class bitget(Exchange, ImplicitAPI):
4569
4704
  planType = self.safe_string(params, 'planType', 'track_plan')
4570
4705
  request['planType'] = planType
4571
4706
  response = self.privateMixPostV2MixOrderCancelPlanOrder(self.extend(request, params))
4572
- elif stop:
4707
+ elif trigger:
4573
4708
  response = self.privateMixPostV2MixOrderCancelPlanOrder(self.extend(request, params))
4574
4709
  else:
4575
4710
  response = self.privateMixPostV2MixOrderCancelOrder(self.extend(request, params))
@@ -4580,7 +4715,7 @@ class bitget(Exchange, ImplicitAPI):
4580
4715
  elif marginMode == 'cross':
4581
4716
  response = self.privateMarginPostV2MarginCrossedCancelOrder(self.extend(request, params))
4582
4717
  else:
4583
- if stop:
4718
+ if trigger:
4584
4719
  response = self.privateSpotPostV2SpotTradeCancelPlanOrder(self.extend(request, params))
4585
4720
  else:
4586
4721
  response = self.privateSpotPostV2SpotTradeCancelOrder(self.extend(request, params))
@@ -4629,7 +4764,7 @@ class bitget(Exchange, ImplicitAPI):
4629
4764
  #
4630
4765
  data = self.safe_value(response, 'data', {})
4631
4766
  order = None
4632
- if (market['swap'] or market['future']) and stop:
4767
+ if (market['swap'] or market['future']) and trigger:
4633
4768
  orderInfo = self.safe_value(data, 'successList', [])
4634
4769
  order = orderInfo[0]
4635
4770
  else:
@@ -4650,7 +4785,7 @@ class bitget(Exchange, ImplicitAPI):
4650
4785
  :param str symbol: unified market symbol, default is None
4651
4786
  :param dict [params]: extra parameters specific to the exchange API endpoint
4652
4787
  :param str [params.marginMode]: 'isolated' or 'cross' for spot margin trading
4653
- :param boolean [params.stop]: *contract only* set to True for canceling trigger orders
4788
+ :param boolean [params.trigger]: *contract only* set to True for canceling trigger orders
4654
4789
  :returns dict: an array of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
4655
4790
  """
4656
4791
  if symbol is None:
@@ -4665,7 +4800,7 @@ class bitget(Exchange, ImplicitAPI):
4665
4800
  market = self.market(symbol)
4666
4801
  marginMode = None
4667
4802
  marginMode, params = self.handle_margin_mode_and_params('cancelOrders', params)
4668
- stop = self.safe_value_2(params, 'stop', 'trigger')
4803
+ trigger = self.safe_value_2(params, 'stop', 'trigger')
4669
4804
  params = self.omit(params, ['stop', 'trigger'])
4670
4805
  orderIdList = []
4671
4806
  for i in range(0, len(ids)):
@@ -4694,7 +4829,7 @@ class bitget(Exchange, ImplicitAPI):
4694
4829
  productType = None
4695
4830
  productType, params = self.handle_product_type_and_params(market, params)
4696
4831
  request['productType'] = productType
4697
- if stop:
4832
+ if trigger:
4698
4833
  response = self.privateMixPostV2MixOrderCancelPlanOrder(self.extend(request, params))
4699
4834
  else:
4700
4835
  response = self.privateMixPostV2MixOrderBatchCancelOrders(self.extend(request, params))
@@ -4731,7 +4866,7 @@ class bitget(Exchange, ImplicitAPI):
4731
4866
  :param str symbol: unified market symbol
4732
4867
  :param dict [params]: extra parameters specific to the exchange API endpoint
4733
4868
  :param str [params.marginMode]: 'isolated' or 'cross' for spot margin trading
4734
- :param boolean [params.stop]: *contract only* set to True for canceling trigger orders
4869
+ :param boolean [params.trigger]: *contract only* set to True for canceling trigger orders
4735
4870
  :returns dict[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
4736
4871
  """
4737
4872
  if symbol is None:
@@ -4749,7 +4884,7 @@ class bitget(Exchange, ImplicitAPI):
4749
4884
  request: dict = {
4750
4885
  'symbol': market['id'],
4751
4886
  }
4752
- stop = self.safe_bool_2(params, 'stop', 'trigger')
4887
+ trigger = self.safe_bool_2(params, 'stop', 'trigger')
4753
4888
  params = self.omit(params, ['stop', 'trigger'])
4754
4889
  response = None
4755
4890
  if market['spot']:
@@ -4775,7 +4910,7 @@ class bitget(Exchange, ImplicitAPI):
4775
4910
  # }
4776
4911
  #
4777
4912
  else:
4778
- if stop:
4913
+ if trigger:
4779
4914
  stopRequest: dict = {
4780
4915
  'symbolList': [market['id']],
4781
4916
  }
@@ -4807,7 +4942,7 @@ class bitget(Exchange, ImplicitAPI):
4807
4942
  productType = None
4808
4943
  productType, params = self.handle_product_type_and_params(market, params)
4809
4944
  request['productType'] = productType
4810
- if stop:
4945
+ if trigger:
4811
4946
  response = self.privateMixPostV2MixOrderCancelPlanOrder(self.extend(request, params))
4812
4947
  else:
4813
4948
  response = self.privateMixPostV2MixOrderBatchCancelOrders(self.extend(request, params))
@@ -4963,7 +5098,7 @@ class bitget(Exchange, ImplicitAPI):
4963
5098
  :param dict [params]: extra parameters specific to the exchange API endpoint
4964
5099
  :param int [params.until]: the latest time in ms to fetch orders for
4965
5100
  :param str [params.planType]: *contract stop only* 'normal_plan': average trigger order, 'profit_loss': opened tp/sl orders, 'track_plan': trailing stop order, default is 'normal_plan'
4966
- :param boolean [params.stop]: set to True for fetching trigger orders
5101
+ :param boolean [params.trigger]: set to True for fetching trigger orders
4967
5102
  :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)
4968
5103
  :param str [params.isPlan]: *swap only* 'plan' for stop orders and 'profit_loss' for tp/sl orders, default is 'plan'
4969
5104
  :param boolean [params.trailing]: set to True if you want to fetch trailing orders
@@ -5001,9 +5136,9 @@ class bitget(Exchange, ImplicitAPI):
5001
5136
  return self.fetch_paginated_call_cursor('fetchOpenOrders', symbol, since, limit, params, cursorReceived, 'idLessThan')
5002
5137
  response = None
5003
5138
  trailing = self.safe_bool(params, 'trailing')
5004
- stop = self.safe_bool_2(params, 'stop', 'trigger')
5139
+ trigger = self.safe_bool_2(params, 'stop', 'trigger')
5005
5140
  planTypeDefined = self.safe_string(params, 'planType') is not None
5006
- isStop = (stop or planTypeDefined)
5141
+ isTrigger = (trigger or planTypeDefined)
5007
5142
  params = self.omit(params, ['stop', 'trigger', 'trailing'])
5008
5143
  request, params = self.handle_until_option('endTime', request, params)
5009
5144
  if since is not None:
@@ -5027,7 +5162,7 @@ class bitget(Exchange, ImplicitAPI):
5027
5162
  elif marginMode == 'cross':
5028
5163
  response = self.privateMarginGetV2MarginCrossedOpenOrders(self.extend(request, query))
5029
5164
  else:
5030
- if stop:
5165
+ if trigger:
5031
5166
  response = self.privateSpotGetV2SpotTradeCurrentPlanOrder(self.extend(request, query))
5032
5167
  else:
5033
5168
  response = self.privateSpotGetV2SpotTradeUnfilledOrders(self.extend(request, query))
@@ -5039,7 +5174,7 @@ class bitget(Exchange, ImplicitAPI):
5039
5174
  planType = self.safe_string(params, 'planType', 'track_plan')
5040
5175
  request['planType'] = planType
5041
5176
  response = self.privateMixGetV2MixOrderOrdersPlanPending(self.extend(request, query))
5042
- elif isStop:
5177
+ elif isTrigger:
5043
5178
  planType = self.safe_string(query, 'planType', 'normal_plan')
5044
5179
  request['planType'] = planType
5045
5180
  response = self.privateMixGetV2MixOrderOrdersPlanPending(self.extend(request, query))
@@ -5222,7 +5357,7 @@ class bitget(Exchange, ImplicitAPI):
5222
5357
  #
5223
5358
  data = self.safe_value(response, 'data')
5224
5359
  if type == 'spot':
5225
- if (marginMode is not None) or stop:
5360
+ if (marginMode is not None) or trigger:
5226
5361
  resultList = self.safe_list(data, 'orderList', [])
5227
5362
  return self.parse_orders(resultList, market, since, limit)
5228
5363
  else:
@@ -5326,7 +5461,7 @@ class bitget(Exchange, ImplicitAPI):
5326
5461
  return self.fetch_paginated_call_cursor('fetchCanceledAndClosedOrders', symbol, since, limit, params, cursorReceived, 'idLessThan')
5327
5462
  response = None
5328
5463
  trailing = self.safe_value(params, 'trailing')
5329
- stop = self.safe_bool_2(params, 'stop', 'trigger')
5464
+ trigger = self.safe_bool_2(params, 'stop', 'trigger')
5330
5465
  params = self.omit(params, ['stop', 'trigger', 'trailing'])
5331
5466
  request, params = self.handle_until_option('endTime', request, params)
5332
5467
  if since is not None:
@@ -5348,20 +5483,19 @@ class bitget(Exchange, ImplicitAPI):
5348
5483
  response = self.privateMarginGetV2MarginIsolatedHistoryOrders(self.extend(request, params))
5349
5484
  elif marginMode == 'cross':
5350
5485
  response = self.privateMarginGetV2MarginCrossedHistoryOrders(self.extend(request, params))
5486
+ elif trigger:
5487
+ if symbol is None:
5488
+ raise ArgumentsRequired(self.id + ' fetchCanceledAndClosedOrders() requires a symbol argument')
5489
+ endTime = self.safe_integer_n(params, ['endTime', 'until'])
5490
+ params = self.omit(params, ['until'])
5491
+ if since is None:
5492
+ since = now - 7776000000
5493
+ request['startTime'] = since
5494
+ if endTime is None:
5495
+ request['endTime'] = now
5496
+ response = self.privateSpotGetV2SpotTradeHistoryPlanOrder(self.extend(request, params))
5351
5497
  else:
5352
- if stop:
5353
- if symbol is None:
5354
- raise ArgumentsRequired(self.id + ' fetchCanceledAndClosedOrders() requires a symbol argument')
5355
- endTime = self.safe_integer_n(params, ['endTime', 'until'])
5356
- params = self.omit(params, ['until'])
5357
- if since is None:
5358
- since = now - 7776000000
5359
- request['startTime'] = since
5360
- if endTime is None:
5361
- request['endTime'] = now
5362
- response = self.privateSpotGetV2SpotTradeHistoryPlanOrder(self.extend(request, params))
5363
- else:
5364
- response = self.privateSpotGetV2SpotTradeHistoryOrders(self.extend(request, params))
5498
+ response = self.privateSpotGetV2SpotTradeHistoryOrders(self.extend(request, params))
5365
5499
  else:
5366
5500
  productType = None
5367
5501
  productType, params = self.handle_product_type_and_params(market, params)
@@ -5370,7 +5504,7 @@ class bitget(Exchange, ImplicitAPI):
5370
5504
  planType = self.safe_string(params, 'planType', 'track_plan')
5371
5505
  request['planType'] = planType
5372
5506
  response = self.privateMixGetV2MixOrderOrdersPlanHistory(self.extend(request, params))
5373
- elif stop:
5507
+ elif trigger:
5374
5508
  planType = self.safe_string(params, 'planType', 'normal_plan')
5375
5509
  request['planType'] = planType
5376
5510
  response = self.privateMixGetV2MixOrderOrdersPlanHistory(self.extend(request, params))
@@ -5556,7 +5690,7 @@ class bitget(Exchange, ImplicitAPI):
5556
5690
  #
5557
5691
  data = self.safe_value(response, 'data', {})
5558
5692
  if marketType == 'spot':
5559
- if (marginMode is not None) or stop:
5693
+ if (marginMode is not None) or trigger:
5560
5694
  return self.parse_orders(self.safe_value(data, 'orderList', []), market, since, limit)
5561
5695
  else:
5562
5696
  return self.parse_orders(self.safe_value(data, 'entrustedList', []), market, since, limit)
ccxt/bitmex.py CHANGED
@@ -55,7 +55,9 @@ class bitmex(Exchange, ImplicitAPI):
55
55
  'closePosition': True,
56
56
  'createOrder': True,
57
57
  'createReduceOnlyOrder': True,
58
+ 'createStopOrder': True,
58
59
  'createTrailingAmountOrder': True,
60
+ 'createTriggerOrder': True,
59
61
  'editOrder': True,
60
62
  'fetchBalance': True,
61
63
  'fetchClosedOrders': True,
ccxt/bitopro.py CHANGED
@@ -42,6 +42,8 @@ class bitopro(Exchange, ImplicitAPI):
42
42
  'closeAllPositions': False,
43
43
  'closePosition': False,
44
44
  'createOrder': True,
45
+ 'createStopOrder': True,
46
+ 'createTriggerOrder': True,
45
47
  'editOrder': False,
46
48
  'fetchBalance': True,
47
49
  'fetchBorrowRateHistories': False,
@@ -986,6 +988,7 @@ class bitopro(Exchange, ImplicitAPI):
986
988
  :param float amount: how much of currency you want to trade in units of base currency
987
989
  :param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
988
990
  :param dict [params]: extra parameters specific to the exchange API endpoint
991
+ :param dict [params.triggerPrice]: the price at which a trigger order is triggered at
989
992
  :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
990
993
  """
991
994
  self.load_markets()
ccxt/bitrue.py CHANGED
@@ -531,6 +531,7 @@ class bitrue(Exchange, ImplicitAPI):
531
531
  '-4051': InsufficientFunds, # {"code":-4051,"msg":"Isolated balance insufficient."}
532
532
  },
533
533
  'broad': {
534
+ 'Insufficient account balance': InsufficientFunds, # {"code":-2010,"msg":"Insufficient account balance.","data":null}
534
535
  'has no operation privilege': PermissionDenied,
535
536
  'MAX_POSITION': InvalidOrder, # {"code":-2010,"msg":"Filter failure: MAX_POSITION"}
536
537
  },
ccxt/btcmarkets.py CHANGED
@@ -42,6 +42,7 @@ class btcmarkets(Exchange, ImplicitAPI):
42
42
  'createDepositAddress': False,
43
43
  'createOrder': True,
44
44
  'createReduceOnlyOrder': False,
45
+ 'createTriggerOrder': True,
45
46
  'fetchBalance': True,
46
47
  'fetchBorrowRateHistories': False,
47
48
  'fetchBorrowRateHistory': False,
@@ -787,6 +788,7 @@ class btcmarkets(Exchange, ImplicitAPI):
787
788
  :param float amount: how much of currency you want to trade in units of base currency
788
789
  :param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
789
790
  :param dict [params]: extra parameters specific to the exchange API endpoint
791
+ :param float [params.triggerPrice]: the price at which a trigger order is triggered at
790
792
  :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
791
793
  """
792
794
  self.load_markets()
ccxt/bybit.py CHANGED
@@ -1076,6 +1076,7 @@ class bybit(Exchange, ImplicitAPI):
1076
1076
  'default': {
1077
1077
  'sandbox': True,
1078
1078
  'createOrder': {
1079
+ 'marginMode': False,
1079
1080
  'triggerPrice': True,
1080
1081
  'triggerPriceType': {
1081
1082
  'last': True,
@@ -1093,7 +1094,6 @@ class bybit(Exchange, ImplicitAPI):
1093
1094
  },
1094
1095
  'limitPrice': True,
1095
1096
  },
1096
- 'marginMode': False,
1097
1097
  'timeInForce': {
1098
1098
  'GTC': True,
1099
1099
  'IOC': True,
@@ -1113,6 +1113,7 @@ class bybit(Exchange, ImplicitAPI):
1113
1113
  'max': 10,
1114
1114
  },
1115
1115
  'fetchMyTrades': {
1116
+ 'marginMode': False,
1116
1117
  'limit': 100,
1117
1118
  'daysBack': 365 * 2, # 2 years
1118
1119
  'untilDays': 7, # days between start-end
@@ -1123,18 +1124,18 @@ class bybit(Exchange, ImplicitAPI):
1123
1124
  'trailing': False,
1124
1125
  },
1125
1126
  'fetchOpenOrders': {
1126
- 'limit': 50,
1127
1127
  'marginMode': False,
1128
+ 'limit': 50,
1128
1129
  'trigger': True,
1129
1130
  'trailing': False,
1130
1131
  },
1131
1132
  'fetchOrders': None,
1132
1133
  'fetchClosedOrders': {
1134
+ 'marginMode': False,
1133
1135
  'limit': 50,
1134
1136
  'daysBackClosed': 365 * 2, # 2 years
1135
1137
  'daysBackCanceled': 1,
1136
1138
  'untilDays': 7,
1137
- 'marginMode': False,
1138
1139
  'trigger': True,
1139
1140
  'trailing': False,
1140
1141
  },
@@ -1145,6 +1146,7 @@ class bybit(Exchange, ImplicitAPI):
1145
1146
  'spot': {
1146
1147
  'extends': 'default',
1147
1148
  'createOrder': {
1149
+ 'marginMode': False,
1148
1150
  'triggerPrice': True,
1149
1151
  'triggerPriceType': None,
1150
1152
  'triggerDirection': False,
@@ -1154,7 +1156,6 @@ class bybit(Exchange, ImplicitAPI):
1154
1156
  'triggerPriceType': None,
1155
1157
  'limitPrice': True,
1156
1158
  },
1157
- 'marginMode': False,
1158
1159
  'timeInForce': {
1159
1160
  'GTC': True,
1160
1161
  'IOC': True,
@@ -1228,7 +1229,7 @@ class bybit(Exchange, ImplicitAPI):
1228
1229
 
1229
1230
  def add_pagination_cursor_to_result(self, response):
1230
1231
  result = self.safe_dict(response, 'result', {})
1231
- data = self.safe_value_n(result, ['list', 'rows', 'data', 'dataList'], [])
1232
+ data = self.safe_list_n(result, ['list', 'rows', 'data', 'dataList'], [])
1232
1233
  paginationCursor = self.safe_string_2(result, 'nextPageCursor', 'cursor')
1233
1234
  dataLength = len(data)
1234
1235
  if (paginationCursor is not None) and (dataLength > 0):
@@ -1239,12 +1240,12 @@ class bybit(Exchange, ImplicitAPI):
1239
1240
 
1240
1241
  def is_unified_enabled(self, params={}):
1241
1242
  """
1242
- :param dict [params]: extra parameters specific to the exchange API endpoint
1243
1243
 
1244
1244
  https://bybit-exchange.github.io/docs/v5/user/apikey-info#http-request
1245
1245
  https://bybit-exchange.github.io/docs/v5/account/account-info
1246
1246
 
1247
1247
  returns [enableUnifiedMargin, enableUnifiedAccount] so the user can check if unified account is enabled
1248
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1248
1249
  :returns any: [enableUnifiedMargin, enableUnifiedAccount]
1249
1250
  """
1250
1251
  # The API key of user id must own one of permissions will be allowed to call following API endpoints.
@@ -2277,6 +2278,7 @@ class bybit(Exchange, ImplicitAPI):
2277
2278
  :param str[] symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
2278
2279
  :param dict [params]: extra parameters specific to the exchange API endpoint
2279
2280
  :param str [params.subType]: *contract only* 'linear', 'inverse'
2281
+ :param str [params.baseCoin]: *option only* base coin, default is 'BTC'
2280
2282
  :returns dict: an array of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
2281
2283
  """
2282
2284
  self.load_markets()
@@ -2318,10 +2320,11 @@ class bybit(Exchange, ImplicitAPI):
2318
2320
  # only if passedSubType is None, then use spot
2319
2321
  if type == 'spot' and passedSubType is None:
2320
2322
  request['category'] = 'spot'
2321
- elif type == 'swap' or type == 'future' or subType is not None:
2322
- request['category'] = subType
2323
2323
  elif type == 'option':
2324
2324
  request['category'] = 'option'
2325
+ request['baseCoin'] = self.safe_string(params, 'baseCoin', 'BTC')
2326
+ elif type == 'swap' or type == 'future' or subType is not None:
2327
+ request['category'] = subType
2325
2328
  response = self.publicGetV5MarketTickers(self.extend(request, params))
2326
2329
  #
2327
2330
  # {
@@ -3108,7 +3111,7 @@ class bybit(Exchange, ImplicitAPI):
3108
3111
  'datetime': self.iso8601(timestamp),
3109
3112
  }
3110
3113
  responseResult = self.safe_dict(response, 'result', {})
3111
- currencyList = self.safe_value_n(responseResult, ['loanAccountList', 'list', 'balance'])
3114
+ currencyList = self.safe_list_n(responseResult, ['loanAccountList', 'list', 'balance'])
3112
3115
  if currencyList is None:
3113
3116
  # usdc wallet
3114
3117
  code = 'USDC'
@@ -3878,7 +3881,7 @@ class bybit(Exchange, ImplicitAPI):
3878
3881
  side = self.safe_string(rawOrder, 'side')
3879
3882
  amount = self.safe_value(rawOrder, 'amount')
3880
3883
  price = self.safe_value(rawOrder, 'price')
3881
- orderParams = self.safe_value(rawOrder, 'params', {})
3884
+ orderParams = self.safe_dict(rawOrder, 'params', {})
3882
3885
  orderRequest = self.create_order_request(marketId, type, side, amount, price, orderParams, isUta)
3883
3886
  ordersRequests.append(orderRequest)
3884
3887
  symbols = self.market_symbols(orderSymbols, None, False, True, True)
ccxt/cex.py CHANGED
@@ -26,7 +26,7 @@ class cex(Exchange, ImplicitAPI):
26
26
  'id': 'cex',
27
27
  'name': 'CEX.IO',
28
28
  'countries': ['GB', 'EU', 'CY', 'RU'],
29
- 'rateLimit': 1667, # 100 req/min
29
+ 'rateLimit': 300, # 200 req/min
30
30
  'pro': True,
31
31
  'has': {
32
32
  'CORS': None,
@@ -38,6 +38,8 @@ class cex(Exchange, ImplicitAPI):
38
38
  'cancelAllOrders': True,
39
39
  'cancelOrder': True,
40
40
  'createOrder': True,
41
+ 'createStopOrder': True,
42
+ 'createTriggerOrder': True,
41
43
  'fetchAccounts': True,
42
44
  'fetchBalance': True,
43
45
  'fetchClosedOrder': True,
@@ -918,7 +920,7 @@ class cex(Exchange, ImplicitAPI):
918
920
  # },
919
921
  # ...
920
922
  #
921
- data = self.safe_value(response, 'data', [])
923
+ data = self.safe_list(response, 'data', [])
922
924
  return self.parse_orders(data, market, since, limit)
923
925
 
924
926
  def fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
@@ -987,10 +989,16 @@ class cex(Exchange, ImplicitAPI):
987
989
 
988
990
  def parse_order_status(self, status: Str):
989
991
  statuses: dict = {
992
+ 'PENDING_NEW': 'open',
993
+ 'NEW': 'open',
994
+ 'PARTIALLY_FILLED': 'open',
990
995
  'FILLED': 'closed',
996
+ 'EXPIRED': 'expired',
997
+ 'REJECTED': 'rejected',
998
+ 'PENDING_CANCEL': 'canceling',
991
999
  'CANCELLED': 'canceled',
992
1000
  }
993
- return self.safe_string(statuses, status, None)
1001
+ return self.safe_string(statuses, status, status)
994
1002
 
995
1003
  def parse_order(self, order: dict, market: Market = None) -> Order:
996
1004
  #
@@ -1039,7 +1047,7 @@ class cex(Exchange, ImplicitAPI):
1039
1047
  currencyId = self.safe_string(order, 'feeCurrency')
1040
1048
  feeCode = self.safe_currency_code(currencyId)
1041
1049
  fee['currency'] = feeCode
1042
- fee['fee'] = feeAmount
1050
+ fee['cost'] = feeAmount
1043
1051
  timestamp = self.safe_integer(order, 'serverCreateTimestamp')
1044
1052
  requestedBase = self.safe_number(order, 'requestedAmountCcy1')
1045
1053
  executedBase = self.safe_number(order, 'executedAmountCcy1')
@@ -1083,6 +1091,7 @@ class cex(Exchange, ImplicitAPI):
1083
1091
  :param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
1084
1092
  :param dict [params]: extra parameters specific to the exchange API endpoint
1085
1093
  :param str [params.accountId]: account-id to use(default is empty string)
1094
+ :param float [params.triggerPrice]: the price at which a trigger order is triggered at
1086
1095
  :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
1087
1096
  """
1088
1097
  accountId = None
ccxt/coinbase.py CHANGED
@@ -2181,7 +2181,8 @@ class coinbase(Exchange, ImplicitAPI):
2181
2181
 
2182
2182
  :param dict [params]: extra parameters specific to the exchange API endpoint
2183
2183
  :param boolean [params.v3]: default False, set True to use v3 api endpoint
2184
- :param dict [params.type]: "spot"(default) or "swap" or "future"
2184
+ :param str [params.type]: "spot"(default) or "swap" or "future"
2185
+ :param int [params.limit]: default 250, maximum number of accounts to return
2185
2186
  :returns dict: a `balance structure <https://docs.ccxt.com/#/?id=balance-structure>`
2186
2187
  """
2187
2188
  self.load_markets()
@@ -2198,7 +2199,7 @@ class coinbase(Exchange, ImplicitAPI):
2198
2199
  request['limit'] = 250
2199
2200
  response = self.v3PrivateGetBrokerageAccounts(self.extend(request, params))
2200
2201
  else:
2201
- request['limit'] = 100
2202
+ request['limit'] = 250
2202
2203
  response = self.v2PrivateGetAccounts(self.extend(request, params))
2203
2204
  #
2204
2205
  # v2PrivateGetAccounts
ccxt/coinex.py CHANGED
@@ -68,6 +68,7 @@ class coinex(Exchange, ImplicitAPI):
68
68
  'createOrders': True,
69
69
  'createReduceOnlyOrder': True,
70
70
  'createStopLossOrder': True,
71
+ 'createStopOrder': True,
71
72
  'createTakeProfitOrder': True,
72
73
  'createTriggerOrder': True,
73
74
  'editOrder': True,