gate-io-api 0.0.82__py3-none-any.whl → 0.0.83__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.0'
29
+ __version__ = '4.5.1'
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.0'
11
+ __version__ = '4.5.1'
12
12
 
13
13
  # -----------------------------------------------------------------------------
14
14
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  # -----------------------------------------------------------------------------
4
4
 
5
- __version__ = '4.5.0'
5
+ __version__ = '4.5.1'
6
6
 
7
7
  # -----------------------------------------------------------------------------
8
8
 
@@ -765,6 +765,9 @@ class gate(Exchange, ImplicitAPI):
765
765
  'option': 'options',
766
766
  'options': 'options',
767
767
  },
768
+ 'fetchMarkets': {
769
+ 'types': ['spot', 'swap', 'future', 'option'],
770
+ },
768
771
  'swap': {
769
772
  'fetchMarkets': {
770
773
  'settlementCurrencies': ['usdt', 'btc'],
@@ -1234,21 +1237,24 @@ class gate(Exchange, ImplicitAPI):
1234
1237
  await self.load_time_difference()
1235
1238
  if self.check_required_credentials(False):
1236
1239
  await self.load_unified_status()
1240
+ rawPromises = []
1237
1241
  sandboxMode = self.safe_bool(self.options, 'sandboxMode', False)
1238
- rawPromises = [
1239
- self.fetch_contract_markets(params),
1240
- self.fetch_option_markets(params),
1241
- ]
1242
- if not sandboxMode:
1243
- # gate doesn't have a sandbox for spot markets
1244
- mainnetOnly = [self.fetch_spot_markets(params)]
1245
- rawPromises = self.array_concat(rawPromises, mainnetOnly)
1246
- promises = await asyncio.gather(*rawPromises)
1247
- spotMarkets = self.safe_value(promises, 0, [])
1248
- contractMarkets = self.safe_value(promises, 1, [])
1249
- optionMarkets = self.safe_value(promises, 2, [])
1250
- markets = self.array_concat(spotMarkets, contractMarkets)
1251
- return self.array_concat(markets, optionMarkets)
1242
+ fetchMarketsOptions = self.safe_dict(self.options, 'fetchMarkets')
1243
+ types = self.safe_list(fetchMarketsOptions, 'types', ['spot', 'swap', 'future', 'option'])
1244
+ for i in range(0, len(types)):
1245
+ marketType = types[i]
1246
+ if marketType == 'spot':
1247
+ if not sandboxMode:
1248
+ # gate doesn't have a sandbox for spot markets
1249
+ rawPromises.append(self.fetch_spot_markets(params))
1250
+ elif marketType == 'swap':
1251
+ rawPromises.append(self.fetch_swap_markets(params))
1252
+ elif marketType == 'future':
1253
+ rawPromises.append(self.fetch_future_markets(params))
1254
+ elif marketType == 'option':
1255
+ rawPromises.append(self.fetch_option_markets(params))
1256
+ results = await asyncio.gather(*rawPromises)
1257
+ return self.arrays_concat(results)
1252
1258
 
1253
1259
  async def fetch_spot_markets(self, params={}):
1254
1260
  marginPromise = self.publicMarginGetCurrencyPairs(params)
@@ -1363,10 +1369,9 @@ class gate(Exchange, ImplicitAPI):
1363
1369
  })
1364
1370
  return result
1365
1371
 
1366
- async def fetch_contract_markets(self, params={}):
1372
+ async def fetch_swap_markets(self, params={}):
1367
1373
  result = []
1368
1374
  swapSettlementCurrencies = self.get_settlement_currencies('swap', 'fetchMarkets')
1369
- futureSettlementCurrencies = self.get_settlement_currencies('future', 'fetchMarkets')
1370
1375
  for c in range(0, len(swapSettlementCurrencies)):
1371
1376
  settleId = swapSettlementCurrencies[c]
