ccxt 4.4.22__py2.py3-none-any.whl → 4.4.24__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 (60) hide show
  1. ccxt/__init__.py +3 -1
  2. ccxt/abstract/binance.py +64 -43
  3. ccxt/abstract/binancecoinm.py +64 -43
  4. ccxt/abstract/binanceus.py +64 -43
  5. ccxt/abstract/binanceusdm.py +64 -43
  6. ccxt/abstract/coincatch.py +94 -0
  7. ccxt/abstract/kucoin.py +1 -0
  8. ccxt/abstract/kucoinfutures.py +1 -0
  9. ccxt/async_support/__init__.py +3 -1
  10. ccxt/async_support/base/exchange.py +1 -1
  11. ccxt/async_support/binance.py +87 -62
  12. ccxt/async_support/bitfinex.py +4 -0
  13. ccxt/async_support/bitflyer.py +1 -0
  14. ccxt/async_support/bitrue.py +3 -0
  15. ccxt/async_support/bybit.py +39 -6
  16. ccxt/async_support/cex.py +4 -0
  17. ccxt/async_support/coinbase.py +1 -1
  18. ccxt/async_support/coinbaseexchange.py +3 -0
  19. ccxt/async_support/coincatch.py +4955 -0
  20. ccxt/async_support/coinex.py +60 -1
  21. ccxt/async_support/gate.py +177 -59
  22. ccxt/async_support/hyperliquid.py +1 -1
  23. ccxt/async_support/kucoin.py +15 -8
  24. ccxt/async_support/latoken.py +6 -0
  25. ccxt/async_support/mexc.py +1 -1
  26. ccxt/async_support/oceanex.py +2 -0
  27. ccxt/async_support/okcoin.py +1 -0
  28. ccxt/async_support/poloniex.py +5 -0
  29. ccxt/async_support/yobit.py +1 -1
  30. ccxt/base/exchange.py +5 -4
  31. ccxt/binance.py +87 -62
  32. ccxt/bitfinex.py +4 -0
  33. ccxt/bitflyer.py +1 -0
  34. ccxt/bitrue.py +3 -0
  35. ccxt/bybit.py +39 -6
  36. ccxt/cex.py +4 -0
  37. ccxt/coinbase.py +1 -1
  38. ccxt/coinbaseexchange.py +3 -0
  39. ccxt/coincatch.py +4955 -0
  40. ccxt/coinex.py +60 -1
  41. ccxt/gate.py +177 -59
  42. ccxt/hyperliquid.py +1 -1
  43. ccxt/kucoin.py +15 -8
  44. ccxt/latoken.py +6 -0
  45. ccxt/mexc.py +1 -1
  46. ccxt/oceanex.py +2 -0
  47. ccxt/okcoin.py +1 -0
  48. ccxt/poloniex.py +5 -0
  49. ccxt/pro/__init__.py +3 -1
  50. ccxt/pro/coincatch.py +1429 -0
  51. ccxt/pro/kucoin.py +2 -1
  52. ccxt/pro/onetrading.py +2 -1
  53. ccxt/test/tests_async.py +29 -6
  54. ccxt/test/tests_sync.py +29 -6
  55. ccxt/yobit.py +1 -1
  56. {ccxt-4.4.22.dist-info → ccxt-4.4.24.dist-info}/METADATA +7 -6
  57. {ccxt-4.4.22.dist-info → ccxt-4.4.24.dist-info}/RECORD +60 -56
  58. {ccxt-4.4.22.dist-info → ccxt-4.4.24.dist-info}/LICENSE.txt +0 -0
  59. {ccxt-4.4.22.dist-info → ccxt-4.4.24.dist-info}/WHEEL +0 -0
  60. {ccxt-4.4.22.dist-info → ccxt-4.4.24.dist-info}/top_level.txt +0 -0
@@ -223,6 +223,7 @@ class kucoin(Exchange, ImplicitAPI):
223
223
  'market/orderbook/level{level}': 3, # 3SW
224
224
  'market/orderbook/level2': 3, # 3SW
225
225
  'market/orderbook/level3': 3, # 3SW
226
+ 'hf/accounts/opened': 2, #
226
227
  'hf/orders/active': 2, # 2SW
