ccxt 4.4.33__py2.py3-none-any.whl → 4.4.35__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 (100) hide show
  1. ccxt/__init__.py +3 -1
  2. ccxt/abstract/bingx.py +17 -0
  3. ccxt/abstract/bitbank.py +5 -0
  4. ccxt/abstract/bitfinex2.py +1 -0
  5. ccxt/abstract/bitpanda.py +0 -12
  6. ccxt/abstract/bitrue.py +3 -3
  7. ccxt/abstract/ellipx.py +25 -0
  8. ccxt/abstract/okx.py +1 -0
  9. ccxt/abstract/onetrading.py +0 -12
  10. ccxt/abstract/xt.py +5 -5
  11. ccxt/alpaca.py +2 -0
  12. ccxt/async_support/__init__.py +3 -1
  13. ccxt/async_support/alpaca.py +2 -0
  14. ccxt/async_support/base/exchange.py +1 -1
  15. ccxt/async_support/binance.py +19 -15
  16. ccxt/async_support/bingx.py +479 -146
  17. ccxt/async_support/bitbank.py +5 -0
  18. ccxt/async_support/bitbns.py +2 -0
  19. ccxt/async_support/bitfinex2.py +1 -0
  20. ccxt/async_support/bitget.py +174 -40
  21. ccxt/async_support/bitmex.py +3 -1
  22. ccxt/async_support/bitopro.py +3 -0
  23. ccxt/async_support/bitrue.py +3 -2
  24. ccxt/async_support/btcmarkets.py +5 -3
  25. ccxt/async_support/btcturk.py +19 -19
  26. ccxt/async_support/bybit.py +13 -10
  27. ccxt/async_support/cex.py +13 -4
  28. ccxt/async_support/coinbase.py +3 -2
  29. ccxt/async_support/coinex.py +1 -0
  30. ccxt/async_support/coinone.py +7 -7
  31. ccxt/async_support/coinsph.py +7 -7
  32. ccxt/async_support/coinspot.py +39 -39
  33. ccxt/async_support/cryptocom.py +36 -34
  34. ccxt/async_support/ellipx.py +1828 -0
  35. ccxt/async_support/gate.py +143 -39
  36. ccxt/async_support/hyperliquid.py +70 -11
  37. ccxt/async_support/idex.py +3 -4
  38. ccxt/async_support/kraken.py +58 -49
  39. ccxt/async_support/krakenfutures.py +3 -1
  40. ccxt/async_support/kucoin.py +1 -1
  41. ccxt/async_support/okcoin.py +2 -0
  42. ccxt/async_support/okx.py +15 -10
  43. ccxt/async_support/onetrading.py +67 -370
  44. ccxt/async_support/paradex.py +2 -0
  45. ccxt/async_support/phemex.py +16 -0
  46. ccxt/async_support/poloniex.py +3 -1
  47. ccxt/async_support/poloniexfutures.py +3 -1
  48. ccxt/async_support/vertex.py +2 -0
  49. ccxt/async_support/woo.py +69 -69
  50. ccxt/async_support/xt.py +10 -10
  51. ccxt/base/exchange.py +28 -7
  52. ccxt/binance.py +19 -15
  53. ccxt/bingx.py +479 -146
  54. ccxt/bitbank.py +5 -0
  55. ccxt/bitbns.py +2 -0
  56. ccxt/bitfinex2.py +1 -0
  57. ccxt/bitget.py +174 -40
  58. ccxt/bitmex.py +3 -1
  59. ccxt/bitopro.py +3 -0
  60. ccxt/bitrue.py +3 -2
  61. ccxt/btcmarkets.py +5 -3
  62. ccxt/btcturk.py +19 -19
  63. ccxt/bybit.py +13 -10
  64. ccxt/cex.py +13 -4
  65. ccxt/coinbase.py +3 -2
  66. ccxt/coinex.py +1 -0
  67. ccxt/coinone.py +7 -7
  68. ccxt/coinsph.py +7 -7
  69. ccxt/coinspot.py +39 -39
  70. ccxt/cryptocom.py +36 -34
  71. ccxt/ellipx.py +1828 -0
  72. ccxt/gate.py +143 -39
  73. ccxt/hyperliquid.py +70 -11
  74. ccxt/idex.py +3 -4
  75. ccxt/kraken.py +58 -49
  76. ccxt/krakenfutures.py +3 -1
  77. ccxt/kucoin.py +1 -1
  78. ccxt/okcoin.py +2 -0
  79. ccxt/okx.py +15 -10
  80. ccxt/onetrading.py +67 -370
  81. ccxt/paradex.py +2 -0
  82. ccxt/phemex.py +16 -0
  83. ccxt/poloniex.py +3 -1
  84. ccxt/poloniexfutures.py +3 -1
  85. ccxt/pro/__init__.py +1 -1
  86. ccxt/pro/bitrue.py +13 -11
  87. ccxt/pro/idex.py +15 -0
  88. ccxt/pro/probit.py +58 -68
  89. ccxt/pro/woo.py +15 -15
  90. ccxt/test/tests_async.py +29 -2
  91. ccxt/test/tests_helpers.py +0 -2
  92. ccxt/test/tests_sync.py +29 -2
  93. ccxt/vertex.py +2 -0
  94. ccxt/woo.py +69 -69
  95. ccxt/xt.py +10 -10
  96. {ccxt-4.4.33.dist-info → ccxt-4.4.35.dist-info}/METADATA +9 -8
  97. {ccxt-4.4.33.dist-info → ccxt-4.4.35.dist-info}/RECORD +100 -97
  98. {ccxt-4.4.33.dist-info → ccxt-4.4.35.dist-info}/LICENSE.txt +0 -0
  99. {ccxt-4.4.33.dist-info → ccxt-4.4.35.dist-info}/WHEEL +0 -0
  100. {ccxt-4.4.33.dist-info → ccxt-4.4.35.dist-info}/top_level.txt +0 -0
