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

Method fetchPosition

js/src/bitget.js:7965–8059  ·  view source on GitHub ↗

* @method * @name bitget#fetchPosition * @description fetch data on a single open contract trade position * @see https://www.bitget.com/api-doc/contract/position/get-single-position * @see https://www.bitget.com/api-doc/uta/trade/Get-Position * @param {string} symbol unified

(symbol, params = {})

Source from the content-addressed store, hash-verified

7963 * @returns {object} a [position structure]{@link https://docs.ccxt.com/?id=position-structure}
7964 */
7965 async fetchPosition(symbol, params = {}) {
7966 await this.loadMarkets();
7967 const market = this.market(symbol);
7968 let productType = undefined;
7969 [productType, params] = this.handleProductTypeAndParams(market, params);
7970 const request = {
7971 'symbol': market['id'],
7972 };
7973 let response = undefined;
7974 let uta = undefined;
7975 let result = undefined;
7976 [uta, params] = this.handleOptionAndParams(params, 'fetchPosition', 'uta', false);
7977 if (uta) {
7978 request['category'] = productType;
7979 response = await this.privateUtaGetV3PositionCurrentPosition(this.extend(request, params));
7980 //
7981 // {
7982 // "code": "00000",
7983 // "msg": "success",
7984 // "requestTime": 1750929905423,
7985 // "data": {
7986 // "list": [
7987 // {
7988 // "category": "USDT-FUTURES",
7989 // "symbol": "BTCUSDT",
7990 // "marginCoin": "USDT",
7991 // "holdMode": "hedge_mode",
7992 // "posSide": "long",
7993 // "marginMode": "crossed",
7994 // "positionBalance": "5.435199",
7995 // "available": "0.001",
7996 // "frozen": "0",
7997 // "total": "0.001",
7998 // "leverage": "20",
7999 // "curRealisedPnl": "0",
8000 // "avgPrice": "107410.3",
8001 // "positionStatus": "normal",
8002 // "unrealisedPnl": "0.0047",
8003 // "liquidationPrice": "0",
8004 // "mmr": "0.004",
8005 // "profitRate": "0.0008647337475591",
8006 // "markPrice": "107415.3",
8007 // "breakEvenPrice": "107539.2",
8008 // "totalFunding": "0",
8009 // "openFeeTotal": "-0.06444618",
8010 // "closeFeeTotal": "0",
8011 // "createdTime": "1750495670699",
8012 // "updatedTime": "1750929883465"
8013 // }
8014 // ]
8015 // }
8016 // }
8017 //
8018 const data = this.safeDict(response, 'data', {});
8019 result = this.safeList(data, 'list', []);
8020 }
8021 else {
8022 request['marginCoin'] = market['settleId'];

Callers

nothing calls this directly

Calls 10

parsePositionMethod · 0.95
loadMarketsMethod · 0.45
marketMethod · 0.45
handleOptionAndParamsMethod · 0.45
extendMethod · 0.45
safeDictMethod · 0.45
safeListMethod · 0.45

Tested by

no test coverage detected