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

Method parse_position

python/ccxt/bydfi.py:1962–2061  ·  view source on GitHub ↗
(self, position: dict, market: Market = None)

Source from the content-addressed store, hash-verified

1960 return self.parse_positions(data, [market['symbol']])
1961
1962 def parse_position(self, position: dict, market: Market = None):
1963 #
1964 # fetchPositions, fetchPositionsForSymbol
1965 # {
1966 # "symbol": "ETH-USDC",
1967 # "side": "BUY",
1968 # "volume": "0.001",
1969 # "avgPrice": "3032.45",
1970 # "liqPrice": "0",
1971 # "markPrice": "3032.37",
1972 # "unPnl": "-0.00008",
1973 # "positionMargin": "0",
1974 # "settleCoin": "USDC",
1975 # "im": "3.03245",
1976 # "mm": "0.007581125"
1977 # }
1978 #
1979 # fetchPositionsHistory
1980 # {
1981 # "id": "16788366",
1982 # "wallet": "W001",
1983 # "currency": "USDC",
1984 # "symbol": "ETH-USDC",
1985 # "side": "BUY",
1986 # "positionSide": "BOTH",
1987 # "leverage": 1,
1988 # "avgOpenPositionPrice": "3032.45",
1989 # "openPositionVolume": "1",
1990 # "openCount": 1,
1991 # "highPrice": "3032.45",
1992 # "lowPrice": "2953.67",
1993 # "avgClosePositionPrice": "2953.67",
1994 # "closePositionVolume": "1",
1995 # "closePositionCost": "2.95367",
1996 # "closeCount": 1,
1997 # "positionProfits": "-0.07878",
1998 # "lossBonus": "0",
1999 # "capitalFeeTotal": "-0.00026361",
2000 # "capitalFeeOutCash": "-0.00026361",
2001 # "capitalFeeInCash": "0",
2002 # "capitalFeeBonus": "0",
2003 # "openFeeTotal": "-0.00181947",
2004 # "openFeeBonus": "0",
2005 # "closeFeeTotal": "-0.00177221",
2006 # "closeFeeBonus": "0",
2007 # "liqLoss": "0",
2008 # "liqClosed": False,
2009 # "sequence": "53685341336",
2010 # "updateTime": "1766494929423",
2011 # "createTime": "1766423985842"
2012 # }
2013 #
2014 marketId = self.safe_string(position, 'symbol')
2015 market = self.safe_market(marketId, market)
2016 buyOrSell = self.safe_string(position, 'side')
2017 rawPositionSide = self.safe_string_lower(position, 'positionSide')
2018 positionSide = self.parse_position_side(buyOrSell)
2019 hedged = None

Callers

nothing calls this directly

Calls 10

parse_position_sideMethod · 0.95
safe_stringMethod · 0.80
safe_string_lowerMethod · 0.80
safe_string_2Method · 0.80
string_divMethod · 0.80
safe_integerMethod · 0.80
safe_positionMethod · 0.80
parse_numberMethod · 0.80
safe_marketMethod · 0.45
iso8601Method · 0.45

Tested by

no test coverage detected