227
228
  'hf/orders/active/symbols': 2, # 2SW
228
229
  'hf/margin/order/active/symbols': 2, # 2SW
@@ -652,7 +653,7 @@ class kucoin(Exchange, ImplicitAPI):
652
653
  'FUD': 'FTX Users\' Debt',
653
654
  },
654
655
  'options': {
655
- 'hf': False,
656
+ 'hf': None, # would be auto set to `true/false` after first load
656
657
  'version': 'v1',
657
658
  'symbolSeparator': '-',
658
659
  'fetchMyTradesMethod': 'private_get_fills',
@@ -1084,7 +1085,8 @@ class kucoin(Exchange, ImplicitAPI):
1084
1085
  # "enableTrading": True
1085
1086
  # },
1086
1087
  #
1087
- requestMarginables = self.check_required_credentials(False)
1088
+ credentialsSet = self.check_required_credentials(False)
1089
+ requestMarginables = credentialsSet and self.safe_bool(params, 'marginables', True)
1088
1090
  if requestMarginables:
1089
1091
  promises.append(self.privateGetMarginSymbols(params)) # cross margin symbols
1090
1092
  #
@@ -1147,6 +1149,9 @@ class kucoin(Exchange, ImplicitAPI):
1147
1149
  # "makerCoefficient": "1" # Maker Fee Coefficient
1148
1150
  # }
1149
1151
  #
1152
+ if credentialsSet:
1153
+ # load migration status for account
1154
+ promises.append(self.load_migration_status())
1150
1155
  responses = await asyncio.gather(*promises)
1151
1156
  symbolsData = self.safe_list(responses[0], 'data')
1152
1157
  crossData = self.safe_dict(responses[1], 'data', {}) if requestMarginables else {}
@@ -1233,14 +1238,16 @@ class kucoin(Exchange, ImplicitAPI):
1233
1238
  return result
1234
1239
 
1235
1240
  async def load_migration_status(self, force: bool = False):
1236
- if not ('hfMigrated' in self.options) or (self.options['hfMigrated'] is None) or force:
1237
- result: dict = await self.privateGetMigrateUserAccountStatus()
1238
- data: dict = self.safe_dict(result, 'data', {})
1239
- status: Int = self.safe_integer(data, 'status')
1240
- self.options['hfMigrated'] = (status == 2)
1241
+ """
1242
+ loads the migration status for the account(hf or not)
1243
+ :see: https://www.kucoin.com/docs/rest/spot-trading/spot-hf-trade-pro-account/get-user-type
1244
+ """
1245
+ if not ('hf' in self.options) or (self.options['hf'] is None) or force:
1246
+ result: dict = await self.privateGetHfAccountsOpened()
1247
+ self.options['hf'] = self.safe_bool(result, 'data')
1241
1248
 
1242
1249
  def handle_hf_and_params(self, params={}):
1243
- migrated: Bool = self.safe_bool_2(self.options, 'hfMigrated', 'hf', False)
1250
+ migrated: Bool = self.safe_bool(self.options, 'hf', False)
1244
1251
  loadedHf: Bool = None
1245
1252
  if migrated is not None:
1246
1253
  if migrated:
@@ -60,6 +60,12 @@ class latoken(Exchange, ImplicitAPI):
60
60
  'fetchDepositAddressesByNetwork': False,
61
61
  'fetchDepositsWithdrawals': True,
62
62
  'fetchDepositWithdrawFees': False,
63
+ 'fetchFundingHistory': False,
64
+ 'fetchFundingInterval': False,
65
+ 'fetchFundingIntervals': False,
66
+ 'fetchFundingRate': False,
67
+ 'fetchFundingRateHistory': False,
68
+ 'fetchFundingRates': False,
63
69
  'fetchIsolatedBorrowRate': False,
64
70
  'fetchIsolatedBorrowRates': False,
65
71
  'fetchMarginMode': False,
@@ -94,7 +94,7 @@ class mexc(Exchange, ImplicitAPI):
94
94
  'fetchFundingIntervals': False,
95
95
  'fetchFundingRate': True,
96
96
  'fetchFundingRateHistory': True,
97
- 'fetchFundingRates': None,
97
+ 'fetchFundingRates': False,
98
98
  'fetchIndexOHLCV': True,
99
99
  'fetchIsolatedBorrowRate': False,
100
100
  'fetchIsolatedBorrowRates': False,
@@ -57,6 +57,8 @@ class oceanex(Exchange, ImplicitAPI):
57
57
  'fetchDepositAddress': 'emulated',
58
58
  'fetchDepositAddresses': None,
59
59
  'fetchDepositAddressesByNetwork': True,
60
+ 'fetchFundingRateHistory': False,
61
+ 'fetchFundingRates': False,
60
62
  'fetchIsolatedBorrowRate': False,
61
63
  'fetchIsolatedBorrowRates': False,
62
64
  'fetchMarkets': True,
@@ -72,6 +72,7 @@ class okcoin(Exchange, ImplicitAPI):
72
72
  'fetchFundingHistory': False,
73
73
  'fetchFundingRate': False,
74
74
  'fetchFundingRateHistory': False,
75
+ 'fetchFundingRates': False,
75
76
  'fetchLedger': True,
76
77
  'fetchMarkets': True,
77
78
  'fetchMyTrades': True,
@@ -62,7 +62,12 @@ class poloniex(Exchange, ImplicitAPI):
62
62
  'fetchDepositsWithdrawals': True,
63
63
  'fetchDepositWithdrawFee': 'emulated',
64
64
  'fetchDepositWithdrawFees': True,
65
+ 'fetchFundingHistory': False,
66
+ 'fetchFundingInterval': False,
67
+ 'fetchFundingIntervals': False,
65
68
  'fetchFundingRate': False,
69
+ 'fetchFundingRateHistory': False,
70
+ 'fetchFundingRates': False,
66
71
  'fetchMarginMode': False,
67
72
  'fetchMarkets': True,
68
73
  'fetchMyTrades': True,
@@ -1125,7 +1125,7 @@ class yobit(Exchange, ImplicitAPI):
1125
1125
  ids = list(trades.keys())
1126
1126
  result = []
1127
1127
  for i in range(0, len(ids)):
1128
- id = ids[i]
1128
+ id = self.safe_string(ids, i)
1129
1129
  trade = self.parse_trade(self.extend(trades[id], {
1130
1130
  'trade_id': id,
1131
1131
  }), market)
ccxt/base/exchange.py CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.4.22'
7
+ __version__ = '4.4.24'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -3001,9 +3001,10 @@ class Exchange(object):
3001
3001
  isTriggerOrSLTpOrder = ((self.safe_string(order, 'triggerPrice') is not None or (self.safe_string(order, 'stopLossPrice') is not None)) or (self.safe_string(order, 'takeProfitPrice') is not None))
3002
3002
  if parseFilled or parseCost or shouldParseFees:
3003
3003
  rawTrades = self.safe_value(order, 'trades', trades)
3004
- oldNumber = self.number
3004
+ # oldNumber = self.number
3005
3005
  # we parse trades here!
3006
- self.number = str
3006
+ # i don't think self is needed anymore
3007
+ # self.number = str
3007
3008
  firstTrade = self.safe_value(rawTrades, 0)
3008
3009
  # parse trades if they haven't already been parsed
3009
3010
  tradesAreParsed = ((firstTrade is not None) and ('info' in firstTrade) and ('id' in firstTrade))
@@ -3011,7 +3012,7 @@ class Exchange(object):
3011
3012
  trades = self.parse_trades(rawTrades, market)
3012
3013
  else:
3013
3014
  trades = rawTrades
3014
- self.number = oldNumber
3015
+ # self.number = oldNumber; why parse trades if you read the value using `safeString` ?
3015
3016
  tradesLength = 0
3016
3017
  isArray = isinstance(trades, list)
3017
3018
  if isArray:
ccxt/binance.py CHANGED
@@ -494,6 +494,7 @@ class binance(Exchange, ImplicitAPI):
494
494
  'portfolio/asset-index-price': 0.1,
495
495
  'portfolio/repay-futures-switch': 3, # Weight(IP): 30 => cost = 0.1 * 30 = 3
496
496
  'portfolio/margin-asset-leverage': 5, # Weight(IP): 50 => cost = 0.1 * 50 = 5
497
+ 'portfolio/balance': 2,
497
498
  # staking
498
499
  'staking/productList': 0.1,
499
500
  'staking/position': 0.1,
@@ -696,6 +697,7 @@ class binance(Exchange, ImplicitAPI):
696
697
  'loan/flexible/ltv/adjustment/history': 40, # Weight(IP): 400 => cost = 0.1 * 400 = 40
697
698
  'loan/flexible/loanable/data': 40, # Weight(IP): 400 => cost = 0.1 * 400 = 40
698
699
  'loan/flexible/collateral/data': 40, # Weight(IP): 400 => cost = 0.1 * 400 = 40
700
+ 'portfolio/account': 2,
699
701
  },
