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
@@ -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
  },
@@ -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,
@@ -225,6 +225,7 @@ class bitfinex2(Exchange, ImplicitAPI):
225
225
  'pulse/hist': 2.7,
226
226
  'pulse/profile/{nickname}': 2.7,
227
227
  'funding/stats/{symbol}/hist': 10, # ratelimit not in docs
228
+ 'ext/vasps': 1,
228
229
  },
229
230
  'post': {
230
231
  'calc/trade/avg': 2.7,
@@ -1462,6 +1462,141 @@ class bitget(Exchange, ImplicitAPI):
1462
1462
  },
1463
1463
  'defaultTimeInForce': 'GTC', # 'GTC' = Good To Cancel(default), 'IOC' = Immediate Or Cancel
1464
1464
  },
1465
+ 'features': {
1466
+ 'spot': {
1467
+ 'sandbox': True,
1468
+ 'createOrder': {
1469
+ 'marginMode': True,
1470
+ 'triggerPrice': True,
1471
+ 'triggerPriceType': {
1472
+ 'last': True,
1473
+ 'mark': True,
1474
+ 'index': False, # not on spot
1475
+ },
1476
+ 'triggerDirection': False,
1477
+ 'stopLossPrice': True, # but not yet implemented in spot
1478
+ 'takeProfitPrice': True, # but not yet implemented in spot
1479
+ 'attachedStopLossTakeProfit': {
1480
+ 'triggerPriceType': {
1481
+ 'last': False,
1482
+ 'mark': False,
1483
+ 'index': False,
1484
+ },
1485
+ 'limitPrice': True,
1486
+ },
1487
+ 'timeInForce': {
1488
+ 'GTC': True,
1489
+ 'IOC': True,
1490
+ 'FOK': True,
1491
+ 'PO': True,
1492
+ 'GTD': False,
1493
+ },
1494
+ 'hedged': False,
1495
+ 'trailing': False,
1496
+ 'marketBuyRequiresPrice': True,
1497
+ 'marketBuyByCost': True,
1498
+ # exchange-supported features
1499
+ # 'selfTradePrevention': True,
1500
+ # 'twap': False,
1501
+ # 'iceberg': False,
1502
+ # 'oco': False,
1503
+ },
1504
+ 'createOrders': {
1505
+ 'max': 50,
1506
+ },
1507
+ 'fetchMyTrades': {
1508
+ 'marginMode': True,
1509
+ 'limit': 100,
1510
+ 'daysBack': None,
1511
+ 'untilDays': 90,
1512
+ },
1513
+ 'fetchOrder': {
1514
+ 'marginMode': False,
1515
+ 'trigger': False,
1516
+ 'trailing': False,
1517
+ },
1518
+ 'fetchOpenOrders': {
1519
+ 'marginMode': True,
1520
+ 'limit': 100,
1521
+ 'trigger': True,
1522
+ 'trailing': False,
1523
+ },
1524
+ 'fetchOrders': None,
1525
+ 'fetchClosedOrders': {
1526
+ 'marginMode': True,
1527
+ 'limit': 100,
1528
+ 'daysBackClosed': None,
1529
+ 'daysBackCanceled': None,
1530
+ 'untilDays': 90,
1531
+ 'trigger': True,
1532
+ 'trailing': False,
1533
+ },
1534
+ 'fetchOHLCV': {
1535
+ 'limit': 1000, # variable timespans for recent endpoint, 200 for historical
1536
+ },
1537
+ },
1538
+ 'forPerps': {
1539
+ 'extends': 'spot',
1540
+ 'createOrder': {
1541
+ 'triggerPrice': True,
1542
+ 'triggerPriceType': {
1543
+ 'last': True,
1544
+ 'mark': True,
1545
+ 'index': False, # not on spot
1546
+ },
1547
+ 'triggerDirection': False,
1548
+ 'stopLossPrice': True,
1549
+ 'takeProfitPrice': True,
1550
+ 'attachedStopLossTakeProfit': {
1551
+ 'triggerPriceType': {
1552
+ 'last': True,
1553
+ 'mark': True,
1554
+ 'index': True,
1555
+ },
1556
+ 'limitPrice': False,
1557
+ },
1558
+ 'timeInForce': {
1559
+ 'GTC': True,
1560
+ 'IOC': True,
1561
+ 'FOK': True,
1562
+ 'PO': True,
1563
+ 'GTD': False,
1564
+ },
1565
+ 'hedged': True,
1566
+ 'trailing': True,
1567
+ 'marketBuyRequiresPrice': False,
1568
+ 'marketBuyByCost': False,
1569
+ # exchange-supported features
1570
+ # 'selfTradePrevention': True,
1571
+ # 'trailing': True,
1572
+ # 'twap': False,
1573
+ # 'iceberg': False,
1574
+ # 'oco': False,
1575
+ },
1576
+ 'fetchMyTrades': {
1577
+ 'untilDays': 7,
1578
+ },
1579
+ 'fetchClosedOrders': {
1580
+ 'trailing': True,
1581
+ },
1582
+ },
1583
+ 'swap': {
1584
+ 'linear': {
1585
+ 'extends': 'forPerps',
1586
+ },
1587
+ 'inverse': {
1588
+ 'extends': 'forPerps',
1589
+ },
1590
+ },
1591
+ 'future': {
1592
+ 'linear': {
1593
+ 'extends': 'forPerps',
1594
+ },
1595
+ 'inverse': {
1596
+ 'extends': 'forPerps',
1597
+ },
1598
+ },
1599
+ },
1465
1600
  })
