1. 查询账户持仓

GET /v1/api/trade/position?serverId={serverId}&accountId={accountId}&from={from}&to={to}

根据账户LOGIN查询账户持仓信息

Request Headers

Name Required Type Description
x-api-tenantId yes string 租户编号
x-api-token yes string 认证token

Request Parameters

Name Required Type Description
serverId yes string 交易服务器ID
accountId yes string 账户login
from no int 时间开始范围,时间戳,单位毫秒
to no int 时间结束范围,时间戳,单位毫秒

Response

Name Type Description
result boolean 成功标识,返回true,表示请求成功,false表示请求失败
mcode string 错误码,成功时返回m00000,失败时返回对应的错误码,见文档默认错误码说明
data object 账户数据
errorMessage List 错误提示信息,部分错误码时有值
1、data数据类型
Name Type Description
accountId string 账户ID
ticket string 交易ID
openTime string 开仓时间
openPrice double 开仓价
type string 买卖类型
symbol string 交易货币
volume double 交易量
profit double 盈亏
sl double 止损
tp double 止盈

Example

请求示例

GET /v1/api/trade/position?serverId=428&accountId=1234580230

返回示例:成功

{
    "data": [
        {
            "accountId": 1234580230,
            "openPrice": 1.17294,
            "openTime": "2017-08-16 06:26:21",
            "profit": 1929,
            "sl": 0,
            "symbol": "EURUSD",
            "ticket": 3215317,
            "tp": 0,
            "type": "buy",
            "volume": 1
        },
        {
            "accountId": 1234580230,
            "openPrice": 1.17393,
            "openTime": "2017-08-16 03:25:53",
            "profit": 1830,
            "sl": 0,
            "symbol": "EURUSD",
            "ticket": 3215316,
            "tp": 0,
            "type": "buy",
            "volume": 1
        },
        {
            "accountId": 1234580230,
            "openPrice": 1.17394,
            "openTime": "2017-08-16 03:25:41",
            "profit": 1829,
            "sl": 0,
            "symbol": "EURUSD",
            "ticket": 3215315,
            "tp": 0,
            "type": "buy",
            "volume": 1
        },
        {
            "accountId": 1234580230,
            "openPrice": 1.17387,
            "openTime": "2017-08-16 03:24:37",
            "profit": -1855,
            "sl": 0,
            "symbol": "EURUSD",
            "ticket": 3215314,
            "tp": 0,
            "type": "sell",
            "volume": 1
        },
        {
            "accountId": 1234580230,
            "openPrice": 1.17263,
            "openTime": "2017-08-16 06:28:21",
            "profit": 1960,
            "sl": 0,
            "symbol": "EURUSD",
            "ticket": 3215313,
            "tp": 0,
            "type": "buy",
            "volume": 1
        }
    ],
    "mcode": "m0000000",
    "result": true
}

返回示例:失败

{
    "mcode":"m0000001",
    "errorMessage":"",
    "result":false
}

2. Error 错误处理

错误码表(Error Code)

mcode Message
BW_INVALID_PARAM 参数错误
BW_INVALID_SERVERID 无效serverId
-1 服务异常,请稍后再试

results matching ""

    No results matching ""