ccxt/bitbank.py CHANGED
@@ -128,8 +128,11 @@ class bitbank(Exchange, ImplicitAPI):
128
128
  'user/assets',
129
129
  'user/spot/order',
130
130
  'user/spot/active_orders',
131
+ 'user/margin/positions',
131
132
  'user/spot/trade_history',
132
133
  'user/deposit_history',
134
+ 'user/unconfirmed_deposits',
135
+ 'user/deposit_originators',
133
136
  'user/withdrawal_account',
134
137
  'user/withdrawal_history',
135
138
  'spot/status',
@@ -140,6 +143,8 @@ class bitbank(Exchange, ImplicitAPI):
140
143
  'user/spot/cancel_order',
141
144
  'user/spot/cancel_orders',
142
145
  'user/spot/orders_info',
146
+ 'user/confirm_deposits',
147
+ 'user/confirm_deposits_all',
143
148
  'user/request_withdrawal',
144
149
  ],
145
150
  },
ccxt/bitbns.py CHANGED
@@ -39,6 +39,8 @@ class bitbns(Exchange, ImplicitAPI):
39
39
  'cancelAllOrders': False,
40
40
  'cancelOrder': True,
41
41
  'createOrder': True,
42
+ 'createStopOrder': True,
43
+ 'createTriggerOrder': True,
42
44
  'fetchBalance': True,
43
45
  'fetchDepositAddress': True,
44
46
  'fetchDepositAddresses': False,
ccxt/bitfinex2.py CHANGED
@@ -224,6 +224,7 @@ class bitfinex2(Exchange, ImplicitAPI):
224
224
  'pulse/hist': 2.7,
225
225
  'pulse/profile/{nickname}': 2.7,
226
226
  'funding/stats/{symbol}/hist': 10, # ratelimit not in docs
227
+ 'ext/vasps': 1,
227
228
  },
228
229
  'post': {
229
230
  'calc/trade/avg': 2.7,
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,
@@ -1469,7 +1471,7 @@ class bitmex(Exchange, ImplicitAPI):
1469
1471
  }
