MCPcopy Create free account
hub / github.com/ccxt/ccxt / fetch_markets

Method fetch_markets

python/ccxt/async_support/gate.py:1310–1344  ·  view source on GitHub ↗

retrieves data on all markets for gate https://www.gate.com/docs/developers/apiv4/#query-all-supported-currency-pairs # spot https://www.gate.com/docs/developers/apiv4/en/#list-all-supported-currency-pairs-supported-in-margin-trading

(self, params={})

Source from the content-addressed store, hash-verified

1308 return super(gate, self).safe_market(marketId, market, delimiter, marketType)
1309
1310 async def fetch_markets(self, params={}) -> List[Market]:
1311 """
1312 retrieves data on all markets for gate
1313
1314 https://www.gate.com/docs/developers/apiv4/#query-all-supported-currency-pairs # spot
1315 https://www.gate.com/docs/developers/apiv4/en/#list-all-supported-currency-pairs-supported-in-margin-trading # margin
1316 https://www.gate.com/docs/developers/apiv4/en/#query-all-futures-contracts # swap
1317 https://www.gate.com/docs/developers/apiv4/en/#query-all-futures-contracts-2 # future
1318 https://www.gate.com/docs/developers/apiv4/en/#list-all-contracts-for-specified-underlying-and-expiration-date # option
1319
1320 :param dict [params]: extra parameters specific to the exchange API endpoint
1321 :returns dict[]: an array of objects representing market data
1322 """
1323 if self.options['adjustForTimeDifference']:
1324 await self.load_time_difference()
1325 if self.check_required_credentials(False):
1326 await self.load_unified_status()
1327 rawPromises = []
1328 fetchMarketsOptions = self.safe_dict(self.options, 'fetchMarkets')
1329 types = self.safe_list(fetchMarketsOptions, 'types', ['spot', 'swap', 'future', 'option'])
1330 for i in range(0, len(types)):
1331 marketType = types[i]
1332 if marketType == 'spot':
1333 # if not sandboxMode:
1334 # gate doesn't have a sandbox for spot markets
1335 rawPromises.append(self.fetch_spot_markets(params))
1336 # }
1337 elif marketType == 'swap':
1338 rawPromises.append(self.fetch_swap_markets(params))
1339 elif marketType == 'future':
1340 rawPromises.append(self.fetch_future_markets(params))
1341 elif marketType == 'option':
1342 rawPromises.append(self.fetch_option_markets(params))
1343 results = await asyncio.gather(*rawPromises)
1344 return self.arrays_concat(results)
1345
1346 async def fetch_spot_markets(self, params={}):
1347 marginPromise = self.publicMarginGetCurrencyPairs(params)

Callers

nothing calls this directly

Calls 12

load_unified_statusMethod · 0.95
fetch_spot_marketsMethod · 0.95
fetch_swap_marketsMethod · 0.95
fetch_future_marketsMethod · 0.95
fetch_option_marketsMethod · 0.95
safe_dictMethod · 0.80
safe_listMethod · 0.80
arrays_concatMethod · 0.80
rangeFunction · 0.50
load_time_differenceMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected