> ## Documentation Index
> Fetch the complete documentation index at: https://docs.monochrome.exchange/llms.txt
> Use this file to discover all available pages before exploring further.

# 账户与仓位

> 合约 API：账户与仓位。

## 获取合约账户资产

`GET` `/future/user/v1/compat/balance/list`

**Parameters**

| 参数 | 数据类型 | 是否必须 | 默认值 | 描述 | 取值范围 |
| - | - | - | - | - | - |
| queryAccountId | string | false | N/A | 账户id | |

### 限流规则

200/s/apikey

```json Response theme={null}
{
  "error": {
    "code": "",
    "msg": ""
  },
  "msgInfo": "",
  "result": [
    {
        "accountId": 500000000000, // 账户id
        "userId": 500000000000, // 用户id
        "coin": "usdt", // 币种
        "underlyingType": 2, // 币本位，u本位
        "walletBalance": "2078.57264793", // 币种余额
        "openOrderMarginFrozen": "0", // 订单冻结
        "isolatedMargin": "0", // 保证金冻结
        "crossedMargin": "0", // 全仓保证金冻结
        "amount": "2078.57264793", // 净资产余额
        "totalAmount": "2078.57264793", // 保证金余额
        "convertBtcAmount": "0.03638940", // walletBalance钱包资产折算 BTC
        "convertUsdtAmount": "2078.5726", // walletBalance钱包资产折算 USDT
        "profit": "0", // 已盈亏
        "notProfit": "0", // 未实现盈亏
        "bonus": "0", // 体验金
        "coupon": "0" // 抵扣金
    }
 ],
  "returnCode": 0
```

## 获取账户相关信息

`GET` `/future/user/v1/account/info`

### 限流规则

200/s/apikey

```json Response theme={null}
{
  "error": {
    "code": "",
    "msg": ""
  },
  "msgInfo": "",
  "result": {
    "accountId": 0, //帐户id
    "allowOpenPosition": false, //是否可开仓
    "allowTrade": false, //是否可以交易
    "allowTransfer": false, //是否可以划转
    "openTime": "", //开通时间
    "state": 0, //用户状态
    "userId": 0 //用户id
  },
  "returnCode": 0
}
```

## 获取listenKey

`GET` `/future/user/v1/user/listen-key`

注：**有效时间为8小时**

### 限流规则

200/s/apikey

```json Response theme={null}
{
  "error": {
    "code": "",
    "msg": ""
  },
  "msgInfo": "",
  "result": {},
  "returnCode": 0
}
```

## 开通合约

`POST` `/future/user/v1/account/open`

### 限流规则

200/s/apikey

```json Response theme={null}
{
  "error": {
    "code": "",
    "msg": ""
  },
  "msgInfo": "",
  "result": true,
  "returnCode": 0
}
```

## 获取用户单币种资金

`GET` `/future/user/v1/balance/detail`

**Parameters**

| 参数 | 数据类型 | 是否必须 | 默认值 | 描述 | 取值范围 |
| - | - | - | - | - | - |
| coin | string | true | N/A | 币种 | |

### 限流规则

200/s/apikey

```json Response theme={null}
{
  "error": {
    "code": "",
    "msg": ""
  },
  "msgInfo": "",
  "result": {
    "availableBalance": 0,      //可用余额
    "coin": "",                 //币种
    "isolatedMargin": 0,        //逐仓保证金冻结
    "openOrderMarginFrozen": 0, //订单冻结
    "crossedMargin": 0,         //全仓起始保证金
    "bonus": 0,                 //体验金余额
    "coupon": 0,                //抵扣金余额
    "walletBalance": 0          //钱包余额
  },
  "returnCode": 0
}
```

## 获取用户资金

`GET` `/future/user/v1/balance/list`

### 限流规则

200/s/apikey

```json Response theme={null}
{
  "error": {
    "code": "",
    "msg": ""
  },
  "msgInfo": "",
  "result": [
    {
      "availableBalance": 0,      //可用余额
      "coin": "",                 //币种
      "isolatedMargin": 0,        //逐仓保证金冻结
      "openOrderMarginFrozen": 0, //订单冻结
      "crossedMargin": 0,         //全仓起始保证金
      "bonus": 0,                 //体验金余额
      "coupon": 0,                //抵扣金余额
      "walletBalance": 0          //钱包余额
    }
  ],
  "returnCode": 0
}
```

## 获取用户账务流水

`GET` `/future/user/v1/balance/bills`

**Parameters**

| 参数 | 数据类型 | 是否必须 | 默认值 | 描述 | 取值范围 |
| - | - | - | - | - | - |
| symbol | string | true | N/A | 交易对 | |
| direction | string | false | NEXT | 方向（PREV:上一页；NEXT:下一页） | PREV;NEXT |
| id | integer | false | N/A | id | |
| limit | integer | false | 10 | 条数 | |
| startTime | integer | false | N/A | 起始时间 | |
| endTime | integer | false | N/A | 结束时间 | |

### 限流规则

200/s/apikey

```json Response theme={null}
{
  "error": {
    "code": "",
    "msg": ""
  },
  "msgInfo": "",
  "result": {
    "hasNext": false, //是否有下一页
    "hasPrev": false, //是否有上一页
    "items": [ //数据列表
      {
        "afterAmount": 0, //变动后余额
        "amount": 0, //数量
        "coin": "", //币种
        "createdTime": 0, //时间
        "id": 0, //id
        "side": "", //ADD:划入;SUB:转出
        "symbol": "", //交易对
        "type": "" //EXCHANGE:划转;CLOSE_POSITION:平仓盈亏;TAKE_OVER:仓位接管;QIANG_PING_MANAGER:强平管理费（手续费）;FUND:资金费用;FEE:手续费 (开仓、平仓、强平);ADL:自动减仓;TAKE_OVER:仓位接管MERGE:仓位合并
      }
    ]
  },
  "returnCode": 0
}
```

## 获取资金费用

`GET` `/future/user/v1/balance/funding-rate-list`

**Parameters**

| 参数 | 数据类型 | 是否必须 | 默认值 | 描述 | 取值范围 |
| - | - | - | - | - | - |
| symbol | string | false | N/A | 交易对 | |
| direction | string | false | NEXT | 方向（PREV:上一页；NEXT:下一页） | PREV;NEXT |
| id | integer | false | N/A | id | |
| limit | integer | false | 10 | 条数 | |
| startTime | integer | false | N/A | 起始时间 | |
| endTime | integer | false | N/A | 结束时间 | |

### 限流规则

200/s/apikey

```json Response theme={null}
{
  "error": {
    "code": "",
    "msg": ""
  },
  "msgInfo": "",
  "result": {
    "hasNext": false, //是否有下一页
    "hasPrev": false, //是否有上一页
    "items": [ //数据列表
      {
        "cast": 0, //资金费用
        "coin": "", //币种
        "createdTime": 0, //时间
        "id": 0, //id
        "positionSide": "", //方向
        "symbol": "" //交易对
      }
    ]
  },
  "returnCode": 0
}
```

## 获取活跃持仓信息

`GET` `/future/user/v1/position`

**Parameters**

| 参数 | 数据类型 | 是否必须 | 默认值 | 描述 | 取值范围 |
| - | - | - | - | - | - |
| symbol | string | false | N/A | 交易对（不传时查询所有交易对的持仓信息） | |

### 限流规则

200/s/apikey