1466
1601
 
1467
1602
  def set_sandbox_mode(self, enabled):
@@ -4122,7 +4257,7 @@ class bitget(Exchange, ImplicitAPI):
4122
4257
  raise ExchangeError(self.id + ' createOrder() params can only contain one of triggerPrice, stopLossPrice, takeProfitPrice, trailingPercent')
4123
4258
  if type == 'limit':
4124
4259
  request['price'] = self.price_to_precision(symbol, price)
4125
- triggerType = self.safe_string(params, 'triggerType', 'mark_price')
4260
+ triggerPriceType = self.safe_string_2(params, 'triggerPriceType', 'triggerType', 'mark_price')
4126
4261
  reduceOnly = self.safe_bool(params, 'reduceOnly', False)
4127
4262
  clientOrderId = self.safe_string_2(params, 'clientOid', 'clientOrderId')
4128
4263
  exchangeSpecificTifParam = self.safe_string_2(params, 'force', 'timeInForce')
@@ -4148,7 +4283,7 @@ class bitget(Exchange, ImplicitAPI):
4148
4283
  if clientOrderId is not None:
4149
4284
  request['clientOid'] = clientOrderId
4150
4285
  if isTriggerOrder or isStopLossOrTakeProfitTrigger or isTrailingPercentOrder:
4151
- request['triggerType'] = triggerType
4286
+ request['triggerType'] = triggerPriceType
4152
4287
  if isTrailingPercentOrder:
4153
4288
  if not isMarketOrder:
4154
4289
  raise BadRequest(self.id + ' createOrder() bitget trailing orders must be market orders')
@@ -4257,7 +4392,7 @@ class bitget(Exchange, ImplicitAPI):
4257
4392
  request['size'] = quantity
4258
4393
  if triggerPrice is not None:
4259
4394
  request['planType'] = planType
4260
- request['triggerType'] = triggerType
4395
+ request['triggerType'] = triggerPriceType
4261
4396
  request['triggerPrice'] = self.price_to_precision(symbol, triggerPrice)
4262
4397
  if price is not None:
4263
4398
  request['executePrice'] = self.price_to_precision(symbol, price)
@@ -4529,7 +4664,7 @@ class bitget(Exchange, ImplicitAPI):
4529
4664
  :param str symbol: unified symbol of the market the order was made in
4530
4665
  :param dict [params]: extra parameters specific to the exchange API endpoint
4531
4666
  :param str [params.marginMode]: 'isolated' or 'cross' for spot margin trading
4532
- :param boolean [params.stop]: set to True for canceling trigger orders
4667
+ :param boolean [params.trigger]: set to True for canceling trigger orders
4533
4668
  :param str [params.planType]: *swap only* either profit_plan, loss_plan, normal_plan, pos_profit, pos_loss, moving_plan or track_plan
4534
4669
  :param boolean [params.trailing]: set to True if you want to cancel a trailing order
4535
4670
  :returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
@@ -4549,17 +4684,17 @@ class bitget(Exchange, ImplicitAPI):
4549
4684
  marginMode, params = self.handle_margin_mode_and_params('cancelOrder', params)
4550
4685
  request: dict = {}
4551
4686
  trailing = self.safe_value(params, 'trailing')
4552
- stop = self.safe_value_2(params, 'stop', 'trigger')
4687
+ trigger = self.safe_value_2(params, 'stop', 'trigger')
4553
4688
  params = self.omit(params, ['stop', 'trigger', 'trailing'])
4554
- if not (market['spot'] and stop):
4689
+ if not (market['spot'] and trigger):
4555
4690
  request['symbol'] = market['id']
4556
- if not ((market['swap'] or market['future']) and stop):
4691
+ if not ((market['swap'] or market['future']) and trigger):
4557
4692
  request['orderId'] = id
4558
4693
  if (market['swap']) or (market['future']):
4559
4694
  productType = None
4560
4695
  productType, params = self.handle_product_type_and_params(market, params)
4561
4696
  request['productType'] = productType
4562
- if stop or trailing:
4697
+ if trigger or trailing:
4563
4698
  orderIdList = []
