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

Method fetch_positions

python/ccxt/delta.py:1713–1747  ·  view source on GitHub ↗

fetch all open positions https://docs.delta.exchange/#get-margined-positions :param str[]|None symbols: list of unified market symbols :param dict [params]: extra parameters specific to the exchange API endpoint :returns dict[]: a list of `position structur

(self, symbols: Strings = None, params={})

Source from the content-addressed store, hash-verified

1711 return self.parse_position(result, market)
1712
1713 def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
1714 """
1715 fetch all open positions
1716
1717 https://docs.delta.exchange/#get-margined-positions
1718
1719 :param str[]|None symbols: list of unified market symbols
1720 :param dict [params]: extra parameters specific to the exchange API endpoint
1721 :returns dict[]: a list of `position structure <https://docs.ccxt.com/?id=position-structure>`
1722 """
1723 self.load_markets()
1724 response = self.privateGetPositionsMargined(params)
1725 #
1726 # {
1727 # "success": True,
1728 # "result": [
1729 # {
1730 # "user_id": 0,
1731 # "size": 0,
1732 # "entry_price": "string",
1733 # "margin": "string",
1734 # "liquidation_price": "string",
1735 # "bankruptcy_price": "string",
1736 # "adl_level": 0,
1737 # "product_id": 0,
1738 # "product_symbol": "string",
1739 # "commission": "string",
1740 # "realized_pnl": "string",
1741 # "realized_funding": "string"
1742 # }
1743 # ]
1744 # }
1745 #
1746 result = self.safe_list(response, 'result', [])
1747 return self.parse_positions(result, symbols)
1748
1749 def parse_position(self, position: dict, market: Market = None):
1750 #

Callers

nothing calls this directly

Calls 4

load_marketsMethod · 0.95
safe_listMethod · 0.80
parse_positionsMethod · 0.45

Tested by

no test coverage detected