1. 查询账户成交记录
GET /v1/api/trade/deal?serverId={serverId}&accountId={accountId}&from={from}&to={to}
根据账户LOGIN查询账户成交信息
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 |
开仓价 |
closeTime |
string |
平仓时间 |
closePrice |
double |
平仓价 |
type |
string |
买卖类型 |
symbol |
string |
交易货币 |
volume |
double |
交易量 |
profit |
double |
盈亏 |
swap |
double |
隔夜利息 |
commission |
double |
佣金 |
sl |
double |
止损 |
tp |
double |
止盈 |
Example
请求示例
GET /v1/api/trade/deal?serverId=428&accountId=1122334496
返回示例:成功
{
"data": [
{
"accountId": 1122334496,
"closePrice": 100.426,
"closeTime": "2016-08-17 14:50:30",
"commission": 0,
"openPrice": 105.67,
"openTime": "2016-07-21 09:32:52",
"profit": 522.18,
"swap": -0.03,
"symbol": "USDJPY",
"ticket": 192290,
"type": "sell",
"volume": 0.1
},
{
"accountId": 1122334496,
"closePrice": 1.1275,
"closeTime": "2016-08-17 14:50:30",
"commission": -1,
"openPrice": 1.10639,
"openTime": "2016-07-20 02:31:22",
"profit": -2111,
"swap": -0.28,
"symbol": "EURUSD",
"ticket": 192249,
"type": "sell",
"volume": 1
},
{
"accountId": 1122334496,
"closePrice": 1.39099,
"closeTime": "2016-08-17 14:50:29",
"commission": -1,
"openPrice": 1.10639,
"openTime": "2016-07-19 10:56:20",
"profit": -28460,
"swap": -0.29,
"symbol": "EURUSD",
"ticket": 192246,
"type": "sell",
"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 |
服务异常,请稍后再试 |