fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market https://developer-pro.bitmart.com/en/spot/#get-ticker-of-a-trading-pair-v3 https://developer-pro.bitmart.com/en/futuresv2/#get-contract-details
(self, symbol: str, params={})
| 1576 | }, market) |
| 1577 | |
| 1578 | def fetch_ticker(self, symbol: str, params={}) -> Ticker: |
| 1579 | """ |
| 1580 | fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market |
| 1581 | |
| 1582 | https://developer-pro.bitmart.com/en/spot/#get-ticker-of-a-trading-pair-v3 |
| 1583 | https://developer-pro.bitmart.com/en/futuresv2/#get-contract-details |
| 1584 | |
| 1585 | :param str symbol: unified symbol of the market to fetch the ticker for |
| 1586 | :param dict [params]: extra parameters specific to the exchange API endpoint |
| 1587 | :returns dict: a `ticker structure <https://docs.ccxt.com/?id=ticker-structure>` |
| 1588 | """ |
| 1589 | self.load_markets() |
| 1590 | market = self.market(symbol) |
| 1591 | request = {} |
| 1592 | response = None |
| 1593 | if market['swap']: |
| 1594 | request['symbol'] = market['id'] |
| 1595 | response = self.publicGetContractPublicDetails(self.extend(request, params)) |
| 1596 | # |
| 1597 | # { |
| 1598 | # "code": 1000, |
| 1599 | # "message": "Ok", |
| 1600 | # "data": { |
| 1601 | # "symbols": [ |
| 1602 | # { |
| 1603 | # "symbol": "BTCUSDT", |
| 1604 | # "product_type": 1, |
| 1605 | # "open_timestamp": 1645977600000, |
| 1606 | # "expire_timestamp": 0, |
| 1607 | # "settle_timestamp": 0, |
| 1608 | # "base_currency": "BTC", |
| 1609 | # "quote_currency": "USDT", |
| 1610 | # "last_price": "63547.4", |
| 1611 | # "volume_24h": "110938430", |
| 1612 | # "turnover_24h": "7004836342.6944", |
| 1613 | # "index_price": "63587.85404255", |
| 1614 | # "index_name": "BTCUSDT", |
| 1615 | # "contract_size": "0.001", |
| 1616 | # "min_leverage": "1", |
| 1617 | # "max_leverage": "100", |
| 1618 | # "price_precision": "0.1", |
| 1619 | # "vol_precision": "1", |
| 1620 | # "max_volume": "1000000", |
| 1621 | # "min_volume": "1", |
| 1622 | # "funding_rate": "0.0000801", |
| 1623 | # "expected_funding_rate": "-0.0000035", |
| 1624 | # "open_interest": "278214", |
| 1625 | # "open_interest_value": "17555316.9355496", |
| 1626 | # "high_24h": "64109.4", |
| 1627 | # "low_24h": "61857.6", |
| 1628 | # "change_24h": "0.0239264900886327", |
| 1629 | # "funding_time": 1726819200000 |
| 1630 | # }, |
| 1631 | # ] |
| 1632 | # } |
| 1633 | # } |
| 1634 | # |
| 1635 | elif market['spot']: |
nothing calls this directly
no test coverage detected