1372
1377
  request: dict = {
@@ -1376,6 +1381,11 @@ class gate(Exchange, ImplicitAPI):
1376
1381
  for i in range(0, len(response)):
1377
1382
  parsedMarket = self.parse_contract_market(response[i], settleId)
1378
1383
  result.append(parsedMarket)
1384
+ return result
1385
+
1386
+ async def fetch_future_markets(self, params={}):
1387
+ result = []
1388
+ futureSettlementCurrencies = self.get_settlement_currencies('future', 'fetchMarkets')
1379
1389
  for c in range(0, len(futureSettlementCurrencies)):
1380
1390
  settleId = futureSettlementCurrencies[c]
1381
1391
  request: dict = {
@@ -2543,7 +2553,11 @@ class gate(Exchange, ImplicitAPI):
2543
2553
  #
2544
2554
  request, query = self.prepare_request(market, market['type'], params)
2545
2555
  if limit is not None:
2546
- request['limit'] = limit # default 10, max 100
2556
+ if market['spot']:
2557
+ limit = min(limit, 1000)
2558
+ else:
2559
+ limit = min(limit, 300)
2560
+ request['limit'] = limit
2547
2561
  request['with_id'] = True
2548
2562
  response = None
2549
2563
  if market['spot'] or market['margin']:
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.5.0'
7
+ __version__ = '4.5.1'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -2337,6 +2337,12 @@ class Exchange(object):
2337
2337
  # return the first index of the cache that can be applied to the orderbook or -1 if not possible
2338
2338
  return -1
2339
2339
 
2340
+ def arrays_concat(self, arraysOfArrays: List[Any]):
2341
+ result = []
2342
+ for i in range(0, len(arraysOfArrays)):
2343
+ result = self.array_concat(result, arraysOfArrays[i])
2344
+ return result
2345
+
2340
2346
  def find_timeframe(self, timeframe, timeframes=None):
2341
2347
  if timeframes is None:
2342
2348
  timeframes = self.timeframes
gate/ccxt/gate.py CHANGED
@@ -764,6 +764,9 @@ class gate(Exchange, ImplicitAPI):
764
764
  'option': 'options',
765
765
  'options': 'options',
766
766
  },
767
+ 'fetchMarkets': {
768
+ 'types': ['spot', 'swap', 'future', 'option'],
769
+ },
767
770
  'swap': {
768
771
  'fetchMarkets': {
769
772
  'settlementCurrencies': ['usdt', 'btc'],
@@ -1233,21 +1236,24 @@ class gate(Exchange, ImplicitAPI):
1233
1236
  self.load_time_difference()
1234
1237
  if self.check_required_credentials(False):
1235
1238
  self.load_unified_status()
1239
+ rawPromises = []
1236
1240
  sandboxMode = self.safe_bool(self.options, 'sandboxMode', False)
1237
- rawPromises = [
1238
- self.fetch_contract_markets(params),
1239
- self.fetch_option_markets(params),
1240
- ]
1241
- if not sandboxMode:
1242
- # gate doesn't have a sandbox for spot markets
1243
- mainnetOnly = [self.fetch_spot_markets(params)]
1244
- rawPromises = self.array_concat(rawPromises, mainnetOnly)
1245
- promises = rawPromises
1246
- spotMarkets = self.safe_value(promises, 0, [])
1247
- contractMarkets = self.safe_value(promises, 1, [])
1248
- optionMarkets = self.safe_value(promises, 2, [])
1249
- markets = self.array_concat(spotMarkets, contractMarkets)
1250
- return self.array_concat(markets, optionMarkets)
1241
+ fetchMarketsOptions = self.safe_dict(self.options, 'fetchMarkets')
1242
+ types = self.safe_list(fetchMarketsOptions, 'types', ['spot', 'swap', 'future', 'option'])
1243
+ for i in range(0, len(types)):
1244
+ marketType = types[i]
1245
+ if marketType == 'spot':
1246
+ if not sandboxMode:
1247
+ # gate doesn't have a sandbox for spot markets
1248
+ rawPromises.append(self.fetch_spot_markets(params))
1249
+ elif marketType == 'swap':
1250
+ rawPromises.append(self.fetch_swap_markets(params))
1251
+ elif marketType == 'future':
1252
+ rawPromises.append(self.fetch_future_markets(params))
1253
+ elif marketType == 'option':
1254
+ rawPromises.append(self.fetch_option_markets(params))
1255
+ results = rawPromises
1256
+ return self.arrays_concat(results)
1251
1257
 
1252
1258
  def fetch_spot_markets(self, params={}):
1253
1259
  marginPromise = self.publicMarginGetCurrencyPairs(params)
@@ -1362,10 +1368,9 @@ class gate(Exchange, ImplicitAPI):
1362
1368
  })
1363
1369
  return result
1364
1370
 
1365
- def fetch_contract_markets(self, params={}):
1371
+ def fetch_swap_markets(self, params={}):
1366
1372
  result = []
1367
1373
  swapSettlementCurrencies = self.get_settlement_currencies('swap', 'fetchMarkets')
1368
- futureSettlementCurrencies = self.get_settlement_currencies('future', 'fetchMarkets')
1369
1374
  for c in range(0, len(swapSettlementCurrencies)):
1370
1375
  settleId = swapSettlementCurrencies[c]
1371
1376
  request: dict = {
@@ -1375,6 +1380,11 @@ class gate(Exchange, ImplicitAPI):
1375
1380
  for i in range(0, len(response)):
1376
1381
  parsedMarket = self.parse_contract_market(response[i], settleId)
1377
1382
  result.append(parsedMarket)
1383
+ return result
1384
+
1385
+ def fetch_future_markets(self, params={}):
1386
+ result = []
1387
+ futureSettlementCurrencies = self.get_settlement_currencies('future', 'fetchMarkets')
1378
1388
  for c in range(0, len(futureSettlementCurrencies)):
1379
1389
  settleId = futureSettlementCurrencies[c]
1380
1390
  request: dict = {
@@ -2542,7 +2552,11 @@ class gate(Exchange, ImplicitAPI):
2542
2552
  #
2543
2553
  request, query = self.prepare_request(market, market['type'], params)
2544
2554
  if limit is not None:
2545
- request['limit'] = limit # default 10, max 100
2555
+ if market['spot']:
2556
+ limit = min(limit, 1000)
2557
+ else:
2558
+ limit = min(limit, 300)
2559
+ request['limit'] = limit
2546
2560
  request['with_id'] = True
2547
2561
  response = None
2548
2562
  if market['spot'] or market['margin']:
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.0'
11
+ __version__ = '4.5.1'
12
12
 
13
13
  # ----------------------------------------------------------------------------
14
14
 
gate/ccxt/pro/gate.py CHANGED
@@ -368,6 +368,13 @@ class gate(gateAsync):
368
368
  async def watch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook:
369
369
  """
370
370
  watches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
371
+
372
+ https://www.gate.com/docs/developers/apiv4/ws/en/#order-book-channel
373
+ https://www.gate.com/docs/developers/apiv4/ws/en/#order-book-v2-api
374
+ https://www.gate.com/docs/developers/futures/ws/en/#order-book-api
375
+ https://www.gate.com/docs/developers/futures/ws/en/#order-book-v2-api
376
+ https://www.gate.com/docs/developers/delivery/ws/en/#order-book-api
377
+
371
378
  :param str symbol: unified symbol of the market to fetch the order book for
372
379
  :param int [limit]: the maximum amount of order book entries to return
373
380
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -384,7 +391,7 @@ class gate(gateAsync):
384
391
  url = self.get_url_by_market(market)
385
392
  payload = [marketId, interval]
386
393
  if limit is None:
387
- limit = 100
394
+ limit = 100 # max 100 atm
388
395
  if market['contract']:
389
396
  stringLimit = str(limit)
390
397
  payload.append(stringLimit)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gate-io-api
3
- Version: 0.0.82
3
+ Version: 0.0.83
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
@@ -135,7 +135,6 @@ You can also construct custom requests to available "implicit" endpoints
135
135
  - `fetch_balance(self, params={})`
136
136
  - `fetch_borrow_interest(self, code: Str = None, symbol: Str = None, since: Int = None, limit: Int = None, params={})`
137
137
  - `fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={})`
138
- - `fetch_contract_markets(self, params={})`
139
138
  - `fetch_currencies(self, params={})`
140
139
  - `fetch_deposit_address(self, code: str, params={})`
141
140
  - `fetch_deposit_addresses_by_network(self, code: str, params={})`
@@ -145,6 +144,7 @@ You can also construct custom requests to available "implicit" endpoints
145
144
  - `fetch_funding_rate_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={})`
146
145
  - `fetch_funding_rate(self, symbol: str, params={})`
147
146
  - `fetch_funding_rates(self, symbols: Strings = None, params={})`
147
+ - `fetch_future_markets(self, params={})`
148
148
  - `fetch_greeks(self, symbol: str, params={})`
149
149
  - `fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={})`
150
150
  - `fetch_leverage_tiers(self, symbols: Strings = None, params={})`
@@ -175,6 +175,7 @@ You can also construct custom requests to available "implicit" endpoints
175
175
  - `fetch_positions(self, symbols: Strings = None, params={})`
176
176
  - `fetch_settlement_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={})`
177
177
  - `fetch_spot_markets(self, params={})`
178
+ - `fetch_swap_markets(self, params={})`
178
179
  - `fetch_ticker(self, symbol: str, params={})`
179
180
  - `fetch_tickers(self, symbols: Strings = None, params={})`
180
181
  - `fetch_time(self, params={})`
@@ -1,11 +1,11 @@
1
1
  gate/__init__.py,sha256=rmRavmagjlyk7Z5zGWWJiY8tfYIPsk04hRzC4SYJOzA,222
2
- gate/ccxt/__init__.py,sha256=0LiBUl_gaGFBAU2rvHWktB_Oufw7id-BLa4T-ILs6tI,6126
3
- gate/ccxt/gate.py,sha256=FDdn8_V_d43wb4oy_dIFMQH0A0hrCGDK_KxDZ53uP7Y,352765
2
+ gate/ccxt/__init__.py,sha256=g528Eq7wZnoP7lgxxmlwBETsi8s0pv9YYW-FLhs33JE,6126
3
+ gate/ccxt/gate.py,sha256=AePkMpd4rKP4GoxClgM4qJ6fCrszgTzwrl_ZmJw6Yig,353292
4
4
  gate/ccxt/abstract/gate.py,sha256=MrRMycFEpZKJ6yC7qi0p_qcwZtU9WJi5bBbVllskGoA,45044
5
- gate/ccxt/async_support/__init__.py,sha256=mMBCyVInccXhu-jxuvOwpkTgWcCXru9ViK_q-85IhNk,4859
6
- gate/ccxt/async_support/gate.py,sha256=A0W3gaGbAqXBWKbbzRS4-N2491tMe6UuRam2kQ7mOh0,354724
5
+ gate/ccxt/async_support/__init__.py,sha256=phgbS_JCUEt69ioOLmEGr1VCK5kujnR08leavR0USWE,4859
6
+ gate/ccxt/async_support/gate.py,sha256=t5iTFzkJVS14V9Prgoqi6achMXMlKKLZ7TQwP2zphxw,355257
7
7
  gate/ccxt/async_support/base/__init__.py,sha256=aVYSsFi--b4InRs9zDN_wtCpj8odosAB726JdUHavrk,67
8
- gate/ccxt/async_support/base/exchange.py,sha256=YMd_vhLNV7Ay-PhgjeEmksr2-wUhQk6TSj_gsaJhLYg,121268
8
+ gate/ccxt/async_support/base/exchange.py,sha256=F8astaio1v_0MuDn3pjKByPR6NdwB1lSvDE71auAnA8,121268
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,11 +17,11 @@ 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=W1B4s4X8fIXF9lvAte_LmBb8FYHtFF0qATcJgBfXEYA,334124
20
+ gate/ccxt/base/exchange.py,sha256=uA5L1S85RqI7H9tDUkHTeqUBX_HzGD3tMl4Y7r4y_eU,334337
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=bVc3pl2kCNYFQrWfthJK-ZkYbOyMXa33kmHEg15kxAg,4173
24
- gate/ccxt/pro/gate.py,sha256=vbpPBXKBrPjtA-mQF-d6Rh0jfSqZBG17tMo42v4CWTM,89406
23
+ gate/ccxt/pro/__init__.py,sha256=SFdAX3dnRME2O6E7JpLpdaFMeiG5PctnDQZUsXbJ2is,4173
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
27
27
  gate/ccxt/static_dependencies/ecdsa/__init__.py,sha256=Xaj0G79BLtBt2YZcOOMV8qOlQZ7fIJznNiHhiEEZfQA,594
@@ -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.82.dist-info/METADATA,sha256=4IgCgVcWnAYTAA8nRZklielDgu_XCZgoi4IFbIwq-ds,26789
285
- gate_io_api-0.0.82.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
286
- gate_io_api-0.0.82.dist-info/RECORD,,
284
+ gate_io_api-0.0.83.dist-info/METADATA,sha256=eNxSJm9plPVWbLGaxPN2XakjkxtrwvMMBclqYXCIHQY,26827
285
+ gate_io_api-0.0.83.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
286
+ gate_io_api-0.0.83.dist-info/RECORD,,