4564
4699
  orderId: dict = {
4565
4700
  'orderId': id,
@@ -4570,7 +4705,7 @@ class bitget(Exchange, ImplicitAPI):
4570
4705
  planType = self.safe_string(params, 'planType', 'track_plan')
4571
4706
  request['planType'] = planType
4572
4707
  response = await self.privateMixPostV2MixOrderCancelPlanOrder(self.extend(request, params))
4573
- elif stop:
4708
+ elif trigger:
4574
4709
  response = await self.privateMixPostV2MixOrderCancelPlanOrder(self.extend(request, params))
4575
4710
  else:
4576
4711
  response = await self.privateMixPostV2MixOrderCancelOrder(self.extend(request, params))
@@ -4581,7 +4716,7 @@ class bitget(Exchange, ImplicitAPI):
4581
4716
  elif marginMode == 'cross':
4582
4717
  response = await self.privateMarginPostV2MarginCrossedCancelOrder(self.extend(request, params))
4583
4718
  else:
4584
- if stop:
4719
+ if trigger:
4585
4720
  response = await self.privateSpotPostV2SpotTradeCancelPlanOrder(self.extend(request, params))
4586
4721
  else:
4587
4722
  response = await self.privateSpotPostV2SpotTradeCancelOrder(self.extend(request, params))
@@ -4630,7 +4765,7 @@ class bitget(Exchange, ImplicitAPI):
4630
4765
  #
4631
4766
  data = self.safe_value(response, 'data', {})
4632
4767
  order = None
4633
- if (market['swap'] or market['future']) and stop:
4768
+ if (market['swap'] or market['future']) and trigger:
4634
4769
  orderInfo = self.safe_value(data, 'successList', [])
4635
4770
  order = orderInfo[0]
4636
4771
  else:
@@ -4651,7 +4786,7 @@ class bitget(Exchange, ImplicitAPI):
4651
4786
  :param str symbol: unified market symbol, default is None
4652
4787
  :param dict [params]: extra parameters specific to the exchange API endpoint
4653
4788
  :param str [params.marginMode]: 'isolated' or 'cross' for spot margin trading
4654
- :param boolean [params.stop]: *contract only* set to True for canceling trigger orders
4789
+ :param boolean [params.trigger]: *contract only* set to True for canceling trigger orders
4655
4790
  :returns dict: an array of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
4656
4791
  """
4657
4792
  if symbol is None:
@@ -4666,7 +4801,7 @@ class bitget(Exchange, ImplicitAPI):
4666
4801
  market = self.market(symbol)
4667
4802
  marginMode = None
4668
4803
  marginMode, params = self.handle_margin_mode_and_params('cancelOrders', params)
4669
- stop = self.safe_value_2(params, 'stop', 'trigger')
4804
+ trigger = self.safe_value_2(params, 'stop', 'trigger')
4670
4805
  params = self.omit(params, ['stop', 'trigger'])
4671
4806
  orderIdList = []
4672
4807
  for i in range(0, len(ids)):
@@ -4695,7 +4830,7 @@ class bitget(Exchange, ImplicitAPI):
4695
4830
  productType = None
4696
4831
  productType, params = self.handle_product_type_and_params(market, params)
4697
4832
  request['productType'] = productType
4698
- if stop:
4833
+ if trigger:
4699
4834
  response = await self.privateMixPostV2MixOrderCancelPlanOrder(self.extend(request, params))
4700
4835
  else:
4701
4836
  response = await self.privateMixPostV2MixOrderBatchCancelOrders(self.extend(request, params))
@@ -4732,7 +4867,7 @@ class bitget(Exchange, ImplicitAPI):
4732
4867
  :param str symbol: unified market symbol
4733
4868
  :param dict [params]: extra parameters specific to the exchange API endpoint
4734
4869
  :param str [params.marginMode]: 'isolated' or 'cross' for spot margin trading
4735
- :param boolean [params.stop]: *contract only* set to True for canceling trigger orders
4870
+ :param boolean [params.trigger]: *contract only* set to True for canceling trigger orders
4736
4871
  :returns dict[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
4737
4872
  """
4738
4873
  if symbol is None:
@@ -4750,7 +4885,7 @@ class bitget(Exchange, ImplicitAPI):
4750
4885
  request: dict = {
4751
4886
  'symbol': market['id'],
4752
4887
  }
4753
- stop = self.safe_bool_2(params, 'stop', 'trigger')
4888
+ trigger = self.safe_bool_2(params, 'stop', 'trigger')
4754
4889
  params = self.omit(params, ['stop', 'trigger'])
4755
4890
  response = None
4756
4891
  if market['spot']:
@@ -4776,7 +4911,7 @@ class bitget(Exchange, ImplicitAPI):
4776
4911
  # }
4777
4912
  #
4778
4913
  else:
4779
- if stop:
4914
+ if trigger:
4780
4915
  stopRequest: dict = {
4781
4916
  'symbolList': [market['id']],
4782
4917
  }
@@ -4808,7 +4943,7 @@ class bitget(Exchange, ImplicitAPI):
4808
4943
  productType = None
4809
4944
  productType, params = self.handle_product_type_and_params(market, params)
4810
4945
  request['productType'] = productType
4811
- if stop:
4946
+ if trigger:
4812
4947
  response = await self.privateMixPostV2MixOrderCancelPlanOrder(self.extend(request, params))
4813
4948
  else:
4814
4949
  response = await self.privateMixPostV2MixOrderBatchCancelOrders(self.extend(request, params))
@@ -4964,7 +5099,7 @@ class bitget(Exchange, ImplicitAPI):
4964
5099
  :param dict [params]: extra parameters specific to the exchange API endpoint
4965
5100
  :param int [params.until]: the latest time in ms to fetch orders for
4966
5101
  :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'
4967
- :param boolean [params.stop]: set to True for fetching trigger orders
5102
+ :param boolean [params.trigger]: set to True for fetching trigger orders
4968
5103
  :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)
4969
5104
  :param str [params.isPlan]: *swap only* 'plan' for stop orders and 'profit_loss' for tp/sl orders, default is 'plan'
4970
5105
  :param boolean [params.trailing]: set to True if you want to fetch trailing orders
@@ -5002,9 +5137,9 @@ class bitget(Exchange, ImplicitAPI):
5002
5137
  return await self.fetch_paginated_call_cursor('fetchOpenOrders', symbol, since, limit, params, cursorReceived, 'idLessThan')