700
702
  'post': {
701
703
  'eth-staking/eth/stake': 15, # Weight(IP): 150 => cost = 0.1 * 150 = 15
@@ -773,6 +775,10 @@ class binance(Exchange, ImplicitAPI):
773
775
  'commissionRate': 20,
774
776
  'income/asyn': 5,
775
777
  'income/asyn/id': 5,
778
+ 'trade/asyn': 0.5,
779
+ 'trade/asyn/id': 0.5,
780
+ 'order/asyn': 0.5,
781
+ 'order/asyn/id': 0.5,
776
782
  'pmExchangeInfo': 0.5, # Weight(IP): 5 => cost = 0.1 * 5 = 0.5
777
783
  'pmAccountInfo': 0.5, # Weight(IP): 5 => cost = 0.1 * 5 = 0.5
778
784
  },
@@ -1051,99 +1057,118 @@ class binance(Exchange, ImplicitAPI):
1051
1057
  },
1052
1058
  },
1053
1059
  'papi': {
1060
+ # IP(papi) request rate limit of 6000 per minute
1061
+ # 1 IP(papi) => cost = 0.2 =>(1000 / (50 * 0.2)) * 60 = 6000
1062
+ # Order(papi) request rate limit of 1200 per minute
1063
+ # 1 Order(papi) => cost = 1 =>(1000 / (50 * 1)) * 60 = 1200
1054
1064
  'get': {
1055
- 'ping': 1,
1056
- 'um/order': 1, # 1
1057
- 'um/openOrder': 1, # 1
1065
+ 'ping': 0.2,
1066
+ 'um/order': 1,
1067
+ 'um/openOrder': 1,
1058
1068
  'um/openOrders': {'cost': 1, 'noSymbol': 40},
1059
- 'um/allOrders': 5, # 5
1060
- 'cm/order': 1, # 1
1061
- 'cm/openOrder': 1, # 1
1069
+ 'um/allOrders': 5,
1070
+ 'cm/order': 1,
1071
+ 'cm/openOrder': 1,
1062
1072
  'cm/openOrders': {'cost': 1, 'noSymbol': 40},
1063
- 'cm/allOrders': 20, # 20
1073
+ 'cm/allOrders': 20,
1064
1074
  'um/conditional/openOrder': 1,
1065
1075
  'um/conditional/openOrders': {'cost': 1, 'noSymbol': 40},
1066
1076
  'um/conditional/orderHistory': 1,
1067
- 'um/conditional/allOrders': 40,
1077
+ 'um/conditional/allOrders': {'cost': 1, 'noSymbol': 40},
1068
1078
  'cm/conditional/openOrder': 1,
1069
1079
  'cm/conditional/openOrders': {'cost': 1, 'noSymbol': 40},
1070
1080
  'cm/conditional/orderHistory': 1,
1071
1081
  'cm/conditional/allOrders': 40,
1072
- 'margin/order': 5,
1082
+ 'margin/order': 10,
1073
1083
  'margin/openOrders': 5,
1074
1084
  'margin/allOrders': 100,
1075
1085
  'margin/orderList': 5,
1076
1086
  'margin/allOrderList': 100,
1077
1087
  'margin/openOrderList': 5,
1078
1088
  'margin/myTrades': 5,
1079
- 'balance': 20, # 20
1080
- 'account': 20, # 20
1081
- 'margin/maxBorrowable': 5, # 5
1082
- 'margin/maxWithdraw': 5, # 5
1083
- 'um/positionRisk': 5, # 5
1084
- 'cm/positionRisk': 1, # 1
1085
- 'um/positionSide/dual': 30, # 30
1086
- 'cm/positionSide/dual': 30, # 30
1087
- 'um/userTrades': 5, # 5
1088
- 'cm/userTrades': 20, # 20
1089
- 'um/leverageBracket': 1, # 1
1090
- 'cm/leverageBracket': 1, # 1
1091
- 'margin/forceOrders': 1, # 1
1092
- 'um/forceOrders': 20, # 20
1093
- 'cm/forceOrders': 20, # 20
1094
- 'um/apiTradingStatus': 1, # 1
1095
- 'um/commissionRate': 20, # 20
1096
- 'cm/commissionRate': 20, # 20
1097
- 'margin/marginLoan': 10,
1098
- 'margin/repayLoan': 10,
1099
- 'margin/marginInterestHistory': 1,
1100
- 'portfolio/interest-history': 50, # 50
1101
- 'um/income': 30,
1102
- 'cm/income': 30,
1103
- 'um/account': 5,
1104
- 'cm/account': 5,
1105
- 'repay-futures-switch': 3, # Weight(IP): 30 => cost = 0.1 * 30 = 3
1089
+ 'balance': 4,
1090
+ 'account': 4,
1091
+ 'margin/maxBorrowable': 1,
1092
+ 'margin/maxWithdraw': 1,
1093
+ 'um/positionRisk': 1,
1094
+ 'cm/positionRisk': 0.2,
1095
+ 'um/positionSide/dual': 6,
1096
+ 'cm/positionSide/dual': 6,
1097
+ 'um/userTrades': 5,
1098
+ 'cm/userTrades': 20,
1099
+ 'um/leverageBracket': 0.2,
1100
+ 'cm/leverageBracket': 0.2,
1101
+ 'margin/forceOrders': 1,
1102
+ 'um/forceOrders': {'cost': 20, 'noSymbol': 50},
1103
+ 'cm/forceOrders': {'cost': 20, 'noSymbol': 50},
1104
+ 'um/apiTradingStatus': {'cost': 0.2, 'noSymbol': 2},
1105
+ 'um/commissionRate': 4,
1106
+ 'cm/commissionRate': 4,
1107
+ 'margin/marginLoan': 2,
1108
+ 'margin/repayLoan': 2,
1109
+ 'margin/marginInterestHistory': 0.2,
1110
+ 'portfolio/interest-history': 10,
1111
+ 'um/income': 6,
1112
+ 'cm/income': 6,
1113
+ 'um/account': 1,
1114
+ 'cm/account': 1,
1115
+ 'repay-futures-switch': 6,
1106
1116
  'um/adlQuantile': 5,
1107
1117
  'cm/adlQuantile': 5,
1118
+ 'um/trade/asyn': 300,
1119
+ 'um/trade/asyn/id': 2,
1120
+ 'um/order/asyn': 300,
1121
+ 'um/order/asyn/id': 2,
1122
+ 'um/income/asyn': 300,
1123
+ 'um/income/asyn/id': 2,
1124
+ 'um/orderAmendment': 1,
1125
+ 'cm/orderAmendment': 1,
1126
+ 'um/feeBurn': 30,
1127
+ 'um/accountConfig': 1,
1128
+ 'um/symbolConfig': 1,
1129
+ 'cm/accountConfig': 1,
1130
+ 'cm/symbolConfig': 1,
1108
1131
  },
1109
1132
  'post': {
1110
- 'um/order': 1, # 0
1133
+ 'um/order': 1,
1111
1134
  'um/conditional/order': 1,
1112
- 'cm/order': 1, # 0
1135
+ 'cm/order': 1,
1113
1136
  'cm/conditional/order': 1,
1114
- 'margin/order': 0.0133, # Weight(UID): 2 => cost = 0.006667 * 2 = 0.013334
1115
- 'marginLoan': 0.1333, # Weight(UID): 20 => cost = 0.006667 * 20 = 0.13334
1116
- 'repayLoan': 0.1333, # Weight(UID): 20 => cost = 0.006667 * 20 = 0.13334
1117
- 'margin/order/oco': 0.0400, # Weight(UID): 6 => cost = 0.006667 * 6 = 0.040002
1118
- 'um/leverage': 1, # 1
1119
- 'cm/leverage': 1, # 1
1120
- 'um/positionSide/dual': 1, # 1
1121
- 'cm/positionSide/dual': 1, # 1
1122
- 'auto-collection': 0.6667, # Weight(UID): 100 => cost = 0.006667 * 100 = 0.6667
1123
- 'bnb-transfer': 0.6667, # Weight(UID): 100 => cost = 0.006667 * 100 = 0.6667
1124
- 'repay-futures-switch': 150, # Weight(IP): 1500 => cost = 0.1 * 1500 = 150
1125
- 'repay-futures-negative-balance': 150, # Weight(IP): 1500 => cost = 0.1 * 1500 = 150
1126
- 'listenKey': 1, # 1
1127
- 'asset-collection': 3,
1128
- 'margin/repay-debt': 0.4, # Weight(Order): 0.4 =>(1000 / (50 * 0.4)) * 60 = 3000
1137
+ 'margin/order': 1,
1138
+ 'marginLoan': 100,
1139
+ 'repayLoan': 100,
1140
+ 'margin/order/oco': 1,
1141
+ 'um/leverage': 0.2,
1142
+ 'cm/leverage': 0.2,
1143
+ 'um/positionSide/dual': 0.2,
1144
+ 'cm/positionSide/dual': 0.2,
1145
+ 'auto-collection': 150,
1146
+ 'bnb-transfer': 150,
1147
+ 'repay-futures-switch': 150,
1148
+ 'repay-futures-negative-balance': 150,
1149
+ 'listenKey': 0.2,
1150
+ 'asset-collection': 6,
1151
+ 'margin/repay-debt': 3000,
1129
1152
  'um/feeBurn': 1,
1130
1153
  },
1131
1154
  'put': {
1132
- 'listenKey': 1, # 1
1155
+ 'listenKey': 0.2,
1156
+ 'um/order': 1,
1157
+ 'cm/order': 1,
1133
1158
  },
1134
1159
  'delete': {
1135
- 'um/order': 1, # 1
1160
+ 'um/order': 1,
1136
1161
  'um/conditional/order': 1,
1137
- 'um/allOpenOrders': 1, # 1
1162
+ 'um/allOpenOrders': 1,
1138
1163
  'um/conditional/allOpenOrders': 1,
1139
- 'cm/order': 1, # 1
1164
+ 'cm/order': 1,
1140
1165
  'cm/conditional/order': 1,
1141
- 'cm/allOpenOrders': 1, # 1
1166
+ 'cm/allOpenOrders': 1,
1142
1167
  'cm/conditional/allOpenOrders': 1,
1143
- 'margin/order': 1, # Weight(IP): 10 => cost = 0.1 * 10 = 1
1144
- 'margin/allOpenOrders': 5, # 5
1145
- 'margin/orderList': 2, # 2
1146
- 'listenKey': 1, # 1
1168
+ 'margin/order': 2,
1169
+ 'margin/allOpenOrders': 5,
1170
+ 'margin/orderList': 2,
1171
+ 'listenKey': 0.2,
1147
1172
  },
1148
1173
  },