1470
1472
  if limit is not None:
1471
1473
  request['count'] = limit # default 100, max 500
1472
- until = self.safe_integer_2(params, 'until', 'endTime')
1474
+ until = self.safe_integer(params, 'until')
1473
1475
  if until is not None:
1474
1476
  params = self.omit(params, ['until'])
1475
1477
  request['endTime'] = self.iso8601(until)
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
  },
@@ -2938,7 +2939,7 @@ class bitrue(Exchange, ImplicitAPI):
2938
2939
  version = self.safe_string(api, 1)
2939
2940
  access = self.safe_string(api, 2)
2940
2941
  url = None
2941
- if type == 'api' and version == 'kline':
2942
+ if (type == 'api' and version == 'kline') or (type == 'open' and path.find('listenKey') >= 0):
2942
2943
  url = self.urls['api'][type]
2943
2944
  else:
2944
2945
  url = self.urls['api'][type] + '/' + version
@@ -2947,7 +2948,7 @@ class bitrue(Exchange, ImplicitAPI):
2947
2948
  if access == 'private':
2948
2949
  self.check_required_credentials()
2949
2950
  recvWindow = self.safe_integer(self.options, 'recvWindow', 5000)
2950
- if type == 'spot':
2951
+ if type == 'spot' or type == 'open':
2951
2952
  query = self.urlencode(self.extend({
2952
2953
  'timestamp': self.nonce(),
2953
2954
  'recvWindow': recvWindow,
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,
@@ -312,7 +313,7 @@ class btcmarkets(Exchange, ImplicitAPI):
312
313
  type = self.parse_transaction_type(self.safe_string_lower(transaction, 'type'))
313
314
  if type == 'withdraw':
314
315
  type = 'withdrawal'
315
- cryptoPaymentDetail = self.safe_value(transaction, 'paymentDetail', {})
316
+ cryptoPaymentDetail = self.safe_dict(transaction, 'paymentDetail', {})
316
317
  txid = self.safe_string(cryptoPaymentDetail, 'txId')
317
318
  address = self.safe_string(cryptoPaymentDetail, 'address')
318
319
  tag = None
@@ -393,7 +394,7 @@ class btcmarkets(Exchange, ImplicitAPI):
393
394
  base = self.safe_currency_code(baseId)
394
395
  quote = self.safe_currency_code(quoteId)
395
396
  symbol = base + '/' + quote
396
- fees = self.safe_value(self.safe_value(self.options, 'fees', {}), quote, self.fees)
397
+ fees = self.safe_value(self.safe_dict(self.options, 'fees', {}), quote, self.fees)
397
398
  pricePrecision = self.parse_number(self.parse_precision(self.safe_string(market, 'priceDecimals')))
398
399
  minAmount = self.safe_number(market, 'minOrderAmount')
399
400
  maxAmount = self.safe_number(market, 'maxOrderAmount')
@@ -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()
@@ -1014,7 +1016,7 @@ class btcmarkets(Exchange, ImplicitAPI):
1014
1016
  clientOrderId = self.safe_string(order, 'clientOrderId')
1015
1017
  timeInForce = self.safe_string(order, 'timeInForce')
1016
1018
  stopPrice = self.safe_number(order, 'triggerPrice')
1017
- postOnly = self.safe_value(order, 'postOnly')
1019
+ postOnly = self.safe_bool(order, 'postOnly')
1018
1020
  return self.safe_order({
1019
1021
  'info': order,
1020
1022
  'id': id,
ccxt/btcturk.py CHANGED
@@ -205,8 +205,8 @@ class btcturk(Exchange, ImplicitAPI):
205
205
  # ],
206
206
  # }
207
207
  #
208
- data = self.safe_value(response, 'data')
209
- markets = self.safe_value(data, 'symbols', [])
208
+ data = self.safe_dict(response, 'data', {})
209
+ markets = self.safe_list(data, 'symbols', [])
210
210
  return self.parse_markets(markets)
211
211
 
212
212
  def parse_market(self, entry) -> Market:
@@ -215,7 +215,7 @@ class btcturk(Exchange, ImplicitAPI):
215
215
  quoteId = self.safe_string(entry, 'denominator')
216
216
  base = self.safe_currency_code(baseId)
217
217
  quote = self.safe_currency_code(quoteId)
218
- filters = self.safe_value(entry, 'filters', [])
218
+ filters = self.safe_list(entry, 'filters', [])
219
219
  minPrice = None
220
220
  maxPrice = None
221
221
  minAmount = None
@@ -282,7 +282,7 @@ class btcturk(Exchange, ImplicitAPI):
282
282
  }
283
283
 
284
284
  def parse_balance(self, response) -> Balances:
285
- data = self.safe_value(response, 'data', [])
285
+ data = self.safe_list(response, 'data', [])
286
286
  result: dict = {
287
287
  'info': response,
288
288
  'timestamp': None,
@@ -356,7 +356,7 @@ class btcturk(Exchange, ImplicitAPI):
356
356
  # ]
357
357
  # }
358
358
  # }
359
- data = self.safe_value(response, 'data')
359
+ data = self.safe_dict(response, 'data', {})
360
360
  timestamp = self.safe_integer(data, 'timestamp')
361
361
  return self.parse_order_book(data, market['symbol'], timestamp, 'bids', 'asks', 0, 1)
362
362
 
@@ -637,20 +637,20 @@ class btcturk(Exchange, ImplicitAPI):
637
637
 
638
638
  def parse_ohlcvs(self, ohlcvs, market=None, timeframe='1m', since: Int = None, limit: Int = None, tail: Bool = False):
639
639
  results = []
640
- timestamp = self.safe_value(ohlcvs, 't')
641
- high = self.safe_value(ohlcvs, 'h')
642
- open = self.safe_value(ohlcvs, 'o')
643
- low = self.safe_value(ohlcvs, 'l')
644
- close = self.safe_value(ohlcvs, 'c')
645
- volume = self.safe_value(ohlcvs, 'v')
640
+ timestamp = self.safe_list(ohlcvs, 't', [])
641
+ high = self.safe_list(ohlcvs, 'h', [])
642
+ open = self.safe_list(ohlcvs, 'o', [])
643
+ low = self.safe_list(ohlcvs, 'l', [])
644
+ close = self.safe_list(ohlcvs, 'c', [])
645
+ volume = self.safe_list(ohlcvs, 'v', [])
646
646
  for i in range(0, len(timestamp)):
647
647
  ohlcv: dict = {
648
- 'timestamp': self.safe_value(timestamp, i),
649
- 'high': self.safe_value(high, i),
650
- 'open': self.safe_value(open, i),
651
- 'low': self.safe_value(low, i),
652
- 'close': self.safe_value(close, i),
653
- 'volume': self.safe_value(volume, i),
648
+ 'timestamp': self.safe_integer(timestamp, i),
649
+ 'high': self.safe_number(high, i),
650
+ 'open': self.safe_number(open, i),
651
+ 'low': self.safe_number(low, i),
652
+ 'close': self.safe_number(close, i),
653
+ 'volume': self.safe_number(volume, i),
654
654
  }
655
655
  results.append(self.parse_ohlcv(ohlcv, market))
656
656
  sorted = self.sort_by(results, 0)
@@ -733,8 +733,8 @@ class btcturk(Exchange, ImplicitAPI):
733
733
  market = self.market(symbol)
734
734
  request['pairSymbol'] = market['id']
735
735
  response = self.privateGetOpenOrders(self.extend(request, params))
736
- data = self.safe_value(response, 'data')
737
- bids = self.safe_value(data, 'bids', [])
736
+ data = self.safe_dict(response, 'data', {})
737
+ bids = self.safe_list(data, 'bids', [])
738
738
  asks = self.safe_list(data, 'asks', [])
739
739
  return self.parse_orders(self.array_concat(bids, asks), market, since, limit)
740
740