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

Method fetch_position

python/ccxt/delta.py:1684–1711  ·  view source on GitHub ↗

fetch data on a single open contract trade position https://docs.delta.exchange/#get-position :param str symbol: unified market symbol of the market the position is held in, default is None :param dict [params]: extra parameters specific to the exchange API endpoin

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

Source from the content-addressed store, hash-verified

1682 return self.parse_balance(response)
1683
1684 def fetch_position(self, symbol: str, params={}):
1685 """
1686 fetch data on a single open contract trade position
1687
1688 https://docs.delta.exchange/#get-position
1689
1690 :param str symbol: unified market symbol of the market the position is held in, default is None
1691 :param dict [params]: extra parameters specific to the exchange API endpoint
1692 :returns dict: a `position structure <https://docs.ccxt.com/?id=position-structure>`
1693 """
1694 self.load_markets()
1695 market = self.market(symbol)
1696 request = {
1697 'product_id': market['numericId'],
1698 }
1699 response = self.privateGetPositions(self.extend(request, params))
1700 #
1701 # {
1702 # "result":{
1703 # "entry_price":null,
1704 # "size":0,
1705 # "timestamp":1605454074268079
1706 # },
1707 # "success":true
1708 # }
1709 #
1710 result = self.safe_dict(response, 'result', {})
1711 return self.parse_position(result, market)
1712
1713 def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
1714 """

Callers

nothing calls this directly

Calls 6

load_marketsMethod · 0.95
parse_positionMethod · 0.95
safe_dictMethod · 0.80
privateGetPositionsMethod · 0.65
marketMethod · 0.45
extendMethod · 0.45

Tested by

no test coverage detected