1149
1174
  },
ccxt/bitfinex.py CHANGED
@@ -60,6 +60,10 @@ class bitfinex(Exchange, ImplicitAPI):
60
60
  'fetchDepositsWithdrawals': True,
61
61
  'fetchDepositWithdrawFee': 'emulated',
62
62
  'fetchDepositWithdrawFees': True,
63
+ 'fetchFundingHistory': False,
64
+ 'fetchFundingRate': False, # Endpoint 'lendbook/{currency}' is related to interest rates on spot margin lending
65
+ 'fetchFundingRateHistory': False,
66
+ 'fetchFundingRates': False,
63
67
  'fetchIndexOHLCV': False,
64
68
  'fetchLeverageTiers': False,
65
69
  'fetchMarginMode': False,
ccxt/bitflyer.py CHANGED
@@ -41,6 +41,7 @@ class bitflyer(Exchange, ImplicitAPI):
41
41
  'fetchDeposits': True,
42
42
  'fetchFundingRate': True,
43
43
  'fetchFundingRateHistory': False,
44
+ 'fetchFundingRates': False,
44
45
  'fetchMarginMode': False,
45
46
  'fetchMarkets': True,
46
47
  'fetchMyTrades': True,
ccxt/bitrue.py CHANGED
@@ -72,7 +72,10 @@ class bitrue(Exchange, ImplicitAPI):
72
72
  'fetchDepositsWithdrawals': False,
