ccxt 3.0.96__py2.py3-none-any.whl → 3.0.98__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 +1 -1
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/coinex.py +10 -1
- ccxt/async_support/huobi.py +168 -92
- ccxt/async_support/phemex.py +2 -2
- ccxt/base/exchange.py +2 -2
- ccxt/coinex.py +10 -1
- ccxt/huobi.py +168 -92
- ccxt/phemex.py +2 -2
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/bitfinex2.py +8 -4
- ccxt/pro/deribit.py +2 -0
- ccxt/test/test_async.py +3 -5
- ccxt/test/test_sync.py +3 -5
- {ccxt-3.0.96.dist-info → ccxt-3.0.98.dist-info}/METADATA +4 -4
- {ccxt-3.0.96.dist-info → ccxt-3.0.98.dist-info}/RECORD +19 -19
- {ccxt-3.0.96.dist-info → ccxt-3.0.98.dist-info}/WHEEL +0 -0
- {ccxt-3.0.96.dist-info → ccxt-3.0.98.dist-info}/top_level.txt +0 -0
ccxt/huobi.py
CHANGED
@@ -2308,8 +2308,7 @@ class huobi(Exchange, ImplicitAPI):
|
|
2308
2308
|
# request['end-time'] = self.sum(since, 172800000) # 48 hours window
|
2309
2309
|
method = 'spotPrivateGetV1OrderMatchresults'
|
2310
2310
|
else:
|
2311
|
-
|
2312
|
-
raise ArgumentsRequired(self.id + ' fetchMyTrades() requires a symbol for ' + marketType + ' orders')
|
2311
|
+
self.check_required_symbol('fetchMyTrades', symbol)
|
2313
2312
|
request['contract'] = market['id']
|
2314
2313
|
request['trade_type'] = 0 # 0 all, 1 open long, 2 open short, 3 close short, 4 close long, 5 liquidate long positions, 6 liquidate short positions
|
2315
2314
|
if since is not None:
|
@@ -3094,8 +3093,7 @@ class huobi(Exchange, ImplicitAPI):
|
|
3094
3093
|
else:
|
3095
3094
|
request['order-id'] = id
|
3096
3095
|
else:
|
3097
|
-
|
3098
|
-
raise ArgumentsRequired(self.id + ' fetchOrder() requires a symbol for ' + marketType + ' orders')
|
3096
|
+
self.check_required_symbol('fetchOrder', symbol)
|
3099
3097
|
request['contract_code'] = market['id']
|
3100
3098
|
if market['linear']:
|
3101
3099
|
marginMode = None
|
@@ -3265,8 +3263,7 @@ class huobi(Exchange, ImplicitAPI):
|
|
3265
3263
|
def fetch_spot_orders_by_states(self, states, symbol: Optional[str] = None, since: Optional[int] = None, limit: Optional[int] = None, params={}):
|
3266
3264
|
method = self.safe_string(self.options, 'fetchOrdersByStatesMethod', 'spot_private_get_v1_order_orders') # spot_private_get_v1_order_history
|
3267
3265
|
if method == 'spot_private_get_v1_order_orders':
|
3268
|
-
|
3269
|
-
raise ArgumentsRequired(self.id + ' fetchOrders() requires a symbol argument')
|
3266
|
+
self.check_required_symbol('fetchOrders', symbol)
|
3270
3267
|
self.load_markets()
|
3271
3268
|
market = None
|
3272
3269
|
request = {
|
@@ -3331,8 +3328,7 @@ class huobi(Exchange, ImplicitAPI):
|
|
3331
3328
|
return self.fetch_spot_orders_by_states('filled,partial-canceled,canceled', symbol, since, limit, params)
|
3332
3329
|
|
3333
3330
|
def fetch_contract_orders(self, symbol: Optional[str] = None, since: Optional[int] = None, limit: Optional[int] = None, params={}):
|
3334
|
-
|
3335
|
-
raise ArgumentsRequired(self.id + ' fetchContractOrders() requires a symbol argument')
|
3331
|
+
self.check_required_symbol('fetchContractOrders', symbol)
|
3336
3332
|
self.load_markets()
|
3337
3333
|
market = self.market(symbol)
|
3338
3334
|
request = {
|
@@ -3639,8 +3635,7 @@ class huobi(Exchange, ImplicitAPI):
|
|
3639
3635
|
params = self.omit(params, 'account-id')
|
3640
3636
|
response = self.spotPrivateGetV1OrderOpenOrders(self.extend(request, params))
|
3641
3637
|
else:
|
3642
|
-
|
3643
|
-
raise ArgumentsRequired(self.id + ' fetchOpenOrders() requires a symbol for ' + marketType + ' orders')
|
3638
|
+
self.check_required_symbol('fetchOpenOrders', symbol)
|
3644
3639
|
if limit is not None:
|
3645
3640
|
request['page_size'] = limit
|
3646
3641
|
request['contract_code'] = market['id']
|
@@ -4484,6 +4479,8 @@ class huobi(Exchange, ImplicitAPI):
|
|
4484
4479
|
:param str id: order id
|
4485
4480
|
:param str|None symbol: unified symbol of the market the order was made in
|
4486
4481
|
:param dict params: extra parameters specific to the huobi api endpoint
|
4482
|
+
:param bool|None params['stop']: *contract only* if the order is a stop trigger order or not
|
4483
|
+
:param bool|None params['stopLossTakeProfit']: *contract only* if the order is a stop-loss or take-profit order
|
4487
4484
|
:returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
4488
4485
|
"""
|
4489
4486
|
self.load_markets()
|
@@ -4504,60 +4501,83 @@ class huobi(Exchange, ImplicitAPI):
|
|
4504
4501
|
# 'pair': 'BTC-USDT',
|
4505
4502
|
# 'contract_type': 'this_week', # swap, self_week, next_week, quarter, next_ quarter
|
4506
4503
|
}
|
4507
|
-
|
4504
|
+
response = None
|
4508
4505
|
if marketType == 'spot':
|
4509
4506
|
clientOrderId = self.safe_string_2(params, 'client-order-id', 'clientOrderId')
|
4510
|
-
method = 'spotPrivatePostV1OrderOrdersOrderIdSubmitcancel'
|
4511
4507
|
if clientOrderId is None:
|
4512
4508
|
request['order-id'] = id
|
4509
|
+
response = self.spotPrivatePostV1OrderOrdersOrderIdSubmitcancel(self.extend(request, params))
|
4513
4510
|
else:
|
4514
4511
|
request['client-order-id'] = clientOrderId
|
4515
|
-
method = 'spotPrivatePostV1OrderOrdersSubmitCancelClientOrder'
|
4516
4512
|
params = self.omit(params, ['client-order-id', 'clientOrderId'])
|
4513
|
+
response = self.spotPrivatePostV1OrderOrdersSubmitCancelClientOrder(self.extend(request, params))
|
4517
4514
|
else:
|
4518
|
-
|
4519
|
-
|
4520
|
-
|
4515
|
+
self.check_required_symbol('cancelOrder', symbol)
|
4516
|
+
clientOrderId = self.safe_string_2(params, 'client_order_id', 'clientOrderId')
|
4517
|
+
if clientOrderId is None:
|
4518
|
+
request['order_id'] = id
|
4519
|
+
else:
|
4520
|
+
request['client_order_id'] = clientOrderId
|
4521
|
+
params = self.omit(params, ['client_order_id', 'clientOrderId'])
|
4522
|
+
if market['future']:
|
4523
|
+
request['symbol'] = market['settleId']
|
4524
|
+
else:
|
4525
|
+
request['contract_code'] = market['id']
|
4526
|
+
stop = self.safe_value(params, 'stop')
|
4527
|
+
stopLossTakeProfit = self.safe_value(params, 'stopLossTakeProfit')
|
4528
|
+
params = self.omit(params, ['stop', 'stopLossTakeProfit'])
|
4521
4529
|
if market['linear']:
|
4522
4530
|
marginMode = None
|
4523
4531
|
marginMode, params = self.handle_margin_mode_and_params('cancelOrder', params)
|
4524
4532
|
marginMode = 'cross' if (marginMode is None) else marginMode
|
4525
4533
|
if marginMode == 'isolated':
|
4526
|
-
|
4534
|
+
if stop:
|
4535
|
+
response = self.contractPrivatePostLinearSwapApiV1SwapTriggerCancel(self.extend(request, params))
|
4536
|
+
elif stopLossTakeProfit:
|
4537
|
+
response = self.contractPrivatePostLinearSwapApiV1SwapTpslCancel(self.extend(request, params))
|
4538
|
+
else:
|
4539
|
+
response = self.contractPrivatePostLinearSwapApiV1SwapCancel(self.extend(request, params))
|
4527
4540
|
elif marginMode == 'cross':
|
4528
|
-
|
4541
|
+
if stop:
|
4542
|
+
response = self.contractPrivatePostLinearSwapApiV1SwapCrossTriggerCancel(self.extend(request, params))
|
4543
|
+
elif stopLossTakeProfit:
|
4544
|
+
response = self.contractPrivatePostLinearSwapApiV1SwapCrossTpslCancel(self.extend(request, params))
|
4545
|
+
else:
|
4546
|
+
response = self.contractPrivatePostLinearSwapApiV1SwapCrossCancel(self.extend(request, params))
|
4529
4547
|
elif market['inverse']:
|
4530
|
-
if market['
|
4531
|
-
|
4532
|
-
|
4533
|
-
|
4534
|
-
|
4548
|
+
if market['swap']:
|
4549
|
+
if stop:
|
4550
|
+
response = self.contractPrivatePostSwapApiV1SwapTriggerCancel(self.extend(request, params))
|
4551
|
+
elif stopLossTakeProfit:
|
4552
|
+
response = self.contractPrivatePostSwapApiV1SwapTpslCancel(self.extend(request, params))
|
4553
|
+
else:
|
4554
|
+
response = self.contractPrivatePostSwapApiV1SwapCancel(self.extend(request, params))
|
4555
|
+
elif market['future']:
|
4556
|
+
if stop:
|
4557
|
+
response = self.contractPrivatePostApiV1ContractTriggerCancel(self.extend(request, params))
|
4558
|
+
elif stopLossTakeProfit:
|
4559
|
+
response = self.contractPrivatePostApiV1ContractTpslCancel(self.extend(request, params))
|
4560
|
+
else:
|
4561
|
+
response = self.contractPrivatePostApiV1ContractCancel(self.extend(request, params))
|
4535
4562
|
else:
|
4536
4563
|
raise NotSupported(self.id + ' cancelOrder() does not support ' + marketType + ' markets')
|
4537
|
-
clientOrderId = self.safe_string_2(params, 'client_order_id', 'clientOrderId')
|
4538
|
-
if clientOrderId is None:
|
4539
|
-
request['order_id'] = id
|
4540
|
-
else:
|
4541
|
-
request['client_order_id'] = clientOrderId
|
4542
|
-
params = self.omit(params, ['client_order_id', 'clientOrderId'])
|
4543
|
-
response = getattr(self, method)(self.extend(request, params))
|
4544
4564
|
#
|
4545
4565
|
# spot
|
4546
4566
|
#
|
4547
4567
|
# {
|
4548
|
-
#
|
4549
|
-
#
|
4568
|
+
# "status": "ok",
|
4569
|
+
# "data": "10138899000",
|
4550
4570
|
# }
|
4551
4571
|
#
|
4552
|
-
#
|
4572
|
+
# future and swap
|
4553
4573
|
#
|
4554
4574
|
# {
|
4555
|
-
# "status":"ok",
|
4556
|
-
# "data":{
|
4557
|
-
# "errors":[],
|
4558
|
-
# "successes":"924660854912552960"
|
4575
|
+
# "status": "ok",
|
4576
|
+
# "data": {
|
4577
|
+
# "errors": [],
|
4578
|
+
# "successes": "924660854912552960"
|
4559
4579
|
# },
|
4560
|
-
# "ts":1640504486089
|
4580
|
+
# "ts": 1640504486089
|
4561
4581
|
# }
|
4562
4582
|
#
|
4563
4583
|
return self.extend(self.parse_order(response, market), {
|
@@ -4571,6 +4591,8 @@ class huobi(Exchange, ImplicitAPI):
|
|
4571
4591
|
:param [str] ids: order ids
|
4572
4592
|
:param str|None symbol: unified market symbol, default is None
|
4573
4593
|
:param dict params: extra parameters specific to the huobi api endpoint
|
4594
|
+
:param bool|None params['stop']: *contract only* if the orders are stop trigger orders or not
|
4595
|
+
:param bool|None params['stopLossTakeProfit']: *contract only* if the orders are stop-loss or take-profit orders
|
4574
4596
|
:returns dict: an list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
4575
4597
|
"""
|
4576
4598
|
self.load_markets()
|
@@ -4581,7 +4603,7 @@ class huobi(Exchange, ImplicitAPI):
|
|
4581
4603
|
marketType, params = self.handle_market_type_and_params('cancelOrders', market, params)
|
4582
4604
|
request = {
|
4583
4605
|
# spot -----------------------------------------------------------
|
4584
|
-
# 'order-ids':
|
4606
|
+
# 'order-ids': ','.join(ids), # max 50
|
4585
4607
|
# 'client-order-ids': ','.join(ids), # max 50
|
4586
4608
|
# contracts ------------------------------------------------------
|
4587
4609
|
# 'order_id': id, # comma separated, max 10
|
@@ -4589,43 +4611,24 @@ class huobi(Exchange, ImplicitAPI):
|
|
4589
4611
|
# 'contract_code': market['id'],
|
4590
4612
|
# 'symbol': market['settleId'],
|
4591
4613
|
}
|
4592
|
-
|
4614
|
+
response = None
|
4593
4615
|
if marketType == 'spot':
|
4594
4616
|
clientOrderIds = self.safe_value_2(params, 'client-order-id', 'clientOrderId')
|
4595
4617
|
clientOrderIds = self.safe_value_2(params, 'client-order-ids', 'clientOrderIds', clientOrderIds)
|
4596
4618
|
if clientOrderIds is None:
|
4597
4619
|
if isinstance(clientOrderIds, str):
|
4598
|
-
request['order-ids'] = ids
|
4620
|
+
request['order-ids'] = [ids]
|
4599
4621
|
else:
|
4600
|
-
request['order-ids'] =
|
4622
|
+
request['order-ids'] = ids
|
4601
4623
|
else:
|
4602
4624
|
if isinstance(clientOrderIds, str):
|
4603
|
-
request['client-order-ids'] = clientOrderIds
|
4625
|
+
request['client-order-ids'] = [clientOrderIds]
|
4604
4626
|
else:
|
4605
|
-
request['client-order-ids'] =
|
4627
|
+
request['client-order-ids'] = clientOrderIds
|
4606
4628
|
params = self.omit(params, ['client-order-id', 'client-order-ids', 'clientOrderId', 'clientOrderIds'])
|
4607
|
-
|
4629
|
+
response = self.spotPrivatePostV1OrderOrdersBatchcancel(self.extend(request, params))
|
4608
4630
|
else:
|
4609
|
-
|
4610
|
-
raise ArgumentsRequired(self.id + ' cancelOrders() requires a symbol for ' + marketType + ' orders')
|
4611
|
-
marketInner = self.market(symbol)
|
4612
|
-
request['contract_code'] = marketInner['id']
|
4613
|
-
if marketInner['linear']:
|
4614
|
-
marginMode = None
|
4615
|
-
marginMode, params = self.handle_margin_mode_and_params('cancelOrders', params)
|
4616
|
-
marginMode = 'cross' if (marginMode is None) else marginMode
|
4617
|
-
if marginMode == 'isolated':
|
4618
|
-
method = 'contractPrivatePostLinearSwapApiV1SwapCancel'
|
4619
|
-
elif marginMode == 'cross':
|
4620
|
-
method = 'contractPrivatePostLinearSwapApiV1SwapCrossCancel'
|
4621
|
-
elif marketInner['inverse']:
|
4622
|
-
if marketInner['future']:
|
4623
|
-
method = 'contractPrivatePostApiV1ContractCancel'
|
4624
|
-
request['symbol'] = marketInner['settleId']
|
4625
|
-
elif marketInner['swap']:
|
4626
|
-
method = 'contractPrivatePostSwapApiV1SwapCancel'
|
4627
|
-
else:
|
4628
|
-
raise NotSupported(self.id + ' cancelOrders() does not support ' + marketType + ' markets')
|
4631
|
+
self.check_required_symbol('cancelOrders', symbol)
|
4629
4632
|
clientOrderIds = self.safe_string_2(params, 'client_order_id', 'clientOrderId')
|
4630
4633
|
clientOrderIds = self.safe_string_2(params, 'client_order_ids', 'clientOrderIds', clientOrderIds)
|
4631
4634
|
if clientOrderIds is None:
|
@@ -4633,7 +4636,48 @@ class huobi(Exchange, ImplicitAPI):
|
|
4633
4636
|
else:
|
4634
4637
|
request['client_order_id'] = clientOrderIds
|
4635
4638
|
params = self.omit(params, ['client_order_id', 'client_order_ids', 'clientOrderId', 'clientOrderIds'])
|
4636
|
-
|
4639
|
+
if market['future']:
|
4640
|
+
request['symbol'] = market['settleId']
|
4641
|
+
else:
|
4642
|
+
request['contract_code'] = market['id']
|
4643
|
+
stop = self.safe_value(params, 'stop')
|
4644
|
+
stopLossTakeProfit = self.safe_value(params, 'stopLossTakeProfit')
|
4645
|
+
params = self.omit(params, ['stop', 'stopLossTakeProfit'])
|
4646
|
+
if market['linear']:
|
4647
|
+
marginMode = None
|
4648
|
+
marginMode, params = self.handle_margin_mode_and_params('cancelOrders', params)
|
4649
|
+
marginMode = 'cross' if (marginMode is None) else marginMode
|
4650
|
+
if marginMode == 'isolated':
|
4651
|
+
if stop:
|
4652
|
+
response = self.contractPrivatePostLinearSwapApiV1SwapTriggerCancel(self.extend(request, params))
|
4653
|
+
elif stopLossTakeProfit:
|
4654
|
+
response = self.contractPrivatePostLinearSwapApiV1SwapTpslCancel(self.extend(request, params))
|
4655
|
+
else:
|
4656
|
+
response = self.contractPrivatePostLinearSwapApiV1SwapCancel(self.extend(request, params))
|
4657
|
+
elif marginMode == 'cross':
|
4658
|
+
if stop:
|
4659
|
+
response = self.contractPrivatePostLinearSwapApiV1SwapCrossTriggerCancel(self.extend(request, params))
|
4660
|
+
elif stopLossTakeProfit:
|
4661
|
+
response = self.contractPrivatePostLinearSwapApiV1SwapCrossTpslCancel(self.extend(request, params))
|
4662
|
+
else:
|
4663
|
+
response = self.contractPrivatePostLinearSwapApiV1SwapCrossCancel(self.extend(request, params))
|
4664
|
+
elif market['inverse']:
|
4665
|
+
if market['swap']:
|
4666
|
+
if stop:
|
4667
|
+
response = self.contractPrivatePostSwapApiV1SwapTriggerCancel(self.extend(request, params))
|
4668
|
+
elif stopLossTakeProfit:
|
4669
|
+
response = self.contractPrivatePostSwapApiV1SwapTpslCancel(self.extend(request, params))
|
4670
|
+
else:
|
4671
|
+
response = self.contractPrivatePostSwapApiV1SwapCancel(self.extend(request, params))
|
4672
|
+
elif market['future']:
|
4673
|
+
if stop:
|
4674
|
+
response = self.contractPrivatePostApiV1ContractTriggerCancel(self.extend(request, params))
|
4675
|
+
elif stopLossTakeProfit:
|
4676
|
+
response = self.contractPrivatePostApiV1ContractTpslCancel(self.extend(request, params))
|
4677
|
+
else:
|
4678
|
+
response = self.contractPrivatePostApiV1ContractCancel(self.extend(request, params))
|
4679
|
+
else:
|
4680
|
+
raise NotSupported(self.id + ' cancelOrders() does not support ' + marketType + ' markets')
|
4637
4681
|
#
|
4638
4682
|
# spot
|
4639
4683
|
#
|
@@ -4668,7 +4712,7 @@ class huobi(Exchange, ImplicitAPI):
|
|
4668
4712
|
# }
|
4669
4713
|
# }
|
4670
4714
|
#
|
4671
|
-
#
|
4715
|
+
# future and swap
|
4672
4716
|
#
|
4673
4717
|
# {
|
4674
4718
|
# "status": "ok",
|
@@ -4692,6 +4736,8 @@ class huobi(Exchange, ImplicitAPI):
|
|
4692
4736
|
cancel all open orders
|
4693
4737
|
:param str|None symbol: unified market symbol, only orders in the market of self symbol are cancelled when symbol is not None
|
4694
4738
|
:param dict params: extra parameters specific to the huobi api endpoint
|
4739
|
+
:param bool|None params['stop']: *contract only* if the orders are stop trigger orders or not
|
4740
|
+
:param bool|None params['stopLossTakeProfit']: *contract only* if the orders are stop-loss or take-profit orders
|
4695
4741
|
:returns [dict]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
4696
4742
|
"""
|
4697
4743
|
self.load_markets()
|
@@ -4714,34 +4760,56 @@ class huobi(Exchange, ImplicitAPI):
|
|
4714
4760
|
# 'direction': 'buy': # buy, sell
|
4715
4761
|
# 'offset': 'open', # open, close
|
4716
4762
|
}
|
4717
|
-
|
4763
|
+
response = None
|
4718
4764
|
if marketType == 'spot':
|
4719
4765
|
if symbol is not None:
|
4720
|
-
market = self.market(symbol)
|
4721
4766
|
request['symbol'] = market['id']
|
4722
|
-
|
4767
|
+
response = self.spotPrivatePostV1OrderOrdersBatchCancelOpenOrders(self.extend(request, params))
|
4723
4768
|
else:
|
4724
|
-
|
4725
|
-
|
4726
|
-
|
4727
|
-
request['contract_code'] =
|
4728
|
-
|
4769
|
+
self.check_required_symbol('cancelAllOrders', symbol)
|
4770
|
+
if market['future']:
|
4771
|
+
request['symbol'] = market['settleId']
|
4772
|
+
request['contract_code'] = market['id']
|
4773
|
+
stop = self.safe_value(params, 'stop')
|
4774
|
+
stopLossTakeProfit = self.safe_value(params, 'stopLossTakeProfit')
|
4775
|
+
params = self.omit(params, ['stop', 'stopLossTakeProfit'])
|
4776
|
+
if market['linear']:
|
4729
4777
|
marginMode = None
|
4730
4778
|
marginMode, params = self.handle_margin_mode_and_params('cancelAllOrders', params)
|
4731
4779
|
marginMode = 'cross' if (marginMode is None) else marginMode
|
4732
4780
|
if marginMode == 'isolated':
|
4733
|
-
|
4781
|
+
if stop:
|
4782
|
+
response = self.contractPrivatePostLinearSwapApiV1SwapTriggerCancelall(self.extend(request, params))
|
4783
|
+
elif stopLossTakeProfit:
|
4784
|
+
response = self.contractPrivatePostLinearSwapApiV1SwapTpslCancelall(self.extend(request, params))
|
4785
|
+
else:
|
4786
|
+
response = self.contractPrivatePostLinearSwapApiV1SwapCancelall(self.extend(request, params))
|
4734
4787
|
elif marginMode == 'cross':
|
4735
|
-
|
4736
|
-
|
4737
|
-
|
4738
|
-
|
4739
|
-
|
4740
|
-
|
4741
|
-
|
4742
|
-
|
4743
|
-
|
4744
|
-
|
4788
|
+
if stop:
|
4789
|
+
response = self.contractPrivatePostLinearSwapApiV1SwapCrossTriggerCancelall(self.extend(request, params))
|
4790
|
+
elif stopLossTakeProfit:
|
4791
|
+
response = self.contractPrivatePostLinearSwapApiV1SwapCrossTpslCancelall(self.extend(request, params))
|
4792
|
+
else:
|
4793
|
+
response = self.contractPrivatePostLinearSwapApiV1SwapCrossCancelall(self.extend(request, params))
|
4794
|
+
elif market['inverse']:
|
4795
|
+
if market['swap']:
|
4796
|
+
if stop:
|
4797
|
+
response = self.contractPrivatePostSwapApiV1SwapTriggerCancelall(self.extend(request, params))
|
4798
|
+
elif stopLossTakeProfit:
|
4799
|
+
response = self.contractPrivatePostSwapApiV1SwapTpslCancelall(self.extend(request, params))
|
4800
|
+
else:
|
4801
|
+
response = self.contractPrivatePostSwapApiV1SwapCancelall(self.extend(request, params))
|
4802
|
+
elif market['future']:
|
4803
|
+
if stop:
|
4804
|
+
response = self.contractPrivatePostApiV1ContractTriggerCancelall(self.extend(request, params))
|
4805
|
+
elif stopLossTakeProfit:
|
4806
|
+
response = self.contractPrivatePostApiV1ContractTpslCancelall(self.extend(request, params))
|
4807
|
+
else:
|
4808
|
+
response = self.contractPrivatePostApiV1ContractCancelall(self.extend(request, params))
|
4809
|
+
else:
|
4810
|
+
raise NotSupported(self.id + ' cancelAllOrders() does not support ' + marketType + ' markets')
|
4811
|
+
#
|
4812
|
+
# spot
|
4745
4813
|
#
|
4746
4814
|
# {
|
4747
4815
|
# code: 200,
|
@@ -4752,6 +4820,17 @@ class huobi(Exchange, ImplicitAPI):
|
|
4752
4820
|
# }
|
4753
4821
|
# }
|
4754
4822
|
#
|
4823
|
+
# future and swap
|
4824
|
+
#
|
4825
|
+
# {
|
4826
|
+
# status: "ok",
|
4827
|
+
# data: {
|
4828
|
+
# errors: [],
|
4829
|
+
# successes: "1104754904426696704"
|
4830
|
+
# },
|
4831
|
+
# ts: "1683435723755"
|
4832
|
+
# }
|
4833
|
+
#
|
4755
4834
|
return response
|
4756
4835
|
|
4757
4836
|
def parse_deposit_address(self, depositAddress, currency=None):
|
@@ -5353,8 +5432,7 @@ class huobi(Exchange, ImplicitAPI):
|
|
5353
5432
|
:param dict params: extra parameters specific to the huobi api endpoint
|
5354
5433
|
:returns [dict]: a list of `funding rate structures <https://docs.ccxt.com/en/latest/manual.html?#funding-rate-history-structure>`
|
5355
5434
|
"""
|
5356
|
-
|
5357
|
-
raise ArgumentsRequired(self.id + ' fetchFundingRateHistory() requires a symbol argument')
|
5435
|
+
self.check_required_symbol('fetchFundingRateHistory', symbol)
|
5358
5436
|
self.load_markets()
|
5359
5437
|
market = self.market(symbol)
|
5360
5438
|
request = {
|
@@ -5858,8 +5936,7 @@ class huobi(Exchange, ImplicitAPI):
|
|
5858
5936
|
:param dict params: extra parameters specific to the huobi api endpoint
|
5859
5937
|
:returns dict: response from the exchange
|
5860
5938
|
"""
|
5861
|
-
|
5862
|
-
raise ArgumentsRequired(self.id + ' setLeverage() requires a symbol argument')
|
5939
|
+
self.check_required_symbol('setLeverage', symbol)
|
5863
5940
|
self.load_markets()
|
5864
5941
|
market = self.market(symbol)
|
5865
5942
|
marketType, query = self.handle_market_type_and_params('setLeverage', market, params)
|
@@ -6938,8 +7015,7 @@ class huobi(Exchange, ImplicitAPI):
|
|
6938
7015
|
marginMode = 'cross' if (marginMode is None) else marginMode
|
6939
7016
|
method = None
|
6940
7017
|
if marginMode == 'isolated':
|
6941
|
-
|
6942
|
-
raise ArgumentsRequired(self.id + ' borrowMargin() requires a symbol argument for isolated margin')
|
7018
|
+
self.check_required_symbol('borrowMargin', symbol)
|
6943
7019
|
market = self.market(symbol)
|
6944
7020
|
request['symbol'] = market['id']
|
6945
7021
|
method = 'privatePostMarginOrders'
|
ccxt/phemex.py
CHANGED
@@ -2399,7 +2399,7 @@ class phemex(Exchange, ImplicitAPI):
|
|
2399
2399
|
:param float amount: how much of currency you want to trade in units of base currency
|
2400
2400
|
:param float|None price: the price at which the order is to be fullfilled, in units of the base currency, ignored in market orders
|
2401
2401
|
:param dict params: extra parameters specific to the phemex api endpoint
|
2402
|
-
:param str|None params['posSide']: either '
|
2402
|
+
:param str|None params['posSide']: either 'Merged' or 'Long' or 'Short'
|
2403
2403
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
2404
2404
|
"""
|
2405
2405
|
if symbol is None:
|
@@ -2457,7 +2457,7 @@ class phemex(Exchange, ImplicitAPI):
|
|
2457
2457
|
:param str id: order id
|
2458
2458
|
:param str symbol: unified symbol of the market the order was made in
|
2459
2459
|
:param dict params: extra parameters specific to the phemex api endpoint
|
2460
|
-
:param str|None params['posSide']: either '
|
2460
|
+
:param str|None params['posSide']: either 'Merged' or 'Long' or 'Short'
|
2461
2461
|
:returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
2462
2462
|
"""
|
2463
2463
|
if symbol is None:
|
ccxt/pro/__init__.py
CHANGED
ccxt/pro/bitfinex2.py
CHANGED
@@ -618,10 +618,14 @@ class bitfinex2(ccxt.async_support.bitfinex2):
|
|
618
618
|
asks = book['asks']
|
619
619
|
# pepperoni pizza from bitfinex
|
620
620
|
for i in range(0, depth):
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
621
|
+
bid = self.safe_value(bids, i)
|
622
|
+
ask = self.safe_value(asks, i)
|
623
|
+
if bid is not None:
|
624
|
+
stringArray.append(self.number_to_string(bids[i][0]))
|
625
|
+
stringArray.append(self.number_to_string(bids[i][1]))
|
626
|
+
if ask is not None:
|
627
|
+
stringArray.append(self.number_to_string(asks[i][0]))
|
628
|
+
stringArray.append(self.number_to_string(-asks[i][1]))
|
625
629
|
payload = ':'.join(stringArray)
|
626
630
|
localChecksum = self.crc32(payload, True)
|
627
631
|
responseChecksum = self.safe_integer(message, 2)
|
ccxt/pro/deribit.py
CHANGED
@@ -239,6 +239,8 @@ class deribit(ccxt.async_support.deribit):
|
|
239
239
|
}
|
240
240
|
request = self.deep_extend(message, params)
|
241
241
|
trades = await self.watch(url, channel, request, channel, request)
|
242
|
+
if self.newUpdates:
|
243
|
+
limit = trades.getLimit(symbol, limit)
|
242
244
|
return self.filter_by_since_limit(trades, since, limit, 'timestamp')
|
243
245
|
|
244
246
|
def handle_trades(self, client: Client, message):
|
ccxt/test/test_async.py
CHANGED
@@ -239,10 +239,6 @@ class testMainClass(baseMainTestClass):
|
|
239
239
|
else:
|
240
240
|
finalValue = exchangeSettings[key]
|
241
241
|
set_exchange_prop(exchange, key, finalValue)
|
242
|
-
# support simple proxy
|
243
|
-
proxy = get_exchange_prop(exchange, 'httpProxy')
|
244
|
-
if proxy:
|
245
|
-
add_proxy(exchange, proxy)
|
246
242
|
# credentials
|
247
243
|
reqCreds = get_exchange_prop(exchange, 're' + 'quiredCredentials') # dont glue the r-e-q-u-i-r-e phrase, because leads to messed up transpilation
|
248
244
|
objkeys = list(reqCreds.keys())
|
@@ -267,7 +263,9 @@ class testMainClass(baseMainTestClass):
|
|
267
263
|
if exchange.alias:
|
268
264
|
dump('[SKIPPED] Alias exchange. ', 'exchange', exchangeId, 'symbol', symbol)
|
269
265
|
exit_script()
|
270
|
-
|
266
|
+
proxy = exchange.safe_string(skippedSettingsForExchange, 'httpProxy')
|
267
|
+
if proxy is not None:
|
268
|
+
add_proxy(exchange, proxy)
|
271
269
|
self.skippedMethods = exchange.safe_value(skippedSettingsForExchange, 'skipMethods', {})
|
272
270
|
self.checkedPublicTests = {}
|
273
271
|
|
ccxt/test/test_sync.py
CHANGED
@@ -238,10 +238,6 @@ class testMainClass(baseMainTestClass):
|
|
238
238
|
else:
|
239
239
|
finalValue = exchangeSettings[key]
|
240
240
|
set_exchange_prop(exchange, key, finalValue)
|
241
|
-
# support simple proxy
|
242
|
-
proxy = get_exchange_prop(exchange, 'httpProxy')
|
243
|
-
if proxy:
|
244
|
-
add_proxy(exchange, proxy)
|
245
241
|
# credentials
|
246
242
|
reqCreds = get_exchange_prop(exchange, 're' + 'quiredCredentials') # dont glue the r-e-q-u-i-r-e phrase, because leads to messed up transpilation
|
247
243
|
objkeys = list(reqCreds.keys())
|
@@ -266,7 +262,9 @@ class testMainClass(baseMainTestClass):
|
|
266
262
|
if exchange.alias:
|
267
263
|
dump('[SKIPPED] Alias exchange. ', 'exchange', exchangeId, 'symbol', symbol)
|
268
264
|
exit_script()
|
269
|
-
|
265
|
+
proxy = exchange.safe_string(skippedSettingsForExchange, 'httpProxy')
|
266
|
+
if proxy is not None:
|
267
|
+
add_proxy(exchange, proxy)
|
270
268
|
self.skippedMethods = exchange.safe_value(skippedSettingsForExchange, 'skipMethods', {})
|
271
269
|
self.checkedPublicTests = {}
|
272
270
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: ccxt
|
3
|
-
Version: 3.0.
|
3
|
+
Version: 3.0.98
|
4
4
|
Summary: A JavaScript / Python / PHP cryptocurrency trading library with support for 130+ exchanges
|
5
5
|
Home-page: https://ccxt.com
|
6
6
|
Author: Igor Kroitor
|
@@ -262,13 +262,13 @@ console.log(version, Object.keys(exchanges));
|
|
262
262
|
|
263
263
|
All-in-one browser bundle (dependencies included), served from a CDN of your choice:
|
264
264
|
|
265
|
-
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@3.0.
|
266
|
-
* unpkg: https://unpkg.com/ccxt@3.0.
|
265
|
+
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@3.0.98/dist/ccxt.browser.js
|
266
|
+
* unpkg: https://unpkg.com/ccxt@3.0.98/dist/ccxt.browser.js
|
267
267
|
|
268
268
|
CDNs are not updated in real-time and may have delays. Defaulting to the most recent version without specifying the version number is not recommended. Please, keep in mind that we are not responsible for the correct operation of those CDN servers.
|
269
269
|
|
270
270
|
```HTML
|
271
|
-
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@3.0.
|
271
|
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@3.0.98/dist/ccxt.browser.js"></script>
|
272
272
|
```
|
273
273
|
|
274
274
|
Creates a global `ccxt` object:
|