gate-io-api 0.0.85__py3-none-any.whl → 0.0.86__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.

Potentially problematic release.


This version of gate-io-api might be problematic. Click here for more details.

gate/ccxt/__init__.py CHANGED
@@ -26,7 +26,7 @@ sys.modules['ccxt'] = ccxt_module
26
26
 
27
27
  # ----------------------------------------------------------------------------
28
28
 
29
- __version__ = '4.5.3'
29
+ __version__ = '4.5.4'
30
30
 
31
31
  # ----------------------------------------------------------------------------
32
32
 
@@ -8,7 +8,7 @@ sys.modules['ccxt'] = ccxt_module
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
11
- __version__ = '4.5.3'
11
+ __version__ = '4.5.4'
12
12
 
13
13
  # -----------------------------------------------------------------------------
14
14
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  # -----------------------------------------------------------------------------
4
4
 
5
- __version__ = '4.5.3'
5
+ __version__ = '4.5.4'
6
6
 
7
7
  # -----------------------------------------------------------------------------
8
8
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.5.3'
7
+ __version__ = '4.5.4'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -1309,6 +1309,10 @@ class Exchange(object):
1309
1309
  elif algoType == 'ES':
1310
1310
  rawSignature = Exchange.ecdsa(token, secret, 'p256', algorithm)
1311
1311
  signature = Exchange.base16_to_binary(rawSignature['r'].rjust(64, "0") + rawSignature['s'].rjust(64, "0"))
1312
+ elif algoType == 'Ed':
1313
+ signature = Exchange.eddsa(token.encode('utf-8'), secret, 'ed25519', True)
1314
+ # here the signature is already a urlencoded base64-encoded string
1315
+ return token + '.' + signature
1312
1316
  else:
1313
1317
  signature = Exchange.hmac(Exchange.encode(token), secret, algos[algorithm], 'binary')
1314
1318
  return token + '.' + Exchange.urlencode_base64(signature)
@@ -1442,12 +1446,22 @@ class Exchange(object):
1442
1446
  'v': v,
1443
1447
  }
1444
1448
 
1449
+
1450
+ @staticmethod
1451
+ def binary_to_urlencoded_base64(data: bytes) -> str:
1452
+ encoded = base64.urlsafe_b64encode(data).decode("utf-8")
1453
+ return encoded.rstrip("=")
1454
+
1445
1455
  @staticmethod
1446
- def eddsa(request, secret, curve='ed25519'):
1456
+ def eddsa(request, secret, curve='ed25519', url_encode=False):
1447
1457
  if isinstance(secret, str):
1448
1458
  secret = Exchange.encode(secret)
1449
1459
  private_key = ed25519.Ed25519PrivateKey.from_private_bytes(secret) if len(secret) == 32 else load_pem_private_key(secret, None)
1450
- return Exchange.binary_to_base64(private_key.sign(request))
1460
+ signature = private_key.sign(request)
1461
+ if url_encode:
1462
+ return Exchange.binary_to_urlencoded_base64(signature)
1463
+
1464
+ return Exchange.binary_to_base64(signature)
1451
1465
 
1452
1466
  @staticmethod
1453
1467
  def axolotl(request, secret, curve='ed25519'):
@@ -2865,9 +2879,9 @@ class Exchange(object):
2865
2879
  def parse_to_numeric(self, number):
2866
2880
  stringVersion = self.number_to_string(number) # self will convert 1.0 and 1 to "1" and 1.1 to "1.1"
2867
2881
  # keep self in mind:
2868
- # in JS: 1 == 1.0 is True; 1 == 1.0 is True
2882
+ # in JS: 1 == 1.0 is True
2869
2883
  # in Python: 1 == 1.0 is True
2870
- # in PHP 1 == 1.0 is True, but 1 == 1.0 is False.
2884
+ # in PHP: 1 == 1.0 is True, but 1 == 1.0 is False.
2871
2885
  if stringVersion.find('.') >= 0:
2872
2886
  return float(stringVersion)
2873
2887
  return int(stringVersion)
@@ -3313,6 +3327,24 @@ class Exchange(object):
3313
3327
  self.codes = list(currenciesSortedByCode.keys())