73
73
  'fetchDepositWithdrawFee': 'emulated',
74
74
  'fetchDepositWithdrawFees': True,
75
+ 'fetchFundingHistory': False,
75
76
  'fetchFundingRate': False,
77
+ 'fetchFundingRateHistory': False,
78
+ 'fetchFundingRates': False,
76
79
  'fetchIsolatedBorrowRate': False,
77
80
  'fetchIsolatedBorrowRates': False,
78
81
  'fetchMarginMode': False,
ccxt/bybit.py CHANGED
@@ -1026,6 +1026,7 @@ class bybit(Exchange, ImplicitAPI):
1026
1026
  },
1027
1027
  'enableUnifiedMargin': None,
1028
1028
  'enableUnifiedAccount': None,
1029
+ 'unifiedMarginStatus': None,
1029
1030
  'createMarketBuyOrderRequiresPrice': True, # only True for classic accounts
1030
1031
  'createUnifiedMarginAccount': False,
1031
1032
  'defaultType': 'swap', # 'swap', 'future', 'option', 'spot'
@@ -1145,6 +1146,8 @@ class bybit(Exchange, ImplicitAPI):
1145
1146
 
1146
1147
  def is_unified_enabled(self, params={}):
1147
1148
  """
1149
+ :see: https://bybit-exchange.github.io/docs/v5/user/apikey-info#http-request
1150
+ :see: https://bybit-exchange.github.io/docs/v5/account/account-info
1148
1151
  returns [enableUnifiedMargin, enableUnifiedAccount] so the user can check if unified account is enabled
1149
1152
  """
1150
1153
  # The API key of user id must own one of permissions will be allowed to call following API endpoints.
@@ -1158,8 +1161,12 @@ class bybit(Exchange, ImplicitAPI):
1158
1161
  # so we're assuming UTA is enabled
1159
1162
  self.options['enableUnifiedMargin'] = False
1160
1163
  self.options['enableUnifiedAccount'] = True
1164
+ self.options['unifiedMarginStatus'] = 3
1161
1165
  return [self.options['enableUnifiedMargin'], self.options['enableUnifiedAccount']]
1162
- response = self.privateGetV5UserQueryApi(params)
1166
+ rawPromises = [self.privateGetV5UserQueryApi(params), self.privateGetV5AccountInfo(params)]
1167
+ promises = rawPromises
1168
+ response = promises[0]
1169
+ accountInfo = promises[1]
1163
1170
  #
1164
1171
  # {
1165
1172
  # "retCode": 0,
@@ -1199,13 +1206,34 @@ class bybit(Exchange, ImplicitAPI):
1199
1206
  # "retExtInfo": {},
1200
1207
  # "time": 1676891757649
1201
1208
  # }
1209
+ # account info
1210
+ # {
1211
+ # "retCode": 0,
1212
+ # "retMsg": "OK",
1213
+ # "result": {
1214
+ # "marginMode": "REGULAR_MARGIN",
1215
+ # "updatedTime": "1697078946000",
1216
+ # "unifiedMarginStatus": 4,
1217
+ # "dcpStatus": "OFF",
1218
+ # "timeWindow": 10,
1219
+ # "smpGroup": 0,
1220
+ # "isMasterTrader": False,
1221
+ # "spotHedgingStatus": "OFF"
1222
+ # }
1223
+ # }
1202
1224
  #
