def position_list_query(self, code='', pl_ratio_min=None,
                            pl_ratio_max=None, trd_env=TrdEnv.REAL, acc_id=0, acc_index=0):
        """for querying the position list"""
        ret, msg = self._check_trd_env(trd_env)
        if ret != RET_OK:
            return ret, msg

        ret, msg, acc_id = self._check_acc_id_and_acc_index(trd_env, acc_id, acc_index)
        if ret != RET_OK:
            return ret, msg

        ret, msg, stock_code = self._check_stock_code(code)
        if ret != RET_OK:
            return ret, msg

        query_processor = self._get_sync_query_processor(
            PositionListQuery.pack_req, PositionListQuery.unpack_rsp)

        kargs = {
            'code': str(stock_code),
            'pl_ratio_min': pl_ratio_min,
            'pl_ratio_max': pl_ratio_max,
            'trd_mkt': self.__trd_mkt,
            'trd_env': trd_env,
            'acc_id': acc_id,
            'conn_id': self.get_sync_conn_id()
        }
        ret_code, msg, position_list = query_processor(**kargs)

        if ret_code != RET_OK:
            return RET_ERROR, msg

        col_list = [
            "code", "stock_name", "qty", "can_sell_qty", "cost_price",
            "cost_price_valid", "market_val", "nominal_price", "pl_ratio",
            "pl_ratio_valid", "pl_val", "pl_val_valid", "today_buy_qty",
            "today_buy_val", "today_pl_val", "today_sell_qty", "today_sell_val",
            "position_side"
        ]

        position_list_table = pd.DataFrame(position_list, columns=col_list)
        return RET_OK, position_list_table
def position_list_query ( self , code = '' , pl_ratio_min = None , pl_ratio_max = None , trd_env = TrdEnv . REAL , acc_id = 0 , acc_index = 0 ) : ret , msg = self . _check_trd_env ( trd_env ) if ret != RET_OK : return ret , msg ret , msg , acc_id = self . _check_acc_id_and_acc_index ( trd_env , acc_id , acc_index ) if ret != RET_OK : return ret , msg ret , msg , stock_code = self . _check_stock_code ( code ) if ret != RET_OK : return ret , msg query_processor = self . _get_sync_query_processor ( PositionListQuery . pack_req , PositionListQuery . unpack_rsp ) kargs = { 'code' : str ( stock_code ) , 'pl_ratio_min' : pl_ratio_min , 'pl_ratio_max' : pl_ratio_max , 'trd_mkt' : self . __trd_mkt , 'trd_env' : trd_env , 'acc_id' : acc_id , 'conn_id' : self . get_sync_conn_id ( ) } ret_code , msg , position_list = query_processor ( ** kargs ) if ret_code != RET_OK : return RET_ERROR , msg col_list = [ "code" , "stock_name" , "qty" , "can_sell_qty" , "cost_price" , "cost_price_valid" , "market_val" , "nominal_price" , "pl_ratio" , "pl_ratio_valid" , "pl_val" , "pl_val_valid" , "today_buy_qty" , "today_buy_val" , "today_pl_val" , "today_sell_qty" , "today_sell_val" , "position_side" ] position_list_table = pd . DataFrame ( position_list , columns = col_list ) return RET_OK , position_list_table
for querying the position list