5003
5138
  response = None
5004
5139
  trailing = self.safe_bool(params, 'trailing')
5005
- stop = self.safe_bool_2(params, 'stop', 'trigger')
5140
+ trigger = self.safe_bool_2(params, 'stop', 'trigger')
5006
5141
  planTypeDefined = self.safe_string(params, 'planType') is not None
5007
- isStop = (stop or planTypeDefined)
5142
+ isTrigger = (trigger or planTypeDefined)
5008
5143
  params = self.omit(params, ['stop', 'trigger', 'trailing'])
5009
5144
  request, params = self.handle_until_option('endTime', request, params)
5010
5145
  if since is not None:
@@ -5028,7 +5163,7 @@ class bitget(Exchange, ImplicitAPI):
5028
5163
  elif marginMode == 'cross':
5029
5164
  response = await self.privateMarginGetV2MarginCrossedOpenOrders(self.extend(request, query))
5030
5165
  else:
5031
- if stop:
5166
+ if trigger:
5032
5167
  response = await self.privateSpotGetV2SpotTradeCurrentPlanOrder(self.extend(request, query))
5033
5168
  else:
5034
5169
  response = await self.privateSpotGetV2SpotTradeUnfilledOrders(self.extend(request, query))
@@ -5040,7 +5175,7 @@ class bitget(Exchange, ImplicitAPI):
5040
5175
  planType = self.safe_string(params, 'planType', 'track_plan')
5041
5176
  request['planType'] = planType
5042
5177
  response = await self.privateMixGetV2MixOrderOrdersPlanPending(self.extend(request, query))
5043
- elif isStop:
5178
+ elif isTrigger:
5044
5179
  planType = self.safe_string(query, 'planType', 'normal_plan')
5045
5180
  request['planType'] = planType
5046
5181
  response = await self.privateMixGetV2MixOrderOrdersPlanPending(self.extend(request, query))
@@ -5223,7 +5358,7 @@ class bitget(Exchange, ImplicitAPI):
5223
5358
  #
5224
5359
  data = self.safe_value(response, 'data')
5225
5360
  if type == 'spot':
5226
- if (marginMode is not None) or stop:
5361
+ if (marginMode is not None) or trigger:
5227
5362
  resultList = self.safe_list(data, 'orderList', [])
5228
5363
  return self.parse_orders(resultList, market, since, limit)
5229
5364
  else:
@@ -5327,7 +5462,7 @@ class bitget(Exchange, ImplicitAPI):
5327
5462
  return await self.fetch_paginated_call_cursor('fetchCanceledAndClosedOrders', symbol, since, limit, params, cursorReceived, 'idLessThan')
5328
5463
  response = None
5329
5464
  trailing = self.safe_value(params, 'trailing')
5330
- stop = self.safe_bool_2(params, 'stop', 'trigger')
5465
+ trigger = self.safe_bool_2(params, 'stop', 'trigger')
5331
5466
  params = self.omit(params, ['stop', 'trigger', 'trailing'])
5332
5467
  request, params = self.handle_until_option('endTime', request, params)
5333
5468
  if since is not None:
@@ -5349,20 +5484,19 @@ class bitget(Exchange, ImplicitAPI):
5349
5484
  response = await self.privateMarginGetV2MarginIsolatedHistoryOrders(self.extend(request, params))
5350
5485
  elif marginMode == 'cross':
5351
5486
  response = await self.privateMarginGetV2MarginCrossedHistoryOrders(self.extend(request, params))
5487
+ elif trigger:
5488
+ if symbol is None:
5489
+ raise ArgumentsRequired(self.id + ' fetchCanceledAndClosedOrders() requires a symbol argument')
5490
+ endTime = self.safe_integer_n(params, ['endTime', 'until'])
5491
+ params = self.omit(params, ['until'])
5492
+ if since is None:
5493
+ since = now - 7776000000
5494
+ request['startTime'] = since
5495
+ if endTime is None:
5496
+ request['endTime'] = now
5497
+ response = await self.privateSpotGetV2SpotTradeHistoryPlanOrder(self.extend(request, params))
5352
5498
  else:
5353
- if stop:
5354
- if symbol is None:
5355
- raise ArgumentsRequired(self.id + ' fetchCanceledAndClosedOrders() requires a symbol argument')
5356
- endTime = self.safe_integer_n(params, ['endTime', 'until'])
5357
- params = self.omit(params, ['until'])
5358
- if since is None:
5359
- since = now - 7776000000
5360
- request['startTime'] = since
5361
- if endTime is None:
5362
- request['endTime'] = now
5363
- response = await self.privateSpotGetV2SpotTradeHistoryPlanOrder(self.extend(request, params))
5364
- else:
5365
- response = await self.privateSpotGetV2SpotTradeHistoryOrders(self.extend(request, params))
5499
+ response = await self.privateSpotGetV2SpotTradeHistoryOrders(self.extend(request, params))
5366
5500
  else:
5367
5501
  productType = None
5368
5502
  productType, params = self.handle_product_type_and_params(market, params)
@@ -5371,7 +5505,7 @@ class bitget(Exchange, ImplicitAPI):
5371
5505
  planType = self.safe_string(params, 'planType', 'track_plan')
5372
5506
  request['planType'] = planType
5373
5507
  response = await self.privateMixGetV2MixOrderOrdersPlanHistory(self.extend(request, params))
5374
- elif stop:
5508
+ elif trigger:
5375
5509
  planType = self.safe_string(params, 'planType', 'normal_plan')
5376
5510
  request['planType'] = planType
5377
5511
  response = await self.privateMixGetV2MixOrderOrdersPlanHistory(self.extend(request, params))
@@ -5557,7 +5691,7 @@ class bitget(Exchange, ImplicitAPI):
5557
5691
  #
5558
5692
  data = self.safe_value(response, 'data', {})
5559
5693
  if marketType == 'spot':
5560
- if (marginMode is not None) or stop:
5694
+ if (marginMode is not None) or trigger:
5561
5695
  return self.parse_orders(self.safe_value(data, 'orderList', []), market, since, limit)
5562
5696
  else:
5563
5697
  return self.parse_orders(self.safe_value(data, 'entrustedList', []), market, since, limit)
@@ -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)
@@ -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
  await self.load_markets()
@@ -532,6 +532,7 @@ class bitrue(Exchange, ImplicitAPI):
532
532
  '-4051': InsufficientFunds, # {"code":-4051,"msg":"Isolated balance insufficient."}
533
533
  },
534
534
  'broad': {
535
+ 'Insufficient account balance': InsufficientFunds, # {"code":-2010,"msg":"Insufficient account balance.","data":null}
535
536
  'has no operation privilege': PermissionDenied,
536
537
  'MAX_POSITION': InvalidOrder, # {"code":-2010,"msg":"Filter failure: MAX_POSITION"}
537
538
  },
@@ -2939,7 +2940,7 @@ class bitrue(Exchange, ImplicitAPI):
2939
2940
  version = self.safe_string(api, 1)
2940
2941
  access = self.safe_string(api, 2)
2941
2942
  url = None
2942
- if type == 'api' and version == 'kline':
2943
+ if (type == 'api' and version == 'kline') or (type == 'open' and path.find('listenKey') >= 0):
2943
2944
  url = self.urls['api'][type]
2944
2945
  else:
2945
2946
  url = self.urls['api'][type] + '/' + version
@@ -2948,7 +2949,7 @@ class bitrue(Exchange, ImplicitAPI):
2948
2949
  if access == 'private':
2949
2950
  self.check_required_credentials()
2950
2951
  recvWindow = self.safe_integer(self.options, 'recvWindow', 5000)
2951
- if type == 'spot':
2952
+ if type == 'spot' or type == 'open':
2952
2953
  query = self.urlencode(self.extend({
2953
2954
  'timestamp': self.nonce(),
2954
2955
  'recvWindow': recvWindow,
@@ -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
  await 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,
@@ -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 = await 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