ccxt 4.3.11__py2.py3-none-any.whl → 4.3.12__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 (72) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/async_support/__init__.py +1 -1
  3. ccxt/async_support/base/exchange.py +1 -1
  4. ccxt/async_support/bigone.py +22 -22
  5. ccxt/async_support/binance.py +7 -7
  6. ccxt/async_support/bingx.py +2 -2
  7. ccxt/async_support/bitget.py +10 -8
  8. ccxt/async_support/bitmart.py +7 -11
  9. ccxt/async_support/bitmex.py +2 -2
  10. ccxt/async_support/bybit.py +75 -65
  11. ccxt/async_support/coinbase.py +8 -8
  12. ccxt/async_support/coinbaseinternational.py +2 -2
  13. ccxt/async_support/coinex.py +501 -445
  14. ccxt/async_support/coinlist.py +12 -12
  15. ccxt/async_support/coinmetro.py +2 -2
  16. ccxt/async_support/cryptocom.py +16 -16
  17. ccxt/async_support/digifinex.py +3 -3
  18. ccxt/async_support/gate.py +2 -2
  19. ccxt/async_support/hitbtc.py +3 -3
  20. ccxt/async_support/htx.py +6 -9
  21. ccxt/async_support/indodax.py +2 -2
  22. ccxt/async_support/kraken.py +3 -1
  23. ccxt/async_support/kucoin.py +4 -4
  24. ccxt/async_support/kucoinfutures.py +6 -6
  25. ccxt/async_support/mexc.py +5 -5
  26. ccxt/async_support/okx.py +9 -9
  27. ccxt/async_support/poloniexfutures.py +4 -4
  28. ccxt/async_support/probit.py +2 -2
  29. ccxt/async_support/whitebit.py +72 -1
  30. ccxt/async_support/woo.py +2 -2
  31. ccxt/base/exchange.py +14 -2
  32. ccxt/base/types.py +25 -0
  33. ccxt/bigone.py +22 -22
  34. ccxt/binance.py +7 -7
  35. ccxt/bingx.py +2 -2
  36. ccxt/bitget.py +10 -8
  37. ccxt/bitmart.py +7 -11
  38. ccxt/bitmex.py +2 -2
  39. ccxt/bybit.py +75 -65
  40. ccxt/coinbase.py +8 -8
  41. ccxt/coinbaseinternational.py +2 -2
  42. ccxt/coinex.py +501 -445
  43. ccxt/coinlist.py +12 -12
  44. ccxt/coinmetro.py +2 -2
  45. ccxt/cryptocom.py +16 -16
  46. ccxt/digifinex.py +3 -3
  47. ccxt/gate.py +2 -2
  48. ccxt/hitbtc.py +3 -3
  49. ccxt/htx.py +6 -9
  50. ccxt/indodax.py +2 -2
  51. ccxt/kraken.py +3 -1
  52. ccxt/kucoin.py +4 -4
  53. ccxt/kucoinfutures.py +6 -6
  54. ccxt/mexc.py +5 -5
  55. ccxt/okx.py +9 -9
  56. ccxt/poloniexfutures.py +4 -4
  57. ccxt/pro/__init__.py +1 -1
  58. ccxt/pro/bitget.py +139 -87
  59. ccxt/pro/bybit.py +192 -12
  60. ccxt/pro/coinbase.py +90 -20
  61. ccxt/pro/mexc.py +21 -1
  62. ccxt/probit.py +2 -2
  63. ccxt/test/base/test_datetime.py +6 -0
  64. ccxt/test/base/test_ledger_entry.py +2 -2
  65. ccxt/whitebit.py +72 -1
  66. ccxt/woo.py +2 -2
  67. {ccxt-4.3.11.dist-info → ccxt-4.3.12.dist-info}/METADATA +4 -4
  68. {ccxt-4.3.11.dist-info → ccxt-4.3.12.dist-info}/RECORD +70 -72
  69. ccxt/async_support/flowbtc.py +0 -34
  70. ccxt/flowbtc.py +0 -34
  71. {ccxt-4.3.11.dist-info → ccxt-4.3.12.dist-info}/WHEEL +0 -0
  72. {ccxt-4.3.11.dist-info → ccxt-4.3.12.dist-info}/top_level.txt +0 -0
ccxt/bybit.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.bybit import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Balances, Currencies, Currency, Greeks, Int, Leverage, Market, MarketInterface, Num, Option, OptionChain, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry
9
+ from ccxt.base.types import Balances, CrossBorrowRate, Currencies, Currency, Greeks, Int, Leverage, Market, MarketInterface, Num, Option, OptionChain, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import AuthenticationError
@@ -2417,9 +2417,9 @@ class bybit(Exchange, ImplicitAPI):
2417
2417
  request['category'] = type
