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

Method fetchPosition

ts/src/woo.ts:3794–3836  ·  view source on GitHub ↗

* @method * @name woo#fetchPosition * @description fetch data on an open position * @see https://developer.woox.io/api-reference/endpoint/futures/get_positions * @param {string} symbol unified market symbol of the market the position is held in * @param {object} [params] ext

(symbol: Str, params = {})

Source from the content-addressed store, hash-verified

3792 * @returns {object} a [position structure]{@link https://docs.ccxt.com/?id=position-structure}
3793 */
3794 async fetchPosition (symbol: Str, params = {}) {
3795 await this.loadMarkets ();
3796 const market = this.market ((symbol as string));
3797 const request: Dict = {
3798 'symbol': market['id'],
3799 };
3800 const response = await this.v3PrivateGetFuturesPositions (this.extend (request, params));
3801 //
3802 // {
3803 // "success": true,
3804 // "data": {
3805 // "positions": [
3806 // {
3807 // "symbol": "PERP_LTC_USDT",
3808 // "holding": "0.1",
3809 // "pendingLongQty": "0",
3810 // "pendingShortQty": "0",
3811 // "settlePrice": "96.87",
3812 // "averageOpenPrice": "96.87",
3813 // "pnl24H": "0",
3814 // "fee24H": "0.0048435",
3815 // "markPrice": "96.83793449",
3816 // "estLiqPrice": "0",
3817 // "timestamp": 1752500555823,
3818 // "adlQuantile": 2,
3819 // "positionSide": "BOTH",
3820 // "marginMode": "CROSS",
3821 // "isolatedMarginToken": "",
3822 // "isolatedMarginAmount": "0",
3823 // "isolatedFrozenLong": "0",
3824 // "isolatedFrozenShort": "0",
3825 // "leverage": 10
3826 // }
3827 // ]
3828 // },
3829 // "timestamp": 1752500579848
3830 // }
3831 //
3832 const result = this.safeDict (response, 'data', {});
3833 const positions = this.safeList (result, 'positions', []);
3834 const first = this.safeDict (positions, 0, {});
3835 return this.parsePosition (first, market);
3836 }
3837
3838 /**
3839 * @method

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected