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

Method fetch_ticker

python/ccxt/derive.py:733–810  ·  view source on GitHub ↗

fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market https://docs.derive.xyz/reference/post_public-get-ticker :param str symbol: unified symbol of the market to fetch the ticker for :param di

(self, symbol: str, params={})

Source from the content-addressed store, hash-verified

731 })
732
733 def fetch_ticker(self, symbol: str, params={}) -> Ticker:
734 """
735 fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
736
737 https://docs.derive.xyz/reference/post_public-get-ticker
738
739 :param str symbol: unified symbol of the market to fetch the ticker for
740 :param dict [params]: extra parameters specific to the exchange API endpoint
741 :returns dict: a `ticker structure <https://docs.ccxt.com/?id=ticker-structure>`
742 """
743 self.load_markets()
744 market = self.market(symbol)
745 request = {
746 'instrument_name': market['id'],
747 }
748 response = self.publicPostGetTicker(self.extend(request, params))
749 #
750 # spot
751 #
752 # {
753 # "result": {
754 # "instrument_type": "perp",
755 # "instrument_name": "BTC-PERP",
756 # "scheduled_activation": 1701840228,
757 # "scheduled_deactivation": 9223372036854776000,
758 # "is_active": True,
759 # "tick_size": "0.1",
760 # "minimum_amount": "0.01",
761 # "maximum_amount": "10000",
762 # "amount_step": "0.001",
763 # "mark_price_fee_rate_cap": "0",
764 # "maker_fee_rate": "0.00005",
765 # "taker_fee_rate": "0.0003",
766 # "base_fee": "0.1",
767 # "base_currency": "BTC",
768 # "quote_currency": "USD",
769 # "option_details": null,
770 # "perp_details": {
771 # "index": "BTC-USD",
772 # "max_rate_per_hour": "0.004",
773 # "min_rate_per_hour": "-0.004",
774 # "static_interest_rate": "0.0000125",
775 # "aggregate_funding": "10512.580833189805742522",
776 # "funding_rate": "-0.000022223906766867"
777 # },
778 # "erc20_details": null,
779 # "base_asset_address": "0xDBa83C0C654DB1cd914FA2710bA743e925B53086",
780 # "base_asset_sub_id": "0",
781 # "pro_rata_fraction": "0",
782 # "fifo_min_allocation": "0",
783 # "pro_rata_amount_step": "0.1",
784 # "best_ask_amount": "0.012",
785 # "best_ask_price": "99567.9",
786 # "best_bid_amount": "0.129",
787 # "best_bid_price": "99554.5",
788 # "five_percent_bid_depth": "11.208",
789 # "five_percent_ask_depth": "11.42",
790 # "option_pricing": null,

Callers

nothing calls this directly

Calls 6

parse_tickerMethod · 0.95
safe_dictMethod · 0.80
publicPostGetTickerMethod · 0.65
load_marketsMethod · 0.45
marketMethod · 0.45
extendMethod · 0.45

Tested by

no test coverage detected