2418
2418
  if since is not None:
2419
2419
  request['startTime'] = since
2420
- until = self.safe_integer_2(params, 'until', 'till') # unified in milliseconds
2420
+ until = self.safe_integer(params, 'until') # unified in milliseconds
2421
2421
  endTime = self.safe_integer(params, 'endTime', until) # exchange-specific in milliseconds
2422
- params = self.omit(params, ['endTime', 'till', 'until'])
2422
+ params = self.omit(params, ['endTime', 'until'])
2423
2423
  if endTime is not None:
2424
2424
  request['endTime'] = endTime
2425
2425
  else:
@@ -3810,40 +3810,8 @@ class bybit(Exchange, ImplicitAPI):
3810
3810
  result = self.safe_dict(response, 'result', {})
3811
3811
  return self.parse_order(result, market)
3812
3812
 
3813
- def edit_order(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={}):
3814
- """
3815
- edit a trade order
3816
- :see: https://bybit-exchange.github.io/docs/v5/order/amend-order
3817
- :see: https://bybit-exchange.github.io/docs/derivatives/unified/replace-order
3818
- :see: https://bybit-exchange.github.io/docs/api-explorer/derivatives/trade/contract/replace-order
3819
- :param str id: cancel order id
3820
- :param str symbol: unified symbol of the market to create an order in
3821
- :param str type: 'market' or 'limit'
3822
- :param str side: 'buy' or 'sell'
3823
- :param float amount: how much of currency you want to trade in units of base currency
3824
- :param float price: the price at which the order is to be fullfilled, in units of the base currency, ignored in market orders
3825
- :param dict [params]: extra parameters specific to the exchange API endpoint
3826
- :param float [params.triggerPrice]: The price that a trigger order is triggered at
3827
- :param float [params.stopLossPrice]: The price that a stop loss order is triggered at
3828
- :param float [params.takeProfitPrice]: The price that a take profit order is triggered at
3829
- :param dict [params.takeProfit]: *takeProfit object in params* containing the triggerPrice that the attached take profit order will be triggered
3830
- :param float [params.takeProfit.triggerPrice]: take profit trigger price
3831
- :param dict [params.stopLoss]: *stopLoss object in params* containing the triggerPrice that the attached stop loss order will be triggered
3832
- :param float [params.stopLoss.triggerPrice]: stop loss trigger price
3833
- :param str [params.triggerBy]: 'IndexPrice', 'MarkPrice' or 'LastPrice', default is 'LastPrice', required if no initial value for triggerPrice
3834
- :param str [params.slTriggerBy]: 'IndexPrice', 'MarkPrice' or 'LastPrice', default is 'LastPrice', required if no initial value for stopLoss
3835
- :param str [params.tpTriggerby]: 'IndexPrice', 'MarkPrice' or 'LastPrice', default is 'LastPrice', required if no initial value for takeProfit
3836
- :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
3837
- """
3838
- if symbol is None:
3839
- raise ArgumentsRequired(self.id + ' editOrder() requires a symbol argument')
3840
- self.load_markets()
3813
+ def edit_order_request(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={}):
3841
3814
  market = self.market(symbol)