3314
3328
  return self.markets
3315
3329
 
3330
+ def set_markets_from_exchange(self, sourceExchange):
3331
+ # Validate that both exchanges are of the same type
3332
+ if self.id != sourceExchange.id:
3333
+ raise ArgumentsRequired(self.id + ' shareMarkets() can only share markets with exchanges of the same type(got ' + sourceExchange['id'] + ')')
3334
+ # Validate that source exchange has loaded markets
3335
+ if not sourceExchange.markets:
3336
+ raise ExchangeError('setMarketsFromExchange() source exchange must have loaded markets first. Can call by using loadMarkets function')
3337
+ # Set all market-related data
3338
+ self.markets = sourceExchange.markets
3339
+ self.markets_by_id = sourceExchange.markets_by_id
3340
+ self.symbols = sourceExchange.symbols
3341
+ self.ids = sourceExchange.ids
3342
+ self.currencies = sourceExchange.currencies
3343
+ self.baseCurrencies = sourceExchange.baseCurrencies
3344
+ self.quoteCurrencies = sourceExchange.quoteCurrencies
3345
+ self.codes = sourceExchange.codes
3346
+ return self
3347
+
3316
3348
  def get_describe_for_extended_ws_exchange(self, currentRestInstance: Any, parentRestInstance: Any, wsBaseDescribe: dict):
3317
3349
  extendedRestDescribe = self.deep_extend(parentRestInstance.describe(), currentRestInstance.describe())
3318
3350
  superWithRestDescribe = self.deep_extend(extendedRestDescribe, wsBaseDescribe)
@@ -4375,16 +4407,27 @@ class Exchange(object):
4375
4407
  result.append(account)
4376
4408
  return result
4377
4409
 
4378
- def parse_trades(self, trades: List[Any], market: Market = None, since: Int = None, limit: Int = None, params={}):
4410
+ def parse_trades_helper(self, isWs: bool, trades: List[Any], market: Market = None, since: Int = None, limit: Int = None, params={}):
4379
4411
  trades = self.to_array(trades)
4380
4412
  result = []
4381
4413
  for i in range(0, len(trades)):
4382
- trade = self.extend(self.parse_trade(trades[i], market), params)
4414
+ parsed = None
4415
+ if isWs:
4416
+ parsed = self.parse_ws_trade(trades[i], market)
4417
+ else:
4418
+ parsed = self.parse_trade(trades[i], market)
4419
+ trade = self.extend(parsed, params)
4383
4420
  result.append(trade)
4384
4421
  result = self.sort_by_2(result, 'timestamp', 'id')
4385
4422
  symbol = market['symbol'] if (market is not None) else None
4386
4423
  return self.filter_by_symbol_since_limit(result, symbol, since, limit)
4387
4424
 
4425
+ def parse_trades(self, trades: List[Any], market: Market = None, since: Int = None, limit: Int = None, params={}):
4426
+ return self.parse_trades_helper(False, trades, market, since, limit, params)
4427
+
4428
+ def parse_ws_trades(self, trades: List[Any], market: Market = None, since: Int = None, limit: Int = None, params={}):
4429
+ return self.parse_trades_helper(True, trades, market, since, limit, params)
4430
+
4388
4431
  def parse_transactions(self, transactions: List[Any], currency: Currency = None, since: Int = None, limit: Int = None, params={}):
4389
4432
  transactions = self.to_array(transactions)
4390
4433
  result = []
@@ -6056,6 +6099,29 @@ class Exchange(object):
6056
6099
  symbol = None if (market is None) else market['symbol']
6057
6100
  return self.filter_by_symbol_since_limit(sorted, symbol, since, limit)
6058
6101
 
