EasyFut

获取当前持仓

GET /position

传参:

字段名类型是否必传字段说明
----

响应参数(参考TqSdk官方文档: https://doc.shinnytech.com/tqsdk/latest/reference/tqsdk.objs.html#tqsdk.objs.Position)

注意:当前持仓为0但是当日有过交易的合约,也会出现在响应结果中,如果想精确获取有持仓的合约,请在结果中根据 pos != 0 自行过滤。

字段名类型字段说明
exchange_idstr交易所
instrument_idstr交易所内的合约代码
pos_long_hisint多头老仓手数
pos_long_todayint多头今仓手数
pos_short_hisint空头老仓手数
pos_short_todayint空头今仓手数
volume_long_todayint期货公司查询的多头今仓手数 (不推荐, 推荐使用pos_long_today)
volume_long_hisint期货公司查询的多头老仓手数 (不推荐, 推荐使用pos_long_his)
volume_longint期货公司查询的多头手数 (不推荐, 推荐使用pos_long)
volume_long_frozen_todayint期货公司查询的多头今仓冻结 (不推荐)
volume_long_frozen_hisint期货公司查询的多头老仓冻结 (不推荐)
volume_long_frozenint期货公司查询的多头持仓冻结 (不推荐)
volume_short_todayint期货公司查询的空头今仓手数 (不推荐, 推荐使用pos_short_today)
volume_short_hisint期货公司查询的空头老仓手数 (不推荐, 推荐使用pos_short_his)
volume_shortint期货公司查询的空头手数 (不推荐, 推荐使用pos_short)
volume_short_frozen_todayint期货公司查询的空头今仓冻结 (不推荐)
volume_short_frozen_hisint期货公司查询的空头老仓冻结 (不推荐)
volume_short_frozenint期货公司查询的空头持仓冻结 (不推荐)
open_price_longfloat多头开仓均价,以开仓价来统计
open_price_shortfloat空头开仓均价,以开仓价来统计
open_cost_longfloat多头开仓成本,为开仓价乘以手数
open_cost_shortfloat空头开仓成本,为开仓价乘以手数
position_price_longfloat多头持仓均价,为多头持仓成本除以多头数量
position_price_shortfloat空头持仓均价,为空头持仓成本除以空头数量
position_cost_longfloat多头持仓成本,为今仓的开仓价乘以手数加上昨仓的昨结算价乘以手数的和
position_cost_shortfloat空头持仓成本,为今仓的开仓价乘以手数加上昨仓的昨结算价乘以手数的和
float_profit_longfloat多头浮动盈亏
float_profit_shortfloat空头浮动盈亏
float_profitfloat浮动盈亏 (浮动盈亏: 相对于开仓价的盈亏)
position_profit_longfloat多头持仓盈亏
position_profit_shortfloat空头持仓盈亏
position_profitfloat持仓盈亏 (持仓盈亏: 相对于上一交易日结算价的盈亏),期权持仓盈亏为 0
margin_longfloat多头占用保证金
margin_shortfloat空头占用保证金
marginfloat占用保证金
market_value_longfloat期权权利方市值(始终 >= 0)
market_value_shortfloat期权义务方市值(始终 <= 0)
market_valuefloat期权市值
posint净持仓手数, ==0表示无持仓或多空持仓手数相等. <0表示空头持仓大于多头持仓, >0表示多头持仓大于空头持仓
pos_longint多头持仓手数, ==0表示无多头持仓. >0表示多头持仓手数
pos_shortint空头持仓手数, ==0表示无空头持仓. >0表示空头持仓手数

请求示例:

curl http://127.0.0.1:8888/position

响应示例:

{
  "code": 10000,
  "data": {
    "SHFE.rb2309": {
      "exchange_id": "SHFE",
      "instrument_id": "rb2309",
      "pos_long_his": 0,
      "pos_long_today": 1,
      "pos_short_his": 0,
      "pos_short_today": 0,
      "volume_long_today": 1,
      "volume_long_his": 0,
      "volume_long": 1,
      "volume_long_frozen_today": 0,
      "volume_long_frozen_his": 0,
      "volume_long_frozen": 0,
      "volume_short_today": 0,
      "volume_short_his": 0,
      "volume_short": 0,
      "volume_short_frozen_today": 0,
      "volume_short_frozen_his": 0,
      "volume_short_frozen": 0,
      "open_price_long": 3642.0,
      "open_price_short": 0.0,
      "open_cost_long": 36420.0,
      "open_cost_short": 0.0,
      "position_price_long": 3642.0,
      "position_price_short": 0.0,
      "position_cost_long": 36420.0,
      "position_cost_short": 0.0,
      "float_profit_long": 0.0,
      "float_profit_short": 0.0,
      "float_profit": 0.0,
      "position_profit_long": 0.0,
      "position_profit_short": 0.0,
      "position_profit": 0.0,
      "margin_long": 2924.8,
      "margin_short": 0.0,
      "margin": 2924.8,
      "market_value_long": 0.0,
      "market_value_short": 0.0,
      "market_value": 0.0,
      "pos": 1,
      "pos_long": 1,
      "pos_short": 0,
      "user_id": "436abcd6-4348-4cb9-b421-db8ed7e2d442",
      "volume_long_yd": 0,
      "volume_short_yd": 0,
      "last_price": 3642.0
    }
  },
  "msg": "操作成功!"
}