3842
- enableUnifiedMargin, enableUnifiedAccount = self.is_unified_enabled()
3843
- isUnifiedAccount = (enableUnifiedMargin or enableUnifiedAccount)
3844
- isUsdcSettled = market['settle'] == 'USDC'
3845
- if isUsdcSettled and not isUnifiedAccount:
3846
- return self.edit_usdc_order(id, symbol, type, side, amount, price, params)
3847
3815
  request = {
3848
3816
  'symbol': market['id'],
3849
3817
  'orderId': id,
@@ -3904,6 +3872,43 @@ class bybit(Exchange, ImplicitAPI):
3904
3872
  if clientOrderId is not None:
3905
3873
  request['orderLinkId'] = clientOrderId
3906
3874
  params = self.omit(params, ['stopPrice', 'stopLossPrice', 'takeProfitPrice', 'triggerPrice', 'clientOrderId', 'stopLoss', 'takeProfit'])
3875
+ return request
3876
+
3877
+ def edit_order(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={}):
3878
+ """
3879
+ edit a trade order
3880
+ :see: https://bybit-exchange.github.io/docs/v5/order/amend-order
3881
+ :see: https://bybit-exchange.github.io/docs/derivatives/unified/replace-order
3882
+ :see: https://bybit-exchange.github.io/docs/api-explorer/derivatives/trade/contract/replace-order
3883
+ :param str id: cancel order id
3884
+ :param str symbol: unified symbol of the market to create an order in
3885
+ :param str type: 'market' or 'limit'
3886
+ :param str side: 'buy' or 'sell'
3887
+ :param float amount: how much of currency you want to trade in units of base currency
3888
+ :param float price: the price at which the order is to be fullfilled, in units of the base currency, ignored in market orders
3889
+ :param dict [params]: extra parameters specific to the exchange API endpoint
3890
+ :param float [params.triggerPrice]: The price that a trigger order is triggered at
3891
+ :param float [params.stopLossPrice]: The price that a stop loss order is triggered at
3892
+ :param float [params.takeProfitPrice]: The price that a take profit order is triggered at
3893
+ :param dict [params.takeProfit]: *takeProfit object in params* containing the triggerPrice that the attached take profit order will be triggered
3894
+ :param float [params.takeProfit.triggerPrice]: take profit trigger price
3895
+ :param dict [params.stopLoss]: *stopLoss object in params* containing the triggerPrice that the attached stop loss order will be triggered
3896
+ :param float [params.stopLoss.triggerPrice]: stop loss trigger price
3897
+ :param str [params.triggerBy]: 'IndexPrice', 'MarkPrice' or 'LastPrice', default is 'LastPrice', required if no initial value for triggerPrice
3898
+ :param str [params.slTriggerBy]: 'IndexPrice', 'MarkPrice' or 'LastPrice', default is 'LastPrice', required if no initial value for stopLoss
3899
+ :param str [params.tpTriggerby]: 'IndexPrice', 'MarkPrice' or 'LastPrice', default is 'LastPrice', required if no initial value for takeProfit
3900
+ :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
3901
+ """
3902
+ self.load_markets()
3903
+ if symbol is None:
3904
+ raise ArgumentsRequired(self.id + ' editOrder() requires a symbol argument')
3905
+ market = self.market(symbol)
3906
+ enableUnifiedMargin, enableUnifiedAccount = self.is_unified_enabled()
3907
+ isUnifiedAccount = (enableUnifiedMargin or enableUnifiedAccount)
3908
+ isUsdcSettled = market['settle'] == 'USDC'
3909
+ if isUsdcSettled and not isUnifiedAccount:
3910
+ return self.edit_usdc_order(id, symbol, type, side, amount, price, params)
3911
+ request = self.edit_order_request(id, symbol, type, side, amount, price, params)
3907
3912
  response = self.privatePostV5OrderAmend(self.extend(request, params))
3908
3913
  #
3909
3914
  # {
@@ -3959,26 +3964,8 @@ class bybit(Exchange, ImplicitAPI):
3959
3964
  result = self.safe_dict(response, 'result', {})
3960
3965
  return self.parse_order(result, market)
3961
3966
 
3962
- def cancel_order(self, id: str, symbol: Str = None, params={}):
3963
- """
3964
- cancels an open order
3965
- :see: https://bybit-exchange.github.io/docs/v5/order/cancel-order
3966
- :param str id: order id
3967
- :param str symbol: unified symbol of the market the order was made in
3968
- :param dict [params]: extra parameters specific to the exchange API endpoint
3969
- :param boolean [params.stop]: *spot only* whether the order is a stop order
3970
- :param str [params.orderFilter]: *spot only* 'Order' or 'StopOrder' or 'tpslOrder'
3971
- :returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
3972
- """
3973
- if symbol is None:
3974
- raise ArgumentsRequired(self.id + ' cancelOrder() requires a symbol argument')
3975
- self.load_markets()
3967
+ def cancel_order_request(self, id: str, symbol: Str = None, params={}):
3976
3968
  market = self.market(symbol)
3977
- enableUnifiedMargin, enableUnifiedAccount = self.is_unified_enabled()
3978
- isUnifiedAccount = (enableUnifiedMargin or enableUnifiedAccount)
3979
- isUsdcSettled = market['settle'] == 'USDC'
3980
- if isUsdcSettled and not isUnifiedAccount:
3981
- return self.cancel_usdc_order(id, symbol, params)
3982
3969
  request = {
3983
3970
  'symbol': market['id'],
3984
3971
  # 'orderLinkId': 'string',
@@ -3988,7 +3975,7 @@ class bybit(Exchange, ImplicitAPI):
3988
3975
  }
3989
3976
  if market['spot']:
3990
3977
  # only works for spot market
3991
- isStop = self.safe_value_2(params, 'stop', 'trigger', False)
3978
+ isStop = self.safe_bool_2(params, 'stop', 'trigger', False)
3992
3979
  params = self.omit(params, ['stop', 'trigger'])
3993
3980
  request['orderFilter'] = 'StopOrder' if isStop else 'Order'
3994
3981
  if id is not None: # The user can also use argument params["orderLinkId"]
@@ -4001,7 +3988,30 @@ class bybit(Exchange, ImplicitAPI):
4001
3988
  request['category'] = 'inverse'
4002
3989
  elif market['option']:
4003
3990
  request['category'] = 'option'
4004
- response = self.privatePostV5OrderCancel(self.extend(request, params))
3991
+ return self.extend(request, params)
3992
+
3993
+ def cancel_order(self, id: str, symbol: Str = None, params={}):
3994
+ """
3995
+ cancels an open order
3996
+ :see: https://bybit-exchange.github.io/docs/v5/order/cancel-order
3997
+ :param str id: order id
3998
+ :param str symbol: unified symbol of the market the order was made in
3999
+ :param dict [params]: extra parameters specific to the exchange API endpoint
4000
+ :param boolean [params.stop]: *spot only* whether the order is a stop order
4001
+ :param str [params.orderFilter]: *spot only* 'Order' or 'StopOrder' or 'tpslOrder'
4002
+ :returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
4003
+ """
4004
+ if symbol is None:
4005
+ raise ArgumentsRequired(self.id + ' cancelOrder() requires a symbol argument')
4006
+ self.load_markets()
4007
+ market = self.market(symbol)
4008
+ enableUnifiedMargin, enableUnifiedAccount = self.is_unified_enabled()
4009
+ isUnifiedAccount = (enableUnifiedMargin or enableUnifiedAccount)
4010
+ isUsdcSettled = market['settle'] == 'USDC'
4011
+ if isUsdcSettled and not isUnifiedAccount:
4012
+ return self.cancel_usdc_order(id, symbol, params)
4013
+ requestExtended = self.cancel_order_request(id, symbol, params)
4014
+ response = self.privatePostV5OrderCancel(requestExtended)
4005
4015
  #
4006
4016
  # {
4007
4017
  # "retCode": 0,
@@ -4474,9 +4484,9 @@ class bybit(Exchange, ImplicitAPI):
4474
4484
  request['limit'] = limit
4475
4485
  if since is not None:
4476
4486
  request['startTime'] = since
4477
- until = self.safe_integer_2(params, 'until', 'till') # unified in milliseconds
4487
+ until = self.safe_integer(params, 'until') # unified in milliseconds
4478
4488
  endTime = self.safe_integer(params, 'endTime', until) # exchange-specific in milliseconds
4479
- params = self.omit(params, ['endTime', 'till', 'until'])
4489
+ params = self.omit(params, ['endTime', 'until'])
4480
4490
  if endTime is not None:
4481
4491
  request['endTime'] = endTime
4482
4492
  response = self.privateGetV5OrderHistory(self.extend(request, params))
@@ -4632,9 +4642,9 @@ class bybit(Exchange, ImplicitAPI):
4632
4642
  request['limit'] = limit
4633
4643
  if since is not None:
4634
4644
  request['startTime'] = since
4635
- until = self.safe_integer_2(params, 'until', 'till') # unified in milliseconds
4645
+ until = self.safe_integer(params, 'until') # unified in milliseconds
4636
4646
  endTime = self.safe_integer(params, 'endTime', until) # exchange-specific in milliseconds
4637
- params = self.omit(params, ['endTime', 'till', 'until'])
4647
+ params = self.omit(params, ['endTime', 'until'])
4638
4648
  if endTime is not None:
4639
4649
  request['endTime'] = endTime
4640
4650
  response = self.privateGetV5OrderHistory(self.extend(request, params))
@@ -5379,7 +5389,7 @@ class bybit(Exchange, ImplicitAPI):
5379
5389
  # 'coin': currency['id'],
5380
5390
  # 'currency': currency['id'], # alias
5381
5391
  # 'start_date': self.iso8601(since),
5382
- # 'end_date': self.iso8601(till),
5392
+ # 'end_date': self.iso8601(until),
5383
5393
  # 'wallet_fund_type': 'Deposit', # Withdraw, RealisedPNL, Commission, Refund, Prize, ExchangeOrderWithdraw, ExchangeOrderDeposit
5384
5394
  # 'page': 1,
5385
5395
  # 'limit': 20, # max 50
@@ -6338,8 +6348,8 @@ class bybit(Exchange, ImplicitAPI):
6338
6348
  }
