fetch positions risk https://asterdex.github.io/aster-api-website/futures-v3/account%26trades/#position-information-v3-user_data :param str[]|None symbols: list of unified market symbols :param dict [params]: extra parameters specific to the exchange API endpoint
(self, symbols: Strings = None, params={})
| 3386 | }) |
| 3387 | |
| 3388 | def fetch_positions_risk(self, symbols: Strings = None, params={}): |
| 3389 | """ |
| 3390 | fetch positions risk |
| 3391 | |
| 3392 | https://asterdex.github.io/aster-api-website/futures-v3/account%26trades/#position-information-v3-user_data |
| 3393 | |
| 3394 | :param str[]|None symbols: list of unified market symbols |
| 3395 | :param dict [params]: extra parameters specific to the exchange API endpoint |
| 3396 | :returns dict: data on the positions risk |
| 3397 | """ |
| 3398 | if symbols is not None: |
| 3399 | if not isinstance(symbols, list): |
| 3400 | raise ArgumentsRequired(self.id + ' fetchPositionsRisk() requires an array argument for symbols') |
| 3401 | self.load_markets_and_sign_in() |
| 3402 | self.load_leverage_brackets(False, params) |
| 3403 | request = {} |
| 3404 | response = self.fapiPrivateGetV3PositionRisk(self.extend(request, params)) |
| 3405 | # |
| 3406 | # [ |
| 3407 | # { |
| 3408 | # "entryPrice": "6563.66500", |
| 3409 | # "marginType": "isolated", |
| 3410 | # "isAutoAddMargin": "false", |
| 3411 | # "isolatedMargin": "15517.54150468", |
| 3412 | # "leverage": "10", |
| 3413 | # "liquidationPrice": "5930.78", |
| 3414 | # "markPrice": "6679.50671178", |
| 3415 | # "maxNotionalValue": "20000000", |
| 3416 | # "positionSide": "LONG", |
| 3417 | # "positionAmt": "20.000", # negative value for 'SHORT' |
| 3418 | # "symbol": "BTCUSDT", |
| 3419 | # "unRealizedProfit": "2316.83423560", |
| 3420 | # "updateTime": 1625474304765 |
| 3421 | # } |
| 3422 | # ] |
| 3423 | # |
| 3424 | result = [] |
| 3425 | for i in range(0, len(response)): |
| 3426 | rawPosition = response[i] |
| 3427 | entryPriceString = self.safe_string(rawPosition, 'entryPrice') |
| 3428 | if Precise.string_gt(entryPriceString, '0'): |
| 3429 | result.append(self.parse_position_risk(response[i])) |
| 3430 | symbols = self.market_symbols(symbols) |
| 3431 | return self.filter_by_array_positions(result, 'symbol', symbols, False) |
| 3432 | |
| 3433 | def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]: |
| 3434 | """ |
no test coverage detected