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

Method fetch_spot_markets

python/ccxt/bitmart.py:975–1072  ·  view source on GitHub ↗
(self, params={})

Source from the content-addressed store, hash-verified

973 }
974
975 def fetch_spot_markets(self, params={}) -> List[MarketInterface]:
976 response = self.publicGetSpotV1SymbolsDetails(params)
977 #
978 # {
979 # "message":"OK",
980 # "code":1000,
981 # "trace":"a67c9146-086d-4d3f-9897-5636a9bb26e1",
982 # "data":{
983 # "symbols":[
984 # {
985 # "symbol": "BTC_USDT",
986 # "symbol_id": 53,
987 # "base_currency": "BTC",
988 # "quote_currency": "USDT",
989 # "base_min_size": "0.000010000000000000000000000000",
990 # "base_max_size": "100000000.000000000000000000000000000000",
991 # "price_min_precision": -1,
992 # "price_max_precision": 2,
993 # "quote_increment": "0.00001", # Api docs says "The minimum order quantity is also the minimum order quantity increment", however I think they mistakenly use the term 'order quantity'
994 # "expiration": "NA",
995 # "min_buy_amount": "5.000000000000000000000000000000",
996 # "min_sell_amount": "5.000000000000000000000000000000",
997 # "trade_status": "trading"
998 # },
999 # ]
1000 # }
1001 # }
1002 #
1003 data = self.safe_dict(response, 'data', {})
1004 symbols = self.safe_list(data, 'symbols', [])
1005 result = []
1006 fees = self.fees['trading']
1007 for i in range(0, len(symbols)):
1008 market = symbols[i]
1009 id = self.safe_string(market, 'symbol')
1010 numericId = self.safe_integer(market, 'symbol_id')
1011 baseId = self.safe_string(market, 'base_currency')
1012 quoteId = self.safe_string(market, 'quote_currency')
1013 base = self.safe_currency_code(baseId)
1014 quote = self.safe_currency_code(quoteId)
1015 symbol = base + '/' + quote
1016 minBuyCost = self.safe_string(market, 'min_buy_amount')
1017 minSellCost = self.safe_string(market, 'min_sell_amount')
1018 minCost = Precise.string_max(minBuyCost, minSellCost)
1019 baseMinSize = self.safe_number(market, 'base_min_size')
1020 result.append(self.safe_market_structure({
1021 'id': id,
1022 'numericId': numericId,
1023 'symbol': symbol,
1024 'base': base,
1025 'quote': quote,
1026 'settle': None,
1027 'baseId': baseId,
1028 'quoteId': quoteId,
1029 'settleId': None,
1030 'type': 'spot',
1031 'spot': True,
1032 'margin': False,

Callers 1

fetch_marketsMethod · 0.95

Calls 14

safe_dictMethod · 0.80
safe_listMethod · 0.80
safe_stringMethod · 0.80
safe_integerMethod · 0.80
string_maxMethod · 0.80
safe_numberMethod · 0.80
safe_market_structureMethod · 0.80
safe_string_lower_2Method · 0.80
parse_numberMethod · 0.80
parse_precisionMethod · 0.80
rangeFunction · 0.50

Tested by

no test coverage detected