1203
1225
  result = self.safe_dict(response, 'result', {})
1226
+ accountResult = self.safe_dict(accountInfo, 'result', {})
1204
1227
  self.options['enableUnifiedMargin'] = self.safe_integer(result, 'unified') == 1
1205
1228
  self.options['enableUnifiedAccount'] = self.safe_integer(result, 'uta') == 1
1229
+ self.options['unifiedMarginStatus'] = self.safe_integer(accountResult, 'unifiedMarginStatus', 3) # default to uta.1 if not found
1206
1230
  return [self.options['enableUnifiedMargin'], self.options['enableUnifiedAccount']]
1207
1231
 
1208
1232
  def upgrade_unified_trade_account(self, params={}):
1233
+ """
1234
+ :see: https://bybit-exchange.github.io/docs/v5/account/upgrade-unified-account
1235
+ upgrades the account to unified trade account *warning* self is irreversible
1236
+ """
1209
1237
  return self.privatePostV5AccountUpgradeToUta(params)
1210
1238
 
1211
1239
  def create_expired_option_market(self, symbol: str):
@@ -3018,10 +3046,15 @@ class bybit(Exchange, ImplicitAPI):
3018
3046
  isInverse = (type == 'inverse')
3019
3047
  isFunding = (lowercaseRawType == 'fund') or (lowercaseRawType == 'funding')
