ccxt 4.4.36__py2.py3-none-any.whl → 4.4.37__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/coinbase.py CHANGED
@@ -88,6 +88,8 @@ class coinbase(Exchange, ImplicitAPI):
88
88
  'fetchDepositAddress': 'emulated',
89
89
  'fetchDepositAddresses': False,
90
90
  'fetchDepositAddressesByNetwork': True,
91
+ 'fetchDepositMethodId': True,
92
+ 'fetchDepositMethodIds': True,
91
93
  'fetchDeposits': True,
92
94
  'fetchDepositsWithdrawals': True,
93
95
  'fetchFundingHistory': False,
@@ -4102,6 +4104,90 @@ class coinbase(Exchange, ImplicitAPI):
4102
4104
  data = self.safe_dict(response, 'data', {})
4103
4105
  return self.parse_transaction(data)
4104
4106
 
4107
+ def fetch_deposit_method_ids(self, params={}):
4108
+ """
4109
+ fetch the deposit id for a fiat currency associated with self account
4110
+
4111
+ https://docs.cdp.coinbase.com/advanced-trade/reference/retailbrokerageapi_getpaymentmethods
4112
+
4113
+ :param dict [params]: extra parameters specific to the exchange API endpoint
4114
+ :returns dict: an array of `deposit id structures <https://docs.ccxt.com/#/?id=deposit-id-structure>`
4115
+ """
4116
+ self.load_markets()
4117
+ response = self.v3PrivateGetBrokeragePaymentMethods(params)
4118
+ #
4119
+ # {
4120
+ # "payment_methods": [
4121
+ # {
4122
+ # "id": "21b39a5d-f7b46876fb2e",
4123
+ # "type": "COINBASE_FIAT_ACCOUNT",
4124
+ # "name": "CAD Wallet",
4125
+ # "currency": "CAD",
4126
+ # "verified": True,
4127
+ # "allow_buy": False,
4128
+ # "allow_sell": True,
4129
+ # "allow_deposit": False,
4130
+ # "allow_withdraw": False,
4131
+ # "created_at": "2023-06-29T19:58:46Z",
4132
+ # "updated_at": "2023-10-30T20:25:01Z"
4133
+ # }
4134
+ # ]
4135
+ # }
4136
+ #
4137
+ result = self.safe_list(response, 'payment_methods', [])
4138
+ return self.parse_deposit_method_ids(result)
4139
+
4140
+ def fetch_deposit_method_id(self, id: str, params={}):
4141
+ """
4142
+ fetch the deposit id for a fiat currency associated with self account
4143
+
4144
+ https://docs.cdp.coinbase.com/advanced-trade/reference/retailbrokerageapi_getpaymentmethod
4145
+
4146
+ :param str id: the deposit payment method id
4147
+ :param dict [params]: extra parameters specific to the exchange API endpoint
4148
+ :returns dict: a `deposit id structure <https://docs.ccxt.com/#/?id=deposit-id-structure>`
4149
+ """
4150
+ self.load_markets()
4151
+ request: dict = {
4152
+ 'payment_method_id': id,
4153
+ }
4154
+ response = self.v3PrivateGetBrokeragePaymentMethodsPaymentMethodId(self.extend(request, params))
4155
+ #
4156
+ # {
4157
+ # "payment_method": {
4158
+ # "id": "21b39a5d-f7b46876fb2e",
4159
+ # "type": "COINBASE_FIAT_ACCOUNT",
4160
+ # "name": "CAD Wallet",
4161
+ # "currency": "CAD",
4162
+ # "verified": True,
4163
+ # "allow_buy": False,
4164
+ # "allow_sell": True,
4165
+ # "allow_deposit": False,
4166
+ # "allow_withdraw": False,
4167
+ # "created_at": "2023-06-29T19:58:46Z",
4168
+ # "updated_at": "2023-10-30T20:25:01Z"
4169
+ # }
4170
+ # }
4171
+ #
4172
+ result = self.safe_dict(response, 'payment_method', {})
4173
+ return self.parse_deposit_method_id(result)
4174
+
4175
+ def parse_deposit_method_ids(self, ids, params={}):
4176
+ result = []
4177
+ for i in range(0, len(ids)):
4178
+ id = self.extend(self.parse_deposit_method_id(ids[i]), params)
4179
+ result.append(id)
4180
+ return result
4181
+
4182
+ def parse_deposit_method_id(self, depositId):
4183
+ return {
4184
+ 'info': depositId,
4185
+ 'id': self.safe_string(depositId, 'id'),
4186
+ 'currency': self.safe_string(depositId, 'currency'),
4187
+ 'verified': self.safe_bool(depositId, 'verified'),
4188
+ 'tag': self.safe_string(depositId, 'name'),
4189
+ }
4190
+
4105
4191
  def fetch_convert_quote(self, fromCode: str, toCode: str, amount: Num = None, params={}) -> Conversion:
4106
4192
  """
4107
4193
  fetch a quote for converting from one currency to another
ccxt/gate.py CHANGED
@@ -40,7 +40,7 @@ class gate(Exchange, ImplicitAPI):
40
40
  'certified': True,
41
41
  'pro': True,
42
42
  'urls': {
43
- 'logo': 'https://user-images.githubusercontent.com/1294454/31784029-0313c702-b509-11e7-9ccc-bc0da6a0e435.jpg',
43
+ 'logo': 'https://github.com/user-attachments/assets/64f988c5-07b6-4652-b5c1-679a6bf67c85',
44
44
  'doc': 'https://www.gate.io/docs/developers/apiv4/en/',
45
45
  'www': 'https://gate.io/',
46
46
  'api': {
ccxt/hyperliquid.py CHANGED
@@ -225,6 +225,96 @@ class hyperliquid(Exchange, ImplicitAPI):
225
225
  'defaultSlippage': 0.05,
226
226
  'zeroAddress': '0x0000000000000000000000000000000000000000',
227
227
  },
228
+ 'features': {
229
+ 'default': {
230
+ 'sandbox': True,
231
+ 'createOrder': {
232
+ 'marginMode': False,
233
+ 'triggerPrice': False,
234
+ 'triggerPriceType': None,
235
+ 'triggerDirection': False,
236
+ 'stopLossPrice': False,
237
+ 'takeProfitPrice': False,
238
+ 'attachedStopLossTakeProfit': None,
239
+ 'timeInForce': {
240
+ 'GTC': True,
241
+ 'IOC': True,
242
+ 'FOK': False,
243
+ 'PO': True,
244
+ 'GTD': False,
245
+ },
246
+ 'hedged': False,
247
+ 'trailing': False,
248
+ },
249
+ 'createOrders': {
250
+ 'max': 1000,
251
+ },
252
+ 'fetchMyTrades': {
253
+ 'marginMode': False,
254
+ 'limit': 2000,
255
+ 'daysBack': None,
256
+ 'untilDays': None,
257
+ },
258
+ 'fetchOrder': {
259
+ 'marginMode': False,
260
+ 'trigger': False,
261
+ 'trailing': False,
262
+ },
263
+ 'fetchOpenOrders': {
264
+ 'marginMode': False,
265
+ 'limit': 2000,
266
+ 'trigger': False,
267
+ 'trailing': False,
268
+ },
269
+ 'fetchOrders': {
270
+ 'marginMode': False,
271
+ 'limit': 2000,
272
+ 'daysBack': None,
273
+ 'untilDays': None,
274
+ 'trigger': False,
275
+ 'trailing': False,
276
+ },
277
+ 'fetchClosedOrders': {
278
+ 'marginMode': False,
279
+ 'limit': 2000,
280
+ 'daysBackClosed': None,
281
+ 'daysBackCanceled': None,
282
+ 'untilDays': None,
283
+ 'trigger': False,
284
+ 'trailing': False,
285
+ },
286
+ 'fetchOHLCV': {
287
+ 'limit': 5000,
288
+ },
289
+ },
290
+ 'spot': {
291
+ 'extends': 'default',
292
+ },
293
+ 'forPerps': {
294
+ 'extends': 'default',
295
+ 'createOrder': {
296
+ 'stopLossPrice': True,
297
+ 'takeProfitPrice': True,
298
+ 'attachedStopLossTakeProfit': None, # todo, in two orders
299
+ },
300
+ },
301
+ 'swap': {
302
+ 'linear': {
303
+ 'extends': 'forPerps',
304
+ },
305
+ 'inverse': {
306
+ 'extends': 'forPerps',
307
+ },
308
+ },
309
+ 'future': {
310
+ 'linear': {
311
+ 'extends': 'forPerps',
312
+ },
313
+ 'inverse': {
314
+ 'extends': 'forPerps',
315
+ },
316
+ },
317
+ },
228
318
  })
229
319
 
230
320
  def set_sandbox_mode(self, enabled):
@@ -502,7 +592,7 @@ class hyperliquid(Exchange, ImplicitAPI):
502
592
  pricePrecision = self.calculate_price_precision(price, amountPrecision, 8)
503
593
  pricePrecisionStr = self.number_to_string(pricePrecision)
504
594
  # quotePrecision = self.parse_number(self.parse_precision(self.safe_string(innerQuoteTokenInfo, 'szDecimals')))
505
- baseId = self.number_to_string(i + 10000)
595
+ baseId = self.number_to_string(index + 10000)
506
596
  markets.append(self.safe_market_structure({
507
597
  'id': marketName,
508
598
  'symbol': symbol,
@@ -1191,7 +1281,7 @@ class hyperliquid(Exchange, ImplicitAPI):
1191
1281
  signature = self.sign_message(msg, self.privateKey)
1192
1282
  return signature
1193
1283
 
1194
- def build_transfer_sig(self, message):
1284
+ def build_usd_send_sig(self, message):
1195
1285
  messageTypes: dict = {
1196
1286
  'HyperliquidTransaction:UsdSend': [
1197
1287
  {'name': 'hyperliquidChain', 'type': 'string'},
@@ -1202,6 +1292,17 @@ class hyperliquid(Exchange, ImplicitAPI):
1202
1292
  }
1203
1293
  return self.sign_user_signed_action(messageTypes, message)
1204
1294
 
1295
+ def build_usd_class_send_sig(self, message):
1296
+ messageTypes: dict = {
1297
+ 'HyperliquidTransaction:UsdClassTransfer': [
1298
+ {'name': 'hyperliquidChain', 'type': 'string'},
1299
+ {'name': 'amount', 'type': 'string'},
1300
+ {'name': 'toPerp', 'type': 'bool'},
1301
+ {'name': 'nonce', 'type': 'uint64'},
1302
+ ],
1303
+ }
1304
+ return self.sign_user_signed_action(messageTypes, message)
1305
+
1205
1306
  def build_withdraw_sig(self, message):
1206
1307
  messageTypes: dict = {
1207
1308
  'HyperliquidTransaction:Withdraw': [
@@ -2589,25 +2690,34 @@ class hyperliquid(Exchange, ImplicitAPI):
2589
2690
  # handle swap <> spot account transfer
2590
2691
  if not self.in_array(toAccount, ['spot', 'swap', 'perp']):
2591
2692
  raise NotSupported(self.id + 'transfer() only support spot <> swap transfer')
2693
+ strAmount = self.number_to_string(amount)
2592
2694
  vaultAddress = self.format_vault_address(self.safe_string(params, 'vaultAddress'))
2593
2695
  params = self.omit(params, 'vaultAddress')
2696
+ if vaultAddress is not None:
2697
+ strAmount = strAmount + ' subaccount:' + vaultAddress
2594
2698
  toPerp = (toAccount == 'perp') or (toAccount == 'swap')
2595
- action: dict = {
2596
- 'type': 'spotUser',
2597
- 'classTransfer': {
2598
- 'usdc': amount,
2699
+ transferPayload: dict = {
2700
+ 'hyperliquidChain': 'Testnet' if isSandboxMode else 'Mainnet',
2701
+ 'amount': strAmount,
2702
+ 'toPerp': toPerp,
2703
+ 'nonce': nonce,
2704
+ }
2705
+ transferSig = self.build_usd_class_send_sig(transferPayload)
2706
+ transferRequest: dict = {
2707
+ 'action': {
2708
+ 'hyperliquidChain': transferPayload['hyperliquidChain'],
2709
+ 'signatureChainId': '0x66eee',
2710
+ 'type': 'usdClassTransfer',
2711
+ 'amount': strAmount,
2599
2712
  'toPerp': toPerp,
2713
+ 'nonce': nonce,
2600
2714
  },
2601
- }
2602
- signature = self.sign_l1_action(action, nonce, vaultAddress)
2603
- innerRequest: dict = {
2604
- 'action': action,
2605
2715
  'nonce': nonce,
2606
- 'signature': signature,
2716
+ 'signature': transferSig,
2607
2717
  }
2608
2718
  if vaultAddress is not None:
2609
- innerRequest['vaultAddress'] = vaultAddress
2610
- transferResponse = self.privatePostExchange(innerRequest)
2719
+ transferRequest['vaultAddress'] = vaultAddress
2720
+ transferResponse = self.privatePostExchange(transferRequest)
2611
2721
  return transferResponse
2612
2722
  # handle sub-account/different account transfer
2613
2723
  self.check_address(toAccount)
@@ -2621,7 +2731,7 @@ class hyperliquid(Exchange, ImplicitAPI):
2621
2731
  'amount': self.number_to_string(amount),
2622
2732
  'time': nonce,
2623
2733
  }
2624
- sig = self.build_transfer_sig(payload)
2734
+ sig = self.build_usd_send_sig(payload)
2625
2735
  request: dict = {
2626
2736
  'action': {
2627
2737
  'hyperliquidChain': payload['hyperliquidChain'],
ccxt/paradex.py CHANGED
@@ -276,6 +276,7 @@ class paradex(Exchange, ImplicitAPI):
276
276
  'commonCurrencies': {
277
277
  },
278
278
  'options': {
279
+ 'paradexAccount': None, # add {"privateKey": A, "publicKey": B, "address": C}
279
280
  'broker': 'CCXT',
280
281
  },
281
282
  })
@@ -964,10 +965,10 @@ class paradex(Exchange, ImplicitAPI):
964
965
  }
965
966
 
966
967
  def retrieve_account(self):
967
- self.check_required_credentials()
968
968
  cachedAccount: dict = self.safe_dict(self.options, 'paradexAccount')
969
969
  if cachedAccount is not None:
970
970
  return cachedAccount
971
+ self.check_required_credentials()
971
972
  systemConfig = self.get_system_config()
972
973
  domain = self.prepare_paradex_domain(True)
973
974
  messageTypes = {
@@ -1956,7 +1957,6 @@ class paradex(Exchange, ImplicitAPI):
1956
1957
  if query:
1957
1958
  url += '?' + self.urlencode(query)
1958
1959
  elif api == 'private':
1959
- self.check_required_credentials()
1960
1960
  headers = {
1961
1961
  'Accept': 'application/json',
1962
1962
  'PARADEX-PARTNER': self.safe_string(self.options, 'broker', 'CCXT'),
ccxt/pro/__init__.py CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # ----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.4.36'
7
+ __version__ = '4.4.37'
8
8
 
9
9
  # ----------------------------------------------------------------------------
10
10
 
@@ -22,7 +22,7 @@ from ccxt.pro.binanceusdm import binanceusdm # noqa
22
22
  from ccxt.pro.bingx import bingx # noqa: F401
23
23
  from ccxt.pro.bitcoincom import bitcoincom # noqa: F401
24
24
  from ccxt.pro.bitfinex import bitfinex # noqa: F401
25
- from ccxt.pro.bitfinex2 import bitfinex2 # noqa: F401
25
+ from ccxt.pro.bitfinex1 import bitfinex1 # noqa: F401
26
26
  from ccxt.pro.bitget import bitget # noqa: F401
27
27
  from ccxt.pro.bithumb import bithumb # noqa: F401
28
28
  from ccxt.pro.bitmart import bitmart # noqa: F401
@@ -98,7 +98,7 @@ exchanges = [
98
98
  'bingx',
99
99
  'bitcoincom',
100
100
  'bitfinex',
101
- 'bitfinex2',
101
+ 'bitfinex1',
102
102
  'bitget',
103
103
  'bithumb',
104
104
  'bitmart',