def fetch_markets(self, params={}): response = self.publicGetMarkets(params) # # [ # { # market: 'DIL-ETH', # status: 'active', # baseAsset: 'DIL', # baseAssetPrecision: 8, # quoteAsset: 'ETH', # quoteAssetPrecision: 8 # }, ... # ] # response2 = self.publicGetExchange() # # { # "timeZone": "UTC", # "serverTime": 1590408000000, # "ethereumDepositContractAddress": "0x...", # "ethUsdPrice": "206.46", # "gasPrice": 7, # "volume24hUsd": "10416227.98", # "makerFeeRate": "0.001", # "takerFeeRate": "0.002", # "makerTradeMinimum": "0.15000000", # "takerTradeMinimum": "0.05000000", # "withdrawalMinimum": "0.04000000" # } # maker = self.safe_number(response2, 'makerFeeRate') taker = self.safe_number(response2, 'takerFeeRate') makerMin = self.safe_string(response2, 'makerTradeMinimum') takerMin = self.safe_string(response2, 'takerTradeMinimum') minCostETH = self.parse_number(Precise.string_min(makerMin, takerMin)) result = [] for i in range(0, len(response)): entry = response[i] marketId = self.safe_string(entry, 'market') baseId = self.safe_string(entry, 'baseAsset') quoteId = self.safe_string(entry, 'quoteAsset') base = self.safe_currency_code(baseId) quote = self.safe_currency_code(quoteId) basePrecisionString = self.safe_string(entry, 'baseAssetPrecision') quotePrecisionString = self.safe_string(entry, 'quoteAssetPrecision') basePrecision = self.parse_precision(basePrecisionString) quotePrecision = self.parse_precision(quotePrecisionString) status = self.safe_string(entry, 'status') minCost = None if quote == 'ETH': minCost = minCostETH result.append({ 'id': marketId, 'symbol': base + '/' + quote, 'base': base, 'quote': quote, 'settle': None, 'baseId': baseId, 'quoteId': quoteId, 'settleId': None, 'type': 'spot', 'spot': True, 'margin': False, 'swap': False, 'future': False, 'option': False, 'active': (status == 'active'), 'contract': False, 'linear': None, 'inverse': None, 'taker': taker, 'maker': maker, 'contractSize': None, 'expiry': None, 'expiryDatetime': None, 'strike': None, 'optionType': None, 'precision': { 'amount': int(basePrecisionString), 'price': int(quotePrecisionString), }, 'limits': { 'leverage': { 'min': None, 'max': None, }, 'amount': { 'min': self.parse_number(basePrecision), 'max': None, }, 'price': { 'min': self.parse_number(quotePrecision), 'max': None, }, 'cost': { 'min': minCost, 'max': None, }, }, 'info': entry, }) return result
assert Precise.string_neg('-0') == '0' assert Precise.string_neg('-500.1') == '500.1' assert Precise.string_neg('213') == '-213' assert Precise.string_mod('57.123', '10') == '7.123' assert Precise.string_mod('18', '6') == '0' assert Precise.string_mod('10.1', '0.5') == '0.1' assert Precise.string_mod('10000000', '5555') == '1000' assert Precise.string_mod('5550', '120') == '30' assert Precise.string_equals('1.0000', '1') assert Precise.string_equals('-0.0', '0') assert Precise.string_equals('-0.0', '0.0') assert Precise.string_equals('5.534000', '5.5340') assert Precise.string_min('1.0000', '2') == '1' assert Precise.string_min('2', '1.2345') == '1.2345' assert Precise.string_min('3.1415', '-2') == '-2' assert Precise.string_min('-3.1415', '-2') == '-3.1415' assert Precise.string_min('0.000', '-0.0') == '0' assert Precise.string_max('1.0000', '2') == '2' assert Precise.string_max('2', '1.2345') == '2' assert Precise.string_max('3.1415', '-2') == '3.1415' assert Precise.string_max('-3.1415', '-2') == '-2' assert Precise.string_max('0.000', '-0.0') == '0' assert not Precise.string_gt('1.0000', '2') assert Precise.string_gt('2', '1.2345') assert Precise.string_gt('3.1415', '-2') assert not Precise.string_gt('-3.1415', '-2')