/** ================================= 仓单贸易v2 ================================**/

import { commonSearch_go } from "@/services/go";
import {
    QueryOrderQuoteDetailReq,
    QueryOrderQuoteReq, QueryWrOrderDetailReq, QueryWrPositionReq, QueryWrTradeDetailReq, WrOrderDetail,
    WrOrderQuote,
    WrOrderQuoteDetail, WrPosition, WrTradeDetail
} from "@/services/go/wrtrade/interface";


/**
 * 查询大厅行情列表 /WrTrade2/QueryOrderQuote
 * @param req
 */
export function queryOrderQuote(req: QueryOrderQuoteReq): Promise<WrOrderQuote[]> {
    return commonSearch_go('/WrTrade2/QueryOrderQuote', { req }).catch((err) => {
        throw new Error(`查询大厅行情列表: ${err}`);
    });
}

/**
 * 查询买卖大厅 /WrTrade2/QueryOrderQuoteDetail
 * @param req
 */
export function queryOrderQuoteDetail(req: QueryOrderQuoteDetailReq): Promise<WrOrderQuoteDetail[]> {
    return commonSearch_go('/WrTrade2/QueryOrderQuoteDetail', { req }).catch((err) => {
        throw new Error(`查询买卖大厅: ${err}`);
    });
}



/**
 *  查询仓单委托单(挂单) /WrTrade2/QueryWrOrderDetail
 * @param req
 */
export function queryWrOrderDetail(req: QueryWrOrderDetailReq): Promise<WrOrderDetail[]> {
    return commonSearch_go('/WrTrade2/QueryWrOrderDetail', { req }).catch((err) => {
        throw new Error(`查询仓单委托单(挂单): ${err}`);
    });
}

/**
 * 查询现货(预售)仓单持仓 /WrTrade2/QueryWrPosition
 */
export function queryWrPosition(req: QueryWrPositionReq): Promise<WrPosition[]> {
    return commonSearch_go('/WrTrade2/QueryWrPosition', { req }).catch((err) => {
        throw new Error(`查询现货(预售)仓单持仓: ${err}`);
    });
}

/**
 * 查询仓单成交明细 /WrTrade2/QueryWrTradeDetail
 */
export function queryWrTradeDetail(req: QueryWrTradeDetailReq): Promise<WrTradeDetail[]> {
    return commonSearch_go('/WrTrade2/QueryWrTradeDetail', { req }).catch((err) => {
        throw new Error(`查询仓单成交明细: ${err}`);
    });
}