6102
+ def handle_trigger_prices_and_params(self, symbol, params, omitParams=True):
6103
+ #
6104
+ triggerPrice = self.safe_string_2(params, 'triggerPrice', 'stopPrice')
6105
+ triggerPriceStr: Str = None
6106
+ stopLossPrice = self.safe_string(params, 'stopLossPrice')
6107
+ stopLossPriceStr: Str = None
6108
+ takeProfitPrice = self.safe_string(params, 'takeProfitPrice')
6109
+ takeProfitPriceStr: Str = None
6110
+ #
6111
+ if triggerPrice is not None:
6112
+ if omitParams:
6113
+ params = self.omit(params, ['triggerPrice', 'stopPrice'])
6114
+ triggerPriceStr = self.price_to_precision(symbol, float(triggerPrice))
6115
+ if stopLossPrice is not None:
6116
+ if omitParams:
6117
+ params = self.omit(params, 'stopLossPrice')
6118
+ stopLossPriceStr = self.price_to_precision(symbol, float(stopLossPrice))
6119
+ if takeProfitPrice is not None:
6120
+ if omitParams:
6121
+ params = self.omit(params, 'takeProfitPrice')
6122
+ takeProfitPriceStr = self.price_to_precision(symbol, float(takeProfitPrice))
6123
+ return [triggerPriceStr, stopLossPriceStr, takeProfitPriceStr, params]
6124
+
6059
6125
  def handle_trigger_direction_and_params(self, params, exchangeSpecificKey: Str = None, allowEmpty: Bool = False):