6339
6349
  if since is not None:
6340
6350
  request['startTime'] = since
6341
- until = self.safe_integer_2(params, 'until', 'till') # unified in milliseconds
6342
- params = self.omit(params, ['till', 'until'])
6351
+ until = self.safe_integer(params, 'until') # unified in milliseconds
6352
+ params = self.omit(params, ['until'])
6343
6353
  if until is not None:
6344
6354
  request['endTime'] = until
6345
6355
  if limit is not None:
@@ -6477,7 +6487,7 @@ class bybit(Exchange, ImplicitAPI):
6477
6487
  'info': interest,
6478
6488
  }, market)
6479
6489
 
6480
- def fetch_cross_borrow_rate(self, code: str, params={}):
6490
+ def fetch_cross_borrow_rate(self, code: str, params={}) -> CrossBorrowRate:
6481
6491
  """
6482
6492
  fetch the rate of interest to borrow a currency for margin trading
6483
6493
  :see: https://bybit-exchange.github.io/docs/zh-TW/v5/spot-margin-normal/interest-quota
ccxt/coinbase.py CHANGED
@@ -3109,9 +3109,9 @@ class coinbase(Exchange, ImplicitAPI):
3109
3109
  request['limit'] = limit
3110
3110
  if since is not None:
3111
3111
  request['start_date'] = self.iso8601(since)
3112
- until = self.safe_integer_n(params, ['until', 'till'])
3112
+ until = self.safe_integer_n(params, ['until'])
3113
3113
  if until is not None:
3114
- params = self.omit(params, ['until', 'till'])
3114
+ params = self.omit(params, ['until'])
3115
3115
  request['end_date'] = self.iso8601(until)
3116
3116
  response = self.v3PrivateGetBrokerageOrdersHistoricalBatch(self.extend(request, params))
3117
3117
  #
@@ -3179,9 +3179,9 @@ class coinbase(Exchange, ImplicitAPI):
3179
3179
  request['limit'] = limit
3180
3180
  if since is not None:
3181
3181
  request['start_date'] = self.iso8601(since)
3182
- until = self.safe_integer_n(params, ['until', 'till'])
3182
+ until = self.safe_integer_n(params, ['until'])
3183
3183
  if until is not None:
3184
- params = self.omit(params, ['until', 'till'])
3184
+ params = self.omit(params, ['until'])
3185
3185
  request['end_date'] = self.iso8601(until)
3186
3186
  response = self.v3PrivateGetBrokerageOrdersHistoricalBatch(self.extend(request, params))
3187
3187
  #
@@ -3309,8 +3309,8 @@ class coinbase(Exchange, ImplicitAPI):
3309
3309
  'product_id': market['id'],
3310
3310
  'granularity': self.safe_string(self.timeframes, timeframe, timeframe),
3311
3311
  }
3312
- until = self.safe_integer_n(params, ['until', 'till', 'end'])
3313
- params = self.omit(params, ['until', 'till'])
3312
+ until = self.safe_integer_n(params, ['until', 'end'])
3313
+ params = self.omit(params, ['until'])
3314
3314
  duration = self.parse_timeframe(timeframe)
3315
3315
  requestedDuration = limit * duration
3316
3316
  sinceString = None
@@ -3437,9 +3437,9 @@ class coinbase(Exchange, ImplicitAPI):
3437
3437
  request['limit'] = limit
3438
3438
  if since is not None:
3439
3439
  request['start_sequence_timestamp'] = self.iso8601(since)
3440
- until = self.safe_integer_n(params, ['until', 'till'])
3440
+ until = self.safe_integer_n(params, ['until'])
3441
3441
  if until is not None:
3442
- params = self.omit(params, ['until', 'till'])
3442
+ params = self.omit(params, ['until'])
3443
3443
  request['end_sequence_timestamp'] = self.iso8601(until)
3444
3444
  response = self.v3PrivateGetBrokerageOrdersHistoricalFills(self.extend(request, params))
3445
3445
  #
@@ -1725,9 +1725,9 @@ class coinbaseinternational(Exchange, ImplicitAPI):
1725
1725
  request['result_limit'] = limit
1726
1726
  if since is not None:
1727
1727
  request['time_from'] = self.iso8601(since)
1728
- until = self.safe_string_n(params, ['until', 'till'])
1728
+ until = self.safe_string_n(params, ['until'])
1729
1729
  if until is not None:
1730
- params = self.omit(params, ['until', 'till'])
1730
+ params = self.omit(params, ['until'])
1731
1731
  request['ref_datetime'] = self.iso8601(until)
1732
1732
  response = self.v1PrivateGetPortfoliosFills(self.extend(request, params))
1733
1733
  #