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.
- ccxt/__init__.py +3 -1
- ccxt/abstract/bingx.py +16 -0
- ccxt/abstract/bitbank.py +5 -0
- ccxt/abstract/bitfinex2.py +1 -0
- ccxt/abstract/ellipx.py +25 -0
- ccxt/alpaca.py +2 -0
- ccxt/async_support/__init__.py +3 -1
- ccxt/async_support/alpaca.py +2 -0
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/binance.py +19 -15
- ccxt/async_support/bingx.py +155 -8
- ccxt/async_support/bitbank.py +5 -0
- ccxt/async_support/bitbns.py +2 -0
- ccxt/async_support/bitfinex2.py +1 -0
- ccxt/async_support/bitget.py +174 -40
- ccxt/async_support/bitmex.py +2 -0
- ccxt/async_support/bitopro.py +3 -0
- ccxt/async_support/bitrue.py +1 -0
- ccxt/async_support/btcmarkets.py +2 -0
- ccxt/async_support/bybit.py +13 -10
- ccxt/async_support/cex.py +13 -4
- ccxt/async_support/coinbase.py +3 -2
- ccxt/async_support/coinex.py +1 -0
- ccxt/async_support/coinone.py +7 -7
- ccxt/async_support/coinsph.py +7 -7
- ccxt/async_support/coinspot.py +39 -39
- ccxt/async_support/cryptocom.py +36 -34
- ccxt/async_support/ellipx.py +1828 -0
- ccxt/async_support/gate.py +1 -0
- ccxt/async_support/hyperliquid.py +2 -0
- ccxt/async_support/krakenfutures.py +3 -1
- ccxt/async_support/okcoin.py +2 -0
- ccxt/async_support/okx.py +14 -10
- ccxt/async_support/onetrading.py +20 -1
- ccxt/async_support/paradex.py +2 -0
- ccxt/async_support/phemex.py +16 -0
- ccxt/async_support/poloniex.py +3 -1
- ccxt/async_support/poloniexfutures.py +3 -1
- ccxt/async_support/vertex.py +2 -0
- ccxt/async_support/woo.py +69 -69
- ccxt/base/exchange.py +27 -7
- ccxt/binance.py +19 -15
- ccxt/bingx.py +155 -8
- ccxt/bitbank.py +5 -0
- ccxt/bitbns.py +2 -0
- ccxt/bitfinex2.py +1 -0
- ccxt/bitget.py +174 -40
- ccxt/bitmex.py +2 -0
- ccxt/bitopro.py +3 -0
- ccxt/bitrue.py +1 -0
- ccxt/btcmarkets.py +2 -0
- ccxt/bybit.py +13 -10
- ccxt/cex.py +13 -4
- ccxt/coinbase.py +3 -2
- ccxt/coinex.py +1 -0
- ccxt/coinone.py +7 -7
- ccxt/coinsph.py +7 -7
- ccxt/coinspot.py +39 -39
- ccxt/cryptocom.py +36 -34
- ccxt/ellipx.py +1828 -0
- ccxt/gate.py +1 -0
- ccxt/hyperliquid.py +2 -0
- ccxt/krakenfutures.py +3 -1
- ccxt/okcoin.py +2 -0
- ccxt/okx.py +14 -10
- ccxt/onetrading.py +20 -1
- ccxt/paradex.py +2 -0
- ccxt/phemex.py +16 -0
- ccxt/poloniex.py +3 -1
- ccxt/poloniexfutures.py +3 -1
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/idex.py +15 -0
- ccxt/pro/probit.py +4 -2
- ccxt/pro/woo.py +15 -15
- ccxt/test/tests_helpers.py +0 -2
- ccxt/vertex.py +2 -0
- ccxt/woo.py +69 -69
- {ccxt-4.4.33.dist-info → ccxt-4.4.34.dist-info}/METADATA +9 -8
- {ccxt-4.4.33.dist-info → ccxt-4.4.34.dist-info}/RECORD +82 -79
- {ccxt-4.4.33.dist-info → ccxt-4.4.34.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.4.33.dist-info → ccxt-4.4.34.dist-info}/WHEEL +0 -0
- {ccxt-4.4.33.dist-info → ccxt-4.4.34.dist-info}/top_level.txt +0 -0
ccxt/async_support/bitget.py
CHANGED
@@ -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
|
-
|
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'] =
|
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'] =
|
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.
|
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
|
-
|
4687
|
+
trigger = self.safe_value_2(params, 'stop', 'trigger')
|
4553
4688
|
params = self.omit(params, ['stop', 'trigger', 'trailing'])
|
4554
|
-
if not (market['spot'] and
|
4689
|
+
if not (market['spot'] and trigger):
|
4555
4690
|
request['symbol'] = market['id']
|
4556
|
-
if not ((market['swap'] or market['future']) and
|
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
|
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
|
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
|
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
|
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.
|
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
|
-
|
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
|
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.
|
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
|
-
|
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
|
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
|
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.
|
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
|
-
|
5140
|
+
trigger = self.safe_bool_2(params, 'stop', 'trigger')
|
5006
5141
|
planTypeDefined = self.safe_string(params, 'planType') is not None
|
5007
|
-
|
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
|
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
|
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
|
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
|
-
|
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
|
-
|
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
|
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
|
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)
|
ccxt/async_support/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/async_support/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
|
await self.load_markets()
|
ccxt/async_support/bitrue.py
CHANGED
@@ -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
|
},
|
ccxt/async_support/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
|
await self.load_markets()
|
ccxt/async_support/bybit.py
CHANGED
@@ -1077,6 +1077,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
1077
1077
|
'default': {
|
1078
1078
|
'sandbox': True,
|
1079
1079
|
'createOrder': {
|
1080
|
+
'marginMode': False,
|
1080
1081
|
'triggerPrice': True,
|
1081
1082
|
'triggerPriceType': {
|
1082
1083
|
'last': True,
|
@@ -1094,7 +1095,6 @@ class bybit(Exchange, ImplicitAPI):
|
|
1094
1095
|
},
|
1095
1096
|
'limitPrice': True,
|
1096
1097
|
},
|
1097
|
-
'marginMode': False,
|
1098
1098
|
'timeInForce': {
|
1099
1099
|
'GTC': True,
|
1100
1100
|
'IOC': True,
|
@@ -1114,6 +1114,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
1114
1114
|
'max': 10,
|
1115
1115
|
},
|
1116
1116
|
'fetchMyTrades': {
|
1117
|
+
'marginMode': False,
|
1117
1118
|
'limit': 100,
|
1118
1119
|
'daysBack': 365 * 2, # 2 years
|
1119
1120
|
'untilDays': 7, # days between start-end
|
@@ -1124,18 +1125,18 @@ class bybit(Exchange, ImplicitAPI):
|
|
1124
1125
|
'trailing': False,
|
1125
1126
|
},
|
1126
1127
|
'fetchOpenOrders': {
|
1127
|
-
'limit': 50,
|
1128
1128
|
'marginMode': False,
|
1129
|
+
'limit': 50,
|
1129
1130
|
'trigger': True,
|
1130
1131
|
'trailing': False,
|
1131
1132
|
},
|
1132
1133
|
'fetchOrders': None,
|
1133
1134
|
'fetchClosedOrders': {
|
1135
|
+
'marginMode': False,
|
1134
1136
|
'limit': 50,
|
1135
1137
|
'daysBackClosed': 365 * 2, # 2 years
|
1136
1138
|
'daysBackCanceled': 1,
|
1137
1139
|
'untilDays': 7,
|
1138
|
-
'marginMode': False,
|
1139
1140
|
'trigger': True,
|
1140
1141
|
'trailing': False,
|
1141
1142
|
},
|
@@ -1146,6 +1147,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
1146
1147
|
'spot': {
|
1147
1148
|
'extends': 'default',
|
1148
1149
|
'createOrder': {
|
1150
|
+
'marginMode': False,
|
1149
1151
|
'triggerPrice': True,
|
1150
1152
|
'triggerPriceType': None,
|
1151
1153
|
'triggerDirection': False,
|
@@ -1155,7 +1157,6 @@ class bybit(Exchange, ImplicitAPI):
|
|
1155
1157
|
'triggerPriceType': None,
|
1156
1158
|
'limitPrice': True,
|
1157
1159
|
},
|
1158
|
-
'marginMode': False,
|
1159
1160
|
'timeInForce': {
|
1160
1161
|
'GTC': True,
|
1161
1162
|
'IOC': True,
|
@@ -1229,7 +1230,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
1229
1230
|
|
1230
1231
|
def add_pagination_cursor_to_result(self, response):
|
1231
1232
|
result = self.safe_dict(response, 'result', {})
|
1232
|
-
data = self.
|
1233
|
+
data = self.safe_list_n(result, ['list', 'rows', 'data', 'dataList'], [])
|
1233
1234
|
paginationCursor = self.safe_string_2(result, 'nextPageCursor', 'cursor')
|
1234
1235
|
dataLength = len(data)
|
1235
1236
|
if (paginationCursor is not None) and (dataLength > 0):
|
@@ -1240,12 +1241,12 @@ class bybit(Exchange, ImplicitAPI):
|
|
1240
1241
|
|
1241
1242
|
async def is_unified_enabled(self, params={}):
|
1242
1243
|
"""
|
1243
|
-
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1244
1244
|
|
1245
1245
|
https://bybit-exchange.github.io/docs/v5/user/apikey-info#http-request
|
1246
1246
|
https://bybit-exchange.github.io/docs/v5/account/account-info
|
1247
1247
|
|
1248
1248
|
returns [enableUnifiedMargin, enableUnifiedAccount] so the user can check if unified account is enabled
|
1249
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1249
1250
|
:returns any: [enableUnifiedMargin, enableUnifiedAccount]
|
1250
1251
|
"""
|
1251
1252
|
# The API key of user id must own one of permissions will be allowed to call following API endpoints.
|
@@ -2278,6 +2279,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
2278
2279
|
:param str[] symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
2279
2280
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2280
2281
|
:param str [params.subType]: *contract only* 'linear', 'inverse'
|
2282
|
+
:param str [params.baseCoin]: *option only* base coin, default is 'BTC'
|
2281
2283
|
:returns dict: an array of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
|
2282
2284
|
"""
|
2283
2285
|
await self.load_markets()
|
@@ -2319,10 +2321,11 @@ class bybit(Exchange, ImplicitAPI):
|
|
2319
2321
|
# only if passedSubType is None, then use spot
|
2320
2322
|
if type == 'spot' and passedSubType is None:
|
2321
2323
|
request['category'] = 'spot'
|
2322
|
-
elif type == 'swap' or type == 'future' or subType is not None:
|
2323
|
-
request['category'] = subType
|
2324
2324
|
elif type == 'option':
|
2325
2325
|
request['category'] = 'option'
|
2326
|
+
request['baseCoin'] = self.safe_string(params, 'baseCoin', 'BTC')
|
2327
|
+
elif type == 'swap' or type == 'future' or subType is not None:
|
2328
|
+
request['category'] = subType
|
2326
2329
|
response = await self.publicGetV5MarketTickers(self.extend(request, params))
|
2327
2330
|
#
|
2328
2331
|
# {
|
@@ -3109,7 +3112,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
3109
3112
|
'datetime': self.iso8601(timestamp),
|
3110
3113
|
}
|
3111
3114
|
responseResult = self.safe_dict(response, 'result', {})
|
3112
|
-
currencyList = self.
|
3115
|
+
currencyList = self.safe_list_n(responseResult, ['loanAccountList', 'list', 'balance'])
|
3113
3116
|
if currencyList is None:
|
3114
3117
|
# usdc wallet
|
3115
3118
|
code = 'USDC'
|
@@ -3879,7 +3882,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
3879
3882
|
side = self.safe_string(rawOrder, 'side')
|
3880
3883
|
amount = self.safe_value(rawOrder, 'amount')
|
3881
3884
|
price = self.safe_value(rawOrder, 'price')
|
3882
|
-
orderParams = self.
|
3885
|
+
orderParams = self.safe_dict(rawOrder, 'params', {})
|
3883
3886
|
orderRequest = self.create_order_request(marketId, type, side, amount, price, orderParams, isUta)
|
3884
3887
|
ordersRequests.append(orderRequest)
|
3885
3888
|
symbols = self.market_symbols(orderSymbols, None, False, True, True)
|
ccxt/async_support/cex.py
CHANGED
@@ -27,7 +27,7 @@ class cex(Exchange, ImplicitAPI):
|
|
27
27
|
'id': 'cex',
|
28
28
|
'name': 'CEX.IO',
|
29
29
|
'countries': ['GB', 'EU', 'CY', 'RU'],
|
30
|
-
'rateLimit':
|
30
|
+
'rateLimit': 300, # 200 req/min
|
31
31
|
'pro': True,
|
32
32
|
'has': {
|
33
33
|
'CORS': None,
|
@@ -39,6 +39,8 @@ class cex(Exchange, ImplicitAPI):
|
|
39
39
|
'cancelAllOrders': True,
|
40
40
|
'cancelOrder': True,
|
41
41
|
'createOrder': True,
|
42
|
+
'createStopOrder': True,
|
43
|
+
'createTriggerOrder': True,
|
42
44
|
'fetchAccounts': True,
|
43
45
|
'fetchBalance': True,
|
44
46
|
'fetchClosedOrder': True,
|
@@ -919,7 +921,7 @@ class cex(Exchange, ImplicitAPI):
|
|
919
921
|
# },
|
920
922
|
# ...
|
921
923
|
#
|
922
|
-
data = self.
|
924
|
+
data = self.safe_list(response, 'data', [])
|
923
925
|
return self.parse_orders(data, market, since, limit)
|
924
926
|
|
925
927
|
async def fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
@@ -988,10 +990,16 @@ class cex(Exchange, ImplicitAPI):
|
|
988
990
|
|
989
991
|
def parse_order_status(self, status: Str):
|
990
992
|
statuses: dict = {
|
993
|
+
'PENDING_NEW': 'open',
|
994
|
+
'NEW': 'open',
|
995
|
+
'PARTIALLY_FILLED': 'open',
|
991
996
|
'FILLED': 'closed',
|
997
|
+
'EXPIRED': 'expired',
|
998
|
+
'REJECTED': 'rejected',
|
999
|
+
'PENDING_CANCEL': 'canceling',
|
992
1000
|
'CANCELLED': 'canceled',
|
993
1001
|
}
|
994
|
-
return self.safe_string(statuses, status,
|
1002
|
+
return self.safe_string(statuses, status, status)
|
995
1003
|
|
996
1004
|
def parse_order(self, order: dict, market: Market = None) -> Order:
|
997
1005
|
#
|
@@ -1040,7 +1048,7 @@ class cex(Exchange, ImplicitAPI):
|
|
1040
1048
|
currencyId = self.safe_string(order, 'feeCurrency')
|
1041
1049
|
feeCode = self.safe_currency_code(currencyId)
|
1042
1050
|
fee['currency'] = feeCode
|
1043
|
-
fee['
|
1051
|
+
fee['cost'] = feeAmount
|
1044
1052
|
timestamp = self.safe_integer(order, 'serverCreateTimestamp')
|
1045
1053
|
requestedBase = self.safe_number(order, 'requestedAmountCcy1')
|
1046
1054
|
executedBase = self.safe_number(order, 'executedAmountCcy1')
|
@@ -1084,6 +1092,7 @@ class cex(Exchange, ImplicitAPI):
|
|
1084
1092
|
:param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
1085
1093
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1086
1094
|
:param str [params.accountId]: account-id to use(default is empty string)
|
1095
|
+
:param float [params.triggerPrice]: the price at which a trigger order is triggered at
|
1087
1096
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
1088
1097
|
"""
|
1089
1098
|
accountId = None
|
ccxt/async_support/coinbase.py
CHANGED
@@ -2182,7 +2182,8 @@ class coinbase(Exchange, ImplicitAPI):
|
|
2182
2182
|
|
2183
2183
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2184
2184
|
:param boolean [params.v3]: default False, set True to use v3 api endpoint
|
2185
|
-
:param
|
2185
|
+
:param str [params.type]: "spot"(default) or "swap" or "future"
|
2186
|
+
:param int [params.limit]: default 250, maximum number of accounts to return
|
2186
2187
|
:returns dict: a `balance structure <https://docs.ccxt.com/#/?id=balance-structure>`
|
2187
2188
|
"""
|
2188
2189
|
await self.load_markets()
|
@@ -2199,7 +2200,7 @@ class coinbase(Exchange, ImplicitAPI):
|
|
2199
2200
|
request['limit'] = 250
|
2200
2201
|
response = await self.v3PrivateGetBrokerageAccounts(self.extend(request, params))
|
2201
2202
|
else:
|
2202
|
-
request['limit'] =
|
2203
|
+
request['limit'] = 250
|
2203
2204
|
response = await self.v2PrivateGetAccounts(self.extend(request, params))
|
2204
2205
|
#
|
2205
2206
|
# v2PrivateGetAccounts
|
ccxt/async_support/coinex.py
CHANGED