获取持仓信息 - GET_UNIT_POSITION

GET_UNIT_POSITION(unit_id, symbol)
Arguments:
  • unit_id (string) -- 指定交易单元。
  • symbol (string) -- 指定合约。
Returns:

返回账户全部持仓对象。

参数说明

unit_id 表示交易单元,用于分类管理订单。

symbol 表示指定合约,格式为 交易所代码.合约代码

关于 order_id 和 unit_id 的说明

关于 symbol 的说明

用法示例

查看当前账户指定合约下指定 unit_id 的持仓信息:

const TQ = new TQSDK();
var position = TQ.GET_UNIT_POSITION('spl', 'SHFE.cu1809');

返回数据结构示例

返回全部持仓信息:

{
    "exchange_id": "SHFE",                        //交易所代码
    "instrument_id": "cu1801",                    //合约代码
    "volume_long": 5,                             //多头持仓手数
    "volume_short": 5,                            //空头持仓手数
    "hedge_flag": "SPEC",                         //套保标记
    //参考字段
    "open_price_long": 3203.5,                    //多头开仓均价
    "open_price_short": 3100.5,                   //空头开仓均价
    "open_cost_long": 3203.5,                     //多头开仓市值
    "open_cost_short": 3100.5,                    //空头开仓市值
    "margin": 32324.4,                            //占用保证金
    "float_profit_long": 32324.4,                 //多头浮动盈亏
    "float_profit_short": 32324.4,                //空头浮动盈亏
    "volume_long_today": 5,                       //多头今仓手数
    "volume_long_his": 5,                         //多头老仓手数
    "volume_long_frozen": 5,                      //多头持仓冻结
    "volume_long_frozen_today": 5,                //多头今仓冻结
    "volume_short_today": 5,                      //空头今仓手数
    "volume_short_his": 5,                        //空头老仓手数
    "volume_short_frozen": 5,                     //空头持仓冻结
    "volume_short_frozen_today": 5,               //空头今仓冻结
}