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

Method fetch_markets

python/ccxt/gate.py:1309–1343  ·  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

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