6060
6126
  """
6061
6127
  @ignore
@@ -7044,7 +7110,7 @@ class Exchange(object):
7044
7110
  clients = list(self.clients.values())
7045
7111
  for i in range(0, len(clients)):
7046
7112
  client = clients[i]
7047
- futures = self.safe_dict(client, 'futures')
7113
+ futures = client.futures
7048
7114
  if (futures is not None) and ('fetchPositionsSnapshot' in futures):
7049
7115
  del futures['fetchPositionsSnapshot']
7050
7116
  elif topic == 'ticker' and (self.tickers is not None):
gate/ccxt/pro/__init__.py CHANGED
@@ -8,7 +8,7 @@ sys.modules['ccxt'] = ccxt_module
8
8
 
9
9
  # ----------------------------------------------------------------------------
10
10
 
11
- __version__ = '4.5.3'
11
+ __version__ = '4.5.4'
12
12
 
13
13
  # ----------------------------------------------------------------------------
14
14
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gate-io-api
3
- Version: 0.0.85
3
+ Version: 0.0.86
4
4
  Summary: gate crypto exchange api client
5
5
  Project-URL: Homepage, https://github.com/ccxt/ccxt
6
6
  Project-URL: Issues, https://github.com/ccxt/ccxt
@@ -1,11 +1,11 @@
1
1
  gate/__init__.py,sha256=rmRavmagjlyk7Z5zGWWJiY8tfYIPsk04hRzC4SYJOzA,222
2
- gate/ccxt/__init__.py,sha256=gJRMBYzasd3QEyOAe03x4k7JVaHB3dGKH7EjLw00Dbs,6126
2
+ gate/ccxt/__init__.py,sha256=i3CZmpHc7MyEMUCc7MAmDc_pBJlNJCUi_x1fBJTW-PM,6126
3
3
  gate/ccxt/gate.py,sha256=zCZJMYkxUE3qsy2q8Mo--ketScdWr7cmMji8hLduaj8,354225
4
4
  gate/ccxt/abstract/gate.py,sha256=MrRMycFEpZKJ6yC7qi0p_qcwZtU9WJi5bBbVllskGoA,45044
5
- gate/ccxt/async_support/__init__.py,sha256=tGsh7e2531DDry-3hJMPl3FE2egDTEciipi2uGXjTJQ,4859
5
+ gate/ccxt/async_support/__init__.py,sha256=PwMxJHb_0srPtajXR1qR2ykJurEZYeycFSV07Cot1Eg,4859
6
6
  gate/ccxt/async_support/gate.py,sha256=JkMRmZsHy5HesfqJUjJBqWlAydRsuJxJBLoPv2uwUPQ,356190
7
7
  gate/ccxt/async_support/base/__init__.py,sha256=aVYSsFi--b4InRs9zDN_wtCpj8odosAB726JdUHavrk,67
8
- gate/ccxt/async_support/base/exchange.py,sha256=nMqvBDsBpGe7mSUA1j8xK4_CvHvGtrlkeFfjdcnUfPQ,121450
8
+ gate/ccxt/async_support/base/exchange.py,sha256=yg4s0ITgw7YAAbfTHxBzRQo2cZtJj7BCvaUgMiUuvnw,121450
9
9
  gate/ccxt/async_support/base/throttler.py,sha256=tvDVcdRUVYi8fZRlEcnqtgzcgB_KMUMRs5Pu8tuU-tU,1847
10
10
  gate/ccxt/async_support/base/ws/__init__.py,sha256=uockzpLuwntKGZbs5EOWFe-Zg-k6Cj7GhNJLc_RX0so,1791
11
11
  gate/ccxt/async_support/base/ws/cache.py,sha256=xf2VOtfUwloxSlIQ39M1RGZHWQzyS9IGhB5NX6cDcAc,8370
@@ -17,10 +17,10 @@ gate/ccxt/async_support/base/ws/order_book_side.py,sha256=GhnGUt78pJ-AYL_Dq9prod
17
17
  gate/ccxt/base/__init__.py,sha256=eTx1OE3HJjspFUQjGm6LBhaQiMKJnXjkdP-JUXknyQ0,1320
18
18
  gate/ccxt/base/decimal_to_precision.py,sha256=3XI30u9YudHbTA438397u5rkdlXa3atxwZEfUus3C4k,6803
19
19
  gate/ccxt/base/errors.py,sha256=OGhWNvNtRlJOzFx-n1x3ZjTnaPpfWH0Vc0xACS-MeDw,5012
20
- gate/ccxt/base/exchange.py,sha256=K-wfT2MGTJMLuqR7ytj7xYunUdJOm3Ve3XRikY_3UKk,334643
20
+ gate/ccxt/base/exchange.py,sha256=-Kn1sp6UDgjrpACqsX-mYpp-e3amK3UoMFSCai7exkM,337938
21
21
  gate/ccxt/base/precise.py,sha256=koce64Yrp6vFbGijJtUt-QQ6XhJgeGTCksZ871FPp_A,8886
22
22
  gate/ccxt/base/types.py,sha256=Gvbogh9i7pPH7Z18xesYeDPribqqwq8uKpOv-YODFBs,11505
23
- gate/ccxt/pro/__init__.py,sha256=-p7sUE9qxc3UEvzYoLOfE8_xXIJS-1I946rACvZgV8A,4173
23
+ gate/ccxt/pro/__init__.py,sha256=zBEzY7j6U6HBke9SVEgGNrQOoSRkmkL0839vvneyUbI,4173
24
24
  gate/ccxt/pro/gate.py,sha256=Pl64TJO43NcLrqDGs2oU16bPfFqIjOHllJTkpGMuErI,89805
25
25
  gate/ccxt/static_dependencies/README.md,sha256=3TCvhhn09_Cqf9BDDpao1V7EfKHDpQ6k9oWRsLFixpU,18
26
26
  gate/ccxt/static_dependencies/__init__.py,sha256=tzFje8cloqmiIE6kola3EaYC0SnD1izWnri69hzHsSw,168
@@ -281,6 +281,6 @@ gate/ccxt/static_dependencies/toolz/curried/exceptions.py,sha256=gKFOHDIayAWnX2u
281
281
  gate/ccxt/static_dependencies/toolz/curried/operator.py,sha256=ML92mknkAwzBl2NCm-4werSUmJEtSHNY9NSzhseNM9s,525
282
282
  gate/ccxt/static_dependencies/typing_inspect/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
283
283
  gate/ccxt/static_dependencies/typing_inspect/typing_inspect.py,sha256=5gIWomLPfuDpgd3gX1GlnX0MuXM3VorR4j2W2qXORiQ,28269
284
- gate_io_api-0.0.85.dist-info/METADATA,sha256=FMuYJIrqaqmB6xhgRA59d-OdtJgAS7VTEVoUESkY6aU,26827
285
- gate_io_api-0.0.85.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
286
- gate_io_api-0.0.85.dist-info/RECORD,,
284
+ gate_io_api-0.0.86.dist-info/METADATA,sha256=wmI2e9jhHn2-9ytaUHrGSxQWbjMR5QWbMjcOWa-WjRM,26827
285
+ gate_io_api-0.0.86.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
286
+ gate_io_api-0.0.86.dist-info/RECORD,,