3020
3048
  if isUnifiedAccount:
3021
- if isInverse:
3022
- type = 'contract'
3049
+ unifiedMarginStatus = self.safe_integer(self.options, 'unifiedMarginStatus', 3)
3050
+ if unifiedMarginStatus < 5:
3051
+ # it's not uta.20 where inverse are unified
3052
+ if isInverse:
3053
+ type = 'contract'
3054
+ else:
3055
+ type = 'unified'
3023
3056
  else:
3024
- type = 'unified'
3057
+ type = 'unified' # uta.20 where inverse are unified
3025
3058
  else:
3026
3059
  if isLinear or isInverse:
3027
3060
  type = 'contract'
@@ -7087,13 +7120,13 @@ class bybit(Exchange, ImplicitAPI):
7087
7120
 
7088
7121
  def parse_margin_loan(self, info, currency: Currency = None):
7089
7122
  #
7090
- # borrowMargin
7123
+ # borrowCrossMargin
7091
7124
  #
7092
7125
  # {
7093
7126
  # "transactId": "14143"
7094
7127
  # }
7095
7128
  #
7096
- # repayMargin
7129
+ # repayCrossMargin
7097
7130
  #
7098
7131
  # {
7099
7132
  # "repayId": "12128"
ccxt/cex.py CHANGED
@@ -43,6 +43,10 @@ class cex(Exchange, ImplicitAPI):
43
43
  'fetchCurrencies': True,
44
44
  'fetchDepositAddress': True,
45
45
  'fetchDepositsWithdrawals': True,
46
+ 'fetchFundingHistory': False,
47
+ 'fetchFundingRate': False,
48
+ 'fetchFundingRateHistory': False,
49
+ 'fetchFundingRates': False,
46
50
  'fetchLedger': True,
47
51
  'fetchMarkets': True,
48
52
  'fetchOHLCV': True,
ccxt/coinbase.py CHANGED
@@ -3491,7 +3491,7 @@ class coinbase(Exchange, ImplicitAPI):
3491
3491
  paginate = False
3492
3492
  paginate, params = self.handle_option_and_params(params, 'fetchMyTrades', 'paginate')
3493
3493
  if paginate:
3494
- return self.fetch_paginated_call_cursor('fetchMyTrades', symbol, since, limit, params, 'cursor', 'cursor', None, 100)
3494
+ return self.fetch_paginated_call_cursor('fetchMyTrades', symbol, since, limit, params, 'cursor', 'cursor', None, 250)
3495
3495
  market = None
3496
3496
  if symbol is not None:
3497
3497
  market = self.market(symbol)
ccxt/coinbaseexchange.py CHANGED
@@ -53,7 +53,10 @@ class coinbaseexchange(Exchange, ImplicitAPI):
53
53
  'fetchDepositAddress': False, # the exchange does not have self method, only createDepositAddress, see https://github.com/ccxt/ccxt/pull/7405
54
54
  'fetchDeposits': True,
55
55
  'fetchDepositsWithdrawals': True,
56
+ 'fetchFundingHistory': False,
56
57
  'fetchFundingRate': False,
58
+ 'fetchFundingRateHistory': False,
59
+ 'fetchFundingRates': False,
57
60
  'fetchLedger': True,
58
61
  'fetchMarginMode': False,
59
62
  'fetchMarkets': True,