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

Method fetch_position

python/ccxt/bitget.py:7470–7572  ·  view source on GitHub ↗

fetch data on a single open contract trade position https://www.bitget.com/api-doc/contract/position/get-single-position https://www.bitget.com/api-doc/uta/trade/Get-Position :param str symbol: unified market symbol of the market the position is held in :pa

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

Source from the content-addressed store, hash-verified

7468 return self.parse_trades(data, market, since, limit)
7469
7470 def fetch_position(self, symbol: str, params={}):
7471 """
7472 fetch data on a single open contract trade position
7473
7474 https://www.bitget.com/api-doc/contract/position/get-single-position
7475 https://www.bitget.com/api-doc/uta/trade/Get-Position
7476
7477 :param str symbol: unified market symbol of the market the position is held in
7478 :param dict [params]: extra parameters specific to the exchange API endpoint
7479 :param boolean [params.uta]: set to True for the unified trading account(uta), defaults to False
7480 :returns dict: a `position structure <https://docs.ccxt.com/?id=position-structure>`
7481 """
7482 self.load_markets()
7483 market = self.market(symbol)
7484 productType = None
7485 productType, params = self.handle_product_type_and_params(market, params)
7486 request = {
7487 'symbol': market['id'],
7488 }
7489 response = None
7490 uta = None
7491 result = None
7492 uta, params = self.handle_option_and_params(params, 'fetchPosition', 'uta', False)
7493 if uta:
7494 request['category'] = productType
7495 response = self.privateUtaGetV3PositionCurrentPosition(self.extend(request, params))
7496 #
7497 # {
7498 # "code": "00000",
7499 # "msg": "success",
7500 # "requestTime": 1750929905423,
7501 # "data": {
7502 # "list": [
7503 # {
7504 # "category": "USDT-FUTURES",
7505 # "symbol": "BTCUSDT",
7506 # "marginCoin": "USDT",
7507 # "holdMode": "hedge_mode",
7508 # "posSide": "long",
7509 # "marginMode": "crossed",
7510 # "positionBalance": "5.435199",
7511 # "available": "0.001",
7512 # "frozen": "0",
7513 # "total": "0.001",
7514 # "leverage": "20",
7515 # "curRealisedPnl": "0",
7516 # "avgPrice": "107410.3",
7517 # "positionStatus": "normal",
7518 # "unrealisedPnl": "0.0047",
7519 # "liquidationPrice": "0",
7520 # "mmr": "0.004",
7521 # "profitRate": "0.0008647337475591",
7522 # "markPrice": "107415.3",
7523 # "breakEvenPrice": "107539.2",
7524 # "totalFunding": "0",
7525 # "openFeeTotal": "-0.06444618",
7526 # "closeFeeTotal": "0",
7527 # "createdTime": "1750495670699",

Callers

nothing calls this directly

Calls 10

parse_positionMethod · 0.95
safe_dictMethod · 0.80
safe_listMethod · 0.80
load_marketsMethod · 0.45
marketMethod · 0.45
extendMethod · 0.45

Tested by

no test coverage detected