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

Method fetch_option

python/ccxt/gate.py:7774–7830  ·  view source on GitHub ↗

fetches option data that is commonly found in an option chain https://www.gate.com/docs/developers/apiv4/en/#query-specified-contract-details :param str symbol: unified market symbol :param dict [params]: extra parameters specific to the exchange API endpoint

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

Source from the content-addressed store, hash-verified

7772 }
7773
7774 def fetch_option(self, symbol: str, params={}) -> Option:
7775 """
7776 fetches option data that is commonly found in an option chain
7777
7778 https://www.gate.com/docs/developers/apiv4/en/#query-specified-contract-details
7779
7780 :param str symbol: unified market symbol
7781 :param dict [params]: extra parameters specific to the exchange API endpoint
7782 :returns dict: an `option chain structure <https://docs.ccxt.com/?id=option-chain-structure>`
7783 """
7784 self.load_markets()
7785 market = self.market(symbol)
7786 request = {
7787 'contract': market['id'],
7788 }
7789 response = self.publicOptionsGetContractsContract(self.extend(request, params))
7790 #
7791 # {
7792 # "is_active": True,
7793 # "mark_price_round": "0.01",
7794 # "settle_fee_rate": "0.00015",
7795 # "bid1_size": 30,
7796 # "taker_fee_rate": "0.0003",
7797 # "price_limit_fee_rate": "0.1",
7798 # "order_price_round": "0.1",
7799 # "tag": "month",
7800 # "ref_rebate_rate": "0",
7801 # "name": "ETH_USDT-20240628-4500-C",
7802 # "strike_price": "4500",
7803 # "ask1_price": "280.5",
7804 # "ref_discount_rate": "0",
7805 # "order_price_deviate": "0.2",
7806 # "ask1_size": -19,
7807 # "mark_price_down": "155.45",
7808 # "orderbook_id": 11724695,
7809 # "is_call": True,
7810 # "last_price": "188.7",
7811 # "mark_price": "274.26",
7812 # "underlying": "ETH_USDT",
7813 # "create_time": 1688024882,
7814 # "settle_limit_fee_rate": "0.1",
7815 # "orders_limit": 10,
7816 # "mark_price_up": "403.83",
7817 # "position_size": 80,
7818 # "order_size_max": 10000,
7819 # "position_limit": 100000,
7820 # "multiplier": "0.01",
7821 # "order_size_min": 1,
7822 # "trade_size": 229,
7823 # "underlying_price": "3326.6",
7824 # "maker_fee_rate": "0.0003",
7825 # "expiration_time": 1719561600,
7826 # "trade_id": 15,
7827 # "bid1_price": "269.3"
7828 # }
7829 #
7830 return self.parse_option(response, None, market)
7831

Callers

nothing calls this directly

Calls 5

parse_optionMethod · 0.95
load_marketsMethod · 0.45
marketMethod · 0.45
extendMethod · 0.45

Tested by

no test coverage detected