async def get_position(self, symbol):
    " 获取当前持仓\n\n        Args:\n            symbol: Trade target\n\n        Returns:\n            position: Position if successfully, otherwise it's None.\n            error: Error information, otherwise it's None.\n        "
    (success, error) = (await self._rest_api.get_positions(True))
    if error:
        return (None, error)
    if (not success['success']):
        return (None, 'get_position error')
    p = next(filter((lambda x: (x['future'] == symbol)), success['result']), None)
    if (p == None):
        return (Position(self._platform, self._account, self._strategy, symbol), None)
    if (p['netSize'] == 0):
        return (Position(self._platform, self._account, self._strategy, symbol), None)
    pos = Position(self._platform, self._account, self._strategy, symbol)
    pos.margin_mode = MARGIN_MODE_CROSSED
    pos.utime = tools.get_cur_timestamp_ms()
    if (p['netSize'] < 0):
        pos.long_quantity = 0
        pos.long_avail_qty = 0
        pos.long_open_price = 0
        pos.long_hold_price = 0
        pos.long_liquid_price = 0
        pos.long_unrealised_pnl = 0
        pos.long_leverage = 0
        pos.long_margin = 0
        pos.short_quantity = abs(p['netSize'])
        pos.short_avail_qty = ((pos.short_quantity - p['longOrderSize']) if (p['longOrderSize'] < pos.short_quantity) else 0)
        pos.short_open_price = p['recentAverageOpenPrice']
        pos.short_hold_price = p['entryPrice']
        pos.short_liquid_price = p['estimatedLiquidationPrice']
        pos.short_unrealised_pnl = p['unrealizedPnl']
        pos.short_leverage = int((1 / p['initialMarginRequirement']))
        pos.short_margin = p['collateralUsed']
    else:
        pos.long_quantity = abs(p['netSize'])
        pos.long_avail_qty = ((pos.long_quantity - p['shortOrderSize']) if (p['shortOrderSize'] < pos.long_quantity) else 0)
        pos.long_open_price = p['recentAverageOpenPrice']
        pos.long_hold_price = p['entryPrice']
        pos.long_liquid_price = p['estimatedLiquidationPrice']
        pos.long_unrealised_pnl = p['unrealizedPnl']
        pos.long_leverage = int((1 / p['initialMarginRequirement']))
        pos.long_margin = p['collateralUsed']
        pos.short_quantity = 0
        pos.short_avail_qty = 0
        pos.short_open_price = 0
        pos.short_hold_price = 0
        pos.short_liquid_price = 0
        pos.short_unrealised_pnl = 0
        pos.short_leverage = 0
        pos.short_margin = 0
    return (pos, None)
获取当前持仓

Args:
    symbol: Trade target

Returns:
    position: Position if successfully, otherwise it's None.
    error: Error information, otherwise it's None.
async def get_position(self, symbol):
    " 获取当前持仓\n\n        Args:\n            symbol: Trade target\n\n        Returns:\n            position: Position if successfully, otherwise it's None.\n            error: Error information, otherwise it's None.\n        "
    (success, error) = (await self._rest_api.get_positions(True))
    if error:
        return (None, error)
    if (not success['success']):
        return (None, 'get_position error')
    p = next(filter((lambda x: (x['future'] == symbol)), success['result']), None)
    if (p == None):
        return (Position(self._platform, self._account, self._strategy, symbol), None)
    if (p['netSize'] == 0):
        return (Position(self._platform, self._account, self._strategy, symbol), None)
    pos = Position(self._platform, self._account, self._strategy, symbol)
    pos.margin_mode = MARGIN_MODE_CROSSED
    pos.utime = tools.get_cur_timestamp_ms()
    if (p['netSize'] < 0):
        pos.long_quantity = 0
        pos.long_avail_qty = 0
        pos.long_open_price = 0
        pos.long_hold_price = 0
        pos.long_liquid_price = 0
        pos.long_unrealised_pnl = 0
        pos.long_leverage = 0
        pos.long_margin = 0
        pos.short_quantity = abs(p['netSize'])
        pos.short_avail_qty = ((pos.short_quantity - p['longOrderSize']) if (p['longOrderSize'] < pos.short_quantity) else 0)
        pos.short_open_price = p['recentAverageOpenPrice']
        pos.short_hold_price = p['entryPrice']
        pos.short_liquid_price = p['estimatedLiquidationPrice']
        pos.short_unrealised_pnl = p['unrealizedPnl']
        pos.short_leverage = int((1 / p['initialMarginRequirement']))
        pos.short_margin = p['collateralUsed']
    else:
        pos.long_quantity = abs(p['netSize'])
        pos.long_avail_qty = ((pos.long_quantity - p['shortOrderSize']) if (p['shortOrderSize'] < pos.long_quantity) else 0)
        pos.long_open_price = p['recentAverageOpenPrice']
        pos.long_hold_price = p['entryPrice']
        pos.long_liquid_price = p['estimatedLiquidationPrice']
        pos.long_unrealised_pnl = p['unrealizedPnl']
        pos.long_leverage = int((1 / p['initialMarginRequirement']))
        pos.long_margin = p['collateralUsed']
        pos.short_quantity = 0
        pos.short_avail_qty = 0
        pos.short_open_price = 0
        pos.short_hold_price = 0
        pos.short_liquid_price = 0
        pos.short_unrealised_pnl = 0
        pos.short_leverage = 0
        pos.short_margin = 0
    return (pos, None)