fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market https://doc.xt.com/#market10ticker24h https://doc.xt.com/#futures_quotesgetAggTicker :param str symbol: unified market symbol to fetch the
(self, symbol: str, params={})
| 1597 | return swapOb |
| 1598 | |
| 1599 | def fetch_ticker(self, symbol: str, params={}): |
| 1600 | """ |
| 1601 | fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market |
| 1602 | |
| 1603 | https://doc.xt.com/#market10ticker24h |
| 1604 | https://doc.xt.com/#futures_quotesgetAggTicker |
| 1605 | |
| 1606 | :param str symbol: unified market symbol to fetch the ticker for |
| 1607 | :param dict params: extra parameters specific to the xt api endpoint |
| 1608 | :returns dict: a `ticker structure <https://docs.ccxt.com/en/latest/manual.html#ticker-structure>` |
| 1609 | """ |
| 1610 | self.load_markets() |
| 1611 | market = self.market(symbol) |
| 1612 | request = { |
| 1613 | 'symbol': market['id'], |
| 1614 | } |
| 1615 | response = None |
| 1616 | if market['linear']: |
| 1617 | response = self.publicLinearGetFutureMarketV1PublicQAggTicker(self.extend(request, params)) |
| 1618 | elif market['inverse']: |
| 1619 | response = self.publicInverseGetFutureMarketV1PublicQAggTicker(self.extend(request, params)) |
| 1620 | else: |
| 1621 | response = self.publicSpotGetTicker24h(self.extend(request, params)) |
| 1622 | # |
| 1623 | # spot |
| 1624 | # |
| 1625 | # { |
| 1626 | # "rc": 0, |
| 1627 | # "mc": "SUCCESS", |
| 1628 | # "ma": [], |
| 1629 | # "result": [ |
| 1630 | # { |
| 1631 | # "s": "btc_usdt", |
| 1632 | # "t": 1678172693931, |
| 1633 | # "cv": "34.00", |
| 1634 | # "cr": "0.0015", |
| 1635 | # "o": "22398.05", |
| 1636 | # "l": "22323.72", |
| 1637 | # "h": "22600.50", |
| 1638 | # "c": "22432.05", |
| 1639 | # "q": "7962.256931", |
| 1640 | # "v": "178675209.47416856" |
| 1641 | # } |
| 1642 | # ] |
| 1643 | # } |
| 1644 | # |
| 1645 | # swap and future |
| 1646 | # |
| 1647 | # { |
| 1648 | # "returnCode": 0, |
| 1649 | # "msgInfo": "success", |
| 1650 | # "error": null, |
| 1651 | # "result": { |
| 1652 | # "t": 1678172848572, |
| 1653 | # "s": "btc_usdt", |
| 1654 | # "c": "22415.5", |
| 1655 | # "h": "22590.0", |
| 1656 | # "l": "22310.0", |
no test coverage detected