(self, params={})
| 524 | return self.fetch_markets_from_api(params) |
| 525 | |
| 526 | def fetch_markets_from_web(self, params={}): |
| 527 | data = self.fetch_web_endpoint('fetchMarkets', 'webGetRestApi', False, '<h1 id="symbols-and-minimums">Symbols and minimums</h1>') |
| 528 | error = self.id + ' fetchMarketsFromWeb() the API doc HTML markup has changed, breaking the parser of order limits and precision info for markets.' |
| 529 | tables = data.split('tbody>') |
| 530 | numTables = len(tables) |
| 531 | if numTables < 2: |
| 532 | raise NotSupported(error) |
| 533 | rows = tables[1].split("\n<tr>\n") # eslint-disable-line quotes |
| 534 | numRows = len(rows) |
| 535 | if numRows < 2: |
| 536 | raise NotSupported(error) |
| 537 | result = [] |
| 538 | # skip the first element(empty string) |
| 539 | for i in range(1, numRows): |
| 540 | row = rows[i] |
| 541 | cells = row.split("</td>\n") # eslint-disable-line quotes |
| 542 | numCells = len(cells) |
| 543 | if numCells < 5: |
| 544 | raise NotSupported(error) |
| 545 | # [ |
| 546 | # '<td>btcusd', # currency |
| 547 | # '<td>0.00001 BTC(1e-5)', # min order size |
| 548 | # '<td>0.00000001 BTC(1e-8)', # tick size |
| 549 | # '<td>0.01 USD', # quote currency price increment |
| 550 | # '</tr>' |
| 551 | # ] |
| 552 | marketId = cells[0].replace('<td>', '') |
| 553 | marketId = marketId.replace('*', '') |
| 554 | # base = self.safe_currency_code(baseId) |
| 555 | minAmountString = cells[1].replace('<td>', '') |
| 556 | minAmountParts = minAmountString.split(' ') |
| 557 | minAmount = self.safe_number(minAmountParts, 0) |
| 558 | amountPrecisionString = cells[2].replace('<td>', '') |
| 559 | amountPrecisionParts = amountPrecisionString.split(' ') |
| 560 | idLength = len(marketId) - 0 |
| 561 | startingIndex = idLength - 3 |
| 562 | pricePrecisionString = cells[3].replace('<td>', '') |
| 563 | pricePrecisionParts = pricePrecisionString.split(' ') |
| 564 | quoteId = self.safe_string_lower(pricePrecisionParts, 1, marketId[startingIndex:idLength]) |
| 565 | baseId = self.safe_string_lower(amountPrecisionParts, 1, marketId.replace(quoteId, '')) |
| 566 | base = self.safe_currency_code(baseId) |
| 567 | quote = self.safe_currency_code(quoteId) |
| 568 | result.append({ |
| 569 | 'id': marketId, |
| 570 | 'symbol': base + '/' + quote, |
| 571 | 'base': base, |
| 572 | 'quote': quote, |
| 573 | 'settle': None, |
| 574 | 'baseId': baseId, |
| 575 | 'quoteId': quoteId, |
| 576 | 'settleId': None, |
| 577 | 'type': 'spot', |
| 578 | 'spot': True, |
| 579 | 'margin': False, |
| 580 | 'swap': False, |
| 581 | 'future': False, |
| 582 | 'option': False, |
| 583 | 'active': None, |
no test coverage detected