```json Response theme={null}
{
  "error": {
    "args": [],
    "code": "",
    "msg": ""
  },
  "msgInfo": "",
  "result": [
    {
      "autoMargin": false, // 是否自动追加保证金
      "availableCloseSize": 0, // 可平仓数量（张）
      "breakPrice": 0, // 爆仓价格
      "calMarkPrice": 0, // 计算标记价格
      "closeOrderSize": 0, // 平仓挂单数量（张）
      "contractType": "", // 合约类型：PERPETUAL（永续合约）、PREDICT（预测合约）
      "entryPrice": 0, // 开仓均价
      "floatingPL": 0, // 未实现盈亏
      "isolatedMargin": 0, // 逐仓保证金
      "leverage": 0, // 杠杆倍数
      "openOrderMarginFrozen": 0, // 开仓订单保证金占用
      "openOrderSize": 0, // 开仓订单占用
      "positionSide": "", // 持仓方向
      "positionSize": 0, // 持仓数量（张）
      "positionType": "", // 仓位类型：CROSSED（全仓）；ISOLATED（逐仓）
      "profitId": 0, // 止盈止损id
      "realizedProfit": 0, // 已实现盈亏
      "symbol": "", // 交易对
      "triggerPriceType": "", // 触发价格类型 1、指数价格2：标记价格（合理价格）；3：最新价
      "triggerProfitPrice": 0, // 止盈触发价
      "triggerStopPrice": 0, // 止损触发价
      "welfareAccount": true
    }
  ],
  "returnCode": 0
}
```

## 获取持仓信息

`GET` `/future/user/v1/position/list`

**Parameters**

| 参数 | 数据类型 | 是否必须 | 默认值 | 描述 | 取值范围 |
| - | - | - | - | - | - |
| symbol | string | false | N/A | 交易对（不传时查询所有交易对的持仓信息） | |

### 限流规则

200/s/apikey

```json Response theme={null}
{
  "error": {
    "code": "",
    "msg": ""
  },
  "msgInfo": "",
  "result": [
    {
      "autoMargin": false, //是否自动追加保证金
      "availableCloseSize": 0, //可平仓数量（张）
      "closeOrderSize": 0, //平仓挂单数量（张）
      "entryPrice": 0, //开仓均价
      "isolatedMargin": 0, //逐仓保证金
      "leverage": 0, //杠杆倍数
      "openOrderMarginFrozen": 0, //开仓订单保证金占用
      "positionSide": "", //持仓方向
      "positionSize": 0, //持仓数量（张）
      "positionType": "", //仓位类型
      "realizedProfit": 0, //已实现盈亏
      "symbol": "" //交易对
    }
  ],
  "returnCode": 0
}
```

## 获取用户阶梯费率

`GET` `/future/user/v1/user/step-rate`

### 限流规则

200/s/apikey

```json Response theme={null}
{
  "error": {
    "code": "",
    "msg": ""
  },
  "msgInfo": "success",
  "result": {
    "makerFee":"0.00004",
    "takerFee": "0.00001"
  },
  "returnCode": 0
}
```

## 调整杠杆倍数

`POST` `/future/user/v1/position/adjust-leverage`

Content-Type = application/x-www-form-urlencoded && application/json

**Parameters**

| 参数 | 数据类型 | 是否必须 | 默认值 | 描述 | 取值范围 |
| - | - | - | - | - | - |
| symbol | string | true | N/A | 交易对 | |
| positionSide | string | true | N/A | 仓位方向 | LONG;SHORT |
| leverage | integer | true | N/A | 杠杆倍数 | |

### 限流规则

200/s/apikey

```json Response theme={null}
{
  "error": {
    "code": "",
    "msg": ""
  },
  "msgInfo": "",
  "result": {},
  "returnCode": 0
}
```

## 修改保证金

`POST` `/future/user/v1/position/margin`

Content-Type = application/x-www-form-urlencoded && application/json

**Parameters**

| 参数 | 数据类型 | 是否必须 | 默认值 | 描述 | 取值范围 |
| - | - | - | - | - | - |
| symbol | string | true | N/A | 交易对 | |
| margin | number | false | N/A | 数量 | |
| positionSide | string | false | N/A | 持仓方向：LONG;SHORT | |
| type | string | false | N/A | 调整方向（ADD：增加逐仓保证金；SUB：减少逐仓保证金） | ADD;SUB |

### 限流规则

200/s/apikey

```json Response theme={null}
{
  "error": {
    "code": "",
    "msg": ""
  },
  "msgInfo": "",
  "result": {},
  "returnCode": 0
}
```

## 一键平仓

`POST` `/future/user/v1/position/close-all`

### 限流规则

200/s/apikey

```json Response theme={null}
{
  "error": {
    "code": "",
    "msg": ""
  },
  "msgInfo": "",
  "result": true,
  "returnCode": 0
}
```

## 获取ADL信息

`GET` `/future/user/v1/position/adl`

### 限流规则

200/s/apikey

```json Response theme={null}
{
  "error": {
    "code": "",
    "msg": ""
  },
  "msgInfo": "",
  "result": [
    {
      "longQuantile": 0, //多头adl
      "shortQuantile": 0, //空头adl
      "symbol": "" //交易对
    }
  ],
  "returnCode": 0
}
```

## 收藏交易对

`POST` `/future/user/v1/user/collection/add`

Content-Type = application/x-www-form-urlencoded && application/json

**Parameters**

| 参数 | 数据类型 | 是否必须 | 默认值 | 描述 | 取值范围 |
| - | - | - | - | - | - |
| symbol | string | true | N/A | 交易对 | |

### 限流规则

200/s/apikey

```json Response theme={null}
{
  "error": {
    "code": "",
    "msg": ""
  },
  "msgInfo": "",
  "result": true,
  "returnCode": 0
}
```

## 取消收藏交易对

`POST` `/future/user/v1/user/collection/cancel`

Content-Type = application/x-www-form-urlencoded && application/json

**Parameters**

| 参数 | 数据类型 | 是否必须 | 默认值 | 描述 | 取值范围 |
| - | - | - | - | - | - |
| symbol | string | true | N/A | 交易对 | |

### 限流规则

200/s/apikey

```json Response theme={null}
{
  "error": {
    "code": "",
    "msg": ""
  },
  "msgInfo": "",
  "result": true,
  "returnCode": 0
}
```

## 收藏交易对列表

`GET` `/future/user/v1/user/collection/list`

### 限流规则

200/s/apikey

```json Response theme={null}
{
  "error": {
    "code": "",
    "msg": ""
  },
  "msgInfo": "",
  "result": [],
  "returnCode": 0
}
```

## 修改持仓模式

`POST` `/future/user/v1/position/change-type`

Content-Type = application/x-www-form-urlencoded && application/json

**Parameters**

| 参数 | 数据类型 | 是否必须 | 默认值 | 描述 | 取值范围 |
| - | - | - | - | - | - |
| symbol | string | true | N/A | 交易对 | |
| positionSide | string | true | N/A | 仓位方向 | LONG;SHORT |
| positionType | string | true | N/A | 仓位类型 | CROSSED;ISOLATED |

### 限流规则

200/s/apikey

```json Response theme={null}
{
  "error": {
    "code": "",
    "msg": ""
  },
  "msgInfo": "",
  "result": {},
  "returnCode": 0
}
```

## 获取持仓爆仓信息

`GET` `/future/user/v1/position/break-list`

**Parameters**

| 参数 | 数据类型 | 是否必须 | 默认值 | 描述 | 取值范围 |
| - | - | - | - | - | - |
| symbol | string | false | N/A | 交易对（不传时查询所有交易对的持仓爆仓信息） | |

### 限流规则

200/s/apikey

```json Response theme={null}
{
  "error": {
    "code": "",
    "msg": ""
  },
  "msgInfo": "",
  "result": [
    {
      "breakPrice": 0,    //爆仓价格,0代表不爆仓
      "calMarkPrice": 0,  //计算标记价格
      "contractType": "", //合约类型：PERPETUAL(永续合约)、PREDICT(预测合约)
      "entryPrice": 0,    //开仓均价
      "isolatedMargin": 0,//逐仓保证金
      "leverage": 0,      //杠杆倍数
      "positionSide": "", //持仓方向
      "positionSize": 0,  //持仓数量（张）
      "positionType": "", //仓位类型:CROSSED(全仓);ISOLATED(逐仓)
      "symbol": ""        //交易对
    }
  ],
  "returnCode": 0
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.