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

Method fetch_position

python/ccxt/binance.py:10343–10384  ·  view source on GitHub ↗

fetch data on an open position https://developers.binance.com/docs/derivatives/option/trade/Option-Position-Information :param str symbol: unified market symbol of the market the position is held in :param dict [params]: extra parameters specific to the exchange AP

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

Source from the content-addressed store, hash-verified

10341 return tiers
10342
10343 def fetch_position(self, symbol: str, params={}):
10344 """
10345 fetch data on an open position
10346
10347 https://developers.binance.com/docs/derivatives/option/trade/Option-Position-Information
10348
10349 :param str symbol: unified market symbol of the market the position is held in
10350 :param dict [params]: extra parameters specific to the exchange API endpoint
10351 :returns dict: a `position structure <https://docs.ccxt.com/?id=position-structure>`
10352 """
10353 self.load_markets()
10354 market = self.market(symbol)
10355 if not market['option']:
10356 raise NotSupported(self.id + ' fetchPosition() supports option markets only')
10357 request = {
10358 'symbol': market['id'],
10359 }
10360 response = self.eapiPrivateGetPosition(self.extend(request, params))
10361 #
10362 # [
10363 # {
10364 # "entryPrice": "27.70000000",
10365 # "symbol": "ETH-230426-1850-C",
10366 # "side": "LONG",
10367 # "quantity": "0.50000000",
10368 # "reducibleQty": "0.50000000",
10369 # "markValue": "10.250000000",
10370 # "ror": "-0.2599",
10371 # "unrealizedPNL": "-3.600000000",
10372 # "markPrice": "20.5",
10373 # "strikePrice": "1850.00000000",
10374 # "positionCost": "13.85000000",
10375 # "expiryDate": 1682496000000,
10376 # "priceScale": 1,
10377 # "quantityScale": 2,
10378 # "optionSide": "CALL",
10379 # "quoteAsset": "USDT",
10380 # "time": 1682492427106
10381 # }
10382 # ]
10383 #
10384 return self.parse_option_position(response[0], market)
10385
10386 def fetch_option_positions(self, symbols: Strings = None, params={}):
10387 """

Callers

nothing calls this directly

Calls 6

marketMethod · 0.95
parse_option_positionMethod · 0.95
NotSupportedClass · 0.90
load_marketsMethod · 0.45
extendMethod · 0.45

Tested by

no test coverage detected